Multithreading Physics

Is any work being put into improving jmephysics multithreading? When I run right now, it is unstable and I get ODE errors if there is a lot of multithreaded physics interaction.

The used ODE version is single threaded. Thus you need to synchronize access to physics (and you cannot access it while simulation step is computed).

As Oleh Derevenko is putting some effort into making ODE multi-threadable you might have a chance to use multi-threaded ODE in future versions. Currently there is no effort put into jME Physics to allow for multi-threading, though.

Heho,



I have tried to lock and unlock the PhysicsGameThread



SimpleMultiThreadPhysicsGame.physicsState.lock();
try {
   body.setLinearVelocity(velocity);
} finally {
     SimpleMultiThreadPhysicsGame.physicsState.unlock();
}



but it didn't really help.

Are there any rules, what all have to acces locked in ODE? BEcause I use getLocalTranslation, getVelocity and such stuff, all in different Threads. I didn't wand to lock the physics in any case, because I think it will arrest the speed.