melonJS
    Preparing search index...

    Class 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.

    // a loaded rock that falls and rolls as the shape it is drawn
    rock.bodyDef = { type: "dynamic", shapes: [ConvexHull3d.fromMesh(rock)] };
    Index
    collisionMask?: number
    collisionType?: number

    Optional per-shape collision settings (see Body#addShape).

    isActive?: boolean

    false takes this shape out of collision without removing it

    isTrigger?: boolean

    true reports contacts but skips the position correction

    points: Float32Array

    the points, [x, y, z, ...], relative to pos

    an offset from the owning body's position, added to every point

    type: string = "ConvexHull3d"

    the shape type (used internally)

    "ConvexHull3d"