Well after I treid several hours to debug my stuff to see why it just does not make sense, I think I have located the error:
testcode, returns sometimes localTranslation instead of WorldTranslation!!!
@Override
public Vector3f getPosition() {
System.out.println("Parent:" + this.visiblenode.getParent()); //players parent, rootnode or car
System.out.println("Parentrelation:" + this.visiblenode.getLocalTranslation());
if(this.visiblenode.getParent() != null){
System.out.println("Parent's-Parent:" + this.visiblenode.getParent().getParent()); //null or the rootnode wher the car is
System.out.println("Parent's-Parentrelation:" + this.visiblenode.getParent().getLocalTranslation());
}
System.out.println("My world position:"+this.visiblenode.getWorldTranslation());
return this.visiblenode.getWorldTranslation();
}
in the upper of couse the rootnode is the same as in the other, I just made a mistake labeling.
In the beginning, but there really shouldn't be any problem related with this, as they are really just Nodes, without physic or anything. Also in the lower one on the picture, there clearly is a math error.
Uh, when in the update loop do you read those values?
If you change the local transform, and don't call updateGeometricState(), then world transform will return the last local transform set. This is obviously incorrect.
Maybe we should throw an exception if you try to retrieve the world transform when the refresh flag is set?
Yeah, it works because essentially you're manually converting the position from local space to world space using the every parents local transform (which is incorrectly stored in the world transform). A very similar process is done in the engine itself to derive the world transform.