# Quaternion RotateTowards - Need to stop early

Hello,

Is it possible to stop the RotateTowards before it reaches it’s destination using something like a predefined percentage. For example. I want to rotate a player to a destination and then stop after it’s 80% of the way there. It’s seems like this could be accomplished by just changing the destination but I haven’t been able to find a way to change the destination to where I want it.

``````Quaternion destination = Quaternion.LookRotation(playerLookDirection);
transform.rotation = Quaternion.RotateTowards(transform.rotation, destination, speed * Time.deltaTime);
``````

Thanks.

if the total rotation is 45* and you want 80%
`rotation *= 0.8f;`

what exactly isnt working?

I have been trying to do something like that but you can’t multiply a quaternion by float.

You need to manipulate `playerLookDirection` vector or wrap the second line in an if statement, so it stops whenever the current rotation reaches given offset

I was able to change the playerLookDirection to accomplish this. Thanks.

There are many ways how to get 80% of a rotation between two rotations. One way would be to:

• Calculate the total angle between the two rotations

• Calculate the desired about you want. So for example if current and target are 45° apart and you want 80% of it, just multiply by `0.8f` to get 36°

• You can actually use RotateTowards with your current and target rotation and simply pass the angle we got in 2 as maxDegreesDelta. The resulting quaternion would be 80% before the target. Save that rotation as new target

• Now given the new target from stop 3 we can use RotateTowards the usual way and rotate from current to our new target.

A similar effect should be possible with `Quaternion.Slerp(current, target, 0.8f)`.

You will need to figure out what the correct value to test is… I just used 20 as an example, but its been a long time since I used the function, so not sure what output to expect without testing.

Something like this should probably work

``````Quaternion destination = Quaternion.LookRotation(playerLookDirection);

if(Quaternion.Angle(destination, transform.rotation) > 20)
transform.rotation = Quaternion.RotateTowards(transform.rotation, destination, speed * Time.deltaTime);
``````