Add RenderLayers support to picking backend#124
Open
lukeod wants to merge 1 commit into
Open
Conversation
- Filter cameras and entities by RenderLayers intersection - Select highest-order active camera for pointer target - Maintains compatibility with entities without RenderLayers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Adds RenderLayers support to the Lunex picking backend to properly filter entities and cameras by visibility layers.
Problem
The picking backend was not respecting RenderLayers, causing UI elements to receive pick events from cameras that shouldn't be able to see them. This is particularly problematic in multi-camera setups where different cameras target different layers (e.g., a 3D
world camera on layer 0 and a 2D UI camera on layer 1).
Solution
Option<&RenderLayers>to both camera and entity queriesmax_by_key()instead offind()DEFAULT_LAYERS(layer 0) for entities/cameras without explicit RenderLayersChanges
Testing
Tested with a multi-camera setup:
Related
Follows the same pattern as Bevy's built-in mesh picking backend for RenderLayers filtering.
This is the same issue identified by PR #108, however this commit aims to follow bevy norms, and not implement any breaking changes (such as requiring an explicit camera index).