Physics · class
Vehicle
Explained in Your first game, Rigid bodies.
class Vehicleimport { Vehicle } from '@driftengine/physics';Constructor
new
constructor(chassis: number, options: VehicleOptions)| Parameter | Type | Description |
|---|---|---|
chassis | number | |
options | VehicleOptions |
Properties
| Name | Type | Description |
|---|---|---|
chassisreadonly | number | |
wheelCountreadonly | number | |
groundedreadonly | Uint8Array | Whether each wheel found ground on the last update. |
compressionreadonly | Float32Array | How far each wheel's suspension is compressed, in metres. |
contactreadonly | Float32Array | Where each wheel's contact is, xyz-packed. Meaningful where grounded. |
Methods
update
update(world: PhysicsWorld, dt: number, input: VehicleInput): voidAdvance the vehicle one fixed tick. Call before world.step.
| Parameter | Type | Description |
|---|---|---|
world | PhysicsWorld | |
dt | number | |
input | VehicleInput |