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

UI camera flexibility regression #5242

Open
nicopap opened this issue Jul 7, 2022 · 4 comments
Open

UI camera flexibility regression #5242

nicopap opened this issue Jul 7, 2022 · 4 comments
Labels
A-UI Graphical user interfaces, styles, layouts, and widgets C-Bug An unexpected or incorrect behavior P-Regression Functionality that used to work but no longer does. Add a test for this!

Comments

@nicopap
Copy link
Contributor

nicopap commented Jul 7, 2022

Bevy version

bf1ca81

What you did

In bevy 0.7, it was possible to manipulate individually ui cameras such as in this example.

What went wrong

With changes made to the way ui is handled in #4745, such design is impossible to execute. Manipulating UI cameras can be useful for fancy game effects, and it would be a shame to lose this flexibility.

@nicopap nicopap added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Jul 7, 2022
@Vrixyz
Copy link
Member

Vrixyz commented Jul 7, 2022

What exactly is impossible ?

I'll suppose you're referring to:

fn cam_system(
    mut cam: Query<(&mut Transform, &mut OrthographicProjection), With<CameraUi>>,
    input: Res<Input<KeyCode>>,
) {

By "manipulating camera", you mean changing the OrthographicProjection ? Would Projection be helpful ?

@nicopap
Copy link
Contributor Author

nicopap commented Jul 7, 2022

Would Projection be helpful ?

Since #4745 "CameraUi" is not a thing independent from other cameras, it's just a component to toggle ui visibility on a specific camera.

You can see in extract_default_ui_camera_view that now, the UI camera perspective is a set value, and it's not accessible from the main app world. This PR adds a way to manipulate that camera perspective, through CameraUiConfig

@Nilirad Nilirad added A-UI Graphical user interfaces, styles, layouts, and widgets P-Regression Functionality that used to work but no longer does. Add a test for this! and removed S-Needs-Triage This issue needs to be labelled labels Jul 7, 2022
nicopap added a commit to nicopap/bevy that referenced this issue Jul 8, 2022
Add fields to UiCameraConfig to control the UI camera scale and
position.

Fixes bevyengine#5242. It is again possible to manipulate the ui camera.

An alternative design was considered, where instead of having a
component that controls all of the UI camera settings, the component
would only hold an Entity referencing another camera.

That design was abandoned in favor of the current one because the
viewport is tightly bound to the "actual" camera the UI camera is
attached to. So it would be awkward to maintain independently two
different cameras.
nicopap added a commit to nicopap/bevy that referenced this issue Jul 8, 2022
Add fields to UiCameraConfig to control the UI camera scale and
position.

Fixes bevyengine#5242. It is again possible to manipulate the ui camera.

An alternative design was considered, where instead of having a
component that controls all of the UI camera settings, the component
would only hold an Entity referencing another camera.

That design was abandoned in favor of the current one because the
viewport is tightly bound to the "actual" camera the UI camera is
attached to. So it would be awkward to maintain independently two
different cameras.
nicopap added a commit to nicopap/bevy that referenced this issue Jul 9, 2022
Add fields to UiCameraConfig to control the UI camera scale and
position.

Fixes bevyengine#5242. It is again possible to manipulate the ui camera.

An alternative design was considered, where instead of having a
component that controls all of the UI camera settings, the component
would only hold an Entity referencing another camera.

That design was abandoned in favor of the current one because the
viewport is tightly bound to the "actual" camera the UI camera is
attached to. So it would be awkward to maintain independently two
different cameras.
nicopap added a commit to nicopap/bevy that referenced this issue Jul 19, 2022
Add fields to UiCameraConfig to control the UI camera scale and
position.

Fixes bevyengine#5242. It is again possible to manipulate the ui camera.

An alternative design was considered, where instead of having a
component that controls all of the UI camera settings, the component
would only hold an Entity referencing another camera.

That design was abandoned in favor of the current one because the
viewport is tightly bound to the "actual" camera the UI camera is
attached to. So it would be awkward to maintain independently two
different cameras.
nicopap added a commit to nicopap/bevy that referenced this issue Jul 21, 2022
Add fields to UiCameraConfig to control the UI camera scale and
position.

Fixes bevyengine#5242. It is again possible to manipulate the ui camera.

An alternative design was considered, where instead of having a
component that controls all of the UI camera settings, the component
would only hold an Entity referencing another camera.

That design was abandoned in favor of the current one because the
viewport is tightly bound to the "actual" camera the UI camera is
attached to. So it would be awkward to maintain independently two
different cameras.
nicopap added a commit to nicopap/bevy that referenced this issue Jul 21, 2022
Add fields to UiCameraConfig to control the UI camera scale and
position.

Fixes bevyengine#5242. It is again possible to manipulate the ui camera.

An alternative design was considered, where instead of having a
component that controls all of the UI camera settings, the component
would only hold an Entity referencing another camera.

That design was abandoned in favor of the current one because the
viewport is tightly bound to the "actual" camera the UI camera is
attached to. So it would be awkward to maintain independently two
different cameras.
nicopap added a commit to nicopap/bevy that referenced this issue Jul 21, 2022
Add fields to UiCameraConfig to control the UI camera scale and
window_origin.

Fixes bevyengine#5242. It is again possible to manipulate the ui camera.

An alternative design was considered, where instead of having a
component that controls all of the UI camera settings, the component
would only hold an Entity referencing another camera.

That design was abandoned in favor of the current one because the
viewport is tightly bound to the "actual" camera the UI camera is
attached to. So it would be awkward to maintain independently two
different cameras.
@cart
Copy link
Member

cart commented Aug 11, 2022

We discussed having an optional UICameraBundle that points to a ui-only render graph. I think im open to it and thats largely a superficial / high level change.

Notably, you can still do UI-only cameras by spawning a 2d or 3d camera and using RenderLayers. But a more explicit UI-only camera seems reasonable / one that doesn't run empty 2d or 3d passes.

@cart
Copy link
Member

cart commented Aug 11, 2022

I think the UiPassNode will already work as expected for some UiCameraBundle with a customized projection. I built the "default ui view" part of that as opt-in (with this scenario in mind).

You might be able to create your own UiCameraBundle right now, point it to a render graph with only UiPassNode wired up, and it might just work. No promises as I havent proven this scenario out yet, but I think theres a good chance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-UI Graphical user interfaces, styles, layouts, and widgets C-Bug An unexpected or incorrect behavior P-Regression Functionality that used to work but no longer does. Add a test for this!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants