Gearbox block #

VP Vehicle Controller gearbox

Transmission Type #

Manual

Each gear is either engaged or disengaged. Smooth gear shifting requires engaging the clutch or configuring a Torque Converter.

The Auto shift option in the Gearbox configuration provides automatic gear shifting.

Automatic

Gears are engaged via clutches inside the gearbox, so shifting gears provide a smooth transition between them. Automatic transmissions are typically used in combination with a Torque Converter as clutch.

The [D] mode provides auto-shifting, while the [M] mode requires gears to be engaged manually.

Gear Ratios #

Forward Gear Ratios
Forward gears (positive ratios). 0 is the first gear, 1 the second gear, and so on. Ratios should be configured in descending order for the automatic shifting features to work.
Reverse Gear Ratios
Reverse gears (negative ratios). 0 is the first reverse gear, 1 the second reverse gear, and so on. If Auto-shift in Reverse is enabled then ratios should be specified in ascending order (i.e. -3, -2, -1).

Manual Transmission #

Each gear is either engaged or disengaged. Smooth gear shifting requires engaging the clutch or configuring a Torque Converter.

VP Manual Transmission

Gear Change Time
Time in seconds that takes shifting to current gear to another. Gearbox stays in Neutral during this time.
Auto Shift

Enables automatic gear shifting

Neutral Rpm
Engages Neutral when rpm falls below this value
First Gear Rpm
First Gear is engaged from Neutral above this rpm
Gear Down Rpm
Shifts gear down below this rpm
Gear Up Rpm
Shifts gear up above this rpm
Gear Up Interval
Minimum time in seconds between two consecutive gear up shifts.
Gear Down Interval
Minimum time in seconds between two consecutive gear down shifts.
2nd Gear Min Speed
Minimum speed of the vehicle in m/s to allow automatic gear shifting above the 2nd gear. Useful to prevent gear shifting when the drive wheels are heavily slipping in 1st gear.
Allow Park Mode

Park mode [P] is typical of automatic transmissions. This option enables park mode in the manual transmission.

Strict Park Mode
If enabled the park mode [P] can be engaged or disengaged only when the brake is strongly pressed.

Automatic Transmission #

Gears are engaged via clutches inside the gearbox, so shifting gears provide a smooth transition between them. Automatic transmissions are typically used in combination with a Torque Converter as clutch.

VP Automatic Transmission

Gear Transition Time
Duration in seconds of the smooth transition from a gear to another.
Shift Interval
Minimum time in seconds between two consecutive gear changes.
Gear Down Rpm
A shorter gear is selected below this rpm.
Gear Up Rpm
A longer gear is selected above this rpm.
Initial Gear Forward
The forward gear to engage when selecting the [D] mode. Typically is 1, but some vehicles with many gears may engage the 2nd, 3rd or even 4rd. In these cases the shorter gears can be selected in [L] mode and with the shift-up / shift-down inputs.
Initial Gear Reverse
The reverse gear to engage when selecting the [R] mode. Typically is -1, but some vehicles with several reverse gears may engage any other initially. Other reverse gears may be selected with the shift-up / shift-down inputs.
Next Gear Min Speed
Minimum speed of the vehicle in m/s to allow automatic engagement of gears based on current speed. Note that above this min speed the system may select a gear shorter than the initial ones.
Auto-Shift In Reverse
Applies auto-shifting in reverse mode [R]. Reverse gear ratios should be in ascending order for this feature to work properly (i.e. -3, -2, -1).
Strict Park Mode
If enabled the park mode [P] can be engaged or disengaged only when the brake is strongly pressed.

Data Bus parameters #

Data Bus Value Description Notes
InputData.ManualGear Manual gear lever position -1 (reverse), 0 (neutral), 1, 2, 3, ...
InputData.AutomaticGear Automatic transmission mode 1 0, 1, 2, 3, 4, 5 = M, P, R, N, D, L
InputData.GearShift Incremental gear shifting value 2 Add +1 for gear up or -1 for gear down
VehicleData.GearboxGear Currently engaged gear Negative = reverse, 0 = Neutral or Park, Positive = forward.
VehicleData.GearboxMode Actual transmission mode 0, 1, 2, 3, 4, 5 = M, P, R, N, D, L
VehicleData.GearboxShifting Is the gearbox in the middle of a gear shift operation? 0 = no, 1 = yes
SettingsData.AutoShiftOverride Auto-shift override setting 3 0 = no override, 1 = force auto shift, 2 = force manual shift

See Data Bus Reference for more information.

1 Automatic transmission modes:
  • M (0): Manual: do not automatically engage gears. Use manual gear shifting.
  • P (1): Park
  • R (2): Reverse. Gear shifting is supported for more than one reverse gears.
  • N (3): Neutral
  • D (4): Drive: automatically engage forward gears. Gear shifting is supported for forward gears.
  • L (5): Low: first gear only.

2 GearShift value is reset to 0 when the vehicle has acknowledged and processed the input. Successive gear shift commands can be grouped by adding/subtracting +-1 to this bus value.

3 AutoShiftOverride: See notes below.

The AutoShiftOverride value #

The automatic shifting feature in both Manual and Automatic transmissions may be overridden from scripting via Data Bus by modifying the AutoShiftOverride value in the Settings channel.

The effect of the AutoShiftOverride value depends on the vehicle's transmission type:

AutoShiftOverride is intended to temporarily override auto-shifting in specific situations. For example, it's used for preventing gear shifting during replays, as the replay data already includes the currently engaged gear.

AutoShiftOverride is not a reliable way of implementing an auto-shift / manual-shift selector in the vehicle because the value might be overwritten by other components. Read below.

Auto-shift / manual-shift selection #

Determining the transmission type

If you want to configure the shift mode externally to the vehicle (i.e. via UI or hotkey) then you should probably use a Manual transmission and modify the auto-shift flag. The Automatic transmission is intended to allow users to select among Drive [D] (automatic) or Manual [M] themselves using the vehicle input.

The behavior of the automated gear shifting is different between Automatic and Manual transmissions:

Example: Add-on component that modifies the Gearbox settings in runtime in any transmission type.

using UnityEngine;
using VehiclePhysics;

public class GearShiftModeSelector : VehicleBehaviour
    {
    public enum GearShiftMode { Manual, Automatic }
    public GearShiftMode mode = GearShiftMode.Manual;

    Gearbox.Settings m_gearboxSettings;

    public override void OnEnableVehicle ()
        {
        // Retrieve a reference to the gearbox settings
        var gearbox = vehicle.GetInternalObject(typeof(Gearbox)) as Gearbox;
        if (gearbox == null)
            {
            // This vehicle doesn't have a gearbox. Self-disable this add-on.
            enabled = false;
            }

        m_gearboxSettings = gearbox.settings;
        }

    public override void FixedUpdateVehicle ()
        {
        if (m_gearboxSettings.type == Gearbox.Type.Automatic)
            {
            // Automatic Transmission. Select the proper mode.
            if (mode == GearShiftMode.Automatic)
                {
                // Force select mode D (4) unless current mode is R (2)
                if (vehicle.data.Get(Channel.Input, InputData.AutomaticGear) != 2)
                    vehicle.data.Set(Channel.Input, InputData.AutomaticGear, 4);
                }
            else
                {
                // Force select mode M (0)
                vehicle.data.Set(Channel.Input, InputData.AutomaticGear, 0);
                }
            }
        else
            {
            // Manual gearbox. Just match the auto-shift mode.
            m_gearboxSettings.autoShift = mode == GearShiftMode.Automatic;
            }
        }
    }