mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Fix stupid initial tidally locked rotation
This commit is contained in:
parent
e26ab0fa18
commit
91e3144e1b
@ -41,9 +41,6 @@ namespace NewHorizons.Builder.General
|
||||
var alignmentAxis = config.Orbit.alignmentAxis ?? new Vector3(0, -1, 0);
|
||||
|
||||
// Start it off facing the right way
|
||||
var facing = body.transform.TransformDirection(alignmentAxis);
|
||||
body.transform.rotation = Quaternion.FromToRotation(facing, alignmentAxis) * body.transform.rotation;
|
||||
|
||||
var alignment = body.AddComponent<AlignWithTargetBody>();
|
||||
alignment.SetTargetBody(primaryBody?.GetAttachedOWRigidbody());
|
||||
alignment._localAlignmentAxis = alignmentAxis;
|
||||
@ -52,7 +49,7 @@ namespace NewHorizons.Builder.General
|
||||
// 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.transform.rotation = Quaternion.FromToRotation(currentDirection, targetDirection) * alignment.transform.rotation;
|
||||
alignment._owRigidbody.SetAngularVelocity(Vector3.zero);
|
||||
|
||||
// Static bodies won't update rotation with physics for some reason
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user