Wow thank you for the prompt reply!
Ah, I have to iterate because I need to add the propagate force to nearby particles, not just the particle involved in the contact.
But given it's very heavy I can consider skipping that propagate effect for now.
Ah, I have to iterate because I need to add the propagate force to nearby particles, not just the particle involved in the contact.
But given it's very heavy I can consider skipping that propagate effect for now.
Quote:(01-05-2024, 01:17 PM)josemendez Wrote: Hi!
Not sure why you need to iterate trough all particles for every contact, just to find which particle is closest to the contact? Contacts already give you the index of the particle involved in the contact, you can use that. See:
http://obi.virtualmethodstudio.com/manua...sions.html
Code:// get the particle index directly, as all simplices are guaranteed to have size 1:
int particleIndex = solver.simplices[contact.bodyA];
// do something with the particle, for instance get its position:
var position = solver.positions[particleIndex];