Skip to content
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

Allow moving only one side of extents-based rectangles/boxes using editor gizmos #452

Closed
KoBeWi opened this issue Feb 7, 2020 · 5 comments · Fixed by godotengine/godot#71092

Comments

@KoBeWi
Copy link
Member

KoBeWi commented Feb 7, 2020

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.

@Calinou
Copy link
Member

Calinou commented Feb 8, 2020

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.

@JamesC01

This comment has been minimized.

@Calinou

This comment has been minimized.

@JamesC01
Copy link

JamesC01 commented Aug 12, 2021

I just found this addon, which essentially does this: godot-extend Maybe someone who understands it (@Calinou ?) could try to implement it into godot directly. To get the addon working, you have to add the name of the node(s) you want to scale this way in the extend.gd classes array. The gizmo is 6 dots, not the usual scaling tool. It only works on 1x1x1 csg shapes, because it's only scaling the transform, not the actual size of the CSG, but it's at least a start. This is a feature I feel is almost essential for CSG.

@Zireael07
Copy link

Leaving a comment here to say this also applies to 3D, not just 2D.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants