Skip to main content

Module spatial

Module spatial 

Source
Expand description

Display-independent selection, proximity, and conservative camera visibility.

SpatialIndex2D and SpatialIndex3D own snapshots of caller-supplied IDs and boxes. Rebuild after world bounds change; no ECS or raylib state is read implicitly. Queries borrow the snapshot and never allocate when using visitor methods. A failed rebuild leaves the previous snapshot intact.

Structs§

Frustum2D
Visible 2D camera rectangle, including rotation and fitted/expanded aspect.
Frustum3D
Six-plane 3D camera frustum. Box results are conservative near corners.
Ray2
A 2D ray with a unit-length direction; distances are world units.
Ray3
A 3D ray with a unit-length direction; distances are world units.
RayHit2
Contact on a 2D box. The normal points outward; strict inside starts have zero normal.
RayHit3
Contact on a 3D box. The normal points outward; strict inside starts have zero normal.
SpatialHit2
Nearest indexed 2D box contact.
SpatialHit3
Nearest indexed 3D box contact.
SpatialIndex2D
Owned 2D collider snapshot with a balanced AABB hierarchy.
SpatialIndex3D
Owned 3D collider snapshot with the same lifecycle as SpatialIndex2D.

Enums§

SpatialError
Invalid, nonfinite, or unsupported spatial input.