Compound Physics Setup

Hey (I realized it was an off day a bit late :joy:),

In these playgrounds there are 3 impostors, sphere, box and compoundBody. The position of the compound body is the center of mass. If I move it up you can see the center is at the top of the head.

See this playground: https://www.babylonjs-playground.com/#492ZK0#9

So to setup the collision I would:

  • set the position of the visual mesh
  • position the collider meshes (eg. box and sphere) around the visual mesh
  • position where you want the center of mass (compound body)
  • add collider meshes as a child of the compound body
  • create physics imposters

Let me know if Im not making sense, hope this helps.