# Basic Steering Behaviors.

This topic is 3834 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I'm having trouble understanding the physics equations related to Steering Behaviors For Autonomous Characters (present in the book "Programming Game AI by example"). In the book, Mat Buckland calculates Seek like so (in Pseudocode) def Seek() DesiredVelocity = Normalize(TargetPos - VehiclePos) * VehicleMaxSpeed SteeringForce = DesiredVelocity - VehicleVelocity return SteeringForce Seek is stated, in the book- to return a steering force, which is "the force required, when added to the agents current velocity vector, gives the desired velocity. How does the subtraction of two velocity vectors suddenly become a force? My heads in a spin- any help is greatly appreciated!

##### Share on other sites
the terminology seems a bit confusing, you are right.
first of all... the output is not a real force but a "change in velocity" which is kind of similar, but physically not the same.
anyway, the idea is to move the agent as fast as possible toward the target position. As fast as possible means that the agent usually has a steering ability, in this case represented by the VehicleMaxSpeed... but you should probably read it as "maximum change in velocity".
hope this helps.

##### Share on other sites

Quote:
 Original post by Metro_MysteryI'm having trouble understanding the physics equations related to Steering Behaviors For Autonomous Characters (present in the book "Programming Game AI by example").In the book, Mat Buckland calculates Seek like so (in Pseudocode)def Seek()DesiredVelocity = Normalize(TargetPos - VehiclePos) * VehicleMaxSpeedSteeringForce = DesiredVelocity - VehicleVelocityreturn SteeringForceSeek is stated, in the book- to return a steering force, which is "the force required, when added to the agents current velocity vector, gives the desired velocity.How does the subtraction of two velocity vectors suddenly become a force?My heads in a spin- any help is greatly appreciated!

Lets see... Desired Velocity... Velocity should be a speed with a direction...

*Pos is place only, so in SI, m. *Speed is m/s. So (m) * m/s = m**2/s. So we don't even have a velocity right now. And velocity, no matter how you add or subtract it, cannot equal force. I would say look at his other code, and most likely he doesn't actually want force to be returned, and he has misnamed it.

##### Share on other sites
Thanks for the replies guys,

Would it be correct to say that he's obtaining the "force" vector assuming the constant scaling factor in F = m/t(v-u) [m/t] is 1kg/1sec?

In that case the force vector + the current velocity vector will indeed give the desired velocity vector.

##### Share on other sites
It's not mis-named... it's simply an approximation. The difference of velocities is a first order approximation of the acceleration needed to change velocity in a single frame. Acceleration is linearly proportional to force (F=ma). Typically the returned value is weighted by two factors, the mass of the object (most applications assume unit mass) and a factor that determines the number of frames over which the acceleration should actually produce the convergence to the desired point. Given that this is an iterated solution method for at least one moving target, the acceleration required at the next iteration will not be the same. Indeed, one can prove that for a stationary target and a simple motion model, this technique will provide convergence of position to the target. The limits of discrete numerical computations will cause some instability very close to the target point, but this is easily dealt with by using a deadzone around the target point within which the velocity is set to zero.

Regards,

Timkin

1. 1
2. 2
3. 3
Rutin
14
4. 4
5. 5

• 9
• 9
• 11
• 11
• 23
• ### Forum Statistics

• Total Topics
633674
• Total Posts
3013275
×