C# 逆时针方向的行星轨道
我做了一个行星顺时针运行的游戏(更多的是模拟)。我想知道怎样才能使它逆时针旋转 Host=行星正在轨道上运行的对象 实体=行星C# 逆时针方向的行星轨道,c#,visual-studio,C#,Visual Studio,我做了一个行星顺时针运行的游戏(更多的是模拟)。我想知道怎样才能使它逆时针旋转 Host=行星正在轨道上运行的对象 实体=行星 double angle; if (host.Y == entity.Y && host.X == entity.X) //small offset angle = Math.Atan2(host.Y - entity.Y + (Random.NextDouble()*2 - 1),
double angle;
if (host.Y == entity.Y && host.X == entity.X) //small offset
angle = Math.Atan2(host.Y - entity.Y + (Random.NextDouble()*2 - 1),
host.X - entity.X + (Random.NextDouble()*2 - 1));
else
angle = Math.Atan2(host.Y - entity.Y, host.X - entity.X);
float angularSpd = host.GetSpeed(s.Speed)/s.Radius;
angle += angularSpd*(time.thisTickTimes/1000f);
double x = entity.X + Math.Cos(angle)*radius;
double y = entity.Y + Math.Sin(angle)*radius;
Vector2 vect = new Vector2((float) x, (float) y) - new Vector2(host.X, host.Y);
vect.Normalize();
vect *= host.GetSpeed(s.Speed)*(time.thisTickTimes/1000f);
host.MoveTo(host.X + vect.X, host.Y + vect.Y);
尝试将
角度+=angularpd…
更改为角度-=angularpd…
Pfft。。。我真是哑巴。谢谢你的回答!它起作用了。