From a22c505984697881f5f911a165ee022087b69e09 Mon Sep 17 00:00:00 2001 From: chai <215380520@qq.com> Date: Mon, 20 May 2024 22:36:58 +0800 Subject: *rename --- Thronefall_1_0/Decompile/KeepRelativeRotationTo.cs | 59 ---------------------- 1 file changed, 59 deletions(-) delete mode 100644 Thronefall_1_0/Decompile/KeepRelativeRotationTo.cs (limited to 'Thronefall_1_0/Decompile/KeepRelativeRotationTo.cs') diff --git a/Thronefall_1_0/Decompile/KeepRelativeRotationTo.cs b/Thronefall_1_0/Decompile/KeepRelativeRotationTo.cs deleted file mode 100644 index 94dbe16..0000000 --- a/Thronefall_1_0/Decompile/KeepRelativeRotationTo.cs +++ /dev/null @@ -1,59 +0,0 @@ -using UnityEngine; - -public class KeepRelativeRotationTo : MonoBehaviour -{ - [SerializeField] - private Transform transformToKeepRelativeRotationTo; - - [SerializeField] - private Vector3 upVector = Vector3.up; - - private Quaternion initialOffset; - - private Vector3 selfPosition; - - private Vector3 otherPosition; - - private Quaternion localRotationStart; - - private Vector3 upVectorAdjusted; - - private void PrepareData() - { - if ((bool)base.transform.parent) - { - selfPosition = base.transform.localPosition; - otherPosition = base.transform.parent.worldToLocalMatrix.MultiplyPoint(transformToKeepRelativeRotationTo.position); - upVectorAdjusted = upVector; - } - else - { - selfPosition = base.transform.position; - otherPosition = transformToKeepRelativeRotationTo.position; - upVectorAdjusted = upVector; - } - } - - private void Start() - { - if ((bool)base.transform.parent) - { - upVector = base.transform.localToWorldMatrix.MultiplyVector(upVector); - upVector = base.transform.parent.localToWorldMatrix.MultiplyVector(upVector); - upVector = upVector.normalized; - } - localRotationStart = base.transform.localRotation; - PrepareData(); - initialOffset = Quaternion.Inverse(Quaternion.LookRotation(otherPosition - selfPosition, upVectorAdjusted)); - } - - private void Update() - { - if ((bool)transformToKeepRelativeRotationTo) - { - PrepareData(); - Quaternion quaternion = Quaternion.LookRotation(otherPosition - selfPosition, upVectorAdjusted); - base.transform.localRotation = quaternion * initialOffset * localRotationStart; - } - } -} -- cgit v1.1-26-g67d0