Пример #1
0
        private static Vector3D?FindPastePosition(MyObjectBuilder_CubeGrid[] grids, BoundingSphereD position, double cutout)
        {
            BoundingSphere sphere = FindBoundingSphere(grids);

            /*
             * Now we know the radius that can house all grids which will now be
             * used to determine the perfect place to paste the grids to.
             */

            Random   rand     = new Random();
            MyEntity safezone = null;
            var      entities = MyEntities.GetEntitiesInSphere(ref position);

            foreach (MyEntity entity in entities)
            {
                if (entity is MySafeZone)
                {
                    safezone = entity;
                }
            }
            return(MyEntities.FindFreePlaceCustom(position.RandomToUniformPointInSphereWithInnerCutout(rand.NextDouble(), rand.NextDouble(), rand.NextDouble(), cutout).GetValueOrDefault(), sphere.Radius + 50, 20, 5, 1, 0, safezone));
        }