Class Vehicle¶
Namespace: Apogee.Physics
Assembly: Apogee.Physics.dll
A vehicle on a dynamic body: wheels with suspension and tires, or tracks, an engine and a clutch (Jolt's VehicleConstraint). The game owns the gearbox: it sets
public sealed class Vehicle : EngineObject
Inheritance¶
object ← EngineObject ← Vehicle
Inherited Members¶
EngineObject.IsAdopted, EngineObject.Handle, EngineObject.IsDestroyed, EngineObject.Class, EngineObject.Adopt(), EngineObject.TryGet(SlotHandle, out EngineObject), EngineObject.Destroy(), object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object?, object?), object.ToString()
Remarks¶
A road or tracked vehicle on Jolt's wheeled and tracked VehicleConstraint, tuned for heavy vehicles. Differences from Jolt's own: its transmission stays in manual mode with one forward and one
reverse gear whose ratio is rewritten each step; wheels at one axle share a differential whose ratio goes with the wheel size; the wheels of a vehicle with no powered wheel (a trailer)
stay in neutral; and the steered wheels turn about one center (Ackermann).
Properties¶
Brake¶
public float Brake { get; set; }
Property Value¶
BrakeCapacity¶
What all the brakes give together, in N·m.
public float BrakeCapacity { get; }
Property Value¶
Class¶
What the registry knows about this object's class.
public override ClassInfo Class { get; }
Property Value¶
Clutch¶
How far the clutch is engaged: 0 drives nothing, 1 is fully engaged. Set it in
public float Clutch { get; set; }
Property Value¶
DriveRatio¶
The overall ratio between engine and wheels the game drives through, signed: negative reverses; 0 is neutral. Set it in
public float DriveRatio { get; set; }
Property Value¶
EngineLoad¶
The throttle that reached the engine, 0 to 1.
public float EngineLoad { get; }
Property Value¶
EnginePeakPowerRpm¶
The rpm where the engine's power (torque times rpm) peaks, from its curve.
public float EnginePeakPowerRpm { get; }
Property Value¶
EngineRpm¶
public float EngineRpm { get; }
Property Value¶
EngineTorque¶
The torque the engine gives at the throttle that reached it, in N·m.
public float EngineTorque { get; }
Property Value¶
Entity¶
The entity of the vehicle's body.
public Entity Entity { get; }
Property Value¶
Forward¶
Throttle: -1 to 1 (negative backs up in a gearbox that reverses by throttle; the usual gearbox uses
public float Forward { get; set; }
Property Value¶
GearRatio¶
The gear ratio the transmission is in now.
public float GearRatio { get; }
Property Value¶
Handbrake¶
public float Handbrake { get; set; }
Property Value¶
IsReady¶
Whether the vehicle is working (its body exists and the wheels were built).
public bool IsReady { get; }
Property Value¶
SpeedKmh¶
How fast it moves along its forward axis, in km/h (negative backing up).
public float SpeedKmh { get; }
Property Value¶
Steering¶
-1 to 1: positive turns toward +X (the vehicle's left, in its +Z-forward space), negative toward -X.
public float Steering { get; set; }
Property Value¶
Stepping¶
Emitted before each fixed step with its length, before the inputs reach Jolt: the game's driving logic (its gearbox, assists, ABS) belongs here.
public Signal<float> Stepping { get; }
Property Value¶
WheelCount¶
How many wheels it has.
public int WheelCount { get; }
Property Value¶
Methods¶
GetBrakeFactor(int)¶
public float GetBrakeFactor(int index)
Parameters¶
index int
Returns¶
GetWheelCompression(int)¶
How far the suspension is compressed, 0 (extended) to 1.
public float GetWheelCompression(int index)
Parameters¶
index int
Returns¶
GetWheelContact(int)¶
public bool GetWheelContact(int index)
Parameters¶
index int
Returns¶
GetWheelContactEntity(int)¶
The entity of the body the wheel stands on, or 0.
public Entity GetWheelContactEntity(int index)
Parameters¶
index int
Returns¶
GetWheelContactNormal(int)¶
public Vector3 GetWheelContactNormal(int index)
Parameters¶
index int
Returns¶
GetWheelContactPoint(int)¶
The point where the wheel touches the ground (the world's origin if it does not).
public Double3 GetWheelContactPoint(int index)
Parameters¶
index int
Returns¶
GetWheelReadings()¶
Four numbers for each wheel, the ones the driving assists need: 1 if it touches the ground (else 0), its angular velocity in rad/s, the load it carries in newtons (its suspension's force) and the grip of its tire (0 for a track's wheel).
public float[] GetWheelReadings()
Returns¶
float[]
GetWheelRpm(int)¶
The wheel's rotation speed in revolutions per minute.
public float GetWheelRpm(int index)
Parameters¶
index int
Returns¶
GetWheelSteerDegrees(int)¶
How far the wheel is turned about its steering axis, in degrees (positive toward +X, like
public float GetWheelSteerDegrees(int index)
Parameters¶
index int
Returns¶
OnDestroyed()¶
protected override void OnDestroyed()
SetBrakeFactor(int, float)¶
Scales one wheel's brake torque for the next steps: 0 releases it, 1 is full. An ABS sets it every step.
public void SetBrakeFactor(int index, float factor)
Parameters¶
index int
factor float