1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-11-26 06:28:35 +01:00

fixed camera's ConstrainWorldBounds midpoint formula being incorrect

This commit is contained in:
Ellpeck 2020-06-01 17:00:32 +02:00
parent b237c0fcc4
commit 62c8b7766c

View file

@ -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;