How do I make a character stop when it hits the terrain?

In the attached file I try to design an interactive animation where the character is a fish. All around the fish is a terrain. In Blender Game when pressing P the fish swimms (shakes tail etc) but no motion. When pressing F the fish goes ahead (motion). When pressing left arrow, it goes to the left and reversed (right arrow = going to the right).

Now the problem is that whenever I keep on pressing F the fish continues swimming forward and disappears inside the terrain just as if the terrain was not existing.

How do I make the fish stop when it hits the terrain?


FISH.blend (3.91 MB)

You have to set different physics types to the objects. Have a look at the video here below, it shows you how to set it up properly.

physics. since i think we are all sick of answering this question, ill just give you the fixed blend. the controls are going to need work, but the collision and setup is proper.

FISH.blend (2.54 MB)

I would use a radar and connect to a state actuator.And set it to state 2.Then put a property on the terrain.Make it a actor.Put the property in the radar sensor.

why don’t you use distance constraint.And i dynamic cube around the fish.And just animate the fish in place.

Thank you all. It works.