Collision and animated shapes

I’m not really sure how to deal with collision (via Bullet) in conjunction with animated shapes. For example, I have a dragon model with a walking animation. I can give it a compound shape that roughly matches, but as soon as it starts moving it will no longer match the position of the legs, neck, etc. I don’t know what the best way to correct that is.

Should I be creating a bunch of individual rigid bodies approximating each non-deforming chunk, e.g. the upper body, and then connecting them with constraints and parenting them to the appropriate bones? If so, what would I then parent the actor to? Would I create a separate ghost shape connected to the others by a 6-axis constraint to be the parent?

Would that work? Is there a better way?


Well, you can go two ways. Consider that in your case the “rigid body(s)” serves only one purpose: to push away other collision objects. They are not controlled by physics (e. g. gravity) - they are controlled by the animation.

(1) The easy way it to create only one rigid body, which aproximates the total shape of your dragon. This is sufficient in most cases.

(2) Then more realistic (but less performant) way would be to create one kinematic rigid body for each (major) bone, and make this body move together with the bone. You don’t need to create constraints, since the actor joints already keep the bones together. Just make sure the bones don’t overlap.