Planeshift
Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes

psLinearMovement Class Reference

Movement related class. More...

#include <linmove.h>

List of all members.

Public Member Functions

virtual void AddVelocity (const csVector3 &vel)
 Adds on a velocity to this body in world coordinates.
virtual void ClearPortalDisplacement ()
 Clear the total displacement caused by space warping portals.
virtual void ClearWorldVelocity ()
 Resets the velocity of this body in world coordinates.
virtual csTicks ClientTimeDiff ()
virtual int ExtrapolatePosition (float delta)
 This function actually moves and rotates the mesh, relighting if necessary.
virtual const csVector3 GetAngularVelocity () const
 Get the current angular velocity vector.
virtual void GetAngularVelocity (csVector3 &v) const
virtual void GetCDDimensions (csVector3 &body, csVector3 &legs, csVector3 &shift)
virtual void GetDRData (bool &on_ground, csVector3 &pos, float &yrot, iSector *&sector, csVector3 &vel, csVector3 &worldVel, float &ang_vel)
 Return all necessary data for Dead Reckoning.
const csVector3 GetFullPosition () const
virtual float GetGravity ()
virtual void GetLastClientPosition (csVector3 &pos, float &yrot, iSector *&sector)
virtual void GetLastFullPosition (csVector3 &pos, float &yrot, iSector *&sector)
virtual void GetLastPosition (csVector3 &pos, float &yrot, iSector *&sector) const
virtual csVector3 GetPortalDisplacement ()
 Get the total displacement caused by space warping portals.
const csVector3 GetPosition () const
virtual iSector * GetSector () const
virtual const csVector3 GetVelocity () const
virtual void GetVelocity (csVector3 &v) const
virtual float GetYRotation () const
virtual bool InitCD (const csVector3 &body, const csVector3 &legs, const csVector3 &shift, iMeshWrapper *mesh)
virtual bool IsOnGround () const
virtual bool IsPath () const
 psLinearMovement (iObjectRegistry *object_reg)
virtual void ResetGravity ()
virtual bool RotateV (float delta)
virtual void SetAngularVelocity (const csVector3 &angle, const csVector3 &angle_to_reach)
virtual void SetAngularVelocity (const csVector3 &angle)
virtual void SetDeltaLimit (float deltaLimit)
virtual void SetDRData (bool on_ground, csVector3 &pos, float yrot, iSector *sector, csVector3 &vel, csVector3 &worldVel, float ang_vel)
 Sets all relevant dead reckoning data on this entity.
virtual void SetFullPosition (const char *center_name, float yrot, iSector *sector)
virtual void SetFullPosition (const csVector3 &pos, float yrot, const iSector *sector)
virtual void SetGravity (float grav)
virtual void SetHugGround (bool hugGround)
 Set if pcmesh should be transformed to follow the contour of the ground.
virtual void SetOnGround (bool onground)
virtual void SetPath (iPath *newpath)
 This function lets linmove store a ref to the supplied iPath.
virtual void SetPathAction (int which, const char *action)
 This relates a particular action name to be used between two points in the path.
virtual void SetPathSector (const char *sectorname)
 This sets the sector which will be used for the entire path.
virtual void SetPathSpeed (float speed)
 This relates the movement of the entity along the path to the time values specified by the path.
virtual void SetPathTime (float timeval)
 This function sets the current position on the path for use when time deltas are added later.
virtual void SetPosition (const char *center_name, float yrot, iSector *sector)
virtual void SetPosition (const csVector3 &pos, float yrot, const iSector *sector)
void SetScale (float set_scale)
virtual void SetSoftDRData (bool on_ground, csVector3 &pos, float yrot, iSector *sector, csVector3 &vel, csVector3 &worldVel, float ang_vel)
 Sets dead reckoning data with 'soft' position updating.
virtual void SetVelocity (const csVector3 &vel)
 Sets a velocity for this body in body coordinates.
virtual void SetYRotation (float yrot)
void StackTrace (const char *error)
 Procedure used to dump stack in error situations.
virtual void TickEveryFrame ()
virtual csTicks TimeDiff (void)
 Returns the difference in time between now and when the last DR update or extrapolation took place.
virtual void UpdateDR (csTicks delta)
 This function calls ExtrapolatePosition with a certain time delta or calculates the delta relative to the last update.
virtual void UpdateDR ()
virtual void UpdateDRDelta (csTicks ticksdelta)
 This function calls ExtrapolatePosition with a certain time but uses a fixed delta.
