Fix viewport_to_world and world_to_viewport#6526
Fix viewport_to_world and world_to_viewport#6526tim-blackbird wants to merge 1 commit intobevyengine:mainfrom
viewport_to_world and world_to_viewport#6526Conversation
|
Needs more testing D: |
|
this may be reverted for the 0.9, see #6522 |
|
I'm less convinced by this. it feels like the right fix is that the viewport's |
|
@devil-ira sorry, actually, I don't quite understand this. Could you provide some more commentary on why your solution does what is intended? From a mathematical perspective, I get that if I want to mirror a coordinate system along a particular axis, we multiply the values of that axis by But suppose we have a grid an N x M grid, and we want to mirror in the y-direction. Then, the mapping from |
Pls no. I really want screen space stuff to have consistent coordinates, unless it really makes sense for them to be different. (UI and viewports are aligned currently). @bzm3r Note that this is a breaking change as I believed(I'm rethinking atm) the usage of the existing method was technically incorrect, even if it did work. It's just the sign/direction of the Y axis that is off. The comments in the code should be changed to reflect that better. I'm closing this as I realize the way it is now is not necessarily incorrect, and merging this would make using these methods with the cursor position more cumbersome. I do want to make an argument in favor of making the coordinate systems of screen space stuff in Bevy(UI, cursor position, and viewports) be consistent/least surprising, but I'll do that in a dedicated issue once I've written something up :) |
Yes, I agree that making the coordinate systems of screen space stuff be consistent. It's weird that when I first using |
Objective
The origin of the viewport lies at the top-left, as documented here.
Test program.
Migration Guide
Camera::world_to_viewportnow correctly returns the viewport position with Y pointing downwards, instead of up.You may need to adjust your code if you were using this method.