In Reynolds-style steering, what is a desired velocity, and how does seek turn it into a capped steering force?
answer
- want minus have
- full speed straight at the target
- truncate force, then truncate speed
- force limit sets the turning radius
basics
~20 sSeek's desired velocity points from the agent straight at the target at maximum speed. The steering force is desired velocity minus current velocity, truncated to a maximum force, so the agent bends onto the new heading instead of snapping.
solid answer
~40 sA **desired velocity** is the velocity the agent would adopt if it could change velocity instantly. For seek it is `normalize(target - position) * maxSpeed`; flee simply negates the direction. The **steering force** is the correction `desired - velocity`, truncated to `maxForce`; dividing by mass gives an acceleration, and the movement layer integrates velocity, truncated to `maxSpeed`, and then position. The two caps are what make the result read as a body rather than a cursor: the velocity can only bend a little per tick, so the agent carves curves no tighter than a radius of about `speed^2 / maxAcceleration`. Pursue and evade reuse seek and flee on a predicted target position. The output is a request, an acceleration, that a character controller or physics body then carries out.
code
pseudocode · 17 linesfunction seek(agent, target):
toTarget = target - agent.position
if length(toTarget) < EPSILON:
return (0, 0) // on the target: no direction to seek
desired = normalize(toTarget) * agent.maxSpeed
steering = desired - agent.velocity
return truncate(steering, agent.maxForce)
function pursue(agent, quarry):
T = length(quarry.position - agent.position) / agent.maxSpeed
predicted = quarry.position + quarry.velocity * T
return seek(agent, predicted)
function step(agent, steering, dt): // minimal point-mass locomotion
acceleration = steering / agent.mass
agent.velocity = truncate(agent.velocity + acceleration * dt, agent.maxSpeed)
agent.position = agent.position + agent.velocity * dtgo deeper
Recall the formula: desired velocity is full speed toward the target, steering is desired minus current, and the result is truncated to a maximum force before use.
Explain how the force and speed caps produce a turning radius, why seek overshoots, and how pursue, evade and wander reuse the same desired-minus-current pattern.
Show you keep steering separate from locomotion and decision making, and can say which layer owns a symptom such as instant turns, overshoot or an agent pushing into a wall.
Frame steering as one layer of a movement stack and its tuning numbers as a shared contract between design, animation and physics, not as per-agent tweaks.
## Where steering sits Reynolds described the motion of autonomous characters as three layers, and keeping them apart is the first thing an interviewer listens for: - **Action selection** decides *what* the agent wants: chase the intruder, head for the exit, flee the explosion. A state machine, behavior tree or planner lives here. - **Steering** turns that wish into a **steering force**: a small correction to the current velocity, recomputed every tick. - **Locomotion** carries it out: a point-mass integrator in a prototype, a character controller or physics body in a game, often with an animation layer on top. Steering never moves the body and never plans a route. It answers one question: given where I am, how fast I am going and where I want to be, which way should I push right now? ## Seek, step by step **Seek** is the simplest behaviour and the template for the others. Each tick: 1. Compute the offset to the target: `toTarget = target - position`. 2. Build the **desired velocity**: the offset's direction at full speed, `normalize(toTarget) * maxSpeed`. This is the velocity the agent would take if it could change velocity instantly. 3. Compute the **steering force** as the difference between what it wants and what it has: `steering = desired - velocity`. 4. **Truncate** the steering force to `maxForce` and divide by mass to get an acceleration. 5. Hand the acceleration to locomotion, which integrates velocity (truncated to `maxSpeed`) and then position. **Flee** is seek with the desired velocity reversed: `normalize(position - target) * maxSpeed`. ## Why the two limits matter The two truncations are what make the output look like a moving body: - **Maximum force** limits how much the velocity can change per tick, so a sudden change of goal produces a curve rather than a snap. - **Maximum speed** caps how fast the agent travels however long it keeps accelerating. - Together they set the **turning radius**. A body moving at speed `v` around a circle of radius `R` needs a sideways acceleration of `v^2 / R`. If the most the agent can apply is `aMax = maxForce / mass`, the tightest circle it can hold at speed `v` is `R = v^2 / aMax`. Doubling the speed quadruples that radius; doubling the force limit halves it. That is why tuning happens on these numbers rather than in the behaviour: a nimble drone and a lumbering tank can run the same seek code with different limits. ## The family built on seek | Behaviour | Desired velocity | Typical use | |---|---|---| | Seek | toward the target at full speed | chase a point, steer to a waypoint | | Flee | away from the target at full speed | escape a threat | | Pursue | seek toward a **predicted** target position | intercept a moving target | | Evade | flee from a predicted position | escape a pursuer | | Wander | seek a jittered point on a circle ahead | idle roaming that looks purposeful | | Arrive | seek, slowing inside a radius | stop at a destination | **Pursue** predicts where the target will be `T` seconds ahead, `target.position + target.velocity * T`, and seeks that point; a simple estimate of `T` is the distance divided by the pursuer's speed. A drone chasing a moving target with plain seek aims where the target *is*, so it trails behind and curls into a tail chase; pursue aims where the target *will be* and cuts across its path. **Wander** keeps a point on a circle projected in front of the agent and nudges it by a small random amount each tick, so the heading drifts smoothly instead of jittering. ## Common mistakes - Treating the desired velocity as the output and assigning it straight to the velocity. The agent then turns instantly and the force limit does nothing. - Expecting seek to stop. It reaches the target at full speed and overshoots; stopping is the arrive behaviour's job. - Normalising a zero vector when the agent sits exactly on the target, which produces invalid numbers that then spread into position. - Mixing units: if the steering force is treated as an acceleration in one place and divided by mass in another, every tuning value quietly changes meaning. - Expecting steering to get around a wall. Seek pushes straight at its target; finding the way around obstacles is the route planner's job, and steering then follows the waypoints it hands over.
- How does pursue choose where to aim, and when does that prediction fail?Pursue seeks `target.position + target.velocity * T`, where `T` is commonly the distance divided by the pursuer's speed. It is a straight-line extrapolation, so it misleads when the target turns or accelerates, and more so the larger `T` is. An exact lead solves for the intercept time with a quadratic, still assuming the target keeps its velocity; if that equation has no positive root, no straight-line intercept at that speed exists.
- Why does wander move a point on a circle ahead of the agent instead of picking a random direction each tick?A fresh random direction every tick produces jittery, aimless motion, because the desired velocity jumps around faster than the agent can follow. Wander keeps a target on a circle projected ahead and moves it by a small random step per tick, so the desired heading drifts smoothly. The circle's distance, its radius and the jitter size tune how often and how sharply the agent turns.
- The steering force is the desired velocity itself, assigned straight to the agent.
- Seek slows down on its own as the distance to the target shrinks.
- Capping speed is enough; the force limit does not change the path taken.
- Pursue is seek on the target's current position, only at a higher speed.
- Steering behaviours find a way around walls to reach the target.