Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Matrix 矩阵创建比例,这里发生了什么?_Matrix_Scale_Transformation_Monogame_Spritebatch - Fatal编程技术网

Matrix 矩阵创建比例,这里发生了什么?

Matrix 矩阵创建比例,这里发生了什么?,matrix,scale,transformation,monogame,spritebatch,Matrix,Scale,Transformation,Monogame,Spritebatch,我正试图用spritebatch执行一些矩阵变换,但我不明白比例矩阵发生了什么 rotM = Matrix.CreateTranslation(0, 0, 0) * Matrix.CreateFromYawPitchRoll(MathHelper.ToRadians(startRotations.Y) , MathHelper.ToRadians(startR

我正试图用spritebatch执行一些矩阵变换,但我不明白比例矩阵发生了什么

       rotM = Matrix.CreateTranslation(0, 0, 0)
                * Matrix.CreateFromYawPitchRoll(MathHelper.ToRadians(startRotations.Y)
                                              , MathHelper.ToRadians(startRotations.X)
                                              , MathHelper.ToRadians(startRotations.Z))
                * Matrix.CreateScale(endScale.X, endScale.Y, 0)
                * Matrix.CreateTranslation((Origin.X + PositionRec.X + Offset.X) * endScale.X
                                         , (Origin.Y + PositionRec.Y + Offset.Y) * endScale.Y, 0);

        sp.Begin(SpriteSortMode.Deferred, null, null, null, null, null, rotM);
        sp.Draw(BackgroundTexture, Vector2.Zero, PositionRec, BackgroundColor * alpha);
        sp.End();
通常我会用这个顺序得到最漂亮的结果,但是如果我在旋转之前改变比例,一切都会变得奇怪,甚至使用(1.1.0)比例,所以我只得到原始大小

让我们将比例固定为1(不包括Z),如果我使用比例保持顶点不变,为什么/如何影响旋转(我想)

示例:

平移->旋转->缩放->平移

平移->缩放->旋转->平移


事先谢谢你,罗杰。想了一会儿,我想我明白了

所以我在3d空间里画精灵,2d。 旋转后,z坐标具有值,因此使用0作为z比例会破坏该值

因为我没有使用任何灯光或阴影,所以很难检查发生了什么

是这样吗

谢谢,罗杰