CSpirit Class Reference

The class that represents a spirit in the CWorld system. A Spirit a cylinderic object that can move and jump like a player. I can also climb inclined surfaces and stairs. More...

#include <World.h>

Inheritance diagram for CSpirit:

CThing

List of all members.

Public Member Functions

 CSpirit (CWorld *world, float height, float radius, float climbheight, float maxclimbslope, float movespeed, float airspeedratio, float slidespeedratio)
 ~CSpirit ()
int Type ()
 Returns TYPE_CSPIRIT.
void SetPosition (const Vector3 &pos)
 Sets the position of the CSpirit.
void SetDirection (const Vector3 &direction)
void SetOrientation (const Quaternion &orient)
void SetAngularVelocity (const Vector3 &vel)
 This is meaningless for CSpirit. Overrides CThing::SetAngularVelocity.
void SetVelocity (const Vector3 &vel)
 Sets the velocity of the CSpirit.
Vector3 GetVelocity ()
 Retrieves the velocity of the CSpirit.
Vector3 GetAngularVelocity ()
 This is meaningless for CSpirit. Overrides CThing::GetAngularVelocity.
void ShowGeometry (bool show)
 Sets whether the show or hide the geometry mesh of the CSpirit.
void SetCollisionEnabled (bool collision)
 This is meaningless for CSpirit. For a CSpirit dynamics is always enabled. Overrides CThing::SetCollisionEnabled.
void SetDynamicsEnabled (bool dynamics)
 This is meaningless for CSpirit. For a CSpirit collision is always enabled. Overrides CThing::SetDynamicsEnabled.
void SetMass (float m)
 Overrides CThing::SetMass for CSpirit.
float GetMass ()
 Overrides CThing::GetMass for CSpirit.
void SetDensity (float m)
 Overrides CThing::SetDensity for CSpirit.
float GetDensity ()
 Overrides CThing::GetDensity for CSpirit.
const Vector3 & GetDirection ()
 Retrieves the looking direction of the CSpirit.
void Move (float forward, float left)
void Turn (float left_radians)
void Stop ()
 Stops the spirit by setting all movement factors.
bool IsOnGround ()
 Queries whether the spirit is on a surface and can walk.
void Jump (float speed)
int Serialize (void *dest)
int Deserialize (void *dest)
void GetMoveFactors (float *forward, float *left)


Detailed Description

The class that represents a spirit in the CWorld system. A Spirit a cylinderic object that can move and jump like a player. I can also climb inclined surfaces and stairs.

Constructor & Destructor Documentation

CSpirit::CSpirit ( CWorld world,
float  height,
float  radius,
float  climbheight,
float  maxclimbslope,
float  movespeed,
float  airspeedratio,
float  slidespeedratio 
)

Constructor. A spirit must never be created this way. CWorld::Use CreateSphere instead.

Parameters:
world The CWorld instance that this sphere will belong to.
other_parameters For other parameters see CWorld::CreateSpirit.

CSpirit::~CSpirit (  ) 

Destructor A spirit must never be destroyed this way. Use CWorld::RemoveThing instead.


Member Function Documentation

void CSpirit::SetDirection ( const Vector3 &  direction  ) 

Sets the direction of the CSpirit. This is a meaningful way to set orientation.

Parameters:
direction The direction vector that the spirit will look(local-x = direction). Should not have z component.
See also:
CSpirit::SetOrientation.

void CSpirit::SetOrientation ( const Quaternion &  orient  )  [virtual]

Sets the orientation of the CSpirit. The direction of the spirit must not have a z-component after setting the orientation.

See also:
CSpirit::SetDirection.

Reimplemented from CThing.

void CSpirit::Move ( float  forward,
float  left 
)

Increaese/decreases the movement of the spirit. Actual increase depends on move speed.

Parameters:
forward The velocity of the spirit increaes by a factor of forward (the actual increase is movespeed*forward) in the direction of the spirit.
left The velocity of the spirit increaes by a factor of left (the actual increase is movespeed*left) in the left direction of the spirit.

void CSpirit::Turn ( float  left_radians  ) 

Turns the spirit so changes its looking direction.

Parameters:
left_radians The amount of turn to the left expressed in radians.

void CSpirit::Jump ( float  speed  ) 

Increases the speed of the spirit in upwards direction if it is on the ground.

Parameters:
speed The amount of increase.

int CSpirit::Serialize ( void *  dest  )  [virtual]

Serializes the CSpirit into a memory location.

Parameters:
dest The address of the memory location for serialization.
Returns:
The size of the serialization. The next serialization location must be this bytes beyond dest.
See also:
Deserialize

Reimplemented from CThing.

int CSpirit::Deserialize ( void *  dest  )  [virtual]

Deserializes the CSpirit from a memory location.

Parameters:
dest The address of the memory location for deserialization.
Returns:
The size of the deserialization. The next deserialization location must be this bytes beyond dest.
See also:
Serialize

Reimplemented from CThing.

void CSpirit::GetMoveFactors ( float *  forward,
float *  left 
)

Gets the move factors of the spirit.

Parameters:
forward Pointer to the variable in which the forward move factor value will placed.
left Pointer to the variable in which the left move factor value will placed.


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

Generated on Fri Jun 13 19:46:39 2008 for OPSIMUS by  doxygen 1.5.5