bevy
bevy copied to clipboard
Window y coordinate inverted on main.
Bevy version
main 1914a3f288a812667f735ee9e7806cf1560dacc0
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 https://github.com/bevyengine/bevy/pull/6000 or the winit upgrade.~~ Caused by https://github.com/bevyengine/bevy/pull/6000
I haven't verified if this happens on non windows 11 systems.
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.
With more complex 2D cameras, this will probably be a wash.
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.
That is deliberate: see #5572.
Makes sense, want me to close the issue then?
edit: Or should the mouse coordinates still be considered an issue, while UI isn't?
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 |
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.
Feel free to blame me as I was the one that pushed for that change :see_no_evil:
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
:' )
reverted in #6533 keeping this issue to continue discussing if we want to change
I don't think this is really relevant anymore so I'm closing it.