All examples · Physics

Convex polygons

What this example shows

Triangles, diamonds, pentagons and hexagons tumbling down static ramps. A polygon collider takes the corners of a convex shape: Rapier builds their hull, so the order does not matter and a dent disappears. For a concave shape, compose it from several convex ones.

Corners are written around the object's position, which is its centre, the same point a sprite is centred on. The picture is still a square, so a triangle shows as a square resting on a slanted edge: the gap between what is drawn and what collides stays in plain sight. Click to drop more.

Starting