Table of Contents

Class ClientAnimator

Namespace
Vintagestory.API.Common
Assembly
VintagestoryAPI.dll

Syncs every frame with entity.ActiveAnimationsByAnimCode, starts and stops animations when necessary and does recursive interpolation on the rotation, position and scale value for each frame, for each element and for each active element this produces always correctly blended animations but is significantly more costly for the cpu when compared to the technique used by the AnimatorBase.

public class ClientAnimator : AnimatorBase, IAnimator
Inheritance
ClientAnimator
Implements
Derived
Inherited Members

Constructors

ClientAnimator(WalkSpeedSupplierDelegate, List<ElementPose>, Animation[], ShapeElement[], Dictionary<int, AnimationJoint>, Action<string>)

public ClientAnimator(WalkSpeedSupplierDelegate walkSpeedSupplier, List<ElementPose> rootPoses, Animation[] animations, ShapeElement[] rootElements, Dictionary<int, AnimationJoint> jointsById, Action<string> onAnimationStoppedListener = null)

Parameters

walkSpeedSupplier WalkSpeedSupplierDelegate
rootPoses List<ElementPose>
animations Animation[]
rootElements ShapeElement[]
jointsById Dictionary<int, AnimationJoint>
onAnimationStoppedListener Action<string>

ClientAnimator(WalkSpeedSupplierDelegate, Animation[], Action<string>)

public ClientAnimator(WalkSpeedSupplierDelegate walkSpeedSupplier, Animation[] animations, Action<string> onAnimationStoppedListener = null)

Parameters

walkSpeedSupplier WalkSpeedSupplierDelegate
animations Animation[]
onAnimationStoppedListener Action<string>

ClientAnimator(WalkSpeedSupplierDelegate, Animation[], ShapeElement[], Dictionary<int, AnimationJoint>, Action<string>)

public ClientAnimator(WalkSpeedSupplierDelegate walkSpeedSupplier, Animation[] animations, ShapeElement[] rootElements, Dictionary<int, AnimationJoint> jointsById, Action<string> onAnimationStoppedListener = null)

Parameters

walkSpeedSupplier WalkSpeedSupplierDelegate
animations Animation[]
rootElements ShapeElement[]
jointsById Dictionary<int, AnimationJoint>
onAnimationStoppedListener Action<string>

Fields

MaxConcurrentAnimations

public static int MaxConcurrentAnimations

Field Value

int

RootPoses

public List<ElementPose> RootPoses

Field Value

List<ElementPose>

jointsById

public Dictionary<int, AnimationJoint> jointsById

Field Value

Dictionary<int, AnimationJoint>

jointsDone

protected HashSet<int> jointsDone

Field Value

HashSet<int>

rootElements

public ShapeElement[] rootElements

Field Value

ShapeElement[]

Methods

AnimNowActive(RunningAnimation, AnimationMetaData)

protected override void AnimNowActive(RunningAnimation anim, AnimationMetaData animData)

Parameters

anim RunningAnimation
animData AnimationMetaData

CreateForEntity(Entity, List<ElementPose>, Animation[], ShapeElement[], Dictionary<int, AnimationJoint>)

public static ClientAnimator CreateForEntity(Entity entity, List<ElementPose> rootPoses, Animation[] animations, ShapeElement[] rootElements, Dictionary<int, AnimationJoint> jointsById)

Parameters

entity Entity
rootPoses List<ElementPose>
animations Animation[]
rootElements ShapeElement[]
jointsById Dictionary<int, AnimationJoint>

Returns

ClientAnimator

CreateForEntity(Entity, Animation[], ShapeElement[], Dictionary<int, AnimationJoint>)

public static ClientAnimator CreateForEntity(Entity entity, Animation[] animations, ShapeElement[] rootElements, Dictionary<int, AnimationJoint> jointsById)

Parameters

entity Entity
animations Animation[]
rootElements ShapeElement[]
jointsById Dictionary<int, AnimationJoint>

Returns

ClientAnimator

GetPosebyName(string, StringComparison)

public override ElementPose GetPosebyName(string name, StringComparison stringComparison = StringComparison.InvariantCultureIgnoreCase)

Parameters

name string
stringComparison StringComparison

Returns

ElementPose

LoadAttachmentPoints(List<ElementPose>)

protected virtual void LoadAttachmentPoints(List<ElementPose> cachedPoses)

Parameters

cachedPoses List<ElementPose>

LoadPosesAndAttachmentPoints(ShapeElement[], List<ElementPose>)

protected virtual void LoadPosesAndAttachmentPoints(ShapeElement[] elements, List<ElementPose> intoPoses)

Parameters

elements ShapeElement[]
intoPoses List<ElementPose>

OnFrame(Dictionary<string, AnimationMetaData>, float)

The event fired on each frame.

public override void OnFrame(Dictionary<string, AnimationMetaData> activeAnimationsByAnimCode, float dt)

Parameters

activeAnimationsByAnimCode Dictionary<string, AnimationMetaData>
dt float

calculateMatrices(float)

protected override void calculateMatrices(float dt)

Parameters

dt float

initFields()

protected virtual void initFields()