No way to freeze local z-rotation?

Hi,

I have tried a bunch of different things now and I can’t seem to lock the rotation on the local z-axis of my rigidbody. Using either rb.angularVelocity or rb.addTorque to set x, y-rotation with GetAxis input (horizontal for x, vertical for y) how do i constrain the rotation of the object so it does not rotate around z?

Thanks!

Doesn’t work with editor constraints or FreezeRotationZ…

If I rotate X by 90 degrees and then Y by 90 degrees, I’ve effectively rotated the object around Z by 90 degrees without directly changing it.
Similarly, if I rotate Z by 90 degrees and then X by 90 degrees, I’ve effectively rotate the object around Y by 90 degrees.

That’s probably the issue here. What is your desired outcome in this scenario?

If, even in these scenarios, the “effective rotation around the Z axis” should be constrained then you will want to actively detect and counteract it.