【发布时间】:2014-03-28 13:05:15
【问题描述】:
我一直在摆弄 MathHelp.Lerp();试图找到最简单的方法来旋转导弹的行进方向。现在它会立即朝着玩家/鼠标所在的方向移动。
拉普是最好用的还是其他类型的方向旋转是我应该追求的? Latest post, example of what I mean.
protected override void Update(GameTime gameTime)
{
// Allows the game to exit
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
this.Exit();
delta = (float)gameTime.ElapsedGameTime.TotalSeconds * Speed;
direction = mousePosition - missilePosition;
direction.Normalize();
missilePosition += direction * delta;
//missilePosition = Vector2.Lerp(missilePosition, mousePosition, 2.0f);
mouse = Mouse.GetState();
mousePosition = new Vector2(mouse.X, mouse.Y);
base.Update(gameTime);
}
让图像随着导弹的方向旋转也是我一直在寻找并试图弄清楚的事情。我如何让图像随着方向的旋转而旋转?
【问题讨论】:
-
我刚刚发现了一些我可以使用的东西here 我还在阅读它,但也许可以从这里得到答案...
-
我会做这样的事情:找出目标和导弹之间的角度,有一个预定义的
maximumturnangle,如果转向角度大于maximumturnangle,旋转导弹很多度。如果角度小于maximumturnangle,则将导弹旋转到所需的量。 -
谢谢,我会试试的。
标签: c# xna rotation image-rotation directions