Beispiel #1
0
 /// <summary>
 /// Überprüft, ob der Mausstrahl das Spielobjekt schneidet.
 /// </summary>
 public virtual GameObjectDistance Intersects(Ray ray)
 {
     if (ray.Intersects(_overallBoundingBox) != null)
     {
         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);
 }
Beispiel #2
0
 /// <summary>
 /// Überprüft, ob der Mausstrahl das Spielobjekt schneidet.
 /// </summary>
 public virtual GameObjectDistance Intersects(Ray ray)
 {
     if (ray.Intersects (_overallBoundingBox) != null) {
         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;
 }