overview wiki api reference download
 All Classes Functions Variables Typedefs Enumerations Enumerator
Public Member Functions | Protected Member Functions
gameplay::PhysicsVehicle Class Reference

#include <PhysicsVehicle.h>

Inheritance diagram for gameplay::PhysicsVehicle:
gameplay::PhysicsCollisionObject

List of all members.

Public Member Functions

PhysicsCollisionObject::Type getType () const
PhysicsRigidBodygetRigidBody () const
void setEnabled (bool enable)
unsigned int getWheelCount () const
PhysicsVehicleWheelgetWheel (unsigned int i)
void addWheel (PhysicsVehicleWheel *wheel)
float getSpeedKph () const
float getSpeedSmoothKph () const
void update (float elapsedTime, float steering, float braking, float driving)
void reset ()
float getSteeringGain () const
void setSteeringGain (float steeringGain)
float getBrakingForce () const
void setBrakingForce (float brakingForce)
float getDrivingForce () const
void setDrivingForce (float drivingForce)
float getSteerdownSpeed () const
float getSteerdownGain () const
void setSteerdown (float steerdownSpeed, float steerdownGain)
float getBrakedownStart () const
float getBrakedownFull () const
void setBrakedown (float brakedownStart, float brakedownFull)
float getDrivedownStart () const
float getDrivedownFull () const
void setDrivedown (float drivedownStart, float drivedownFull)
float getBoostSpeed () const
float getBoostGain () const
void setBoost (float boostSpeed, float boostGain)
float getDownforce () const
void setDownforce (float downforce)

Protected Member Functions

btCollisionObject * getCollisionObject () const

Detailed Description

Defines a class for vehicle physics.

In addition to its own properties defined below, a vehicle has available to it all of the properties of a rigid body such as shape, mass, friction, etc which correspond to the vehicle body:

See also:
http://gameplay3d.github.io/GamePlay/docs/file-formats.html#wiki-Collision_Objects

Member Function Documentation

Permanently adds a wheel to this vehicle.

Parameters:
wheelthe wheel to add.

Returns boost gain at zero speed, typically greater than 1. Driving force is boosted by this factor at zero speed, and that factor fades linearly with speed reaching 1 at a specified speed.

Returns:
boost gain at zero speed.

Returns upper limit of low-speed boost effect, in km/h. Driving force is boosted by a specified factor at zero speed, and that factor fades linearly with speed reaching 1 at this speed.

Returns:
upper limit of low-speed boost effect, in km/h.

Returns speed where braking is fully faded, in km/h. This speed is typically greater than the brakedownStart speed.

Returns:
speed where braking is fully faded, in km/h.

Returns speed where braking starts to fade, in km/h.

Returns:
speed where braking starts to fade, in km/h.

Gets braking force at full braking.

Returns:
braking force at full braking.
btCollisionObject* gameplay::PhysicsVehicle::getCollisionObject ( ) const [protected, virtual]

Returns the lumped constant that controls aerodynamic downforce. Technically speaking, this constant lumps together the reference area and the down-force coefficient, and is in world-units squared. The actual aerodynamic down-force is calculated as a function of current speed, and is proportional to this constant.

Returns:
the lumped constant that controls aerodynamic downforce.

Returns speed where driving force is fully faded, in km/h. This speed is typically greater than the drivedownStart speed.

Returns:
speed where driving force is fully faded, in km/h.

Returns speed where driving force starts to fade, in km/h.

Returns:
speed where driving force starts to fade, in km/h.

Gets driving force at full throttle.

Returns:
driving force at full throttle.

Returns the rigid body associated with this vehicle.

Gets an indication of vehicle speed in kilometers per hour.

Gets a lagged version of vehicle speed in kilometers per hour, for example that might be used to control engine sounds.

Returns gain at the point of reduced steering, typically less than 1. A point of reduced steering is defined by speed and gain. Steering authority will reduce linearly with speed up to this point, and remain constant above that.

