ldtk icon indicating copy to clipboard operation
ldtk copied to clipboard

Entity Layer Grid Snap Factor

Open nyalloc opened this issue 3 years ago • 1 comments

When using LDtk, a user is likely to encounter a situation where they need to move an entity so that its origin sits on the boundary between two tiles, rather than the center of a tile. In the current release, this is not possible. In the latest commit of the 0.10 branch, the user would need to manually adjust the position to achieve this.

image Desired position

image Available positions on the grid

To remedy this, I propose that a "Grid Snap Factor" option is added to the entity layer definition. This normalized floating point value would control the degree to which the editor aligns entities to the grid.

image

Here are some visualisations of how this option would change editing entities:

image ezgif-5-b0a79b5f42 LDtk's current behavior. Entities are fully aligned to the grid. 1.0 should be the default Snap Factor for an entity layer.

image ezgif-5-f02e44b458 Entities can now snap to the boundary between grid units, permitting them to be placed between tiles.

image ezgif-5-d3dae6969d Even more granular placement is possible when required.

nyalloc avatar Jan 30 '22 22:01 nyalloc

Related to #304

deepnight avatar Feb 03 '22 11:02 deepnight