torque Torque Game Engine Documentation
TGE Version 1.5.2

Vehicle Class Reference

#include <vehicle.h>

Inheritance diagram for Vehicle:

Inheritance graph
[legend]

Public Member Functions

 Vehicle ()
void processTick (const Move *move)
 Processes a move event and updates object state once every 32 milliseconds.
bool onAdd ()
 Called when the object is added to the sim.
void onRemove ()
 Called when the object is removed from the sim.
Point2F getSteering ()
void interpolateTick (F32 dt)
 Interpolates between move ticks.
void advanceTime (F32 dt)
 Advances simulation time for animations.
void disableCollision ()
 Disables collisions for this vehicle and all mounted objects.
void enableCollision ()
 Enables collisions for this vehicle and all mounted objects.
Point3F getVelocity () const
 Returns the velocity of the vehicle.
void setEnergyLevel (F32 energy)
 Sets the level of energy for this object.
 DECLARE_CONOBJECT (Vehicle)
Rigid body methods
void getVelocity (const Point3F &r, Point3F *vel)
 This method will get the velocity of the object, taking into account angular velocity.
void applyImpulse (const Point3F &r, const Point3F &impulse)
 Applies an impulse force.
void getCameraParameters (F32 *min, F32 *max, Point3F *offset, MatrixF *rot)
 Gets the minimum viewing distance, maximum viewing distance, camera offsetand rotation for this object, if the world were to be viewed through its eyes.
void getCameraTransform (F32 *pos, MatrixF *mat)
 Gets the camera transform.
void mountObject (ShapeBase *obj, U32 node)
 Mount an object to a mount point.

Static Public Member Functions

static void initPersistFields ()
 Register dynamic fields in a subclass of ConsoleObject.

Static Public Attributes

static ClippedPolyListsPolyList
static S32 sVehicleCount

Protected Types

enum  CollisionFaceFlags {
  BodyCollision = 0x1,
  WheelCollision = 0x2
}
enum  MaskBits {
  PositionMask = Parent::NextFreeMask << 0,
  EnergyMask = Parent::NextFreeMask << 1,
  NextFreeMask = Parent::NextFreeMask << 2
}

Protected Member Functions

bool onNewDataBlock (GameBaseData *dptr)
 Called when a new datablock is set.
void updatePos (F32 dt)
bool updateCollision (F32 dt)
bool resolveCollision (Rigid &ns, CollisionList &cList)
bool resolveContacts (Rigid &ns, CollisionList &cList, F32 dt)
bool resolveDisplacement (Rigid &ns, CollisionState *state, F32 dt)
bool findContacts (Rigid &ns, CollisionList &cList)
void checkTriggers ()
void setPosition (const Point3F &pos, const QuatF &rot)
void setRenderPosition (const Point3F &pos, const QuatF &rot)
void setTransform (const MatrixF &mat)
 Sets the Object -> World transform.
virtual void updateMove (const Move *move)
virtual void updateForces (F32 dt)
void writePacketData (GameConnection *conn, BitStream *stream)
 Write state information necessary to perform client side prediction of an object.
void readPacketData (GameConnection *conn, BitStream *stream)
 Read data written with writePacketData() and update the object state.
U32 packUpdate (NetConnection *conn, U32 mask, BitStream *stream)
 Instructs this object to pack its state for transfer over the network.
void unpackUpdate (NetConnection *conn, BitStream *stream)
 Instructs this object to read state data previously packed with packUpdate.
void updateLiftoffDust (F32 dt)
void updateDamageSmoke (F32 dt)
void updateWorkingCollisionSet (const U32 mask)
virtual U32 getCollisionMask ()
void updateFroth (F32 dt)
bool collidingWithWater (Point3F &waterHeight)
void renderImage (SceneState *state, SceneRenderImage *image)
void renderMountedImage (SceneState *state, ShapeImageRenderImage *image)
 Renders a mounted object.
virtual bool getAIMove (Move *move)

Static Protected Member Functions

static void findCallback (SceneObject *obj, void *key)

Protected Attributes

StateDelta mDelta
S32 mPredictionCount
 Number of ticks to predict.
VehicleDatamDataBlock
 Datablock.
bool inLiquid
AUDIOHANDLE waterWakeHandle
Point3F mCameraOffset
 3rd person camera
Point2F mSteering
F32 mThrottle
bool mJetting
bool mDisableMove
CollisionList mCollisionList
CollisionList mContacts
Rigid mRigid
ShapeBaseConvex mConvex
int restCount
ParticleEmittermDustEmitterList [VehicleData::VC_NUM_DUST_EMITTERS]
ParticleEmittermDamageEmitterList [VehicleData::VC_NUM_DAMAGE_EMITTERS]
ParticleEmittermSplashEmitterList [VehicleData::VC_NUM_SPLASH_EMITTERS]

Private Types

typedef ShapeBase Parent

Data Structures

struct  StateDelta

Member Typedef Documentation

typedef ShapeBase Vehicle::Parent [private]

