01-05-2024, 01:17 PM
(This post was last modified: 01-05-2024, 01:19 PM by josemendez.)
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
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];