Skip to main content

Module collide

Module collide 

Source
Expand description

Collision query layer (stage CC) — box-vs-voxel overlap over a scene; see docs/porting/PORTING-CONTROLLER.md. Collision query layer (stage CC.0 — see docs/porting/PORTING-CONTROLLER.md).

World-space box-vs-voxel overlap tests over a whole Scene, promoted from the three demo copies of the fly-camera collision hack (scene-demo collision.rs, cave-demo, cave-web) so the CC character controller — and the demos themselves — share one implementation with the demos’ hard-won lessons pinned as unit tests here:

  • Solidity comes from roxlap_core::world_query::getcube: Cube::Color and Cube::UnexposedSolid block (slab interiors are solid material), Cube::Air does not.
  • The voxlap bedrock placeholder at chunk-local z = CHUNK_SIZE_Z - 1 is a policy, not a fact — Solidity::bedrock_blocks, default false to match the demos’ treat_z_max_as_air rendering (else an invisible wall appears at every grid’s bottom plane).
  • Positions outside every grid’s footprint are air, so a body can move past a grid without hitting invisible bounds.

Grid placement: axis-aligned grids are probed cell-exactly (the box’s floor-range of voxel cells); rotated grids are probed conservatively — the world box’s 8 corners are transformed into grid-local space and their local AABB is probed, which blocks slightly early near rotated geometry but never leaks. An exact OBB-vs-voxel test is out of scope for a controller-grade query.

Structs§

Solidity
What counts as solid for a collision probe.

Functions§

box_overlaps_solid
true if the axis-aligned world-space box [min, max] overlaps any solid voxel of any grid in scene.
grid_box_overlaps_solid
Single-grid form of box_overlaps_solid — the building block the scene-level test folds over, public for hosts that manage their own grid (the cave demos collide against one grid only).
point_overlaps_solid
Point form of box_overlaps_solid: true if the voxel cell containing the world-space point p is solid in any grid.