Outcome of a SceneRaycaster.pick call.

Always includes the world-space ray that was tested (useful for downstream visualisation or follow-up queries). Hit fields are populated iff hit === true.

interface SceneRaycastResult {
    hit: boolean;
    meshId: string;
    objectId: string;
    rayDir: Vec3Float;
    rayOrigin: Vec3Float;
    tHit: number;
    triangleIndex: number;
    worldPos: Vec3Float;
}

Properties

hit: boolean

True when the ray hit a triangle that satisfied the pick filters.

meshId: string

Mesh ID of the hit triangle. null on a miss.

objectId: string

Object ID of the hit. null on a miss.

rayDir: Vec3Float

World-space ray direction used for the test (unnormalised).

rayOrigin: Vec3Float

World-space ray origin used for the test.

tHit: number

Parametric distance along the ray, in dir-multiples. null on a miss.

triangleIndex: number

Index of the hit triangle (offset into geometry indices ÷ 3); -1 on a miss.

worldPos: Vec3Float

World-space hit position. null on a miss.