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.setShadowMode(RenderQueue.ShadowMode.Cast);
[java]
// If your not running debug mode, let physics tick happen during the render cycle of the app
physicsState.setThreadingType(BulletAppState.ThreadingType.PARALLEL);
// Set the BroadphaseType to SIMPLE… since simple is what you need
physicsState.setBroadphaseType(PhysicsSpace.BroadphaseType.SIMPLE);
// Set the accuracy a little lower…
physicsState.getPhysicsSpace().setAccuracy(.025f);
[/java]
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.
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.
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!