【问题标题】:Fast moving object leaves a "ghost" trail快速移动的物体留下“幽灵”痕迹
【发布时间】:2016-07-26 04:18:25
【问题描述】:

我正在尝试在 Monogame 中以高速绘制子弹。当我以大约 400 像素/秒的速度绘制它时,“这很慢”,但在 1500 像素/秒左右,它开始“复制”或“重影”纹理。我是 Monogame 的新手,对图形知识了解不多。

如何在不产生“重影”效果的情况下高速移动对象?

SpriteBatch 开始:

 sb.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearWrap, DepthStencilState.None, RasterizerState.CullNone,
            null, Global.Camera.GetViewTransformationMatrix());

绘制方法:

public override void Draw(SpriteBatch sb)
{
        Vector2 origin = new Vector2(source.Width / 2, source.Height / 2);
        Rectangle tRect = Bounds;

         sb.Draw(
            texture: TDTGame.GameAssets.Texture,
            destinationRectangle: tRect,
            sourceRectangle: source,
            rotation: MathHelper.ToRadians(Rotation - 270f), //Set rotation to forward of the texture.
            color: Color.White,
            origin: origin,
            layerDepth: 1f
            );
}

编辑:

Youtube 链接:here

子弹的运动:

    float traveledDistance;
    public override void Update(GameTime gt)
    {
        float deltaTime = (float)gt.ElapsedGameTime.TotalSeconds;
        traveledDistance += Speed * deltaTime;

        Position += Forward * Speed * deltaTime;

        if (traveledDistance > Range)
        {
            Destroy();
        }
    }

【问题讨论】:

  • 你能发布鬼的截图或视频吗?重影有没有可能是一种幻觉。
  • @craftworkgames 确实感觉像是一种错觉,因为当我以较低的帧速率录制时,您看不到踪迹。在静止图像“prntscrn”中捕获它也没有显示轨迹。喜欢 MonoGame.Extended 库只是想说继续努力!
  • 在这种情况下,不妨尝试一下背景颜色,看看您是否可以通过这种方式摆脱它,或者看看其他带有快速移动物体的游戏,看看它们是否有什么有趣的事情。

标签: xna monogame


【解决方案1】:

这很可能是低帧率造成的。帧速率越高,你的大脑就越不会注意到子弹的“运动”只是在多个位置绘制相同的图像,并且随着时间的推移而变化:)

【讨论】:

    【解决方案2】:

    如前所述,痕迹可能在您的眼睛中,而不是在屏幕上。如果你想克服这种影响,你可能想跳过一些帧(可能从屏幕上完全移除子弹或至少跳过移动)。

    【讨论】:

      猜你喜欢
      • 2021-07-07
      • 2013-09-07
      • 2019-06-09
      • 1970-01-01
      • 2013-05-28
      • 1970-01-01
      • 1970-01-01
      • 2019-10-09
      • 2023-04-05
      相关资源
      最近更新 更多