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. Open in GitHub
public class ClientAnimator : AnimatorBase, IAnimator
- Inheritance
-
ClientAnimator
- Implements
- Derived
- Inherited Members
- Extension Methods
Constructors
ClientAnimator(WalkSpeedSupplierDelegate, List<ElementPose>, Animation[], ShapeElement[], Dictionary<int, AnimationJoint>, Action<string>, Action<AnimationSound>)
public ClientAnimator(WalkSpeedSupplierDelegate walkSpeedSupplier, List<ElementPose> rootPoses, Animation[] animations, ShapeElement[] rootElements, Dictionary<int, AnimationJoint> jointsById, Action<string> onAnimationStoppedListener = null, Action<AnimationSound> onShouldPlaySoundListener = null)
Parameters
walkSpeedSupplierWalkSpeedSupplierDelegaterootPosesList<ElementPose>animationsAnimation[]rootElementsShapeElement[]jointsByIdDictionary<int, AnimationJoint>onAnimationStoppedListenerAction<string>onShouldPlaySoundListenerAction<AnimationSound>
ClientAnimator(WalkSpeedSupplierDelegate, Animation[], Action<string>, Action<AnimationSound>)
public ClientAnimator(WalkSpeedSupplierDelegate walkSpeedSupplier, Animation[] animations, Action<string> onAnimationStoppedListener = null, Action<AnimationSound> onShouldPlaySoundListener = null)
Parameters
walkSpeedSupplierWalkSpeedSupplierDelegateanimationsAnimation[]onAnimationStoppedListenerAction<string>onShouldPlaySoundListenerAction<AnimationSound>
ClientAnimator(WalkSpeedSupplierDelegate, Animation[], ShapeElement[], Dictionary<int, AnimationJoint>, Action<string>, Action<AnimationSound>)
public ClientAnimator(WalkSpeedSupplierDelegate walkSpeedSupplier, Animation[] animations, ShapeElement[] rootElements, Dictionary<int, AnimationJoint> jointsById, Action<string> onAnimationStoppedListener = null, Action<AnimationSound> onShouldPlaySoundListener = null)
Parameters
walkSpeedSupplierWalkSpeedSupplierDelegateanimationsAnimation[]rootElementsShapeElement[]jointsByIdDictionary<int, AnimationJoint>onAnimationStoppedListenerAction<string>onShouldPlaySoundListenerAction<AnimationSound>
Fields
MaxConcurrentAnimations
public static int MaxConcurrentAnimations
Field Value
jointsById
public Dictionary<int, AnimationJoint> jointsById
Field Value
jointsDone
protected HashSet<int> jointsDone
Field Value
Properties
MaxJointId
public override int MaxJointId { get; }
Property Value
Methods
AnimNowActive(RunningAnimation, AnimationMetaData)
protected override void AnimNowActive(RunningAnimation anim, AnimationMetaData animData)
Parameters
animRunningAnimationanimDataAnimationMetaData
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
entityEntityrootPosesList<ElementPose>animationsAnimation[]rootElementsShapeElement[]jointsByIdDictionary<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
entityEntityanimationsAnimation[]rootElementsShapeElement[]jointsByIdDictionary<int, AnimationJoint>
Returns
DumpCurrentState()
public override string DumpCurrentState()
Returns
GetPosebyName(string, StringComparison)
public override ElementPose GetPosebyName(string name, StringComparison stringComparison = StringComparison.InvariantCultureIgnoreCase)
Parameters
namestringstringComparisonStringComparison
Returns
LoadAttachmentPoints(List<ElementPose>)
protected virtual void LoadAttachmentPoints(List<ElementPose> cachedPoses)
Parameters
cachedPosesList<ElementPose>
LoadPosesAndAttachmentPoints(ShapeElement[], List<ElementPose>)
protected virtual void LoadPosesAndAttachmentPoints(ShapeElement[] elements, List<ElementPose> intoPoses)
Parameters
elementsShapeElement[]intoPosesList<ElementPose>
OnFrame(Dictionary<string, AnimationMetaData>, float)
The event fired on each frame.
public override void OnFrame(Dictionary<string, AnimationMetaData> activeAnimationsByAnimCode, float dt)
Parameters
activeAnimationsByAnimCodeDictionary<string, AnimationMetaData>dtfloat
ReloadAttachmentPoints()
public override void ReloadAttachmentPoints()
calculateMatrices(float)
protected override void calculateMatrices(float dt)
Parameters
dtfloat
initFields()
protected virtual void initFields()
initMatrices(int)
protected virtual void initMatrices(int maxJointId)
Parameters
maxJointIdint