Comments and answers for "Distance to object I am looking towards"
http://answers.unity.com/questions/45301/distance-to-object-i-am-looking-towards.html
The latest comments and answers for the question "Distance to object I am looking towards"Answer by Steffen Franz
http://answers.unity.com/answers/45475/view.html
<p>construct a vector between the two points you want to measure, then get the magnitude of the vector.</p>
<pre><code>float distance = (endPoint - startPoint).magnitude;
</code></pre>
<p>even better to use Vector3.sqrmagnitude -> " Returns the squared length of this vector (Read Only). Calculating the squared magnitude instead of the magnitude is much faster. Often if you are comparing magnitudes of two vectors you can just compare their squared magnitudes. "</p>Mon, 31 Jan 2011 19:32:47 GMTSteffen Franz