ISkeletonAnim

Main interface to handle low-level animation processing on a character instance. More...

#include

Public Types

enum { LayerCount = SKELETON_ANIMATION_LAYER_COUNT }

Public Member Functions

virtual void SetDebugging (uint32 flags)=0
Enable special debug text for this skeleton.
virtual void SetMirrorAnimation (uint32 ts)=0
virtual void SetAnimationDrivenMotion (uint32 ts)=0
virtual uint32 GetAnimationDrivenMotion () const =0
virtual void SetTrackViewExclusive (uint32 i)=0
virtual void SetTrackViewMixingWeight (uint32 layer, f32 weight)=0
virtual uint32 GetTrackViewStatus () const =0
virtual bool StartAnimation (const char *szAnimName0, const CryCharAnimationParams &params)=0
virtual bool StartAnimationById (int32 id, const CryCharAnimationParams &Params)=0
virtual bool StopAnimationInLayer (int32 nLayer, f32 BlendOutTime)=0
Stops playback of the current animation in the specified layer, and specifies the time during which we will blend out.
virtual bool StopAnimationsAllLayers ()=0
Seizes playback of animations in all layers.
virtual CAnimation * FindAnimInFIFO (uint32 nUserToken, int nLayer=1)=0
virtual const CAnimation * FindAnimInFIFO (uint32 nUserToken, int nLayer=1) const =0
virtual bool RemoveAnimFromFIFO (uint32 nLayer, uint32 num, bool forceRemove=false)=0
virtual int GetNumAnimsInFIFO (uint32 nLayer) const =0
virtual void ClearFIFOLayer (uint32 nLayer)=0
virtual CAnimation & GetAnimFromFIFO (uint32 nLayer, uint32 num)=0
virtual const CAnimation & GetAnimFromFIFO (uint32 nLayer, uint32 num) const =0
virtual void ManualSeekAnimationInFIFO (uint32 nLayer, uint32 num, float time, bool triggerAnimEvents)=0
If manual update is set for anim, then set anim time and handle anim events.
virtual void RemoveTransitionDelayConditions (uint32 nLayer)=0
virtual void SetLayerBlendWeight (int32 nLayer, f32 fMult)=0
virtual void SetLayerPlaybackScale (int32 nLayer, f32 fSpeed)=0
virtual f32 GetLayerPlaybackScale (uint32 nLayer) const =0
virtual void SetDesiredMotionParam (EMotionParamID id, f32 value, f32 frametime)=0
virtual bool GetDesiredMotionParam (EMotionParamID id, float &value) const =0
virtual void SetAnimationNormalizedTime (CAnimation *pAnimation, f32 normalizedTime, bool entireClip=true)=0
virtual f32 GetAnimationNormalizedTime (const CAnimation *pAnimation) const =0
Get the animation normalized time for the specified running animation. The return value is in the range [0..1].
virtual void SetLayerNormalizedTime (uint32 layer, f32 normalizedTime)=0
virtual f32 GetLayerNormalizedTime (uint32 layer) const =0
virtual f32 CalculateCompleteBlendSpaceDuration (const CAnimation &rAnimation) const =0
virtual Vec3 GetCurrentVelocity () const =0
virtual void SetEventCallback (CallBackFuncType func, void *pdata)=0
virtual AnimEventInstance GetLastAnimEvent ()=0
virtual const QuatT & GetRelMovement () const =0
virtual f32 GetUserData (int i) const =0
virtual bool PushPoseModifier (uint32 layer, IAnimationPoseModifierPtr poseModifier, const char *name=NULL)=0
Pushes a pose modifier into the specified layer, ensuring that it will be executed next frame.
virtual IAnimationPoseModifierSetupPtr GetPoseModifierSetup ()=0
virtual IAnimationPoseModifierSetupConstPtr GetPoseModifierSetup () const =0
virtual QuatT CalculateRelativeMovement (const float deltaTime, const bool CurrNext=0) const =0
This function will move outside of this interface. Use at your own risk.

Detailed Description

Main interface to handle low-level animation processing on a character instance.

Member Function Documentation

◆ CalculateCompleteBlendSpaceDuration()

virtual f32 ISkeletonAnim::CalculateCompleteBlendSpaceDuration ( const CAnimation & rAnimation) const
pure virtual

Calculates duration of blend space up to the point where it starts to repeat, that is a Least Common Multiple of a number of segments of different examples. For instance, if segments of caf1: A B C, caf2: 1 2. The whole duration will be calculated for sequence A1 B2 C1 A2 B1 C2.

◆ FindAnimInFIFO()

virtual CAnimation* ISkeletonAnim::FindAnimInFIFO ( uint32 nUserToken,
int nLayer = 1
)
pure virtual

Find an animation with a given user token.

Parameters
nUserTokenUser token that identifies an animation to search for.
nLayerLayer of FIFO where to search for animation, if -1 all layers are searched.

◆ GetLayerPlaybackScale()

virtual f32 ISkeletonAnim::GetLayerPlaybackScale ( uint32 nLayer) const
pure virtual
Note
This does NOT override the overall animation speed, but it multiplies it.

◆ RemoveAnimFromFIFO()

virtual bool ISkeletonAnim::RemoveAnimFromFIFO ( uint32 nLayer,
uint32 num,
bool forceRemove = false
)
pure virtual

Remove an animation with a given index and given layer.

Parameters
nLayerAnimation layer to remove from.
numTransition queue index to remove at.
forceRemoveIgnore special conditions and force a removal from the layer.

◆ RemoveTransitionDelayConditions()

virtual void ISkeletonAnim::RemoveTransitionDelayConditions ( uint32 nLayer)
pure virtual

Makes sure there's no anim in this layer's queue that could cause a delay (useful when you want to play an animation that you want to be 100% sure is going to be transitioned to immediately).

◆ SetAnimationNormalizedTime()

virtual void ISkeletonAnim::SetAnimationNormalizedTime ( CAnimation * pAnimation,
f32 normalizedTime,
bool entireClip = true
)
pure virtual

Set the time for the specified running animation to a value in the range [0..1]. When entireClip is true, set the animation normalized time. When entireClip is false, set the current segment normalized time.

◆ SetDesiredMotionParam()

virtual void ISkeletonAnim::SetDesiredMotionParam ( EMotionParamID id,
f32 value,
f32 frametime
)
pure virtual

Updates the given motion parameter in order to select / blend between animations in blend spaces. Will perform clamping and clearing as needed.

#include 


void SetBlendSpaceParameter(ICharacterInstance& character)
{
    // Specify which parameter to override, for the sake of this example we opt for travel speed
    // These parameters can also be seen in the Character Tool
    const EMotionParamID parameterId = eMotionParamID_TravelSpeed;
    // Specify the value we want to set the parameter to
    const float newValue = 5.f;

    // Now set the motion parameter, affecting compatible blend spaces starting with the next frame.
    character.GetISkeletonAnim()->SetDesiredMotionParam(parameterId, newValue, 0.f);
}

◆ StartAnimation()

virtual bool ISkeletonAnim::StartAnimation ( const char * szAnimName0,
const CryCharAnimationParams & params
)
pure virtual

Starts playing back the specified animation in the layer specified in the provided parameters.

Parameters
szAnimName0Name of the animation we want to play back, without the .caf or .i_caf suffixes.
paramsParameters that describe how the animation should be started, such as playback speed.
#include 

void StartAnimation(ICharacterInstance* pCharacter)
{
    // Start an animation named "MyAnimation" (it should be visible with the same name in the Character Tool)
    const char* szAnimationName = "MyAnimation";
    // Loop the animation at normal speed
    CryCharAnimationParams animationParams;
    animationParams.m_nFlags = CA_LOOPED;
    // Start playing back the animation
    pCharacter->GetISkeletonAnim()->StartAnimation(szAnimationName, animationParams);
}

◆ StartAnimationById()

virtual bool ISkeletonAnim::StartAnimationById ( int32 id,
const CryCharAnimationParams & Params
)
pure virtual

Starts playing back the specified animation in the layer specified in the provided parameters.

Parameters
idUnique animation identifier, useful to avoid looking up animation by name on every playback
paramsParameters that describe how the animation should be started, such as playback speed.