/// <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); }
/// <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; }