Character Controller - Get Rotation from Ground


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 →

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,

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.

Hi okazaky,
Have you find a good solution for your problem?
I’m very interesting. =)