Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Particle Collision Not Working On Instantiated Rope
#1
Hi, 

When I instantiate a prefab consisting of ropes (that then get reparented to ObiSolver object in OnEnable), the OnCollision seems to not catch any collision events with the targeted particle (beginning of rope) but when the prefab is already in the scene, OnCollision is detecting collision events with that particle. Its only with that particle, it seems to throw events with other particles along that rope when instantiated.

It working, this is with the prefab placed in the scene from the start:
[Image: giphy.gif?cid=790b7611ce3aac377c22c6242e...y.gif&ct=g]

When the prefab is instantiated, no collisions events detected from that particle:
[Image: giphy.gif?cid=790b76112f9596c9ab90c9faef...y.gif&ct=g]

OnCollision:
Code:
// Just iterate over all contacts in the current frame
foreach (Oni.Contact contact in handCollision.contacts)
{
    // This one is an actual collision
    if (contact.distance > 0.01) return;

    // Get the particle index directly, as all simplices are guaranteed to have size 1:
    int particleIndex = hand.Solver.simplices[contact.bodyA];

    // This is not the particle you are looking for - Obi Wan
    if (particleIndex != hand.SolverIndex) return;

    // Retrieve collider
    ObiColliderBase collider = ObiColliderWorld.GetInstance().colliderHandles[contact.bodyB].owner;

    // Attach hand and collider
    hand.Grab(collider.transform);
}

Getting the start particle:
Code:
_arm.elements[0].particle1;

The particle is still accurate to the solver indices because I am still able to add force to that specific particle. However, it is not being detected by OnCollision.
Reply


Messages In This Thread
Particle Collision Not Working On Instantiated Rope - by VirtualCucumber - 18-03-2022, 03:42 AM