getWorldTranslation() doesn't change, if object is moved by physics

hello jme-peoples!



I wanna use the following methods of an Object of the Class com.jme.scene.Spatial


Vector3f    getWorldTranslation()
Vector3f    localToWorld(Vector3f in, Vector3f store)
Vector3f    worldToLocal(Vector3f in, Vector3f store)


My Spatial-Object is moved by physics. I'm calling periodical the methods


//Spatial model;
model.updateWorldVectors();
Vector3f position = model.getWorldTranslation();



But the position that getWorldTranslation returns, is always the inital worldposition, but not the actual worldposition.

I tried to use the following method:

Vector3f position = model.getWorldBound().getCenter()



It works, but i also need the methods "localToWorld" and "worldToLocal", and those also doesn't work if getWorldTranslation doesn't work.

Can somebody help me ?

It does work fine in jmetest.physics.TestMarble.

Maybe you can post a simple test to reproduce the problem?

i'm currenty in a reading at the university, i will check this example in 3 hours at home on my workstation, because i did'nt find this example online.

thanks for the information.



ok. i looked at the example, and added the function simpleUpdate and sysout periodically the position of the sphere and it works.



my problem was, that my spatial "model", wasn't a DynamicNode, but his the sub-note "body" is a DynamicNode and only the sub-note ist moved by the physics





i noticed, if i ONLY call update getWorldTranslation (on the bodynode). i get always correct values.



but if i call updateWorldVectors, before getWorldTranslation(). some times the value ist incorrect (x=y=z=0).


BodyPosition: com.jme.math.Vector3f [X=-12.505646, Y=-4.0097027, Z=90.49304]
BodyPosition: com.jme.math.Vector3f [X=-12.505646, Y=-4.0097027, Z=90.49304]
BodyPosition: com.jme.math.Vector3f [X=-12.505676, Y=-4.0097094, Z=90.49301]
BodyPosition: com.jme.math.Vector3f [X=0.0, Y=0.0, Z=0.0]
BodyPosition: com.jme.math.Vector3f [X=-12.505638, Y=-4.009927, Z=90.49306]
BodyPosition: com.jme.math.Vector3f [X=-12.505638, Y=-4.009927, Z=90.49306]
BodyPosition: com.jme.math.Vector3f [X=0.0, Y=0.0, Z=0.0]
BodyPosition: com.jme.math.Vector3f [X=-12.5056305, Y=-4.010342, Z=90.49312]
BodyPosition: com.jme.math.Vector3f [X=-12.5056305, Y=-4.010342, Z=90.49312]
BodyPosition: com.jme.math.Vector3f [X=-12.5056305, Y=-4.010342, Z=90.49312]
BodyPosition: com.jme.math.Vector3f [X=-12.5056305, Y=-4.010342, Z=90.49312]
BodyPosition: com.jme.math.Vector3f [X=0.0, Y=0.0, Z=0.0]
BodyPosition: com.jme.math.Vector3f [X=-12.505554, Y=-4.0105577, Z=90.49293]
BodyPosition: com.jme.math.Vector3f [X=-12.505554, Y=-4.0105577, Z=90.49293]
BodyPosition: com.jme.math.Vector3f [X=-12.505554, Y=-4.0105577, Z=90.49293]
BodyPosition: com.jme.math.Vector3f [X=-12.505554, Y=-4.0105577, Z=90.49293]

So this is solved?

irrisor said:

So this is solved?


The first problem ist solved, but my new problem isn't.
sometimes i get wrong values, also with the worldToLocal method.
but if i call updateWorldVectors, before getWorldTranslation()

why do you do that then? updateWorldVectors is called by updateGeometricState somewhere in your game loop - you should not call it more often
irrisor said:

So this is solved?

yes