I'm trying to make a teeter totter like object rotate with Unity and for some reason the rotation is instant, rather than a gradual movement. I had looked into Slerp and Lerp previously and am unable to get it to work with either. I was wondering if anyone had any insight as I'm sure i'm missing something stupid and easy xD. Thank you! Here is the method.
private void Rotate(float rotateAmount)
{
var oldRotation = transform.rotation;
transform.Rotate(0, 0, rotateAmount);
var newRotation = transform.rotation;
for (float t = 0; t <= 1.0; t += Time.deltaTime)
{
transform.rotation = Quaternion.Slerp(oldRotation, newRotation, t);
}
transform.rotation = newRotation;
}
}