How to set only one axis of a rotation?

Hi there I don’t know if Im being stupid but I would like to set ONLY my z rotation to 0.
and keep all my other rotations untouched if that makes sense.

transform.rotation.y = 0; does not work.

Well, first of all if you only want to set z to 0 you shouldn’t use y in your code :slight_smile:
Also, you probably want to work with the euler angles instead of the .rotation quaternion:

Vector3 euler = transform.eulerAngles;
euler.z = 0;
transform.eulerAngles = euler;