Class WheeledVehicle
Representation of the car vehicle that uses wheels. Built on top of the RigidBody with collider representing its chassis shape and wheels.
Namespace: FlaxEngine
Assembly: FlaxEngine.CSharp.dll
Syntax
[ActorContextMenu("New/Physics/Wheeled Vehicle")]
[ActorToolbox("Physics")]
[Unmanaged]
public class WheeledVehicle : RigidBody, ISerializable
Constructors
WheeledVehicle()
Properties
AntiRollBars
Sets axles anti roll bars to increase vehicle stability.
Declaration
[Unmanaged]
public WheeledVehicle.AntiRollBar[] AntiRollBars { get; set; }
Property Value
WheeledVehicle.AntiRollBar[]
|
Differential
Gets or sets the vehicle differential settings.
Declaration
[EditorOrder(7)]
[EditorDisplay("Vehicle", null)]
[Unmanaged]
public WheeledVehicle.DifferentialSettings Differential { get; set; }
Property Value
WheeledVehicle.DifferentialSettings
|
DriveControl
Gets or sets the vehicle drive control settings.
Declaration
[EditorOrder(5)]
[EditorDisplay("Vehicle", null)]
[Unmanaged]
public WheeledVehicle.DriveControlSettings DriveControl { get; set; }
Property Value
WheeledVehicle.DriveControlSettings
|
DriveType
Gets or sets the vehicle driving model type.
Declaration
[EditorOrder(2)]
[EditorDisplay("Vehicle", null)]
[Unmanaged]
public WheeledVehicle.DriveTypes DriveType { get; set; }
Property Value
WheeledVehicle.DriveTypes
|
Engine
Gets or sets the vehicle engine settings.
Declaration
[EditorOrder(6)]
[EditorDisplay("Vehicle", null)]
[Unmanaged]
public WheeledVehicle.EngineSettings Engine { get; set; }
Property Value
WheeledVehicle.EngineSettings
|
EngineRotationSpeed
Gets the current engine rotation speed (Revolutions Per Minute is the number of turns in one minute).
Declaration
[Unmanaged]
public float EngineRotationSpeed { get; }
Property Value
System.Single
|
ForwardSpeed
Gets the current forward vehicle movement speed (along forward vector of the actor transform).
Declaration
[Unmanaged]
public float ForwardSpeed { get; }
Property Value
System.Single
|
Gearbox
Gets or sets the vehicle gearbox settings.
Declaration
[EditorOrder(8)]
[EditorDisplay("Vehicle", null)]
[Unmanaged]
public WheeledVehicle.GearboxSettings Gearbox { get; set; }
Property Value
WheeledVehicle.GearboxSettings
|
SidewaysSpeed
Gets the current sideways vehicle movement speed (along right vector of the actor transform).
Declaration
[Unmanaged]
public float SidewaysSpeed { get; }
Property Value
System.Single
|
UseAnalogSteering
If checked, the vehicle driving and steering inputs will be used as analog values (from gamepad), otherwise will be used as digital input (from keyboard).
Declaration
[EditorOrder(1)]
[EditorDisplay("Vehicle", null)]
[Unmanaged]
public bool UseAnalogSteering { get; set; }
Property Value
System.Boolean
|
UseReverseAsBrake
If checked, the negative throttle value will be used as brake and reverse to behave in a more arcade style where holding reverse also functions as brake. Disable it for more realistic driving controls.
Declaration
[EditorOrder(0)]
[EditorDisplay("Vehicle", null)]
[Unmanaged]
public bool UseReverseAsBrake { get; set; }
Property Value
System.Boolean
|
Wheels
Gets or sets the vehicle wheels settings.
Declaration
[EditorOrder(4)]
[EditorDisplay("Vehicle", null)]
[Unmanaged]
public WheeledVehicle.Wheel[] Wheels { get; set; }
Property Value
WheeledVehicle.Wheel[]
|
Methods
ClearInput()
Clears all the vehicle control inputs to the default values (throttle, steering, breaks).
Declaration
[Unmanaged]
public void ClearInput()
GetWheelState(Int32, out WheeledVehicle.WheelState)
Gets the current state of the wheel.
Declaration
[Unmanaged]
public void GetWheelState(int index, out WheeledVehicle.WheelState result)
Parameters
System.Int32
index
The index of the wheel. |
WheeledVehicle.WheelState
result
The current state. |
SetBrake(Single)
Sets the input for vehicle brakes. Brake is the analog brake pedal value in range (0,1) where 1 represents the pedal fully pressed and 0 represents the pedal in its rest state.
Declaration
[Unmanaged]
public void SetBrake(float value)
Parameters
System.Single
value
The value (0,1 range). |
SetHandbrake(Single)
Sets the input for vehicle handbrake. Handbrake is the analog handbrake value in range (0,1) where 1 represents the handbrake fully engaged and 0 represents the handbrake in its rest state.
Declaration
[Unmanaged]
public void SetHandbrake(float value)
Parameters
System.Single
value
The value (0,1 range). |
SetSteering(Single)
Sets the input for vehicle steering. Steer is the analog steer value in range (-1,1) where -1 represents the steering wheel at left lock and +1 represents the steering wheel at right lock.
Declaration
[Unmanaged]
public void SetSteering(float value)
Parameters
System.Single
value
The value (-1,1 range). |
SetTankLeftBrake(Single)
Sets the input for tank brakes the left track. Brake is the analog brake pedal value in range (0,1) where 1 represents the pedal fully pressed and 0 represents the pedal in its rest state.
Declaration
[Unmanaged]
public void SetTankLeftBrake(float value)
Parameters
System.Single
value
The value (0,1 range). |
SetTankLeftThrottle(Single)
Sets the input for tank left track throttle. It is the analog accelerator pedal value in range (-1,1) where 1 represents the pedal fully pressed to move to forward, 0 to represents the pedal in its rest state and -1 represents the pedal fully pressed to move to backward. The track direction will be inverted if the vehicle current gear is rear.
Declaration
[Unmanaged]
public void SetTankLeftThrottle(float value)
Parameters
System.Single
value
The value (-1,1 range). |
SetTankRightBrake(Single)
Sets the input for tank brakes the right track. Brake is the analog brake pedal value in range (0,1) where 1 represents the pedal fully pressed and 0 represents the pedal in its rest state.
Declaration
[Unmanaged]
public void SetTankRightBrake(float value)
Parameters
System.Single
value
The value (0,1 range). |
SetTankRightThrottle(Single)
Sets the input for tank right track throttle. It is the analog accelerator pedal value in range (-1,1) where 1 represents the pedal fully pressed to move to forward, 0 to represents the pedal in its rest state and -1 represents the pedal fully pressed to move to backward. The track direction will be inverted if the vehicle current gear is rear.
Declaration
[Unmanaged]
public void SetTankRightThrottle(float value)
Parameters
System.Single
value
The value (-1,1 range). |
SetThrottle(Single)
Sets the input for vehicle throttle. It is the analog accelerator pedal value in range (0,1) where 1 represents the pedal fully pressed and 0 represents the pedal in its rest state.
Declaration
[Unmanaged]
public void SetThrottle(float value)
Parameters
System.Single
value
The value (-1,1 range). When using UseReverseAsBrake it can be negative and will be used as brake and backward driving. |
Setup()
Rebuilds the vehicle. Call it after modifying vehicle settings (eg. engine options).
Declaration
[Unmanaged]
public void Setup()