using System.Collections.Generic; using Unity.CharacterController; using Unity.Entities; using Unity.NetCode; namespace ProjectM.Simulation { /// /// Ghost-variant registration for the kinematic character (M5b). is /// presentation-only fixed-step smoothing that must exist ONLY on predicted clients: on the server it /// would interfere with LocalToWorld, and on interpolated remote ghosts it would double up with netcode's /// own snapshot interpolation. BakeCharacter adds it to every prefab version, so we force it /// predicted-client-only here. /// /// We deliberately do NOT override the default variants for LocalTransform or /// PhysicsVelocity (the CC sample's DontSerializeVariant on LocalTransform is global and would /// break the non-character ghosts in this project — projectiles, dummies, pickups — which rely on stock /// LocalTransform replication). The character's position therefore replicates via the normal /// owner-predicted LocalTransform path, like every other ghost. /// /// public sealed partial class CharacterGhostVariantsSystem : DefaultVariantSystemBase { protected override void RegisterDefaultVariants(Dictionary defaultVariants) { defaultVariants.Add(typeof(CharacterInterpolation), Rule.ForAll(typeof(CharacterInterpolation_GhostVariant))); } } [GhostComponentVariation(typeof(CharacterInterpolation))] [GhostComponent(PrefabType = GhostPrefabType.PredictedClient)] public struct CharacterInterpolation_GhostVariant { } }