Niagara ScratchPad Custom Collision

SeverynB
Wed, 12 Nov 2025 15:52:45 +0000
Asset Creation

HELP i need somebody!

I have an emitter that spawns exactly two particles at random positions. I want them to attract each other, collide once, and then fly apart. To keep it highly optimized, I’m avoiding physics-based collisions and instead using a custom Scratchpad module in Particle Update:

1. Using Particle Reader Attribute and Particle Index, I fetch the position of each particle.

2. I compute the midpoint between the two particles to drive an attractor force.

3. I calculate the current distance between the particles.

4. I created a float particle attribute, Particles.HasCollided, to store collision state.

5. I compare the current distance with a CollisionDistance input (float). When distance < CollisionDistance, that comparison returns true.

6. I also check whether Particles.HasCollided > 0.

7. I OR these two booleans to get the current collision state.

Intended logic:

1. At start, Particles.HasCollided = 0.

2. When the distance test is true, the OR node becomes true.

3. The OR result sets Particles.HasCollided = 1.

4. From then on, HasCollided should remain true, so I can use it in force logic to push particles apart and keep them apart.

Problem:

For some reason, this setup sets Particles.HasCollided = 1 at the very beginning, even though I explicitly initialize it to 0 in Particle Spawn.

Question:

Is there a way to make this logic work as intended?
Or, is there another low-cost method to detect/handle a “collision” between just two particles?

1 post - 1 participant