Understanding collision points data in TMX

#1

Hi, I’m trying to understand how collision point data in the TMX is interpreted.

I have a isometric map whose tile size is 256 x 148.

What I understand from the collision point data is that the 0,0 origin point corresponds to the left point in the ‘isometric diamond’. I imagine the map’s tile superimposed over my tile image at the bottom and left-hand side of the frame and the left corner of the diamond tile is 0,0. This seems to correspond accordingly to the anchor point of the tile when being placed on the grid. So far, this is what I understand.

What I don’t understand is when I use a larger tile image in the same map. I’m using a 312 x 352 image, and when I manually input 0,0 inside the TMX via text editor, and then plot out a 256 x 148 isometric diamond (in the same way I’ve done for the other tiles at 256 x 148, I get the following:

As you can see, the 0,0 is about 8 pixels away from the left edge. The bottom node is about 5 pixels from the bottom edge.

In the documentation it states:

Each polygon object is made up of a space-delimited list of x,y coordinates. The origin for these coordinates is the location of the parent object. By default, the first point is created as 0,0 denoting that the point will originate exactly where the object is placed.

But when placed as a tile it seems to follow my understanding of the anchor point being referenced by the tile shape flushed at the bottom and left of the tile image.

As you can see with the image above, the tile’s placement is exactly bordering the left edge, but the 0,0 coordinates in the collision polygons are offset to the right.

Any info on this would be appreciated. Thanks!

(Thorbjørn Lindeijer) #2

Could this be a confusion caused by the different interpretation of position and origin for tiles on a tile layer and tile objects? Here’s an image showing the current situation:

Of course, this is not ideal and I’d like to move towards a well defined (and customizable) origin point for tiles, though it’s hard to marry that with the current behavior (which needs to be done for keeping compatibility).

#3

Hi Bjorn, I’m not quite sure how or if it’s related to tile placement. I’m actually trying to use the collision editor and retrieving point data from the TMX. I translate this point data to proportional coordinates for use in C2. But I can’t correlate the point data with a point in the image.

If I could rephrase the question: how does one determine what point in the tile object is 0,0 when the tile image is larger than the tile size?

Many thanks.

best,
lernie.