Slow physics - what am I doing wrong?

Hi, I’m having an issue where game gets really slow when I try to add rigidbody. I just need physic to detect collision, so I went the simplest possible taking example on TestBrickTower where there is tons of physic objects.

[java] Spatial oto = assetManager.loadModel(“Models/Oto/Oto.j3o”);

                oto.addControl(new RigidBodyControl(100));

I don’t understand why i am getting such slow framerate when the physic is so simple.

Here is a build with debug physic enabled so you can see it in action

Couple hints:

// If your not running debug mode, let physics tick happen during the render cycle of the app

// Set the BroadphaseType to SIMPLE… since simple is what you need

// Set the accuracy a little lower…

Not sure if this will solve all your issues, but will help to recover some of the CPU usage and allow the render loop to continue doing its thing while physics calcs the next tick.

Hmmm, the first one is making the game crash on null pointer, the other didn’t seem to help much :confused:

Its hard to tell without seeing any code. I tried your example, and it works fine at the start, but then the object count goes to like 500, and then it crawls. So its probably a combination of too many objects being rendered, and too many physics objects. How dense is your terrain? try lowering the vertex count of that as well + lower the overall number of objects

Wouldnt oto result in a gimpact shape? Dynamic triangle collision shapes are way imperformant (due to complex algorithms) for oto a soldution woudl be to use a classical hitbos instead of triangle accurate collision

Well, I tried to apply your suggestion but I am not getting anywhere. Since you said that seeing the code might help, I prepared an archive with all the src in it.

Dropbox - File Deleted

I want to thank you in advance for taking time to look into it; if someone can find the mistakes that I are oblivious to and explain it to me it will help me become a better JME coder!