Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to get particles in a group?
#2
(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];
}
Reply


Messages In This Thread
How to get particles in a group? - by tegleg - 14-03-2023, 01:07 PM
RE: How to get particles in a group? - by josemendez - 14-03-2023, 03:19 PM
RE: How to get particles in a group? - by tegleg - 14-03-2023, 04:23 PM
RE: How to get particles in a group? - by tegleg - 14-03-2023, 06:01 PM
RE: How to get particles in a group? - by tegleg - 14-03-2023, 09:54 PM
RE: How to get particles in a group? - by tegleg - 15-03-2023, 01:01 PM