The OrthographicProjection has it's default values overriden in Camera2dBundle's default implementation, causing counter-intuitive problems #12267
Labels
A-Rendering
Drawing game state to the screen
C-Bug
An unexpected or incorrect behavior
C-Usability
A targeted quality-of-life change that makes Bevy easier to use
Hello!
I don't know if this should be a feature request or a bug.
Since this is about unexpected behavior, I feel like a bug fits better.
Bevy version
0.13
What you did
Warning in advance: still a beginner at rust, so I might be using an anti-pattern somewhere.
I was messing around with different values to initialize the
Camera2dBundle
with, and noticed my rendering seems to disappear sometimes.After looking at the source code, I found these lines:
bevy/crates/bevy_core_pipeline/src/core_2d/camera_2d.rs
Lines 37 to 42 in 04ec105
This means, that when initializing the camera on your side using a camera 2d bundle, if you want a scale, you must be careful to also specify znear / zfar.
What went wrong
When not specifying znear / zfar, all sprites and text stop appearing.
I think it would be better if the defaults of
OrthographicProjection
work out of the box, but I don't know the internals of bevy enough to know if this is reasonnable. A warning in the docs would also may be a solution.Additional information
I saw #239, but I don't think it's related since any scale value breaks the rendering.
The text was updated successfully, but these errors were encountered: