Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Selecting Individual Particles During Runtime
#5
(06-11-2019, 06:45 PM)josemendez Wrote: Well, each actor has a "particleIndices" array that tells you exactly what index in the solver is that particle allocated to. For instance, the first particle in the cloth is at cloth.particleIndices[0]. So if you use that to index the solver arrays, you get the position/velocity/ whatever of that particle: solver.positions[cloth.particleIndices[0]].

Sometimes you're interested in particles that meet some property. Generally you need to iterate over all of them, performing a test (proximity to another object, alignment to an axis, velocity over a threshold, etc). Otherwise, an actor is just a bunch of particles, just like a mesh is a bunch of vertices. How you'd know which vertex indices are part of the arm of a character? well, you just cannot know.

In Obi 5.0, we've added the concept of particle "groups". This allows you to group particles together in editor, and later retrieve these groups by code. This way you can attach semantic data to certain particles that have a special meaning or purpose for you. For instance, you could select all particles in a character's arm, put them under a group called "arm", then retrieve their indices at runtime.

Thank you for the detailed explanation, it was very helpful.
Can't wait for the exciting things inĀ 5.0!
Reply


Messages In This Thread
RE: Selecting Individual Particles During Runtime - by 3rdcat - 09-11-2019, 07:08 AM