using System;
using Unity.CharacterController;
using Unity.Entities;
using Unity.Mathematics;
namespace ProjectM.Simulation
{
///
/// Tunables for the top-down kinematic character (M5b: Unity Character Controller package). Twin-stick /
/// planar: NO jump, NO air control, NO gravity, NO view pitch. The per-tick target speed comes from the
/// data-driven via ; this
/// component only carries the smoothing sharpness + step/slope handling the CC processor needs. Authored
/// on the player prefab by PlayerCharacterAuthoring. Not a ghost — movement replicates through the
/// owner-predicted LocalTransform (re-simulated on the owner, interpolated on remotes).
///
[Serializable]
public struct CharacterComponent : IComponentData
{
/// How quickly RelativeVelocity is lerped toward the target velocity on the ground.
public float GroundedMovementSharpness;
/// Step/slope handling params (defaults; planar ground so mostly inert).
public BasicStepAndSlopeHandlingParameters StepAndSlopeHandling;
public static CharacterComponent GetDefault()
{
return new CharacterComponent
{
GroundedMovementSharpness = 15f,
StepAndSlopeHandling = BasicStepAndSlopeHandlingParameters.GetDefault(),
};
}
}
///
/// Per-tick, NON-replicated control for the CC processor, derived each predicted tick from the replicated
/// by . Derived (not authored, not a ghost): a
/// pure function of replicated input + recomputed stats, so it reproduces identically on server, owning
/// client, and across rollback re-simulation.
///
[Serializable]
public struct CharacterControl : IComponentData
{
/// World-space desired velocity (already scaled by MoveSpeed, Y == 0). The processor lerps
/// RelativeVelocity toward this each tick.
public float3 MoveVelocity;
}
}