FLOCKING EXPERIMENT
April 13, 2008
Realtime flocking script for trueSpace7.5 based on the works of Craig Reynolds.
Flock members start in a random state and then follow a set of rules to
control their motion. Their logic tells them to react to
collisions with other flock members and scene objects that have been
designated as collision objects, stay close to other flock members,
steer to the same heading as other flock members and steer towards the
goal object.

click image to see the video(512Kb, wmv)
- choose the default aspect of the script and click the "Start"
button, a goal object and the flock will be generated
- check the Active checkbox to start the motion
- click the checkbox again to freeze the motion
- click "Delete Flock" to delete the flock and start over
Use the "coll" aspect to choose top level objects in the scene for the
flock to collide with. "Make Flock Collision" will add the object to
the simulation and "Remove Flock Collision" will remove it.
The "Asp4" aspect can be used to change the flock member template model
and to set the values for the simulation. The model that is to replace
the default red "fish/bird" must have it's nose in the +Z direction and it's
top in the +Y direction with all rotations set to zero. Just select
the new model and click on "new template" to use your own model.
- personalSpace is the radius the member will consider to be too close
- localRadius is the distance that the member can see, it defines it's
local group space
All the rest of the attributes are the weights associated with a specific
behavior and are all added together to steer the member of the flock.
- extCollS - external collision strength, steering weight based on
collision with objects outside the flock
- grpCollS - collision with other flock members
- inertialS - inertial strength, tendency to continue in a straight
line
- grpHeadS - steer in same direction as flock inside the local group
of the flock member
- localCenterS - steer toward the center of the local group
- grpCenterS - steer toward the center of the entire flock
- goalS - steer toward the goal object
Collision with objects is determined by the bounding box of the object so
you can't make a box to contain the flock. There is no obstacle
avoidance behavior built in.
Craig Reynold's Boids