예제 #1
0
        public bool getIntersectionTime(List <uint> phases, Ray ray, Vector3 endPos, float maxDist)
        {
            float distance = maxDist;
            DynamicTreeIntersectionCallback callback = new DynamicTreeIntersectionCallback(phases);

            impl.intersectRay(ray, callback, ref distance, endPos);
            if (callback.didHit())
            {
                maxDist = distance;
            }
            return(callback.didHit());
        }
예제 #2
0
        public bool GetIntersectionTime(Ray ray, Vector3 endPos, PhaseShift phaseShift, float maxDist)
        {
            float distance = maxDist;
            DynamicTreeIntersectionCallback callback = new DynamicTreeIntersectionCallback(phaseShift);

            impl.IntersectRay(ray, callback, ref distance, endPos);
            if (callback.DidHit())
            {
                maxDist = distance;
            }
            return(callback.DidHit());
        }
예제 #3
0
        public bool isInLineOfSight(Vector3 startPos, Vector3 endPos, PhaseShift phaseShift)
        {
            float maxDist = (endPos - startPos).magnitude();

            if (!MathFunctions.fuzzyGt(maxDist, 0))
            {
                return(true);
            }

            Ray r = new Ray(startPos, (endPos - startPos) / maxDist);
            DynamicTreeIntersectionCallback callback = new DynamicTreeIntersectionCallback(phaseShift);

            impl.intersectRay(r, callback, ref maxDist, endPos);

            return(!callback.didHit());
        }
예제 #4
0
        public float getHeight(float x, float y, float z, float maxSearchDist, PhaseShift phaseShift)
        {
            Vector3 v = new Vector3(x, y, z + 0.5f);
            Ray     r = new Ray(v, new Vector3(0, 0, -1));
            DynamicTreeIntersectionCallback callback = new DynamicTreeIntersectionCallback(phaseShift);

            impl.intersectZAllignedRay(r, callback, ref maxSearchDist);

            if (callback.didHit())
            {
                return(v.Z - maxSearchDist);
            }
            else
            {
                return(float.NegativeInfinity);
            }
        }