Reimplemented from ShapeBase.

Reimplemented in AIWheeledVehicle, FlyingVehicle, HoverVehicle, and WheeledVehicle.


Member Enumeration Documentation

enum Vehicle::CollisionFaceFlags [protected]

Enumerator:
BodyCollision 
WheelCollision 

enum Vehicle::MaskBits [protected]

Enumerator:
PositionMask 
EnergyMask 
NextFreeMask 

Reimplemented in WheeledVehicle.


Constructor & Destructor Documentation

Vehicle::Vehicle (  ) 


Member Function Documentation

bool Vehicle::onNewDataBlock ( GameBaseData dptr  )  [protected, virtual]

Called when a new datablock is set.

This allows subclasses to appropriately handle new datablocks.

See also:
setDataBlock()
Parameters:
dptr New datablock

Reimplemented from ShapeBase.

Reimplemented in FlyingVehicle, HoverVehicle, and WheeledVehicle.

void Vehicle::updatePos ( F32  dt  )  [protected]

bool Vehicle::updateCollision ( F32  dt  )  [protected]

bool Vehicle::resolveCollision ( Rigid ns,
CollisionList cList 
) [protected]

bool Vehicle::resolveContacts ( Rigid ns,
CollisionList cList,
F32  dt 
) [protected]

bool Vehicle::resolveDisplacement ( Rigid ns,
CollisionState state,
F32  dt 
) [protected]

bool Vehicle::findContacts ( Rigid ns,
CollisionList cList 
) [protected]

void Vehicle::checkTriggers (  )  [protected]

static void Vehicle::findCallback ( SceneObject obj,
void key 
) [static, protected]

void Vehicle::setPosition ( const Point3F pos,
const QuatF rot 
) [protected]

void Vehicle::setRenderPosition ( const Point3F pos,
const QuatF rot 
) [protected]

void Vehicle::setTransform ( const MatrixF mat  )  [protected, virtual]

Sets the Object -> World transform.

Parameters:
mat New transform matrix

Reimplemented from SceneObject.

virtual void Vehicle::updateMove ( const Move move  )  [protected, virtual]

Reimplemented in FlyingVehicle, HoverVehicle, and WheeledVehicle.

virtual void Vehicle::updateForces ( F32  dt  )  [protected, virtual]

Reimplemented in FlyingVehicle, HoverVehicle, and WheeledVehicle.

void Vehicle::writePacketData ( GameConnection conn,
BitStream stream 
) [protected, virtual]

Write state information necessary to perform client side prediction of an object.

This information is sent only to the controling object. For example, if you are a client controlling a Player, the server uses writePacketData() instead of packUpdate() to generate the data you receive.

Parameters:
conn Connection for which we're generating this data.
stream Bitstream for output.

Reimplemented from ShapeBase.

Reimplemented in FlyingVehicle, and WheeledVehicle.

void Vehicle::readPacketData ( GameConnection conn,
BitStream stream 
) [protected, virtual]

Read data written with writePacketData() and update the object state.

Parameters:
conn Connection for which we're generating this data.
stream Bitstream to read.

Reimplemented from ShapeBase.

Reimplemented in FlyingVehicle, and WheeledVehicle.

U32 Vehicle::packUpdate ( NetConnection conn,
U32  mask,
BitStream stream 
) [protected, virtual]

Instructs this object to pack its state for transfer over the network.

Parameters:
conn Net connection being used
mask Mask indicating fields to transmit.
stream Bitstream to pack data to
Returns:
Any bits which were not dealt with. The value is stored by the networking system. Don't set bits you weren't passed.

Reimplemented from ShapeBase.

Reimplemented in FlyingVehicle, HoverVehicle, and WheeledVehicle.

void Vehicle::unpackUpdate ( NetConnection conn,
BitStream stream 
) [protected, virtual]

Instructs this object to read state data previously packed with packUpdate.

Parameters:
conn Net connection being used
stream stream to read from

Reimplemented from ShapeBase.

Reimplemented in FlyingVehicle, HoverVehicle, and WheeledVehicle.

void Vehicle::updateLiftoffDust ( F32  dt  )  [protected]

void Vehicle::updateDamageSmoke ( F32  dt  )  [protected]

void Vehicle::updateWorkingCollisionSet ( const U32  mask  )  [protected]

virtual U32 Vehicle::getCollisionMask (  )  [protected, virtual]

Reimplemented in FlyingVehicle, HoverVehicle, and WheeledVehicle.

void Vehicle::updateFroth ( F32  dt  )  [protected]

bool Vehicle::collidingWithWater ( Point3F waterHeight  )  [protected]

void Vehicle::renderImage ( SceneState state,
SceneRenderImage image 
) [protected, virtual]

Reimplemented from ShapeBase.

Reimplemented in WheeledVehicle.

void Vehicle::renderMountedImage ( SceneState state,
ShapeImageRenderImage image 
) [protected, virtual]

Renders a mounted object.

