- Home /
Stay on top of the ground
I can't seem to figure out how to make the character stay on top of the ground with the character controller. If the NPC starts chasing a ball and the ball is in the ground or sinks in the character also does the same.
I've looked through almost all the answers here given on the character controller module and it seems to be a bug, or else I'm missing something. Some say I have to write collision code for the floor and character. Some say I have to add a rigidbody to the floor. Adding a rigidbody to the NPC makes it freak out. Adding a rigidbody and checking kinematic seems to have no effect.
Any suggestions?
Posting the movement code for your NPC would help sort this out.
Answer by Menatombo · Mar 10, 2014 at 07:43 PM
transform.localEulerAngles = Vector3(0, transform.localEulerAngles.y, 0);
This is what I added to my code and it keeps my NPC's from dropping through the floor. Hope this helps others.