BulletVehicle

class BulletVehicle

Bases: TypedReferenceCount

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.

Inheritance diagram

Inheritance diagram of BulletVehicle

BulletVehicle(BulletWorld *world, BulletRigidBodyNode *chassis)

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

void apply_engine_force(PN_stdfloat force, int idx)

Applies force at the wheel with index idx for acceleration.

BulletWheel create_wheel(void)

Wheels

Factory method for creating wheels for this vehicle instance.

BulletRigidBodyNode *get_chassis(void)

Returns the chassis of this vehicle. The chassis is a rigid body node.

static TypeHandle get_class_type(void)
PN_stdfloat get_current_speed_km_hour(void) const

Returns the current speed in kilometers per hour. Convert to miles using: km/h * 0.62 = mph

LVector3 get_forward_vector(void) const

Returns the forward vector representing the car’s actual direction of movement. The forward vetcor is given in global coordinates.

int get_num_wheels(void) const

Returns the number of wheels this vehicle has.

PN_stdfloat get_steering_value(int idx) const

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

BulletVehicleTuning &get_tuning(void)

Tuning

Tuning

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!

BulletWheel 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.

void reset_suspension(void)

Resets the vehicle’s suspension.

void set_brake(PN_stdfloat brake, int idx)

Applies braking force to the wheel with index idx.

void set_coordinate_system(BulletUpAxis up)

Specifies which axis is “up”. Nessecary for the vehicle’s suspension to work properly!

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.