Skip to content

Instantly share code, notes, and snippets.

@rvishwajith
Created January 13, 2021 05:59
Show Gist options
  • Save rvishwajith/c482d94715dba9c5043c4543aac8b3f8 to your computer and use it in GitHub Desktop.
Save rvishwajith/c482d94715dba9c5043c4543aac8b3f8 to your computer and use it in GitHub Desktop.
rule2(Boid b)
distance = 100 // Threshold of distance between boids
result = <0, 0, 0>
FOR b2 in Boids
IF b != b2 // Ignore duplicate boids
IF dist(b.position, b2.position) < distance
result -= (b2.position - b.position)
RETURN result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment