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