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)
#3
(20-05-2021, 09:08 AM)josemendez Wrote: 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.

The global solver prefab gets instantiated with an identity transformation (pos 0,0,0, rotation 0,0,0,1, scale 1,1,1) and doesn't move, so I dunno if it'd actually show up as an issue. BUT, I could look at modifying the code to work when those assumptions can't be applied.

Also, do you think fixing this issue would also fix some of the side effects of the DontDestroyOnLoad() problem mentioned in the other post?

(20-05-2021, 09:08 AM)josemendez Wrote: 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.

Are there any other places in the code where a similar issue will take place?

It appears like some sort of initialization takes place in an unexpected order, judging from the change. I'm not sure what my approach to using ObiSolver would screw up outside of this.

I was considering having it be the case that all ropes that are meant to be controlled by the global solver are parented to it. However, this approach might not work well since some prefabs will also contain ropes, and reparenting child objects could have problems:
  • If a prefab uses GetComponentInChildren to find obi rope references, they'd stop working unexpectedly. Or when writing new behaviours, it might be easy to forget that that rope which was originally in the prefab is no longer there after being instantiated.
  • If a prefab is destroyed at runtime as a whole, you'd have ropes left-over that don't get destroyed with the rest of the prefab.
Reply


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