Skip to content

Commit

Permalink
apply vehicle input in FixedUpdate
Browse files Browse the repository at this point in the history
  • Loading branch information
mackierx111 committed Dec 19, 2024
1 parent 30677bc commit 2b07310
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions Assets/AWSIM/Scripts/Vehicles/VehicleOverrideInputManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,20 @@ public class VehicleOverrideInputManager : MonoBehaviour

[SerializeField] Vehicle vehicle;

void Update()
private void FixedUpdate()
{
ApplyInput();
}

void ApplyInput()
{
VehicleInputBase.InputArg inputArg = new VehicleInputBase.InputArg(ControlMode, AutonomousInput.SteeringInput);

// Update new input for Autonomous and Manually Inputs.
AutonomousInput.OnUpdate(inputArg);
ManuallyInput.OnUpdate(inputArg);
}

private void FixedUpdate()
{

// If override input is present, switch new ControlMode.
if (ManuallyInput.Overridden)
{
Expand All @@ -61,8 +64,6 @@ private void FixedUpdate()
vehicle.AutomaticShiftInput = ManuallyInput.ShiftInput;
vehicle.SignalInput = ManuallyInput.TurnSignalInput;
}

// TODO: Implement inputs to the vehicle in the case of other control modes.
}
}
}

0 comments on commit 2b07310

Please sign in to comment.