How to lock a rotation some of the time but not always

I want to have the camera as a child of my player object, except the player object is a rotating sphere. So whenever I try that, it rotates the camera like crazy along with the player. But I still need to manually rotate the camera based on 4 different orientations.

So what I’m looking for is along the lines of:

if ((Input.GetKey ("down")) && (PlayerOne.grounded == true))
{
transform.eulerAngles = new Vector3 (transform.eulerAngles.x, transform.eulerAngles.y, transform.eulerAngles.z - 90);
} else { lock rotation

Also what do I need to do to reference player one’s grounded variable, as it is a variable assigned by a C# script?

Can you perhaps elaborate on that? Does the camera not rotate the way you expect it to?

I want the camera to be a child of the player object
I want the camera to not rotate, despite the player constantly rotating
I want the camera to ONLY rotate when I hit the down arrow, as long as playerOne’s “Grounded” variable is true, with the camera rotating -90 degrees to the Z axis.

Sorry for any confusion.

In that case you would have to compensate for the player’s rotation. But does it really make sense to have it be a child of the player then?

Well is there a way I can set it to simply follow the player’s X and Y coordinates without it being a child?

You can set its transform.position to the player’s transform.position.

Only the X and the Y while maintaining an independent Z?

That’s possible, too, if you construct a new Vector3 with the appropriate values.