@pixi/3d
    Preparing search index...

    Interface RaycastHit3D

    A hit in world space: what View3D#raycast returns, and what every 3D pointer event carries as hit3D

    const hit = view3d.raycast(event.global);
    if (hit) marker.position.copyFrom(hit.point);

    // The same shape on an event; null when the pointer is over nothing.
    mesh.on('pointertap', (e) => {
    if (e.hit3D) marker.position.copyFrom(e.hit3D.point);
    });
    • An event's hit3D is reused for later events, so copy out anything you keep; see Event3DFields.

    Container3D#hitVolume For choosing the shape each node is picked against

    interface RaycastHit3D {
        distance: number;
        localPoint: Vector3;
        normal: Vector3;
        point: Vector3;
        target: Container3D;
        triangleIndex: number;
        uv: Vector2;
    }
    Index
    distance: number

    Distance from the camera to the hit along the ray, in world units

    For an orthographic camera it is measured from the camera plane.

    if (hit && hit.distance < reach) pickUp(hit.target);
    
    localPoint: Vector3

    Hit point in the local space of the node the ray struck

    For another node's space, pass point to that node's toLocal.

    // Which half of the dial was grabbed, in the dial's own frame?
    dial.on('pointerdown', (e) => {
    grabbedRight = e.hit3D !== null && e.hit3D.localPoint.x > 0;
    });
    normal: Vector3

    The hit triangle's flat normal, in world space; zero when triangleIndex is -1

    if (hit && hit.normal.y > 0.7) placeTower(hit.point); // flat enough to build on
    
    point: Vector3

    Hit point, in world space

    if (hit) marker.position.copyFrom(hit.point);
    
    target: Container3D

    The node the hit is reported to

    That is the node the ray struck, or its nearest interactive ancestor when the struck node isn't interactive ('auto' or 'passive'). The other fields still describe the struck node.

    const hit = view3d.raycast(e.global);
    if (hit) select(hit.target);
    triangleIndex: number

    Index of the triangle hit, or -1 for a shape without triangles

    if (hit && hit.triangleIndex !== -1) highlightFace(hit.target, hit.triangleIndex);
    

    Texture coordinate at the hit, for a per-triangle shape

    A geometry without float32 UVs gives the hit's barycentric coordinates in its triangle instead. Box and Sphere hits give zero.

    if (hit) paintAt(hit.uv);