Continuing the work trying to get Collada files into Bullet and then into OF, I have decided upon a new route.
ConvexDecompositionDemo.cpp in the Bullet source distribution shows how to use Convex Decomposition to take a complicated OBJ 3D object, and simplify it into a series of Convex Shapes for more efficient simulation.
I have got the first step of loading an OBJ in, decomposing it, and displaying it’s verticies in amongst some video cubes, courtesy of Theo’s work on top of Memo’s. Not drawing correctly, but I can see the Convex object affecting other objects in the world.
Now I need to be able to add Concave shapes to the simulation as well, in order to be able to draw their correct Meshes “over” the physics world’s view of them - based on their Convex Decompostion into multiple Convex shapes.
I.e. (from the Bulllet Docs)
Ideally, concave meshes should only be used for static artwork. Otherwise its convex hull should be used by passing the mesh to btConvexHullShape. If a single convex shape is not detailed enough, multiple convex parts can be combined into a composite object called btCompoundShape. Convex decomposition can be used to decompose the concave mesh into several convex parts. See the Demos/ConvexDecompositionDemo for an automatic way of doing convex decomposition."
That part of the code is dealt with at the end of:
void ConvexDecompositionDemo::initPhysics(const char* filename)
convexDecompositionObjectOffset.setZ(-6); trans.setOrigin(-convexDecompositionObjectOffset); localCreateRigidBody( mass, trans,compound);
I am currently stuck at understanding of the callback that the ConvexDecomposition code seems to use to compute the various new ConvexShapes, and the creation of a Compoud object in the Bullet World.
You can see where I am here:
Which is basically me pulling apart ConvexDecompositionDemo.cpp into Theo’s project.