Skip to content

makeGridSyncOnMove

makeGridSyncOnMove(options): GridSyncOnMove

Defined in: src/modules/spatial/grid-sync.ts:45

Build an onMove callback that keeps a HashGrid2D in sync with per-entity position changes produced by makeVelocityIntegrationSystem. Projects both snapshots through cellOfPoint and calls grid.move(id, from, to) only when the cells differ — a no-op short-circuit matching what consumers used to write by hand.

Consumers remain responsible for initial grid.add on spawn and final grid.remove on despawn; this helper only covers the motion step.

GridSyncOnMoveOptions

GridSyncOnMove