So im tryin to implement target lead in c# for my turrets, i have found two example. But one is compleltly beyond my math reading ability with strange characters like | in maths?!?! Here is the link if you want to check it out
http://www.tosos.com/pages/calculating-a-lead-on-a-target/
To the author of that post its great but beyond my ability.
Second solution i found was on the Unity Wiki
http://wiki.unity3d.com/index.php?title=Calculating_Lead_For_Projectiles
But this solution does not seem to give accurate results, i think this solution is for a striahgt line ‘no gravity’ shot, but my projectiles are fired in an arc and are affected by gravity.
Can any1 point me in the direction of some simple maths, or provide another example that can deal with target lead for projectiles fired in an a parobolic arc.
Thanks 
The math in the first example can be a bit of a headache at first, but luckily he provides the code so you don’t need to do the math yourself. It looks to me like you should make a script and attach to your rotating turret head.
like so:
public Transform target;
public float projectileSpeed = 200;
void Update()
{
transform.rotation = Quaternion.Euler(CalculateLead());
}
Vector3 CalculateLead () {
Vector3 V = target.rigidbody.velocity;
Vector3 D = target.position - this.transform.position;
float A = V.sqrMagnitude - projectileSpeed * projectileSpeed;
float B = 2 * Vector3.Dot (D, V);
float C = D.sqrMagnitude;
if (A >= 0) {
Debug.LogError ("No solution exists");
return target.position;
} else {
float rt = Mathf.Sqrt (B*B - 4*A*C);
float dt1 = (-B + rt) / (2 * A);
float dt2 = (-B - rt) / (2 * A);
float dt = (dt1 < 0 ? dt2 : dt1);
return target.position + V * dt;
}
}
You’ll need to fill in the variables for everything that is needed in his method, but I think once that is done it should work.
I modified this at work, so I don’t know if it’s going to work straight out of the box. Might take a bit of tweaking, but it should be close to working.
just realised this is an old thread… was wondering why u were asking again.