mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Make tidal locking affecting spawn more consistent
This commit is contained in:
parent
5202326fce
commit
f8cc0e4b64
@ -46,13 +46,17 @@ namespace NewHorizons.Builder.General
|
||||
|
||||
var alignment = body.AddComponent<AlignWithTargetBody>();
|
||||
alignment.SetTargetBody(primaryBody?.GetAttachedOWRigidbody());
|
||||
alignment._usePhysicsToRotate = false;
|
||||
alignment._localAlignmentAxis = alignmentAxis;
|
||||
alignment._owRigidbody = body.GetComponent<OWRigidbody>();
|
||||
|
||||
// Have it face the right way
|
||||
var currentDirection = alignment.transform.TransformDirection(alignment._localAlignmentAxis);
|
||||
var targetDirection = alignment.GetAlignmentDirection();
|
||||
alignment.transform.rotation = Quaternion.FromToRotation(currentDirection, targetDirection);
|
||||
alignment._owRigidbody.SetAngularVelocity(Vector3.zero);
|
||||
|
||||
// Static bodies won't update rotation with physics for some reason
|
||||
// Have to set it in 2 ticks else it flings the player into deep space on spawn (#171)
|
||||
// Pushed to 3 frames after system is ready, bc spawning takes 2 frames, this is hurting my brain too much to try to improve the numbers idc
|
||||
if (!config.Orbit.isStatic) Delay.RunWhen(() => Main.IsSystemReady, () => Delay.FireInNUpdates(() => alignment._usePhysicsToRotate = true, 3));
|
||||
alignment._usePhysicsToRotate = !config.Orbit.isStatic;
|
||||
}
|
||||
|
||||
if (config.Base.centerOfSolarSystem)
|
||||
|
||||
@ -41,7 +41,7 @@ namespace NewHorizons.Handlers
|
||||
if (matchInitialMotion != null) UnityEngine.Object.Destroy(matchInitialMotion);
|
||||
|
||||
// Arbitrary number, depending on the machine some people die, some people fall through the floor, its very inconsistent
|
||||
Delay.StartCoroutine(SpawnCoroutine(10));
|
||||
Delay.StartCoroutine(SpawnCoroutine(30));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user