Mobile Controls

Table of Contents

Realistic Car Controller Pro includes a complete mobile input system with four controller types to choose from. The system is driven by the RCCP_MobileInputs component, which reads values from on-screen UI elements and feeds them into the main input pipeline. All mobile controller settings live inside RCCP_Settings, and the visual controls are part of the RCCP UI Canvas prefab.


Overview

RCCP provides four mobile controller types:

ControllerSteering MethodUI Elements Shown
TouchScreenLeft/Right buttonsSteer Left, Steer Right, Throttle, Brake, Handbrake, NOS
GyroDevice tilt (accelerometer)Throttle, Brake, Handbrake, NOS (no steering buttons)
SteeringWheelRotatable on-screen wheelSteering Wheel, Throttle, Brake, Handbrake, NOS
JoystickDraggable analog stickJoystick, Throttle, Brake, Handbrake, NOS

The NOS button only appears when the active player vehicle has a NOS addon component attached.


Enabling Mobile Controls

  1. Open RCCP Settings: Tools > BoneCracker Games > Realistic Car Controller Pro > Settings
  2. In the Mobile Input section, enable mobileControllerEnabled (set to true)
  3. Select the desired controller type from the mobileController dropdown

When mobileControllerEnabled is false, the mobile canvas is automatically hidden regardless of platform. When true, the canvas activates and shows the appropriate UI elements for the selected controller type.

Settings Reference

FieldTypeDefaultDescription
mobileControllerEnabledboolfalseMaster toggle for mobile controls
mobileControllerenumTouchScreenActive controller type
gyroSensitivityfloat2.5Accelerometer sensitivity multiplier (Gyro mode only)

Controller Types

TouchScreen

The simplest mobile input mode. Six on-screen buttons handle all vehicle controls:

Steering is computed as -left.input + right.input, giving a final range of -1 (full left) to 1 (full right).

Sensitivity and Gravity

Each RCCP_UIController button has two tuning parameters:

ParameterDefaultWhat It Does
sensitivity5.0How fast the input value ramps up toward 1 when the button is held. Higher values produce snappier response.
gravity5.0How fast the input value returns to 0 when the button is released. Higher values make the input drop off faster.

Both values are multiplied by Time.deltaTime each frame, so the actual ramp speed is framerate-independent. The input is clamped between 0 and 1.

Gyro (Accelerometer)

In Gyro mode, the device's built-in accelerometer controls steering. RCCP uses Unity's New Input System accelerometer (UnityEngine.InputSystem.Accelerometer.current) to read the device tilt.

Tuning tip: Start with the default gyroSensitivity of 2.5. Increase it if steering feels too sluggish on tilt, decrease it if small movements cause oversteering.

Steering Wheel

An on-screen rotatable steering wheel rendered by RCCP_UI_SteeringWheelController. The player drags the wheel image to rotate it, and the rotation angle is converted to a normalized steering value between -1 and 1.

ParameterDefaultDescription
steeringWheelMaximumsteerAngle270Maximum rotation angle in degrees (both directions). The wheel can rotate from -270 to +270.
steeringWheelResetPosSpeed20How fast the wheel auto-centers when released. Uses Mathf.MoveTowards scaled by Time.deltaTime * 100.
steeringWheelCenterDeadZoneRadius5Pixel radius around the wheel center where touch input is ignored. Prevents jitter from imprecise touches near the center.

The steering input is calculated as:


input = Round(currentAngle / maximumAngle * 100) / 100

This gives two decimal places of precision. When the player releases the wheel, it smoothly returns to center at the configured reset speed.

The steering wheel uses Unity's EventTrigger system with three events: PointerDown (start tracking), Drag (update angle), and EndDrag (release and auto-center).

Joystick

A standard analog joystick handled by RCCP_UI_Joystick. It consists of a background sprite and a draggable handle sprite.

The joystick implements IDragHandler, IPointerUpHandler, and IPointerDownHandler from Unity's EventSystems.


Switching Controller Type at Runtime

You can change the active mobile controller type from code at any time:


// Switch to Gyro mode
RCCP.SetMobileController(RCCP_Settings.MobileController.Gyro);

// Switch to Joystick mode
RCCP.SetMobileController(RCCP_Settings.MobileController.Joystick);

// Switch to TouchScreen mode
RCCP.SetMobileController(RCCP_Settings.MobileController.TouchScreen);

// Switch to SteeringWheel mode
RCCP.SetMobileController(RCCP_Settings.MobileController.SteeringWheel);

There is also a ready-made UI component, RCCP_UI_SetMobileController, that you can attach to buttons in your own UI. It accepts an integer index:

IndexController
0TouchScreen
1Gyro
2SteeringWheel
3Joystick

How Mobile Input Flows

Understanding the input pipeline helps when debugging:

  1. RCCP_MobileInputs reads values from its assigned UI components (throttle, brake, left, right, ebrake, nos, steeringWheel, joystick) every frame in Update()
  2. It computes combined values: steerInput = -left.input + right.input + steeringWheel.input + joystick.inputHorizontal (only the active controller contributes since others are disabled)
  3. In Gyro mode, the accelerometer reading is added to steerInput
  4. NOS input is added to throttle input (then clamped to 0-1)
  5. All values are clamped to their valid ranges
  6. RCCP_InputManager reads these values from RCCP_MobileInputs.Instance and passes them to the active vehicle

UI Canvas Setup

The mobile UI is part of the RCCP UI Canvas prefab, which is referenced in RCCP_Settings. The canvas contains all mobile control elements, and RCCP_MobileInputs manages which elements are visible based on the active controller type.

Customizing the Layout

To customize button positions, sizes, or visuals:

  1. Locate the RCCP UI Canvas prefab in your scene (or in the project at the path referenced by RCCP Settings)
  2. Open the prefab and find the mobile control GameObjects
  3. Modify RectTransform positions, sizes, and Image sprites as needed
  4. The RCCP_UIController, RCCP_UI_SteeringWheelController, and RCCP_UI_Joystick components must remain on the correct GameObjects for input to work
  5. Make sure the RCCP_MobileInputs component references are not broken after rearranging

Required Scene Components


Platform Notes


Common Issues

ProblemLikely CauseSolution
Controls not showing on devicemobileControllerEnabled is falseEnable it in RCCP Settings
Steering too sensitive in Gyro modegyroSensitivity too highLower the value (try 1.0 - 2.0)
Steering too sluggish in Gyro modegyroSensitivity too lowRaise the value (try 3.0 - 5.0)
Buttons not responding to touchMissing EventSystem in sceneAdd an EventSystem GameObject to the scene
NOS button not visibleVehicle has no NOS addonAdd RCCP NOS component to the vehicle via OtherAddonsManager
TouchScreen buttons respond slowlyLow sensitivity on RCCP_UIControllerIncrease the sensitivity value on the button component
Input sticks after switching controllersUI element not resettingInputs auto-reset on enable/disable; check that references in RCCP_MobileInputs are assigned
Steering wheel jitters near centerDead zone too smallIncrease steeringWheelCenterDeadZoneRadius

Next Steps


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

Need help? See Troubleshooting