Skip to content

Fixing picking behaviour for multiple cameras#108

Open
schecko wants to merge 1 commit into
bytestring-net:mainfrom
schecko:multi_camera
Open

Fixing picking behaviour for multiple cameras#108
schecko wants to merge 1 commit into
bytestring-net:mainfrom
schecko:multi_camera

Conversation

@schecko
Copy link
Copy Markdown

@schecko schecko commented Apr 8, 2025

Before this change, the picking system would pick the first camera in the query (Entity, &Camera, &GlobalTransform, &OrthographicProjection). This means there isn't any way to match the picking camera chosen with the camera used in viewport calculations. This matters for projects that use multiple Orthographic cameras, particularly with different transformations. An example use case is a game that might used a fixed camera for the UI(lunex) and a dynamic camera for gameplay. Changing the gameplay camera transform will invalidate the picking raycasts, causing the UI to render correctly but not be interactive or have incorrect hit boxes.

@lukeod
Copy link
Copy Markdown

lukeod commented Oct 30, 2025

I also ran into this issue while using a 3d world camera, and a 2d camera for a GUI overlay. I came up with what i think is a fix prior to noticing this PR (see above). It may be worth testing/comparing the solutions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants