14-03-2023, 03:19 PM
(This post was last modified: 14-03-2023, 03:20 PM by josemendez.)
(14-03-2023, 01:07 PM)tegleg Wrote: Hi
as the title says how do i get particles in a group from code?
would it be possible to post a snippet to illustrate how its done?
ultimately im looking to get the position of said particles
thanks
Hi!
A ObiParticleGroup contains a list of particle indices that you can just iterate:
Code:
var group = rope.blueprint.groups[0];
for (int i = 0; i < group.particleIndices.Count; ++i)
{
int index = group.particleIndices[i];
// given the index of the particle, get its current position:
int indexInSolver = rope.solverIndices[index];
var position = rope.solver.positions[indexInSolver];
}