private Vector3D?FindPastePosition(Vector3D Target)
        {
            BoundingSphereD 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.
             */

            return(MyEntities.FindFreePlaceCustom(Target, (float)sphere.Radius, 90, 10, 1.5f, 5));
        }
Example #2
0
        private Vector3D?FindPastePosition(Vector3D Target)
        {
            //Log.info($"BoundingSphereD: {SphereD.Center}, {SphereD.Radius}");
            //Log.info($"MyOrientedBoundingBoxD: {BoxD.Center}, {BoxD.GetAABB()}");
            MyGravityProviderSystem.CalculateNaturalGravityInPoint(Target, out float val);
            if (val == 0)
            {
                //following method is what SEworldgen uses. We only really need to use this in space
                return(FindSuitableJumpLocationSpace(Target));
            }

            return(MyEntities.FindFreePlaceCustom(Target, (float)SphereD.Radius, 90, 10, 1.5f, 10));
        }
Example #3
0
        public static Vector3D FindFreePos(BoundingSphereD gate, float sphereradius)
        {
            Random rand = new Random();

            MyEntity safezone = null;
            var      entities = MyEntities.GetEntitiesInSphere(ref gate);

            foreach (MyEntity myentity in entities)
            {
                if (myentity is MySafeZone)
                {
                    safezone = myentity;
                }
            }
            return((Vector3D)MyEntities.FindFreePlaceCustom(gate.RandomToUniformPointInSphere(rand.NextDouble(), rand.NextDouble(), rand.NextDouble()), sphereradius, 20, 5, 1, 0, safezone));
        }
Example #4
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));
        }