Ok so I'm going nuts over this, The source I'm reading from is here:

http://www.red3d.com/cwr/steer/gdc99/

If you can be bothered reading that, the main concern is with the **arrival behaviour.** I have setup my object exactly the same as the page says

Simple Vehicle Model:

mass scalar

position vector

velocity vector

max_force scalar

max_speed scalar

orientation N basis vectors

Code:

private var p:Vector; //position
private var v:Vector; //velocity
private var f:Vector; //force
private var mass:Number;
private var maxForce:Number;
private var maxSpeed:Number;

*I have left out orientation and added in force which is used as steering

now when converting this arrival code into flash:

target_offset = target - position

distance = length (target_offset)

ramped_speed = max_speed * (distance / slowing_distance)

clipped_speed = minimum (ramped_speed, max_speed)

desired_velocity = (clipped_speed / distance) * target_offset

steering = desired_velocity - velocity

Code:

var d:Vector = target.subNew(p); //target offset
var dist:Number = d.length;
var speed:Number = maxSpeed * (dist / 100);
speed = Math.min(speed, maxSpeed);
var dvx = (speed / dist) * d.x;
var dvy = (speed / dist) * d.y;
f.x = dvx - v.x;
f.y = dvy - v.y;

and then I update the object exactly like the paper describes:

steering_force = truncate (steering_direction, max_force)

acceleration = steering_force / mass

velocity = truncate (velocity + acceleration, max_speed)

position = position + velocity

Code:

clamp(f, maxForce);
var ax = f.x / mass;
var ay = f.y / mass;
v.x += ax;
v.y += ay;
clamp(v, maxSpeed);
p.x += v.x;
p.y += v.y;

the clamp functions looks like:

Code:

function clamp(n, max){
var len = n.length;
if(len > max){
n.x /= len
n.y /= len
n.x *= max
n.y *= max
}
}

**But the object continues past the target, as if it were elastic**

can somebody point out what I have done wrong here, I have found several papers on this all which are exactly the same, use the same formulas, but I can't seem to re-create it in flash.