我首先要谈谈这一点,我不是在数人附近。 在另一个问题中发现的代码I似乎有些发挥作用......但造成目标I的位置在大圈中轮换,大多在屏幕上。
该法典:
public void Update(GameTime gameTime)
{
Location = RotateAboutOrigin(Center, Origin, 0.01f);
}
public Vector2 RotateAboutOrigin(Vector2 point, Vector2 origin, float rotation)
{
var u = point - origin; //point relative to origin
if (u == Vector2.Zero)
return point;
var a = (float)Math.Atan2(u.Y, u.X); //angle relative to origin
a += rotation; //rotate
//u is now the new point relative to origin
u = u.Length() * new Vector2((float)Math.Cos(a), (float)Math.Sin(a));
return u + origin;
}
位置由在中央矢量周围任意位置的 mo点确定。
在我点击时,中心是物体I所在地的(主人)中心。 它只是区分案文的高度和宽度。
起源是矢量2 ,我正试图轮流。 它固定在384 384处。
As best I can tell, it s getting the distance between the two vectors and then using atan2 to determine the angle. The rest afterward is a mystery to me. I m aware that I should learn what everything does, and I do intend to when I go to college(only a decade late) starting in the spring. I ve tried reading up on them, but I m lost. Any help would be appreciated.
而且,如果你对贵方建议的地点有好的三点,我将乐于阅读。