Panda3D
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
BulletVehicle Class Reference

Simulates a raycast vehicle which casts a ray per wheel at the ground as a cheap replacement for complex suspension simulation. More...

Inheritance diagram for BulletVehicle:
TypedReferenceCount TypedObject ReferenceCount

Public Member Functions

 __init__ (BulletWorld world, BulletRigidBodyNode chassis)
 Creates a new BulletVehicle instance in the given world and with a chassis node. More...
 
 applyEngineForce (float force, int idx)
 Applies force at the wheel with index idx for acceleration. More...
 
BulletWheel createWheel ()
 Factory method for creating wheels for this vehicle instance. More...
 
BulletRigidBodyNode getChassis ()
 Returns the chassis of this vehicle. More...
 
float getCurrentSpeedKmHour ()
 Returns the current speed in kilometers per hour. More...
 
LVector3 getForwardVector ()
 Returns the forward vector representing the car's actual direction of movement. More...
 
int getNumWheels ()
 Returns the number of wheels this vehicle has. More...
 
float getSteeringValue (int idx)
 Returns the steering angle of the wheel with index idx in degrees. More...
 
BulletVehicleTuning getTuning ()
 Returns a reference to the BulletVehicleTuning object of this vehicle which offers various vehicle-global tuning options. More...
 
BulletWheel getWheel (int idx)
 Returns the BulletWheel with index idx. More...
 
list getWheels ()
 
 resetSuspension ()
 Resets the vehicle's suspension. More...
 
 setBrake (float brake, int idx)
 Applies braking force to the wheel with index idx. More...
 
 setCoordinateSystem (BulletUpAxis up)
 Specifies which axis is "up". More...
 
 setPitchControl (float pitch)
 
 setSteeringValue (float steering, int idx)
 Sets the steering value (in degrees) of the wheel with index idx. More...
 
- Public Member Functions inherited from TypedObject
TypeHandle getType ()
 
int getTypeIndex ()
 Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. More...
 
bool isExactType (TypeHandle handle)
 Returns true if the current object is the indicated type exactly. More...
 
bool isOfType (TypeHandle handle)
 Returns true if the current object is or derives from the indicated type. More...
 
- Public Member Functions inherited from ReferenceCount
int getRefCount ()
 Returns the current reference count. More...
 
 ref ()
 Explicitly increments the reference count. More...
 
bool testRefCountIntegrity ()
 Does some easy checks to make sure that the reference count isn't completely bogus. More...
 
bool testRefCountNonzero ()
 Does some easy checks to make sure that the reference count isn't zero, or completely bogus. More...
 
bool unref ()
 Explicitly decrements the reference count. More...
 

Static Public Member Functions

static TypeHandle getClassType ()
 
- Static Public Member Functions inherited from TypedReferenceCount
static TypeHandle getClassType ()
 
- Static Public Member Functions inherited from TypedObject
static TypeHandle getClassType ()
 
- Static Public Member Functions inherited from ReferenceCount
static TypeHandle getClassType ()
 

Public Attributes

BulletRigidBodyNode chassis
 Returns the chassis of this vehicle. More...
 
float current_speed_km_hour
 Returns the current speed in kilometers per hour. More...
 
LVector3 forward_vector
 Returns the forward vector representing the car's actual direction of movement. More...
 
BulletVehicleTuning tuning
 Tuning. More...
 
BulletWheel wheels []
 
- Public Attributes inherited from TypedObject
TypeHandle type
 Returns the TypeHandle representing this object's type. More...
 
- Public Attributes inherited from ReferenceCount
int ref_count
 The current reference count. More...
 

Detailed Description

Simulates a raycast vehicle which casts a ray per wheel at the ground as a cheap replacement for complex suspension simulation.

The suspension can be tuned in various ways. It is possible to add a (probably) arbitrary number of wheels.

Member Function Documentation

◆ __init__()

__init__ ( BulletWorld  world,
BulletRigidBodyNode  chassis 
)

Creates a new BulletVehicle instance in the given world and with a chassis node.

◆ applyEngineForce()

applyEngineForce ( float  force,
int  idx 
)

Applies force at the wheel with index idx for acceleration.

◆ createWheel()

BulletWheel createWheel ( )

Factory method for creating wheels for this vehicle instance.

◆ getChassis()

BulletRigidBodyNode getChassis ( )

Returns the chassis of this vehicle.

The chassis is a rigid body node.

◆ getClassType()

static TypeHandle getClassType ( )
static

◆ getCurrentSpeedKmHour()

float getCurrentSpeedKmHour ( )

Returns the current speed in kilometers per hour.

Convert to miles using: km/h * 0.62 = mph

◆ getForwardVector()

LVector3 getForwardVector ( )

Returns the forward vector representing the car's actual direction of movement.

The forward vetcor is given in global coordinates.

◆ getNumWheels()

int getNumWheels ( )

Returns the number of wheels this vehicle has.

◆ getSteeringValue()

float getSteeringValue ( int  idx)

Returns the steering angle of the wheel with index idx in degrees.

◆ getTuning()

BulletVehicleTuning getTuning ( )

Returns a reference to the BulletVehicleTuning object of this vehicle which offers various vehicle-global tuning options.

Make sure to configure this before adding wheels!

◆ getWheel()

BulletWheel getWheel ( int  idx)

Returns the BulletWheel with index idx.

Causes an AssertionError if idx is equal or larger than the number of wheels.

◆ getWheels()

list getWheels ( )

◆ resetSuspension()

resetSuspension ( )

Resets the vehicle's suspension.

◆ setBrake()

setBrake ( float  brake,
int  idx 
)

Applies braking force to the wheel with index idx.

◆ setCoordinateSystem()

setCoordinateSystem ( BulletUpAxis  up)

Specifies which axis is "up".

Nessecary for the vehicle's suspension to work properly!

◆ setPitchControl()

setPitchControl ( float  pitch)

◆ setSteeringValue()

setSteeringValue ( float  steering,
int  idx 
)

Sets the steering value (in degrees) of the wheel with index idx.

Member Data Documentation

◆ chassis

Returns the chassis of this vehicle.

The chassis is a rigid body node.

◆ current_speed_km_hour

float current_speed_km_hour

Returns the current speed in kilometers per hour.

Convert to miles using: km/h * 0.62 = mph

◆ forward_vector

LVector3 forward_vector

Returns the forward vector representing the car's actual direction of movement.

The forward vetcor is given in global coordinates.

◆ tuning

Tuning.

◆ wheels

BulletWheel wheels[]