<p>I solved this using the built in <a href="https://helpx.adobe.com/after-effects/using/simulation-effects.html#foam_effect" rel="nofollow noreferrer">Foam particle render</a> - it does have basic collision avoidance</p>

CC BY-SA 4.0
2018-07-05T14:09:37.823Z
2018-07-05T14:09:37.823Z
tomh
<p>I solved it with the enable flocking option
attract 0%
separate 20%</p>

CC BY-SA 4.0
2022-10-31T11:36:22.580Z
In Trapcode Particular?
tomh
CC BY-SA 4.0
2022-10-28T18:47:01.357Z
2022-10-28T18:47:01.357Z
Nuria
<p>I need to drive a large number of small 2D cars around on screen in a fairly random fashion... I have the Trapcode Suite.  I'd really like them not to overlap each other.  What's the easiest way to achieve this? Any good tricks using C4Dlite maybe? At the moment I'm using Particular to splatter them all over the screen, and it looks a bit rubbish.</p>

CC BY-SA 3.0
2017-09-19T07:50:28.510Z
Don't know about C4D, but there is a physics plugin for After Effects called Newton 2 that can achieve that.
MEGA
CC BY-SA 3.0
2017-09-20T01:22:24.307Z
You can do it with expressions, there is a sampleImage function which you could call for perimeter points on each car to find out if they're overlapping, https://is.gd/cXC6Il You could also just fudge it by avoiding cars within a certain radius. But it would be super slow for lots of cars. If it was my project I'd do it with a script, using something like the Boids flocking algorithm. https://en.wikipedia.org/wiki/Boids
stib
<after-effects><after-effects-expressions>
Animating particles with collision avoidance?
tomh
# Animating particles with collision avoidance?

(Asked by: username_0 on 2017-09-19)

I need to drive a large number of small 2D cars around on screen in a fairly random fashion... I have the Trapcode Suite. I'd really like them not to overlap each other. What's the easiest way to achieve this? Any good tricks using C4Dlite maybe? At the moment I'm using Particular to splatter them all over the screen, and it looks a bit rubbish.

**Tags:** after-effects, after-effects-expressions

> **Comments:**
> **username_1**: Don't know about C4D, but there is a physics plugin for After Effects called Newton 2 that can achieve that.  
> **username_2**: You can do it with expressions, there is a sampleImage function which you could call for perimeter points on each car to find out if they're overlapping, https://is.gd/cXC6Il You could also just fudge it by avoiding cars within a certain radius. But it would be super slow for lots of cars. If it was my project I'd do it with a script, using something like the Boids flocking algorithm. https://en.wikipedia.org/wiki/Boids  

---

## 2 answers

### Answer by username_0 on 2018-07-05. Score: 1

I solved this using the built in [Foam particle render](https://helpx.adobe.com/after-effects/using/simulation-effects.html#foam_effect) - it does have basic collision avoidance


---

### Answer by username_3 on 2022-10-28. Score: -1

I solved it with the enable flocking option
attract 0%
separate 20%

> **Comments:**
> **username_0**: In Trapcode Particular?  

---

