- Home /
How do I keep a character from rotating?
I want to disallow my character from tipping over, but still be able to rotate left and right. How would I go about doing this?
What are you using for the physics of your character? A capsule collider? A character controller?
The model is a rigidbody and it has a box collider. Would a character controller be prefferable?
It somewhat depends on what you want to do with the game. Character controllers collide with things, but do not use regular physics. Thus they are more fit to be used for characters. Pushing things around etc has to be done with another script however.
Well, I really just need a character that can move around without tipping over. Pushing isn't needed.
When I put a character control on my character, it just falls through the ground. What am I doing wrong?
does it have a collider component?
if you really wanted to you could replace it Euler angles with(0,y,0), and that way it will only ever rotate about Y, and your question title is ambiguous
Answer by BJ · May 19, 2012 at 04:40 AM
I'm creating a 2D game and utilised:
RigidBody -> Constraints -> Freeze Position Z
RigidBody -> Constraints -> Freeze Rotation X Y Z
The freeze rotation prevents the sprite plane slipping into the z axis. I'm not sure if this is helpful in your case.
Answer by reptilebeats · May 19, 2012 at 03:31 AM
silly question but has your ground got a collider on it, best way without seeing your settings would to create an empty just with the character controller, this will at least rule out a few things, also have you got a rigidbody im pretty sure they dont use a rigidbody as like shadow says it doesnt use regualer physics so putting a rigidbody on it kinda defeats the purpose
check out http://unity3d.com/support/documentation/Components/class-CharacterController.html
Answer by Sting_Auer · May 19, 2012 at 01:14 PM
Thanks very much Brendan! I can't believe I missed that little cropdown menu D:
Your answer
