Input System

Table of Contents

Overview

RCCP's input system supports multiple input methods through a centralized RCCP_InputManager singleton. It handles keyboard, gamepad, mobile touch, gyroscope, and virtual steering wheel input, and is compatible with both Unity's legacy Input Manager and the new Input System package.

Input Architecture


RCCP_InputManager (singleton, reads hardware input)
    ↓ provides RCCP_Inputs struct
RCCP_Input (per-vehicle component, processes and applies inputs)
    ↓ vehicle-specific values
RCCP_CarController (uses processed inputs for driving)
  1. RCCP_InputManager reads raw input from the hardware (keyboard, gamepad, touch screen) and populates an RCCP_Inputs struct with normalized values
  2. RCCP_Input (on each vehicle) fetches these values and applies vehicle-specific processing: auto-reverse, steering limiters, counter-steering, throttle cut during shifts
  3. The processed inputs drive the engine, gearbox, brakes, steering, and other systems

Default Controls

Keyboard

ActionKey
AccelerateW or Up Arrow
Brake / ReverseS or Down Arrow
Steer LeftA or Left Arrow
Steer RightD or Right Arrow
HandbrakeSpace
NOSLeft Shift
ClutchLeft Ctrl
Start / Stop EngineI
Headlights (Low)L
Headlights (High)K
Left IndicatorQ
Right IndicatorE
Hazard LightsZ
Gear UpLeft Shift (manual)
Gear DownLeft Ctrl (manual)
Change CameraC
Look BackB
RecordR
ReplayT

Gamepad

ActionButton
AccelerateRight Trigger
BrakeLeft Trigger
SteerLeft Stick (horizontal)
HandbrakeA / Cross
NOSB / Circle
Gear UpRight Bumper
Gear DownLeft Bumper
Change CameraY / Triangle
Look AroundRight Stick

RCCP automatically detects the connected gamepad type and displays appropriate button icons (Xbox, PlayStation, etc.) via the RCCP_GamepadIcons system.

Mobile

RCCP supports four mobile input modes:

ModeDescription
TouchScreenOn-screen buttons for throttle, brake, steering
GyroDevice tilt controls steering, on-screen throttle/brake
SteeringWheelVirtual steering wheel with on-screen pedals
JoystickVirtual joystick for steering, on-screen throttle/brake

Set the mobile controller type via:


RCCP.SetMobileController(RCCP_Settings.MobileController.SteeringWheel);

Or through the RCCP Settings asset.

Input Processing

The RCCP_Input component applies several processing steps to raw input before it reaches the vehicle:

Auto-Reverse

When using automatic transmission, if the player holds brake while the vehicle is nearly stopped, the vehicle automatically shifts into reverse and the brake input becomes throttle.

Counter-Steering

When the vehicle is sliding, a configurable counter-steering factor automatically applies slight corrective steering opposite to the slide direction. This makes the vehicle easier to control without requiring expert input.

Steering Limiter

At speeds above approximately 15 km/h, if the wheels are slipping significantly, the maximum steering angle is reduced to prevent violent spins. This works in conjunction with the speed-based steering curve from the behavior preset.

Throttle Cut During Shifts

During gear changes, throttle input is temporarily zeroed to simulate the real-world power interruption during a gear shift.

Speed-Based Steering

The behavior preset defines a steering curve that reduces the maximum steering angle at higher speeds. This prevents unrealistically sharp turns at highway speeds.

Input Overriding

You can bypass the normal input pipeline entirely to control a vehicle from your own script, AI system, or network synchronization:


// Create custom inputs
RCCP_Inputs customInputs = new RCCP_Inputs();
customInputs.throttleInput = 0.8f;  // 80% throttle
customInputs.steerInput = 0.3f;     // Slight right turn
customInputs.brakeInput = 0f;

// Apply to a vehicle
vehicle.Inputs.OverrideInputs(customInputs);

// Later, restore normal input
vehicle.Inputs.DisableOverrideInputs();

Override Flags

FlagDescription
overridePlayerInputsSkip RCCP_InputManager, use custom RCCP_Inputs
overrideExternalInputsSkip post-processing (steering limiter, auto-reverse, etc.)

Input Rebinding

Players can remap controls at runtime. The rebinding system saves and loads custom key mappings automatically if autoSaveLoadInputRebind is enabled in RCCP Settings.

UI Integration

Input Values

All input values are normalized to standard ranges:

InputRangeDescription
Throttle0 to 10 = no gas, 1 = full throttle
Brake0 to 10 = no brake, 1 = full brake
Steering-1 to 1-1 = full left, 1 = full right
Handbrake0 to 10 = released, 1 = fully engaged
Clutch0 to 10 = released, 1 = fully pressed
NOS0 to 10 = off, 1 = full NOS

Events

The input system fires events that you can subscribe to:


// Gear shift events
RCCP_InputManager.OnGearShiftedUp += () => { /* gear up */ };
RCCP_InputManager.OnGearShiftedDown += () => { /* gear down */ };

Next Steps