Question

I would like to illustrate how insects are following their leader in 2 dimensions. How can I acomplish that? Is it possible to do this with Boids algorithm? Or maybe someone knows another algorithm, designed especially for that reason?

Was it helpful?

Solution

Boids-style algorithms should be fine for this, however you will probably need to tweak the algorithm and experiment a bit before you get something that looks really good. You'll get something like leader/follower behaviours providing you do the following:

  • Get the "followers" to adjust their heading towards the "leader". Depending on how strong you want the follower effect to be you can make this effect weaker or stronger, or only apply it some of the time etc.

  • You may choose to either have every bot follow the same leader, or each follow a different leader. If the former, you will get a big flock following a single individual. If the latter, you will tend to get "chains" forming.

  • You'll probably want the ultimate leader(s) to move relatively independently. Maybe make the leader change heading randomly or even try to head "away" from the centre of the group.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top