Physics · function
shapeBounds
World-axis bounds of a shape as placed (its points are its placement).
Explained in Your first game, Rigid bodies.
function shapeBounds(shape: ConvexShape, out: Aabb): Aabbimport { shapeBounds } from '@driftengine/physics';Parameters
| Parameter | Type | Description |
|---|---|---|
shape | ConvexShape | |
out | Aabb |
In depth
radius and sideRadius grow the box differently, and the second one is not sideRadius on
every axis. A ball grows a box by its radius along all three; a disc perpendicular to a unit
axis a grows it by sideRadius * sqrt(1 - a[i]^2) along axis i — the disc's own extent seen
down that axis, which is the full radius across the axis and exactly nothing along it. Using
sideRadius on all three instead would bound a lying cylinder as if it were a sphere, which is
conservative and therefore not wrong, and would cost the broad phase the difference on every
cylinder in the world.