raycastAll
raycastAll
Casts a ray and returns the first object hit. Uses current mouse position if no ray specified.
Signature
raycastAll(ray?: Ray): Promise<RayObjectHit | null>Parameters
Parameter
Type
Required
Description
ray
Ray
No
Custom ray to cast. If omitted, uses current mouse cursor position.
type Ray = {
start: Vector3;
direction: Vector3;
};Returns
Promise<RayObjectHit | null> — Hit information or null if no intersection.
type RayObjectHit = {
id: string; // Object UUID
name: string; // Object name
position: Vector3; // World position of hit point
normal: Vector3; // Surface normal at hit point
uv: Vector3; // UV coordinates (z is always 0)
};Usage
Notes
Returns first hit object only, not an array
Without ray parameter, uses current mouse cursor position over iframe
Returns
nullif ray doesn't hit any object
Last updated