Parameters:
state State of scene
image ShapeImage to render

Reimplemented from ShapeBase.

virtual bool Vehicle::getAIMove ( Move move  )  [protected, virtual]

Reimplemented in AIWheeledVehicle.

static void Vehicle::initPersistFields (  )  [static]

Register dynamic fields in a subclass of ConsoleObject.

See also:
addField(), addFieldV(), addDepricatedField(), addGroup(), endGroup()

Reimplemented from GameBase.

Reimplemented in FlyingVehicle, and WheeledVehicle.

void Vehicle::processTick ( const Move move  )  [virtual]

Processes a move event and updates object state once every 32 milliseconds.

This takes place both on the client and server, every 32 milliseconds (1 tick).

See also:
ProcessList
Parameters:
move Move event corresponding to this tick, or NULL.

Reimplemented from ShapeBase.

Reimplemented in WheeledVehicle.

bool Vehicle::onAdd (  )  [virtual]

Called when the object is added to the sim.

Reimplemented from ShapeBase.

Reimplemented in FlyingVehicle, HoverVehicle, and WheeledVehicle.

void Vehicle::onRemove (  )  [virtual]

Called when the object is removed from the sim.

Reimplemented from ShapeBase.

Reimplemented in FlyingVehicle, HoverVehicle, and WheeledVehicle.

Point2F Vehicle::getSteering (  )  [inline]

void Vehicle::interpolateTick ( F32  dt  )  [virtual]

Interpolates between move ticks.

See also:
processTick
Parameters:
dt Change in time between the last call and this call to the function

Reimplemented from GameBase.

void Vehicle::advanceTime ( F32  dt  )  [virtual]

Advances simulation time for animations.

This is called every frame.

Parameters:
dt Time since last advance call

Reimplemented from ShapeBase.

Reimplemented in FlyingVehicle, HoverVehicle, and WheeledVehicle.

void Vehicle::disableCollision (  )  [virtual]

Disables collisions for this vehicle and all mounted objects.

Reimplemented from SceneObject.

void Vehicle::enableCollision (  )  [virtual]

Enables collisions for this vehicle and all mounted objects.

Reimplemented from SceneObject.

Point3F Vehicle::getVelocity (  )  const [virtual]

Returns the velocity of the vehicle.

Reimplemented from SceneObject.

void Vehicle::setEnergyLevel ( F32  energy  )  [virtual]

Sets the level of energy for this object.

Parameters:
energy Level of energy to assign to this object

Reimplemented from ShapeBase.

void Vehicle::getVelocity ( const Point3F r,
Point3F vel 
)

This method will get the velocity of the object, taking into account angular velocity.

Parameters:
r Point on the object you want the velocity of, relative to Center of Mass
vel Velocity (out)

void Vehicle::applyImpulse ( const Point3F r,
const Point3F impulse 
) [virtual]

Applies an impulse force.

Parameters:
r Point on the object to apply impulse to, r is relative to Center of Mass
impulse Impulse vector to apply.

Reimplemented from ShapeBase.

void Vehicle::getCameraParameters ( F32 min,
F32 max,
Point3F offset,
MatrixF rot 
) [virtual]

Gets the minimum viewing distance, maximum viewing distance, camera offsetand rotation for this object, if the world were to be viewed through its eyes.

Parameters:
min Minimum viewing distance
max Maximum viewing distance
offset Offset of the camera from the origin in local space
rot Rotation matrix

Reimplemented from ShapeBase.

void Vehicle::getCameraTransform ( F32 pos,
MatrixF mat 
) [virtual]

Gets the camera transform.

Todo:
Find out what pos does
Parameters:
pos TODO: Find out what this does
mat Camera transform (out)

Reimplemented from ShapeBase.

void Vehicle::mountObject ( ShapeBase obj,
U32  node 
) [virtual]

Mount an object to a mount point.

Parameters:
obj Object to mount
node Mount node ID

Reimplemented from ShapeBase.

Vehicle::DECLARE_CONOBJECT ( Vehicle   ) 


Field Documentation

Number of ticks to predict.

Datablock.

Reimplemented from ShapeBase.

Reimplemented in FlyingVehicle, HoverVehicle, and WheeledVehicle.

bool Vehicle::inLiquid [protected]

3rd person camera

F32 Vehicle::mThrottle [protected]

bool Vehicle::mJetting [protected]

bool Vehicle::mDisableMove [protected]

Rigid Vehicle::mRigid [protected]

int Vehicle::restCount [protected]

ParticleEmitter* Vehicle::mDustEmitterList[VehicleData::VC_NUM_DUST_EMITTERS] [protected]

ParticleEmitter* Vehicle::mDamageEmitterList[VehicleData::VC_NUM_DAMAGE_EMITTERS] [protected]

ParticleEmitter* Vehicle::mSplashEmitterList[VehicleData::VC_NUM_SPLASH_EMITTERS] [protected]




All Rights Reserved GarageGames.com, Inc. 1999-2005
Auto-magically Generated with Doxygen