From 2c953914bcd13681447dbaec130dcce140a4aeb1 Mon Sep 17 00:00:00 2001 From: Stepan Koltsov Date: Mon, 18 Mar 2024 17:35:33 +0000 Subject: [PATCH] Explain Camera2dBundle.projection needs to be set carefully (#11115) Encountered it while implementing https://github.com/bevyengine/bevy/pull/11109. Co-authored-by: Alice Cecile --- crates/bevy_core_pipeline/src/core_2d/camera_2d.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/crates/bevy_core_pipeline/src/core_2d/camera_2d.rs b/crates/bevy_core_pipeline/src/core_2d/camera_2d.rs index 86e636d1a6b7d..83cfdfe3b3a46 100644 --- a/crates/bevy_core_pipeline/src/core_2d/camera_2d.rs +++ b/crates/bevy_core_pipeline/src/core_2d/camera_2d.rs @@ -22,6 +22,10 @@ pub struct Camera2d; pub struct Camera2dBundle { pub camera: Camera, pub camera_render_graph: CameraRenderGraph, + /// Note: default value for `OrthographicProjection.near` is `0.0` + /// which makes objects on the screen plane invisible to 2D camera. + /// `Camera2dBundle::default()` sets `near` to negative value, + /// so be careful when initializing this field manually. pub projection: OrthographicProjection, pub visible_entities: VisibleEntities, pub frustum: Frustum,