I have a problem with updateGeometricState, I don't know if it's a bug or if I don't understand how it works.
I have a model stocked in a Node with 3 children. I do a localTranslation on a child in the addBloc function :
public void addBloc() {
Node objets = ((Node)modelNode.getChild(0));
// modelNode is a Node with the used model
...
// translate on X
Spatial movedPart = objets.getChild(MOVED_PART);
Vector3f position = movedPart.getLocalTranslation();
movedPart.setLocalTranslation(new Vector3f(position.x + _widthCopiedMesh,
position.y, position.z));
movedPart.updateGeometricState(0, true);
}
this works correctly, but when I call the scaleSize function to scale all the model node (parent of translated object) it change the local translation with the original values.
Scale works on the model but the translated object move to its original position, so updateGeometricState seems to initialize translation values of child and I don't understand why. Or maybe it's another problem.
updateGS does not by itself affect local transform values, so something else must be going on there… for example, if you have an animation controller in action or something of that nature.
and as you can see this is the only one line which can modify it (or maybe an other thread but I don't have animation in my program).
So I decided to trace in Debug all the calls in updateGS and in fact I found where the values are changed, it's in the function applyToSpatial of TransformQuaternion.
The stack trace is:
The only time I have seen something like this happening is when someone accidentally overwrote the localTranslation vector of a node with the worldTranslation, and since updateGS does change the worldTranslation, then it would also change the local (because they are the same reference/object). Try to print your vectors as follows:
Well, I found the problem, indeed there was SpatialTransformer on the model, you were right. These SpatialTransformers was created in a conversion beetween 3DS file and Jme file so I never saw them, especially besause there is no animation on the model.