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

Add a property to change the Camera2D view rectangle gizmo's size #11611

Open
totally-grey opened this issue Jan 19, 2025 · 0 comments
Open

Add a property to change the Camera2D view rectangle gizmo's size #11611

totally-grey opened this issue Jan 19, 2025 · 0 comments

Comments

@totally-grey
Copy link

totally-grey commented Jan 19, 2025

Describe the project you are working on

A game featuring different kinds of consoles, each with its own resolution and unique games.

Describe the problem or limitation you are having in your project

Each console add the game running scene on a subviewport that has the console resolution, which is different from project settings resolution so when i add the camera to the console game the camera has size from project settings. So to avoid this I'm using a ReferenceRect node with a simulate the camera view, so when the game start a gamera substitue the ReferenceRect to Camera

Each console adds the game running scene to a subviewport configured with the console's resolution, which differs from the project settings resolution. However, when I add the Camera2D node to the any console game, the camera inherits the project settings resolution. To avoid this, I'm using a ReferenceRect node to simulate the camera view. When the game starts, a camera replaces the ReferenceRect.

Editor view

Red rectangle is RectangleRect
Pink rectangle is the Camera2D view

Image

In-game view

Image

Describe the feature / enhancement and how it helps to overcome the problem or limitation

A custom way to set the camera size helps better visualize the camera view when working with subviewport textures. This is especially useful when applying zoom in the editor, as the camera view doesn’t match the actual in-game view.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

Add a checkbox to replace the default camera view size to a custom size, so when the checkbox is selected the camera view size is the same as defined on custom size Vector2 property.

Custom size set to false:

Image

Custom size set to true:

Image

How it's look on editor:

2025-01-19.16-53-20.mp4

The zoom property must work on custom size rectangle view too.
I think that this can be useful with Camera3D too.

If this enhancement will not be used often, can it be worked around with a few lines of script?

This can be achieved with a ReferenceRect that is replaced during when in-game. However, if the camera has functions that run like tool or animations, these also need to be added to the ReferenceRect to allow testing within the editor.

Is there a reason why this should be core and not an add-on in the asset library?

This enhances the workflow with subviewports, improving the ability to visualize what will be displayed by the camera.

@Calinou Calinou changed the title Add property to change the camera view rectangle. Add a property to change the Camera2D view rectangle gizmo's size Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants