13-02-2021, 08:03 PM
(This post was last modified: 13-02-2021, 08:11 PM by josemendez.)
Hi Matt,
There's a couple things at play in this:
- There seems to be a bug in ObiSolver, introduced in 6.0 (thanks a bunch for reporting this!!), that causes entries in the particlesInActor array to be incorrectly flagged as "occupied" when disabling an actor. I still have to analyze it greater detail, but as far as I could reason it seems the culprit is a missing call in the solver's RemoveActor() method. Line 1145 should be:
So the entire method looks like this:
You can try this yourself, the entries in particleInActor should no longer be null. A patch will be available by monday.
- The BallPool test scene contains a spawner object that sets the phase of the balls after spawning them. However, when an actor is enabled it copies all its data from the blueprint, except for positions and velocities . This means the ball's phase will revert to the one set in the blueprint if you manually deactivate/reactivate it. This will cause the ball to no longer collide with other actors sharing the same phase. This is the default behavior since Obi 4.X, so it should work the same way in 5.X and 6.X too.
For instance if you spawn a second ball in the scene, deactivate it and reactivate it, its phase will revert to 0. Now both have the same phase and won't collide with each other.
Let me know how it goes,
There's a couple things at play in this:
- There seems to be a bug in ObiSolver, introduced in 6.0 (thanks a bunch for reporting this!!), that causes entries in the particlesInActor array to be incorrectly flagged as "occupied" when disabling an actor. I still have to analyze it greater detail, but as far as I could reason it seems the culprit is a missing call in the solver's RemoveActor() method. Line 1145 should be:
Code:
FreeParticles(actor.solverIndices);
So the entire method looks like this:
Code:
public bool RemoveActor(ObiActor actor)
{
if (actor == null)
return false;
// Find actor index in our actors array:
int index = actors.IndexOf(actor);
// If we are in charge of this actor indeed, perform all steps necessary to release it.
if (index >= 0)
{
actor.UnloadBlueprint(this);
for (int i = 0; i < actor.solverIndices.Length; ++i)
particleToActor[actor.solverIndices[i]] = null;
FreeParticles(actor.solverIndices);//<----ADD THIS LINE
actors.RemoveAt(index);
actor.solverIndices = null;
// If this was the last actor in the solver, tear it down:
if (actors.Count == 0)
Teardown();
return true;
}
return false;
}
- The BallPool test scene contains a spawner object that sets the phase of the balls after spawning them. However, when an actor is enabled it copies all its data from the blueprint, except for positions and velocities . This means the ball's phase will revert to the one set in the blueprint if you manually deactivate/reactivate it. This will cause the ball to no longer collide with other actors sharing the same phase. This is the default behavior since Obi 4.X, so it should work the same way in 5.X and 6.X too.
For instance if you spawn a second ball in the scene, deactivate it and reactivate it, its phase will revert to 0. Now both have the same phase and won't collide with each other.
Let me know how it goes,