Question in short; what is a good way to generate collision shape(s) for static world geometry? Typically this world is made of corridors and such, but also more advanced surfaces appear (curvy pipes, spiral stairs, bumpy floors, organic shapes, ...).
Now in detail. I've been using CollisionTrees (thus per triangle) for quite a long time in Newton 2.x. because:
A- You can make up any shape
B- Its easy; when importing a world from an OBJ file for example, you can just copy the same mesh and use it for physics. No need to hand-make a world out of primitives.
BUT... I had several issues:
A- It's static of course. No problem most of the time, but some parts of the world are candidate for changes. Moving platforms, destroyable walls, bridges that can open/close, et cetera.
B- You don't always want every polygon of the visual world to collide. Small * on the floor (loose pave tiles, junk) would slow me down or even get me stuck sometimes!
C- Its probably not the most efficient way, memory and performance wise. Very often complicated pieces of the map can be simplified to just a OBB or cylinder (but not always!!). Also, the visual mesh contains a lot of parts I will simply never reach (details on the ceiling?).
D- Stairs are horrible. I've implemented some hacks such as forward scans to determine if there is a passable obstacle in front. Ifso, some magic force would lift me up. But the detection doesn't always work well in case a lot of detail and other junk is in my way. Often I would get stuck or had to take a sprint in order to get me up the stair.
E- The worst issue was stuff falling through the walls or floor. Don't know why it happens, but it happens. My player (just a cylinder really) doesn't seem to have this problem, but small stuff -in my case often compounds of one or more convex hulls- would fall through the CollisionTree or act weird. Bugs in either my code or Newton 2.x, lower framerates, small stuff missing triangles, ... I don't know, but it just didn't feel very stabile.
Right. I'm redoing things (going to Newton 3 for example), so that gives a chance to rethink. My guess is that a physics engine prefers primitives to work with. And yeah, using the NewtonMeshCalculateOOBB( ) function, I can generate OBB's (automatically) to cover up my world.
But before going that route, I want to make sure if its necessary. Because it will give the mappers some more work, and some shapes just don't lend themselves for boxes or other primitives. Spiral stairs, a hollow sewer pipe, a bumpy terrain, ...
I'm sure some of you guys used Newton in more advanced worlds. So, how did you deal with world-collisions?
Ciao!