Skip to content

KX_VehicleWrapper

Base class: EXP_PyObjectPlus

KX_VehicleWrapper

TODO - description

addWheel(wheel, attachPos, downDir, axleDir, suspensionRestLength, wheelRadius, hasSteering)

Section titled “addWheel(wheel, attachPos, downDir, axleDir, suspensionRestLength, wheelRadius, hasSteering)”

Add a wheel to the vehicle

  • wheel: The object to use as a wheel.
    • type: KX_GameObject or a KX_GameObject name
  • attachPos: The position to attach the wheel, relative to the chassis object center.
    • type: vector of 3 floats
  • downDir: The direction vector pointing down to where the vehicle should collide with the floor.
    • type: vector of 3 floats
  • axleDir: The axis the wheel rotates around, relative to the chassis.
    • type: vector of 3 floats
  • suspensionRestLength: The length of the suspension when no forces are being applied.
    • type: float
  • wheelRadius: The radius of the wheel (half the diameter).
    • type: float
  • hasSteering: True if the wheel should turn with steering, typically used in front wheels.
    • type: boolean

Apply a braking force to the specified wheel

  • force: the brake force
    • type: float
  • wheelIndex: index of the wheel where the force needs to be applied
    • type: integer

Apply an engine force to the specified wheel

  • force: the engine force
    • type: float
  • wheelIndex: index of the wheel where the force needs to be applied
    • type: integer

Get the constraint ID

Returns: the constraint id

Return type: integer

Returns the constraint type.

Returns: constraint type

Return type: integer

Returns the number of wheels.

Returns: the number of wheels for this vehicle

Return type: integer

Returns the wheel orientation as a quaternion.

  • wheelIndex: the wheel index
    • type: integer

Returns: TODO Description

Return type: TODO - type should be quat as per method name but from the code it looks like a matrix

Returns the position of the specified wheel

  • wheelIndex: the wheel index
    • type: integer

Returns: position vector

Return type: list[x, y, z]

Returns the rotation of the specified wheel

  • wheelIndex: the wheel index
    • type: integer

Returns: the wheel rotation

Return type: float

setRollInfluence(rollInfluece, wheelIndex)

Section titled “setRollInfluence(rollInfluece, wheelIndex)”

Set the specified wheel’s roll influence. The higher the roll influence the more the vehicle will tend to roll over in corners.

  • rollInfluece: the wheel roll influence
    • type: float
  • wheelIndex: the wheel index
    • type: integer

Set the specified wheel’s steering

  • steering: the wheel steering
    • type: float
  • wheelIndex: the wheel index
    • type: integer

setSuspensionCompression(compression, wheelIndex)

Section titled “setSuspensionCompression(compression, wheelIndex)”

Set the specified wheel’s compression

  • compression: the wheel compression
    • type: float
  • wheelIndex: the wheel index
    • type: integer

Set the specified wheel’s damping

  • damping: the wheel damping
    • type: float
  • wheelIndex: the wheel index
    • type: integer

setSuspensionStiffness(stiffness, wheelIndex)

Section titled “setSuspensionStiffness(stiffness, wheelIndex)”

Set the specified wheel’s stiffness

  • stiffness: the wheel stiffness
    • type: float
  • wheelIndex: the wheel index
    • type: integer

Set the specified wheel’s tyre friction

  • friction: the tyre friction
    • type: float
  • wheelIndex: the wheel index
    • type: integer

Set ray cast mask.

Type: bitfield

These items exist in the engine but were not in the Range documentation. The ones marked new in Anastacio were added by Anastacio Engine.

method

Vehicle axes (right, up, forward) (0=X, 1=Y, 2=Z).

Returns: tuple

method

Current speed in km/h.

Returns: float

method

Current speed in meters per second.

Returns: float

method

Vehicle forward direction, in world space.

Returns: Vector

method

Wheel configuration: connectionPoint, downDirection, axleDirection, suspensionRestLength, wheelRadius, hasSteering and isDriveWheel.

Returns: dict

method

Wheel state this tick: world position and orientation, rotation, isInContact, contact point and normal, suspensionForce and more.

Returns: dict

method

Loads a vehicle preset (file) and applies it to this vehicle.

method

Rebuilds the wheels from the preset, using the given objects (one per wheel). Use Empties with No Collision physics as wheels.

method

Puts the suspension back at rest (useful after teleporting the car).

method

Saves the current vehicle setup to a preset file.

method

Sets which axes (0=X, 1=Y, 2=Z) are right, up and forward. All three axes must be used without repeating.

setWheelIsDriveWheel(wheelIndex, isDriveWheel)

Section titled “setWheelIsDriveWheel(wheelIndex, isDriveWheel)”

method

Sets whether the wheel gets engine traction.

attribute · read-only

Id of the vehicle physics constraint.

attribute · read-only

Type of the vehicle physics constraint.