Example #1
0
        //  Return reference to a voxel map that intersects with the specified sphere. If not intersection, null is returned.
        //  We don't look for closest intersection - so we stop on first intersection found.
        //  Params:
        //      sphere - sphere we want to test for intersection
        public static MyVoxelMap GetIntersectionWithSphere(ref BoundingSphere sphere, MyVoxelMap selected)
        {
            for (int i = 0; i < m_voxelMaps.Count; i++)
            {
                if (selected == null || m_voxelMaps[i] == selected)
                {
                    MyVoxelMap voxelMap = m_voxelMaps[i];
                    if (voxelMap.IsSphereIntersectingBoundingBoxOfThisVoxelMap(ref sphere))
                    {
                        return(voxelMap);
                    }
                }
            }

            //  No intersection found
            return(null);
        }