public override SteeringOutput getSteering() { SteeringOutputKinematic steering = new SteeringOutputKinematic(); steering.velocity = character.position - target.position; steering.velocity = steering.velocity.Normalize(2); steering.velocity *= maxSpeed; steering.rotation = 0; return(steering); }
public override SteeringOutput getSteering() { SteeringOutputKinematic steering = new SteeringOutputKinematic(); steering.velocity = target.position - character.position; if (steering.velocity.Norm(2) < satisfactionRadius) { steering.velocity.Clear(); steering.rotation = 0; return(steering); } steering.velocity /= timeToTarget; if (steering.velocity.Norm(2) > maxSpeed) { steering.velocity = steering.velocity.Normalize(2); steering.velocity *= maxSpeed; } steering.rotation = 0; return(steering); }