I’m working with making polygon objects for tiles in a tileset and then reading those values into unity. But I appear to have run into a behavior of Tiled that doesn’t make sense to me.
In my test scenario (to make sure I wasn’t crazy) I am making a collider object using the “insert polygon” tool in the tileset editor. The collider/polygon in question is an isosceles right triangle with the 90 degree corner in the top-right corner of the tile.
Heres the problem: When I draw the polygon, the resulting coordinates for each point, as shown in the resulting tsx file, are different depending on which corner I start in. If I start drawing the polygon in the top left corner, I get the following:
<polyline points="0,0 32,0 32,32 0,0"/>
If I start in the top right corner this is the result:
<polyline points="0,0 0,32 -32,0 0,0"/>
All the points are in exactly the same positions relative to the tile, and the resulting polygon is in the same orientation relative to the tile. But the position data for the points differs.
I fail to understand why this is happening and its really screwing with how I import this data into Unity.
Is there a way to make these positions consistent regardless of order? or is there some other element to how this part of tiled works that I need to understand?
Also, if this is intended behavior, It should be at least mentioned in the documentation. Perhaps it is there, but I was unable to find it.
EDIT: I should note that my tests were all done with clockwise placement of points.