vtlib library
Public Member Functions | List of all members
vtAnimPathEngine Class Reference
Inheritance diagram for vtAnimPathEngine:
Inheritance graph
[legend]

Public Member Functions

void SetAnimationPath (vtAnimPath *path)
 Set the animation path for this engine to use.
 
vtAnimPathGetAnimationPath ()
 Get the animation path associated with this engine.
 
const vtAnimPathGetAnimationPath () const
 Get the animation path associated with this engine.
 
void Reset ()
 
void SetSpeed (float fSpeed)
 Set the play speed, in time units per second. Default is 1.0.
 
float GetSpeed () const
 Get the play speed.
 
void SetContinuous (bool bFlag)
 
bool GetContinuous () const
 Return true if set for continuous play.
 
void SetPosOnly (bool bFlag)
 
bool GetPosOnly () const
 Return true if set to use position only.
 
virtual void Eval ()
 Virtual handler, will be called every frame to do the work of the engine.
 
void SetTime (float fTime)
 
float GetTime ()
 
- Public Member Functions inherited from vtEngine
osg::Referenced * GetTarget (uint which=0)
 
void AddTarget (osg::Referenced *ptr)
 
void RemoveTarget (osg::Referenced *ptr)
 
uint NumTargets ()
 Return the number of targets for this engine.
 
virtual void OnMouse (vtMouseEvent &event)
 Virtual handler, to catch mouse events, can be overridden by your engine class.
 
virtual void OnKey (int key, int flags)
 Virtual handler, to catch keyboard events, can be overridden by your engine class.
 
virtual void OnWindowSize (int width, int height)
 Virtual handler, to catch resize events, can be overridden by your engine class.
 

Detailed Description

This class connects a path (vtAnimPath) to any number of targets. The targets can be any transform (such as scene graph object or camera) which will be moved along the path based on time.

Speed is relative. For example, calling SetSpeed(2.0) means that an animation path with control points from 0 to 10 seconds will be played in 5 seconds. Default speed is 1.0.

Other aspects of playback you can control include continuous play (SetContinuous) and position only (SetPosOnly) which is useful if you want to move a camera along a path but allow the user to freely look around.

Member Function Documentation

float vtAnimPathEngine::GetTime ( )
inline

Set the play time, which will be in the range of 0.0 to the length of the animation path.

void vtAnimPathEngine::Reset ( )

Set the engine back to the beginning of its path (time = 0). This will affect the targets the next time Eval() or UpdateTargets() is called.

void vtAnimPathEngine::SetContinuous ( bool  bFlag)
inline

Set to true for continuous play, meaning that each time it reaches the end of the animation path, it continues from the beginning without stopping.

void vtAnimPathEngine::SetPosOnly ( bool  bFlag)
inline

Set to true for play to ignore the orientation of the animation path, so that only the position of the targets is affected.

void vtAnimPathEngine::SetTime ( float  fTime)
inline

Set the play time, which should be in the range of 0.0 to the length of the animation path. This will affect the targets the next time Eval() or UpdateTargets() is called.