ldtk
ldtk copied to clipboard
[Feature Request] Entity placement and Pivots
I have an issue regarding the placement of new entities and how they align to the grid.
The current default behaviour when placing new entities with a center pivot is to also position them at the center of the grid cell. This is probably desirable(?) but counter-intuitive to some who would expect an entity's default coordinates to always be aligned to the grid regardless of its pivot point -- this is the behaviour in GameMaker, as an example.
What's interesting is that adjusting an entity's coordinates after placing it and then dragging it again seems to preserve its new "offset". Here I demonstrate placing an entity, adjusting its coordinates to be 'grid-aligned', and then dragging it still preserves its new alignment.
https://github.com/deepnight/ldtk/assets/1772788/6eba929f-06f4-4145-a860-e967245cd57a
It's a way of getting around this issue, but is tedious to do for each entity. I would want a setting that defaults placing entities so that their coordinates are always aligned to the grid.
Since this is only an issue when placing new entities, rather than adding an extra pivot/anchor property to each entity definition (as suggested in #763), it might be easier to make this a Workspace Setting, something like:
"Default placement for new entities : ["Offset using pivot" / "Always align to grid"]"
This image demonstrates the placement behaviour (Left: "Offset using pivot", Right: "Always align to grid")
To add to this issue, the object is aligned correctly if an object is set with the default up-left pivot point and then altered afterwards - it's only when placing entities with the adjusted pivot points that they will be misaligned.