- Home /
Physics with CharacterController?
Hey,
I'm totally lost on how to get physics working properly for a CharacterController. I was using a Rigidbody to do some stuff like jumping and moving around, but whenever I move up a ramp or anything, the force gets all wonky and the character actually never stops moving slightly.
I've since changed the Rigidbody to a CharacterController, but for some reason, my CharacterController isn't reacting to anything. There is absolutely no collision, and it will not respond to gravity and sit on the surface of a plane like I want it to. It simply floats through any obstacles, also. I've tried attaching a kinematic Rigidbody to the CharacterController, but that doesn't change anything unless I set it to not use gravity -- in which case everything gets weird and my move keys push me in random directions.
Is there a way to make my CharacterController collide at all without using Rigidbody? And, is there a way to make it react to gravity (say, if I wanted to implement a jump function).
Thanks
Answer by Bunny83 · Mar 21, 2012 at 11:59 PM
The CharacterController is not a physic-object. That's actually the point of it ;) It's not influenced by external forces. It's exclusively moved via script. It does collide with any sort of colliders (as long as they aren't triggers). I guess you didn't use the Move function to move the CharacterController... Gravity has to be implemented either manually by adding a downforce to your movement vector or to use the SimpleMove function which applies gravity automatically. You can't give a manual up(jump)-force with SimpleMove, that's why you usually use Move().
Thank you! This helped me out a lot. It also simplified my movement code significantly due to the fact that the $$anonymous$$ove function is well-documented. I appreciate the input!
Your answer
Follow this Question
Related Questions
Making a character controller work with physics 1 Answer
Parenting the Character Controller to rigidbody: won't stick 1 Answer
Strange Quadruped Root Motion and Rigidbody Physics 0 Answers
Question about pushing objects, "Animate Physics" and Rigidbodies 0 Answers
Should my character controller slide down a ramp when I apply gravity to it? 2 Answers