mono/MonoGame — Issue #364: SpriteBatch.Draw not using specified transformation matrix
Author: hexate
Created: 2012-03-09 21:11:20+00:00
State: open

I use the crap out of the following in my game

spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, null, null, null, null, myCamera.View);
spriteBatch.Draw(someStuff);

and the camera's view matrix is not being applied.

I'm pretty sure the fix is pretty trivial, i think you change this in SpriteBatch.UpdateWorldMatrixOrientation() ~ln 507

from this:
matViewScreen =
Matrix.CreateRotationZ((float)Math.PI) *
Matrix.CreateRotationY((float)Math.PI) *
Matrix.CreateTranslation(-viewport.Width / 2, viewport.Height / 2, 1);

to this:
matViewScreen =
_matrix *
Matrix.CreateRotationZ((float)Math.PI) *
Matrix.CreateRotationY((float)Math.PI) *
Matrix.CreateTranslation(-viewport.Width / 2, viewport.Height / 2, 1);