Watch the little guys flock around, and play with the sliders. See what sort of patterns emerge! Press space to show/hide the controls. >turn speed: How fast they turn. Higher values make them seem kinda hyper, don't you think? >speed: They can make sharper turns if they're slower. ># of boids: Things start to slow down above 20, just so you know. >flock radius: How far a boid has to be from its nearest neighbor before it starts thinking about changing its direction to match. >spacing: How far away the boids try to keep from each other, as a fraction of the flock radius. >trail length: Turn it up to 100 to watch them paint the whole stage. This actually took very little code - because of how the boids render to begin with, I get the trail effect basically for free!
Boids are simulated creatures, obeying very simple rules, and yet showing complex flocking behavior, like birds or fish. The rules are: Separation: Boids try to avoid running into each other. Alignment: Boids try to fly in the same direction as nearby boids. Cohesion: Boids try to fly close to each other. My algorithm is a bit simplified from the "official" version, but they still flock beautifully. A fun side effect of how I've coded them is, if you look closely, they seem to wiggle like fish! Music: Vincent Rubinetti - Fractals, from The Music of 3blue1brown #Simulation #Simulations #Animation #Animations #Boids (should it be 'animation' or 'animationS'? i've never really used tags before lol. If you're all the way down here... love and favorite pls?)