Final IK + Timeline

744 views
Skip to first unread message

Morphy

unread,
Aug 14, 2021, 3:36:19 PM8/14/21
to Final IK
Hello,

How can I get Final IK to evaluate in edit mode when updated from a custom timeline clip? Here's my attempt (the relevant snippet from ProcessFrame in my LookAtMixer):

public override void ProcessFrame(...) {
  for (int i = 0; i < playable.GetInputCount(); ++i) {
    // compute finalPosition and finalWeight from the clips.
  }

  if (ik.solver.target != null) ik.solver.target = null;
  ik.solver.SetIKPosition(finalPosition);
  ik.solver.SetLookAtWeight(finalWeight);
  if (!Application.isPlaying) {
    if (ik.fixTransforms) ik.GetIKSolver().FixTransforms();
    ik.GetIKSolver().Update();
  }
}

General pointers to reading material / tutorials on how to best setup Final IK with Unity Timeline would also be appreciated.

Khaled

Pärtel Lang

unread,
Aug 16, 2021, 6:33:28 AM8/16/21
to Final IK
Hey,
I haven't actually tried to run LookAtIK from Timeline, but all IK components can be run from editor. There's the EditorIK component in the package that takes care of that. Normally EditorIK can be used like this:

1. Add an IK component to the character
2. Add EditorIK to the same gameobject
3. Create/Final IK/EditorIK Pose
4. Assign the created pose as "Default Pose" in EditorIK
5. Click on the "Store Default Pose" button in EditorIK (only appears when default pose is assigned)
6. Click on the "Start Solver" button.

That should get the solver running for you in the editor.
Perhaps you could make a copy of EditorIK and replace public void Update() with your ProcessFrame. I'd try it here, but don't have the rest of your LookAtMixer stuff.

Best,
Pärtel

Morphy

unread,
Aug 16, 2021, 3:07:08 PM8/16/21
to Pärtel Lang, Final IK
Thanks, Pärtel. 

I'm aware of the EditorIK component. I followed your recommendation and followed the implementation of its Update() more closely. It still doesn't quite work. I've attached a minimal version of my script. All the classes are in the attached file.
Apologies if my previous message didn't provide the full context: the challenge here is running Final IK alongside an animation track and overriding its output.
Both versions of the script (the attached version and the one in my previous message) work if I mute the animation track. Please note that "work" here means that they're able to affect the animation output whatsoever, even if the result is incorrect - I've commented out the pose restoration code for now.

The solutions I can think of:
- Wrap Final IK solvers in Animation Jobs. This seems quite involved and I'm hoping to avoid going down this route. Having that said, you've indicated in your FAQ that you ran a test for some of the IK solvers using Animation Jobs. If you still have the code around and are able to share it, it might be a great reference.
- Rely on the solvers that come with Unity's Animation Rigging package instead. They're already written as Animation Jobs, but the issue is that these solvers are pretty basic and the quality isn't nearly as good as Final IK.
- Bake Final IK into an animation clip and put it in an override track. This only partially solves the problem. It would enable tuning other parts of the Timeline on top of Final IK in edit mode, but wouldn't enable tuning Final IK itself.
- Store the pose when Timeline is running, exit preview mode, restore the pose, tune Final IK then go back to Timeline preview. I haven't tested it, but I think it should work. It still wouldn't enable scrubbing through the timeline to fine tune Final IK and it wouldn't enable tuning other parts of the Timeline on top of Final IK.
- Tune Final IK in play mode. This is what I'm currently doing, but it's a bit tedious, especially that I'm at a point in the project where entering play mode is quite slow.

Other ideas :)?

Khaled


--
You received this message because you are subscribed to a topic in the Google Groups "Final IK" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/final-ik/E3-imv0DKUY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to final-ik+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/final-ik/d58fde92-f30b-41ed-b28c-26623e823454n%40googlegroups.com.
LookAtClip.cs

Jake Slack

unread,
Feb 7, 2024, 9:32:51 PM2/7/24
to Final IK
Hi Morphy,

Could you let me know if you managed to find a solution to use FinalIK effectively in the Unity timeline?

Any help is very much appreciated as I am running into the same issues.

Thanks, Jake

Veltry CV2

unread,
Feb 12, 2025, 1:14:00 AMFeb 12
to Final IK
yo shit got hacked dm me at "_._together_._" on discord

Reply all
Reply to author
Forward
0 new messages