the points, [x, y, z, ...]; at least four, not all in
one plane, for a solid
OptionalcollisionOptionalcollisionOptional per-shape collision settings (see Body#addShape).
Optionalisfalse takes this shape out of collision without removing it
Optionalistrue reports contacts but skips the position correction
the points, [x, y, z, ...], relative to pos
an offset from the owning body's position, added to every point
the shape type (used internally)
translate this shape by the given offset
x offset, or a vector carrying the whole offset
Optionaly: number = 0
y offset
Optionalz: number = 0
z offset
this shape, for chaining
The axis-aligned box around this shape: what the built-in physics resolves it as.
a new Box3d
StaticfromThe hull of a Mesh as it is drawn, relative to its pos:
through its transform, scale and handedness. A physics engine that
turns the body turns it from there.
the mesh, a glTF part included
a new ConvexHull3d
A collision shape that wraps a set of points in the tightest convex solid around them: the shape for a moving object with an irregular outline, a rock, a barrel or a glTF prop, that should tumble and stack as it looks. Concave parts are filled in; build a concave object from several shapes, or, if it never moves, give it a TriangleMesh3d.
The points are in the body's space, relative to the renderable's
pos, in the engine's 3D convention (Y-down, +Z forward); the physics engine works out the hull. ConvexHull3d.fromMesh takes them from a Mesh as it is drawn, a glTF part included.A 3D physics adapter (
@melonjs/rapier3d-adapter) builds it exactly. The built-in physics approximates it by its bounding Box3d, and the 2D adapters refuse it.Example