DR-042 Phase C (legibility, part 2): walls block enemies (C5) — restore the fortress fantasy
Player-built structures now physically block enemies (husks walked straight through walls before). Dedicated "Structure" physics layer (slot 9) so the player passes its own walls while enemies are stopped: - New WorldCollisionConfig.StructureMask, baked from the "Structure" layer in WorldCollisionAuthoring (mirrors EnvironmentMask). EnemyAISystem ORs it into the movement sweep filter (CollidesWith = envMask | structMask) — no new system, same 1-2 SphereCasts per enemy. - Wall/Turret/Pylon prefabs get a cell-sized BoxCollider on the Structure layer (Wall's existing one relayered). - Physics matrix: Default x Structure unchecked, so the kinematic player CC (Default) passes its own walls while the enemy's explicit cast still hits them. Despawn frees collision for free (collider dies with the entity). Play-verified baked filters: StructMask=512; structure colliders BelongsTo=512, CollidesWith=0xFFFFFFFE (includes Environment for the enemy cast, EXCLUDES bit 0 so the player passes). 389/389 EditMode, no exceptions. Server-only/static colliders -> deterministic, no client divergence. SaveData stays v5. Phase C complete (C5-C7). A visual fun-gate (husk stops at wall, player walks through) is the operator's eyes. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -100,8 +100,9 @@ namespace ProjectM.Server
|
||||
var ecb = new EntityCommandBuffer(Allocator.Temp);
|
||||
bool havePhysics = SystemAPI.TryGetSingleton<PhysicsWorldSingleton>(out var physics);
|
||||
uint envMask = SystemAPI.TryGetSingleton<WorldCollisionConfig>(out var worldCol) ? worldCol.EnvironmentMask : 0u;
|
||||
var envFilter = new CollisionFilter { BelongsTo = ~0u, CollidesWith = envMask, GroupIndex = 0 };
|
||||
bool sweep = havePhysics && envMask != 0u;
|
||||
uint sweepMask = envMask | worldCol.StructureMask; // DR-042 C5: also collide enemies against player-built walls
|
||||
var envFilter = new CollisionFilter { BelongsTo = ~0u, CollidesWith = sweepMask, GroupIndex = 0 };
|
||||
bool sweep = havePhysics && sweepMask != 0u;
|
||||
const float SweepRadius = 0.5f; // collide-and-slide sphere radius for Husk movement
|
||||
|
||||
foreach (var (xform, stats, cooldown, knockback, windup, region) in
|
||||
|
||||
Reference in New Issue
Block a user