How to make good mesh physics

Building using prims, sculpties and meshes. Texture creation techniques.
Post Reply
User avatar
Tess Juel
Posts: 39
Joined: Sun Sep 11, 2016 4:24 pm
Has thanked: 25 times
Been thanked: 50 times

How to make good mesh physics

Post by Tess Juel »

There's been some talk about compatibility issues between the three physics engines we have so I thought a quick physics tutorial would be a good idea. :)

ODE, Bullet and ubODE all have their quirks and "shortcuts" but the principles for a truly well made and efficient physics model are the same for all of them.

What physics does
First we need to think of what the purpose of physics really is. The physics model:
  • defines "exclusion zones" where avatars (and physical objects) are not allowed
  • defines walkable surface
  • defines (to some degree) surfaces it's possible to rez on
That's all there is to it. This means there is no point in including small lumps and bumps in the physics model since they won't affect an avatar's movement anyway. This again means that the visual model is hardly ever suitable as the physics model; it's usually way too detailed and since running the physics engine is very heavy work for the server, we want to keep it as simple as possible. So we need to be prepared to make separate models for our physics. Fortunately that isn't difficult at all:

Phantom objects
For any object that doesn't need any physics, make a dae file with only a single mesh triangle. Save it and reuse it every time you make a phantom mesh.
This includes all wearable items btw.

Simple physics
Most decorative objects (such as furniture) only reall needs a simple "bounding box" style physics model to keep people from walking right through them. For such items, make a dae file with a simple cube, save and reuse whenever needed. Size doesn't matter, the physics model will automatically be scaled to the same overall dimensions as the visual one.

More advanced physics
Keep the overall dimensions the same as the visual model, sometimes we have to add one or more extra tris just to define the outer limits of the size for this.
Apart from that, add surfaces wherever you want an avatar to be able to walk and wherever you want to block an avatar from passing through. Nothing more and nothing less. For vertical, blocking, surfaces, you don't need exact placement, a few cm leeway makes no noticeable difference. But for horizontal walkable surfaces you want pinpoint precision. And as I alredy said, don't include lumps and bumps too small to affect the avatar in the physics model.
These users thanked the author Tess Juel for the post (total 3):
Ilan TochnerSue CaxtonGregg Legendary
Post Reply