mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Improved gravitational sphere of influence calculations
This commit is contained in:
parent
784d654d3c
commit
0e51c14b74
@ -49,6 +49,14 @@ namespace NewHorizons.Builder.General
|
||||
astroObject.SetValue("_customName", config.Name);
|
||||
astroObject.SetValue("_primaryBody", primaryBody);
|
||||
|
||||
// Expand gravitational sphere of influence of the primary to encompass this body if needed
|
||||
if(primaryBody != null && !config.Orbit.IsStatic)
|
||||
{
|
||||
var primarySphereOfInfluence = primaryBody.GetGravityVolume().gameObject.GetComponent<SphereCollider>();
|
||||
if (primarySphereOfInfluence.radius < config.Orbit.SemiMajorAxis)
|
||||
primarySphereOfInfluence.radius = config.Orbit.SemiMajorAxis * 1.5f;
|
||||
}
|
||||
|
||||
if (config.Orbit.IsTidallyLocked)
|
||||
{
|
||||
var alignment = body.AddComponent<AlignWithTargetBody>();
|
||||
|
||||
@ -20,7 +20,7 @@ namespace NewHorizons.Builder.General
|
||||
if (exponent == 2f) gravityRadius = Mathf.Sqrt(gravityRadius);
|
||||
|
||||
// To let you actually orbit things the way you would expect we cap this at 4x the diameter if its not a star or black hole (this is what giants deep has)
|
||||
if (config.Star != null || config.Singularity != null) gravityRadius = Mathf.Min(gravityRadius, 4 * config.Base.SurfaceSize);
|
||||
if (config.Star == null && config.Singularity == null) gravityRadius = Mathf.Min(gravityRadius, 4 * config.Base.SurfaceSize);
|
||||
else gravityRadius = Mathf.Min(gravityRadius, 15 * config.Base.SurfaceSize);
|
||||
if (config.Base.SphereOfInfluence != 0f) gravityRadius = config.Base.SphereOfInfluence;
|
||||
|
||||
|
||||
@ -100,6 +100,7 @@ namespace NewHorizons.Builder.Props
|
||||
component.SetSector(sector);
|
||||
}
|
||||
|
||||
|
||||
foreach (var component in prop.GetComponentsInChildren<Component>())
|
||||
{
|
||||
// TODO: Make this work or smthng
|
||||
@ -110,6 +111,7 @@ namespace NewHorizons.Builder.Props
|
||||
if(enabledField != null && enabledField.FieldType == typeof(bool)) enabledField.SetValue(component, true);
|
||||
}
|
||||
|
||||
|
||||
prop.transform.position = position == null ? go.transform.position : go.transform.TransformPoint((Vector3)position);
|
||||
|
||||
Quaternion rot = rotation == null ? Quaternion.identity : Quaternion.Euler((Vector3)rotation);
|
||||
|
||||
@ -202,6 +202,19 @@ namespace NewHorizons
|
||||
Logger.Log($"Is the player warping in? {IsWarping}");
|
||||
if (IsWarping) Instance.ModHelper.Events.Unity.FireInNUpdates(() => _shipWarpController.WarpIn(), 1);
|
||||
IsWarping = false;
|
||||
|
||||
// Fix some camera stuff
|
||||
/*
|
||||
foreach(var owc in GameObject.FindObjectsOfType<OWCamera>())
|
||||
{
|
||||
var far = Main.FurthestOrbit * 10f;
|
||||
if (owc.farClipPlane < far)
|
||||
{
|
||||
owc.farClipPlane = far;
|
||||
owc.mainCamera.farClipPlane = far;
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
#region TitleScreen
|
||||
|
||||
@ -80,16 +80,21 @@ namespace NewHorizons.Utility
|
||||
|
||||
public static void OnMapControllerAwake(MapController __instance, ref float ____maxPanDistance, ref float ____maxZoomDistance, ref float ____minPitchAngle, ref float ____zoomSpeed)
|
||||
{
|
||||
Logger.Log($"Other far? {Main.FurthestOrbit}");
|
||||
____maxPanDistance = Main.FurthestOrbit * 1.5f;
|
||||
____maxZoomDistance *= 6f;
|
||||
____minPitchAngle = -90f;
|
||||
____zoomSpeed *= 4f;
|
||||
__instance._mapCamera.farClipPlane = Main.FurthestOrbit * 3f;
|
||||
__instance._mapCamera.farClipPlane = Main.FurthestOrbit * 10f;
|
||||
}
|
||||
|
||||
public static void OnOWCameraAwake(OWCamera __instance)
|
||||
{
|
||||
__instance.farClipPlane *= 4f;
|
||||
/*
|
||||
var far = Main.FurthestOrbit * 10f;
|
||||
__instance.farClipPlane = far;
|
||||
__instance.mainCamera.farClipPlane = far;
|
||||
*/
|
||||
}
|
||||
|
||||
public static bool OnSunLightParamUpdaterLateUpdate(SunLightParamUpdater __instance)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user