RaycastVehicle Class
Vehicle helper class that casts rays from the wheel positions towards the ground and applies forces.
Constructor
RaycastVehicle
-
[options]
Parameters:
-
[options]
Object optional-
[chassisBody]
Body optionalThe car chassis body.
-
[indexRightAxis]
Integer optionalAxis to use for right. x=0, y=1, z=2
-
[indexLeftAxis]
Integer optional -
[indexUpAxis]
Integer optional
-
Item Index
Methods
Methods
addToWorld
-
world
Add the vehicle including its constraints to the world.
Parameters:
-
world
World
addWheel
-
[options]
Add a wheel. For information about the options, see WheelInfo.
Parameters:
-
[options]
Object optional
applyEngineForce
-
value
-
wheelIndex
Set the wheel force to apply on one of the wheels each time step
Parameters:
-
value
Number -
wheelIndex
Integer
getVehicleAxisWorld
-
axisIndex
-
result
Get one of the wheel axles, world-oriented.
Parameters:
-
axisIndex
Integer -
result
Vec3
getWheelTransformWorld
-
wheelIndex
Get the world transform of one of the wheels
Parameters:
-
wheelIndex
Integer
Returns:
removeFromWorld
-
world
Remove the vehicle including its constraints from the world.
Parameters:
-
world
World
setBrake
-
brake
-
wheelIndex
Set the braking force of a wheel
Parameters:
-
brake
Number -
wheelIndex
Integer
setSteeringValue
-
value
-
wheelIndex
Set the steering value of a wheel.
Parameters:
-
value
Number -
wheelIndex
Integer
updateWheelTransform
-
wheelIndex
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
IntegerThe wheel index to update.
Properties
indexForwardAxis
Integer
Index of the forward axis, 0=x, 1=y, 2=z
Default: 0
indexRightAxis
Integer
Index of the right axis, 0=x, 1=y, 2=z
Default: 1
indexUpAxis
Integer
Index of the up axis, 0=x, 1=y, 2=z
Default: 2
sliding
Boolean
Will be set to true if the car is sliding.
wheelInfos
Array
An array of WheelInfo objects.