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.
Related issue: #24354, #26322, #26041
Description
This PR sets a constant for the right and left eye layer, and also allows you to change the XRCamera layers simply by updating the main camera layer. I think matching the layers on both the XRCamera and the main camera is a intuitive behaviour, it was what I was expecting before I investigated the XRManager code.
Update
After some thought, I decided to change how I handle the XR camera layers. It seems to me that the only reason that layers are added to the individual XR cameras is to demonstrate the Mery video example. If that's case, then I think it makes senses for the XR cameras layers to match the main renderer camera up until the user request the change. That is why I suggest we introduce an API to set the individual camera layers.
I think this will simplify the way layers are handled, make for a lot less code in all cases, and it will be more consistent with the rest of the project - I believe this is the only case where the renderer reserves layers for a specific use?
e.g. currently if I want to render a specific layer in XR I have to do this ( or see :
after this change it will become
for the Mery example, you only need to add the one line:
renderer.xr.setEyeLayers( [ 0, 1 ] );