24-02-2021, 11:06 AM
(This post was last modified: 24-02-2021, 11:10 AM by josemendez.)
If you're using Obi 6.X, you can't just access the solverIndices array directly using contact.bodyA.
contact.bodyA is a simplex index, not a particle index. You need to get the particle index out of that simplex. See the manual for examples on how it's done:
http://obi.virtualmethodstudio.com/tutor...sions.html
For instance:
contact.bodyA is a simplex index, not a particle index. You need to get the particle index out of that simplex. See the manual for examples on how it's done:
http://obi.virtualmethodstudio.com/tutor...sions.html
For instance:
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];
}