Simple animation system for the unity dots stack.
To execute the sample:
AnimationsAuthoring
component to the root entity of a rigged model/prefabSkinnedMeshAuthoring
component to any children that should be deformed (have a skinned mesh renderer)Now the first animation clip should be executed on entering playmode.
Use the AnimationAspect
to to easily play and switch animations.
The animation clip will also start from 0 even if the same index is used again.
This example plays the animationClip with index 1 for all entities:
var clipIndex = 1;
foreach (var animationAspect in SystemAPI.Query<AnimationAspect>())
{
animationAspect.Play(clipIndex);
}
This example blends from the current clip to the next with the specified duration & set it to loop:
var clipIndex = 1;
foreach (var animationAspect in SystemAPI.Query<AnimationAspect>())
{
animationAspect.Crossfade(clipIndex, 0.5f, true);
}
For more advanced usage, you can modify the AnimationPlayer
component directly.