Inputs

Table of Contents

Overview

RCCP uses Unity's New Input System (com.unity.inputsystem package) for all player input. This replaces the legacy Input.GetAxis / Input.GetKey approach with a modern, data-driven system that supports multiple devices out of the box.

Key points:

Input Architecture

Input flows through three layers before reaching the vehicle:


InputActionAsset (.inputactions file)
        |
        v
RCCP_InputManager  (singleton, reads actions, fires static events)
        |
        v
RCCP_Input  (per-vehicle component, processes and applies inputs)
        |
        v
RCCP_CarController  (vehicle systems consume throttle, brake, steer, etc.)

Action Maps

The InputActionAsset contains three action maps:

Action MapPurposeActions
VehicleDriving controlsThrottle, Brake, Steering, Handbrake, NOS, Clutch, Engine, Lights, Indicators, Gears, Trail Detach
CameraCamera controlMouseInput, Change Camera, Look Back, Zoom, Hold (orbit)
OptionalRecording and replayRecord, Replay

All three maps are enabled simultaneously at runtime. The RCCP_InputManager caches references to each map on initialization for performance.

RCCP_Inputs Struct

The RCCP_Inputs class carries all analog input values between the manager and vehicle components:

FieldTypeRangeDescription
throttleInputfloat0 to 1Throttle pedal amount
brakeInputfloat0 to 1Brake pedal amount
steerInputfloat-1 to 1Steering direction (negative = left, positive = right)
handbrakeInputfloat0 to 1Handbrake engagement
clutchInputfloat0 to 1Clutch disengagement
nosInputfloat0 to 1Nitrous oxide activation
mouseInputVector2unboundedMouse/stick delta for camera orbit

Button-press actions (engine start, lights, gear shifts, etc.) are not carried in this struct. They are delivered via static events instead. See Input Events below.

Default Keyboard Bindings

Vehicle Controls

ActionKeyboard KeyDescription
ThrottleW / Up ArrowAccelerate
BrakeS / Down ArrowBrake / Decelerate
Steer LeftA / Left ArrowTurn left
Steer RightD / Right ArrowTurn right
HandbrakeSpaceEngage handbrake
NOS (Nitrous)FActivate nitrous oxide boost
ClutchMDisengage clutch
Start/Stop EngineIToggle engine on/off
Low Beam HeadlightsLToggle low beam headlights
High Beam HeadlightsKToggle high beam headlights
Indicator LeftQToggle left turn signal
Indicator RightEToggle right turn signal
Indicator HazardZToggle hazard lights
Gear Shift UpLeft ShiftShift up one gear
Gear Shift DownLeft CtrlShift down one gear
Gear N (Neutral)NToggle neutral gear
Gear 11Shift directly to 1st gear
Gear 22Shift directly to 2nd gear
Gear 33Shift directly to 3rd gear
Gear 44Shift directly to 4th gear
Gear 55Shift directly to 5th gear
Gear 66Shift directly to 6th gear
Trail DetachTDetach attached trailer

Camera Controls

ActionKeyboard / MouseDescription
Change CameraCCycle through camera modes
Look BackBLook behind vehicle (hold)
Camera OrbitMouse DeltaOrbit camera around vehicle
Hold OrbitLeft Mouse ButtonEnable camera orbit mode
ZoomMouse Scroll WheelZoom camera in/out

Optional Controls

ActionKeyboard KeyDescription
RecordRStart/stop recording vehicle state
ReplayPStart/stop replaying recorded state

Default Gamepad Bindings

These bindings use the standard Gamepad layout. Button names follow Unity's convention: Button South = A (Xbox) / X (PlayStation), Button East = B (Xbox) / O (PlayStation), and so on.

Vehicle Controls

ActionGamepad InputDescription
ThrottleRight TriggerAccelerate
BrakeLeft TriggerBrake / Decelerate
SteeringLeft Stick (horizontal)Turn left/right
HandbrakeButton South (A / X)Engage handbrake
NOS (Nitrous)Button East (B / O)Activate nitrous
Start/Stop EngineButton North (Y / Triangle)Toggle engine
Low Beam HeadlightsD-Pad UpToggle low beam
High Beam HeadlightsLeft Stick DownToggle high beam
Indicator LeftD-Pad LeftToggle left signal
Indicator RightD-Pad RightToggle right signal
Indicator HazardD-Pad DownToggle hazard lights
Gear Shift UpRight Shoulder (RB / R1)Shift up
Gear Shift DownLeft Shoulder (LB / L1)Shift down
Trail DetachRight Stick PressDetach trailer

