Collision detection in multiple physics spaces

Hello everyone, I have been lurking in these forums and learning a lot, but I finally ran into a problem that I can’t solve on my own.

I’m trying to use JME3 to make an application that can run multiple isolated game worlds in parallel. For now, I’m extending SimpleApplication.

I’m experiencing an issue with collision in multiple BulletAppStates, where physics objects will clip through each other when their associated geometry is not connected to a scene graph with SimpleApplication’s rootNode as the parent. Essentially, physics objects will collide when I can see them, but pass through each other when they are not being rendered. They are affected by gravity whether I can see them or not.

For each game world, I am doing this:


physicsRules = new BulletAppState(); //Create a BulletAppState object which will handle general physics details for us

MainApplication.getApplication().getStateManager().attach(physicsRules); //Attach the BulletAppState so that it periodically gets updated by the main application


Is there something I can do to ensure that collisions are always enforced, regardless of whether they are being rendered or not?

Oh wow, sounds strange… Are you using the old PhysicsNodes or already the new PhysicsControls?

I think I found the problem. I stupidly had JGN synchronizing the physics objects with other objects that existed in an empty world. Of course, the objects in the other world had nothing to collide with, and the physics objects I was looking at copied their movements even when going through walls. The shoddy code I wrote to switch to the other world broke the synchronization and I think that’s why the clipping stopped.


This was with PhysicsNode, but it seems to be working better now that I fixed up the synchronization. Thanks for the quick reply though!

The JGN examples suck, they modify the objects directly from the networking thread…

Haha yea that caused me some trouble before. In order to get around it, I actually wound up using that Futures code snippet you posted in some of the other threads as a model. Thanks for that :slight_smile: