protected void RegulateAngle(float target_pitch_angle, float target_roll_angle) { if (Application.isEditor) { for (int i = 0; i < 2; i++) { selfLevelers[i].CopySettings(selfLevelerFactory); } } float pitch_val = Gyroscope.Angle2OneMinusOne(gyroscope.GetRotation().x) * 180f; float slp = selfLevelers[0].Regulate(target_pitch_angle - pitch_val); float roll_val = Gyroscope.Angle2OneMinusOne(gyroscope.GetRotation().z) * 180f; float slr = selfLevelers[1].Regulate(target_roll_angle + roll_val); RotPitch(slp); RotRoll(slr); }
public void test_Angle2OMO_359() { float result = Gyroscope.Angle2OneMinusOne(359f); Assert.AreEqual(result, -0.00555562973f); }
public void test_Angle2OMO_179() { float result = Gyroscope.Angle2OneMinusOne(179f); Assert.AreEqual(result, 0.994444489f); }
public void test_Angle2OMO_181() { float result = Gyroscope.Angle2OneMinusOne(181f); Assert.AreEqual(result, -0.99444437f); }
public void test_Angle2OMO_0() { float result = Gyroscope.Angle2OneMinusOne(0f); Assert.AreEqual(result, 0f); }