Hi,
I’m using Quartenion.Lerp to rotate my object and it works correctly visually but the final values are different to the values I was transforming to.
The final object rotation is (-0.6, 0.6, -0.3, -0.4) when it should have been (0.6, -0.6, 0.3, 0.4)
Thanks!
Ok I think I figured it out…
I was lerping from one rotation to another and at the end of the lerp, the two quaternions, object Quaternion A and target Quartenion B weren’t equal which means when I check if they are equal the if statement returns false. So my solution was to check the angle between the two Quartenions
if(!done){
transform.rotation = Vector3.Lerp(transform.rotation, finalRotation, percentageComplete)
finalAngle = Quaternion.Angle(transform.rotation, finalRotation);
}
if (finalAngle == 0 ) done = true;
if it returns 0 then Quartenions A and B are the same.