I am trying to implement a smooth 180 degree quick turn rotation where if you press LB on the 360 pad the character rotates +180 degrees on the Y axis no matter what direction the player is in then stops until the button is pressed again. However, everything I’ve tried and written usually just forces the player’s rotation to 180 or instantly transitions to +180 degrees at an instant un-smooth speed, or it simply doesn’t rotate the desired 180 degrees. I’ve used eulerAngles, Quaternions, etc.
Basically like this; no matter where the player is if I press LB the player should quickly rotate +180 degrees. Then if I press LB again, she rotates +180 again, etc. So say if my character’s Y rotation is at 75 and I hit LB it would +180 and be at 255, etc.
While this code does exactly what I want it to do, it is WAY too instant:
if (Input.GetKeyDown(KeyCode.Joystick1Button4))
{
transform.rotation *= Quaternion.Euler(0, 180, 0);
}