I am using a simple waypoint script that takes the AI around a small circle of 8 waypoints. The script works fine without any collision detection, but when I add a collider of sorts (Like a box collider) the script stops working. Here’s my script below: `#pragma strict
var grid : Transform;
var speed : float = 5.0;
var current : int;
function Start () {
}
function Update () {
if(current < grid.Length){
//variables to determine movement
var target : Vector3 = grid[current].position;
var moveDirection : Vector3 = target - transform.position;
var velocity = rigidbody.velocity;
//if close to the waypoint, increase current
if(moveDirection.magnitude < 1){
current++;
} else {
velocity = moveDirection.normalized * speed;
}
//set the rigid body velocity to move
rigidbody.velocity = velocity;
} else {
current = 0;
`
Could anyone please help me so that I can run my AI script with a physics collider attached to my AI?