Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Deactivating the obi solver when not needed ?
#13
(14-05-2021, 12:08 PM)josemendez Wrote: Got it. The rope actor is being included in the solver, so the solver constraint network needs to be rebuilt. Since this is a time consuming process, the solver uses a "dirty" flag to signal that constraints should be rebuilt at the start of the next frame. This allows to add many actors at once without having to rebuild everything immediately after adding each one.

So what's happening is that your scripts' Start() function is called right away and disables the solver. This prevents the constraints from being rebuilt. The attachment finds that the actors are loaded in the solver, so it tries to access the constraints (that haven't been built yet, since the solver is disabled). This is what causes the out of bounds.

There's several ways to work around this, the simplest one is waiting for one frame before disabling the solver:

Code:
IEnumerator Start()
{

        yield return 0;
    solver.enabled = false;
}

That should fix it Sonrisa
Perfect.

Have a nice day Sonrisa
Reply


Messages In This Thread
RE: Deactivating the obi solver when not needed ? - by VincentAbert - 14-05-2021, 03:34 PM