fix: MonoGame view matrix calculation issues

This commit is contained in:
2026-01-28 12:58:25 +03:00
parent ad444decbb
commit c68de39c83

View File

@@ -113,10 +113,10 @@ public class MonoGameCamera2D : Behaviour, ICamera2D, IFirstFrameUpdate, ILastFr
public void PreDraw() public void PreDraw()
{ {
ProjectionMatrix = Matrix4x4.CreateOrthographicViewCentered(Viewport.Width, Viewport.Height); ProjectionMatrix = Matrix4x4.CreateOrthographicViewCentered(Viewport.Width, Viewport.Height);
ViewMatrix = ViewMatrix = Matrix4x4.Identity
Matrix4x4.CreateTranslation(new Vector3D(-Transform.Position.X, -Transform.Position.Y, 0f))
.ApplyRotationZ(Transform.Rotation * Math.DegreeToRadian)
.ApplyScale(Transform.Scale.X.Max(Transform.Scale.Y)) .ApplyScale(Transform.Scale.X.Max(Transform.Scale.Y))
.ApplyScale(Zoom); .ApplyScale(Zoom)
.ApplyRotationZ(-Transform.Rotation * Math.DegreeToRadian)
.ApplyTranslation(new Vector3D(-Transform.Position.X, -Transform.Position.Y, 0f));
} }
} }