【发布时间】:2013-08-29 16:18:29
【问题描述】:
我试图在 x 轴上反映我的游戏世界。 我有一个相机,它计算变换矩阵:
_transform =
Matrix.CreateTranslation(new Vector3(-_pos.X, -_pos.Y, 0)) *
Matrix.CreateRotationZ(Rotation) *
Matrix.CreateScale(Zoom) *
Matrix.CreateTranslation(new Vector3(_graphicsDevice.Viewport.Width * 0.5f, _graphicsDevice.Viewport.Height * 0.5f, 0));
它工作正常,直到我放一个反射部分:
_transform = //first try, place here
Matrix.CreateTranslation(new Vector3(-_pos.X, -_pos.Y, 0)) *
Matrix.CreateRotationZ(Rotation) *
Matrix.CreateScale(Zoom) *
Matrix.CreateReflection(new Plane(Vector3.UnitY, 0)) * //here
Matrix.CreateTranslation(new Vector3(_graphicsDevice.Viewport.Width * 0.5f, _graphicsDevice.Viewport.Height * 0.5f, 0));
有了那个“反思”
spriteBatch.Begin(SpriteSortMode.BackToFront,
BlendState.AlphaBlend,
null,
null,
null,
null,
Camera.Active.GetTransformation);
什么都不画。 请帮助并为我的英语感到抱歉:)
UPD:我做了一些测试:
var v = new Vector2(0, 10);
var v2 = Vector2.Transform(v, _transform);
没有 .CreateReflection v2 = {X:450 Y:370}
with .CreateReflection v2 = {X:450 Y:350} //好的。它反映了。但是,为什么不画呢?
【问题讨论】:
-
你是在画图元还是精灵?
-
你能复制你用来正常绘制精灵的代码并反射同一个精灵吗?
-
查看 1 个回答下的评论