# Rotating gameobject 90 degrees adds "squints" to rotation position

I have an object which rotates 90 degrees at `OnTriggerEnter` Gameobject stars at 0, then adds 90 to rotation, then another 90, bringing at 180, then another, 270, then finally comes back to 0. Problem is it adds 90 to 0 and the position becomes 90.345... then adds another 90, and comes to 181.21..., and so on, throwing off the calculation.

Is it possible to get the object to turn a clean 90? How would I account for the "squint" if the engine's position are not exact?

Use Quaternion.Slerp between orientations set with Quaternion.AngleAxis, and after it finishes, add another line specifically setting its rotation to what it should be.

for example;

``````  while (t < 1.0)
{
t += Time.deltaTime * turnSpeed;
transform.rotation = Quaternion.Slerp(turnFrom,turnTo, t);
yield;
}
if (t >= 1.0)
{
transform.rotation = turnTo;

``````

Although I haven't tried it myself, take a look at MathF.SmoothDamp

The function can be used to smooth any kind of value, positions, colors, scalars. So I'd suggest using it to smooth your rotation to your specific values.

Play around with the method arguments to get the desired target values you require.