@pixi/3d
    Preparing search index...

    Type Alias HitVolume3DInput

    HitVolume3DInput:
        | "box"
        | "geometry"
        | Box
        | Sphere
        | Geometry3D
        | IHitVolume3D
        | null

    What Container3D#hitVolume accepts, like hitArea in 2D

    A string derives the shape from the node:

    • 'box': the node's bounding box.
    • 'geometry': every triangle of the node's own geometry, as stored: skinning and morph targets don't move it. Hits carry a normal and UV, but every triangle is tested once the ray reaches the bounding box.

    An instance gives a shape the node can't work out, in the node's local space:

    • Box: an axis-aligned box.
    • Sphere: an analytic sphere. A SphereGeometry works too, but tests every triangle.
    • Geometry3D: a mesh tested per triangle, typically a simpler stand-in for a detailed model.
    • IHitVolume3D: a shape of your own, such as a physics collider.
    mesh.interactive = true;

    mesh.hitVolume = 'box'; // bounding box derived from the node
    mesh.hitVolume = 'geometry'; // per triangle, hits carry normal and uv
    mesh.hitVolume = new Sphere(new Vector3(), 0.5); // the cheapest exact shape for round meshes
    mesh.hitVolume = new CapsuleGeometry(); // a low-poly stand-in
    • Only per-triangle shapes ('geometry' and Geometry3D) give a hit a normal, uv and triangleIndex. Box and Sphere hits have zeros and -1; an IHitVolume3D fills in what it chooses.
    • Per-triangle tests hit back faces too, and the normal follows the triangle's winding, so it can face away from the camera.
    • With the camera inside a box or sphere, a mesh's default bounding box included, the hit is where the ray leaves it, on the far side.
    • On a Mesh3D, 'box' and 'geometry' keep reading the mesh's current geometry, even after a swap. On a plain Container3D, 'box' measures the subtree once, when set, and unlike getLocalBounds() it includes hidden descendants.
    • Per-triangle tests need 'triangle-list' topology and float32 positions. Line, strip and point geometry, quantised positions (KHR_mesh_quantization), and interleaved geometry (interleave: true) never hit; use 'box' or a stand-in geometry for those.
    • 'geometry' on a plain Container3D warns and is ignored, since it has no geometry.

    View3D#raycast For querying a hit directly rather than through events