6 hours ago
(This post was last modified: 6 hours ago by josemendez.)
(11 hours ago)Zavhoz Wrote: I understand that all particles remain one with the emitter that produced them. But I wanted to know if I can determine the particles of the compound at the moment, or if there are separate formations, as in the picture
Hi Zavhoz,
There's no built-in way to do this. The engine doesn't work in terms of "formations", these emerge automatically from the simulation and are not explicitly tracked. You'll have to find these yourself.
A simple algorithm that comes to mind is to keep a set of "formations", and initially assign each particle no formation. Iterate trough all particles, for each one find its neighbors and:
- If the neighbor is not part of any formation, add it to the current particle's formation - if any. If neither are part of a formation, create a new formation and assign them both to it.
- If the current particle and its neighbor are part of different formations, merge both formations.
This is similar to the algorithm used to count connected components in a graph. Once you're done iterating trough all particles, your set will contain the individual formations you're looking for.
kind regards