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!