#include <Car.h>
Inheritance diagram for Engine::GameObjects::Car:
Public Member Functions | |
Car (Physics::World &world, btTransform start, InputDevice *input_device, unsigned int car_model, const btVector3 &plane_normal, const btScalar &plane_distance, const btVector3 &start_point) | |
Construct the car and place it into the game. | |
virtual | ~Car () |
virtual void | draw () const |
Draw the object. | |
virtual Track::AxisAlignedBoundingBox | get_bounds () const |
Get the Axis aligned bounding box of the object. | |
void | take_input (InputReport &report) |
Take input from a device. | |
virtual void | set_forces () |
apply driving forces to the physics engine's representation of the car. | |
virtual void | posttick () |
update the physics | |
void | get_transform (btTransform &transform) |
signed int | get_lap () |
Return the lap the car is on. | |
unsigned long int | get_last_lap_ticks () |
Return the number of ticks taken to complete the last lap. | |
unsigned long int | get_best_lap_ticks () |
Return the number of ticks taken to complete the fastest lap. | |
btScalar | get_speed () |
Return the speed the car is travelling at in decimeters per second. | |
btScalar | get_lap_distance () const |
Return the distance from the start of the lap. | |
bool | get_finished () const |
Return true if three laps have been completed. | |
bool | get_disqualified () const |
Return true if the car has been disqualifed. | |
unsigned long int | get_finish_time () const |
Return the time taken to complete the course or get disqualified. | |
int | get_facing_backwards () const |
Find if car is facing the wrong way. | |
btScalar | get_camera_height () const |
Find a suitable height for a camera. | |
void | get_sensors (float results[NUM_SENSORS]) const |
Return the relative distance to the goal in various directions. | |
Static Public Attributes | |
static const unsigned int | NUM_SENSORS_FEELERS = 8 |
The number of directions the cpu car directional sensors read. | |
static const unsigned int | NUM_FEELER_PROPERTIES = Track::SENSOR_COUNT |
The number of values of data each directional feeler has. | |
static const unsigned int | NUM_SENSORS = NUM_SENSORS_FEELERS * NUM_FEELER_PROPERTIES + 14 |
The total number of sensor values. | |
Private Member Functions | |
Car (Car &car) | |
Car & | operator= (Car &car) |
void | remove () |
Remove the car from the course. | |
void | update_sounds () |
Set the volume, pitch, position and velocity of the sound sources. | |
Private Attributes | |
Track::Texture * | texture |
Track::BulletMesh * | mesh |
Track::Texture * | flame_texture |
The texture used for the engine flame effect. | |
Track::BulletMesh * | flame_mesh |
The mesh used for the engine flame effect. | |
Physics::World & | world |
btRigidBody * | rigid_body |
InputDevice * | input_device |
btVector3 | force |
btVector3 | torque |
btVector3 | local_force |
btVector3 | local_torque |
bool | floor_stick |
True when sticking to a floor, false if falling. | |
unsigned int | car_model |
Which car mesh and texture to use. | |
signed int | lap |
the lap the car is on | |
signed int | max_lap |
The highest numbered lap ever reached. | |
unsigned long int | lap_start_ticks |
The tick number when starting the last lap. | |
unsigned long int | last_lap_ticks |
The number of ticks taken to complete the last lap. | |
unsigned long int | best_lap_ticks |
The number of ticks taken to complete the fastest lap. | |
bool | infront_of_start |
True if infront of the start line. | |
const btVector3 & | plane_normal |
const btScalar & | plane_distance |
const btVector3 & | start_point |
btScalar | elastic_potential_energy |
energy built up when breaking. | |
btScalar | tick_energy_absorbed |
amount of energy built up while breaking in the last frame. | |
btScalar | used_energy_boost |
The amount stored of enery released last tick. | |
unsigned int | boost_timer |
number of ticks since last boost. | |
bool | m_course_complete |
True if 3 laps have been completed. | |
unsigned long int | m_course_complete_time |
The time in ticks taken to complete three laps. | |
bool | m_removed |
True if the car has been removed from the course. | |
btTransform | m_last_transform |
The transformation used when the car crossed the finish line. | |
boost::shared_ptr< SoundSource > | m_engine_sound_source |
The sound effect for the engine accelerating noise. | |
boost::shared_ptr< SoundSource > | m_drag_sound_source |
The sound effect when the car is moving independant of acceleration. | |
boost::shared_ptr< SoundSource > | m_break_sound_source |
The sound effect when the car is braking. | |
boost::shared_ptr< SoundSource > | m_boost_sound_source |
The sound effect for the booster noise. | |
boost::shared_ptr< SoundSource > | m_release_energy_sound_source |
The sound effect for releasing energy stored while breaking. | |
boost::shared_ptr< SoundSource > | m_slide_sound_source |
The sound effect for sliding sideways. |
Definition at line 36 of file Car.h.
Engine::GameObjects::Car::Car | ( | Car & | car | ) | [private] |
Engine::GameObjects::Car::Car | ( | Physics::World & | world, | |
btTransform | start, | |||
InputDevice * | input_device, | |||
unsigned int | car_model, | |||
const btVector3 & | plane_normal, | |||
const btScalar & | plane_distance, | |||
const btVector3 & | start_point | |||
) |
Construct the car and place it into the game.
world | The Physics world of the game. | |
start | The transformation for the starting position. |
input_device | The input device to bind the car to. | |
car_model | The mesh and texture of the car. Must be 0 or 1. | |
plane_normal | The unit normal of the start/finish plane. | |
plane_distance | The signed distance between the start/finish plane and the origin. | |
start_point | The centre of the start/finish line. |
void Engine::GameObjects::Car::draw | ( | ) | const [virtual] |
Draw the object.
Called indirectly by draw(const OcclusionTester &) const when it is on the screen, but can also be called manually if view bounds are not known.
Implements Track::Drawable.
unsigned long int Engine::GameObjects::Car::get_best_lap_ticks | ( | ) |
Track::AxisAlignedBoundingBox Engine::GameObjects::Car::get_bounds | ( | ) | const [virtual] |
Get the Axis aligned bounding box of the object.
The object is contained entierly within this region.
Implements Track::AABBBounded.
btScalar Engine::GameObjects::Car::get_camera_height | ( | ) | const |
bool Engine::GameObjects::Car::get_disqualified | ( | ) | const |
int Engine::GameObjects::Car::get_facing_backwards | ( | ) | const |
unsigned long int Engine::GameObjects::Car::get_finish_time | ( | ) | const |
Return the time taken to complete the course or get disqualified.
Precondition: get_finished() or get_disqualified() returns true.
bool Engine::GameObjects::Car::get_finished | ( | ) | const |
signed int Engine::GameObjects::Car::get_lap | ( | ) |
btScalar Engine::GameObjects::Car::get_lap_distance | ( | ) | const |
unsigned long int Engine::GameObjects::Car::get_last_lap_ticks | ( | ) |
void Engine::GameObjects::Car::get_sensors | ( | float | results[NUM_SENSORS] | ) | const |
Return the relative distance to the goal in various directions.
Gives the difference between the distance to the goal of the car and the difference to the goal of other points: 1m infront of the car, 1m behind the car, 1m to the left of the car, 1m to the right of the car
results | array where calculated values will be written. |
direction and distance to nearest other car(s).
See if the scales can be removed once the AI is good enough.
See if any sensor can be removed once the AI is good enough.
btScalar Engine::GameObjects::Car::get_speed | ( | ) |
void Engine::GameObjects::Car::get_transform | ( | btTransform & | transform | ) |
void Engine::GameObjects::Car::posttick | ( | ) | [virtual] |
update the physics
Implements Engine::Physics::TickObserver.
void Engine::GameObjects::Car::remove | ( | ) | [private] |
void Engine::GameObjects::Car::set_forces | ( | ) | [virtual] |
apply driving forces to the physics engine's representation of the car.
Reimplemented from Engine::Physics::TickObserver.
void Engine::GameObjects::Car::take_input | ( | InputReport & | report | ) |
void Engine::GameObjects::Car::update_sounds | ( | ) | [private] |
unsigned long int Engine::GameObjects::Car::best_lap_ticks [private] |
unsigned int Engine::GameObjects::Car::boost_timer [private] |
unsigned int Engine::GameObjects::Car::car_model [private] |
btScalar Engine::GameObjects::Car::elastic_potential_energy [private] |
bool Engine::GameObjects::Car::floor_stick [private] |
btVector3 Engine::GameObjects::Car::force [private] |
bool Engine::GameObjects::Car::infront_of_start [private] |
signed int Engine::GameObjects::Car::lap [private] |
unsigned long int Engine::GameObjects::Car::lap_start_ticks [private] |
unsigned long int Engine::GameObjects::Car::last_lap_ticks [private] |
btVector3 Engine::GameObjects::Car::local_force [private] |
btVector3 Engine::GameObjects::Car::local_torque [private] |
boost::shared_ptr<SoundSource> Engine::GameObjects::Car::m_boost_sound_source [private] |
boost::shared_ptr<SoundSource> Engine::GameObjects::Car::m_break_sound_source [private] |
bool Engine::GameObjects::Car::m_course_complete [private] |
unsigned long int Engine::GameObjects::Car::m_course_complete_time [private] |
boost::shared_ptr<SoundSource> Engine::GameObjects::Car::m_drag_sound_source [private] |
boost::shared_ptr<SoundSource> Engine::GameObjects::Car::m_engine_sound_source [private] |
btTransform Engine::GameObjects::Car::m_last_transform [private] |
boost::shared_ptr<SoundSource> Engine::GameObjects::Car::m_release_energy_sound_source [private] |
bool Engine::GameObjects::Car::m_removed [private] |
boost::shared_ptr<SoundSource> Engine::GameObjects::Car::m_slide_sound_source [private] |
signed int Engine::GameObjects::Car::max_lap [private] |
Track::BulletMesh* Engine::GameObjects::Car::mesh [private] |
const unsigned int Engine::GameObjects::Car::NUM_FEELER_PROPERTIES = Track::SENSOR_COUNT [static] |
const unsigned int Engine::GameObjects::Car::NUM_SENSORS = NUM_SENSORS_FEELERS * NUM_FEELER_PROPERTIES + 14 [static] |
const unsigned int Engine::GameObjects::Car::NUM_SENSORS_FEELERS = 8 [static] |
const btScalar& Engine::GameObjects::Car::plane_distance [private] |
const btVector3& Engine::GameObjects::Car::plane_normal [private] |
btRigidBody* Engine::GameObjects::Car::rigid_body [private] |
const btVector3& Engine::GameObjects::Car::start_point [private] |
Track::Texture* Engine::GameObjects::Car::texture [private] |
btScalar Engine::GameObjects::Car::tick_energy_absorbed [private] |
btVector3 Engine::GameObjects::Car::torque [private] |
btScalar Engine::GameObjects::Car::used_energy_boost [private] |
Physics::World& Engine::GameObjects::Car::world [private] |
Generated at Mon Sep 6 00:41:17 2010 by Doxygen version 1.4.7 for Racer version svn335.