Physics best practices

Hi all,



I am trying to make physics more usable for me, and to have physics definitely settled in my app.



I am tagging some stuff on my modelling app to postprocess it. So far this has worked well for renderstates. For physics I have:







So, for each node I tag with .!S or .!P, I detach it and create a DynamicPhysicsNode, setting one child as geometry for rendering and the other one as a tip to create the physic representation (using boxes (.!P), spheres (!S)…).



Now I have several doubts:


  1. My airplane is always attached to its wheels. Do I really need to keep 4 separate dynamic entities just to allow wheels to spin and the back wheel to turn on ground?


  2. If I am using 4 or 6 dynamic nodes per vehicle, I will be needing around 144 dynamic entities to allow 24 vehicles in-game. How do you think this is going to perform? Even if my wheels are attached to the airplane hull through joints, should be conservative here?


  3. Not to mention bullets, of which I need to have quite a lot. I plan to keep this out of jMEPhysics.


  4. Networking is now a problem for me. I previously had only one dynamic node per entity, which allowed me to send vehicle vectors and velocities for just one spatial. Since now I have four, should I be sending all of them? This doesn't sound good to me, because wheels are always in the same position (or I can ignore it). I am thinking of sending only minimum information (i.e. hull), and rebuild the missing data on the client side. I know setting physic properties can be bad but I this was working just fine for one aisled node… will this approach work if entities are linked by joints?



    Thank you for your input.
  1. Yes, if you want the wheel rotation to be simulated. No, if you use the wheel geometry for keeping the plane above the ground (let them slide) and rotate the wheels via animation (visuals only).


  2. 144 dynamic nodes should be fine - what stresses ODE (I assume you use that) is high number of contact points. But if you like to go up with the number of entities you can optimize it, of course: a) use a single dynamic entity while the plane is flying b) use a single entity even on ground and simulate wheel rotation with animation (as mentioned above) c) use a single (or low count of) geometry and fake contact with the ground (i.e. with a ray).


  3. use rays instead of spheres or similar geometries. Using rays in jME Physics should at least be faster that anything with jME bounding checks as collision detection.


  4. yes, the approach should still work - maybe you need to tune the calculated position a little