## Public API Reference

- Main Page
- Classes
- Files

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# iPcLinearMovement Struct Reference

This property class controls movement of an entity in a realistic manner. More...

`#include <propclass/linmove.h>`

List of all members.

## Public Member Functions

virtual void | AddGravityCallback (iPcGravityCallback *callback)=0
| Shedules a callback when gravity has grasped an object and is dragging it down.
virtual void | AddVelocity (const csVector3 &vel)=0
| Exerts a velocity on the body in world coordinates.
virtual void | ClearPortalDisplacement ()=0
| Clear the total displacement caused by space warping portals.
virtual void | ClearWorldVelocity ()=0
| Resets the velocity of this body in world coordinates.
virtual void | ExtrapolatePosition (float delta)=0
| This function actually moves and rotates the mesh, relighting if necessary.
virtual iPcMesh * | GetAnchor () const =0
| Get the current anchor or 0 if movement is not anchored.
virtual void | GetAngularVelocity (csVector3 &v) const =0
| Get the current angular velocity vector.
virtual void | GetCDDimensions (csVector3 &body, csVector3 &legs, csVector3 &shift, iPcCollisionDetection *&pc_cd)=0
| Get CD box for the object.
virtual void | GetDRData (bool &on_ground, float &speed, csVector3 &pos, float &yrot, iSector *&sector, csVector3 &vel, csVector3 &worldVel, float &ang_vel)=0
| Return all necessary data for Dead Reckoning.
virtual void | GetLastFullPosition (csVector3 &pos, float &yrot, iSector *&sector)=0
| Get full position and sector.
virtual void | GetLastPosition (csVector3 &pos, float &yrot, iSector *&sector)=0
| Get position and sector.
virtual csVector3 | GetPortalDisplacement ()=0
| Get the total displacement caused by space warping portals.
virtual iSector * | GetSector ()=0
| Get sector.
virtual void | GetVelocity (csVector3 &v) const =0
| Get the current velocity vector.
virtual bool | InitCD (iPcCollisionDetection *pc_cd=0)=0
| Initialize CD again?@@.
virtual bool | InitCD (const csVector3 &body, const csVector3 &legs, const csVector3 &shift, iPcCollisionDetection *pc_cd=0)=0
| Initialize CD box for the object.
virtual bool | InitCD (iMeshWrapper *mesh, float percentage, iPcCollisionDetection *pc_cd=0)=0
| Initialize CD box for the object from a mesh.
virtual bool | IsPath () const =0
| Is a csPath active now or standard DR movement?
virtual void | RemoveGravityCallback (iPcGravityCallback *callback)=0
| Remove a gravity callback.
virtual void | SetAnchor (iPcMesh *pcmesh)=0
| Set an anchor for this movement class.
virtual void | SetAngularVelocity (const csVector3 &angle, const csVector3 &angle_to_reach)=0
| Set the orientation of the mesh with three given euler angles with a maximum to reached.
virtual void | SetAngularVelocity (const csVector3 &angle)=0
| Set the orientation of the mesh with three given euler angles.
virtual void | SetDRData (bool on_ground, float speed, csVector3 &pos, float yrot, iSector *sector, csVector3 &vel, csVector3 &worldVel, float ang_vel)=0
| Sets all relevant dead reckoning data on this entity.
virtual void | SetFullPosition (const char *center_name, float yrot, iSector *sector)=0
| Set full position and sector.
virtual void | SetFullPosition (const csVector3 &pos, float yrot, const iSector *sector)=0
| Set full position and sector.
virtual void | SetHugGround (bool hugGround)=0
| Set if pcmesh should be transformed to follow the contour of the ground.
virtual void | SetPath (iPath *newpath)=0
| This function lets linmove store a ref to the supplied iPath.
virtual void | SetPathAction (int which, const char *action)=0
| This relates a particular action name to be used between two points in the path.
virtual void | SetPathSector (const char *sectorname)=0
| This sets the sector which will be used for the entire path.
virtual void | SetPathSpeed (float speed)=0
| This relates the movement of the entity along the path to the time values specified by the path.
virtual void | SetPathTime (float timeval)=0
| 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)=0
| Set position and sector.
virtual void | SetPosition (const csVector3 &pos, float yrot, const iSector *sector)=0
| Set position and sector.
virtual void | SetSoftDRData (bool on_ground, float speed, csVector3 &pos, float yrot, iSector *sector, csVector3 &vel, csVector3 &worldVel, float ang_vel)=0
| Sets dead reckoning data in a 'soft' way.
virtual void | SetSpeed (float speedZ)=0
| Set the current speed.
virtual void | SetVelocity (const csVector3 &vel)=0
| Set the current velocity vector in body coordinates.
virtual csTicks | TimeDiff (void)=0
| Returns the difference in time between now and when the last DR update or extrapolation took place.
virtual void | UpdateDR (csTicks ticks)=0
| This function calls ExtrapolatePosition with a certain time but calculates the delta relative to the last update, not a fixed delta.
virtual void | UpdateDRDelta (csTicks ticksdelta)=0
| This function calls ExtrapolatePosition with a certain time but uses a fixed delta.

