In the beginning I ran my game without physics and it was nice, but when I applied physics, frames per seconds decreased. It was with medium size map. When I load large map, frame rate went to zero. Then I thought I was using wrong classes. What is the best to use physics. I clone my model, apply it in PhysicsGhostNodes, then add in physics spase and attach to node that attached to root node.
Try CollisionShapeFactory.createDynamicMeshShape(). If you wanna apply physics to your scene as a whole ( except the tanks and bullets )
try CollisionShapeFactory.createCompoundCollisionShape() to it. And try CollisionShapeFactory.createDynamicMeshShape() to the tanks and bullets. If the bullets are spheres then try SphereCollisionShape to it. If you wanna test if your meshes’s collision shapes are at right location,
No, dont use createDynamicMeshShape! It will result in too high CPU usage. You should use basic collision shapes and combine them in CompoundCollisionShapes for more complex shapes that are supposed to move. Mesh shapes should only be used for static physics objects.
Look at this thread for some hints about possible problems and/or improvements.
I came to the conclusion to use DynamicMeshShapes because I made a class that ran all the nodes of a scene and changed the PhysicsNodes’ CollisionShapes. I made it because you just create “CompoundCollisionShape” to yours PhysicsNode at SceneComposerWindow, and that kind of CollisionShape has no mass. So my class altered these CompoundCollisionShapes to DynamicMeshShapes in only one method. Has somehow to change all PhysicsNodes’ CollisionShapes in my class for a kind of CollisionShape efficacy (in just one method, by passing a PhysicsNode as parameter) ???
Yes, the collision shape generation in the SceneComposer is meant for scenes, so non-moving objects. There is no way to one-click create a CompoundCollisionShape of basic shapes (Box, Cylinder etc.) yet in jMP if thats what you are asking for. Dynamic Mesh shapes are simply too costly. You will have to build your Collision Shape “by hand” as I described in the thread.
That method tries to create a collision shape made out of boxes that surround the single geometry objects in your model. You can try it but the manual method will be better.
What you are doing is a manuall intersection check, wich is probably a few dozen times less efficient in a static enviroment. I suggest rereading the jbullet examples (or take a look at the test.jbullet.* package)