-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
User UI camera control #5252
User UI camera control #5252
Conversation
abea0a4
to
3b603cb
Compare
3b603cb
to
3072955
Compare
3072955
to
00655b2
Compare
@IceSentry @superdump, I think this is a serious enough breakage that we should try to get this reviewed and merged for 0.8 |
I'd also like to get cart's input on it. Since from reading the code it gave out the impression he had something in mind. |
#[derive(Component)] | ||
pub struct DefaultCameraView(pub Entity); | ||
#[derive(Component, Debug)] | ||
pub struct UiCamera { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docs needed.
..default() | ||
}, | ||
}) | ||
.insert(UiCameraConfig { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part of the example is unclear, and needs more comments.
We can also probably shorten it now that #5343 has merged!
examples/ui/ui.rs
Outdated
@@ -309,6 +316,31 @@ struct ScrollingList { | |||
position: f32, | |||
} | |||
|
|||
fn change_ui_camera( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO we should have this in its own example. I don't like how big this example is to begin with; let's not make it worse.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure thing, the off_screen_focusables
from ui-navigation seems like a perfect fit, and would help lower the size of the rfc41 PR too.
I feel like this should be split in 2 PR. I like the render layer idea, but I don't like the config part because of the pub projection. |
@IceSentry said:
Indeed. In insight, it's quite obvious those are two different features. The The thing is, you need access to the UI projection for a lot of reasons (navigation is one of them). Here is a different proposition: have a But the one I provided here suffers from the same issue, so maybe it's OK? |
Mhmm. I think we split this, merge the |
Can do, ready tomorrow. But if it doesn't fix #5242 There is no reason for it to be a priority anymore. |
387e95f
to
be9d099
Compare
This enables having different UI per camera. With bevyengine#5225, this enables having different interactive UIs per window. Although, to properly complete this, the focus system will need to account for RenderLayer of UI nodes.
be9d099
to
60c29b8
Compare
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.
60c29b8
to
90d4cb8
Compare
As it was added in bevyengine#5252
As it was added in bevyengine#5252
As it was added in bevyengine#5252
As it was added in bevyengine#5252
As it was added in bevyengine#5252
As it was added in bevyengine#5252
This PR is not fully addressed by #5892, but I think it should be the direction forward, thus superseding this PR. |
Objective
Enable user manipulation of UI camera.
Solution
Add user control of UI cameras
Add fields to UiCameraConfig to control the UI camera scale and
position.
Fixes #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.
Changelog
position
,scale
andwindow_origin
fields toUiCameraConfig
to enablemanipulating the position of the attached UI camera.
Migration Guide
UiCameraBundle
and manipulating its
OrthographicProjection
andGlobalTransform
,add a
UiCameraConfig
component to your viewport camera, anduse its field to change the ui camera position
UiCameraProjection
component to access the UI camera's projection.