How to lock rotation?

I have a game and the character is supposed to be rotation on the x and y axis. The game is physics oriented so the rotation is from rigidbody.AddTorque. Any way to stop the z axis from rotating? Thanks

Configurable joints should do it. Attach it to a gameobject with a rigidbody already attached and you can lock rotation on the Z axis.

If you don’t want the z axis to rotate at all you can tell it to stay still in Update (ie) transform.rotation.z = 0; and it will stay 0. This way you dont have to add a component.

Thanks guys! That was a lot of help! :smile: