#How to implement a vision cone? (Boids & Flocking)
4 messages · Page 1 of 1 (latest)
For your second question, yes - you can check out the library p5.collide2d (it's not too hard to implement it either, requires some geometry) (I am talking about regular shapes, for custom shapes things might be a bit tricky.)
Thanks! I tried implementing a vision cone by calculating the angle between a boid and it's neighbors and it works but it's a bit slow. I'm checking into optimization like using quadtrees to make it have to do less comparisons.
I've heard of collide2d so I'll check that out too. Thanks!
you can use a cross product to check if a point is on one side of a line