bd8458853b
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>
25 lines
1.4 KiB
C#
25 lines
1.4 KiB
C#
using Unity.Entities;
|
|
|
|
namespace ProjectM.Simulation
|
|
{
|
|
/// <summary>
|
|
/// Singleton holding the physics-filter mask of the static world-collision layer ("Environment"): the baked
|
|
/// boundary ring + landmark colliders the player CC sweeps. Baked from the GameObject layer at edit-time (see
|
|
/// WorldCollisionAuthoring) so server systems can build a <c>CollisionFilter</c> in Burst WITHOUT a managed
|
|
/// <c>LayerMask.NameToLayer</c> call or a hardcoded layer index. Read by <see cref="ProjectM.Server"/>'s
|
|
/// EnemyAISystem to sweep-test Husk movement against the environment only (never the player / other Husks).
|
|
/// </summary>
|
|
public struct WorldCollisionConfig : IComponentData
|
|
{
|
|
/// <summary>BelongsTo bitmask of the Environment physics layer (<c>1u << layerIndex</c>).</summary>
|
|
/// <summary>BelongsTo bitmask of the Environment physics layer (<c>1u << layerIndex</c>).</summary>
|
|
public uint EnvironmentMask;
|
|
|
|
/// <summary>DR-042 C5: BelongsTo bitmask of the "Structure" physics layer (player-built Wall/Turret/Pylon
|
|
/// colliders). OR'd into the enemy-movement sweep filter so husks collide-and-slide against walls. 0 if the
|
|
/// layer is absent (feature inert). The layer matrix excludes Structure×the player layer so the player CC
|
|
/// passes through its own walls.</summary>
|
|
public uint StructureMask;
|
|
}
|
|
}
|