Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Question Some questions about Animation Rigging Source Code!!

Discussion in 'Animation Rigging' started by MingKKK, Feb 19, 2021.

  1. MingKKK

    MingKKK

    Joined:
    Apr 13, 2019
    Posts:
    15
    1、In the Playable Graph created by RigBuilder, there is an Animation Ouput that is related to SyncSceneToStream. I read the SyncsceneStream related source code and still don't understand what this property does. Is the source code so complex that it is difficult to understand its benefits.

    2、How can multiple Animation outputs in the same playable graph ensure that output data will not cover each other in ?
    Is the output data is an AnimationStream object?

    3、I learned the Animation C# Job sample project. I found in FullbodyikJob code that use AnimationHumanStream method to set the Goal and Hint for the skeleton to achieve IK function.
    However, It do not use AnimationHumanStream in AnimationRigging, but all the related IK functions are developed using C#. Is it because the UnityEngine's built-in IK algorithm is flawed?


    PLZ ! THX!
     
    Last edited: Feb 19, 2021
  2. MingKKK

    MingKKK

    Joined:
    Apr 13, 2019
    Posts:
    15
    PLZ ! THX!
     
  3. simonbz

    simonbz

    Unity Technologies

    Joined:
    Sep 28, 2015
    Posts:
    295
    Hi,

    The purpose of the SyncSceneToStream job is to read back scene values into the animation stream if they were not previously animated in your animation source (e.g. state machine, timeline). This allows animatable properties to be moved by gameplay (scene values), or driven by animation without having that complexity handled in the constraint implementation

    PlayableGraph outputs are all connected in a LayerMixer in the Animator. Each output has additional options it can be set with to define how it should be blended with other outputs (link).

    Outputs in the AnimationRigging graph are set to read from previous inputs in the stream. As such AnimationRigging acts like post-processing to what came before it.

    Code (CSharp):
    1. output.SetAnimationStreamSource(AnimationStreamSource.PreviousInputs);
    2.  
    Animation Rigging was developed as an extensible framework to handle both generic rigs and humanoid rigs. This is why we made the decision to implement constraints that read from transform bones and not from the human description.

    However, this does not invalidate the humanoid IK constraints in any way. If you want to implement your custom constraint that drive humanoid characters, this will also work with Animation Rigging.
     
    MingKKK likes this.