Ver Fonte

地磁校准圆修正

lvjincheng há 3 anos atrás
pai
commit
754ee04faf

+ 2 - 2
Assets/BowArrow/Scripts/Bluetooth/AimHandler.cs

@@ -189,9 +189,9 @@ public class AimHandler : MonoBehaviour
                 //绘制椭圆形
                 if (MagCalibrater._Radius != this.ellipseScript.ellipseTran.localScale)
                 {
-                    this.ellipseScript.setEllipseLocalScaleAndCenter(MagCalibrater._Radius, MagCalibrater._Center* ratio);
+                    this.ellipseScript.setEllipseLocalScaleAndCenter(MagCalibrater._Radius, MagCalibrater._Center * ratio);
                     //设置绘制图像相机的对应位置
-                    this.ellipseScript.setCameraPos(MagCalibrater._Center * 0.5f);
+                    this.ellipseScript.setCameraPos(MagCalibrater._Center * ratio);
                 }
 
                 MagCalibrationButton.GetComponentInChildren<Text>().text = "开始地磁计校准";

+ 7 - 6
Assets/BowArrow/test-ellipse/Ellipse.cs

@@ -42,14 +42,15 @@ public class Ellipse : MonoBehaviour
     }
 
     //设置camera 的观测位置
+    float cameraOffsetScale = 1.0f;
     public void setCameraPos(Vector3 center)
     {
-
-        this.cameraXTran.localPosition = new Vector3(this.cameraXTran.localPosition.x, center.y, center.z);
-
-        this.cameraYTran.localPosition = new Vector3(center.x, this.cameraYTran.localPosition.y,center.z );
-
-        this.cameraZTran.localPosition = new Vector3(center.x, center.y, this.cameraZTran.localPosition.z);
+        this.cameraXTran.localPosition = new Vector3(center.x - 10 * cameraOffsetScale, center.y, center.z);
+        this.cameraYTran.localPosition = new Vector3(center.x, center.y + 10 * cameraOffsetScale, center.z);
+        this.cameraZTran.localPosition = new Vector3(center.x, center.y, center.z - 10 * cameraOffsetScale);
+        // this.cameraXTran.localPosition = new Vector3(this.cameraXTran.localPosition.x, center.y, center.z);
+        // this.cameraYTran.localPosition = new Vector3(center.x, this.cameraYTran.localPosition.y, center.z);
+        // this.cameraZTran.localPosition = new Vector3(center.x, center.y, this.cameraZTran.localPosition.z);
     }