From 62c8b7766cd7daf290ca40c0c9f889f904dd3fbb Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Mon, 1 Jun 2020 17:00:32 +0200 Subject: [PATCH] fixed camera's ConstrainWorldBounds midpoint formula being incorrect --- MLEM/Cameras/Camera.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MLEM/Cameras/Camera.cs b/MLEM/Cameras/Camera.cs index 35dfcd8..09c584f 100644 --- a/MLEM/Cameras/Camera.cs +++ b/MLEM/Cameras/Camera.cs @@ -135,7 +135,7 @@ namespace MLEM.Cameras { var lastPos = this.Position; var visible = this.GetVisibleRectangle(); if (max.X - min.X < visible.Width) { - this.LookingPosition = new Vector2((max.X - min.X) / 2, this.LookingPosition.Y); + this.LookingPosition = new Vector2((max.X + min.X) / 2, this.LookingPosition.Y); } else { if (this.Position.X < min.X) this.Position.X = min.X; @@ -144,7 +144,7 @@ namespace MLEM.Cameras { } if (max.Y - min.Y < visible.Height) { - this.LookingPosition = new Vector2(this.LookingPosition.X, (max.Y - min.Y) / 2); + this.LookingPosition = new Vector2(this.LookingPosition.X, (max.Y + min.Y) / 2); } else { if (this.Position.Y < min.Y) this.Position.Y = min.Y;