Godot-proposals: Edit only one side of extents

Created on 8 Feb 2020  路  1Comment  路  Source: godotengine/godot-proposals

Describe the project you are working on:
2D game.

Describe the problem or limitation you are having in your project:
I often use CollisionShape2D nodes with rectangle shapes. Their problem is that you need to place the rectangle in the middle of the object and expand the extents to match the object's size. Because the extents increase from both sides and it's not always obvious where object's center may be, it often requires trial-and-error to get done correctly, which is simply a waste of time.

Describe how this feature / enhancement will help you overcome this problem or limitation:
If I could change the rectangle's extents with handles on any side, like this is done with scaling Sprites or resizing Control nodes, it would save some time and make adding colliders more friendly.

Show a mock up screenshots/video or a flow diagram explaining how your proposal will work:
image
image

Describe implementation detail for your proposal (in code), if possible:
RectangleShapes2D should be edited like Control rectangles. This can be achieved by editing extents of RectangleShape2D and position of CollisionShape2D simultaneously.

If this enhancement will not be used often, can it be worked around with a few lines of script?:
No, it would require a plugin.

Is there a reason why this should be core and not an add-on in the asset library?:
It's a QoL thing for collision shapes.

editor

Most helpful comment

For the record, this is also an issue with 3D shapes (such as GIProbe and CSG nodes). Last year, I tried to change it in CSG gizmos but failed.

To behave like Control nodes, the following changes need to be done:

  • Add a gizmo handle in each corner/face. There should be 4 handles in 2D and 6 in 3D. Existing handles may need to be moved.

    • Thinking about it, 8 handles in 2D and 14 in 3D makes more sense. We'd like to be able to select a face to resize the shape only on one axis easily.

  • When the user holds Alt, preserve the old behavior of scaling from the center. Make sure snapping still works as expected.

>All comments

For the record, this is also an issue with 3D shapes (such as GIProbe and CSG nodes). Last year, I tried to change it in CSG gizmos but failed.

To behave like Control nodes, the following changes need to be done:

  • Add a gizmo handle in each corner/face. There should be 4 handles in 2D and 6 in 3D. Existing handles may need to be moved.

    • Thinking about it, 8 handles in 2D and 14 in 3D makes more sense. We'd like to be able to select a face to resize the shape only on one axis easily.

  • When the user holds Alt, preserve the old behavior of scaling from the center. Make sure snapping still works as expected.
Was this page helpful?
0 / 5 - 0 ratings