I'm currently implementing Bullet in the C4 Engine to mirror a PhysX implementation that I've been working on, and I've hit a bit of a wall with regards to saving compound rigid bodies, ie made up from numerous convex hulls (generated using ConvexDecomposition)
At the moment I am using ConvexDecomposition on a test model of a column, it works fine decomposing at runtime but obviously it is slow. So I'm saving it out to a .dae file to load back in at runtime rather than decompose it every time. The problem I have is that the collada file that is generated of the saved compound rigid body does not contain multiple convex hulls that were generated, just a single one.
If I then run the same scene in PhysX (both are using the same ConvexDecomp code) and save a dae file out using NXUStream the file is completely different, but if I then load that file into the bullet scene it loads fine and all of the hulls are created correctly.
The image shows a yellow column that has the collision mesh generated at runtime and the red one loaded the file generated from NXUStream, Column-PhysX.dae - the Bullet debug is turned on.
My question is, do I have to do anything special when saving a btDynamicsWorld, I just create the world, create one rigid body (the compound one) and save it. I created my own class that inherits from ColladaConverter and override the ::createConvexHullShape() and ::createCompoundShape() to check that the convex hulls are being created when it loads and just one hull is created when loading the Bullet generated collada file, Column-Bullet.dae.
The two files are here if anyone wants to check them out.
COLLADAFiles.zip [15.25 KiB]
Downloaded 174 times