Collision shape that a physics body may be composed of.
A shape may also carry its own optional collision settings, which refine the
body's rather than replacing them — collisionType, collisionMask,
isTrigger and isActive. See Body#addShape for the semantics.
Adapter support: the builtin, planck and Rapier adapters honour them
(planck and Rapier map them onto per-collider filters, which both engines
provide natively). The matter
adapter does NOT — its collisionFilter and isSensor belong to a body, not
to the parts it is built from, so per-shape values are ignored there, except
isActive: false, which leaves the shape out of the body.
The 3D shapes need a 3D adapter.Box3d, Sphere, Capsule3d,
TriangleMesh3d and ConvexHull3d have depth. A 3D adapter
(@melonjs/rapier3d-adapter) builds every one of them exactly. The builtin
solver resolves Box3d and Sphere along Z, and stands the bounding
Box3d in for the other three. The matter, planck and Rapier 2D adapters
are 2D engines with no depth to resolve, and THROW when handed any of them.
They are in this union because a body definition is otherwise portable, not
because every adapter accepts them: a 2D game that wants to stay
adapter-portable builds its bodies from the planar shapes.
Collision shape that a physics body may be composed of.
A shape may also carry its own optional collision settings, which refine the body's rather than replacing them —
collisionType,collisionMask,isTriggerandisActive. See Body#addShape for the semantics.Adapter support: the builtin, planck and Rapier adapters honour them (planck and Rapier map them onto per-collider filters, which both engines provide natively). The matter adapter does NOT — its
collisionFilterandisSensorbelong to a body, not to the parts it is built from, so per-shape values are ignored there, exceptisActive: false, which leaves the shape out of the body.The 3D shapes need a 3D adapter.
Box3d,Sphere, Capsule3d, TriangleMesh3d and ConvexHull3d have depth. A 3D adapter (@melonjs/rapier3d-adapter) builds every one of them exactly. The builtin solver resolvesBox3dandSpherealong Z, and stands the boundingBox3din for the other three. The matter, planck and Rapier 2D adapters are 2D engines with no depth to resolve, and THROW when handed any of them. They are in this union because a body definition is otherwise portable, not because every adapter accepts them: a 2D game that wants to stay adapter-portable builds its bodies from the planar shapes.