Vehicles

From Leadwerks Developer Wiki

Jump to: navigation, search

Contents

Introduction

Leadwerks Engine provides a robust vehicle class with support for any number and configuration of tires. The vehicle class is actually an extension of the joint class, and will work with any body entity.

Commands

CreateVehicle

  • C: TVehicle CreateVehicle( TBody chassis )
  • C++:
    • Vehicle::Vehicle( const Body& rBody )
    • virtual void Vehicle::Create( const Body& rBody )
  • BlitzMax: CreateVehicle:TVehicle( body:TBody )
  • C#: IntPtr CreateVehicle( IntPtr body )
Creates a new vehicle constraint on the specified body.
You must set the chassis body mass to non-zero before creating the vehicle.
[Examples]

AddVehicleTire

  • C: int AddVehicleTire(TVehicle vehicle, TVec3 &position=Vec3(0), flt radius=0.5f, flt suspensionLength=0.0f, flt springConstant=70.0f, flt springDamping=150.0f)
  • C++:
    • Tire::Tire( const Vehicle& veh, const Vector3& pos, const Vector3& pin, flt radius, flt suspensionLenght = 0.0f, flt springConstant = 70.0f, flt springDamping = 150.0f )
    • virtual void Tire::Create( const Vehicle& veh, const Vector3& pos, const Vector3& pin, flt radius, flt suspensionLenght = 0.0f, flt springConstant = 70.0f, flt springDamping = 150.0f )
  • BlitzMax: CreateTire:TTire( body:TBody, pos:TVec3, pin:TVec3, radius:Float suspensionLength:Float = 0.0, springConstant:Float = 0.0, springDamping:Float = 0.0 )
  • C#: IntPtr CreateTire( IntPtr vehicle, Vector3 position, Vector3 pin, float radius, float suspensionLength, float springConstant, float springDamping )
Creates a new tire on the specified vehicle.
[Examples]

Italic text

AddTireTorque

  • C: void AddTireTorque(TVehicle vehicle, flt torque, int tire=-1)
  • C++: void Tire::AddTorque( flt angle )
  • BlitzMax: AddTireTorque( tire:TTire, torque:Float )
  • C#: void AddTireTorque( IntPtr tire, float torque )
Adds torque to the tire. Use this to move vehicles.
[Examples]

SetTireSteerAngle

  • C: void SetVehicleSteerAngle(TVehicle vehicle, flt angle, int tire=-1)
  • C++: void Tire::SetAngle( flt angle )
  • BlitzMax: SetTireAngle( tire:TTire, angle:Float )
  • C#: void SetTireAngle( IntPtr tire, float angle )
Sets a tire's steering angle. Use this to steer a vehicle.
[Examples]

GetTireMatrix

  • C: TVec16 GetTireMatrix( TVehicle vehicle, int tire=0 )
Returns the matrix of the specified tire. Tires start from index 0.
[Examples]
Personal tools