updateThrottle method
- GamepadState state
Updates the throttle if either shoulder button is pressed.
Implementation
void updateThrottle(GamepadState state) {
if (!leftShoulderFlag && state.leftShoulder) throttle -= 0.1;
leftShoulderFlag = state.leftShoulder;
if (!rightShoulderFlag && state.rightShoulder) throttle += 0.1;
rightShoulderFlag = state.rightShoulder;
throttle = throttle.clamp(0, 1);
}