Fixed camera ScreenToWorld & WorldToScreen returning invalid values when Camera.UpdateTransform has only been called once, because interpolated zoom value is initially 0 which messes up the transformation matrices. Closes #504

This commit is contained in:
Joonas Rikkonen
2018-07-20 11:36:22 +03:00
parent 9963836c08
commit f13b1b4d84
+2 -2
View File
@@ -99,7 +99,7 @@ namespace Barotrauma
public Camera() public Camera()
{ {
zoom = 1.0f; zoom = prevZoom = 1.0f;
rotation = 0.0f; rotation = 0.0f;
position = Vector2.Zero; position = Vector2.Zero;
@@ -112,7 +112,7 @@ namespace Barotrauma
viewMatrix = viewMatrix =
Matrix.CreateTranslation(new Vector3(GameMain.GraphicsWidth / 2.0f, GameMain.GraphicsHeight / 2.0f, 0)); Matrix.CreateTranslation(new Vector3(GameMain.GraphicsWidth / 2.0f, GameMain.GraphicsHeight / 2.0f, 0));
UpdateTransform(); UpdateTransform(false);
} }
public Vector2 TargetPos public Vector2 TargetPos