Boids (flocking behavior)

I am trying to implement a 3d flocking behavior in vvvv. I just started working with spreads but I encountered a major problem: I need to calculate the distances between the boids to scale their impact on their neighbours but I do not understand how to not mesure the distance of the boid with itself. Has anybody done any boid patching with vvvv or are there any suggestions or example patches?

I am working a a patch and will upload it soon.

i was thinking about patching a boid-module for quite a while, but never had the time to do so. so, it’s cool, that you’re up for it!

what about this: sum the distances to each boid (including the current one), then you will propably divide by the number of distances you have summed, to get some mean value. just divide by the number ( of all boids ) -1. since the distance from the current boid to itself is 0 it will not have an impact on the result.

hope this helps, good luck!

Here is my first attempt at 3d boids (also my first vvvv patch) : (21.23 Kb)