Class InputManagerVehicleInputProvider
Vehicle input provider implementation for Unity's legacy Input Manager system, supporting keyboard, mouse, and gamepad inputs through traditional input axes and buttons.
Inheritance
Inherited Members
Namespace: NWH.VehiclePhysics2.Input
Assembly: NWH.VehiclePhysics2.dll
Syntax
public class InputManagerVehicleInputProvider : VehicleInputProviderBase
Remarks
InputManagerVehicleInputProvider integrates with Unity's Input Manager (Edit > Project Settings > Input Manager) to provide vehicle control through keyboard keys, mouse input, and gamepad axes. This is the traditional Unity input system that uses string-based input names and axis configurations.
Supported input methods include: - Keyboard controls for all vehicle functions (WASD, arrow keys, number keys for gears) - Mouse steering option for enhanced precision control - Gamepad support through configured axes and buttons - Direct gear selection through numbered keys (1-8 for gears, R for reverse) - Function keys for lights, horn, and other auxiliary controls
This provider is ideal for PC/desktop games and provides backward compatibility with existing Unity projects that use the Input Manager. Configure input axes in the Input Manager to customize key bindings and sensitivity settings for different control schemes.
Fields
mouseInput
Should mouse be used for input?
Declaration
[Tooltip("Should mouse be used for input?")]
public bool mouseInput
Field Value
| Type | Description |
|---|---|
| bool |
shiftInputNames
Input Manager binding names for direct gear selection in H-pattern shifters. Array indices map to gear numbers: index 0 = reverse (-1), index 1 = neutral (0), index 2 = 1st gear, etc. To add more gears, extend this array and update the ShiftInto() method accordingly.
Declaration
[NonSerialized]
[Tooltip("Names of input bindings for each individual gears. If you need to add more gears modify this and the corresponding\r\niterator in the\r\nShiftInto() function.")]
public string[] shiftInputNames
Field Value
| Type | Description |
|---|---|
| string[] |
Methods
Boost()
Returns true while the boost button is held down. Only functional when NOSModule or similar boost module is present and enabled. Provides temporary power increase when active.
Declaration
public override bool Boost()
Returns
| Type | Description |
|---|---|
| bool | True while button is pressed. |
Overrides
Brakes()
Returns the current brake input value normalized to [0, 1] range. 0 means no braking, 1 means full braking force.
Declaration
public override float Brakes()
Returns
| Type | Description |
|---|---|
| float | Brake input value between 0 and 1. |
Overrides
Clutch()
Returns the current clutch input value normalized to [0, 1] range. 0 means clutch fully engaged (pedal released), 1 means clutch fully disengaged (pedal pressed). Used with manual transmissions for gear changes and preventing engine stalls.
Declaration
public override float Clutch()
Returns
| Type | Description |
|---|---|
| float | Clutch input value between 0 and 1. |
Overrides
CruiseControl()
Returns true when the cruise control toggle button is pressed this frame. Only functional when CruiseControlModule is present and enabled. Maintains constant vehicle speed without throttle input.
Declaration
public override bool CruiseControl()
Returns
| Type | Description |
|---|---|
| bool | True if button was pressed this frame. |
Overrides
EngineStartStop()
Returns true when the engine start/stop button is pressed this frame. Toggles the engine on/off state.
Declaration
public override bool EngineStartStop()
Returns
| Type | Description |
|---|---|
| bool | True if button was pressed this frame. |
Overrides
ExtraLights()
Returns true when the extra lights toggle button is pressed this frame. Controls auxiliary lights such as fog lights, work lights, or off-road lights.
Declaration
public override bool ExtraLights()
Returns
| Type | Description |
|---|---|
| bool | True if button was pressed this frame. |
Overrides
FlipOver()
Returns true when the flip-over button is pressed this frame. Only functional when FlipOverModule is present and enabled, used to right overturned vehicles.
Declaration
public override bool FlipOver()
Returns
| Type | Description |
|---|---|
| bool | True if button was pressed this frame. |
Overrides
Handbrake()
Returns the current handbrake input value normalized to [0, 1] range. 0 means released, 1 means fully engaged. Typically used for drifting or parking.
Declaration
public override float Handbrake()
Returns
| Type | Description |
|---|---|
| float | Handbrake input value between 0 and 1. |
Overrides
HazardLights()
Returns true when the hazard lights toggle button is pressed this frame. Activates all turn signals simultaneously for emergency warning.
Declaration
public override bool HazardLights()
Returns
| Type | Description |
|---|---|
| bool | True if button was pressed this frame. |
Overrides
HighBeamLights()
Returns true when the high beam headlights toggle button is pressed this frame. Switches headlights between low beam and high beam mode.
Declaration
public override bool HighBeamLights()
Returns
| Type | Description |
|---|---|
| bool | True if button was pressed this frame. |
Overrides
Horn()
Returns true while the horn button is held down. Unlike toggle buttons, this is typically held for continuous horn sound.
Declaration
public override bool Horn()
Returns
| Type | Description |
|---|---|
| bool | True while button is pressed. |
Overrides
LeftBlinker()
Returns true when the left turn signal button is pressed this frame. Toggles the left turn indicator on/off.
Declaration
public override bool LeftBlinker()
Returns
| Type | Description |
|---|---|
| bool | True if button was pressed this frame. |
Overrides
LowBeamLights()
Returns true when the low beam headlights toggle button is pressed this frame. Turns the main headlights on or off.
Declaration
public override bool LowBeamLights()
Returns
| Type | Description |
|---|---|
| bool | True if button was pressed this frame. |
Overrides
RightBlinker()
Returns true when the right turn signal button is pressed this frame. Toggles the right turn indicator on/off.
Declaration
public override bool RightBlinker()
Returns
| Type | Description |
|---|---|
| bool | True if button was pressed this frame. |
Overrides
ShiftDown()
Returns true when the sequential shift down button is pressed this frame. Shifts transmission to the next lower gear in sequential mode.
Declaration
public override bool ShiftDown()
Returns
| Type | Description |
|---|---|
| bool | True if button was pressed this frame. |
Overrides
ShiftInto()
Returns the directly selected gear index for H-pattern shifters. Checks all configured gear input bindings and returns the gear number if any key is pressed. Used for direct gear selection in non-sequential transmissions.
Declaration
public override int ShiftInto()
Returns
| Type | Description |
|---|---|
| int | Gear index (-1 for reverse, 0 for neutral, 1-9 for forward gears), or -999 if no gear key is pressed. |
Overrides
ShiftUp()
Returns true when the sequential shift up button is pressed this frame. Shifts transmission to the next higher gear in sequential mode.
Declaration
public override bool ShiftUp()
Returns
| Type | Description |
|---|---|
| bool | True if button was pressed this frame. |
Overrides
Steering()
Returns the current steering input value normalized to [-1, 1] range. -1 means full left, 0 means centered, 1 means full right.
Declaration
public override float Steering()
Returns
| Type | Description |
|---|---|
| float | Steering input value between -1 and 1. |
Overrides
Throttle()
Returns the current throttle input value normalized to [0, 1] range. 0 means no throttle, 1 means full throttle.
Declaration
public override float Throttle()
Returns
| Type | Description |
|---|---|
| float | Throttle input value between 0 and 1. |
Overrides
TrailerAttachDetach()
Returns true when the trailer attach/detach button is pressed this frame. Only functional when TrailerHitchModule is present and enabled on the vehicle.
Declaration
public override bool TrailerAttachDetach()
Returns
| Type | Description |
|---|---|
| bool | True if button was pressed this frame. |