0
我試圖用spritebatch執行一些矩陣轉換,我不明白尺度矩陣發生了什麼。Matrix創建規模,這裏發生了什麼?
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();
Usualy我得到最好的結果看這個順序,但是如果我更改比例是旋轉一切變得怪異前,即使使用(1.1.0)的規模,所以我剛開始的原始大小。
讓我們將標度固定爲1(不包括Z),爲什麼/如果我用標尺保留頂點(我認爲)會影響旋轉?
實例:
譯本> Rotation->橫向擴展>翻譯
譯本>橫向擴展> Rotation->翻譯
感謝羅傑