Search Unity

  1. We are migrating the Unity Forums to Unity Discussions by the end of July. Read our announcement for more information and let us know if you have any questions.
    Dismiss Notice
  2. Dismiss Notice

What is the best way to do IK animation in Timeline with Sequences package?

Discussion in 'Virtual Production' started by akent99, Sep 12, 2021.

  1. akent99

    akent99

    Joined:
    Jan 14, 2018
    Posts:
    588
    I am finding I would like to pose say hand positions for a character in a Timeline when using the Sequences package. I am using a 3-level deep sequence timeline (I used Episode / Location / Shot for the 3 levels of hierarchy at the moment).

    For example, I have a character, but I want to put their hand on the desk. I don't want to hand animate every bone one by one - I would much prefer an IK solution.

    I have tried Animation Rigging (1.1.1) with Sequences, but hit the following problems
    • Its a runtime constraint system - you have to enter "play mode" to see the results. Flipping between edit and play mode with Sequences is painful (slow to change, you have to refocus the current sequence, etc - and if you have the timeline playing when you enter play mode, you have to turn that off).
    • I read in forums that "record" mode will also make Animation Rigging work, so you can see the result. This might be true, but has not worked for me with the 2 bone constraint. I can record moving the hints around, but you cannot see the effect in preview mode or record mode.
    • When I enter play mode, my character jumps back to 0,0,0 for some bizarre reason (I have "apply scene offsets" on for the track). So I cannot even tell if it will work in Play mode.
    • As soon as I exit play mode, I get lots of Console exceptions thrown, I think due to m_RuntimeRigLayers being null.
    Code (csharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. UnityEngine.Animations.Rigging.RigBuilder.BuildPreviewGraph (UnityEngine.Playables.PlayableGraph graph, UnityEngine.Playables.Playable inputPlayable) (at Library/PackageCache/com.unity.animation.rigging@1.1.1/Runtime/AnimationRig/RigBuilder.cs:197)
    3. UnityEngine.Timeline.AnimationTrack.CreateMixerPlayableGraph (UnityEngine.Playables.PlayableGraph graph, UnityEngine.GameObject go, UnityEngine.Timeline.IntervalTree`1[T] tree) (at Library/PackageCache/com.unity.timeline@1.6.1/Runtime/Animation/AnimationTrack.cs:644)
    4. UnityEngine.Timeline.TrackAsset.CreatePlayableGraph (UnityEngine.Playables.PlayableGraph graph, UnityEngine.GameObject go, UnityEngine.Timeline.IntervalTree`1[T] tree, UnityEngine.Playables.Playable timelinePlayable) (at Library/PackageCache/com.unity.timeline@1.6.1/Runtime/TrackAsset.cs:774)
    5. UnityEngine.Timeline.TimelinePlayable.CreateTrackPlayable (UnityEngine.Playables.PlayableGraph graph, UnityEngine.Playables.Playable timelinePlayable, UnityEngine.Timeline.TrackAsset track, UnityEngine.GameObject go, System.Boolean createOutputs) (at Library/PackageCache/com.unity.timeline@1.6.1/Runtime/TimelinePlayable.cs:202)
    6. UnityEngine.Timeline.TimelinePlayable.CompileTrackList (UnityEngine.Playables.PlayableGraph graph, UnityEngine.Playables.Playable timelinePlayable, System.Collections.Generic.IEnumerable`1[T] tracks, UnityEngine.GameObject go, System.Boolean createOutputs) (at Library/PackageCache/com.unity.timeline@1.6.1/Runtime/TimelinePlayable.cs:135)
    7. UnityEngine.Timeline.TimelinePlayable.Compile (UnityEngine.Playables.PlayableGraph graph, UnityEngine.Playables.Playable timelinePlayable, System.Collections.Generic.IEnumerable`1[T] tracks, UnityEngine.GameObject go, System.Boolean autoRebalance, System.Boolean createOutputs) (at Library/PackageCache/com.unity.timeline@1.6.1/Runtime/TimelinePlayable.cs:115)
    8. UnityEngine.Timeline.TimelinePlayable.Create (UnityEngine.Playables.PlayableGraph graph, System.Collections.Generic.IEnumerable`1[T] tracks, UnityEngine.GameObject go, System.Boolean autoRebalance, System.Boolean createOutputs) (at Library/PackageCache/com.unity.timeline@1.6.1/Runtime/TimelinePlayable.cs:86)
    9. UnityEngine.Timeline.TimelineAsset.CreatePlayable (UnityEngine.Playables.PlayableGraph graph, UnityEngine.GameObject go) (at Library/PackageCache/com.unity.timeline@1.6.1/Runtime/TimelineAsset.cs:409)
    10. UnityEngine.Playables.PlayableAsset.Internal_CreatePlayable (UnityEngine.Playables.PlayableAsset asset, UnityEngine.Playables.PlayableGraph graph, UnityEngine.GameObject go, System.IntPtr ptr) (at <034e42dfc48f4911988983b3b27bcd25>:0)
    11. UnityEngine.Timeline.DirectorControlPlayable:ProcessFrame(Playable, FrameData, Object) (at Library/PackageCache/com.unity.timeline@1.6.1/Runtime/Playables/DirectorControlPlayable.cs:123)
    Is there a better way to IK pose characters in a Timeline without going into Play mode? Ideally in an Override track. I mean Animation Rigging seems like the right functionality - I just want it to work in Edit / Preview etc so I can use it with Sequences and Timelines and see the results immediately.

    Play mode of loses most changes when you exit play mode, so being in play mode when authoring acting etc is not ideal. (Hmm, next hack experiment might be to put [ExecuteEverywhere] on Animation Rigging stuff and see if I can just make it do constraints in Edit mode as well!!!
     
  2. simonbz

    simonbz

    Unity Technologies

    Joined:
    Sep 28, 2015
    Posts:
    295
    Hi,

    Animation Rigging will work in Timeline both in edit mode and play mode, so you should be able to use Timeline to pose your character.

    Did you create an override track to work with? If you have enabled recording on that track, then every modification you make should be picked up and reevaluated in Timeline. You should be able to pose your character this way. Alternatively, you can also do the same thing in the animation window clip per clip (clip can be read-only) just by going in preview.
     
  3. akent99

    akent99

    Joined:
    Jan 14, 2018
    Posts:
    588
    Turned out there are bugs in the new Sequences support. It gives me lots of stack traces in console which is why it did not work. (Copy and paste of some character in a timeline without Sequences worked perfectly.) I reported some more stack traces on another thread and someone from Unity reported they could repeat it and created an internal ticket.
     
  4. ellka

    ellka

    Unity Technologies

    Joined:
    Jun 17, 2019
    Posts:
    71
    Indeed, we have a bug and an investigation tasks to track this work.

    Thanks @simonbz for the precision! That'll actually also help on our side for the investigation.
    I hoped that the errors wouldn't block everything as much as it looks like.

    @akent99, we'll keep you posted with any update!
     
  5. akent99

    akent99

    Joined:
    Jan 14, 2018
    Posts:
    588
    Thanks. I have heaps of other things to do and can just avoid using the feature - the suggested workarounds (on a different thread) did not work for me. There are at least 3 distinct stack traces I hit so there may be more than one bug lurking in the code. Animation Rigging definitely looks useful though in combination with Sequences and live recording, so I look forward to the fix when available.
     
  6. ShiningMichal

    ShiningMichal

    Joined:
    May 9, 2016
    Posts:
    3
    Still not fixed?
     
  7. akent99

    akent99

    Joined:
    Jan 14, 2018
    Posts:
    588
    It is fixed! I am using 2022.1b12 with Timeline 1.7.0-pre.2, Sequences 1.1.0 and Animation Rigging 1.2.0. I am not sure the exact versions needed, but I am using with these versions and it is working now \o/. (I suspect Animation Rigging 1.2.0 is the important one - I might have added it via Git URL... cannot remember now.)
     
    tantx likes this.