void UseCD (bool cd)
virtual ~psLinearMovement ()

Protected Member Functions

int FindSectors (const csVector3 &pos, float size, iSector **sectors)
void HugGround (const csVector3 &pos, iSector *sector)
 Transform pcmesh so that it follows the curvature of the ground at pos (sector)
int MoveSprite (float delta)
int MoveV (float delta)
void OffsetSprite (float delta)

Protected Attributes

float angDelta
csVector3 angleToReach
bool angleToReachFlag
csVector3 angularVelocity
csVector3 bottomSize
csBox3 boundingBox
csRef< iCollideSystem > cdsys
psCollisionDetectioncolldet
float deltaLimit
csRef< iEngine > engine
float gravity
 Speed affects all aspects of movement, including gravity.
bool hugGround
 Should the model be tilted so it's aligned with the ground.
csVector3 intervalSize
 Maximum interval at which to perform CD.
csTicks lastClientDRUpdate
csVector3 lastClientPosition
iSector * lastClientSector
float lastClientYrot
csTicks lastDRUpdate
csRef< iMeshWrapper > mesh
iObjectRegistry * object_reg
csVector3 offset_err
 Error in terms of absolute position.
csVector3 offset_rate
 Speed to bring error to ZERO within 1s.
csRef< iPath > path
csStringArray path_actions
csString path_sector
bool path_sent
float path_speed
float path_time
csVector3 portalDisplaced
 The total change in displacement caused by space warping portals.
float scale
csVector3 shift
bool stationary
csVector3 topSize
csRef< iVirtualClock > vc
csVector3 velBody
csVector3 velWorld
float xRot
float zRot

Static Protected Attributes

static int num_our_cd
static csCollisionPair our_cd_contact [1000]

Detailed Description

Movement related class.

This class handles everything related to moving, from collision detection to dead reckoning and actual entity movement.

Definition at line 68 of file linmove.h.


Constructor & Destructor Documentation

psLinearMovement::psLinearMovement ( iObjectRegistry *  object_reg)
virtual psLinearMovement::~psLinearMovement ( ) [virtual]

Member Function Documentation

virtual void psLinearMovement::AddVelocity ( const csVector3 &  vel) [virtual]

Adds on a velocity to this body in world coordinates.

virtual void psLinearMovement::ClearPortalDisplacement ( ) [virtual]

Clear the total displacement caused by space warping portals.

virtual void psLinearMovement::ClearWorldVelocity ( ) [virtual]

Resets the velocity of this body in world coordinates.

virtual csTicks psLinearMovement::ClientTimeDiff ( ) [inline, virtual]

Definition at line 143 of file linmove.h.

virtual int psLinearMovement::ExtrapolatePosition ( float  delta) [virtual]

This function actually moves and rotates the mesh, relighting if necessary.

int psLinearMovement::FindSectors ( const csVector3 &  pos,
float  size,
iSector **  sectors 
) [protected]
virtual const csVector3 psLinearMovement::GetAngularVelocity ( ) const [virtual]

Get the current angular velocity vector.

virtual void psLinearMovement::GetAngularVelocity ( csVector3 &  v) const [virtual]
virtual void psLinearMovement::GetCDDimensions ( csVector3 &  body,
csVector3 &  legs,
csVector3 &  shift 
) [virtual]
virtual void psLinearMovement::GetDRData ( bool &  on_ground,
csVector3 &  pos,
float yrot,
iSector *&  sector,
csVector3 &  vel,
csVector3 &  worldVel,
float ang_vel 
) [virtual]

Return all necessary data for Dead Reckoning.

const csVector3 psLinearMovement::GetFullPosition ( ) const
virtual float psLinearMovement::GetGravity ( ) [virtual]
virtual void psLinearMovement::GetLastClientPosition ( csVector3 &  pos,
float yrot,
iSector *&  sector 
) [virtual]
virtual void psLinearMovement::GetLastFullPosition ( csVector3 &  pos,
float yrot,
iSector *&  sector 
) [virtual]
virtual void psLinearMovement::GetLastPosition ( csVector3 &  pos,
float yrot,
iSector *&  sector 
) const [virtual]
virtual csVector3 psLinearMovement::GetPortalDisplacement ( ) [virtual]

Get the total displacement caused by space warping portals.

