Tweaks but it works tho

This commit is contained in:
Nick 2022-04-18 11:53:44 -04:00
parent b4675a5c50
commit 87d4d3ad83
3 changed files with 6 additions and 7 deletions

View File

@ -17,7 +17,6 @@ namespace NewHorizons.Builder.Orbital
{ {
public static InitialMotion Make(GameObject body, AstroObject primaryBody, AstroObject secondaryBody, OWRigidbody OWRB, OrbitModule orbit) public static InitialMotion Make(GameObject body, AstroObject primaryBody, AstroObject secondaryBody, OWRigidbody OWRB, OrbitModule orbit)
{ {
body.SetActive(false);
InitialMotion initialMotion = body.AddComponent<InitialMotion>(); InitialMotion initialMotion = body.AddComponent<InitialMotion>();
// This bit makes the initial motion not try to calculate the orbit velocity itself for reasons // This bit makes the initial motion not try to calculate the orbit velocity itself for reasons
@ -76,8 +75,6 @@ namespace NewHorizons.Builder.Orbital
initialMotion._initLinearSpeed = 0f; initialMotion._initLinearSpeed = 0f;
} }
body.SetActive(true);
return initialMotion; return initialMotion;
} }
@ -140,6 +137,7 @@ namespace NewHorizons.Builder.Orbital
); );
// We know their velocities sum up to the total relative velocity and are related to the masses / distances // We know their velocities sum up to the total relative velocity and are related to the masses / distances
// Idk where the times 2 comes from but it makes it work? Idk theres 2 planets? Makes no sense
var relativeVelocity = 2f * reducedOrbit.InitialVelocity; var relativeVelocity = 2f * reducedOrbit.InitialVelocity;
var secondaryVelocity = relativeVelocity / (1f + (r1 / r2)); var secondaryVelocity = relativeVelocity / (1f + (r1 / r2));
var primaryVelocity = relativeVelocity - secondaryVelocity; var primaryVelocity = relativeVelocity - secondaryVelocity;

View File

@ -60,9 +60,9 @@ namespace NewHorizons.Builder.Orbital
orbitLine._astroObject = astroobject; orbitLine._astroObject = astroobject;
orbitLine._fade = fade; orbitLine._fade = fade;
orbitLine._lineWidth = 0.3f; orbitLine._lineWidth = 1f;
orbitLine.InitializeLineRenderer(); Main.Instance.ModHelper.Events.Unity.FireOnNextUpdate(orbitLine.InitializeLineRenderer);
} }
} }
} }

View File

@ -17,9 +17,10 @@ namespace NewHorizons.Components.Orbital
public GameObject FakeMassBody { get; set; } public GameObject FakeMassBody { get; set; }
void Awake() void Start()
{ {
FakeMassBody.SetActive(true); // Make sure its active but maybe it hasn't been set yet
if(FakeMassBody) FakeMassBody.SetActive(true);
} }
void Update() void Update()