21-04-2022, 11:07 AM
(21-04-2022, 10:37 AM)josemendez Wrote: Hi there,
Collisions between actors (rope and cloth, for instance) should happen automatically by default, unless you have changed the collision filters in either actor to specify otherwise.
You talk about "detecting the particle collisions", so I take it you're using a script to detect the contacts at runtime? can you share the script you're using?
Code:
private void Awake()
{
solver = this.GetComponentInParent<ObiSolver>();
}
private void OnEnable()
{
solver.OnCollision += Solver_OnCollision;
}
private void OnDisable()
{
solver.OnCollision -= Solver_OnCollision;
}
public void Solver_OnCollision(object sender, Obi.ObiSolver.ObiCollisionEventArgs e)
{
foreach(Oni.Contact contact in e.contacts)
{
ObiColliderBase collider = ObiColliderWorld.GetInstance().colliderHandles[contact.bodyB].owner;
if (collider.CompareTag("Rope") && collider != null)
{
int particleIndex = solver.simplices[contact.bodyA];
if (!(contactParticles.Contains(particleIndex)))
AddIndex(particleIndex, e);
stitcher.AddStitch(particleIndex, solver.simplices[contact.bodyB]);
stitcher.PushDataToSolver();
}