const csVector3 psLinearMovement::GetPosition ( ) const
virtual iSector* psLinearMovement::GetSector ( ) const [virtual]
virtual void psLinearMovement::GetVelocity ( csVector3 &  v) const [virtual]
virtual const csVector3 psLinearMovement::GetVelocity ( ) const [virtual]
virtual float psLinearMovement::GetYRotation ( ) const [virtual]
void psLinearMovement::HugGround ( const csVector3 &  pos,
iSector *  sector 
) [protected]

Transform pcmesh so that it follows the curvature of the ground at pos (sector)

virtual bool psLinearMovement::InitCD ( const csVector3 &  body,
const csVector3 &  legs,
const csVector3 &  shift,
iMeshWrapper *  mesh 
) [virtual]
virtual bool psLinearMovement::IsOnGround ( ) const [virtual]
virtual bool psLinearMovement::IsPath ( ) const [virtual]
int psLinearMovement::MoveSprite ( float  delta) [protected]
int psLinearMovement::MoveV ( float  delta) [protected]
void psLinearMovement::OffsetSprite ( float  delta) [protected]
virtual void psLinearMovement::ResetGravity ( ) [virtual]
virtual bool psLinearMovement::RotateV ( float  delta) [virtual]
virtual void psLinearMovement::SetAngularVelocity ( const csVector3 &  angle,
const csVector3 &  angle_to_reach 
) [virtual]
virtual void psLinearMovement::SetAngularVelocity ( const csVector3 &  angle) [virtual]
virtual void psLinearMovement::SetDeltaLimit ( float  deltaLimit) [virtual]
virtual void psLinearMovement::SetDRData ( bool  on_ground,
csVector3 &  pos,
float  yrot,
iSector *  sector,
csVector3 &  vel,
csVector3 &  worldVel,
float  ang_vel 
) [virtual]

Sets all relevant dead reckoning data on this entity.

virtual void psLinearMovement::SetFullPosition ( const csVector3 &  pos,
float  yrot,
const iSector *  sector 
) [virtual]
virtual void psLinearMovement::SetFullPosition ( const char *  center_name,
float  yrot,
iSector *  sector 
) [virtual]
virtual void psLinearMovement::SetGravity ( float  grav) [virtual]
virtual void psLinearMovement::SetHugGround ( bool  hugGround) [virtual]

Set if pcmesh should be transformed to follow the contour of the ground.

virtual void psLinearMovement::SetOnGround ( bool  onground) [virtual]
virtual void psLinearMovement::SetPath ( iPath *  newpath) [virtual]

This function lets linmove store a ref to the supplied iPath.

If this path is present, it will be used for movement instead of linear velocity vector.

virtual void psLinearMovement::SetPathAction ( int  which,
const char *  action 
) [virtual]

This relates a particular action name to be used between two points in the path.

This allows linmove to automatically switch a bird from "fly" to "glide", for example, during downward segments of the flight path.

virtual void psLinearMovement::SetPathSector ( const char *  sectorname) [virtual]

This sets the sector which will be used for the entire path.

virtual void psLinearMovement::SetPathSpeed ( float  speed) [virtual]

This relates the movement of the entity along the path to the time values specified by the path.

Speed=0 makes the entity stationary. Speed=1 is normal traversal of the path.

virtual void psLinearMovement::SetPathTime ( float  timeval) [virtual]

This function sets the current position on the path for use when time deltas are added later.

virtual void psLinearMovement::SetPosition ( const csVector3 &  pos,
float  yrot,
const iSector *  sector 
) [virtual]
virtual void psLinearMovement::SetPosition ( const char *  center_name,
float  yrot,
iSector *  sector 
) [virtual]
void psLinearMovement::SetScale ( float  set_scale) [inline]

Definition at line 107 of file linmove.h.

virtual void psLinearMovement::SetSoftDRData ( bool  on_ground,
csVector3 &  pos,
float  yrot,
iSector *  sector,
csVector3 &  vel,
csVector3 &  worldVel,
float  ang_vel 
) [virtual]

Sets dead reckoning data with 'soft' position updating.

Rather than immediately set the new position, the difference between the current position and the new position is put into a position error variable. Over a 1-second interval the MoveV routine will offset the position so that the position error becomes zero.

virtual void psLinearMovement::SetVelocity ( const csVector3 &  vel) [virtual]

Sets a velocity for this body in body coordinates.

virtual void psLinearMovement::SetYRotation ( float  yrot) [virtual]
void psLinearMovement::StackTrace ( const char *  error)

Procedure used to dump stack in error situations.

virtual void psLinearMovement::TickEveryFrame ( ) [virtual]
virtual csTicks psLinearMovement::TimeDiff ( void  ) [virtual]

