- Home /
Character Controller - Get Rotation from Ground
Hi,
is it possible to rotate the character controller depending on the surface that he's moving on?
I'd like to code something in JavaScript that allows the controller to behave like box B in the attached image -->
http://imageshack.us/photo/my-images/16/controllery.jpg/
What's the best way to achieve this? And I'd like to create a variable that controls the amount of rotation so that the controller can be prevented from turning too strong.
Thanks and kindest regards, Daniel
Answer by Peter G · Jun 11, 2011 at 07:16 PM
Unfortunately, you cannot rotate Character controllers on the x or z axis in the current version of Unity. I believe its a Physx thing so that probably won't change until physx allows it. Currently the only solution is to use a Capsule collider and a rigidbody for motion, but that involves completely rewriting a lot of character motors.
To answer the second question, it depends mostly on how you rotate the character. If you choose to use a capsule collider and a rigidbody as suggested above, then you should be able to add a hinge joint that limits rotation on that axis to a certain degree.
Answer by 686InSomNia686 · Jan 12, 2013 at 08:47 PM
Hi okazaky, Have you find a good solution for your problem? I'm very interesting. =) Thx