Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Rope extension, vibration and collision
#17
(28-04-2025, 11:15 AM)josemendez Wrote: Are you using surface collisions by any chance? the code used to get particle indices from a contact is different when using them, as explained in "Retrieving the particle involved in a contact". If you're using surface collisions, the code should look like this:


Code:
// retrieve the offset and size of the simplex in the solver.simplices array:
int simplexStart = solver.simplexCounts.GetSimplexStartAndSize(contact.bodyA, out int simplexSize);

// starting at simplexStart, iterate over all particles in the simplex:
for (int i = 0; i < simplexSize; ++i)
{
    int particleIndex = solver.simplices[simplexStart + i];

    // do something with each particle, for instance get its position:
    var position = solver.positions[particleIndex];
}
 
How can I find the colliding particle from this code? That is, how can I detect (particle/all particle)?
Is the simplexStart value here my index that is experiencing the collision?
When I count particles visually I get a different result.
Surface-based uncheck
   

I solved the reset process as follows;
Code:
public void RopeReset()
{
     ropeEnd.transform.position = ropeEndStartPos;
     rope.ropeBlueprint = null;
     rope.ropeBlueprint = blueprint;
}
Reply


Messages In This Thread
RE: Rope extension, vibration and collision - by 0hsyn1 - 28-04-2025, 11:52 AM