## Detailed Description

This property class controls movement of an entity in a realistic manner.

It should be used in combination with iPcMesh but otherwise doesn't depend on any other property classes. So in that sense it is unrelated to the other movement property classes.

This property class supports dead reckoning which is useful for networking.

This property class supports the following actions (add prefix 'cel.action.' to get the ID of the action and add prefix 'cel.parameter.' to get the ID of the parameter):

- InitCD: parameters 'body' (vector3), 'legs' (vector3), and 'offset' (vector3).
- InitCDMesh: parameters 'percentage' (float).
- SetPosition: parameters 'sector' (string), 'position' (vector3 or string (name of mapnode in that case)), and 'yrot' (y rotation degrees).

This property class supports the following properties (add prefix 'cel.property.' to get the ID of the property:

- anchor (string, read/write): name of the entity on which we are anchored.

Definition at line 88 of file linmove.h.

## Member Function Documentation

virtual void iPcLinearMovement::AddGravityCallback | ( | iPcGravityCallback * | callback | ) | `[pure virtual]`

Shedules a callback when gravity has grasped an object and is dragging it down.

I.e, calls when the object changes to negative Y velocity

Parameters:

  | callback | The callback object

virtual void iPcLinearMovement::AddVelocity | ( | const csVector3 & | vel | ) | `[pure virtual]`

| Exerts a velocity on the body in world coordinates.

virtual void iPcLinearMovement::ClearPortalDisplacement | ( |  | ) | `[pure virtual]`

| Clear the total displacement caused by space warping portals.

virtual void iPcLinearMovement::ClearWorldVelocity | ( |  | ) | `[pure virtual]`

| Resets the velocity of this body in world coordinates.

virtual void iPcLinearMovement::ExtrapolatePosition | ( | float | delta | ) | `[pure virtual]`

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

virtual iPcMesh* iPcLinearMovement::GetAnchor | ( |  | ) | const`[pure virtual]`

| Get the current anchor or 0 if movement is not anchored.

virtual void iPcLinearMovement::GetAngularVelocity | ( | csVector3 & | v | ) | const`[pure virtual]`

| Get the current angular velocity vector.

virtual void iPcLinearMovement::GetCDDimensions | ( | csVector3 & | body,
|  | csVector3 & | legs,
|  | csVector3 & | shift,
|  | iPcCollisionDetection *& | pc_cd
| ) | `[pure virtual]`

| Get CD box for the object.

virtual void iPcLinearMovement::GetDRData | ( | bool & | on_ground,
|  | float & | speed,
|  | csVector3 & | pos,
|  | float & | yrot,
|  | iSector *& | sector,
|  | csVector3 & | vel,
|  | csVector3 & | worldVel,
|  | float & | ang_vel
| ) | `[pure virtual]`

| Return all necessary data for Dead Reckoning.

virtual void iPcLinearMovement::GetLastFullPosition | ( | csVector3 & | pos,
|  | float & | yrot,
|  | iSector *& | sector
| ) | `[pure virtual]`

| Get full position and sector. This is an absolute position which is not relative to the anchor.

virtual void iPcLinearMovement::GetLastPosition | ( | csVector3 & | pos,
|  | float & | yrot,
|  | iSector *& | sector
| ) | `[pure virtual]`

| Get position and sector. If there is an anchor then this position is relative to the anchor. Use SetLastFullPosition() if you want an absolute position.

virtual csVector3 iPcLinearMovement::GetPortalDisplacement | ( |  | ) | `[pure virtual]`

| Get the total displacement caused by space warping portals.

virtual iSector* iPcLinearMovement::GetSector | ( |  | ) | `[pure virtual]`

| Get sector.

virtual void iPcLinearMovement::GetVelocity | ( | csVector3 & | v | ) | const`[pure virtual]`

| Get the current velocity vector.

virtual bool iPcLinearMovement::InitCD | ( | iPcCollisionDetection * | pc_cd = `0` | ) | `[pure virtual]`

| Initialize CD again?@@.

virtual bool iPcLinearMovement::InitCD | ( | const csVector3 & | body,
|  | const csVector3 & | legs,
|  | const csVector3 & | shift,
|  | iPcCollisionDetection * | pc_cd = `0`
| ) | `[pure virtual]`

| Initialize CD box for the object. The two parameters are the dimensions of the body and the legs collider boxes. The 'shift' vector is used to shift the box. By default (with shift equal to the 0 vector) the colliders are created assuming the 0,0,0 origin is at the bottom center of the actor.

virtual bool iPcLinearMovement::InitCD | ( | iMeshWrapper * | mesh,
|  | float | percentage,
|  | iPcCollisionDetection * | pc_cd = `0`
| ) | `[pure virtual]`

Initialize CD box for the object from a mesh.

Parameters:

  | mesh | is the mesh from which to calculate the entire box.
  | percentage | is a number between 0 and 100 indicating where the 'legs' collider stops and the 'body' collider starts. 0 means a very thin 'legs' collider and 100 a very thin 'body' collider.
  | pc_cd | is a pointer to the collision detection property class.

virtual bool iPcLinearMovement::IsPath | ( |  | ) | const`[pure virtual]`

| Is a csPath active now or standard DR movement?

virtual void iPcLinearMovement::RemoveGravityCallback | ( | iPcGravityCallback * | callback | ) | `[pure virtual]`

| Remove a gravity callback.

virtual void iPcLinearMovement::SetAnchor | ( | iPcMesh * | pcmesh | ) | `[pure virtual]`

| Set an anchor for this movement class. When this linmove is anchored it basically means that all movement will be done relative to the anchor. You can use this to do movement on an object that is also moving on its own. If 'pcmesh' is 0 this will clear the anchor.

virtual void iPcLinearMovement::SetAngularVelocity | ( | const csVector3 & | angle,
|  | const csVector3 & | angle_to_reach
| ) | `[pure virtual]`

| Set the orientation of the mesh with three given euler angles with a maximum to reached. It returns true if this maximum has has been reached.

virtual void iPcLinearMovement::SetAngularVelocity | ( | const csVector3 & | angle | ) | `[pure virtual]`

| Set the orientation of the mesh with three given euler angles.

virtual void iPcLinearMovement::SetDRData | ( | bool | on_ground,
|  | float | speed,
|  | csVector3 & | pos,
|  | float | yrot,
|  | iSector * | sector,
|  | csVector3 & | vel,
|  | csVector3 & | worldVel,
|  | float | ang_vel
| ) | `[pure virtual]`

| Sets all relevant dead reckoning data on this entity.

virtual void iPcLinearMovement::SetFullPosition | ( | const char * | center_name,
|  | float | yrot,
|  | iSector * | sector
| ) | `[pure virtual]`

| Set full position and sector. The position is absolute and will be corrected to fit on the anchor if there is one. Use node name as center.

virtual void iPcLinearMovement::SetFullPosition | ( | const csVector3 & | pos,
|  | float | yrot,
|  | const iSector * | sector
| ) | `[pure virtual]`

| Set full position and sector. The position is absolute and will be corrected to fit on the anchor if there is one.

virtual void iPcLinearMovement::SetHugGround | ( | bool | hugGround | ) | `[pure virtual]`

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

virtual void iPcLinearMovement::SetPath | ( | iPath * | newpath | ) | `[pure 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 iPcLinearMovement::SetPathAction | ( | int | which,
|  | const char * | action
| ) | `[pure 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 iPcLinearMovement::SetPathSector | ( | const char * | sectorname | ) | `[pure virtual]`

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

virtual void iPcLinearMovement::SetPathSpeed | ( | float | speed | ) | `[pure 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 iPcLinearMovement::SetPathTime | ( | float | timeval | ) | `[pure virtual]`

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

virtual void iPcLinearMovement::SetPosition | ( | const char * | center_name,
|  | float | yrot,
|  | iSector * | sector
| ) | `[pure virtual]`

| Set position and sector. The position is relative to the anchor (if there is one). Use node name as center.

virtual void iPcLinearMovement::SetPosition | ( | const csVector3 & | pos,
|  | float | yrot,
|  | const iSector * | sector
| ) | `[pure virtual]`

| Set position and sector. The position is relative to the anchor (if there is one).

virtual void iPcLinearMovement::SetSoftDRData | ( | bool | on_ground,
|  | float | speed,
|  | csVector3 & | pos,
|  | float | yrot,
|  | iSector * | sector,
|  | csVector3 & | vel,
|  | csVector3 & | worldVel,
|  | float | ang_vel
| ) | `[pure virtual]`

| Sets dead reckoning data in a 'soft' way. Instead of immediately setting the position, an error (offset) is measured between the current position and the new position. Over the period of 1 second, the position will be offset until this position error is zero.

virtual void iPcLinearMovement::SetSpeed | ( | float | speedZ | ) | `[pure virtual]`

| Set the current speed.

virtual void iPcLinearMovement::SetVelocity | ( | const csVector3 & | vel | ) | `[pure virtual]`

| Set the current velocity vector in body coordinates.

virtual csTicks iPcLinearMovement::TimeDiff | ( | void |  | ) | `[pure virtual]`

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

virtual void iPcLinearMovement::UpdateDR | ( | csTicks | ticks | ) | `[pure virtual]`

| This function calls ExtrapolatePosition with a certain time but calculates the delta relative to the last update, not a fixed delta. This allows all entities linmoves to be synchronized to the same ticks, even if updates are all happening at different times.

virtual void iPcLinearMovement::UpdateDRDelta | ( | csTicks | ticksdelta | ) | `[pure 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.

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

- propclass/linmove.h