Tiled Map Editor: size of isometric tile side

2019-04-12 19:50发布

问题:

In Tiled editor there is an isometric map example: "isometric_grass_and_water.tmx". This example shows simple isometric map with tiles which have size 64x32 pixels.

I need to know size of the side of a tile, so I simply used Pythagorean theorem for this:

In right-angled triangle ABC side AC = width / 2 = 32 and side AB = height / 2 = 16. Thus side of a tile (BC) can be calculated as:

So whole tile is a rhombus in which each side = 35.777.

However when I add an square object with dimensions 35.77 x 35.77 to the Tiled, it not fits into the grid (it is actually bigger than on tile). But if I add object with dimensions 32 x 32 - it fits perfectly.

Please take a look on this image (object A is 32x32, and B is 35.77x35x77):

How is this possible? Is Tiled uses some kind of scaling, or something wrong with my calculations?

回答1:

In isometric mode, the objects are projected into isometric perspective. Since Tiled normally uses pixels for object position and size in orthogonal mode, I chose to use a virtual pixel grid that is projected onto the isometric plane. This grid uses the tile height as the number of subdivisions of the tile grid, hence an object with its width and height equal to the tile height will fill exactly one tile.

My apologies that this has never been documented properly. I will get to the documentation once all the features are in!