- Home /
By-pass the 'shortest route' aspect of Quaternion.Slerp
Hey,
when using Quaternion.Slerp for rotating an object, the function will pick the shortest path to get to that position. Is there any way to bypass this and force the direction of the rotation (clockwise or counter-clockwise) or should I use another function?
I need to rotate a door let's say from 0 degrees to 225 degrees. But instead of the door going through each and every one of the 225 degrees, it rotates the other way around so it only has to rotate 135 degrees, which is not what I want.
you have two choices, either use a function that rotates angles, because they can be used positive and negative for a direction, or you rotate over several Quaternions in between to make the longer distance look shorter with the in between steps.
What function would you suggest that rotates angles? The several quaternions is something I've thought of but that's not that elegant in my opinion :) I'd like a cleaner approach. Do you have functions in $$anonymous$$d like Transform.Rotate
?
Answer by Bunny83 · Mar 05, 2017 at 06:28 PM
I'll check that out, thanks! I'll let you know if it worked.
Try not to post practically duplicate questions.
You're absolutely right, my apologies. I felt like I badly worded my specific question so I posted it a second time. I'll close the other question.