Esempio n. 1
0
 public bool FindWorldBoundsHit(Ray3f ray, out GameObjectRayHit hit)
 {
     hit = null;
     foreach (var go in this.vBoundsObjects)
     {
         GameObjectRayHit myHit = null;
         if (UnityUtil.FindGORayIntersection(ray, go, out myHit))
         {
             if (hit == null || myHit.fHitDist < hit.fHitDist)
             {
                 hit = myHit;
             }
         }
     }
     return(hit != null);
 }
Esempio n. 2
0
        override public bool FindRayIntersection(Ray3f ray, out SORayHit hit)
        {
            hit = null;

            Frame3f frameW   = GetLocalFrame(CoordSpace.WorldCoords);
            Ray     localRay = frameW.ToFrame(ray);

            Bounds hitBounds = GetLocalBoundingBox();

            if (hitBounds.IntersectRay(localRay) == false)
            {
                return(false);
            }

            GameObjectRayHit goHit;

            if (UnityUtil.FindGORayIntersection(ray, meshGO, out goHit))
            {
                hit = new SORayHit(goHit, this);
                return(true);
            }

            return(false);
        }