I'm currently studying steering behaviors. Have recently learned about Seek.
I have a question about this.
Seek is supposed to turn the agent slowly in the direction of it's target, and then move in that direction.
However, I don't understand how Seek turns the agent around slowly. It seems to me like it should make the agent change direction immediately.
This is the code for a Seek function:
Vector Seek(Point target){
Vector toTarget = new Vector(target - agent.getPosition());
Vector desiredVelocity = toTarget.normalize() * agent.getMaxVelocity();
return desiredVelocity.subtract(agent.getVelocity());
}
And then here is the update()
function of the agent.
void update(){
Vector force = seek(target);
Vector acceleration = force.divideBy(mass); // mass = 1.
velocity = velocity.add(acceleration);
position = position.add(velocity);
}
Anybody mind explaining to me where the gradual change of velocity takes place? Thanks