You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the problem or limitation you are having in your project
The Camera2D's limit variables (limit_left, limit_top, limit_right, limit_bottom) are all separate integers, which feels odd, considering they refer to the same thing. Even editor_draw_limits property, when enabled, draws a rectangle of them.
Furthermore, passing these as arguments of Vector2 or Rect2 functions becomes a somewhat repetitive task, especially noticeable if the camera itself is referenced in a variable.
An alternative to this proposal would be to have two Vector2i properties expressing the top-left and bottom-right points, which may be preferable to the current solution, considering all of the following proposals it would require to make this one more user-friendly.
Add x, y, w, h properties to Rect2 #1991 (comment) suggests adding begin as a Rect2 property, which is also something worth proposing elsewhere, as it would greatly improve the viability of this proposal.
I am aware that there's a difference between the Rect2isize and end. The exported values in the Inspector would actually be the position and the size, something often not desirable for Camera2D's use cases. For this reason, the ability to export Rect2i's end is something that's worth proposing elsewhere.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
# Example codevarlimit:=camera.limitupdate_generic_boundaries(camera.limit)
limit.end.x+=20limit.position.x-=50limit.expand(point_of_interest)
If this enhancement will not be used often, can it be worked around with a few lines of script?
It roughly can. Not really a few lines of script, and it is somewhat redundant.
I get what you are saying, but I'm not sure if this is a good idea tbh. limit.x, limit.y, limit.w, limit.h is just by far not as explicit self-explanatory and intuitive as limit_left, limit_right, limit_bottom, limit_top.
Dealing with camera movement and controls can be tough, confusing and challenging for beginners already. This is definitely a feature a beginner would use. I would be in favor of keeping it more explicit and self-explanatory and have it feel somewhat "odd", than making it more tough and less intuitive for beginners, but also less "odd".
The problem is that Rect2 has width and height for right and bottom properties, so the camera limit would need to be camera bounds (i.e. top-left and size) to be intuitive as rect.
Closing, at least for now, as for this to be at the very least nicely doable there would need to be changes to the core class Rect2, or a more personalised way this very Variant could be exported to the editor.
Describe the project you are working on
A typical 2D Godot game
Describe the problem or limitation you are having in your project
The Camera2D's limit variables (
limit_left
,limit_top
,limit_right
,limit_bottom
) are all separate integers, which feels odd, considering they refer to the same thing. Eveneditor_draw_limits
property, when enabled, draws a rectangle of them.Furthermore, passing these as arguments of Vector2 or Rect2 functions becomes a somewhat repetitive task, especially noticeable if the camera itself is referenced in a variable.
Even though these values could be effectively expressed as a top-left and bottom-right Vector2.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
Combining all limit properties into a single Rect2i
limit
would make the variables less redundant while keeping its functionality relatively intact.This would be a breaking change that takes advantage of Godot 4's new Rect2i (Rect2 for integers)
Notes, Drawbacks and other Proposals
begin
as a Rect2 property, which is also something worth proposing elsewhere, as it would greatly improve the viability of this proposal.size
andend
. The exported values in the Inspector would actually be theposition
and thesize
, something often not desirable for Camera2D's use cases. For this reason, the ability to export Rect2i'send
is something that's worth proposing elsewhere.Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
If this enhancement will not be used often, can it be worked around with a few lines of script?
It roughly can. Not really a few lines of script, and it is somewhat redundant.
Is there a reason why this should be core and not an add-on in the asset library?
The Camera2D class is a core feature.
The text was updated successfully, but these errors were encountered: