15-04-2019, 10:07 AM
Hey, developer of Final IK here...
ObiCloth disables the Animator and updates it via ObiAnimatorController when the Obi solver begins, then feeds the results to the cloth for processing. That does not allow Final IK to be updated after the animation and before the cloth simulation, so it will be out of sync no matter how you set up the Script Execution Order.
So basically, you will need to make sure that whenever Animator is updated, Final IK will also be updated and that must be before the cloth solver begins. To do that, you'll need to make a few changes to ObiAnimatorController.cs.
First, add
to the top of the file. It will not compile, because Obi uses assembly definition files. So you'll also need to create assembly definitions for Final IK:
1. Add a new assembly definition file (Create/Assembly Definition) to Plugins/RootMotion, name it "RootMotion". Then another one to Plugins/RootMotion/Editor, name it "RootMotionEditor".
2. Select the RootMotionEditor.asmdef file, add RootMotion.asmdef to the Assembly Definition References, deselect every platform except Editor.
3. Go to Obi/Scripts/Obi.asmdef and add RootMotion.asmdef to it's Assembly Defition References.
4. If you get an error about some ScriptableObject stuff when you select an object with IK, just right-click on Plugins/RootMotion and select Reimport, it's a Unity bug.
Now you can reference RootMotion scripts from Obi scripts. continue to edit ObiAnimatorController like so:
1. Add this:
2. Add this to the line just after animator.Update(updateDelta);
3. Assign all the IK components you wish to use to the ObiAnimatorController in the Editor.
That makes sure the IK components get updated in sync with Obi.
ObiCloth disables the Animator and updates it via ObiAnimatorController when the Obi solver begins, then feeds the results to the cloth for processing. That does not allow Final IK to be updated after the animation and before the cloth simulation, so it will be out of sync no matter how you set up the Script Execution Order.
So basically, you will need to make sure that whenever Animator is updated, Final IK will also be updated and that must be before the cloth solver begins. To do that, you'll need to make a few changes to ObiAnimatorController.cs.
First, add
Code:
using RootMotion.FinalIK;
1. Add a new assembly definition file (Create/Assembly Definition) to Plugins/RootMotion, name it "RootMotion". Then another one to Plugins/RootMotion/Editor, name it "RootMotionEditor".
2. Select the RootMotionEditor.asmdef file, add RootMotion.asmdef to the Assembly Definition References, deselect every platform except Editor.
3. Go to Obi/Scripts/Obi.asmdef and add RootMotion.asmdef to it's Assembly Defition References.
4. If you get an error about some ScriptableObject stuff when you select an object with IK, just right-click on Plugins/RootMotion and select Reimport, it's a Unity bug.
Now you can reference RootMotion scripts from Obi scripts. continue to edit ObiAnimatorController like so:
1. Add this:
Code:
public IK[] IKComponents;
private void Start()
{
foreach (IK ik in IKComponents)
{
ik.enabled = false;
}
}
2. Add this to the line just after animator.Update(updateDelta);
Code:
foreach (IK ik in IKComponents)
{
ik.GetIKSolver().Update();
}
3. Assign all the IK components you wish to use to the ObiAnimatorController in the Editor.
That makes sure the IK components get updated in sync with Obi.