Ejemplo n.º 1
0
        public bool IntersectRay(Ray ray, ref float distance, bool stopAtFirstHit)
        {
            if (triangles.Empty())
            {
                return(false);
            }

            GModelRayCallback callback = new GModelRayCallback(triangles, vertices);

            meshTree.intersectRay(ray, callback, ref distance, stopAtFirstHit);
            return(callback.hit);
        }
Ejemplo n.º 2
0
        public bool IsInsideObject(Vector3 pos, Vector3 down, out float z_dist)
        {
            z_dist = 0f;
            if (triangles.Empty() || !iBound.contains(pos))
            {
                return(false);
            }
            GModelRayCallback callback = new GModelRayCallback(triangles, vertices);
            Vector3           rPos     = pos - 0.1f * down;
            float             dist     = float.PositiveInfinity;
            Ray  ray = new Ray(rPos, down);
            bool hit = IntersectRay(ray, ref dist, false);

            if (hit)
            {
                z_dist = dist - 0.1f;
            }
            return(hit);
        }