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
WalkSpeedSupplierDelegaterootPoses
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
WalkSpeedSupplierDelegateanimations
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
WalkSpeedSupplierDelegateanimations
Animation[]rootElements
ShapeElement[]jointsById
Dictionary<int, AnimationJoint>onAnimationStoppedListener
Action<string>
Fields
MaxConcurrentAnimations
public static int MaxConcurrentAnimations
Field Value
RootPoses
public List<ElementPose> RootPoses
Field Value
jointsById
public Dictionary<int, AnimationJoint> jointsById
Field Value
jointsDone
protected HashSet<int> jointsDone
Field Value
rootElements
public ShapeElement[] rootElements
Field Value
Methods
AnimNowActive(RunningAnimation, AnimationMetaData)
protected override void AnimNowActive(RunningAnimation anim, AnimationMetaData animData)
Parameters
anim
RunningAnimationanimData
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
EntityrootPoses
List<ElementPose>animations
Animation[]rootElements
ShapeElement[]jointsById
Dictionary<int, AnimationJoint>
Returns
CreateForEntity(Entity, Animation[], ShapeElement[], Dictionary<int, AnimationJoint>)
public static ClientAnimator CreateForEntity(Entity entity, Animation[] animations, ShapeElement[] rootElements, Dictionary<int, AnimationJoint> jointsById)
Parameters
entity
Entityanimations
Animation[]rootElements
ShapeElement[]jointsById
Dictionary<int, AnimationJoint>
Returns
GetPosebyName(string, StringComparison)
public override ElementPose GetPosebyName(string name, StringComparison stringComparison = StringComparison.InvariantCultureIgnoreCase)
Parameters
name
stringstringComparison
StringComparison
Returns
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()