mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Initial planet rotation. Fixes #360
This commit is contained in:
parent
f05e2be30a
commit
64efe36511
@ -24,10 +24,12 @@ namespace NewHorizons.Builder.Orbital
|
||||
initialMotion._initAngularSpeed = orbit.siderealPeriod == 0 ? 0f : 2f * Mathf.PI / (orbit.siderealPeriod * 60f);
|
||||
var rotationAxis = Quaternion.AngleAxis(orbit.axialTilt, Vector3.right) * Vector3.up;
|
||||
|
||||
// For things with children this is broken
|
||||
// For stock planets with unsuspended rigidbody children this is broken
|
||||
// For planets with rafts this is broken
|
||||
if (AstroObjectLocator.GetChildren(secondaryBody).Length == 0)
|
||||
{
|
||||
secondaryBody.transform.rotation = Quaternion.FromToRotation(Vector3.up, rotationAxis);
|
||||
secondaryBody.transform.Rotate(rotationAxis, orbit.initialRotation);
|
||||
}
|
||||
|
||||
if (!orbit.isStatic && primaryBody != null)
|
||||
|
||||
6
NewHorizons/External/Modules/OrbitModule.cs
vendored
6
NewHorizons/External/Modules/OrbitModule.cs
vendored
@ -34,6 +34,12 @@ namespace NewHorizons.External.Modules
|
||||
/// </summary>
|
||||
public float siderealPeriod;
|
||||
|
||||
/// <summary>
|
||||
/// Offsets the planet's starting sidereal rotation. In degrees.
|
||||
/// </summary>
|
||||
[Range(0f, 360f)]
|
||||
public float initialRotation;
|
||||
|
||||
/// <summary>
|
||||
/// Should the body always have one side facing its primary?
|
||||
/// </summary>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user