Entity Components
Rukhanka conceptually consists of two main modules:
- Animator controller
- Animation processor
Each module has its own baker system that prepares data for it by converting appropriate authoring components (Unity Animator, Unity Skinned Mesh Renderer, and Unity Animations)
Animator Controller System
The main function of the controller is advancing the animation state machine with time and preparing required animations for the current state and transitions. The animator controller system processes entities with the AnimatorControllerLayerComponent
component array. Each element in this array represents separate animation layer as specified in Unity Animator.
public struct AnimatorControllerLayerComponent: IBufferElementData, IEnableableComponent
{
...
}
AnimatorControllerLayerComponent
is inherit IEnableableComponent so can be enabled and disabled. If disabled, the state machine of this owning entity will not be processed, and the model stops its animations (pose will be paused). After enabling the state machine will continue from the moment of pause.
During state machine processing, all prepared animations will be arranged in form of an array of AnimationToProcessComponent
components.
public struct AnimationToProcessComponent: IBufferElementData
{
...
}
Animation Process System
This system reads the AnimationToProcessComponent
array, samples animations at specified times and blends results according to required blend rules. The animated entity is defined as RigDefinitionComponent
:
public struct RigDefinitionComponent: IComponentData, IEnableableComponent
{
...
}
This component is also inherited from IEnableableComponent
and can be enabled or disabled accordingly. In disabled state, all animations for an entity are not processed, but the corresponding state machine will continue its work and still provides the rig with updated animation data. After enabling RigDefinitionComponent
, animations will jump to the actual state machine animation state.