Glossary · Physics simulation

Collision geometry

Also called collider, geom, capsule, collision shape

The simple shapes a physics engine uses to work out what is touching what: spheres, capsules, boxes and meshes.

Checking whether two detailed body meshes touch is slow. Physics engines instead give each part one or more simple shapes, and only test those. These colliders (in MuJoCo, geoms) can be different from what you see on screen.

shapegood forcontact test
sphereheels, joints, headsvery cheap: compare the distance between centres with the radii
capsulelimbs: a cylinder with rounded endscheap: distance between two line segments
boxfeet, fists, flat surfacesmoderate
meshdetailed shapesexpensive

A capsule is the set of all points within radius rr of a line segment. Two capsules touch when the shortest distance between their segments is less than the sum of their radii:

contact  ⟺  dist⁡(segment1,segment2)<r1+r2\text{contact} \iff \operatorname{dist}(\text{segment}_1, \text{segment}_2) \lt r_1 + r_2

That makes capsules the standard choice for arms and legs: they’re rounded like limbs and very cheap to test.

Shapes and mass

Collision shapes often also set a part’s mass and inertia, from their volume and a density. A body built from capsules can still have realistic mass if each part’s mass is set separately.

In this project

The simple body v2 has 23 colliding shapes: one capsule per segment, box fists, and box feet with a heel sphere and a toe capsule. Each segment’s mass, centre of mass and inertia are copied from the muscular body rather than computed from the capsules, so the two bodies balance the same way. The simple body’s physics step costs 161 µs, against 423 µs for the muscular one.

Related terms

Used in

← All terms