lvjincheng 4 лет назад
Родитель
Сommit
d165af0d26
1 измененных файлов с 12 добавлено и 7 удалено
  1. 12 7
      Assets/BowArrow/Scripts/Bluetooth/ShootCheck.cs

+ 12 - 7
Assets/BowArrow/Scripts/Bluetooth/ShootCheck.cs

@@ -41,7 +41,7 @@ public class ShootCheck : MonoBehaviour
 //socket
         string ipStr = ipInputField.text;//ipInputField.GetComponentInChildren<Text>();
         string serverIP = ipStr;
-        //serverIP = "172.16.20.57";
+        serverIP = "172.16.20.57";
         string address = "ws://" + serverIP + ":8088/Ble/";
         webSocket = new WebSocket(new Uri(address));
 #if !UNITY_WEBGL
@@ -181,10 +181,16 @@ public class ShootCheck : MonoBehaviour
             {
                 maxAcc = acc;
             }
+            // if (acc == 15.99951f) {
             if (acc > 15.9f) {
-                double p1 = -1.188748333;
-                double p2 = 0.033890372;
-                double p3 = 3.408473747;
+                // double p1 = -1.188748333;
+                // double p2 = 0.033890372;
+                // double p3 = 3.408473747;
+
+                double p1 = -1.56729339506415;
+                double p2 = 0.0397744840580165;
+                double p3 = 4.73453844008481;
+
                 float x = (keyAccList.Count + 1) * 2; //单位毫秒
                 double y = 1.0 / (p1+p2*Mathf.Pow(x, 0.5f)*Mathf.Log(x)+p3/Mathf.Pow(x, 0.5f));
                 acc = (float) y;
@@ -220,8 +226,7 @@ public class ShootCheck : MonoBehaviour
             string strShootSpeed = "初速度: " + shootSpeed + " 帧数: " + keyAccList.Count + "\n";
             Debug.LogWarning(strShootSpeed);
             
-            
-            string str1 = strShootSpeed + "检测到射出的数据:\n";
+            string str1 = strShootSpeed + "/////////检测到射出的数据////////////:\n";
             for (int i=0;i<keyAccList.Count;i++)
             {
                 float keyAcc = keyAccList.ElementAt(i);
@@ -232,7 +237,7 @@ public class ShootCheck : MonoBehaviour
             Debug.LogWarning(str1);
             if (webSocket != null)
             { 
-                webSocket.Send(str1);    
+                webSocket.Send(str1+"/////////检测到射出的数据////////////:\n");    
             }
             //本轮计算结束
             keyAccList.Clear();