I am trying to lerp from one rotation to another so I’m trying
Quaternion startRot = gameObject.transform.rotation; gameObject.transform.RotateAround(pivot.position, Vector3.forward, rotAngle); tarAngles = gameObject.transform.rotation; gameObject.transform.RotateAround(pivot.position, Vector3.forward, -2*rotAngle); tarAngles = gameObject.transform.rotation; gameObject.transform.rotation = startRot;
Then the idea it to lerp from one tarAngle to the other. But when that last line is executed, the gameObject’s position moves! It still goes back to the correct rotation, but the object is in a different spot. And even it I save the original position and put the gameObject back, when I try to lerp, the object moves again. This is what I use when lerping
gameObject.tranform.rotation = Quaternion.Lerp(gameObject.tranform.rotation, tarAngle[cur], Time.deltaTime * speed);
It’s not like this moves the gameObject to a random spot each time though, it just moves it to some fixed location every time. What is going on here?