Panda3D
Public Member Functions | Static Public Member Functions | 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. The suspension can be tuned in various ways. It is possible to add a (probably) arbitrary number of wheels. More...

Inheritance diagram for BulletVehicle:
TypedReferenceCount TypedObject ReferenceCount MemoryBase MemoryBase

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. The chassis is a rigid body node. More...
 
float getCurrentSpeedKmHour ()
 Returns the current speed in kilometers per hour. Convert to miles using: km/h * 0.62 = mph. More...
 
LVector3 getForwardVector ()
 Returns the forward vector representing the car's actual direction of movement. The forward vetcor is given in global coordinates. 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. Make sure to configure this before adding wheels! More...
 
BulletWheel getWheel (int idx)
 Returns the BulletWheel with index idx. Causes an AssertionError if idx is equal or larger than the number of wheels. 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". Nessecary for the vehicle's suspension to work properly! 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 ()
 Derived classes should override this function to return get_class_type(). More...
 
int getTypeIndex ()
 Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. This is equivalent to get_type().get_index(). 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. User code should avoid using ref() and unref() directly, which can result in missed reference counts. Instead, let a PointerTo object manage the reference counting automatically. More...
 
bool testRefCountIntegrity ()
 Does some easy checks to make sure that the reference count isn't completely bogus. Returns true if ok, false otherwise. More...
 
bool testRefCountNonzero ()
 Does some easy checks to make sure that the reference count isn't zero, or completely bogus. Returns true if ok, false otherwise. More...
 
bool unref ()
 Explicitly decrements the reference count. Note that the object will not be implicitly deleted by unref() simply because the reference count drops to zero. (Having a member function delete itself is problematic.) However, see the helper function unref_delete(). 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 ()
 

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.