26 #ifndef __CEL_PF_LINEAR_MOVE_FACT__ 27 #define __CEL_PF_LINEAR_MOVE_FACT__ 31 #include "iutil/comp.h" 32 #include "iutil/eventh.h" 33 #include "csutil/scf.h" 34 #include "csutil/stringarray.h" 35 #include "cstool/collider.h" 36 #include "ivaria/collider.h" 37 #include "csutil/sysfunc.h" 40 #define PS_LINMOVE_FOLLOW_ONLY_PORTALS true 42 #define PS_MOVE_FAIL 0 43 #define PS_MOVE_SUCCEED 1 44 #define PS_MOVE_PARTIAL 2 45 #define PS_MOVE_DONTMOVE 3 47 struct iObjectRegistry;
50 struct iCollideSystem;
52 class csReversibleTransform;
54 class csColliderWrapper;
60 #define PSLINEARMOVEMENT_DRDELTA 0.2 75 virtual void SetAngularVelocity(
const csVector3 &angle,
const csVector3 &angle_to_reach);
91 virtual bool RotateV(
float delta);
99 virtual bool InitCD(
const csVector3 &body,
const csVector3 &legs,
const csVector3 &
shift, iMeshWrapper*
mesh);
100 virtual void GetCDDimensions(csVector3 &body, csVector3 &legs, csVector3 &shift);
112 virtual void GetLastPosition(csVector3 &pos,
float &yrot, iSector* §or)
const;
114 virtual void SetPosition(
const csVector3 &pos,
float yrot,
const iSector* sector);
115 virtual void SetFullPosition(
const csVector3 &pos,
float yrot,
const iSector* sector);
116 virtual void SetPosition(
const char* center_name,
float yrot, iSector* sector);
117 virtual void SetFullPosition(
const char* center_name,
float yrot, iSector* sector);
134 virtual bool IsPath()
const;
149 virtual void GetDRData(
bool &on_ground, csVector3 &pos,
150 float &yrot, iSector* §or, csVector3 &vel, csVector3 &worldVel,
154 virtual void SetDRData(
bool on_ground, csVector3 &pos,
155 float yrot, iSector* sector, csVector3 &vel, csVector3 &worldVel,
167 float yrot, iSector* sector, csVector3 &vel, csVector3 &worldVel,
194 virtual void UpdateDR(csTicks delta);
202 virtual void SetPath(iPath* newpath);
254 int MoveV(
float delta);
262 void HugGround(
const csVector3 &pos, iSector* sector);
266 int FindSectors(
const csVector3 &pos,
float size, iSector** sectors);
278 csRef<iVirtualClock>
vc;
virtual void SetPathTime(float timeval)
This function sets the current position on the path for use when time deltas are added later...
csVector3 portalDisplaced
The total change in displacement caused by space warping portals.
virtual void GetLastClientPosition(csVector3 &pos, float &yrot, iSector *§or)
csVector3 offset_rate
Speed to bring error to ZERO within 1s.
csVector3 angularVelocity
csVector3 offset_err
Error in terms of absolute position.
virtual void GetLastPosition(csVector3 &pos, float &yrot, iSector *§or) const
virtual void SetAngularVelocity(const csVector3 &angle)
void StackTrace(const char *error)
Procedure used to dump stack in error situations.
iSector * lastClientSector
virtual void SetDeltaLimit(float deltaLimit)
virtual bool IsOnGround() const
int MoveSprite(float delta)
virtual void SetPosition(const csVector3 &pos, float yrot, const iSector *sector)
virtual iSector * GetSector() const
virtual void GetDRData(bool &on_ground, csVector3 &pos, float &yrot, iSector *§or, csVector3 &vel, csVector3 &worldVel, float &ang_vel)
Return all necessary data for Dead Reckoning.
csVector3 intervalSize
Maximum interval at which to perform CD.
virtual void UpdateDRDelta(csTicks ticksdelta)
This function calls ExtrapolatePosition with a certain time but uses a fixed delta.
bool hugGround
Should the model be tilted so it's aligned with the ground.
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.
float gravity
Speed affects all aspects of movement, including gravity.
virtual void SetYRotation(float yrot)
virtual void TickEveryFrame()
csRef< iCollideSystem > cdsys
psLinearMovement(iObjectRegistry *object_reg)
virtual csTicks TimeDiff(void)
Returns the difference in time between now and when the last DR update or extrapolation took place...
csRef< iVirtualClock > vc
virtual void AddVelocity(const csVector3 &vel)
Adds on a velocity to this body in world coordinates.
Collision Detection (CD) related class.
virtual void SetGravity(float grav)
virtual void SetFullPosition(const csVector3 &pos, float yrot, const iSector *sector)
csTicks lastClientDRUpdate
psCollisionDetection * colldet
const csVector3 GetPosition() const
virtual csTicks ClientTimeDiff()
const csVector3 GetFullPosition() const
virtual ~psLinearMovement()
virtual void SetOnGround(bool onground)
csRef< iMeshWrapper > mesh
virtual int ExtrapolatePosition(float delta)
This function actually moves and rotates the mesh, relighting if necessary.
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 float GetYRotation() const
void OffsetSprite(float delta)
virtual void SetVelocity(const csVector3 &vel)
Sets a velocity for this body in body coordinates.
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)
iObjectRegistry * object_reg
virtual float GetGravity()
virtual csVector3 GetPortalDisplacement()
Get the total displacement caused by space warping portals.
virtual void ResetGravity()
virtual void ClearPortalDisplacement()
Clear the total displacement caused by space warping portals.
csStringArray path_actions
virtual void SetHugGround(bool hugGround)
Set if pcmesh should be transformed to follow the contour of the ground.
virtual void SetPath(iPath *newpath)
This function lets linmove store a ref to the supplied iPath.
csVector3 lastClientPosition
virtual bool InitCD(const csVector3 &body, const csVector3 &legs, const csVector3 &shift, iMeshWrapper *mesh)
virtual const csVector3 GetVelocity() const
virtual bool RotateV(float delta)
virtual void GetCDDimensions(csVector3 &body, csVector3 &legs, csVector3 &shift)
virtual const csVector3 GetAngularVelocity() const
Get the current angular velocity vector.
virtual bool IsPath() const
virtual void ClearWorldVelocity()
Resets the velocity of this body in world coordinates.
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 GetLastFullPosition(csVector3 &pos, float &yrot, iSector *§or)
virtual void SetPathAction(int which, const char *action)
This relates a particular action name to be used between two points in the path.
void SetScale(float set_scale)
static csCollisionPair our_cd_contact[1000]