fixed bug with wall text not rotating around its normal properly

This commit is contained in:
FreezeDriedMangoes 2023-01-27 13:29:55 -05:00
parent a13b790145
commit b62db562f0

View File

@ -170,8 +170,11 @@ namespace NewHorizons.Builder.Props
var up = (nomaiWallTextObj.transform.position - planetGO.transform.position).normalized; var up = (nomaiWallTextObj.transform.position - planetGO.transform.position).normalized;
var forward = planetGO.transform.TransformDirection(info.normal).normalized; var forward = planetGO.transform.TransformDirection(info.normal).normalized;
nomaiWallTextObj.transform.up = up;
nomaiWallTextObj.transform.forward = forward; nomaiWallTextObj.transform.forward = forward;
var desiredUp = Vector3.ProjectOnPlane(up, forward);
var zRotation = Vector3.SignedAngle(nomaiWallTextObj.transform.up, desiredUp, forward);
nomaiWallTextObj.transform.RotateAround(nomaiWallTextObj.transform.position, forward, zRotation);
} }
if (info.rotation != null) if (info.rotation != null)
{ {