Camera Controls

ActionGamepad InputDescription
Change CameraLeft Stick PressCycle camera modes
Look BackButton West (X / Square)Look behind (hold)
Camera OrbitRight StickOrbit camera
Hold OrbitRight Stick PressToggle orbit mode

Additional Control Schemes

RCCP includes preconfigured bindings for two additional devices:

You can view and edit all bindings by opening the InputActionAsset at Assets/Realistic Car Controller Pro/InputActions/RCCP_InputActions.inputactions in Unity's Input Actions editor.

Transmission Modes

RCCP supports three transmission types, configured on the RCCP_Gearbox component. The active transmission mode determines how gear input is interpreted.

Automatic

The gearbox shifts automatically based on engine RPM thresholds. No manual gear input is required from the player. The shift point is controlled by the shiftThreshold property on RCCP_Gearbox (higher values = shifts at higher RPM for a sportier feel).

When Auto Reverse is enabled on RCCP_Input (default: on), the vehicle automatically shifts into reverse when the player holds the brake at low speed, and shifts back to first gear when accelerating forward.

Manual

The player shifts gears manually using the Gear Shift Up and Gear Shift Down inputs (Left Shift / Left Ctrl by default). Direct gear selection is also available using number keys 1-6, N for neutral, or by pressing Gear_R for reverse (only available on G920 wheel scheme by default).

Automatic DNRP (Semi-Automatic)

Uses a Drive / Neutral / Reverse / Park selector similar to a real automatic vehicle. Within Drive mode, gears shift automatically. The player selects the operating mode (D, N, R, or P) using the gear selector inputs.

Input Component Settings

Each vehicle has an RCCP_Input component with per-vehicle input processing settings. These let you fine-tune how raw input translates into vehicle behavior.

Steering Curve

An AnimationCurve that reduces the maximum steering angle as vehicle speed increases. This prevents unrealistic sharp turns at high speed.

Steering Limiter

When enabled (default: on), reduces the allowed steering angle when the vehicle is skidding sideways at speeds above 15 km/h. This prevents the player from oversteering into an unrecoverable spin.

Counter Steering

When enabled (default: on), automatically applies a slight counter-steer correction based on front axle sideways slip. This helps stabilize the vehicle during oversteer situations.

The strength is controlled by counterSteerFactor (0 to 1, default: 0.5).

Auto Reverse

When enabled (default: on) and the transmission is set to Automatic, the vehicle automatically shifts into reverse when the brake is held firmly (over 75% input) while nearly stopped (under 3 km/h). It shifts back to first gear when the vehicle starts moving forward again.

Inverse Throttle/Brake on Reverse

When enabled (default: on) and the transmission is Automatic, the throttle and brake inputs are swapped while the vehicle is in reverse gear. This means pressing the throttle key drives the vehicle backward and pressing the brake key slows it down, which feels more natural.

Cut Throttle When Shifting

When enabled (default: on), throttle input is forced to zero during an active gear shift. This creates a brief power interruption similar to a real manual gearbox, preventing harsh gear engagement.

Brake/Handbrake on Disable

Two options control what happens when the vehicle loses player control (canControl becomes false):

Deadzones

Configurable per input axis to prevent analog stick drift or minor input noise from affecting the vehicle. Each deadzone is a float from 0 to 0.2 (default: 0.05 for all axes).

Deadzone PropertyApplies To
steeringDeadzoneSteering input
throttleDeadzoneThrottle input
brakeDeadzoneBrake input
handbrakeDeadzoneHandbrake input
nosDeadzoneNitrous input
clutchDeadzoneClutch input

Values below the deadzone threshold are treated as zero. The remaining range is remapped to 0-1 so you do not lose any usable range.

Input Rebinding at Runtime

RCCP supports letting players remap controls at runtime using Unity's built-in interactive rebinding API.

How It Works

  1. The player clicks a rebind button in the UI.
  2. An overlay appears with a "Waiting for input..." prompt.
  3. The player presses the desired key or button.
  4. The new binding is applied and displayed.
  5. Bindings are saved to PlayerPrefs as JSON.

Key Classes

ClassPurpose
RCCP_RebindSaveLoadStatic utility that saves and loads binding overrides to/from PlayerPrefs using the key "rebinds".
RCCP_UI_RebindInputUI component that handles interactive rebinding for a single action. Attach to a UI button, assign an InputActionReference, and wire up the text labels.
RCCP_UI_RebindInputResetUI component that resets all rebind overrides back to defaults.

Auto Save/Load

When autoSaveLoadInputRebind is enabled in RCCP_Settings, rebind overrides are automatically saved after changes and loaded on startup via RCCP_RebindSaveLoad.Save() and RCCP_RebindSaveLoad.Load().

Setting Up Rebind UI

  1. Create a UI button for each action you want to be rebindable.
  2. Add the RCCP_UI_RebindInput component to each button.
  3. Assign the InputActionReference for the target action.
  4. Assign TextMeshPro labels for the action name and current binding display.
  5. Optionally assign a rebind overlay GameObject that appears during rebinding.
  6. Call StartInteractiveRebind() from the button's OnClick event.

Input Events

The RCCP_InputManager fires static events for all button-press actions. These events are not carried in the RCCP_Inputs struct because they are one-shot triggers rather than continuous analog values.

Gear Events

EventSignatureFired When
OnGearShiftedUpvoid()Player shifts up one gear
OnGearShiftedDownvoid()Player shifts down one gear
OnGearShiftedTovoid(int gearIndex)Player selects a specific gear (0-5 for gears 1-6, -1 for reverse)
OnGearShiftedToNvoid()Player toggles neutral gear
OnGearTogglevoid(TransmissionType)Transmission type is switched
OnAutomaticGearvoid(SemiAutomaticDNRPGear)DNRP selector position changes (D, N, R, or P)

Camera Events

EventSignatureFired When
OnChangedCameravoid()Player cycles to next camera
OnLookBackCameravoid(bool state)Look-back pressed (true) or released (false)
OnHoldOrbitCameravoid(bool state)Orbit hold pressed (true) or released (false)

Light Events

EventSignatureFired When
OnPressedLowBeamLightsvoid()Low beam headlights toggled
OnPressedHighBeamLightsvoid()High beam headlights toggled
OnPressedLeftIndicatorLightsvoid()Left turn signal toggled
OnPressedRightIndicatorLightsvoid()Right turn signal toggled
OnPressedIndicatorLightsvoid()Hazard lights toggled

Engine Events

EventSignatureFired When
OnStartEnginevoid()Engine start/stop requested
OnStopEnginevoid()Engine stop requested

Stability Helper Events

EventSignatureFired When
OnSteeringHelpervoid()Steering helper toggled
OnTractionHelpervoid()Traction helper toggled
OnAngularDragHelpervoid()Angular drag helper toggled
OnABSvoid()ABS toggled
OnESPvoid()ESP toggled
OnTCSvoid()TCS toggled

Other Events

EventSignatureFired When
OnTrailerDetachvoid()Trailer detach requested
OnRecordvoid()Recording toggled
OnReplayvoid()Replay toggled
OnOptionsvoid()Options menu requested

Subscribing to Events

To listen for input events from your own scripts:


void OnEnable() {
    RCCP_InputManager.OnGearShiftedUp += HandleGearUp;
    RCCP_InputManager.OnPressedLowBeamLights += HandleLowBeam;
}

void OnDisable() {
    RCCP_InputManager.OnGearShiftedUp -= HandleGearUp;
    RCCP_InputManager.OnPressedLowBeamLights -= HandleLowBeam;
}

void HandleGearUp() {
    Debug.Log("Player shifted up!");
}

void HandleLowBeam() {
    Debug.Log("Low beam toggled!");
}

Always unsubscribe in OnDisable() to prevent memory leaks and errors from destroyed objects.

Mobile Input

When mobileControllerEnabled is turned on in RCCP_Settings, the RCCP_InputManager switches from reading the InputActionAsset to reading values from RCCP_MobileInputs.Instance instead. This provides touch-based on-screen controls for throttle, brake, steering, handbrake, and NOS.

For detailed information on setting up mobile controls, see Mobile.

Troubleshooting

No input response at all

Vehicle not responding to input

Stuck inputs after alt-tabbing

RCCP automatically handles application focus and pause events. When the application loses focus or is paused, all input values are reset to zero and the InputActionAsset is temporarily disabled. If you still experience stuck inputs, check that no custom code is overriding the RCCP_InputManager inputs.

Rebindings not saving

Gamepad not detected

Next Steps


Support: bonecrackergames@gmail.com | www.bonecrackergames.com

Need help? See Troubleshooting