Animator

Inherited: NativeBehaviour

Description

The animation controller allows to control different animation states from AnimationStateMachine assets. To use any animations in the Thunder Engine the Animator must be attached to a root Actor in the hierarchy. The animation controller processes an AnimationStateMachine resource type. The animation controller can use parametric values to decide when transition between states must happen.

Public Methods

void

crossFade (const std::string & state, float duration)

void

crossFadeHash (int hash, float duration)

int

duration () const

void

rebind ()

void

setBool (const std::string & name, bool value)

void

setBoolHash (int hash, bool value)

void

setFloat (const std::string & name, float value)

void

setFloatHash (int hash, float value)

void

setInteger (const std::string & name, int32_t value)

void

setIntegerHash (int hash, int32_t value)

void

setState (const std::string & state)

void

setStateHash (int hash)

void

setStateMachine (AnimationStateMachine * resource)

AnimationStateMachine *

stateMachine () const

Static Methods

None

Methods Description

void Animator::crossFade (std::string & state, float duration)

Smoothly changes current state using crossfade interpolation from the previous state to the new state with duration (in milliseconds).


void Animator::crossFadeHash (int hash, float duration)

Smoothly changes current state using crossfade interpolation from the previous state to the new state (using the hash of state) with duration (in milliseconds).


int Animator::duration () const

Returns duration of the animation clip for the current state.


void Animator::rebind ()

Rebinds all animated properties with Animator.


void Animator::setBool (std::string & name, bool value)

Sets the new boolean value for the parameter with the name.


void Animator::setBoolHash (int hash, bool value)

Sets the new boolean value for the parameter using the hash of state as the name.


void Animator::setFloat (std::string & name, float value)

Sets the new floating-point value for the parameter with the name.


void Animator::setFloatHash (int hash, float value)

Sets the new floating-point value for the parameter using the hash of state as the name.


void Animator::setInteger (std::string & name, int32_t value)

Sets the new integer value for the parameter with the name.


void Animator::setIntegerHash (int hash, int32_t value)

Sets the new integer value for the parameter using the hash of state as the name.


void Animator::setState (std::string & state)

Changes the current state of state machine immediately.


void Animator::setStateHash (int hash)

Changes the current state (using the hash of state) of state machine immediately.


void Animator::setStateMachine (AnimationStateMachine * resource)

Sets AnimationStateMachine resource which will be attached to this Animator.

Note: The state machine will move to the initial state automatically during the call of this function.

See also stateMachine().


:ref:`AnimationStateMachine<api_AnimationStateMachine>`* Animator::stateMachine () const

Returns AnimationStateMachine resource attached to this Animator.

See also setStateMachine().