Commit 7ea0eeb2 authored by 潘栩锋's avatar 潘栩锋 🚴

模拟AD盒支持360旋转

parent f0287233
......@@ -500,7 +500,13 @@ namespace FLY.Simulation.Blowing
return GetData(position, angle);
}
double GetValidAngle(double a) {
while (a >= 360)
a -= 360;
while (a < 0)
a += 360;
return a;
}
/// <summary>
/// 获取膜泡数据
/// </summary>
......@@ -518,17 +524,8 @@ namespace FLY.Simulation.Blowing
//压扁对面的角度
double a_other = 360 - a;
a += angle;
if (a >= 360)
a -= 360;
else if (a < 0)
a += 360;
a_other += angle;
if (a_other >= 360)
a_other -= 360;
else if (a_other < 0)
a_other += 360;
a = GetValidAngle( a + angle );
a_other = GetValidAngle(a_other + angle);
int dat_idx1 = (int)(a / 360 * AfterDatas.Count());
int dat_idx2 = (int)(a_other / 360 * AfterDatas.Count());
......@@ -704,7 +701,14 @@ namespace FLY.Simulation.Blowing
double angle = CurrAngle + CurrAngleVelocity * ts.TotalSeconds;
double delta = angle - CurrAngle;
GlobalAngle += delta;
while (angle >= 360)
angle -= 360;
while (angle < 0)
angle +=360;
CurrAngle = angle;
}
/// <summary>
......
......@@ -632,7 +632,7 @@ namespace FlyADBase
}
int ms = systick - systick_1st;
if ((ms < 1000)||
if ((ms < -1000) ||//时间被提前
(ms> 1000 * 60 * 3))//记录与新的timemark 相差3分钟,太大了,重新生成 timemark 与 dt 的关系
{
//被复位了
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment