RaycastVehicle class

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

Constructors

RaycastVehicle({required Body chassisBody, AxisIndex indexRightAxis = AxisIndex.z, AxisIndex indexForwardAxis = AxisIndex.x, AxisIndex indexUpAxis = AxisIndex.y})

Properties

chassisBody Body
The car chassis body.
getter/setter pair
currentVehicleSpeedKmHour double
getter/setter pair
directions List<Vec3>
getter/setter pair
finalraints List<Constraint>
The finalraints. */
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
indexForwardAxis AxisIndex
Index of the forward axis. x=0, y=1, z=2
getter/setter pair
indexRightAxis AxisIndex
Index of the right axis. x=0, y=1, z=2
getter/setter pair
indexUpAxis AxisIndex
Index of the up axis. x=0, y=1, z=2
getter/setter pair
numWheelsOnGround int
Number of wheels on the ground
getter/setter pair
preStepCallback ↔ void Function(dynamic event)
Optional pre-step callback
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sliding bool
Will be set to true if the car is sliding.
getter/setter pair
torque Vec3
final
updateFrictionAxle List<Vec3>
getter/setter pair
updateFrictionForwardWS List<Vec3>
getter/setter pair
wheelInfos List<WheelInfo>
The wheels.
getter/setter pair
world World?
getter/setter pair

Methods

addToWorld(World world) → void
Add the vehicle including its finalraints to the world.
addWheel([WheelInfo? wheelInfo]) int
Add a wheel. For information about the options, see WheelInfo.
applyEngineForce(double value, int wheelIndex) → void
Set the wheel force to apply on one of the wheels each time step
calcRollingFriction(Body body0, Body body1, Vec3 frictionPosWorld, Vec3 frictionDirectionWorld, double maxImpulse) double
castRay(WheelInfo wheel) double
computeImpulseDenominator(Body body, Vec3 pos, Vec3 normal) double
getVehicleAxisWorld(AxisIndex axisIndex, Vec3 result) → void
Get one of the wheel axles, world-oriented.
getWheelTransformWorld(int wheelIndex) Transform
Get the world transform of one of the wheels
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
removeFromWorld(World world) → void
Remove the vehicle including its finalraints from the world.
resolveSingleBilateral(Body body1, Vec3 pos1, Body body2, Vec3 pos2, Vec3 normal) double
setBrake(double brake, int wheelIndex) → void
Set the braking force of a wheel
setSteeringValue(double value, int wheelIndex) → void
Set the steering value of a wheel.
toString() String
A string representation of this object.
inherited
updateFriction(double timeStep) → void
updateSuspension(num? deltaTime) → void
updateVehicle(double timeStep) → void
updateWheelTransform(int wheelIndex) → void
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. @param wheelIndex The wheel index to update.;
updateWheelTransformWorld(WheelInfo wheel) → void

Operators

operator ==(Object other) bool
The equality operator.
inherited