|
|
@@ -142,8 +142,8 @@ public class AimHandler : MonoBehaviour
|
|
|
{
|
|
|
MagCalibrater.Calibration = calibration;
|
|
|
MagCalibrationButton.GetComponentInChildren<Text>().text = "停止地磁计校准";
|
|
|
- this.cMaxVector = new Vector3(0, 0, 0);
|
|
|
- this.cMinVector = new Vector3(0, 0, 0);
|
|
|
+ this.cMaxVector = new Vector3(float.MinValue, float.MinValue, float.MinValue);
|
|
|
+ this.cMinVector = new Vector3(float.MaxValue, float.MaxValue, float.MaxValue);
|
|
|
this.ellipseScript.ellipseTran.gameObject.SetActive(false);
|
|
|
}
|
|
|
else
|
|
|
@@ -218,6 +218,7 @@ public class AimHandler : MonoBehaviour
|
|
|
varianceV /= listArray.Length;
|
|
|
isCalibrateMagPerfect = varianceV < 0.001;
|
|
|
Debug.Log("jc-地磁校准方差=" + varianceV);
|
|
|
+ PopupMgr.ins.ShowTip("地磁校准方差 = " + varianceV);
|
|
|
}
|
|
|
#endregion
|
|
|
}
|
|
|
@@ -337,19 +338,16 @@ public class AimHandler : MonoBehaviour
|
|
|
{
|
|
|
this.ellipseScript.AddAndUpdatePointArray(Mag);
|
|
|
|
|
|
- if (Mag.magnitude > this.cMaxVector.magnitude)
|
|
|
- {
|
|
|
- this.cMaxVector = Mag;
|
|
|
- }
|
|
|
- else if (Mag.magnitude < this.cMinVector.magnitude) {
|
|
|
- this.cMinVector = Mag;
|
|
|
- }
|
|
|
+ if (Mag.x > cMaxVector.x) cMaxVector.x = Mag.x;
|
|
|
+ if (Mag.y > cMaxVector.y) cMaxVector.y = Mag.y;
|
|
|
+ if (Mag.z > cMaxVector.z) cMaxVector.z = Mag.z;
|
|
|
+ if (Mag.x < cMinVector.x) cMinVector.x = Mag.x;
|
|
|
+ if (Mag.y < cMinVector.y) cMinVector.y = Mag.y;
|
|
|
+ if (Mag.z < cMinVector.z) cMinVector.z = Mag.z;
|
|
|
|
|
|
- Vector3 _center = this.cMaxVector - this.cMinVector;
|
|
|
- Debug.LogWarning(_center + " == "+ _center.magnitude);
|
|
|
//设置绘制图像相机的对应位置
|
|
|
- this.ellipseScript.setCameraPos(_center/2);
|
|
|
- this.ellipseScript.setCameraSize(_center.magnitude);
|
|
|
+ this.ellipseScript.setCameraPos((this.cMaxVector + this.cMinVector)/2);
|
|
|
+ this.ellipseScript.setCameraSize(this.cMaxVector - this.cMinVector);
|
|
|
}
|
|
|
Mag = MagCalibrater.Update(Mag);
|
|
|
|