16-02-2021, 11:38 AM
(This post was last modified: 16-02-2021, 11:38 AM by josemendez.)
Hi Matt,
My bad: there is a difference when accessing particle indices from contacts: now that simplices are a part of the engine and particles are just one simplex type, you should use the solver.simplices array, as contact.bodyA and contact.bodyB are simplex indices, not particle indices.
So instead of:
you should use:
Notice the extra indirection level: contact.bodyA is an index in the simplices array, and solver.simplices[contact.bodyA] is a particle index.
This wasn't mentioned in the changelog and is undocumented in the manual, so it's entirely my fault. Will update both the changelog and the manual asap.
Let me know how it goes,
My bad: there is a difference when accessing particle indices from contacts: now that simplices are a part of the engine and particles are just one simplex type, you should use the solver.simplices array, as contact.bodyA and contact.bodyB are simplex indices, not particle indices.
So instead of:
Code:
solver.particleToActor[contact.bodyA];
you should use:
Code:
solver.particleToActor[solver.simplices[contact.bodyA]];
Notice the extra indirection level: contact.bodyA is an index in the simplices array, and solver.simplices[contact.bodyA] is a particle index.
This wasn't mentioned in the changelog and is undocumented in the manual, so it's entirely my fault. Will update both the changelog and the manual asap.
Let me know how it goes,