NcEngine
nc::SkeletalAnimationController Class Reference

State machine that controls animation transitions for a SkinnedMesh. More...

#include <SkeletalAnimationController.h>

Public Member Functions

 SkeletalAnimationController (asset::AssetId animationId=asset::NullAssetId, float defaultTransitionDuration=0.3f)
 Construct a SkeletalAnimationController. More...
 
State Machine Functions

Animation transitions are managed automatically based on the properties of current animation states.

auto GetActiveState () const -> AnimationStateId
 
auto GetCurrentAnimationId () const -> uint64_t
 
auto AddState (LoopAnimation &&properties) -> AnimationStateId
 
auto AddState (PlayOnceAnimation &&properties) -> AnimationStateId
 
auto AddState (StopAnimation &&properties) -> AnimationStateId
 
auto GetAnimation (AnimationStateId stateId) const -> asset::AssetId
 
void SetAnimation (AnimationStateId stateId, asset::AssetId animationId)
 
auto GetDefaultTransitionDuration () const -> float
 
void SetDefaultTransitionDuration (float dur)
 

Immediate Transition Functions

Immediate transitions interrupt the state machine and move to the specified state. Control is returned to the state machine upon the exit condition being met, or the immediate animation finishing, for PlayOnce.

void LoopImmediate (asset::AssetId animId, TransitionCondition &&exitWhen, AnimationStateId exitTo=RootAnimationState, float transitionDuration=UseDefaultTransitionDuration)
 
void PlayOnceImmediate (asset::AssetId animId, AnimationStateId exitTo=RootAnimationState, float transitionDuration=UseDefaultTransitionDuration)
 
void StopImmediate (TransitionCondition &&exitWhen, AnimationStateId exitTo=RootAnimationState, float transitionDuration=UseDefaultTransitionDuration)
 

Detailed Description

State machine that controls animation transitions for a SkinnedMesh.

internal

Constructor & Destructor Documentation

◆ SkeletalAnimationController()

nc::SkeletalAnimationController::SkeletalAnimationController ( asset::AssetId  animationId = asset::NullAssetId,
float  defaultTransitionDuration = 0.3f 
)
explicit

Construct a SkeletalAnimationController.

The controller is initialized with a default state that loops the animation asset specified by animationId. This state is set with the id 'RootState' and cannot not be removed.

Member Function Documentation

◆ LoopImmediate()

void nc::SkeletalAnimationController::LoopImmediate ( asset::AssetId  animId,
TransitionCondition &&  exitWhen,
AnimationStateId  exitTo = RootAnimationState,
float  transitionDuration = UseDefaultTransitionDuration 
)

internal

◆ PlayOnceImmediate()

void nc::SkeletalAnimationController::PlayOnceImmediate ( asset::AssetId  animId,
AnimationStateId  exitTo = RootAnimationState,
float  transitionDuration = UseDefaultTransitionDuration 
)

internal

◆ StopImmediate()

void nc::SkeletalAnimationController::StopImmediate ( TransitionCondition &&  exitWhen,
AnimationStateId  exitTo = RootAnimationState,
float  transitionDuration = UseDefaultTransitionDuration 
)

internal


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