【发布时间】: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 库只是想说继续努力!
-
在这种情况下,不妨尝试一下背景颜色,看看您是否可以通过这种方式摆脱它,或者看看其他带有快速移动物体的游戏,看看它们是否有什么有趣的事情。