14-05-2021, 12:08 PM
(This post was last modified: 14-05-2021, 12:15 PM by josemendez.)
(14-05-2021, 11:49 AM)VincentAbert Wrote: Thank you so much for taking the time to do all of this, I think I understand what we did differently : You launch the game and then pause the solver, whereas I actually stop it in the start function of a script. (i do get the error in the sample scenes this way)
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