Set z-rotation of Gameobject = 0?

Hey all,

Is there a way to set the z- value of a rotation = 0 (the one i see in the inspector)?
I know i can set the xyzw values of a quantanion, but i have no idea how that works, and i did not figure out a way with the t´rotations´- operations listed in the api.

I just simply want the effect that the z - rotation value in the inspector is 0.

hope you can help me.

This is the rotation as euler angles (x, y, z… note the x, y, z of a quat are NOT the same)

You can also just convert the Quaternion to euler angles using the Quaternion.eulerAngles property, and convert them back with Quaternion.Euler static method.

thanks for the reply.
i tryed to use that funktion too. This is my code:

Quaternion tempq = Selector3D.transform.rotation;

Selector3D.transform.eulerAngles = new Vector3(tempq.eulerAngles.x, tempq.eulerAngles.y, 0);

Selector3D is the object i am trying to rotate.
I thougt by doing this the Object would keep its rotation, only changing thr z component to 0. But it doesnt.
I the inspectior it also does not display 0 for the z value.