27-11-2020, 03:16 PM
(This post was last modified: 27-11-2020, 03:22 PM by josemendez.)
You're not checking if the collider reported by the contact is the player, you're merely checking if the player exists. Since this is probably always true, any collider relatively close to the fluid will be destroyed.
Correct solution:
Correct solution:
Code:
void Solver_OnCollision(object sender, Obi.ObiSolver.ObiCollisionEventArgs e)
{
var world = ObiColliderWorld.GetInstance();
foreach (Oni.Contact contact in e.contacts)
{
// this one is an actual collision:
if (contact.distance < 0.01)
{
ObiColliderBase collider = world.colliderHandles[contact.other].owner;
if (collider == player)
GameObject.Destroy(collider.gameObject);
}
}
}