File tree 1 file changed +6
-1
lines changed
crates/bevy_render/src/camera
1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -93,11 +93,16 @@ impl OrthographicCameraBundle {
93
93
/// corresponding to `Z=+999.9` (closest to camera) to `Z=-0.1` (furthest away from
94
94
/// camera) in world space.
95
95
pub fn new_2d ( ) -> Self {
96
+ Self :: custom_2d ( 1000.0 , 1.0 )
97
+ }
98
+
99
+ /// Create an orthographic projection camera with a custom Z position and scale.
100
+ pub fn custom_2d ( far : f32 , scale : f32 ) -> Self {
96
101
// we want 0 to be "closest" and +far to be "farthest" in 2d, so we offset
97
102
// the camera's translation by far and use a right handed coordinate system
98
- let far = 1000.0 ;
99
103
let orthographic_projection = OrthographicProjection {
100
104
far,
105
+ scale,
101
106
depth_calculation : DepthCalculation :: ZDifference ,
102
107
..Default :: default ( )
103
108
} ;
You can’t perform that action at this time.
0 commit comments