What are the limitations of JME

I just have a a couple of questions about what is possible with JME Physics.

Is it possible/necessary to swap out static physics and dynamic physics when two objects collide.  I've read the tutorial and it says that objects can be declared as static or dynamic and that collisions can trigger events.  Would there be a performance gain from switching from static to dynamic in the event of a collision with sufficient energy?

Also, I'm wondering what the limitations are in terms of dynamic physics enabled entities.  I want to handle all motion in my game using a combination of JME Physics and collision triggered events but I'm not sure how this will limit me.  Could anyone give me a ballpark estimate on the number of dynamic physics enabled cubes I could have interacting on screen?

Thanks for all of your help.

As long as the nodes do not collide, you can have hundreds if not thousands of dynamic physic nodes in a scene.

Problems arise when there are many collisions at the same time.

If gravity is enabled, you can only have about 120 stacked boxes, after that performance drops fast.

To improve performance, DynamicNodes can be set to rest().

There is also a auto rest threshold you can enable, that way nodes which are influenced by forces smaller than the threshold are put to sleep.

But then physic objects could end up hanging around in the air.

In physics fun you can play a bit around with jme physics, like creating a wall of boxes, fire things at it and play with gravity.(webstart link, if you have java 6)

Exchanging static and dynamic nodes can be a good idea, but it heavily depends on you use case. You might want to build large scene with walls, houses etc. which should be destructible. Building a static scene and replacing hit walls by multiply dynamic node can be very fast compared to hundreds of dynamic nodes to build your walls initially. Making all things static until they move could be a bad idea, because destroying the static nodes and creating dynamic one costs time, obviously.

Thanks that is exactly what I was wondering about.  I think that setting them to rest and giving objects a mass dependent threshold is probably my best bet.

My plan is to create objects at varying levels of complexity.  For example I could make a wall and when something colides with it I could swap the wall for the bricks that make it up.  Then when the pieces come to rest on the terrain I can set them to rest.  That way I can have everything be gravity enabled and have lots of dynamic physics objects I think.  Since at any given time there would only be a few hundred objects that are dynamic physics enabled on the screen.

Also I was just wondering about how configurable JME is.  For example could I make gravity vary within a region?

Thanks for any and all comments.

walrus said:

Also I was just wondering about how configurable JME is.  For example could I make gravity vary within a region?

ODE does not support this as 'gravity', no. But you can simply switch off gravity and apply own forces instead. Then you can vary whatever you want (e.g. direction and strength of the gravity).