BoundingBox box = //create a bounding box BoundingSphere sphere = BoundingSphere.CreateFromBoundingBox(box); //use sphere for collision detection
ListThis example creates a list of bounding boxes and then creates a list of spheres that include each box. These spheres can be used for collision detection or other spatial operations on multiple objects. Package Library: This method is part of the Microsoft.Xna.Framework namespace, which is included in the XNA Game Studio package.boxes = //create a list of bounding boxes List spheres = new List (); foreach (BoundingBox box in boxes) { spheres.Add(BoundingSphere.CreateFromBoundingBox(box)); } //use spheres for collision detection