Alright, I think I found a quite severe issue this time… And this time I *did* check CVS first. Also, I couldn't find any topics on this on the forum.

Here's the problem: When I set up a transformation hierarchy using the following code (I used the indentation to make the transformation hierarchy clear here):

Node rootNode = new Node("rootNode");

rootNode.setLocalScale(10);

Node transform1 = new Node("transform1");

rootNode.attachChild(transform1);

transform1.setLocalTranslation(0, 0, -0.11f);

// transform1.setLocalScale(new Vector3f(1, 0.9f, 1)); // This is the critical line!

Node transform2 = new Node("transform2");

transform1.attachChild(transform2);

transform2.setLocalScale(0.01f);

Node transform3 = new Node("transform3");

transform2.attachChild(transform3);

Node b1Node = new Node("b1Node");

transform3.attachChild(b1Node);

b1Node.setLocalTranslation(0, 100, -11);

b1Node.setLocalRotation(new Quaternion(0.7072f, 0, 0, 0.7070f));

Box b1 = new Box("b1", new Vector3f(-50, 0, -100), new Vector3f(50, 22, 100));

b1Node.attachChild(b1);

Node b2Node = new Node("b2Node");

transform3.attachChild(b2Node);

b2Node.setLocalTranslation(0, 97.5f, 11);

b2Node.setLocalRotation(new Quaternion(0.7072f, 0, 0, 0.7070f));

Box b2 = new Box("b2", new Vector3f(-45, 0, -97.5f), new Vector3f(45, 3, 97.5f));

b2Node.attachChild(b2);

...then I get the following result:

The two boxes are perfectly aligned, as you can see in the wireframe picture, if you look closely:

You'd excpect that if you uncomment the line that is commented out in the code above, the scene will simply shrink along the Y axis, right? Wrong! The result is this:

There is a gap between the two boxes! It seems there is a bug in the transformation hierachy when using subsequent translations, rotations and scalings.

I already did some reseach on this. In the method

*doTransforms(Spatial)*of

*LWJGLRenderer*, the separate world transformations for translation, rotation and scaling are applied in this order. The world transforms are calculated before this, but it seems that somehow the interaction between the three transformations, especially between rotation and scaling, is not taken into account correctly.

Just some wild guesses on possible solutions for this (didn't dig through every detail of jME's render cycle yet ;) ):

One solution could be the use of transformation matrices instead of separate vectors/quaternions for the three transforms (not very likely to happen, I'd say ^^ ).

Another way could be the use of OpenGL's matrix stack. At the moment, the matrix stack is pushed and popped only when rendering geometry batches (and, of course, for a few other functions such as view transforms). The stack is pushed and the three transforms are applied to the GL matrix, then the geometry is rendered, and afterwards the stack is popped again. What if the stack was also used when rendering other scene elements, that is,

*Spatial*s? When rendering a Spatial, the matrix stack would be pushed and the (local!!!) transforms applied, then the contents of the Spatial (including all children of

*Node*s) would be rendered, and afterwards, the matrix stack would be popped again.

I don't know if these considerations have been made before...

Can anyone please confirm if this is really a problem on the side of jME? And if not, I'd really like to know what I'm doing wrong here... ;)