Builtin Library
README.md
Collider
Gives an entity a collision shape. Can exist without a Physics component (static collision geometry like walls/floors). For dynamic bodies, "mesh" is automatically promoted to "convex" since concave trimesh colliders only work with static bodies in Rapier3D.
Shapes: "box", "sphere", "capsule", "convex", "mesh", "compound".
Sizing: dimensions are half-extents in the entity's local space, and the collider is multiplied by the entity's world scale — it scales with the entity, the same way its mesh does. When dimensions are omitted, the shape derives from the entity's model bounds (still scaled), so a bare Collider matches the rendered geometry. Providing dimensions (size/sizeX/sizeY/sizeZ, radius, height) makes them authoritative over the model bounds — but the world-scale multiply still applies. So a box with sizeX = 0.5 on an entity scaled [50, 0.2, 50] is a 25 x 0.1 x 25 half-extent collider, not 0.5; pass local half-extents and let scale do the rest (or leave the entity at scale 1 to size in world units). The rule is the same with or without a Physics component.
Public fields: shape, sizeX, sizeY, sizeZ (box half-extents, local, scaled by the entity), radius (sphere/capsule), height (capsule), isTrigger, friction, restitution, rollingResistance, spinningResistance, surface (the surface it is made of, by name; see Physics.defineSurface), oneWay (the local direction bodies pass through it along), surfaceVelocity (the local velocity its surface moves at, a conveyor) and contactTag (the tag Physics.setContactFilter reads it by).
Methods: :setShape(shape), :setSize(size) (accepts {x,y,z} array or {x=,y=,z=} map), :setRadius(r), :setTrigger(bool).
entity(id).component.add("Collider", { shape = "box" }) -- box fitted to the entity's model
entity(id).component.add("Collider", { shape = "box", sizeX = 2, sizeY = 4, sizeZ = 0.2 })
entity(id).component.add("Collider", { shape = "sphere", radius = 0.5 })
entity(id).component.add("Collider", { shape = "capsule", radius = 0.3, height = 2 })