- Home /
Question by
Jens12341234 · Apr 04, 2021 at 02:25 PM ·
2dinputcontrollerracing game
New input system controller stops detecting on fully pressed trigger?
Hi there,
I'm trying to make a 2d racing game using the new input system and I would like to use the right trigger on a gamepad to accelerate the car.
My code works, the only problem I'm having is that my controller starts acting weird when I press the trigger all the way.
Does anyone know why this is happening and how I can fix this? This is my movement script:
public void Accelerate(InputAction.CallbackContext context){
DrivingInput = context.ReadValue<Vector2>().y;
speed = DrivingInput * accelerationPower;
rb.AddRelativeForce (Vector2.up * speed);
}
Thanks in advance!
Comment