Detecting neighbour particles in the particle system
I am working on a particle system where each particle counts it neighbour particles and acts accordingly to it. So in more detail the script should do the following: -In each frame count of each particle in the system the neighbour particles in a certain radius. Does anybody of you has experience with this?
For this purpose i created a empty gameobject with Circle Collider 2D (Game is 2D) and iterate its position to each particle postion. So that the OnParticleTrigger() function is called for each particle and counts neighbours in this particle position. Then jumps into the next position of the particle system.
Unfortunatly, it seems that following steps are not possible within one frame:
//get all particles that are inside the Collider
ParticlePhysicsExtensions.GetTriggerParticles(...);
//Move Spehere Collider to a new positon
SphereParticleCollider.transform.position = new Vector3(...);
//get all particles that are inside the Collider at the new position
ParticlePhysicsExtensions.GetTriggerParticles(...);
The result of GetTriggerParticles(...) unfortunatly does not change when i move the collider within one frame to a new position. Thank you for your help!