Represents an entity's position in the world (plus its orientation). More...
#include <ICmpPosition.h>
Public Member Functions | |
| virtual bool | IsInWorld ()=0 |
| Returns true if the entity currently exists at a defined position in the world. | |
| virtual void | MoveOutOfWorld ()=0 |
| Causes IsInWorld to return false. | |
| virtual void | MoveTo (entity_pos_t x, entity_pos_t z)=0 |
| Move smoothly to the given location. | |
| virtual void | JumpTo (entity_pos_t x, entity_pos_t z)=0 |
| Move immediately to the given location, with no interpolation. | |
| virtual void | SetHeightOffset (entity_pos_t dy)=0 |
| Set the vertical offset above the terrain/water surface. | |
| virtual entity_pos_t | GetHeightOffset ()=0 |
| Returns the current vertical offset above the terrain/water surface. | |
| virtual void | SetHeightFixed (entity_pos_t y)=0 |
| Set the vertical position as a fixed, absolute value. | |
| virtual bool | IsFloating ()=0 |
| Returns whether the entity floats on water. | |
| virtual CFixedVector3D | GetPosition ()=0 |
| Returns the current x,y,z position (no interpolation). | |
| virtual CFixedVector2D | GetPosition2D ()=0 |
| Returns the current x,z position (no interpolation). | |
| virtual void | TurnTo (entity_angle_t y)=0 |
| Rotate smoothly to the given angle around the upwards axis. | |
| virtual void | SetYRotation (entity_angle_t y)=0 |
| Rotate immediately to the given angle around the upwards axis. | |
| virtual void | SetXZRotation (entity_angle_t x, entity_angle_t z)=0 |
| Rotate immediately to the given angles around the X (pitch) and Z (roll) axes. | |
| virtual CFixedVector3D | GetRotation ()=0 |
| Returns the current rotation (relative to the upwards axis), as Euler angles with X=pitch, Y=yaw, Z=roll. | |
| virtual fixed | GetDistanceTravelled ()=0 |
| Returns the distance that the unit will be interpolated over, i.e. | |
| virtual void | GetInterpolatedPosition2D (float frameOffset, float &x, float &z, float &rotY)=0 |
| Get the current interpolated 2D position and orientation, for rendering. | |
| virtual CMatrix3D | GetInterpolatedTransform (float frameOffset, bool forceFloating)=0 |
| Get the current interpolated transform matrix, for rendering. | |
Represents an entity's position in the world (plus its orientation).
Entity positions are determined by the following:
Orientations consist of the following:
Entities can also be 'outside the world' (e.g. hidden inside a building), in which case they have no position. Callers must check the entity is in the world, before querying its position.
| virtual fixed ICmpPosition::GetDistanceTravelled | ( | ) | [pure virtual] |
Returns the distance that the unit will be interpolated over, i.e.
the distance travelled since the start of the turn.
Implemented in CCmpPosition.
| virtual entity_pos_t ICmpPosition::GetHeightOffset | ( | ) | [pure virtual] |
Returns the current vertical offset above the terrain/water surface.
Implemented in CCmpPosition.
| virtual void ICmpPosition::GetInterpolatedPosition2D | ( | float | frameOffset, | |
| float & | x, | |||
| float & | z, | |||
| float & | rotY | |||
| ) | [pure virtual] |
Get the current interpolated 2D position and orientation, for rendering.
Must not be called unless IsInWorld is true.
Implemented in CCmpPosition.
| virtual CMatrix3D ICmpPosition::GetInterpolatedTransform | ( | float | frameOffset, | |
| bool | forceFloating | |||
| ) | [pure virtual] |
Get the current interpolated transform matrix, for rendering.
Must not be called unless IsInWorld is true.
Implemented in CCmpPosition.
| virtual CFixedVector3D ICmpPosition::GetPosition | ( | ) | [pure virtual] |
Returns the current x,y,z position (no interpolation).
Depends on the current terrain heightmap. Must not be called unless IsInWorld is true.
Implemented in CCmpPosition.
| virtual CFixedVector2D ICmpPosition::GetPosition2D | ( | ) | [pure virtual] |
Returns the current x,z position (no interpolation).
Must not be called unless IsInWorld is true.
Implemented in CCmpPosition.
| virtual CFixedVector3D ICmpPosition::GetRotation | ( | ) | [pure virtual] |
Returns the current rotation (relative to the upwards axis), as Euler angles with X=pitch, Y=yaw, Z=roll.
(TODO: is that the right way round?)
Implemented in CCmpPosition.
| virtual bool ICmpPosition::IsFloating | ( | ) | [pure virtual] |
Returns whether the entity floats on water.
Implemented in CCmpPosition.
| virtual bool ICmpPosition::IsInWorld | ( | ) | [pure virtual] |
Returns true if the entity currently exists at a defined position in the world.
Implemented in CCmpPosition.
| virtual void ICmpPosition::JumpTo | ( | entity_pos_t | x, | |
| entity_pos_t | z | |||
| ) | [pure virtual] |
Move immediately to the given location, with no interpolation.
Implemented in CCmpPosition.
| virtual void ICmpPosition::MoveOutOfWorld | ( | ) | [pure virtual] |
Causes IsInWorld to return false.
(Use MoveTo() or JumpTo() to move back into the world.)
Implemented in CCmpPosition.
| virtual void ICmpPosition::MoveTo | ( | entity_pos_t | x, | |
| entity_pos_t | z | |||
| ) | [pure virtual] |
Move smoothly to the given location.
Implemented in CCmpPosition.
| virtual void ICmpPosition::SetHeightFixed | ( | entity_pos_t | y | ) | [pure virtual] |
Set the vertical position as a fixed, absolute value.
Will stay at this height until the next call to SetHeightFixed or SetHeightOffset.
Implemented in CCmpPosition.
| virtual void ICmpPosition::SetHeightOffset | ( | entity_pos_t | dy | ) | [pure virtual] |
Set the vertical offset above the terrain/water surface.
Implemented in CCmpPosition.
| virtual void ICmpPosition::SetXZRotation | ( | entity_angle_t | x, | |
| entity_angle_t | z | |||
| ) | [pure virtual] |
Rotate immediately to the given angles around the X (pitch) and Z (roll) axes.
| x | radians around the X axis. (TODO: in which direction?) | |
| z | radians around the Z axis. |
Implemented in CCmpPosition.
| virtual void ICmpPosition::SetYRotation | ( | entity_angle_t | y | ) | [pure virtual] |
Rotate immediately to the given angle around the upwards axis.
| y | clockwise radians from the +Z axis. |
Implemented in CCmpPosition.
| virtual void ICmpPosition::TurnTo | ( | entity_angle_t | y | ) | [pure virtual] |
Rotate smoothly to the given angle around the upwards axis.
| y | clockwise radians from the +Z axis. |
Implemented in CCmpPosition.
1.6.3