Custom Vehicle Controller
  • Custom Vehicle Controller
  • Guides
    • Workflow
      • Quick Setup
      • Creating New Parts
      • Modifying Parts
      • Creating Vehicle Parts Presets
      • Customizable Sets and Runtime Parts Change
      • Engine Performance Customization
      • Exposing Current Car Stats
    • API
      • CustomVehicleController
      • VehicleEngineSoundManager
      • RaceManager
      • RacerProgress
      • RaceSpawner
      • CollisionHandler
    • Vehicle Controller Input Provider
      • Input System Example
      • Mobile Input
    • Tips, Warnings and Requiremens
      • Work With Editor
      • Vehicle Set Up
    • AI Setup
      • AI Racer Creation
      • AI Racer Setup
      • AI Chaser Setup
      • Race Creation
      • Race Configuration
      • Race Information
    • Vehicle Damage System
      • Vehicle Damage Controller
      • Collision Area Partitioner
      • Part Damage Handler
      • Vehicle Attachments Aligner
      • Collision Handler
    • Additional Settings
      • Custom Vehicle Controller
      • Car Visuals Essentials
    • Package Settings
      • Assets Save Location
      • Project-Wide Surface Settings
    • Extra
      • Adding Visual Effects
        • Individual Effect Set Up
      • Adding Sound Effects
        • Adding Engine Sound
        • Adding Extra Sound Effects
  • Converting To Other Render Pipelines
    • Convert To Built-in RenderPipeline
    • Convert To HDRP RenderPipeline
Powered by GitBook
On this page
  1. Guides
  2. API

CustomVehicleController

Method
Description

GetRigidbody()

Returns Rigidbody component used by the CustomVehicleController

GetCurrentCarStats()

GetCenterOfMass()

Returns Transform which represents the CenterOfMass of the vehicle.

GetVehiclePreset()

VehiclePartsPresetSO holds references the the parts Scriptable Objects and is not intended for modifications.

GetCustomizableSet()

VehiclePartsCustomizableSet holds references the the parts Scriptable Objects and is intended for modifications.

SetVehiclePresetSO(VehiclePartsPresetSO newPreset)

SetNewPartToCustomizableSet(IVehiclePart newPart, bool front = true)

RemoveForcedInduction()

Sets the ForcedInductionSO that the VehiclePartsCustomizableSet uses to null

RemoveNitrous()

Sets the NitrousSO that the VehiclePartsCustomizableSet uses to null

UpdateWheelsRadiusFromMeshes()

Will recalculate the radius of the wheels based on the MeshRenderer's size.

AddNitroCharge(float amount)

Add the provided "amount" to the boost amount the vehicle currently has. If the added amount exceeds the maximum boost amount the bottle can contain, it will overflow into the next bottle.

SetNewEnginePart(CustomEnginePart newPart)

EnableInput(bool enable)

Enables or disables the input that the input provider component produces. When the input provider is disabled, shifting, steering, handbraking are disabled and, if the gas input isn't 0, the brake input will be equal to 1.


Property | (type)
Description

UsePreset | bool

DrivetrainType | DrivetrainType

Sets the drivetrain type of the vehicle. Possible values:

RWD (Rear Wheel Drive). AWD (All Wheel Drive).

FWD (Front Wheel Drive)

TransmissionType | TransmissionType

Sets the transmission type of the vehicle. Affects the way the gears change.

Possible values:

Automatic.

Manual (user input only).

AerialControlsEnabled | bool

AerialControlsSensitivity | float

SteerAngle | float

Maximum steering angle in degrees

SteerSpeed | float

Time in which wheels will rotate to the "Steering Input" * "Maximum Steering Angle" angle. Wheels change their rotation linearly.

CenteringSpeed | float

Time in which wheels will rotate to their default state.

ForwardSlippingThreshold | float

SidewaysSlippingThreshold | float

Defines how much slipping is allowed until the wheel is considered to be sideways slipping.

The slipping amount is the property of every tire. It equals to

The amount of raycasts that go along the forward axis of the wheel with an offset from -radius to +radius.

VehiclePartsSetWrapper | VehiclePartsSetWrapper

Reference type field allows other classes to cache it and use the up-to-date parts scriptable objects. This class holds the parts that the vehicle is using either in the form of VehiclePartsPresetSO or a VehiclePartsCustomizableSet. This class has a static "OnAnyPresetChanged" event that triggers when any used part change in any vehicle occurs and a vehicle controller-specific "OnPartsChanged" event.

FrontAxles / RearAxles / SteerAxles | VehicleAxle[]

Arrays that hold the corresponding VehicleAxles. You can use the elements of these arrays to access the WheelController components, as an example, like this: FrontAxles[0].LeftHalfShaft.WheelController

PreviousAPINextVehicleEngineSoundManager

Last updated 11 months ago

Returns Scriptable Object instance used by the CustomVehicleController.

Returns ScriptableObject, assigned to the CustomVehicleController.

Returns instance used by the CustomVehicleController.

Assigns new instance to the CustomVehicleController.

Assigns new individual part to the instance used by the CustomVehicleController. Expects any Scriptable Object that is IVehiclePart (every part that the set uses). Part type will be determined automatically. If a part is a suspension or tires, it must also be specified whether it's for the front or rear part of the vehicle.

Accepts part types that derive from . If the vehicle already has a part of this type, it will be changed for a new part, otherwise a new part will be added to the list.

If true, CustomVehicleController will use and its parts for the vehicle properties. Make sure that VehiclePartsPresetSO and none of its parts are null before setting the property to "True".

If false, CustomVehicleController will use and its parts for the vehicle properties. Make sure that none of its parts are null before setting the property to "False".

Enables vehicle aerial controls. The input is read from the class that implements

The amount of force applied in the pitch / yaw / roll rotation to the rigidbody. Force mode is .

Defines how much slipping is allowed until the wheel is considered to be forward slipping. Forward slipping occurs when acceleration force is higher than the wheel load *.

1 - at the (Dot Product of the tire right direction and vehicle velocity) value.

| int

CurrentCarStats
VehiclePartsPresetSO
VehiclePartsCustomizableSet
VehiclePartsPresetSO
VehiclePartsCustomizableSet
CustomEnginePart
VehiclePartsPresetSO
VehiclePartsCustomizableSet
IVehicleInputProvider
ForceMod
e.Acceleration
tire grip
Sideways Slip Animation Curve
SuspensionSimulationPrecision