Skip to main content

Module collide

Module collide 

Source
Expand description

Movement and collision against sector geometry (Build clipmove / getzrange equivalents, written from scratch).

The mover is a vertical cylinder: radius r (xy units), feet at z, extending height z units upward. A portal wall blocks when the step into the next sector is higher than step, when the head would hit its ceiling, or when the wall’s blocking flag is set.

Structs§

CircleObstacle
Circle obstacle (blocking sprite) for collision.
HitCylinder
Vertical cylinder that can be hit by traces (dudes, things…).
Mover
TraceHit

Enums§

Hit
TraceTarget

Constants§

WALL_BLOCK_FLAG

Functions§

clip_move
Moves (x, y) by (dx, dy) with sliding collision. Returns the new position, sector and the first obstacle touched.
closest_on_seg 🔒
find_sector_near
Sector lookup preferring neighbours of hint (breadth-first over a few levels).
get_z_range
Highest floor and lowest ceiling under a cylinder of radius at (x, y). Returns (ceil_z, ceil_sector, floor_z, floor_sector).
hitscan
3D hitscan. Direction: unit xy vector (dx, dy) and dz z units per xy unit.
nearby_sectors
Collects sectors reachable through portals whose walls come within reach of (x, y).
wall_blocks
True if wall wi (seen from its own sector) blocks a mover with feet at z.