Rotation Question

Hi.



I have an object which I want to rotate by a specific angle around its 3 axes (x,y,z), over a certain duration.



Currently, I’m achieving this by…

  1. Converting the angle-axes to a quaternion (A), and adding it to the object’s current rotation to derive the final rotation position (B).
  2. .slerp(A, B, timeElapsed/totalDuration) to derive the object’s rotation at any given point in time.



    So far, so good & it works well enough… but only for angles less than 180 degrees, because anything higher will cause the rotation to go the “short” way around. (i.e 350 degrees becomes 10 in the other direction)



    So my question is: how do I specify not only the difference in angles between 2 quaternions, but specify the direction to measure the difference as well? Does that make sense?



    Thanks in advance,

    Jon.

Use direction vectors that you rotate by using quaternions you create based on tpf instead of trying to track absolute rotation values: https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:math_for_dummies

1 Like

Lovely. Works like a charm now, thanks.