gameplay::PhysicsVehicle Class Reference

`#include <PhysicsVehicle.h>`

Inheritance diagram for gameplay::PhysicsVehicle:

## Public Member Functions | |

PhysicsCollisionObject::Type | getType () const |

PhysicsRigidBody * | getRigidBody () const |

void | setEnabled (bool enable) |

unsigned int | getWheelCount () const |

PhysicsVehicleWheel * | getWheel (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 |

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:

void gameplay::PhysicsVehicle::addWheel | ( | PhysicsVehicleWheel * | wheel | ) |

Permanently adds a wheel to this vehicle.

**Parameters:**-
wheel the wheel to add.

float gameplay::PhysicsVehicle::getBoostGain | ( | ) | const |

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.

float gameplay::PhysicsVehicle::getBoostSpeed | ( | ) | const |

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.

float gameplay::PhysicsVehicle::getBrakedownFull | ( | ) | const |

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.

float gameplay::PhysicsVehicle::getBrakedownStart | ( | ) | const |

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

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

float gameplay::PhysicsVehicle::getBrakingForce | ( | ) | const |

Gets braking force at full braking.

**Returns:**- braking force at full braking.

btCollisionObject* gameplay::PhysicsVehicle::getCollisionObject | ( | ) | const` [protected, virtual]` |

Implements gameplay::PhysicsCollisionObject.

float gameplay::PhysicsVehicle::getDownforce | ( | ) | const |

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.

float gameplay::PhysicsVehicle::getDrivedownFull | ( | ) | const |

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.

float gameplay::PhysicsVehicle::getDrivedownStart | ( | ) | const |

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

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

float gameplay::PhysicsVehicle::getDrivingForce | ( | ) | const |

Gets driving force at full throttle.

**Returns:**- driving force at full throttle.

Returns the rigid body associated with this vehicle.

float gameplay::PhysicsVehicle::getSpeedKph | ( | ) | const |

Gets an indication of vehicle speed in kilometers per hour.

float gameplay::PhysicsVehicle::getSpeedSmoothKph | ( | ) | const |

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

float gameplay::PhysicsVehicle::getSteerdownGain | ( | ) | const |

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.

float gameplay::PhysicsVehicle::getSteerdownSpeed | ( | ) | const |

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.

float gameplay::PhysicsVehicle::getSteeringGain | ( | ) | const |

Gets steering gain at full deflection.

**Returns:**- steering gain at full deflection.

PhysicsCollisionObject::Type gameplay::PhysicsVehicle::getType | ( | ) | const` [virtual]` |

**See also:**- PhysicsCollisionObject::getType

Implements gameplay::PhysicsCollisionObject.

PhysicsVehicleWheel* gameplay::PhysicsVehicle::getWheel | ( | unsigned int | i | ) |

Gets the wheel at the specified index.

**Parameters:**-
i index of wheel.

**Returns:**- the wheel at the specified index.

unsigned int gameplay::PhysicsVehicle::getWheelCount | ( | ) | const |

Gets the number of wheels on this vehicle.

**Returns:**- the number of wheels on this vehicle.

void gameplay::PhysicsVehicle::reset | ( | ) |

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:**-
boostSpeed upper limit of low-speed boost effect, in km/h. boostGain boost 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:**-
brakedownStart braking fades above this speed. A very large value will effectively disable the feature. brakedownFull braking 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:**-
brakingForce braking 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:**-
downforce the 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:**-
drivedownStart driving force fades above this speed. A very large value will effectively disable the feature. drivedownFull driving 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:**-
drivingForce driving 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:**-
enable true 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:**-
steerdownSpeed speed at the point of reduced steering, in km/h. steerdownGain gain 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:**-
steeringGain steering 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:**-
elapsedTime The elapsed game time. steering steering command (-1 to 1). braking braking command (0 to 1). driving net drivetrain command (0 to 1).

Generated on Sat Jan 24 2015 15:29:43 for gameplay by 1.7.6.1