Skip to content

spatial

Function Summary
raycast Cast a ray and return the closest hit within max-distance, if any.
overlap The caller’s own identified entities whose collision intersects the sphere.
raycast: async func(origin: vec3, direction: vec3, max-distance: f32) -> option<ray-hit>;

Cast a ray and return the closest hit within max-distance, if any.

overlap: async func(center: vec3, radius: f32) -> list<handle>;

The caller’s own identified entities whose collision intersects the sphere. Result count is capped like find’s.

type handle = handle;
record vec3 {
x: f32,
y: f32,
z: f32,
}
record ray-hit {
entity: option<handle>,
position: vec3,
normal: vec3,
distance: f32,
}

The closest thing a ray hit: where and how far, plus the entity when the hit resolved to one of the CALLER’s own identified entities (absent for map geometry and foreign entities — they occlude, nothing more).