protected override void MoveTowardsTarget() { Vector3 pos = CurrentTarget.GetPosition(); pos.y = Mathf.Max(TravelHeight, pos.y); SwarmCenter.position = pos; }
private void StartGravity() { Vector3D position = MyEntity.GetPosition(); foreach (MyPlanet planet in Globals.AllPlanets()) { if (planet.IsPositionInGravityWell(position)) { Vector3D targetPosition = CurrentTarget.GetPosition(); if (!planet.IsPositionInGravityWell(targetPosition)) { Log.DebugLog("Target is not in gravity well, target position: " + targetPosition + ", planet: " + planet.getBestName(), Logger.severity.WARNING); return; } Vector3 gravAtTarget = planet.GetWorldGravityNormalized(ref targetPosition); m_gravData = new GravityData(planet, gravAtTarget); break; } } if (m_gravData != null) { UpdateGravity(); } }