这是我的代码。它有效,除了当我一开始它跳离它开始的地方很远,并且当它旋转它的抽搐和快速翻转时......
float rotAmount = 0;
Vector2 pivot = CenterSelection();
if (keyboardState.IsKeyDown(Keys.OemPlus)) rotAmount = 0.01f;
if (keyboardState.IsKeyDown(Keys.OemMinus)) rotAmount = -0.01f;
map.DoForSelected(delegate(GameObject mod)
{
Vector2 vDif = pivot - mod.position;
float vDist = (float)Math.Sqrt(Math.Pow(vDif.X, 2) + Math.Pow(vDif.Y, 2));
float vRot = rotAmount + (float)Math.Atan2(vDif.Y, vDif.X);
mod.position = pivot + new Vector2(
(float)Math.Cos(vRot),
(float)Math.Sin(vRot)
) * vDist;
mod.rotation += rotAmount;
});
我试图找出问题所在!非常感谢您的帮助!