# A bit confused about Freezing Rotation Logic

Hi guys i think if we put the

``````rigidbody.freezeRotation = false
``````

it will not freeze all the axis (x,y, and z) right? but we need to freeze only the x and y axis. I got Z axis rotated if do rigidbody.freezeRotation = false.
So i put this code instead

``````private void Rotating() {
if (!Input.GetKey(KeyCode.D) && Input.GetKey(KeyCode.A)) {
rigidbody.freezeRotation = true;
transform.Rotate(Vector3.forward);
}
if (!Input.GetKey(KeyCode.A) && Input.GetKey(KeyCode.D)) {
rigidbody.freezeRotation = true;
transform.Rotate(-Vector3.forward);
}
rigidbody.constraints = RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationY;
}
``````

i actually didnt know what Bitwise operator is doing, but i found this way on this

By the way this is my result

1 Like

Hi,

Itâ€™s no surprise that you are confused about the freezing rotation logic because Benâ€™s idea doesnâ€™t work anyway. He replaces the current â€śsolutionâ€ť with an actual solution at the end of lecture â€śSpit & Polishâ€ť (currently #72).

If your solution works as well, thatâ€™s great.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.