Panda3D
 All Classes Functions Variables Enumerations
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. More...

#include "bulletVehicle.h"

Inheritance diagram for BulletVehicle:
TypedReferenceCount TypedObject ReferenceCount MemoryBase MemoryBase

Public Member Functions

 BulletVehicle (BulletWorld *world, BulletRigidBodyNode *chassis)
 Creates a new BulletVehicle instance in the given world and with a chassis node. More...
 
void apply_engine_force (PN_stdfloat force, int idx)
 Applies force at the wheel with index idx for acceleration. More...
 
BulletWheel create_wheel ()
 Factory method for creating wheels for this vehicle instance. More...
 
virtual TypeHandle force_init_type ()
 
BulletRigidBodyNodeget_chassis ()
 Returns the chassis of this vehicle. More...
 
PN_stdfloat get_current_speed_km_hour () const
 Returns the current speed in kilometers per hour. More...
 
LVector3 get_forward_vector () const
 Returns the forward vector representing the car's actual direction of movement. More...
 
int get_num_wheels () const
 Returns the number of wheels this vehicle has. More...
 
PN_stdfloat get_steering_value (int idx) const
 Returns the steering angle of the wheel with index idx in degrees. More...
 
BulletVehicleTuningget_tuning ()
 Returns a reference to the BulletVehicleTuning object of this vehicle which offers various vehicle-global tuning options. More...
 
virtual TypeHandle get_type () const
 
btRaycastVehicle * get_vehicle () const
 
BulletWheel get_wheel (int idx) const
 Returns the BulletWheel with index idx. More...
 
 MAKE_SEQ (get_wheels, get_num_wheels, get_wheel)
 
void reset_suspension ()
 Resets the vehicle's suspension. More...
 
void set_brake (PN_stdfloat brake, int idx)
 Applies braking force to the wheel with index idx. More...
 
void set_coordinate_system (BulletUpAxis up)
 Specifies which axis is "up". More...
 
void set_pitch_control (PN_stdfloat pitch)
 
void set_steering_value (PN_stdfloat steering, int idx)
 Sets the steering value (in degrees) of the wheel with index idx. More...
 
void sync_b2p ()
 
- Public Member Functions inherited from TypedReferenceCount
 TypedReferenceCount (const TypedReferenceCount &copy)
 
void operator= (const TypedReferenceCount &copy)
 
- Public Member Functions inherited from TypedObject
 TypedObject (const TypedObject &copy)
 
TypedObjectas_typed_object ()
 Returns the object, upcast (if necessary) to a TypedObject pointer. More...
 
const TypedObjectas_typed_object () const
 Returns the object, upcast (if necessary) to a TypedObject pointer. More...
 
int get_best_parent_from_Set (const std::set< int > &) const
 
int get_type_index () const
 Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. More...
 
bool is_exact_type (TypeHandle handle) const
 Returns true if the current object is the indicated type exactly. More...
 
bool is_of_type (TypeHandle handle) const
 Returns true if the current object is or derives from the indicated type. More...
 
void operator= (const TypedObject &copy)
 
- Public Member Functions inherited from ReferenceCount
int get_ref_count () const
 Returns the current reference count. More...
 
WeakReferenceListget_weak_list () const
 Returns the WeakReferenceList associated with this ReferenceCount object. More...
 
bool has_weak_list () const
 Returns true if this particular ReferenceCount object has a WeakReferenceList created, false otherwise. More...
 
void local_object ()
 This function should be called, once, immediately after creating a new instance of some ReferenceCount-derived object on the stack. More...
 
void ref () const
 Explicitly increments the reference count. More...
 
bool test_ref_count_integrity () const
 Does some easy checks to make sure that the reference count isn't completely bogus. More...
 
bool test_ref_count_nonzero () const
 Does some easy checks to make sure that the reference count isn't zero, or completely bogus. More...
 
virtual bool unref () const
 Explicitly decrements the reference count. More...
 
void weak_ref (WeakPointerToVoid *ptv)
 Adds the indicated PointerToVoid as a weak reference to this object. More...
 
void weak_unref (WeakPointerToVoid *ptv)
 Removes the indicated PointerToVoid as a weak reference to this object. More...
 

Static Public Member Functions

static TypeHandle get_class_type ()
 
static void init_type ()
 
- Static Public Member Functions inherited from TypedReferenceCount
static TypeHandle get_class_type ()
 
static void init_type ()
 
- Static Public Member Functions inherited from TypedObject
static TypeHandle get_class_type ()
 
static void init_type ()
 This function is declared non-inline to work around a compiler bug in g++ 2.96. More...
 
- Static Public Member Functions inherited from ReferenceCount
static TypeHandle get_class_type ()
 
static void init_type ()
 

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.

Definition at line 65 of file bulletVehicle.h.

Constructor & Destructor Documentation

BulletVehicle::BulletVehicle ( BulletWorld world,
BulletRigidBodyNode chassis 
)

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

Definition at line 29 of file bulletVehicle.cxx.

References set_coordinate_system().

Member Function Documentation

void BulletVehicle::apply_engine_force ( PN_stdfloat  force,
int  idx 
)

Applies force at the wheel with index idx for acceleration.

Definition at line 146 of file bulletVehicle.cxx.

References get_num_wheels().

BulletWheel BulletVehicle::create_wheel ( )

Factory method for creating wheels for this vehicle instance.

Definition at line 182 of file bulletVehicle.cxx.

BulletRigidBodyNode * BulletVehicle::get_chassis ( )

Returns the chassis of this vehicle.

The chassis is a rigid body node.

Definition at line 84 of file bulletVehicle.cxx.

Referenced by BulletWorld::remove_vehicle().

PN_stdfloat BulletVehicle::get_current_speed_km_hour ( ) const

Returns the current speed in kilometers per hour.

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

Definition at line 97 of file bulletVehicle.cxx.

LVector3 BulletVehicle::get_forward_vector ( ) const

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

The forward vetcor is given in global coordinates.

Definition at line 72 of file bulletVehicle.cxx.

int BulletVehicle::get_num_wheels ( ) const
inline

Returns the number of wheels this vehicle has.

Definition at line 58 of file bulletVehicle.I.

Referenced by apply_engine_force(), get_steering_value(), get_wheel(), set_brake(), and set_steering_value().

PN_stdfloat BulletVehicle::get_steering_value ( int  idx) const

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

Definition at line 120 of file bulletVehicle.cxx.

References get_num_wheels().

BulletVehicleTuning & BulletVehicle::get_tuning ( )
inline

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!

Definition at line 47 of file bulletVehicle.I.

BulletWheel BulletVehicle::get_wheel ( int  idx) const

Returns the BulletWheel with index idx.

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

Definition at line 226 of file bulletVehicle.cxx.

References BulletWheel::empty(), and get_num_wheels().

void BulletVehicle::reset_suspension ( )

Resets the vehicle's suspension.

Definition at line 108 of file bulletVehicle.cxx.

void BulletVehicle::set_brake ( PN_stdfloat  brake,
int  idx 
)

Applies braking force to the wheel with index idx.

Definition at line 158 of file bulletVehicle.cxx.

References get_num_wheels().

void BulletVehicle::set_coordinate_system ( BulletUpAxis  up)

Specifies which axis is "up".

Nessecary for the vehicle's suspension to work properly!

Definition at line 46 of file bulletVehicle.cxx.

Referenced by BulletVehicle().

void BulletVehicle::set_steering_value ( PN_stdfloat  steering,
int  idx 
)

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

Definition at line 133 of file bulletVehicle.cxx.

References get_num_wheels().


The documentation for this class was generated from the following files: