bevy icon indicating copy to clipboard operation
bevy copied to clipboard

Add a "screen ray" method

Open bonsairobo opened this issue 6 years ago • 4 comments

Basically this: https://docs.amethyst.rs/stable/amethyst_rendy/camera/enum.Projection.html#method.screen_ray

I think it's an essential utility for 3D games.

bonsairobo avatar Aug 15 '20 23:08 bonsairobo

+1 for some camera helpers.. amethyst's might be cleaner but I have some related code that can be donated:

  • Ray/Ray and Line/Plane intersection using glam: https://github.com/aclysma/minimum/blob/WIP/minimum-math/src/functions.rs
  • I had a "viewport" abstraction that essentially does the same thing the amethyst code is doing: https://github.com/aclysma/minimum/blob/WIP/minimum-game/src/resources/viewport.rs
  • For editor support, I combined the two to draw world-space UI with an immediate-mode API and do click detection. Given a constraint (a line or a plane) it would convert 2D movement back to 3D in a way that that felt pretty good (a surprisingly non-trivial thing to do).

aclysma avatar Aug 16 '20 03:08 aclysma

@cart do you think that would be a good first issue? It seems like nice project for someone getting into bevy

GabCampbell avatar Aug 16 '20 04:08 GabCampbell

#615 should solve this. Looking forward to your feedback!

MarekLg avatar Oct 06 '20 14:10 MarekLg

done: https://docs.rs/bevy/latest/bevy/render/camera/struct.Camera.html#method.viewport_to_world

mockersf avatar Jan 18 '23 10:01 mockersf