feat: fix log fixture passthrough, improve collision, add move_direction
Fix 1 — insert_fixture now updates ChunkData bitsets: Log trunks (can_stand_in=false) now block movement in is_standable. Leaf canopy (can_stand_in=true) remains walkable. Fix 2 — Diagonal-aware collision avoidance: Sidestep priority: left+forward, left, right+forward, right. If all blocked: push through (excuse me), advance path, apply one-step delay (speed-modulated recovery). Does not stack delays. Fix 3 — Movement direction tracking: Ambulatory now has move_direction (Vec2) and step_history ([i16; 4]). TileOccupancy tracks per-tile direction hints for Stage 2 collision (convoy skip, E/S yield) via direction_at(). move_direction is smoothed from: 2 historical steps, current confirmed step, and 2-step path lookahead. Ignore: add *.patch and *.diff to .gitignore
This commit is contained in:
@@ -194,6 +194,11 @@ impl TileMap {
|
||||
|
||||
#[inline]
|
||||
pub fn insert_fixture(&mut self, pos: IVec3, tile: FixtureTileData) {
|
||||
let chunk_pos = world_to_chunk(pos);
|
||||
if let Some(chunk) = self.chunks.get_mut(&chunk_pos) {
|
||||
let (lx, ly, z) = ChunkData::world_to_local(pos);
|
||||
chunk.set_fixture_tile(lx, ly, z, tile.can_stand_in(), tile.can_stand_on());
|
||||
}
|
||||
self.fixture_tiles.insert(pos, tile);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user