-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Image objects incorrect origin #2136
Comments
Yeah, I'm sorry about this inconsistency. It really made sense when I introduced the support for tile objects years ago since I thought they would be primarily used for placing sprites on top-down maps, in which case bottom-alignment is usually the way to go for rendering order reasons. It sort of makes sense for jump-n-runs as well. However, it turned out that the inconsistency with other object types leads to much confusion. It gets worse with isometric maps btw, which uses bottom-center alignment for tile objects. So the alignment of objects depends both on the type of object as well as the type of map. For now the best solution is to find a way to deal with this, either in your engine or your loader. Eventually I do plan to add support a setting for object origin, so then it can be made all consistent. I'll close this issue since it's already known for a long time and covered by #91. |
Ah, I see. I know this isn't a very glamorous feature to focus on, but please would you consider putting this on the roadmap? Speaking from experience, something like this is only going to get more difficult to implement the longer it's put aside! |
@huwpascoe Alright, let's consider where we could add this option. First let's summarize the current behavior:
I don't actually see a reason to make the map or shape object origins configurable. If it would become configurable, it probably makes sense to do this on the map level and have it affect both the map origin and shape object origins. This would enable support for inverting the Y axis properly (see also #2040), which is the only related feature people have been asking for. For tiles and tile objects, an alignment setting could be introduced either on the tileset, the layer or the map (or on the tile, but I think that's covered by individual tile origin offsets (#871)). Of these, I think doing it on the tileset makes the most sense. There are generally less tilesets than layers / maps, so it's most comfortable projects that align all their tile objects the same way. In addition, there is probably more use-case for choosing a different alignment per tileset than doing this per layer / map. Finally, it kind of belongs together with the drawing offset that is already specified on the tileset level. Now one question is, should this tileset alignment option affect only tile objects, or also tiles on tile layers? I guess it should, and it would make it easier to use tilesets like the "perspective_walls.png" example since it's more natural to change the alignment than setting a specific drawing offset. Note that it would not only change the tile origin, but also the anchor within each cell. And then the default would likely remain orientation-specific for backwards compatibility reasons, while explicitly setting the tile alignment would make it consistent. Finally, setting the alignment to top-left would make it consistent with shape objects (though, that behavior is rarely useful for tile layers, so I'm not sure if we could eventually change to setting top-left as the default for new tilesets). Deciding on the behavior is half the work. Opinions welcome! |
I think it would be most useful to have origin attribute(s) per <tile> as in #871 This sprite with the origin marked in yellow for example. The main requirements are:
|
Funny, that I came on this topic when just googled around - I'm struggling with inverted 'y' too right now :D Got to rearrange all my locations inside out :E Considering decision - fixing it @ map level would do the trick ;) And it's 100% alright if it would be hidden optional thing (in 'preferences' ui). |
@huwpascoe Note that tile object flipping really only applies to the image, so it would not change the visual position like rotation would. Unless we say that the origin is also affected by the flipping of the image. This probably would make sense, I just hope we're not making things too complicated. As for the editor to be able to rotate without changing object position, currently the only way to do that is to change the rotation property in the Properties view. The object selection tool doesn't have an appropriate handle for rotating the object without changing its position (should probably be added, but it's not trivial since we don't want to make a big mess of handles either).
@igroglaz Like I said in my comment above the tile alignment could be saved on map, layer or tileset level. I personally thought tileset would be a good fit. Do you have reasons to prefer it on a map level? |
Oh, I see, I misunderstood it then :) Of course, tileset would be alright! 👍 Can't wait for this update! |
Took an hour before I figured out it was tiled and not my sketchy matrix math. For some reason the object's Y origin is default flipped so that 0,0 is on the bottom left compared to everything else. There's no way to set object origins either, so it's quite a weird situation!
The text was updated successfully, but these errors were encountered: