Quaternion Addition Help

Hey everyone.



I’m having a problem when using Quaternion.add() and Quaternion.addlocal().



In the program I’m writing, I have a finger class that is comprised of two cylinders and two spherical ‘joints’ (for reference) at the base of the cylinders that are connected together by a node. The finger also has a quaternion to keep track of its rotation. Performing Node.setLocalTranslation() works correctly and everything is kept as it should be, but when I try to add another quaternion to the finger’s quaternion, the objects inside the node do not shift correctly.



This is how the finger should look:





After performing

[java] Quaternion quat1 = new Quaternion();

hand.getFinger(0).getQuaternion().addLocal(quat1);

hand.getFinger(0).getNode().setLocalRotation(hand.getFinger(0).getQuaternion());[/java]

it looks like this:





Any help is appreciated.

Adding quaternions is not what you think it is, you want to multiply them:

https://wiki.jmonkeyengine.org/legacy/doku.php/rotate

1 Like
normen said:
Adding quaternions is not what you think it is, you want to multiply them:
https://wiki.jmonkeyengine.org/legacy/doku.php/rotate

Thank you very much.