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

Window y coordinate inverted on main. #6522

Closed
Elabajaba opened this issue Nov 9, 2022 · 11 comments
Closed

Window y coordinate inverted on main. #6522

Elabajaba opened this issue Nov 9, 2022 · 11 comments
Labels
A-Input Player input via keyboard, mouse, gamepad, and more A-Windowing Platform-agnostic interface layer to run your app in C-Usability A simple quality-of-life change that makes Bevy easier to use X-Controversial There is active debate or serious implications around merging this PR

Comments

@Elabajaba
Copy link
Contributor

Elabajaba commented Nov 9, 2022

Bevy version

main 1914a3f

What you did

windows.primary().cursor_position()

What went wrong

I expected the y coordinate at the top of the window to be high, and the bottom to be low, like how it was in bevy 0.8. Instead, the top of the window was low and the bottom of the window was high.

For systems that use the mouse coordinates, you now have to either add * Vec2::new(1.0, -1.0) or make the variable mutable and add world_pos.y *= -1.0;.

Additional information

Probably caused by either #6000 or the winit upgrade.
Caused by #6000

I haven't verified if this happens on non windows 11 systems.

@Elabajaba Elabajaba added C-Bug An unexpected or incorrect behavior S-Needs-Triage This issue needs to be labelled labels Nov 9, 2022
@alice-i-cecile alice-i-cecile added A-Input Player input via keyboard, mouse, gamepad, and more A-Windowing Platform-agnostic interface layer to run your app in and removed S-Needs-Triage This issue needs to be labelled labels Nov 9, 2022
@alice-i-cecile alice-i-cecile added this to the Bevy 0.9 milestone Nov 9, 2022
@alice-i-cecile
Copy link
Member

I'm unsure about reverting this part of those changes

This side effect is annoying, but it really does feel like visit coordinates should be in UI space.

@alice-i-cecile
Copy link
Member

With more complex 2D cameras, this will probably be a wash.

@Elabajaba
Copy link
Contributor Author

Elabajaba commented Nov 9, 2022

This breaks bevy's coordinate system consistency. Y is no longer up for everything, it's now up for everything but UI and mouse cursor position.

@alice-i-cecile
Copy link
Member

That is deliberate: see #5572.

@Elabajaba
Copy link
Contributor Author

Elabajaba commented Nov 9, 2022

Makes sense, want me to close the issue then?

edit: Or should the mouse coordinates still be considered an issue, while UI isn't?

@rparrett
Copy link
Contributor

rparrett commented Nov 9, 2022

Just linking this in here for context:

Discussion about the mouse changes from #6000

@mockersf
Copy link
Member

mockersf commented Nov 9, 2022

Changing mouse coordinates should not have been made as part of #6000. Changing UI Y orientation was UI-only and non controversial, changing mouse is not UI-only and controversial...
In short term (for the 0.9 release) we should revert that change, which can be re-submitted in its own PR after. Or at least have a controversial discussion on wether that's what we want, but that could end up blocking the 0.9 which is not something nice...

for ecosystem review:

engine (0,0)
unity bottom left https://docs.unity3d.com/ScriptReference/Input-mousePosition.html
godot top left
unreal engine couldn't find

@cart
Copy link
Member

cart commented Nov 9, 2022

I agree with @mockersf. Mouse cursor orientation should not have been changed in #6000. Much more controversial decision and one worth taking the appropriate time on. We should revert for 0.9.

@irate-devil
Copy link
Contributor

Feel free to blame me as I was the one that pushed for that change 🙈

I agree that it should have some more discussion, and that we should revert it.
But I also believe that it was the right decision and I'll investigate some more and collect my thoughts so it can be reconsidered for 0.10

Somewhat awkward, but I realized the viewport_to_world method was not flipping the Y-axis as it should. If that bugfix gets merged and the cursor origin reverted it will mean the cursor positions Y-axis would need to be flipped again when passing it to viewport_to_world :' )

bors bot pushed a commit that referenced this issue Nov 10, 2022
This reverts commit 8429b6d as discussed in #6522.

I tested that the game_menu example works as it should.

Co-authored-by: devil-ira <justthecooldude@gmail.com>
@mockersf
Copy link
Member

reverted in #6533
keeping this issue to continue discussing if we want to change

@mockersf mockersf removed this from the Bevy 0.9 milestone Nov 11, 2022
@alice-i-cecile alice-i-cecile added C-Usability A simple quality-of-life change that makes Bevy easier to use X-Controversial There is active debate or serious implications around merging this PR and removed C-Bug An unexpected or incorrect behavior labels Nov 11, 2022
ItsDoot pushed a commit to ItsDoot/bevy that referenced this issue Feb 1, 2023
This reverts commit 8429b6d as discussed in bevyengine#6522.

I tested that the game_menu example works as it should.

Co-authored-by: devil-ira <justthecooldude@gmail.com>
@Elabajaba
Copy link
Contributor Author

Elabajaba commented Oct 18, 2023

I don't think this is really relevant anymore so I'm closing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Input Player input via keyboard, mouse, gamepad, and more A-Windowing Platform-agnostic interface layer to run your app in C-Usability A simple quality-of-life change that makes Bevy easier to use X-Controversial There is active debate or serious implications around merging this PR
Projects
None yet
Development

No branches or pull requests

6 participants