Directly change an object's rotation

So I have an interesting question. Is there a way to change an objects rotation to something that you want much like changing transform.position?

Here is my code I’m working with.

if (inBottomHalf == true && inRightHalf == true)
                {
                    transform.RotateAround(Vector3.zero, Vector3.forward, p_rotateSpeed);

                    if(transform.position.y >= (Right_Point.position.y - .1) /*|| transform.position.y <= (Right_Point.position.y + .1)*/)
                        {
                            Debug.Log("Ship's position is at Right_Point");
                            transform.position = Right_Point.position;
                            transform.rotation = new Quaternion(0, 0, 90, 0);
                            break;
                        }
                }

This code is a net that stops the player from moving further when it hits a certain point. The ship comes within the point then gets moved to the point, from there it can’t move. Now while its at the point it has a rotation of 90 on the z value. As I understand it the line

transform.rotation = new Quaternion(0, 0, 90, 0);

Should set the z value at 90 but it doesn’t it adds to the current value. Does anyone know what I’m doing wrong? Thanks in advance!

the constructor new Quaternion(0, 0, 90, 0); sets the x,y,z,w components of the Quaternion. The x,y,z components does not correspond to the x,y,z rotation along those axes. You can read the documentation here.

Use this code to generate a Quaternion that rotates 90 degrees along z axis:

Quaternion.Euler(0, 0, 90);

Try using:

transform.rotation = Vector3(0,0,90);