using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class BowQuatDebug : MonoBehaviour { Text text; public static BowQuatDebug ins; void Start() { ins = this; text = GetComponentInChildren(); } void OnDestroy() { if (ins == this) ins = null; } public void ShowModuleQuat(Vector3 angles) { string ax = angles.x.ToString("#0.000"); string ay = angles.y.ToString("#0.000"); string az = angles.z.ToString("#0.000"); text.text = $"模块欧拉角\nX: {ax} \nY: {ay} \nZ: {az}"; } public void ShowRealBowQuat(Vector3 angles) { string rx = (angles.x > 180 ? 360f - angles.x : -angles.x).ToString("#0.000"); string ry = (angles.y > 180 ? angles.y - 360f : angles.y).ToString("#0.000"); text.text = $"------现实弓------\n上下旋转角度: {rx}°\n左右旋转角度: {ry}°"; } public void ShowGameBowQuat(Vector3 angles) { string rx = (angles.x > 180 ? 360f - angles.x : -angles.x).ToString("#0.000"); string ry = (angles.y > 180 ? angles.y - 360f : angles.y).ToString("#0.000"); text.text += $"\n------游戏弓------\n上下旋转角度: {rx}°\n左右旋转角度: {ry}°"; } }