Rotating a GameObject to match the Input Axis

I’m trying to have a gameObject, which is currently a long cylinder, have a rotation which matches the current axis input. So, if GetAxis(“Vertical”) = 1.0 then the gameObject.rotation.y = 90.0 and if GetAxis("Vertical = 0.0) then gameObject.rotation.y = 0.0

This seems really straightforward, but most of the documentation on rotation deal with consent rotations, not fixed ones. I want the player to move the joystick down and get one fixed rotation which only changes if the player moves the joystick again. Any help would be appreciated Thank you

.rotation is a quaternion; you don’t want to use that.

You can just write that:

if (Input.GetAxis("Vertical") == 1.0) {
	transform.eulerAngles.y = 90.0;
}
else if (Input.GetAxis("Vertical") == 0.0) {
	transform.eulerAngles.y = 0.0;	
}

–Eric

Great Thanks, I was trying to avoid using Quaternions, but I couldn’t figure out how.