Class AnimatorBase
- Namespace
- Vintagestory.API.Common
- Assembly
- VintagestoryAPI.dll
Syncs every frame with entity.ActiveAnimationsByAnimCode, starts, progresses and stops animations when necessary
public abstract class AnimatorBase : IAnimator
- Inheritance
-
AnimatorBase
- Implements
- Derived
- Inherited Members
- Extension Methods
Constructors
AnimatorBase(WalkSpeedSupplierDelegate, Animation[], Action<string>)
public AnimatorBase(WalkSpeedSupplierDelegate WalkSpeedSupplier, Animation[] Animations, Action<string> onAnimationStoppedListener = null)
Parameters
WalkSpeedSupplier
WalkSpeedSupplierDelegateAnimations
Animation[]onAnimationStoppedListener
Action<string>
Fields
AttachmentPointByCode
public Dictionary<string, AttachmentPointAndPose> AttachmentPointByCode
Field Value
CurAnims
public RunningAnimation[] CurAnims
Field Value
RootElements
public ShapeElement[] RootElements
Field Value
RootPoses
public List<ElementPose> RootPoses
Field Value
TransformationMatrices
We skip the last row - https://stackoverflow.com/questions/32565827/whats-the-purpose-of-magic-4-of-last-row-in-matrix-4x4-for-3d-graphics
public float[] TransformationMatrices
Field Value
- float[]
TransformationMatricesDefaultPose
The entities default pose. Meaning for most elements this is the identity matrix, with exception of individually controlled elements such as the head.
public float[] TransformationMatricesDefaultPose
Field Value
- float[]
activeAnimCount
protected int activeAnimCount
Field Value
anims
public RunningAnimation[] anims
Field Value
identMat
public static readonly float[] identMat
Field Value
- float[]
Properties
ActiveAnimationCount
Amount of currently active animations
public int ActiveAnimationCount { get; }
Property Value
Animations
Holds data over all animations. This list always contains all animations of the creature. You have to check yourself which of them are active
public RunningAnimation[] Animations { get; }
Property Value
CalculateMatrices
Whether or not to calculate the animation matrices, required for GetAttachmentPointPose() to deliver correct values. Default on on the client, server side only on when the creature is dead
public bool CalculateMatrices { get; set; }
Property Value
Matrices
The 30 pose transformation matrices that go to the shader
public float[] Matrices { get; }
Property Value
- float[]
MaxJointId
public abstract int MaxJointId { get; }
Property Value
RunningAnimations
[Obsolete("Use Animations instead")]
public RunningAnimation[] RunningAnimations { get; }
Property Value
Methods
AnimNowActive(RunningAnimation, AnimationMetaData)
protected virtual void AnimNowActive(RunningAnimation anim, AnimationMetaData animData)
Parameters
anim
RunningAnimationanimData
AnimationMetaData
DumpCurrentState()
public virtual string DumpCurrentState()
Returns
GetAnimationState(string)
public RunningAnimation GetAnimationState(string code)
Parameters
code
string
Returns
GetAttachmentPointPose(string)
Gets the attachment point pose.
public AttachmentPointAndPose GetAttachmentPointPose(string code)
Parameters
code
string
Returns
GetPosebyName(string, StringComparison)
public virtual ElementPose GetPosebyName(string name, StringComparison stringComparison = StringComparison.InvariantCultureIgnoreCase)
Parameters
name
stringstringComparison
StringComparison
Returns
OnFrame(Dictionary<string, AnimationMetaData>, float)
The event fired on each frame.
public virtual void OnFrame(Dictionary<string, AnimationMetaData> activeAnimationsByAnimCode, float dt)
Parameters
activeAnimationsByAnimCode
Dictionary<string, AnimationMetaData>dt
float
ReloadAttachmentPoints()
public virtual void ReloadAttachmentPoints()
calculateMatrices(float)
protected abstract void calculateMatrices(float dt)
Parameters
dt
float