I have an issue with my 2D isometric engine. I'm using my own 2D camera class which works with matrices and need to find the tilemaps boundaries so the user always sees the map.
Currently my map size is 100x100 (with 128x128 tiles) so the calculation (e.g. for the right boundary) is:
var maxX = (TileMap.MapWidth + 1) * (TileMap.TileWidth / 2) - ViewSize.X; var maxX = (100 + 1) * (128 / 2) - 1360; // = 5104 pixels.
This works fine while having scale factor of 1.0f but not for any other zoom factor. When I zoom out to 0.9f the right border should be at 4953.
I'm using the following code for transformation but I always get a wrong value:
var tempTransform = Matrix.CreateScale(Scale, Scale, 1); var maxXVector = new Vector2(maxX, 0); var maxXTransformed = Vector2.Transform(maxXVector, tempTransform).X;
The result is 4593. Logically this value does not seem to be that wrong since a decrease by 10 percent of the map width (5104) should be something around 510
What am I doing wrong?
Here are some pictures so you can see what I mean:
Zoom 0.9f Thanks for your help!