Reverse is engaged by writing the appropriate values in the Input Channel of the data bus. Depending on the Transmission setup in the GearBox:
- Manual Transmission: write -1 to the entry ManualGear.
- Automatic Transmission: write 2 to the entry AutomaticGear.
Note that the values in the Input Channel represent the actions from the driver. The results may be effective or not depending on the car's setup and state. For example, if Strict Park Mode is enabled in the Gearbox and the Park mode (P) is active, then engaging reverse also requires the brakes pedal to be pressed. Otherwise, writing the described values to the bus won't have any effect.
The logic for "Auto Forward and Reverse" should be implemented in your script. You can read the entry Speed in the Vehicle Channel of the data bus to find out whether the vehicle is moving forwards or backwards, then convert your entries accordingly. Examples:
- If Speed is negative and forward is pressed in your controller then write "throttle = 0" and "brakes = forward" to the vehicle's data bus.
- If Speed is below some threshold and reverse is pressed in your controller, then engage Reverse as described above and write "throttle = reverse" and "brakes = 0" to the vehicle's data bus.
And so on.