Keyboard turning ramps down on release at the same rate it ramps up, so tapping at a rate holds a gentle turn; reversal still cuts to zero

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
soul 2026-10-29 08:09:29 +01:00
commit 633ae3353a
2 changed files with 12 additions and 6 deletions

View file

@ -203,6 +203,8 @@ public class ActionGameManager : MonoBehaviour
private readonly HelmInput _helm = new HelmInput();
// Seconds a held turn key takes to reach full turn rate.
public float KeyboardTurnRampTime = .4f;
// Whether the turn axis was last driven by keys; kept while released so the ramp down still applies.
private bool _turnDigital;
private TextMeshProUGUI _faceAimMark;
private (HardpointData[] hardpoints, Transform[] barrels, PlaceUIElementWorldspace crosshair)[] _articulationGroups;
// The outgoing progress indicators on the player's target: one per lock weapon (its Lock, shown only on a hostile target)
@ -1337,8 +1339,9 @@ public class ActionGameManager : MonoBehaviour
{
ship.Command.Movement = Input.Player.Move.ReadValue<Vector2>().ToCultMath();
_helm.Held = Input.Player.FaceAim.IsPressed();
var turnDigital = Input.Player.Turn.activeControl?.device is UnityEngine.InputSystem.Keyboard;
var turnAxis = _helm.TurnAxis(Input.Player.Turn.ReadValue<float>(), turnDigital, Time.deltaTime, KeyboardTurnRampTime);
if (Input.Player.Turn.activeControl is { } turnControl)
_turnDigital = turnControl.device is UnityEngine.InputSystem.Keyboard;
var turnAxis = _helm.TurnAxis(Input.Player.Turn.ReadValue<float>(), _turnDigital, Time.deltaTime, KeyboardTurnRampTime);
ship.Command.Turn = _helm.Demand(_viewDirection.xz, turnAxis);
}