With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

No credit card required

//magnitude of the overshoot
SteeringForce = walls[ClosestWall].Normal() * OverShoot.Length();
}
}//next feeler
return SteeringForce;
}
I have found the three feeler approach to give good results, but it’s possible
to achieve reasonable performance with just one feeler that continuously
scans left and right in front of the vehicle. It all depends on how many pro
-
cessor cycles you have to play with and how accurate you require the
behavior to be.
Ü
NOTE If you are the impatient sort and have already looked at the source
code, you may have noticed that the final update function in the source is a little
more complicated than the basic update function listed earlier. This is because
many of the techniques I will be describing toward the end of this chapter
involve adding to, or even changing, this function. All the steering behaviors
listed over the next few pages, however, just use this basic skeleton.
Interpose
Interpose returns a steering force that moves a vehicle to the midpoint of
the imaginary line connecting two other agents (or points in space, or of an
agent and a point). A bodyguard taking a bullet for his employer or a soc-
cer player intercepting a pass are examples of this type of behavior.
Like pursuit, the vehicle must estimate where the two agents are going
to be located at a time T in the future. It
can then steer toward that position. But
how do we know what the best value of T
is to use? The answer is, we don’t, so we
The first step in calculating this force
is to determine the midpoint of a line con
-
necting the positions of the agents at the
current time step. The distance from this
point is computed and the value divided
by the vehicle’s maximum speed to give
the time required to travel the distance.
This is our T value. See Figure 3.11, top.
Using T, the agents’ positions are
extrapolated into the future. The midpoint
of these predicted positions is determined
and finally the vehicle uses the arrive
behavior to steer toward that point. See
Figure 3.11, bottom.
106 | Chapter 3
The Steering Behaviors
Figure 3.11. Predicting the inter
-
pose point

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

No credit card required