using Unity.Mathematics;
namespace ProjectM.Simulation
{
///
/// Pure, Burst-friendly math for top-down character control, factored out for EditMode unit testing
/// (no World/system needed). Maps a twin-stick move axis + speed to a planar world velocity.
///
public static class CharacterControlMath
{
///
/// Twin-stick move (x,y) on the XZ plane scaled by . Input longer than unit
/// length is clamped (so diagonals aren't faster than cardinals); shorter is left proportional
/// (analog sticks). Returns a world velocity with Y == 0.
///
public static float3 DesiredMovement(float2 move, float speed)
{
float lenSq = math.lengthsq(move);
if (lenSq > 1f)
move = math.normalize(move);
return new float3(move.x, 0f, move.y) * speed;
}
}
}