diff --git a/crates/bevy_render/src/camera/projection.rs b/crates/bevy_render/src/camera/projection.rs index 3f983fa8b33302..3c2a7d745da217 100644 --- a/crates/bevy_render/src/camera/projection.rs +++ b/crates/bevy_render/src/camera/projection.rs @@ -104,12 +104,14 @@ impl CameraProjection for OrthographicProjection { fn update(&mut self, width: f32, height: f32) { match (&self.scaling_mode, &self.window_origin) { (ScalingMode::WindowSize, WindowOrigin::Center) => { - let half_width = width / 2.0; - let half_height = height / 2.0; - self.left = -half_width; + let half_width = (width / 2.0).round(); + let half_height = (height / 2.0).round(); + // Assign left and bottom such that (right-left)==width and (top-bottom)==height + // still hold with with rounded half_width and half_height + self.left = half_width - width; self.right = half_width; self.top = half_height; - self.bottom = -half_height; + self.bottom = half_height - height; } (ScalingMode::WindowSize, WindowOrigin::BottomLeft) => { self.left = 0.0;