11-02-2020, 01:44 PM
I'm using Obi Rope 5.1 and i need detect collisions (or lack of collisions) between two ropes. I put two ropes with different tags under common Obi Solver and and I received messages from ObiSolver.OnCollision.
But i did not get collider of another rope.
How I can get collision between two ropes?
Code:
private void M_ObiSolver_OnCollision(ObiSolver solver, ObiSolver.ObiCollisionEventArgs contact)
{
foreach (Oni.Contact contactItem in contact.contacts)
{
ObiSolver.ParticleInActor pa = solver.particleToActor[contactItem.particle];
Component collider;
if (ObiCollider.idToCollider.TryGetValue(pa.actor.GetInstanceID(), out collider))
{
//avoid floor collision
if (collider.CompareTag("floorTag"))
return;
if (contactItem.distance < 0.01)
{
if (!pa.actor.CompareTag(collider.tag))
{
print($"rope({pa.actor.name}) touched another rope({collider.name})");
}
else if (pa.actor.CompareTag(collider.tag))
{
print($"rope({pa.actor.name}) touched itself({collider.name})");
}
}
}
}
}
But i did not get collider of another rope.
How I can get collision between two ropes?