29-12-2020, 09:26 AM
(This post was last modified: 29-12-2020, 09:40 AM by josemendez.)
(29-12-2020, 01:00 AM)fluidman84 Wrote: My apologies, but I'm not finding the Obi solver manual update methods as I am the Final IK examples for disabling / enabling. I've tried this, but it does not appear to have solved the issue.
Code:using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using RootMotion.FinalIK;
using Obi;
public class IK_LateUpdate : MonoBehaviour
{
// Array of IK components that you can assign from the inspector.
// IK is abstract, so it does not matter which specific IK component types are used.
public IK[] components;
public ObiFixedUpdater obifixedupdater;
void Start()
{
// Disable all the IK components so they won't update their solvers. Use Disable() instead of enabled = false, the latter does not guarantee solver initiation.
foreach (IK component in components) component.enabled = false;
ObiProfiler.DisableProfiler();
}
void FixedUpdate()
{
// Updating the IK solvers in a specific order.
foreach (IK component in components) component.GetIKSolver().Update();
ObiProfiler.EnableProfiler();
}
}
In your code, you’re just enabling/disabling Obi’s built in profiler. Needless to say that won’t update the simulation. (Or profile it, as there’s nothing to profile there

You can derive from the ObiUpdater class to update Obi whenever you want, as suggested in thr manual:
http://obi.virtualmethodstudio.com/tutor...aters.html
To do this, just look up ObiUpdater in the API docs:
http://obi.virtualmethodstudio.com/api.html
You'll see it has several methods to advance the simulation: BeginStep, Substep, EndStep, and Interpolate. You can also check the different existing subclasses of ObiUpdater (ObiFixedUpdater, ObiLateUpdater, etc) for examples on how/when to call these methods. The typical pattern would be:
Code:
BeginStep();
Substep();
Substep();
.
.
.
Substep();
EndStep();
Interpolate();
So: one call to BeginStep() (performs collision detection and clears up cached data), one or more calls to Substep() (advances simulation), one call to EndStep(); (calls collision callbacks) and one call to Interpolate(); (interpolates physics state and triggers rendering).
The simplest thing for you to do is to just make a copy of ObiFixedUpdater, and then insert the FinalIK update code
in the appropiate place.
Note this isn’t the only possible solution. You just need things to update in a specific order, so you can also use Unity’s script execution order to explicitly set the order in which components should be updated, instead of writing a single component that updates both Obi and FinalIK. See: https://docs.unity3d.com/Manual/class-MonoManager.html