- Home /
Enemy NPC walks through hills
I need help getting the NPC to walk over the hills whilst following the player rather than through the hills. How can I do this?
How are you moving the NPC? Are you directly changing its transform.position? Does the NPC have a collider/character controller/rigidbody?
he has a collider, character controller and rigidbody. it still doesnt work
O$$anonymous$$, but what about my other questions? Are you directly changing its transform.position?
I think so. Sorry, I'm a bit new to scripting and found one on this site which does it. But can't link it because I can't remember what it was. Sorry
If you directly move a transform.position, it completely ignores your collider and rigidbody. This is probably what's happening to you. The simplest way to make it work is to give your enemies CharacterControllers and use CharacterController.Simple$$anonymous$$ove or .$$anonymous$$ove.
Answer by Stormizin · Nov 08, 2012 at 09:44 PM
You need to add a collider in the character to colide with the terrain and go up to your hill.
I hit this problem, but a search found this : http://forum.unity3d.com/threads/21710-Colliders-not-colliding-with-the-terrain
Check my answer here : http://answers.unity3d.com/questions/327124/player-wont-collide-with-wall.html
Add a rigidbody =]
I also already added a rigid body. Still doesn't work, but I'll check the links