- Home /
NPCs fall through hills in terrain
I currently have a problem where my mobs are falling through hills in the terrain. They walk fine over the flat parts, but as soon as they hit a slight slope they fall through it.
I'm walking them towards the player with
transform.Translate(0,0,Time.deltaTime);
transform.position += transform.forward * Time.deltaTime;
Anyone know what the problem is here?
Answer by Screenhog · Sep 18, 2012 at 09:12 PM
Yep. The problem is that you're not moving them correctly.
You're changing their actual position in space. When you do that, it ignores physics until after the move is done. If the translation moves a unit into a hill, their collider will no longer be on top of the hill and they fall through.
The zombies appear to be controlled by CharacterController. Use Move or SimpleMove to move them.
Your answer
Follow this Question
Related Questions
bullet collision with Terrain and Character Collider doesn't work in very fast speed 2 Answers
CharacterController makes player game object fall through generated terrain. 1 Answer
Ship and terrain collision.Need help. 1 Answer
How does unity character controller work? 0 Answers
Disable collision between mesh collider and character controller 3 Answers