You do not need to make the currentVelocity
equal the old desiredVelocity
.
desiredVelocity
changes every frame, as the actor changes position in relation to it's target.
Here's an overview of the situation:
You could use the resulting steeringDirection
to calculate an incremental change to the current velocity (as per Steering Behaviors For Autonomous Characters):
steeringDirection = seek (targetPos);
// this limits the steering force to a maximum steering force
// to avoid unnatural quick 180 turns
steeringForce = truncate (steeringDirection, MaxForce);
// we calculate an acceleration using the actor's mass
// so bigger things can be slow and have "more inertia"
// while small seekers can be fast and more maneuverable
acceleration = steeringForce / mass;
// and add it to the current velocity, which we then clamp to
// the maximum speed of the actor
currentVelocity = truncate (currentVelocity + acceleration, MaxSpeed);
// and we update the position
position = position + currentVelocity;
Hope I could help shed some light on the situation :)