Thanks for the help once again.
I'm trying a different approach for now, I'll try to actually kill the particles in contact with the dropper tip while applying suction.
I'm stuck already though, I can't get the index of those particles. I followed your instructions from the manual page about the trigger volume that reverses the gravity of the particles touching it, but I'm getting different results.
I'm getting a ton of collisions from the solver, but apparently all of them are untagged even though my dropper has tags on the rigidbody and also on the trigger colllider. I also tried to directly compare the colliderbase gameobject reference with the dropper gameobject that has the trigger collider on it, but that never produces a match either. It looks like some contacts are simply missing from collisioneventargs.
I'm trying a different approach for now, I'll try to actually kill the particles in contact with the dropper tip while applying suction.
I'm stuck already though, I can't get the index of those particles. I followed your instructions from the manual page about the trigger volume that reverses the gravity of the particles touching it, but I'm getting different results.
Code:
void Solver_OnCollision(object sender, Obi.ObiSolver.ObiCollisionEventArgs e)
{
// calculate an acceleration that counteracts gravity:
Vector4 antiGravityAccel = -(Vector4)solver.parameters.gravity * antiGravityScale * Time.deltaTime;
var world = ObiColliderWorld.GetInstance();
foreach (Oni.Contact contact in e.contacts)
{
// this one is an actual collision:
if (contact.distance < 0.01)
{
ObiColliderBase col = world.colliderHandles[contact.bodyB].owner;
// if this collider is tagged as "zero gravity":
if (col != null && col.gameObject.CompareTag("zeroGravity"))
{
// get the index of the particle involved in the contact:
int particleIndex = solver.simplices[contact.bodyA];
// set the particle velocity:
solver.velocities[particleIndex] += antiGravityAccel;
}
}
}
}
}
I'm getting a ton of collisions from the solver, but apparently all of them are untagged even though my dropper has tags on the rigidbody and also on the trigger colllider. I also tried to directly compare the colliderbase gameobject reference with the dropper gameobject that has the trigger collider on it, but that never produces a match either. It looks like some contacts are simply missing from collisioneventargs.