Graphics Reference
In-Depth Information
FIGURE 11.2
Force field collision avoidance.
The simple strategy is to position a limited-extent, repelling force field around every object. As long as
a flock member maintains a safe distance from an object, there is no force imparted by the object to the
flock member. Whether this occurs can easily be determined by calculating the distance 2 between the
center point of the flockmember and the center of the object. Once this distance gets belowa certain thresh-
old, the distance-based force starts to gently push the flock member away from the object. As the flock
member gets closer, the force grows accordingly (see Figure 11.2 ). The advantages of this are that inmany
cases it effectively directs a flock member away from collisions, it is easy to implement, and its effect
smoothly decreases the farther away the flock member is from the object, but it also has its drawbacks.
In some cases, the force field approach fails to produce the motion desired (or at least expected). It
prevents a flock member from traveling close and parallel to the surface of an object. The repelling
force is as strong for a flock member moving parallel to a surface as it is for a flock member moving
directly toward the surface. A typical behavior for a flock member attempting to fly parallel to a surface
is to veer away and then toward the surface. The collision avoidance force is initially strong enough to
repel the member so that it drifts away from the surface. When the force weakens because of increasing
distance, the member heads back toward the surface. This cycle of veering away and then toward the
surface keeps repeating. Another problem with simple collision avoidance forces occurs when they
result in a force vector that points directly toward the flock member. In this case, there is no direction
indicated in which the member should veer; it has to stop and back up, which is an unnatural behavior.
Aggregate forces can also prevent a flock member from finding and moving through an opening that
may be more than big enough for passage but for which the forces generated by surrounding objects are
enough to repel the member (see Figure 11.3 ) .
The problem with a simple repelling force field approach is that there is no reasoned strategy for
avoiding the potential collision. Various path planning heuristics that can be viewed as attempts to
model simple cognitive processes in the flock member are useful. For example, a bounding sphere
can be used to divert the flock member's path around objects by steering away from the center toward
the rim of the sphere ( Figure 11.4 ) .
Once the flock member is inside the sphere of influence of the object, its direction vector can be
tested to see if it indicates a potential intersection with the bounding sphere of the object. This calcu-
lation is the same as that used in ray tracing to see if a ray intersects a sphere ( Figure 11.5 ) .
2 As in many cases in which the calculation of distances is required, distance-squared can be used thus avoiding the square root
required in the calculation of distance.
 
Search WWH ::




Custom Search