Write an example for combining a 2D ui cam with a 3D world cam
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 171
Description
## What problem does this solve or what need does it fill?
This is a common setup for games where you spawn a 3D cam with the player, but also need a camera for the menus. You could shuffle a single camera around, or spawn and despawn one, but it's often easiest to just have two dedicated cameras.
This comes at some complexity though! 3D gizmos will by default render onto the 2D camera, looking really wonky. So you need to work with render layers. But don't you dare change the layer of the 2D camera, [or your shadows will flicker](https://github.com/bevyengine/bevy/issues/19166)!
This kind of setup is fairly common and I've seen many requests for how to do this on Discord, so I think an example is in order :) I have some working code in Foxtrot that I can upstream as an example in time
Contributor guide
Research direction
Start with the working code in Foxtrot and review how it combines the 2D UI camera with the 3D world camera. Check the render-layer behavior, including the warning about changing the 2D camera's layer and shadow flicker. Done means adding a clear Bevy example that demonstrates this setup.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- documentation, game-dev
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 66/100