Search Unity

Question Animation Rigging with Multiple Animator Layers

Discussion in 'Animation Rigging' started by MMX3VIII, Jun 17, 2021.

  1. MMX3VIII

    MMX3VIII

    Joined:
    Jul 2, 2017
    Posts:
    7
    Hello, I am experimenting with the Animation Rigging package to use it in my game. The main player has an animator controller with multiple layers:

    upload_2021-6-17_15-17-57.png

    When I applied the Rig setup to the player, added one IK constraint, and started playing the game, many things began to act strangely. For example, the IK target and hint are both snapped to the origin, the Rig weight is stuck at 1 (cannot be changed), and so on. I checked with the official documentation and various online tutorials multiple times to verify that my Rig setup was correct. When I switched to a simpler animator controller (one layer, one state with an idle animation) on the same Rig setup and model, the rig and the IK constraint seem to behave more correctly. I am starting to wonder if the Animation Rigging package supports Animator Controllers with multiple layers?

    Edit: The Animator is running on a Generic 'Animation Type' with no 'Avatar Definition'
     
  2. giantkilleroverunity3d

    giantkilleroverunity3d

    Joined:
    Feb 28, 2014
    Posts:
    383
    I have a problem with the target and hint also. I am still trying to locate where the problem might be.
    The target and hint jump away from start location in preview.
    I am still struggling through the 1 key frame animation to keep the model in the place I place it. Preview, play or game play cause mine to switch locations.
    In regards to your problem it might be something prior to what you are seeing.
    I alleviated rig problems by using exporting Blender mesh only to Mixamo then downloading the model with an animation. Seemed to be less steps.
     
  3. MMX3VIII

    MMX3VIII

    Joined:
    Jul 2, 2017
    Posts:
    7
    Interesting. I will do more extensive tests on simpler rigs as well. I really hope Animation Rigging supports more complex Animator Controllers or this is just a bug, since restructuring my entire animation layout would be disastrous :(
     
  4. simonbz

    simonbz

    Unity Technologies

    Joined:
    Sep 28, 2015
    Posts:
    295
    Hey @MMXXXVIII, we have fixed issues similar to this one recently (link). Can you try updating to a newer version of Unity with this fix to see if it addresses your issue?

    If it does not, please log us a bug using the Unity bug reporter so that we can have a look :)
     
  5. MMX3VIII

    MMX3VIII

    Joined:
    Jul 2, 2017
    Posts:
    7
    Thank you for the reply! Unfortunately no that did not fix my problem. I tested on 2020.3.12f1 with the latest Animation Rigging package. I will file a bug report ASAP :D
     
  6. simonbz

    simonbz

    Unity Technologies

    Joined:
    Sep 28, 2015
    Posts:
    295
    Hey, we had a look at the bug you've reported us!
    Thank you for that btw :D

    So, the reason why the rig weight is locked at runtime is because `writeDefaults` is disabled on your state. If you enable `writeDefaults` you should see that the problem disappears.

    write defaults.png

    Animation Rigging relies on the animation mask to decide whether or not it should read values from the scene (when values are not animated), or use the animation stream (when values are animated). However, when `writeDefaults` is disabled on a state, the animation system will force the animation mask for all properties, thus, forcing the animation stream into Animation Rigging.

    Unfortunately, we can't change this behaviour in the Animation system as it would break other workflows...

    Alternatively, you could also add keyframes for the rig weight in your animation clips to drive the weight through animation instead of script.

    Here is the issue tracker link for reference:
    https://issuetracker.unity3d.com/is...hout-write-defaults-enabled-locks-constraints
     
    Last edited: Jul 14, 2021
    KenjiJU likes this.
  7. MMX3VIII

    MMX3VIII

    Joined:
    Jul 2, 2017
    Posts:
    7
    Thank you so much for the detailed investigation!! It is a bit disappointing that Animation Rigging cannot support writeDefault on false (maybe the documentation guys can add a little note for future users? ;)), however it is real comforting that we have found the culprit to this behavior. I will search for a work around for writeDefault to get this package working and thanks again for all the help!