Hi,
Quick question. When calling RaycastHit.Distance is this just retrieving an already calculated value or is it the same as (pos-pos).magnatude; ?
Thanks
-Matt
Hi,
Quick question. When calling RaycastHit.Distance is this just retrieving an already calculated value or is it the same as (pos-pos).magnatude; ?
Thanks
-Matt
Hm, very interesting question actually! I took a quick look at the decompiled version and found this:
private float m_Distance;
public float distance
{
get
{
return this.m_Distance;
}
set
{
this.m_Distance = value;
}
}
So I guess it is calculated with the hit itself (or might even be a byproduct from stepping through the ray).
That’s good to know. So many optimizations at hand! I’ll have to profile it. ![]()