godot icon indicating copy to clipboard operation
godot copied to clipboard

Allow Position2D to have customizable area rects

Open ElectricVersion opened this issue 10 years ago • 3 comments

Operating system or device - Godot version: All systems, Godot version 2.0.4.1 stable

Issue description (what happened, and what was expected): Position2D can be used for positioning their child nodes; however, those nodes are positioned to the center of the Position2D. Position2D is ALWAYS 20x20 pixels. Therefore, if I have a Position2D at 0,0 with its children having no offset, its children will actually be at 10,10. This can be undesirable, especially if using grid snapping to non-multiples of 10. Obviously there are workarounds, but to be able to set the size of the Position2D rect - and thus the position at which its children will actually be - would be very useful.

Steps to reproduce: Place a Position2D node at 0,0. Turn Grid Snapping on. Add a child node of any type to the Position2D node, and set it also to 0,0. As you will see, it results in the child node being shown at 10,10.

ElectricVersion avatar Jul 14 '16 11:07 ElectricVersion

...Nevermind, someone on IRC told me that Position2Ds are for debugging and not use in games. My apologies, I didn't realize that.

ElectricVersion avatar Jul 14 '16 11:07 ElectricVersion

Just to clarify, Position2D can be used in games. Its purpose is to set visible points in the editor so you can see where it is (as an example, I use them as spawn points). The thing is that the cross center is on the defined position, so you can notice where it is, but the bounding box of it starts a bit further to the top and left. It's similar to what happens to Sprites with the Centered property.

vnen avatar Jul 14 '16 14:07 vnen

Yes, it's actually a duplicate of #1544.

akien-mga avatar Jul 14 '16 14:07 akien-mga