Now that our scene is set up, let's take a look at our avoidance behavior script. It contains all the logic for driving our agent, and applies the avoidance to the movement of the agent. In the sample project, take a look at the Avoidance.cs script:
using UnityEngine;public class Avoidance : MonoBehaviour { [SerializeField] private float movementSpeed = 20.0f; [SerializeField] private float rotationSpeed = 5.0f; [SerializeField] private float force = 50.0f; [SerializeField] private float minimumAvoidanceDistance = 20.0f; [SerializeField] private float toleranceRadius = 3.0f; private float currentSpeed; private Vector3 targetPoint; private RaycastHit mouseHit; private Camera mainCamera; private Vector3 direction; private ...