13-05-2024, 06:18 PM
I think I finally figured out the issue; the problem was that I have multiple ropes in my scene, where each one has its own solver, and each solver is registered to one obi fixed updater. When I was marking the pin constraints as dirty, it was only affecting one of the ropes but the rest remained ignorant of the index change. My solution is to call this instead:
With this, I don't need each pin to actively poll for changes.
So in summary, if an obi collider is destroyed anywhere in the scene, all solvers need to be made aware by having their constraints marked as dirty. A simple issue, but really hard to find since the index errors I was getting gave me zero context.
Code:
public void NotifyColliderDeleted() {
int dirtyMask = 1 << (int)Oni.ConstraintType.Pin;
for (int i = 0; i < fixedUpdater.solvers.Count; i++) {
fixedUpdater.solvers[i].dirtyConstraints |= dirtyMask;
}
}
With this, I don't need each pin to actively poll for changes.
So in summary, if an obi collider is destroyed anywhere in the scene, all solvers need to be made aware by having their constraints marked as dirty. A simple issue, but really hard to find since the index errors I was getting gave me zero context.