#

API Docs for: 0.6.1
Show: Inherited Protected Private Deprecated

# RaycastVehicle Class

Defined in: `src/objects/RaycastVehicle.js:10`

Vehicle helper class that casts rays from the wheel positions towards the ground and applies forces.

## Constructor

### `RaycastVehicle`

(

- `[options]`

)

Defined in `src/objects/RaycastVehicle.js:10`

#### Parameters:

- `[options]` Object optional
  - `[chassisBody]` Body optional

    The car chassis body.

  - `[indexRightAxis]` Integer optional

    Axis to use for right. x=0, y=1, z=2

  - `[indexLeftAxis]` Integer optional
  - `[indexUpAxis]` Integer optional

- Index
- Methods
- Properties

## Item Index

### Methods

- addToWorld
- addWheel
- applyEngineForce
- getVehicleAxisWorld
- getWheelTransformWorld
- removeFromWorld
- setBrake
- setSteeringValue
- updateWheelTransform

### Properties

- chassisBody
- indexForwardAxis
- indexRightAxis
- indexUpAxis
- sliding
- wheelInfos
- world

## Methods

### `addToWorld`

(

- `world`

)

Defined in `src/objects/RaycastVehicle.js:122`

Add the vehicle including its constraints to the world.

#### Parameters:

- `world` World

### `addWheel`

(

- `[options]`

)

Defined in `src/objects/RaycastVehicle.js:74`

Add a wheel. For information about the options, see WheelInfo.

#### Parameters:

- `[options]` Object optional

### `applyEngineForce`

(

- `value`
- `wheelIndex`

)

Defined in `src/objects/RaycastVehicle.js:102`

Set the wheel force to apply on one of the wheels each time step

#### Parameters:

- `value` Number
- `wheelIndex` Integer

### `getVehicleAxisWorld`

(

- `axisIndex`
- `result`

)
private

Defined in `src/objects/RaycastVehicle.js:138`

Get one of the wheel axles, world-oriented.

#### Parameters:

- `axisIndex` Integer
- `result` Vec3

### `getWheelTransformWorld`

(

- `wheelIndex`

)
Transform

Defined in `src/objects/RaycastVehicle.js:428`

Get the world transform of one of the wheels

#### Parameters:

- `wheelIndex` Integer

#### Returns:

Transform:

### `removeFromWorld`

(

- `world`

)

Defined in `src/objects/RaycastVehicle.js:279`

Remove the vehicle including its constraints from the world.

#### Parameters:

- `world` World

### `setBrake`

(

- `brake`
- `wheelIndex`

)

Defined in `src/objects/RaycastVehicle.js:112`

Set the braking force of a wheel

#### Parameters:

- `brake` Number
- `wheelIndex` Integer

### `setSteeringValue`

(

- `value`
- `wheelIndex`

)

Defined in `src/objects/RaycastVehicle.js:89`

Set the steering value of a wheel.

#### Parameters:

- `value` Number
- `wheelIndex` Integer

### `updateWheelTransform`

(

- `wheelIndex`

)

Defined in `src/objects/RaycastVehicle.js:380`

Update one of the wheel transform. Note when rendering wheels: during each step, wheel transforms are updated BEFORE the chassis; ie. their position becomes invalid after the step. Thus when you render wheels, you must update wheel transforms before rendering them. See raycastVehicle demo for an example.

#### Parameters:

- `wheelIndex` Integer

  The wheel index to update.

## Properties

### `chassisBody`

Body

Defined in `src/objects/RaycastVehicle.js:22`

### `indexForwardAxis`

Integer

Defined in `src/objects/RaycastVehicle.js:51`

Index of the forward axis, 0=x, 1=y, 2=z

Default: 0

### `indexRightAxis`

Integer

Defined in `src/objects/RaycastVehicle.js:44`

Index of the right axis, 0=x, 1=y, 2=z

Default: 1

### `indexUpAxis`

Integer

Defined in `src/objects/RaycastVehicle.js:58`

Index of the up axis, 0=x, 1=y, 2=z

Default: 2

### `sliding`

Boolean

Defined in `src/objects/RaycastVehicle.js:33`

Will be set to true if the car is sliding.

### `wheelInfos`

Array

Defined in `src/objects/RaycastVehicle.js:27`

An array of WheelInfo objects.

### `world`

World

Defined in `src/objects/RaycastVehicle.js:39`