Minor - V0.3.0 - Ajoute frein classique et frein à main - V

Adds a traditional brake alongside the existing handbrake functionality.

This change allows for more controlled deceleration using a standard braking system and introduces a brake power parameter in the vehicle controller for further adjustment. The input manager is updated to accommodate a new brake input, and the vehicle controller uses this input to apply a progressive braking force, particularly at lower speeds.

Also corrects a typo in the braking logic.
This commit is contained in:
2026-02-03 19:27:33 +01:00
parent 7a3d9e54c4
commit 8ffb00a024
5 changed files with 162 additions and 34 deletions

View File

@@ -7,15 +7,18 @@ namespace ArcadeVP
{
public ArcadeVehicleController arcadeVehicleController;
[HideInInspector] public float horizontal;
[HideInInspector] public float vertical;
[HideInInspector] public float jump;
[HideInInspector] public float steering;
[HideInInspector] public float acceleration;
[HideInInspector] public float handbrake;
[HideInInspector] public float brake;
private PlayerInput _playerInput;
private InputAction _steerAction;
private InputAction _accelAction;
private InputAction _handbrakeAction;
private InputAction _brakeAction;
private void Awake()
{
_playerInput = GetComponent<PlayerInput>();
@@ -27,16 +30,18 @@ namespace ArcadeVP
_steerAction = _playerInput.actions["Steer"];
_accelAction = _playerInput.actions["Accelerate"];
_brakeAction = _playerInput.actions["HandBrake"];
_handbrakeAction = _playerInput.actions["HandBrake"];
_brakeAction = _playerInput.actions["Brake"];
}
private void Update()
{
horizontal = _steerAction?.ReadValue<float>() ?? 0f;
vertical = _accelAction?.ReadValue<float>() ?? 0f;
jump = _brakeAction?.ReadValue<float>() ?? 0f;
steering = _steerAction?.ReadValue<float>() ?? 0f;
acceleration = _accelAction?.ReadValue<float>() ?? 0f;
handbrake = _handbrakeAction?.ReadValue<float>() ?? 0f;
brake = _brakeAction?.ReadValue<float>() ?? 0f;
arcadeVehicleController.ProvideInputs(horizontal, vertical, jump);
arcadeVehicleController.ProvideInputs(steering, acceleration, handbrake, brake);
}
}
}