Class DynamicRayCastVehicleController

A character controller to simulate vehicles using ray-casting for the wheels.

Hierarchy

  • DynamicRayCastVehicleController

Constructors

Properties

_chassis: any
bodies: any
colliders: any
queries: any
raw: any

Accessors

  • get indexForwardAxis(): number
  • The chassis’ local forward direction (0 = x, 1 = y, 2 = z).

    Returns number

  • get indexUpAxis(): number
  • The chassis’ local up direction (0 = x, 1 = y, 2 = z).

    Returns number

  • set indexUpAxis(axis: number): void
  • Sets the chassis’ local up direction (0 = x, 1 = y, 2 = z).

    Parameters

    • axis: number

    Returns void

  • set setIndexForwardAxis(axis: number): void
  • Sets the chassis’ local forward direction (0 = x, 1 = y, 2 = z).

    Parameters

    • axis: number

    Returns void

Methods

  • Adds a new wheel attached to this vehicle.

    Parameters

    • chassisConnectionCs: Vector

      The position of the wheel relative to the chassis.

    • directionCs: Vector

      The direction of the wheel’s suspension, relative to the chassis. The ray-casting will happen following this direction to detect the ground.

    • axleCs: Vector

      The wheel’s axle axis, relative to the chassis.

    • suspensionRestLength: number

      The rest length of the wheel’s suspension spring.

    • radius: number

      The wheel’s radius.

    Returns void

  • The rigid-body used as the chassis.

    Returns RigidBody

  • The current forward speed of the vehicle.

    Returns number

  • Internal

    Returns void

  • The number of wheels attached to this vehicle.

    Returns number

  • Sets the i-th wheel’s axle axis, relative to the chassis.

    The axis index defined as 0 = X, 1 = Y, 2 = Z.

    Parameters

    Returns void

  • Set the maximum amount of braking impulse applied on the i-th wheel to slow down the vehicle.

    Parameters

    • i: number
    • value: number

    Returns void

  • Sets the position of the i-th wheel, relative to the chassis.

    Parameters

    Returns void

  • Sets the direction of the i-th wheel’s suspension, relative to the chassis.

    The ray-casting will happen following this direction to detect the ground.

    Parameters

    Returns void

  • Sets the forward force applied by the i-th wheel on the chassis.

    Parameters

    • i: number
    • value: number

    Returns void

  • Sets the parameter controlling how much traction the tire has.

    The larger the value, the more instantaneous braking will happen (with the risk of causing the vehicle to flip if it’s too strong).

    Parameters

    • i: number
    • value: number

    Returns void

  • Sets the maximum force applied by the i-th wheel’s suspension.

    Parameters

    • i: number
    • value: number

    Returns void

  • Sets the maximum distance the i-th wheel suspension can travel before and after its resting length.

    Parameters

    • i: number
    • value: number

    Returns void

  • Sets the i-th wheel’s radius.

    Parameters

    • i: number
    • value: number

    Returns void

  • The multiplier of friction between a tire and the collider it’s on top of.

    The larger the value, the stronger side friction will be.

    Parameters

    • i: number
    • value: number

    Returns void

  • Sets the steering angle (radians) for the i-th wheel.

    Parameters

    • i: number
    • value: number

    Returns void

  • The i-th wheel’s suspension’s damping when it is being compressed.

    Parameters

    • i: number
    • value: number

    Returns void

  • Sets the i-th wheel’s suspension’s damping when it is being released.

    Increase this value if the suspension appears to overshoot.

    Parameters

    • i: number
    • value: number

    Returns void

  • Sets the rest length of the i-th wheel’s suspension spring.

    Parameters

    • i: number
    • value: number

    Returns void

  • Sets the i-th wheel’s suspension stiffness.

    Increase this value if the suspension appears to not push the vehicle strong enough.

    Parameters

    • i: number
    • value: number

    Returns void

  • Updates the vehicle’s velocity based on its suspension, engine force, and brake.

    This directly updates the velocity of its chassis rigid-body.

    Parameters

    • dt: number

      Time increment used to integrate forces.

    • Optional filterFlags: QueryFilterFlags

      Flag to exclude categories of objects from the wheels’ ray-cast.

    • Optional filterGroups: number

      Only colliders compatible with these groups will be hit by the wheels’ ray-casts.

    • Optional filterPredicate: ((collider: Collider) => boolean)

      Callback to filter out which collider will be hit by the wheels’ ray-casts.

    Returns void

  • The i-th wheel’s axle axis, relative to the chassis.

    The axis index defined as 0 = X, 1 = Y, 2 = Z.

    Parameters

    • i: number

    Returns Vector

  • The maximum amount of braking impulse applied on the i-th wheel to slow down the vehicle.

    Parameters

    • i: number

    Returns number

  • The position of the i-th wheel, relative to the chassis.

    Parameters

    • i: number

    Returns Vector

  • The (world-space) contact normal between the i-th wheel and the floor.

    Parameters

    • i: number

    Returns Vector

  • The (world-space) point hit by the wheel’s ray-cast for the i-th wheel.

    Parameters

    • i: number

    Returns Vector

  • The direction of the i-th wheel’s suspension, relative to the chassis.

    The ray-casting will happen following this direction to detect the ground.

    Parameters

    • i: number

    Returns Vector

  • The forward force applied by the i-th wheel on the chassis.

    Parameters

    • i: number

    Returns number

  • The forward impulses applied by the i-th wheel on the chassis.

    Parameters

    • i: number

    Returns number

  • Parameter controlling how much traction the tire has.

    The larger the value, the more instantaneous braking will happen (with the risk of causing the vehicle to flip if it’s too strong).

    Parameters

    • i: number

    Returns number

  • The collider hit by the ray-cast for the i-th wheel.

    Parameters

    • i: number

    Returns Collider

  • The (world-space) starting point of the ray-cast for the i-th wheel.

    Parameters

    • i: number

    Returns Vector

  • Is the i-th wheel in contact with the ground?

    Parameters

    • i: number

    Returns boolean

  • The maximum force applied by the i-th wheel’s suspension.

    Parameters

    • i: number

    Returns number

  • The maximum distance the i-th wheel suspension can travel before and after its resting length.

    Parameters

    • i: number

    Returns number

  • The i-th wheel’s radius.

    Parameters

    • i: number

    Returns number

  • The i-th wheel’s current rotation angle (radians) on its axle.

    Parameters

    • i: number

    Returns number

  • The multiplier of friction between a tire and the collider it’s on top of.

    The larger the value, the stronger side friction will be.

    Parameters

    • i: number

    Returns number

  • The side impulses applied by the i-th wheel on the chassis.

    Parameters

    • i: number

    Returns number

  • The steering angle (radians) for the i-th wheel.

    Parameters

    • i: number

    Returns number

  • The i-th wheel’s suspension’s damping when it is being compressed.

    Parameters

    • i: number

    Returns number

  • The force applied by the i-th wheel suspension.

    Parameters

    • i: number

    Returns number

  • The suspension length for the i-th wheel.

    Parameters

    • i: number

    Returns number

  • The i-th wheel’s suspension’s damping when it is being released.

    Increase this value if the suspension appears to overshoot.

    Parameters

    • i: number

    Returns number

  • The rest length of the i-th wheel’s suspension spring.

    Parameters

    • i: number

    Returns number

  • The i-th wheel’s suspension stiffness.

    Increase this value if the suspension appears to not push the vehicle strong enough.

    Parameters

    • i: number

    Returns number

Generated using TypeDoc