仅供参考,我最终从物体到它的未来位置画了一条线(正如我的问题所预期的那样)。
这是 Draw 方法中的代码;
Vector2 nextPos = position + velocity * 7;
drawLine(spriteBatch, Game1.pixelTexture, position, nextPos, Color.FromNonPremultiplied(255, 0, 0, 100));
这是画线代码;
void drawLine(SpriteBatch spa, Texture2D tex, Vector2 src, Vector2 dst, Color col)
{
Vector2 direction = dst - src;
var angle = (float)Math.Atan2(direction.Y, direction.X);
float distance;
Vector2.Distance(ref src, ref dst, out distance);
spa.Draw(tex, src, new Rectangle((int)src.X, (int)src.Y, (int)distance, 2), col, angle, Vector2.Zero, 1.0f, SpriteEffects.None, 0f);
}