i was trying to get some simple physics stuff to work in jme. Based on the simple PhysicsGameStateTutorial i was trying to extend to hold more than one box.
But most of the time my boxes ‘exploded’ away from the origin.
Now i was guessing that the update thread is processing the physics nodes soon as they are created. As soon as you do a …
DynamicPhysicsNode firstNode = pgs.getPhysicsSpace().createDynamicNode();
... there is a node registered with the physics space ... and it will be processed in the update thread.
Now, depending on which thread is faster, the initialization can be in different states when the processing happens, therefore resulting in pretty unexcpected results ...
(another interesting thing is: if you attach the visual to a physics node, generate the geometry but don't attach the physics node to the world ... it is nevertheless processed and viewable in physics debug mode)
The 'solution' here is to create the physics related things in the update thread ... but that makes the concept of having multiple threads irrelevant :(
Any thoughts on this problem?