the vertices, [x, y, z, ...]
Optionalindices: ArrayLike<number>
three vertex indices per triangle; consecutive triples of vertices when omitted
OptionalcollisionOptionalcollisionOptional per-shape collision settings (see Body#addShape).
three vertex indices per triangle
Optionalisfalse takes this shape out of collision without removing it
Optionalistrue reports contacts but skips the position correction
an offset from the owning body's position, added to every vertex
the shape type (used internally)
the vertices, [x, y, z, ...], relative to pos
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
StaticfromA triangle mesh of a Mesh as it is drawn, relative to its pos:
through its transform, scale and handedness, so a body given it collides
with what is seen. A physics engine that turns the body turns it from
there.
the mesh, a glTF part included
a new TriangleMesh3d
A collision shape made of a mesh's own triangles, exact to the surface: the shape for static level geometry, such as terrain, a ramp or a room loaded from glTF, that a character walks on and objects land on.
It is hollow, a skin of triangles with no inside, so it suits bodies that do not move. A moving body is better given a ConvexHull3d, or a few Box3d, Sphere and Capsule3d shapes.
Its vertices are in the body's space, relative to the renderable's
pos, in the engine's 3D convention (Y-down, +Z forward). TriangleMesh3d.fromMesh builds one 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