I see SiO2 allows for registry of collision shapes beforehand, but how do I create the collision shape based on the shape of the spatial?
An excellent use-case would be complicated scenes, which often require collision shapes to be constructed to fit their respective meshes exactly.
You can implement your own CollisionShapes class (it’s an interface) or set a load function on DefaultCollisionShapes that looks up the spatial for the ShapeInfo and uses that to make a collision shape.
You are going to be disappointed, though. Spatials are generally not good sources for collision shapes.
First, complex collision shapes can really only be static objects in bullet (and most physics engines). Second, even if you could, your collision shape would include every little weird piece of hair or dangling bit. 99% of the time, you want a collision shape that is a simplified version of the spatial.
…especially if it is made of a hierarchy of simple convex shapes.
Both Minie and jme3-jbullet provide utility methods that generate a
CollisionShape from a
com.jme3.bullet.util.CollisionShapeFactory.createMeshShape() for instance.
However, I agree with @pspeed that collision shapes should generally be much simpler than the meshes used for visualization. This is particularly true for dynamic objects (such as NPCs). Many techniques are available to achieve this simplification.