how to rotate object a bit. and then go back

hi. I just want to test and see if it’s possible to rotate an object 45 degrees down and then 45 degress up.

		if (Input.GetButtonDown("Glide")){
		transform.Rotate(Vector3.down -45);
	}
	
	if (Input.GetButtonUp("Glide")){
		transform.Rotate(Vector3.down +45);
	}

this is my script inside the update function. But it won’t work. what have I done wrong?

transform.Rotate(45, 0, 0); // tilt to face more down

Imagine you are facing ahead in Unity. The y-axis goes up – Rotate(0,10,0) turns you. The z-axis goes straight ahead – Rotate(0,0,10) leans you sideways. The X axis goes through you sideways like a foosball rod. Rotate(10,0,0) tilts you forwards/backwards.

Rotate is local, unless you change it. That means that whichever way you happen to be facing, Rotate(10,0,0) still works. It tips you in your personal forward (well, really, tilts on your personal x.)

To check whether you want a + or - spin: Unity uses a left-handed coordinate system, which means if you take your left hand, thumb facing +X (right,) then your fingers curve the way a + spin will take you. In other words, you can use your left hand to see Rotate(45,0,0) tilts down, not up.

Vector3.down (which works, but is undocumented) is really just (0,-1,0).
So, Rotate(Vector3.down * -45) is the same as Rotate(0,45,0). It says to spin you 45 degrees on Y, which spins you to face north-west.