i have this problem where a spaceship rotation can move around a tube left or right, the ship rotates left and right fine but when i let go of the button i want a smooth stop, a bit weird to explain but basically the damping works when i let go of the right key but not the left, im probably doing a basic math error so any ideas?
if(Input.GetKey(KeyCode.LeftArrow) || Input.GetKey(KeyCode.A))
{
rotation = -300;
}
else if(Input.GetKey(KeyCode.RightArrow) || Input.GetKey(KeyCode.D))
{
rotation = 300;
}
if(rotation > 0)
{
rotation -= 1500 * Time.deltaTime;
}
else if(rotation < 0)
{
rotation -= 1500 * Time.deltaTime;
}
gameObject.transform.eulerAngles.z += rotation * Time.deltaTime;