public GameObjectDistance Intersects(Ray ray)
 {
     foreach (BoundingBox bounds in Bounds()) {
         Nullable<float> distance = ray.Intersects (bounds);
         if (distance != null) {
             GameObjectDistance intersection = new GameObjectDistance () {
                 Object=this, Distance=distance.Value
             };
             return intersection;
         }
     }
     return null;
 }
Exemple #2
0
 public override GameObjectDistance Intersects(Ray ray)
 {
     foreach (BoundingSphere sphere in Bounds) {
         float? distance = ray.Intersects (sphere);
         if (distance != null) {
             GameObjectDistance intersection = new GameObjectDistance () {
                 Object=this, Distance=distance.Value
             };
             return intersection;
         }
     }
     return null;
 }