dtAnim::CharacterWrapper Class Reference

A Wrapper around an animated character that will perform basic steering. More...

#include <characterwrapper.h>

Inheritance diagram for dtAnim::CharacterWrapper:

dtCore::Transformable dtCore::DeltaDrawable dtCore::Base

List of all members.

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 ()


Detailed Description

A Wrapper around an animated character that will perform basic steering.

Member Typedef Documentation

typedef dtCore::Transformable dtAnim::CharacterWrapper::BaseClass


Constructor & Destructor Documentation

dtAnim::CharacterWrapper::CharacterWrapper ( const std::string &  filename  ) 

dtAnim::CharacterWrapper::~CharacterWrapper (  )  [protected]


Member Function Documentation

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.

Parameters:
time step

float dtAnim::CharacterWrapper::GetHeightAboveGround (  )  const

The height above ground is used for setting the camera height after ground clamping.

Returns:
the current translational offset in the Z direction

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().

Parameters:
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.

Parameters:
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.

Parameters:
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.

Returns:
the current speed of the character

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.

Parameters:
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.

Returns:
current rotation speed

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.

Returns:
desired rotation speed

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.

Parameters:
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.

Parameters:
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().

Returns:
the current local offset (starts as identity)

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().

Parameters:
the desired local offset (starts as identity)

float dtAnim::CharacterWrapper::GetHeading (  )  const

Gets the current heading of the character in degrees.

Returns:
heading in degrees

void dtAnim::CharacterWrapper::SetHeading ( float  degrees  ) 

Gets the current heading of the character in degrees.

Parameters:
heading in degrees

void dtAnim::CharacterWrapper::PlayAnimation ( const std::string &  pAnim  ) 

Just a wrapper interface to the animation helper.

Parameters:
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.

Parameters:
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.

Parameters:
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.

Parameters:
the name of the animation


http://www.delta3d.org
2.0.0 generated 14 Feb 2008