static List <APARaycastHit> INTERNAL_RaycastAll(Ray ray) { stopWatch = new System.Diagnostics.Stopwatch(); stopWatch.Start(); List <APARaycastHit> hits = new List <APARaycastHit>(); APAOctree octree = APAObjectDictionary.GetOctree(); if (octree.bounds.IntersectRay(ray)) { hits = RecurseOctreeBounds(octree, ray); } hits = SortResults(hits); stopWatch.Stop(); Debug.Log("Search Time: " + stopWatch.ElapsedMilliseconds + " ms"); return(hits); }
static bool INTERNAL_Raycast(Ray ray, out APARaycastHit hit) { hit = new APARaycastHit(); List <APARaycastHit> hits = new List <APARaycastHit>(); APAOctree octree = APAObjectDictionary.GetOctree(); if (octree.bounds.IntersectRay(ray)) { hits = RecurseOctreeBounds(octree, ray); } hits = SortResults(hits); if (hits.Count > 0) { hit = hits[0]; } return(hits.Count > 0); }