# Compound Bodies

> Learn all about physics compound bodies in Babylon.js.

Source: https://doc.babylonjs.com/legacy/physics/compoundBodies

## The Skull as a Compound Body

![Skull](https://doc.babylonjs.com/img/how_to/physics/skull.webp)
The skull is an interesting shape to try to turn into a compound body, and you can see it in all its magnificence here: [Playground: Skull As A Compound Body](https://playground.babylonjs.com/#UKNERM#0) - Simple example of the skull as a compound body.

It is roughly composed of a sphere for most of it, with a box around the jaw area. A bit of work is needed to position the sphere and box as well as possible. The skull is compounded from these two covering meshes.

![Compound Skull](https://doc.babylonjs.com/img/how_to/physics/greenSkull.webp)

**Note** Center of mass is at the origin of the compound object.

## Compound to Empty Mesh

1. Create an empty mesh to be used as a parent for the compound body;
2. Create a range of appropriately shaped standard meshes to fit over the irregular mesh;
3. Parent the standard meshes and the irregular mesh to the empty mesh;
4. Calculate or estimate the mass for each standard mesh;
5. Create physics impostors for each standard mesh with zero mass;
6. Create a physics impostor for the empty mesh, using the `NoImpostor` property, with the total mass of all the standard meshes.

**Note** Step 3 MUST come before step 4 and step 5 before step 6.

- [Playground: Skull As A Compound Body 1](https://playground.babylonjs.com/#492ZK0#7) - Simple example of a skull as a compound body.

## Compound Covering Meshes to The Complex Mesh 

1. Create a range of appropriately shaped standard meshes to fit over the irregular mesh;
2. Parent the standard meshes to the irregular mesh;
3. Calculate or estimate the mass for each standard mesh;
4. Create physics impostors for each standard mesh with zero mass;
5. Create a physics impostor for the irregular mesh, using the `NoImpostor` property, with the total mass of all the standard meshes.

**Note** Steps 2, 4 and 5 must be in that order.

- [Playground: Skull As A Compound Body 2](https://playground.babylonjs.com/#492ZK0#12) - Simple example of a skull as a compound body.


## Compound to One of the Covering Meshes

1. Create a range of appropriately shaped standard meshes to fit over the irregular mesh;
2. Choose one standard mesh and parent the other standard meshes and the irregular mesh to this mesh;
3. Calculate or estimate the mass for each standard mesh;
4. Create physics impostors for each standard mesh with the assumed mass;

**Note** Step 2 MUST come before step 4.

- [Playground: Skull As A Compound Body 3](https://playground.babylonjs.com/#492ZK0#8) - Simple example of a skull as a compound body.

## Further reading

- [How To Use The Physics Engines](https://doc.babylonjs.com/legacy/physics/usingPhysicsEngine)
- [How to use Forces](https://doc.babylonjs.com/legacy/physics/forces)
- [How To Use Joints](https://doc.babylonjs.com/legacy/physics/joints)
- [How To Use Pivots and Axes](https://doc.babylonjs.com/legacy/physics/pivotsAxes)
- [How To Create Soft Bodies](https://doc.babylonjs.com/legacy/physics/softBodies)
- [How To Use Advanced Features](https://doc.babylonjs.com/legacy/physics/advancedPhysicsFeatures)