Returns:
gain at the point of reduced steering.

Returns speed at the point of reduced steering, in km/h. A point of reduced steering is defined by speed and gain. Steering authority will reduce linearly with speed up to this point, and remain constant above that.

Returns:
speed at the point of reduced steering, in km/h.

Gets steering gain at full deflection.

Returns:
steering gain at full deflection.

Gets the wheel at the specified index.

Parameters:
iindex of wheel.
Returns:
the wheel at the specified index.

Gets the number of wheels on this vehicle.

Returns:
the number of wheels on this vehicle.

Resets the vehicle's state, for example in preparation for a reposition.

void gameplay::PhysicsVehicle::setBoost ( float  boostSpeed,
float  boostGain 
)

Sets parameters that define low-speed boost of the driving force. Driving force is boosted by the specified factor at zero speed, and that factor fades linearly with speed reaching 1 at the specified speed.

Parameters:
boostSpeedupper limit of low-speed boost effect, in km/h.
boostGainboost gain at zero speed, typically greater than 1. A gain of 1 will effectively disable the feature.
void gameplay::PhysicsVehicle::setBrakedown ( float  brakedownStart,
float  brakedownFull 
)

Sets points that control fade of brake force with speed, in km/h.

Parameters:
brakedownStartbraking fades above this speed. A very large value will effectively disable the feature.
brakedownFullbraking is fully faded at this speed. This speed is typically greater than the brakedownStart speed.
void gameplay::PhysicsVehicle::setBrakingForce ( float  brakingForce)

Sets braking force at full braking.

Parameters:
brakingForcebraking force at full braking.
void gameplay::PhysicsVehicle::setDownforce ( float  downforce)

Sets the lumped constant that controls aerodynamic downforce. Technically speaking, this constant lumps together the reference area and the down-force coefficient, and is in world-units squared. The actual aerodynamic down-force is calculated as a function of current speed, and is proportional to this constant.

Parameters:
downforcethe lumped constant that controls aerodynamic downforce. A value of 0 will effectively disable this feature.
void gameplay::PhysicsVehicle::setDrivedown ( float  drivedownStart,
float  drivedownFull 
)

Sets points that control fade of driving force with speed, in km/h.

Parameters:
drivedownStartdriving force fades above this speed. A very large value will effectively disable the feature.
drivedownFulldriving force is fully faded at this speed. This speed is typically greater than the drivedownStart speed.
void gameplay::PhysicsVehicle::setDrivingForce ( float  drivingForce)

Sets driving force at full throttle.

Parameters:
drivingForcedriving force at full throttle.
void gameplay::PhysicsVehicle::setEnabled ( bool  enable)

Sets whether the associated rigid body is enabled or disabled in the physics world.

Parameters:
enabletrue enables the collision object, false disables it.

Reimplemented from gameplay::PhysicsCollisionObject.

void gameplay::PhysicsVehicle::setSteerdown ( float  steerdownSpeed,
float  steerdownGain 
)

Sets the point of reduced steering, defined by speed and gain. Typically the gain value is less than 1. Steering authority will reduce linearly with speed up to this point, and remain constant above that.

Parameters:
steerdownSpeedspeed at the point of reduced steering, in km/h.
steerdownGaingain at the point of reduced steering. A gain of 1 will effectively disable the feature.
void gameplay::PhysicsVehicle::setSteeringGain ( float  steeringGain)

Sets steering gain at full deflection.

Parameters:
steeringGainsteering gain at full deflection.
void gameplay::PhysicsVehicle::update ( float  elapsedTime,
float  steering,
float  braking,
float  driving 
)

Updates the vehicle state using the specified normalized command inputs, and updates the transform on the visual node for each wheel.

Parameters:
elapsedTimeThe elapsed game time.
steeringsteering command (-1 to 1).
brakingbraking command (0 to 1).
drivingnet drivetrain command (0 to 1).
 All Classes Functions Variables Typedefs Enumerations Enumerator