Quaternion rotation

A friend and I were messing around with jME and were rotating 2 cubes. We had different ideas on how we could do it, but got one way to work. The other didn’t and we aren’t sure why.

We have an array of the geometry we want to rotate. Below is a code snippet -

```           Quaternion rotQuat = new Quaternion();           Quaternion localQuat = null;           float angle = 0;           if (timer.getTimePerFrame() < 1) {                 angle = timer.getTimePerFrame() * 50;           }                rotQuat.fromAngleAxis(angle*FastMath.DEG_TO_RAD, new Vector3f(1, 0, 0));          for (int i = 0; i < spinList.size(); i++){                TriMesh geom = (TriMesh)spinList.get(i);                localQuat = geom.getLocalRotation();                localQuat.addLocal(rotQuat);         } ```

Shouldn't this take the quat from the current object and add a small amount of rotation to it?

If we instead change 2 things: make the angle additive each time, ie angle += .... and then do a geom.setLocalRotation(rotQuat), it works. Of course, this means all the rotating objects are rotated at exactly the same angles, rather than whatever angles they started at.

Regards,
Dr. A>

```Vector2f v=oldmousepos.subtract(mousepos); oldmousepos.set(mousepos); v=v.mult(.03f); Quaternion quat=chosen.getLocalRotation(); Quaternion q=new Quaternion(); q.fromAngles(new float[]{v.y,-v.x,0}); quat=q.mult(quat); chosen.setLocalRotation(quat);```