Returns the difference in time between now and when the last DR update or extrapolation took place.

virtual void psLinearMovement::UpdateDR ( csTicks  delta) [virtual]

This function calls ExtrapolatePosition with a certain time delta or calculates the delta relative to the last update.

This allows all entities linmoves to be synchronized to the same ticks, even if updates are all happening at different times.

virtual void psLinearMovement::UpdateDR ( ) [virtual]
virtual void psLinearMovement::UpdateDRDelta ( csTicks  ticksdelta) [virtual]

This function calls ExtrapolatePosition with a certain time but uses a fixed delta.

This allows all entities linmoves to be synchronized to the same ticks, even if updates are all happening at different times.

void psLinearMovement::UseCD ( bool  cd)

Member Data Documentation

Definition at line 282 of file linmove.h.

csVector3 psLinearMovement::angleToReach [protected]

Definition at line 289 of file linmove.h.

Definition at line 290 of file linmove.h.

csVector3 psLinearMovement::angularVelocity [protected]

Definition at line 288 of file linmove.h.

csVector3 psLinearMovement::bottomSize [protected]

Definition at line 314 of file linmove.h.

csBox3 psLinearMovement::boundingBox [protected]

Definition at line 316 of file linmove.h.

csRef<iCollideSystem> psLinearMovement::cdsys [protected]

Definition at line 279 of file linmove.h.

Definition at line 275 of file linmove.h.

Definition at line 329 of file linmove.h.

csRef<iEngine> psLinearMovement::engine [protected]

Definition at line 277 of file linmove.h.

Speed affects all aspects of movement, including gravity.

It's effectively a comparative rate of "time"

Definition at line 286 of file linmove.h.

bool psLinearMovement::hugGround [protected]

Should the model be tilted so it's aligned with the ground.

Definition at line 296 of file linmove.h.

csVector3 psLinearMovement::intervalSize [protected]

Maximum interval at which to perform CD.

Definition at line 322 of file linmove.h.

Definition at line 325 of file linmove.h.

csVector3 psLinearMovement::lastClientPosition [protected]

Definition at line 326 of file linmove.h.

iSector* psLinearMovement::lastClientSector [protected]

Definition at line 328 of file linmove.h.

Definition at line 327 of file linmove.h.

csTicks psLinearMovement::lastDRUpdate [protected]

Definition at line 324 of file linmove.h.

csRef<iMeshWrapper> psLinearMovement::mesh [protected]

Definition at line 274 of file linmove.h.

int psLinearMovement::num_our_cd [static, protected]

Definition at line 270 of file linmove.h.

iObjectRegistry* psLinearMovement::object_reg [protected]

Definition at line 272 of file linmove.h.

csVector3 psLinearMovement::offset_err [protected]

Error in terms of absolute position.

Definition at line 332 of file linmove.h.

csVector3 psLinearMovement::offset_rate [protected]

Speed to bring error to ZERO within 1s.

Definition at line 333 of file linmove.h.

csCollisionPair psLinearMovement::our_cd_contact[1000] [static, protected]

Definition at line 269 of file linmove.h.

csRef<iPath> psLinearMovement::path [protected]

Definition at line 304 of file linmove.h.

csStringArray psLinearMovement::path_actions [protected]

Definition at line 306 of file linmove.h.

csString psLinearMovement::path_sector [protected]

Definition at line 308 of file linmove.h.

bool psLinearMovement::path_sent [protected]

Definition at line 307 of file linmove.h.

Definition at line 305 of file linmove.h.

Definition at line 305 of file linmove.h.

csVector3 psLinearMovement::portalDisplaced [protected]

The total change in displacement caused by space warping portals.

Definition at line 319 of file linmove.h.

Definition at line 301 of file linmove.h.

csVector3 psLinearMovement::shift [protected]

Definition at line 311 of file linmove.h.

bool psLinearMovement::stationary [protected]

Definition at line 283 of file linmove.h.

csVector3 psLinearMovement::topSize [protected]

Definition at line 312 of file linmove.h.

csRef<iVirtualClock> psLinearMovement::vc [protected]

Definition at line 278 of file linmove.h.

csVector3 psLinearMovement::velBody [protected]

Definition at line 291 of file linmove.h.

csVector3 psLinearMovement::velWorld [protected]

Definition at line 293 of file linmove.h.

Definition at line 298 of file linmove.h.

Definition at line 299 of file linmove.h.


The documentation for this class was generated from the following file: