Not so much a scripting problem - Just need smart peoples' help.

In designing a sort of flight combat game,
I am needing to fire (Instantiate prefab, and move/target with separate script on prefab) a shot, which in the first frame, does a “Lookat Target” and moves forward after that…
I am getting the velocity.magnitude of the enemy ships rigidbody, and the distance between the player and the enemy,
to calculate for how far ahead of the enemy ships’ transform to set as the target,
as in, “compensating for the fact that both the enemy and projectile are in motion”.

What I have, is doing what I want -
It’s a formula that gives a smaller output ,targeting closer to the enemies’ position, the closer the player is to the enemy when firing - and a larger output, targeting further ahead of the enemy position, the higher that ships’ rigidbody.velocity.magnitude is.

Here is the code:

    using UnityEngine;
    using System.Collections;
    public class shotmover : MonoBehaviour {
    	public float speed;
    	public bool hasTarget;
    	public Transform target;
    	public Player player;
    	public Vector3 targetahead;
    	// Use this for initialization
    	void Start () {
    		player = GameObject.FindWithTag ("Player").GetComponent <Player> ();
    		Destroyshot ();
//Find out of the player has a target
    		hasTarget = player.seesTarget;
//If they do,
    		if (hasTarget) {
    //Store that object
    			target = player.locktarget;
/*add to targetahead, forward from the enemy, higher the further you are from the target, divided by 100 because i am just dumb, and higher based on the velocity of the enemy ship.*/
    			targetahead += target.position + target.forward * (((Vector3.Distance(transform.position, target.position)) / 100) * (1+player.locktarget.gameObject.GetComponent<Rigidbody> ().velocity.magnitude));
    			transform.LookAt (targetahead);
    			Debug.Log ("target velocity:" + player.locktarget.gameObject.GetComponent<Rigidbody> ().velocity.magnitude.ToString ());
    	void Update () {
    		gameObject.transform.Translate (Vector3.forward * speed);
    		if (hasTarget) {
    			Debug.DrawLine (gameObject.transform.position, targetahead);
    			Debug.DrawLine (target.transform.position, targetahead);
    	void Destroyshot(){
    		Destroy (gameObject, 2f);

In my little formula there, I am diving by 100 because the player will only target things about 100 units away. And I knew that the velocity output would average out around 1.So I was just kind of spitballing from debug logs!

Here is an image of how that is working:

The help that I need is this:
What would be the most accurate way, or even a more accurate way,
of calculating targetahead?
I drew a little triangle at the bottom of that image, to represent the situation, and the Pythagorean theorem popped into my head. But I can’t quite put anything together that cohesively grabs the right values for something like that.
Any ideas, Pythagorean or otherwise?

here’s the math,

here’s an implementation of the math,

here’s a demo of the implementation.

here is what I am ending up using

 showme2 = (Vector3.Distance (transform.position, target.position));
    			//targetahead += target.position + target.forward * (((Vector3.Distance(transform.position, target.position)) / 100) * (player.locktarget.gameObject.GetComponent<Rigidbody> ().velocity.magnitude));
    			targetahead += target.position +  (target.GetComponent<Rigidbody>().velocity) + player.locktarget.gameObject.GetComponent<Rigidbody> ().velocity/showme2*(Mathf.Sqrt((Mathf.Sqrt(showme2)/speed) * (Mathf.Pow(Mathf.Sqrt(player.locktarget.gameObject.GetComponent<Rigidbody> ().velocity.magnitude), rb.velocity.magnitude)+Mathf.Pow(showme2, Mathf.Sqrt(showme))-Mathf.Sqrt(showme)+Mathf.Sqrt(player.locktarget.GetComponent<Rigidbody>().velocity.magnitude))));
    			//targetahead += target.position - player.locktarget.gameObject.GetComponent<Rigidbody> ().velocity * (Mathf.Sqrt((Mathf.Sqrt(showme2)) * (Mathf.Pow(player.locktarget.gameObject.GetComponent<Rigidbody> ().velocity.magnitude, rb.velocity.magnitude)+Mathf.Pow(showme2, Mathf.Sqrt(showme))+Mathf.Sqrt(showme)+Mathf.Sqrt(player.locktarget.GetComponent<Rigidbody>().velocity.sqrMagnitude))));
    			transform.LookAt (targetahead);
    			Debug.Log ("Target velocity:" + player.locktarget.gameObject.GetComponent<Rigidbody> ().velocity.magnitude.ToString ());
    			showme = (Vector3.Distance(targetahead, target.position));

Here is a playable demo of that in action.