Search Unity

Question Disabling root object messes up Animation Rigging

Discussion in 'Animation Rigging' started by alchemist_wurzelpurzel, Mar 16, 2022.

  1. alchemist_wurzelpurzel

    alchemist_wurzelpurzel

    Joined:
    Sep 4, 2018
    Posts:
    43
    Hi all!

    Using Unity 2020.3.17f1 and Animation Rigging 1.0.3 and a Generic Rig.

    We are using Animation Rigging to let our Character Visuals look at other objects or towards Look Direction Input. It affects hip, waist, chest, shoulder and head bones via one Multi-Aim Constraint and otherwise Override Transform Contraints.
    Our Character Visuals are pooled and when they are not needed anymore their root GameObject is disabled.

    The Player can transform themselves into a Mouse. Doing so will play an animation and at the end, the Player Character Visual is disabled by the pooling system and the Mouse Visual is spawned and enabled.

    The player is then free to walk around and transform back at any time and here comes the issue:
    When reverting the transformation, the Player Character Visual is set to the Player's position & rotation and enabled again. In certain circumstances this leads to the Animation Rigging seemingly being initialized with the wrong default values, creating jumbled visuals.

    After reading this post https://forum.unity.com/threads/mul...fter-deactivate-activate-from-a-pool.1024954/ we already tried using Animator.WriteDefaultValues() right before the Character Visual is disabled, but to no avail. Is there anything else we might be missing?

    We do reset the Look At Target transform's position before re-enabling the Player Character Visual to be right in front of the Player and other than that we only lerp all of the Weights depending on the angle towards the Look At Target.

    Really hoping someone can give us a hint here.
    Thank you!
     
    Last edited: Mar 17, 2022
  2. alchemist_wurzelpurzel

    alchemist_wurzelpurzel

    Joined:
    Sep 4, 2018
    Posts:
    43
    Here's a couple of screenshots showing our setup.
    The Weights are changed at runtime depending on the angle to the target.
     

    Attached Files: