yichael 4 лет назад
Родитель
Сommit
1420def1d4
1 измененных файлов с 15 добавлено и 5 удалено
  1. 15 5
      Assets/BowArrow/Scripts/Bluetooth/o09Axis.cs

+ 15 - 5
Assets/BowArrow/Scripts/Bluetooth/o09Axis.cs

@@ -660,8 +660,8 @@ public class o09Axis
     public List<o0UIRawImageTester> Tester = new List<o0UIRawImageTester>();
     public List<o0UIRawImageTester> Tester = new List<o0UIRawImageTester>();
     public List<Text> TextTester = new List<Text>();
     public List<Text> TextTester = new List<Text>();
 
 
-    static Vector3 AccIdentity = new Vector3(0, -1, 0);
-    static Vector3 MagIdentity = new Vector3(-1, 2, 0).normalized;
+    static public Vector3 AccIdentity = new Vector3(0, -1, 0);
+    static public Vector3 MagIdentity = new Vector3(-1, 2, 0).normalized;
     public class State
     public class State
     {
     {
         public long TimeGap;
         public long TimeGap;
@@ -758,6 +758,8 @@ public class o09Axis
         newQua.eulerAngles = Gyr * TimeGap;
         newQua.eulerAngles = Gyr * TimeGap;
         var quaGyr = LastQuaternion * newQua;
         var quaGyr = LastQuaternion * newQua;
 
 
+        
+
         // Accwit.transform.localRotation = o0Project.o0.FormQuaternion(Accwit.transform.localRotation, AccIdentity, Acc, 1);
         // Accwit.transform.localRotation = o0Project.o0.FormQuaternion(Accwit.transform.localRotation, AccIdentity, Acc, 1);
         // Magwit.transform.localRotation = o0Project.o0.FormQuaternion(Magwit.transform.localRotation, MagIdentity, Mag, 1);
         // Magwit.transform.localRotation = o0Project.o0.FormQuaternion(Magwit.transform.localRotation, MagIdentity, Mag, 1);
 
 
@@ -898,11 +900,19 @@ public class o09Axis
 //         TextTester[19].text = "y轴角度:" + (Mathf.Atan(frontV.z / frontV.x) / Mathf.PI * 180+(frontV.x < 0 ? 90:270));
 //         TextTester[19].text = "y轴角度:" + (Mathf.Atan(frontV.z / frontV.x) / Mathf.PI * 180+(frontV.x < 0 ? 90:270));
 //         TextTester[20].text = "z轴角度" + (Mathf.Atan(upV.y / upV.x) / Mathf.PI * 180 + (upV.x < 0 ? 90:270));
 //         TextTester[20].text = "z轴角度" + (Mathf.Atan(upV.y / upV.x) / Mathf.PI * 180 + (upV.x < 0 ? 90:270));
 
 
-        TextTester[12].text = "x轴角度:\n" + (Mathf.Atan(upV.y / upV.z) / Mathf.PI * 180 + (upV.z < 0 ? 90:270));
-        TextTester[13].text = "y轴角度:\n" + (Mathf.Atan(frontV.z / frontV.x) / Mathf.PI * 180+(frontV.x < 0 ? 90:270));
-        TextTester[14].text = "z轴角度:\n" + (Mathf.Atan(upV.y / upV.x) / Mathf.PI * 180 + (upV.x < 0 ? 90:270));
+//         TextTester[12].text = "x轴角度:\n" + (Mathf.Atan(upV.y / upV.z) / Mathf.PI * 180 + (upV.z < 0 ? 90:270));
+//         TextTester[13].text = "y轴角度:\n" + (Mathf.Atan(frontV.z / frontV.x) / Mathf.PI * 180+(frontV.x < 0 ? 90:270));
+//         TextTester[14].text = "z轴角度:\n" + (Mathf.Atan(upV.y / upV.x) / Mathf.PI * 180 + (upV.x < 0 ? 90:270));
+
 
 
+        //TextTester[12].text = "加速计:" + Acc;
+        //TextTester[13].text = "陀螺仪:" + Gyr;
+        //TextTester[14].text = "地磁计:" + Mag;
 
 
+        TextTester[12].text = "x:" +x;
+        TextTester[13].text = "y:" +y;
+        TextTester[14].text = "z:" +z;
+ 
      /*   Tester?[0].DrawLine(Vector3.Angle(Last.Acc, state.Acc) / 3f, new Color(0, 0, 1));
      /*   Tester?[0].DrawLine(Vector3.Angle(Last.Acc, state.Acc) / 3f, new Color(0, 0, 1));
         Tester?[1].DrawLine(Vector3.Angle(Last.AccSmooth, state.AccSmooth) / 3f, new Color(0, 0, 1));
         Tester?[1].DrawLine(Vector3.Angle(Last.AccSmooth, state.AccSmooth) / 3f, new Color(0, 0, 1));
         Tester?[3].DrawLine(Vector3.Angle(Last.Mag, state.Mag) / 3f, new Color(0, 0, 1));
         Tester?[3].DrawLine(Vector3.Angle(Last.Mag, state.Mag) / 3f, new Color(0, 0, 1));