Ship.Update reads Turn and feeds the rotation thrusters and aether drives; it no longer reads the look direction or snaps Direction toward it. Steering.Toward is the one law from heading to demand (a heading astern now turns at full demand). HelmInput owns the face-the-aim state. Accelerate, Combat and MoveTo write Turn through Steering.Toward. Entity.LookDirection is renamed Aim in the simulation, the Unity readers and the tests. Unity player input follows in the next commit. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
18 lines
630 B
C#
18 lines
630 B
C#
using CultMath;
|
|
using static CultMath.math;
|
|
|
|
// The player's face-the-aim state, engine-free. Held follows the Face Aim hold input each frame; Latched is
|
|
// flipped by the Caps Lock press. Either one faces the aim; neither leaves the hull to the turn axis.
|
|
// Runtime only, never saved: Latched starts false each session.
|
|
public class HelmInput
|
|
{
|
|
public bool Held;
|
|
public bool Latched;
|
|
|
|
public bool FaceAim => Held || Latched;
|
|
|
|
public void Toggle() => Latched = !Latched;
|
|
|
|
public float Demand(Ship ship, float2 aim, float turnAxis) =>
|
|
FaceAim ? Steering.Toward(ship, aim) : clamp(turnAxis, -1f, 1f);
|
|
}
|