Vehicle#
A four-wheeled vehicle on this object's dynamic Rigid Body: suspension, tyre grip, engine with an automatic gearbox, steering and brakes are simulated by the physics engine. The body's local +Z is forward and +Y is up. Scripts drive it by setting Throttle, Steering, Brake and HandBrake each step. Child objects named "Wheel FL", "Wheel FR", "Wheel RL" and "Wheel RR" follow the simulated wheels (their own scale is kept).
public sealed class Vehicle : ScriptMembers: AllWheelDrive · Brake · BrakeTorque · DriftAssist · EngineInertia · EngineTorque · FinalDrive · FrontAxle · Gears · HalfTrack · HandBrake · HandBrakeTorque · MaxRpm · MaxSteerDegrees · MaxTiltDegrees · MountHeight · RearAxle · Speed · Steering · SuspensionDamping · SuspensionFrequency · SuspensionTravel · Throttle · WheelRadius · WheelWidth · WheelsOnGround
AllWheelDrive#
[DefaultValue(true)]
public bool AllWheelDrive;Drive all four wheels (off-road) instead of only the rear.
Brake#
public float Brake { get; set; }0 to 1.
BrakeTorque#
[DefaultValue(1500f)]
public float BrakeTorque;DriftAssist#
[DefaultValue(.8f)]
public float DriftAssist;Drift assist, 0–1: under handbrake (and half as much under brake) the rear axle loses most of its sideways grip and steering yaws the car into the slide. 0 leaves Jolt's tyres alone — they hold sideways even when locked, so a handbrake alone never drifts.
EngineInertia#
[DefaultValue(.5f)]
public float EngineInertia;How heavy the engine is to spin up: low = revs instantly (electric/RC), high = sluggish.
EngineTorque#
[DefaultValue(500f)]
public float EngineTorque;FinalDrive#
[DefaultValue(3.42f)]
public float FinalDrive;Fixed reduction between gearbox and wheels: higher = more punch, lower top speed.
FrontAxle#
[DefaultValue(1.3f)]
public float FrontAxle;Forward (+Z) distance to the front axle, and backward distance to the rear axle.
Gears#
[DefaultValue(5)]
public int Gears;Forward gears of the automatic gearbox. 1 = direct drive (no shifting, like an RC car's electric motor); the default 5 matches a road car.
HalfTrack#
[DefaultValue(.9f)]
public float HalfTrack;Sideways distance from the body's center to each wheel.
HandBrake#
public float HandBrake { get; set; }0 to 1; locks the rear wheels.
HandBrakeTorque#
[DefaultValue(4000f)]
public float HandBrakeTorque;MaxRpm#
[DefaultValue(6000f)]
public float MaxRpm;Engine/motor top speed. With the gearing it sets how fast the wheels can spin.
MaxSteerDegrees#
[DefaultValue(30f)]
public float MaxSteerDegrees;MaxTiltDegrees#
[DefaultValue(0f)]
public float MaxTiltDegrees;Limits how far the body may pitch or roll; 0 = no limit (it can flip).
MountHeight#
[DefaultValue(-.2f)]
public float MountHeight;Height of the suspension mounts relative to the body's center.
RearAxle#
[DefaultValue(1.2f)]
public float RearAxle;Speed#
public float Speed { get; }Forward speed in meters per second (negative when reversing).
Steering#
public float Steering { get; set; }-1 (full left) to 1 (full right).
SuspensionDamping#
[DefaultValue(.5f)]
public float SuspensionDamping;SuspensionFrequency#
[DefaultValue(1.5f)]
public float SuspensionFrequency;Spring stiffness as oscillations per second; softer is bouncier.
SuspensionTravel#
[DefaultValue(.4f)]
public float SuspensionTravel;Throttle#
public float Throttle { get; set; }-1 (reverse) to 1 (full throttle).
WheelRadius#
[DefaultValue(.4f)]
public float WheelRadius;WheelWidth#
[DefaultValue(.3f)]
public float WheelWidth;WheelsOnGround#
public int WheelsOnGround { get; }How many wheels touch the ground after the last physics step.
Related types#
Source#
- Vehicle.cs