title: Hit incoming missile (simple projectile missile) in Unity3D
body: <p>I want to make Surface to Air Missile System in unity3D that could predict the incoming missile position after time 't' and set its interceptor missile angle and position in 3D coordinates so that it could hit incoming missile. I am using following function to get prediction of incoming missile.</p>
  
  <pre><code>    void UpdateTrajectory(Vector3 initialPosition, Vector3 initialVelocity, Vector3 gravity)
  {
      int numSteps = 500; 
      float timeDelta = 1.0f / initialVelocity.magnitude; 
  
      LineRenderer lineRenderer = GetComponent&lt;LineRenderer&gt;();
      lineRenderer.SetVertexCount(numSteps);
  
      Vector3 position = initialPosition;
      Vector3 velocity = initialVelocity;
      for (int i = 0; i &lt; numSteps; ++i)
      {
          lineRenderer.SetPosition(i, position);
  
  
          position += velocity * timeDelta + 0.5f * gravity * timeDelta * timeDelta;
          velocity += gravity * timeDelta;
      }
  }
  </code></pre>
  
  <p>I am using line renderer to get visual trajectory display.
  Now I can hit missile only at few position means I :P have to adjust manually. my SAM Missile System set its angle properly but it can't set exact time and velocity so it could hit missile.</p>