BowQuatDebug.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. public class BowQuatDebug : MonoBehaviour
  6. {
  7. Text text;
  8. public static BowQuatDebug ins;
  9. void Start()
  10. {
  11. ins = this;
  12. text = GetComponentInChildren<Text>();
  13. }
  14. void OnDestroy() {
  15. if (ins == this) ins = null;
  16. }
  17. public void ShowModuleQuat(Vector3 angles) {
  18. string ax = angles.x.ToString("#0.000");
  19. string ay = angles.y.ToString("#0.000");
  20. string az = angles.z.ToString("#0.000");
  21. text.text = $"模块欧拉角\nX: {ax} \nY: {ay} \nZ: {az}";
  22. }
  23. public void ShowRealBowQuat(Vector3 angles) {
  24. string rx = (angles.x > 180 ? 360f - angles.x : -angles.x).ToString("#0.000");
  25. string ry = (angles.y > 180 ? angles.y - 360f : angles.y).ToString("#0.000");
  26. text.text = $"------现实弓------\n上下旋转角度: {rx}°\n左右旋转角度: {ry}°";
  27. }
  28. public void ShowGameBowQuat(Vector3 angles) {
  29. string rx = (angles.x > 180 ? 360f - angles.x : -angles.x).ToString("#0.000");
  30. string ry = (angles.y > 180 ? angles.y - 360f : angles.y).ToString("#0.000");
  31. text.text += $"\n------游戏弓------\n上下旋转角度: {rx}°\n左右旋转角度: {ry}°";
  32. }
  33. }