debug2
parent
872ce15ab4
commit
04224a791b
|
@ -104,7 +104,7 @@ public class GameManager : MonoBehaviour
|
|||
// 计算角速度的变化(可以设定角速度的阈值或限制其过快变化)
|
||||
angleX += gx * dt; // 绕X轴旋转
|
||||
angleY += gy * dt; // 绕Y轴旋转
|
||||
angleZ += gz * dt; // 绕Z轴旋转
|
||||
angleZ -= gz * dt; // 绕Z轴旋转
|
||||
|
||||
// 使用互补滤波来平滑姿态估计
|
||||
// 这里的系数决定了加速度和陀螺仪的权重,通常设置为0.98
|
||||
|
@ -118,7 +118,7 @@ public class GameManager : MonoBehaviour
|
|||
brainTrans.rotation = Quaternion.Euler(new Vector3(filteredRoll, filteredPitch, angleZ));
|
||||
break;
|
||||
case AxisArr.XZY:
|
||||
brainTrans.rotation = Quaternion.Euler(new Vector3(filteredRoll, -angleZ, filteredPitch));
|
||||
brainTrans.rotation = Quaternion.Euler(new Vector3(filteredRoll, angleZ, filteredPitch));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue