Location variables coming out the same in AI Target Leading

Hello, I have a script I’m working on to make an AI turret lead a target.

It is finding the distance to the target fine, but the problem I’m having is that the velocityDist1 and velocityDist2 are coming out as the same number as distTarget. I don’t see the error thats causing this to happen though I imagine its something I have looked over that someone else may find easily.

Thank you for any feedback!

var Target : GameObject;
var barrel : GameObject;
var launcher : GameObject;

var projectile : Rigidbody;

var projectileSpeed = 10;

var turnSpeed = 5;

var accuracy = 1.0;

var weaponRate : float = 0.25;
private var cooldown : float = 0.0;


function FixedUpdate () {

    if (Target) {

        // actual distance to target

        var distTarget = Vector3.Distance(Target.transform.position, transform.position);
        Debug.Log("distTarget = " + distTarget);

        // first calculation, using actual distance

        velocityPosition1 = (Target.transform.position + ( (Target.rigidbody.velocity*accuracy) * (distTarget/projectileSpeed) ));

        velocityDist1 = Vector3.Distance(velocityPosition1, transform.position);
        Debug.Log("velocityDist1 = " + velocityDist1);

        // second calc., using distance from first calc.

        velocityPosition2 = (Target.transform.position + ( (Target.rigidbody.velocity*accuracy) * (velocityDist1/projectileSpeed) ));

        velocityDist2 = Vector3.Distance(velocityPosition2, transform.position);
        Debug.Log("velocityDist2 = " + velocityDist2);

        // third calc., using distance from second calc.

        TargetInterceptPosition = (Target.transform.position + ( (Target.rigidbody.velocity*accuracy) * (velocityDist2/projectileSpeed) ));
        
		Debug.Log("TargetInterceptPosition = " + TargetInterceptPosition);
		Debug.DrawLine(transform.position,TargetInterceptPosition, Color.cyan, 0);
        // aim turret/ship at intercept position

        rotationTarget = Quaternion.LookRotation((TargetInterceptPosition) - transform.position);       
		Debug.Log("rotationTarget = " + rotationTarget);
		
        transform.rotation = Quaternion.Lerp(rotationTarget, transform.rotation, Time.deltaTime * turnSpeed);
        
        if(Time.time > cooldown){
			cooldown = Time.time + weaponRate;
			Fire();
		}

    }

    else {

        Target = GameObject.FindWithTag("Blimp");//or find closest object in seperate function, etc.

    }

}

function Fire(){
	var shellClone : Rigidbody;
	shellClone = Instantiate(projectile, launcher.transform.position, launcher.transform.rotation);
	shellClone.velocity = launcher.transform.forward * projectileSpeed;
	Physics.IgnoreCollision(shellClone.collider, collider);
	audio.Play();
}

At one point the numbers were actually independent of each other and seemed to be calculating correctly, but then it went back to them all being the same. I’m really not sure whats causing this.

Would this be why its not working?

“Note: The velocity returned is simply the difference in distance for the current timestep before and after a call to CharacterController.Move or CharacterController.SimpleMove. The velocity is relative because it won’t track movements to the transform that happen outside of the CharacterController (e.g. character parented under another moving Transform, such as a moving vehicle).”

The movement of the target is not through a controller. Its done through waypoints, lookat, and translate.

Is there a way to still use velocity without a character controller or make an AI move using a character controller?