Ray3d::from_screenspace() implementation from Camera.viewport_to_world() #76
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
bevyengine/bevy#8306 introduces consistent coordinates for every entity without
.y
flipping. The changes are not rolled out yet, but currentmain
ofbevy_mod_raycast
is not working well withbevy
'smain
. In attempt to fix this, I found a simple but questionable solution:bevy_mod_raycast/src/primitives.rs
Lines 240 to 262 in bd84951
is equal to
https://github.com/bevyengine/bevy/blob/585baf0a66b855cef1f0568a4af44b666cfee076/crates/bevy_render/src/camera/camera.rs#L250-L270
Solution
It seems that there's no reason not to utilize
Camera::viewport_to_world()
as it's available since bevyengine/bevy@37860a0 fromv0.9.0
. I propose to utilizeCamera.viewport_to_world()
under the hood ofRay3d::from_screenspace()
as their purposes seems identical. Changes doesn't seem to break anyexamples
functionality on my end