Пример #1
0
    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);
    }
Пример #2
0
    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);
    }
Пример #3
0
 void Awake()
 {
     singleton = this;
 }