private Vector3 Arrive() { // Scale the speed porporitionally to the distance from the target when within the deceleration radius Vector3 targetOffset = this.seekTarget.position - this.transform.position; float distance = targetOffset.magnitude; float scaledSpeed = (distance / this.decelerationRadius) * this.maxSpeed; float desiredSpeed = Mathf.Min (scaledSpeed, this.maxSpeed); // Compute the steering force Vector3 desiredVelocity = targetOffset.normalized * desiredSpeed; return desiredVelocity - this.rb.velocity; }