Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Bug / Crash  Obi adding huge forces to rigidbodies when you delete ropes... (Repro project)
#2
Hi,

Thanks for the repro!

First thing that caught my eye in your scene is that the ropes are not children of the solver, yet they seem to work. Debugging trough the code to see why, I see you've modified ObiActor's SetSolver() method like this:


Quote:protected void SetSolver(ObiSolver newSolver)
        {
            if(newSolver == null)
                newSolver = ObiStatic.WorldSolver;


            // In case the first solver up our hierarchy is not the one we're currently in, change solver.
            if (newSolver != m_Solver)
            {
                RemoveFromSolver();

                m_Solver = newSolver;

                AddToSolver();
            }
        }

When ropes are not children of any solver, they'll pick up your static solver instead regardless of where's located in the scene. This *might* not work in all cases, because lots of operations that convert back and forth between solver and actor space assume the solver is a parent of the actor. This is specially true for inertial forces. Can't really say what side effects you'll hit down the road by doing this, would have to look at it in detail.

As for the bug, I've narrowed it down: the solver was trying to read rigidbody velocities from uninitialized memory positions. Modify ObiSolver's EnsureRigidbodyArraysCapacity() method to look like this:



Code:
public void EnsureRigidbodyArraysCapacity(int count)
{
            if (count >= rigidbodyLinearDeltas.count)
            {
                rigidbodyLinearDeltas.ResizeInitialized(count);
                rigidbodyAngularDeltas.ResizeInitialized(count);

                if (initialized)
                    m_SolverImpl.SetRigidbodyArrays(this);
            }
}

That will fix it.

Let me know if I can be of further help. cheers!
Reply


Messages In This Thread
RE: Obi adding huge forces to rigidbodies when you delete ropes... (Repro project) - by josemendez - 20-05-2021, 09:08 AM