#include <characterwrapper.h>

Public Types | |
| typedef dtCore::Transformable | BaseClass |
Public Member Functions | |
| CharacterWrapper (const std::string &filename) | |
| void | Update (float dt) |
| This is a per-frame call which updates the animation helper, and applies rotation and translation from Speed and RotationSpeed. | |
| float | GetHeightAboveGround () const |
| The height above ground is used for setting the camera height after ground clamping. | |
| void | SetHeightAboveGround (float heightAboveGround) |
| The height above ground is used for setting the camera height after ground clamping. | |
| void | SetGroundClamp (dtCore::Transformable *nodeToClampTo, float heightAboveGround) |
| Initiates ground clamping using a delta transformable, the height above ground is determined to be the height above the ground intersection to set as an offset translation. | |
| void | SetGroundClamp (dtCore::Scene *sceneNode, float heightAboveGround) |
| Initiates ground clamping using a delta transformable, the height above ground is determined to be the height above the ground intersection to set as an offset translation. | |
| float | GetSpeed () const |
| The Speed of the character is defined to be the forward translation in m/s, the character is moved in the update. | |
| void | SetSpeed (float metersPerSecond) |
| The Speed of the character is defined to be the forward translation in m/s, the character is moved in the update. | |
| float | GetRotationSpeed () const |
| The rotation speed of the character is defined to be a rotation about the Z axis in degrees/sec. | |
| void | SetRotationSpeed (float degreesPerSecond) |
| The rotation speed of the character is defined to be a rotation about the Z axis in degrees/sec. | |
| void | RotateToHeading (float headingInDegrees, float dt) |
| Rotate to Heading will rotate the character about the Z axis to match the given heading. | |
| void | RotateToPoint (const osg::Vec3 &point, float dt) |
| Rotate to Point will rotate the character about the Z axis to match the given direction. | |
| dtCore::Transform | GetLocalOffset () const |
| The Local Offset is an additional matrix between the character and the loaded art model. | |
| void | SetLocalOffset (const dtCore::Transform &localOffset) |
| The Local Offset is an additional matrix between the character and the loaded art model. | |
| float | GetHeading () const |
| Gets the current heading of the character in degrees. | |
| void | SetHeading (float degrees) |
| Gets the current heading of the character in degrees. | |
| void | PlayAnimation (const std::string &pAnim) |
| Just a wrapper interface to the animation helper. | |
| void | ClearAnimation (const std::string &pAnim, float fadeOutTime) |
| Just a wrapper interface to the animation helper. | |
| void | ClearAllAnimations (float fadeOutTime) |
| Just a wrapper interface to the animation helper. | |
| bool | IsAnimationPlaying (const std::string &name) const |
| Searches the play list for the desired animation, returns true if the animation is playing. | |
Protected Member Functions | |
| ~CharacterWrapper () | |
| dtAnim::CharacterWrapper::CharacterWrapper | ( | const std::string & | filename | ) |
| dtAnim::CharacterWrapper::~CharacterWrapper | ( | ) | [protected] |
| void dtAnim::CharacterWrapper::Update | ( | float | dt | ) |
This is a per-frame call which updates the animation helper, and applies rotation and translation from Speed and RotationSpeed.
| time | step |
| float dtAnim::CharacterWrapper::GetHeightAboveGround | ( | ) | const |
The height above ground is used for setting the camera height after ground clamping.
| void dtAnim::CharacterWrapper::SetHeightAboveGround | ( | float | heightAboveGround | ) |
The height above ground is used for setting the camera height after ground clamping.
It is defined as a translational offset in the Z direction. Note to initiate ground clamping you must call SetGroundClamp().
| the | desired translational offset in the Z direction |
| void dtAnim::CharacterWrapper::SetGroundClamp | ( | dtCore::Transformable * | nodeToClampTo, | |
| float | heightAboveGround | |||
| ) |
Initiates ground clamping using a delta transformable, the height above ground is determined to be the height above the ground intersection to set as an offset translation.
| the | node to ground clamp to | |
| the | height above ground |
| void dtAnim::CharacterWrapper::SetGroundClamp | ( | dtCore::Scene * | sceneNode, | |
| float | heightAboveGround | |||
| ) |
Initiates ground clamping using a delta transformable, the height above ground is determined to be the height above the ground intersection to set as an offset translation.
| a | scene to perform ground clamping on | |
| the | height above ground |
| float dtAnim::CharacterWrapper::GetSpeed | ( | ) | const |
The Speed of the character is defined to be the forward translation in m/s, the character is moved in the update.
| void dtAnim::CharacterWrapper::SetSpeed | ( | float | metersPerSecond | ) |
The Speed of the character is defined to be the forward translation in m/s, the character is moved in the update.
| the | desired speed of the character |
| float dtAnim::CharacterWrapper::GetRotationSpeed | ( | ) | const |
The rotation speed of the character is defined to be a rotation about the Z axis in degrees/sec.
It controls the heading, and is contributed to the per-frame update.
| void dtAnim::CharacterWrapper::SetRotationSpeed | ( | float | degreesPerSecond | ) |
The rotation speed of the character is defined to be a rotation about the Z axis in degrees/sec.
It controls the heading, and is contributed to the per-frame update.
| void dtAnim::CharacterWrapper::RotateToHeading | ( | float | headingInDegrees, | |
| float | dt | |||
| ) |
Rotate to Heading will rotate the character about the Z axis to match the given heading.
A time step parameter can be used to give a smooth rotation and control the speed at which the character rotates. A time step of 1.0 will give a full rotation to the heading specified. It should be noted that this is an immediate rotation and is independent of the per frame update function.
| desired | heading to rotate towards | |
| current | time step |
| void dtAnim::CharacterWrapper::RotateToPoint | ( | const osg::Vec3 & | point, | |
| float | dt | |||
| ) |
Rotate to Point will rotate the character about the Z axis to match the given direction.
A time step parameter can be used to give a smooth rotation and control the speed at which the character rotates. A time step of 1.0 will give a full rotation to the heading specified. It should be noted that this is an immediate rotation and is independent of the per frame update function.
| desired | point to rotate towards | |
| current | time step |
| dtCore::Transform dtAnim::CharacterWrapper::GetLocalOffset | ( | ) | const |
The Local Offset is an additional matrix between the character and the loaded art model.
This offset matrix can be used to rotate the model to face 'forwards' in model space, or apply a scale value that will not be lost by calling SetTransform().
| void dtAnim::CharacterWrapper::SetLocalOffset | ( | const dtCore::Transform & | localOffset | ) |
The Local Offset is an additional matrix between the character and the loaded art model.
This offset matrix can be used to rotate the model to face 'forwards' in model space, or apply a scale value that will not be lost by calling SetTransform().
| the | desired local offset (starts as identity) |
| float dtAnim::CharacterWrapper::GetHeading | ( | ) | const |
Gets the current heading of the character in degrees.
| void dtAnim::CharacterWrapper::SetHeading | ( | float | degrees | ) |
Gets the current heading of the character in degrees.
| heading | in degrees |
| void dtAnim::CharacterWrapper::PlayAnimation | ( | const std::string & | pAnim | ) |
Just a wrapper interface to the animation helper.
| the | animation to play from the loaded model |
| void dtAnim::CharacterWrapper::ClearAnimation | ( | const std::string & | pAnim, | |
| float | fadeOutTime | |||
| ) |
Just a wrapper interface to the animation helper.
| the | animation to clear from the play list | |
| the | desired time to fade out the animation |
| void dtAnim::CharacterWrapper::ClearAllAnimations | ( | float | fadeOutTime | ) |
Just a wrapper interface to the animation helper.
Clears all animations playing.
| the | fade out time |
| bool dtAnim::CharacterWrapper::IsAnimationPlaying | ( | const std::string & | name | ) | const |
Searches the play list for the desired animation, returns true if the animation is playing.
| the | name of the animation |