Jump to content
  • Advertisement
Sign in to follow this  
Metro_Mystery

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.

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
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 this post


Link to post
Share on other sites


Quote:
Original post by Metro_Mystery
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!


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 this post


Link to post
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 this post


Link to post
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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!