Search Unity

Resolved Animation Rigging - only in Play mode? how do I preview the animation?

Discussion in 'Animation Rigging' started by BuzzKirill, May 25, 2020.

  1. BuzzKirill

    BuzzKirill

    Joined:
    Nov 14, 2017
    Posts:
    48
    I've been trying to get AR to work, and it seems that the constraints/controllers only work in Play mode? Is that correct? This means there's no way to, for example, create IK animations in the Timeline while being able to preview them in the editor?
     
  2. simonbz

    simonbz

    Unity Technologies

    Joined:
    Sep 28, 2015
    Posts:
    295
    Hi,

    No, you can keyframe animation in timeline with Animation Rigging constraints.

    While constraints will not evaluate by themselves in editor mode, they will work to keyframe animation in both the animation window (2019.2+) and timeline (2019.3+).
     
    GameDeveloper1111 likes this.
  3. BuzzKirill

    BuzzKirill

    Joined:
    Nov 14, 2017
    Posts:
    48
    See, that's my problem right there. I wanted to create a cutscene in the Timeline, with characters moving around and interacting. But if there's no live preview in the Editor, it's virtually impossible to animate them...
     
  4. simonbz

    simonbz

    Unity Technologies

    Joined:
    Sep 28, 2015
    Posts:
    295
    Hi,

    I think you misunderstood my last post.

    What I meant to say is a constraint by itself will not evaluate in the editor, but will evaluate using Timeline or the Animation Window both in editmode and in playmode.

    What version of Unity are you using? We pushed changes to Timeline in Unity 2019.3 to allow the constraints to evaluate in edit mode.
     
    BuzzKirill likes this.
  5. m506

    m506

    Joined:
    Dec 21, 2015
    Posts:
    93
    hi, I am having the same issue as him. The rig wont animate in timeline. I am using Unity 2019.3.13f1 and AR 0.2.6.
    I tried to search and entire internet how to do it but I found nothing. So can I please ask you to post a very quick guide how to make the rigs to update properly in timeline? This is what I did:
    - Selected a target transform from an "two bone IK constraint" (hand)
    - Created a timeline asset for that
    - Hit "record" to start keyframing
    - Moved the transform a few times (hand didn't update but effector gizmo did)

    I guess there's some specific setup we need to do before start keyframing? See picture below for your reference:
    upload_2020-5-26_3-42-44.png

    Please help
    Thanks
     
  6. BuzzKirill

    BuzzKirill

    Joined:
    Nov 14, 2017
    Posts:
    48
    So I just tested it in 2019.3 and yes, it works as long as that Record button is on. Thank you.
    @m506, have you seen the Unity tutorial on how to setup the rig? It's not a very intuitive process, maybe you missed some steps?
     
  7. m506

    m506

    Joined:
    Dec 21, 2015
    Posts:
    93
    Hi, the rig I am using for testing was provided by Unity in one of their workshops, so I must be doing something wrong when trying to record the animation but the rig should be fine, as it works during playmode.

    I uploaded the full project here if anyone is interested:
    https://drive.google.com/drive/folders/1pEtGAgd7hbYqkdjCglzt6Jy5b4lRdAst?usp=sharing

    I am trying to animate the "RightArm_target" from the "NinjaRig_Ramen" model.

    Regards
     
  8. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,195
    Hi @simonbz ,

    I was wondering if there was any way to force animation constrains to evaluate outside of the two contexts you've mentioned so far (Previewing an animation clip or previewing a timeline). I use a 3rd party sequencer tool (Slate), which has Animation tracks than can play animation clips. My Animation Rigging constraints work fine in play mode, but the constraints don't evaluate when an animation clip is played by Slate. I was wondering if there was some global event that can be called to force evaluation? Otherwise, I don't see how basically any 3rd party sequencing tool can be compatible with Animation Rigging?
     
  9. simonbz

    simonbz

    Unity Technologies

    Joined:
    Sep 28, 2015
    Posts:
    295
    dgoyette likes this.
  10. Yecats

    Yecats

    Joined:
    Jul 13, 2014
    Posts:
    69
    @simonbz - I am using Unity 2020.2.1f1 and I cannot use the Animation window to animate. When I have it in record mode, and I move the character's arm around nothing happens. If I have it in play mode, it works fine. See below. What am I missing?

    Edit:
    I have solved my issue. It seems that you have to have the Rig Builder component on the parent game object of the armature rig. In other words, this hierarchy setup does not work:

    • Root (Rig Builder + Animator)
      • Person
        • Armature Rig

    Instead, it should be:
    • Root
      • Person (Rig Builder + Animator)
        • Armature Rig
     

    Attached Files:

    Last edited: Feb 25, 2021
    ProceduralCatMaker likes this.
  11. eliteforcevn

    eliteforcevn

    Joined:
    Oct 25, 2018
    Posts:
    47
    I cant key animation rigging plz help

     
  12. giantkilleroverunity3d

    giantkilleroverunity3d

    Joined:
    Feb 28, 2014
    Posts:
    383
    You'll find if you move your keys in the curve window the model changes but not the other way around.
    Moving the gameobject in the scene window does not change the curve.
    This is what I have found and have not found a fix for this.
     
    eliteforcevn likes this.
  13. giantkilleroverunity3d

    giantkilleroverunity3d

    Joined:
    Feb 28, 2014
    Posts:
    383
    When I press preview the character drops into this pose.
    I have an Blender exported mesh to Mixamo to FBX for Unity imported rig with no animations in Unity from Mixamo. There is no root bone. I create a new anim controller and new empty clip. When I press Unity animation clip preview the model drops from the standing on feet on the ground to the waist level on the ground and the character is crouching. This seems to be the difference from the default position in the import configure. There are very busy supplied animations that this does not happen. In some of the animations the character shifts along the X or Z. What is the fix for this? Is in Blender, Mixamo or Unity dealing with root? TIA
    I eventually dropped the Blender/Rigify effort and went straight to Mixamo as a last resort.
    The model performs the default import animation in Mixamo. Even the fingers are animated.
    It is what all the effort I going this for.
    upload_2021-6-15_23-3-48.png
    Is this some how involved?
    https://docs.unity3d.com/Manual/RootMotion.html
     
    Last edited: Jun 16, 2021
  14. giantkilleroverunity3d

    giantkilleroverunity3d

    Joined:
    Feb 28, 2014
    Posts:
    383
    I have selected my blank animation(meaning no properties) in the project hierarchy inspector and this does not show up because my animations are not pose baked.
    I looked across my project to be sure that this is the difference.
    upload_2021-6-16_11-28-57.png
    Downloaded from Mixamo again this time with animation.
    Found this: https://gamedev.stackexchange.com/questions/162853/how-to-disable-animation-root-motion.
    I was refusing to migrate animations.
    https://discord.com/channels/716252125931372615/793544505059704882/854852439072833536
     
    Last edited: Jun 18, 2021
  15. nimbii82

    nimbii82

    Joined:
    Feb 21, 2021
    Posts:
    6
    Up front warning that I do not fully understand this either and it's been a while since I thought about this. Also, FYI I'm not 100% sure I understand your question. In any event, a while back I noticed that the hanging pose centered on the floor is what you see in the Avatar muscles configuration tab. At the time, since I was using IK for the rig I had not loaded any animation clips, and naively assumed that the static model would have the imported default stance. However, I suspect that in the absence of any animation clips, the rig is defaulting to the hanging pose as shown in the Avatar's muscles configuration? In any case, when I added an animation clip to the animation controller, this hanging pose went away and all IK worked as expected on top of the animation. Not quite sure if this is exactly what you are asking about, but if so hope it helps. Cheers.
     
  16. giantkilleroverunity3d

    giantkilleroverunity3d

    Joined:
    Feb 28, 2014
    Posts:
    383
    Thank you for your post. I wasn't asking. I was posting the steps that I also found out which is 'the imported animation creates a "new" default pose'. This seems to set the transforms and rotations. Then the animation is cut down to a desired key frame of the desired pose.
    I initially got caught up in this because I did not want an animation and did not realize the pose engine needs a 'new' set of data else the hanging/crouch pose is the defacto pose and must be corrected from there. I struggled a long time trying to correct the hanging crouch to what I wanted and had to give up as there were a lot of transforms to 'fix'.
    Now I must blend in other positions.
    The initial confusion stems from the advice that is to work in the T or A pose but when in muscles or preview areas with out an initial imported animation the model defaults to the hanging crouch. So this breaks the mantra of a standard default pose. Unity should resort to what the industry is preaching of a standard T or A pose.
    This would correct so much confusion and frustration.
    This one simple fix by Unity is so needed.
     
    Last edited: Jun 18, 2021
  17. giantkilleroverunity3d

    giantkilleroverunity3d

    Joined:
    Feb 28, 2014
    Posts:
    383
    I found that the hanging crouch default position does not show up when I clear the Avatar item from the Animator.
    I can also use Unity Ik in the animation. I also have a thumb tip to shoulder hierarchy set up that works some what.
    upload_2021-6-22_23-52-28.png
    If I drag the LThumbIK around the thumb bends but the rest of the IK chain doesn't move.
     
    Last edited: Jun 23, 2021
  18. giantkilleroverunity3d

    giantkilleroverunity3d

    Joined:
    Feb 28, 2014
    Posts:
    383
    The goal is to get any humanoid mesh into Unity and rig it into the basic T or A pose with no animations as a default.
    This gives a model that has fingers and no face bones.
    Simple import steps do far.
     

    Attached Files:

  19. Harsh-NJ

    Harsh-NJ

    Joined:
    May 1, 2020
    Posts:
    315
    I'm on Unity 2021.3.1f1 and Animation Rigging 1.2.0 and using Sequences
    The problem is the same, sometimes Animation Rigging constraints do update while in Timeline Preview and/or record mode.... and sometimes not. I workaround this by reloading the scene, or refocusing the timeline, scrub through it and it sometimes does the thing. But most of the times, hands stay in T-Pose while the Hand IK Target is somewhere else. And it never updates in realtime.

    All this happens in edit-mode, while in play-mode everything works as expected.
    The only thing problems me is that when I move the constraints, the rig should reflect it in realtime, right?
     
    akent99 likes this.
  20. akent99

    akent99

    Joined:
    Jan 14, 2018
    Posts:
    588
    I was about to post an almost identical article. Animation Rigging 1.2.0, Sequences, and 2022.1f1. Animation rigging moving of IK targets is not reliable in updating the character while in Editor mode.
    • I opened up Unity 2022.1b12. I can move the hand IK target and the target object moves, but not the hand. I scrub the timeline playhead and the hand then jumps to the IK target.
    • I noticed 2022.1f1 is now out, so I installed that, upgraded the project, and tried again. Now I cannot move the IK target. If I grab and move it, it snaps back to its old position.
    • I turned off the RigBuilder componet. The hand stayed stuck out in a position controlled by the IK target. I could move the IK target again, but the hand did not move. I muted an animation track for the character, no change. I unmuted the animation track and the hand suddenly dropped back beside the character.
    • Turning the RigBuilding component back on, the hand is not following the animation rigging IK target any more.
    Basically in Editor mode, moving IK targets for animation rigging occasionally works, but usually does not. ThT makes it very hard to use as changing weights, components, etc seems to take a while to kick in. I was hoping to try and use VR hand controllers while in Editor mode to move the hand IK targets around as a poor mans mocap.
     
    Harsh-NJ likes this.
  21. Harsh-NJ

    Harsh-NJ

    Joined:
    May 1, 2020
    Posts:
    315
    Yes! But try updating timeline package using the same method as for animation rigging (package manager > install package by name > "com.unity.timeline") it installs v1.7.1
    Now the IKs always update, but only after scrubbing the timeline... BUT not in realtime. I don't get any live feedback if I move the target, but hand updates when I change the frame in timeline. But I don't get that T-Pose stuck back again!
     
  22. akent99

    akent99

    Joined:
    Jan 14, 2018
    Posts:
    588
    Unfortunately I am using Timeline 1.7.1 already. It is the standard package in the Cinematic Studio feature for 2022.1.1f1.
     
  23. simonbz

    simonbz

    Unity Technologies

    Joined:
    Sep 28, 2015
    Posts:
    295
    Hi @akent99,

    Do you have the same problem when using Timeline and Animation Rigging without sequences?
    In any case, is it possible to submit a bug for this. We'll have a look!
     
  24. akent99

    akent99

    Joined:
    Jan 14, 2018
    Posts:
    588
    I only normally use Animation Rigging with Sequences (they are both useful!). The 1.2 release for Animation Rigging was a big step forwards in this regard. A part of the challenge is creating a small enough project to upload. (My normal projects are like 15gb - painful to upload!) I don't know if smaller projects play up in the same way. And of course user error is possible.... oh, I think I got something close working and uploaded - IN-4358. It is not playing up in the same way, but I was trying to get something close going quickly.

    Here is a quick screen recording of what I was doing:
    - this is Timeline, no Sequences.

    Here is the sort of thing I am creating - just simple stuff. Animation rigging makes it much quicker than trying to do full mocap for these sorts of shots. I can get precise movements of hands etc with respect to furniture (which is hard with mocap). This link is staged - it might go away in a week or two: https://extra-ordinary-episodes--staging-udjgolu9.web.app/episodes/ep3/ep3-30-410

    My goal was to see if I could use VR hand controllers to live position the IK targets as poor man's mocap. (But there is no IK target for the head, so not sure how well it would work really.) I don't want to use Play mode as normally that is how you trigger a render with Sequences and Timeline recorders etc. I also want to update (and save) the scene position for things - so it needs to be in Edit mode. I wanted to position everything, then turn on recording after dry runs instead of creating recordings all the time just to try things (if that makes sense). Its workflow efficiency related.
     
    Last edited: May 30, 2022
  25. akent99

    akent99

    Joined:
    Jan 14, 2018
    Posts:
    588
    Oh, a bit more fun, when I exited Unity immediately afterwards it crashed. Here is a snippet out of the crash dump file.

    Code (csharp):
    1. =================================================================
    2.     Native Crash Reporting
    3. =================================================================
    4. Got a UNKNOWN while executing native code. This usually indicates
    5. a fatal error in the mono runtime or one of the native libraries
    6. used by your application.
    7. =================================================================
    8.  
    9. =================================================================
    10.     Managed Stacktrace:
    11. =================================================================
    12.       at <unknown> <0xffffffff>
    13.       at System.Object:__icall_wrapper_mono_marshal_isinst_with_cache <0x00078>
    14.       at System.Object:__castclass_with_cache <0x0007a>
    15.       at Enumerator:MoveNext <0x00162>
    16.       at System.Buffers.TlsOverPerCoreLockedStacksArrayPool`1:Trim <0x001c4>
    17.       at System.Buffers.TlsOverPerCoreLockedStacksArrayPool`1:Gen2GcCallbackFunc <0x00042>
    18.       at System.Gen2GcCallback:Finalize <0x000ac>
    19.       at System.Object:runtime_invoke_virtual_void__this__ <0x0008b>
    20. =================================================================
    21. Crash!!!
    22. SymInit: Symbol-SearchPath: 'C:/Program Files/Unity/Hub/Editor/2022.1.1f1/Editor/Data/Mono;.;C:\Users\alanj\Unity Projects\XOrd-rig-bug;C:\Users\alanj\Unity Projects\XOrd-rig-bug\Library\BurstCache\JIT;C:\Program Files\Unity\Hub\Editor\2022.1.1f1\Editor;C:\Windows;C:\Windows\system32;SRV*C:\websymbols*http://msdl.microsoft.com/download/symbols;', symOptions: 534, UserName: 'alanj'
    23. OS-Version: 10.0.0
     
  26. Harsh-NJ

    Harsh-NJ

    Joined:
    May 1, 2020
    Posts:
    315
    Well, what exactly did you do to make it (partially, but still) work? I can see the hand to move along with the IK target?
     
  27. akent99

    akent99

    Joined:
    Jan 14, 2018
    Posts:
    588
    In the simple case, if the record mode is on in an override animation track it moved, I turned record mode off and it stopped moving. So you have to record an animation to see what IK is doing. I was expecting to be able to move IK targets around and see their effect without having to record their values (then use Add Key or similar to record the value). I will try to repeat the full tests later when I get a chance.
     
  28. Harsh-NJ

    Harsh-NJ

    Joined:
    May 1, 2020
    Posts:
    315
    As far As I know, the Rig constrains only evaluate in edit mode (ie not in Play mode) if the record mode is on. Some Rig Builder's Graph method is executed then...
    So It only works while recording! which is working For You!!!
    And that's not working for me (in realtime)
    So you should have no problems!

    In short, you are getting what is being excepted from Timeline and Animation Rigging...
    I guess I should Update Unity to a newer release...
     
  29. akent99

    akent99

    Joined:
    Jan 14, 2018
    Posts:
    588
    Hmmm. In the previous example I wrote up (in the full environment) it was partly working in non-record, edit mode. If I moved the playhead, it would kick in and move the hand (without being in record mode). Then another time, when I tried to move the target, it would snap back immediately. It was behaving differently at times, and inconsistently.

    In the smaller project, it only snaps back if I scrub the playhead (not immediately). So upon reflection, the upload is probably a waste of time. The small project is working "fine" if its only expected to work in Record mode. I also tried with sequences and it behaved the same. And trying again on my big project today, its all behaving at the moment the consistently (no weird behavior). So it must have got itself in some internal mixed up state, which I cannot repeat.

    So sorry for the false alarm, the uploaded project can be ignored. I suspect some code threw an exception and got it into some weird state.
     
  30. akent99

    akent99

    Joined:
    Jan 14, 2018
    Posts:
    588
    I will say that Animation Rigging 1.2 (you have to add it via adding Git URL of "com.unity.animation.rigging" to get the 1.2 code - the feature set for 2022.1f1 still uses version 1.1 it appears) definitely fixed problems when being used with Sequences. Before that I was getting lots of exceptions which made it not always update. I don't know if you need to update the base version of Unity as well to use 1.2, but you might try just updating that package first to see if it fixes things.
     
  31. Harsh-NJ

    Harsh-NJ

    Joined:
    May 1, 2020
    Posts:
    315
    I am already on 1.2.0
     
  32. Harsh-NJ

    Harsh-NJ

    Joined:
    May 1, 2020
    Posts:
    315
    Oh! I forgot to post here... Now it's apparently working consistently without updating anything!
     
    akent99 likes this.
  33. NotEvenTrying

    NotEvenTrying

    Joined:
    May 17, 2017
    Posts:
    43
    Just want to add that it is not working for me with Animation Rigging 1.2.1 - to be more exact, when editing the animation in the "Animation" window, scrubbing along the timeline the IK seems to fall at least one entire frame behind, and when there are changes only 1 frame apart, the only way to correct the IK is to hit play or to turn off recording mode and turn it back on. The IK seems to be updated too early in the chain of internal updates, where its falling 1 frame behind. Doesn't actually prevent me from working, but it is extremely annoying, and slows me down noticeably. It's really surprising to me that this has not been officially addressed yet...
     
  34. fleity

    fleity

    Joined:
    Oct 13, 2015
    Posts:
    345
    I feel similar about this. I am on version 1.2.1 and timeline preview is not working reliably (okay I am doing a bunch of stuff on top in the track which might cause a few issues. I am calling Rigbuilder.StartPreview manually with the mixer playable)