mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Fix tidal lock alignment (comet tails broken tho)
This commit is contained in:
parent
f89a27922d
commit
4eb50ebdfa
@ -1,4 +1,5 @@
|
|||||||
using NewHorizons.External;
|
using NewHorizons.External;
|
||||||
|
using NewHorizons.External.Configs;
|
||||||
using OWML.Utils;
|
using OWML.Utils;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -11,13 +12,17 @@ namespace NewHorizons.Builder.Body
|
|||||||
{
|
{
|
||||||
public static class CometTailBuilder
|
public static class CometTailBuilder
|
||||||
{
|
{
|
||||||
public static void Make(GameObject go, BaseModule module, AstroObject primary)
|
public static void Make(GameObject go, IPlanetConfig config, AstroObject primary)
|
||||||
{
|
{
|
||||||
var cometTail = GameObject.Instantiate(GameObject.Find("Comet_Body/Sector_CO/Effects_CO/Effects_CO_TailMeshes"), go.transform);
|
var cometTail = GameObject.Instantiate(GameObject.Find("Comet_Body/Sector_CO/Effects_CO/Effects_CO_TailMeshes"), go.transform);
|
||||||
cometTail.transform.localPosition = Vector3.zero;
|
cometTail.transform.localPosition = Vector3.zero;
|
||||||
cometTail.name = "CometTail";
|
cometTail.name = "CometTail";
|
||||||
cometTail.transform.localScale = Vector3.one * module.SurfaceSize / 110;
|
cometTail.transform.localScale = Vector3.one * config.Base.SurfaceSize / 110;
|
||||||
cometTail.transform.localRotation = Quaternion.Euler(180, 0, 0);
|
|
||||||
|
Vector3 alignmentAxis = new Vector3(0, -1, 0);
|
||||||
|
if (config.Orbit.AlignmentAxis != null) alignmentAxis = config.Orbit.AlignmentAxis;
|
||||||
|
|
||||||
|
cometTail.transform.localRotation = Quaternion.Euler(0, 270, 90) * Quaternion.FromToRotation(new Vector3(0, -1, 0), alignmentAxis);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -66,7 +66,15 @@ namespace NewHorizons.Builder.General
|
|||||||
var alignment = body.AddComponent<AlignWithTargetBody>();
|
var alignment = body.AddComponent<AlignWithTargetBody>();
|
||||||
alignment.SetTargetBody(primaryBody?.GetAttachedOWRigidbody());
|
alignment.SetTargetBody(primaryBody?.GetAttachedOWRigidbody());
|
||||||
alignment.SetValue("_usePhysicsToRotate", true);
|
alignment.SetValue("_usePhysicsToRotate", true);
|
||||||
alignment._localAlignmentAxis = Vector3.left;
|
if(config.Orbit.AlignmentAxis == null)
|
||||||
|
{
|
||||||
|
alignment._localAlignmentAxis = new Vector3(0, -1, 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
alignment._localAlignmentAxis = config.Orbit.AlignmentAxis;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.Base.CenterOfSolarSystem)
|
if (config.Base.CenterOfSolarSystem)
|
||||||
|
|||||||
1
NewHorizons/External/OrbitModule.cs
vendored
1
NewHorizons/External/OrbitModule.cs
vendored
@ -22,6 +22,7 @@ namespace NewHorizons.External
|
|||||||
public float AxialTilt { get; set; }
|
public float AxialTilt { get; set; }
|
||||||
public float SiderealPeriod { get; set; }
|
public float SiderealPeriod { get; set; }
|
||||||
public bool IsTidallyLocked { get; set; }
|
public bool IsTidallyLocked { get; set; }
|
||||||
|
public MVector3 AlignmentAxis { get; set; }
|
||||||
public bool ShowOrbitLine { get; set; } = true;
|
public bool ShowOrbitLine { get; set; } = true;
|
||||||
public bool IsStatic { get; set; }
|
public bool IsStatic { get; set; }
|
||||||
public MColor Tint { get; set; }
|
public MColor Tint { get; set; }
|
||||||
|
|||||||
@ -292,7 +292,7 @@ namespace NewHorizons.Handlers
|
|||||||
AsteroidBeltBuilder.Make(body.Config.Name, body.Config, body.Mod);
|
AsteroidBeltBuilder.Make(body.Config.Name, body.Config, body.Mod);
|
||||||
|
|
||||||
if (body.Config.Base.HasCometTail)
|
if (body.Config.Base.HasCometTail)
|
||||||
CometTailBuilder.Make(go, body.Config.Base, go.GetComponent<AstroObject>().GetPrimaryBody());
|
CometTailBuilder.Make(go, body.Config, go.GetComponent<AstroObject>().GetPrimaryBody());
|
||||||
|
|
||||||
// Backwards compatability
|
// Backwards compatability
|
||||||
if (body.Config.Base.LavaSize != 0)
|
if (body.Config.Base.LavaSize != 0)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user