Skip to content

RandallLiuXin/DotsAnimation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DotsAnimation

This is a Unity DOTS animation solution. Though still in progress, it is already capable for project usages. (Especially for now, unity doesn't have any official animation solution with the latest DOTS package.)

  • Animation Graph: You can save all the animation variables on it. It supports using nodes to control the Skeleton bones and to define the character's final animation pose.
  • Animation State Machine: Provide a way to break animation of a character into a series of States. These states are then governed by Transition Rules that control how to blend from one state to another.
  • Animation State: It is a portion of an animation graph that we know the character will be blending into and out of on a regular basis. You can use different sample nodes and blend nodes to define the final animation pose for each Animation State.
  • Animation Transition: After you defined your states, you need to use Animation Transition to control how your character is going to transit from one state to another, including transition time, transition rules, how to blend, etc.
  • Animation Events
  • Root motion
  • Animation Compression: based on ACL

Example

You can find a sample graph here: Assets/Resources/Graph/AnimationGraphTest.asset

image

image

image

You can refer to SampleScene.scene for a test example.

How to test

  1. Open SampleScene.scene and press play button.
  2. You can see three characters. The left one is driven by unity's original animator. The other two are this library test examples. The middle one is a single animation clip test. The right one is a animation graph test.

image

  1. Open DOTS hierarchy, and select RPG-Character_ecs_animationGraph

image

image

  1. In the Inspector windows, you can find Bool Parameter

image

  1. Set Moving value to true, you will see the character start to run. Set Dead value to true, you will see the character start to play stun animation. After finishing stun animation, the character will play knockdown animation.

image

  1. Looks like this

image

How It Works

  1. AnimationGraphBlobberSystem: convert unity gameobject to dots entity
  2. AnimationSetParameterSystem: set all the animation parameter based on event
  3. AnimationGraphSystem
    • UpdateAnimationGraphNodeJob update animation nodes which in the graph
    • set animation state machine weight based on animation node result
  4. AnimationStateMachineSystem: init state machine and evaluate transition, then create new state if needed
  5. AnimationChangeStateSystem: handle change state event and blend pose during state transition
  6. UpdateAnimationNodesSystem: update all the animation states
  7. AnimationBlendWeightsSystem: calculate all animations blend weight
  8. ClipSamplingSystem
    • sample optimize skeleton
    • raise animation events
    • send animation event to other system
    • sample root delta
    • apply root motion to entity

Supporting Nodes for now

  • Get variable
  • Single clip
  • State machine
  • Entry State
  • Transition
  • FinalPose

Todo

  • BlendSpace
  • Blend based on layer
  • LOD
  • IK

About

This is a Unity DOTS animation solution. Though still in progress, it is already capable for project usages. (Especially for now, unity doesn't have any official animation solution with the latest DOTS package.)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages