I’m trying to simulate Boid like vehicles.
Now I want that they “care” for each other and don’t crash in another.
Is there a good algorithm for that?
My Idea would be kind of this:
I’m calculating the euclidean distance between all Boids at every iteration and store the distance in a matrix.
After that I extract the indices of all matrix values smaller than ε, so now I know which two Boids are to close.
Now I want that they change velocities so it’s like an inelastic kick. And hopefully this is enough to “kick” them out of the ε radius.
But I think this is not a good way to do this, it will be very time consuming.
What do you think?
I’m a beginner at programming so it would be helpful if there is a “simple” solution.