- Home /
quaternion rotation
How do I make quaternion rotation rotate the same speed as it rotates. And how do I stop it quicker ?
I don't understand what you mean by "rotate the same speed that it rotates". Are you using Quaternion.rotatetowards? Might need a little more context.
I meant i need it to rotate the same speed all the time.. not slow down, not go faster, just immediately stop when it reaches its rotation angle.
Answer by jackmw94 · Feb 25, 2021 at 02:45 PM
I think Quaternion.RotateTowards
is the function you're looking for. If you call it in your update loop with arguments along the lines of this:
transform.rotation = Quaternion.RotateTowards(transform.rotation, targetRotation, constantSpeed);
That should do what you're looking for. You can tell when it's completed by checking:
Quaternion.Angle(transform.rotation, targetRotation) < 0.001f; // some small value
Let me know if that's not what you meant!
@Rostislavvacek116 did this solve your problem? If not then let me know if I can help, if it did then would you $$anonymous$$d accepting the answer :)
Your answer
Follow this Question
Related Questions
Quaternion and 360 degree rotations 1 Answer
Rotate GameObject on click 1 Answer
Changing the speed of a rotating object 2 Answers
Quaternion rotation issue 1 Answer
Is there no way to get reliable angles from a rigidbody? 2 Answers