Original Post
Hi. As a little side project for my Ph.D I''ve been trying to come up with a simple swarm simulation.(I''m currently looking at doing research in Life Simulation specifically Agent Communication).
Anyhow, I''ve run into a little snag.
The whole idea at the moment is to simulate follow-the-leader behavior.
I have created a Sphere class which is just a class that holds information about each Sphere agent (I guess you could call them flies). Anyway, the first sphere created is the lead sphere. Its behavior (how it moves around in 3D space) is governed by some complex equation. I''ve got that working ok, the sphere flies around in circles in a very fly like manner.
The next step is to create a ''follower'' sphere. These spheres aren''t given any complex equations to control their flight, they follow the leader sphere.
And this is where I''m stuck. I''ve written the code that randomly generates a ''follower'' in the scene but I don''t know how I could implement the ''rules''.
The rules, as I see it at this early stage, is that the ''follower'' should try and remain close to its nearest neighbour (x distance away). This value isn''t concrete, just the optimum distance.
If we take the case of the scene where there''s the leader and one follower, how could I check to see the distance between them? And how could I go about correcting the flightpath of the follower sphere?
Any help / suggestions would be great!
Cheers,
SFA.