RigidShape Class Reference

#include <rigidShape.h>

Inheritance diagram for RigidShape:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 RigidShape ()
 ~RigidShape ()
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.
void interpolateTick (F32 dt)
 Interpolates between move ticks.
void advanceTime (F32 dt)
 Advances simulation time for animations.
void disableCollision ()
 Disables collisions for this shape.
void enableCollision ()
 Enables collisions for this shape.
Point3F getVelocity () const
 Returns the velocity of the shape.
void setEnergyLevel (F32 energy)
 Sets the level of energy for this object.
void reset ()
void freezeSim (bool frozen)
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.
 DECLARE_CONOBJECT (RigidShape)
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.

Static Public Member Functions

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

Static Public Attributes

static ClippedPolyListsPolyList

Protected Types

 BodyCollision = BIT(0)
 WheelCollision = BIT(1)
 PositionMask = Parent::NextFreeMask << 0
 EnergyMask = Parent::NextFreeMask << 1
 FreezeMask = Parent::NextFreeMask << 2
 NextFreeMask = Parent::NextFreeMask << 3
enum  CollisionFaceFlags {
  BodyCollision = BIT(0),
  WheelCollision = BIT(1)
}
enum  MaskBits {
  PositionMask = Parent::NextFreeMask << 0,
  EnergyMask = Parent::NextFreeMask << 1,
  FreezeMask = Parent::NextFreeMask << 2,
  NextFreeMask = Parent::NextFreeMask << 3
}

Protected Member Functions

void updateDustTrail (F32 dt)
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.
void updateMove (const Move *move)
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.
void updateLiftoffDust (F32 dt)
void updateWorkingCollisionSet (const U32 mask)
U32 getCollisionMask ()
void updateFroth (F32 dt)
bool collidingWithWater (Point3F &waterHeight)
void updateForces (F32)

Static Protected Member Functions

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

Protected Attributes

StateDelta mDelta
S32 mPredictionCount
 Number of ticks to predict.
bool inLiquid
Point3F mCameraOffset
 3rd person camera
bool mDisableMove
CollisionList mCollisionList
CollisionList mContacts
Rigid mRigid
ShapeBaseConvex mConvex
int restCount
ParticleEmittermDustEmitterList [RigidShapeData::VC_NUM_DUST_EMITTERS]
ParticleEmittermSplashEmitterList [RigidShapeData::VC_NUM_SPLASH_EMITTERS]
GFXStateBlockRef mSolidSB

Private Types

typedef ShapeBase Parent

Private Attributes

RigidShapeDatamDataBlock
 Datablock.
ParticleEmittermDustTrailEmitter

Classes

struct  StateDelta

Member Typedef Documentation

typedef ShapeBase RigidShape::Parent [private]

Reimplemented from ShapeBase.


Member Enumeration Documentation

Enumerator:
BodyCollision 
WheelCollision 

enum RigidShape::MaskBits [protected]

Enumerator:
PositionMask 
EnergyMask 
FreezeMask 
NextFreeMask 


Constructor & Destructor Documentation

RigidShape::RigidShape (  ) 

RigidShape::~RigidShape (  ) 


Member Function Documentation

void RigidShape::updateDustTrail ( F32  dt  )  [protected]

bool RigidShape::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.

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

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

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

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

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

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

void RigidShape::checkTriggers (  )  [protected]

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

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

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

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

Sets the Object -> World transform.

Parameters:
mat New transform matrix

Reimplemented from SceneObject.

void RigidShape::updateMove ( const Move move  )  [protected]

void RigidShape::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.

void RigidShape::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.

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

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

U32 RigidShape::getCollisionMask (  )  [protected]

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

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

void RigidShape::updateForces ( F32   )  [protected]

static void RigidShape::initPersistFields (  )  [static]

Register dynamic fields in a subclass of ConsoleObject.

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

Reimplemented from GameBase.

void RigidShape::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.

bool RigidShape::onAdd (  )  [virtual]

Called when the object is added to the sim.

Reimplemented from ShapeBase.

void RigidShape::onRemove (  )  [virtual]

Called when the object is removed from the sim.

Reimplemented from ShapeBase.

void RigidShape::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 RigidShape::advanceTime ( F32  dt  )  [virtual]

Advances simulation time for animations.

This is called every frame.

Parameters:
dt Time since last advance call

Reimplemented from ShapeBase.

void RigidShape::disableCollision (  )  [virtual]

Disables collisions for this shape.

Reimplemented from SceneObject.

void RigidShape::enableCollision (  )  [virtual]

Enables collisions for this shape.

Reimplemented from SceneObject.

Point3F RigidShape::getVelocity (  )  const [virtual]

Returns the velocity of the shape.

Reimplemented from SceneObject.

void RigidShape::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 RigidShape::reset (  ) 

void RigidShape::freezeSim ( bool  frozen  ) 

void RigidShape::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 RigidShape::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 RigidShape::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 RigidShape::getCameraTransform ( F32 pos,
MatrixF mat 
) [virtual]

Gets the camera transform.

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

Reimplemented from ShapeBase.

U32 RigidShape::packUpdate ( NetConnection conn,
U32  mask,
BitStream stream 
) [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.

void RigidShape::unpackUpdate ( NetConnection conn,
BitStream stream 
) [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.

RigidShape::DECLARE_CONOBJECT ( RigidShape   ) 


Member Data Documentation

Datablock.

Reimplemented from ShapeBase.

Number of ticks to predict.

3rd person camera

int RigidShape::restCount [protected]

ParticleEmitter* RigidShape::mDustEmitterList[RigidShapeData::VC_NUM_DUST_EMITTERS] [protected]

ParticleEmitter* RigidShape::mSplashEmitterList[RigidShapeData::VC_NUM_SPLASH_EMITTERS] [protected]