-
use bevy::{prelude::*, render::camera::ScalingMode};
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_startup_system(setup) // .add_systems(Startup, setup) for bevy 0.11.1
.run();
}
fn setup(
mut commands: Commands,
mut meshes: ResMut<Assets<Mesh>>,
mut color_materials: ResMut<Assets<ColorMaterial>>,
) {
commands.spawn(ColorMesh2dBundle {
mesh: meshes.add(shape::Circle::new(25.).into()).into(),
material: color_materials.add(ColorMaterial::from(Color::YELLOW)),
..default()
});
commands.spawn(Camera2dBundle {
projection: OrthographicProjection {
scaling_mode: ScalingMode::AutoMin {
min_width: 920.0,
min_height: 920.0,
},
..default()
},
..default()
});
} In Bevy 0.10.1, this renders the yellow circle as I expect, but in both 0.11.0 and 0.11.1 versions, the circle does not appear at all, no matter how much I fiddle with the circle's size and the scalinemode's min width and heights I think I Just don't fully understand exactly what ScalingMode::AutoMin does and I'm probably doing something really silly with it. From what I could tell when I'd used it in the past, it maintains a consistent size of the view into the world. If this is a bug, I apologize if it's already been reported, I had searched the issues for the keyword scalingmode and didn't find anything and wasn't sure what other keywords to look for. Edit: Grammar Edit 2: I rendered some text and it appears okay in this same example in 0.11.0 Edit 3: I poorly implied it, but replacing projection with its default renders the circle okay as well. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
It was ..default() shenanigans.. The following works: let mut camera = Camera2dBundle::default();
camera.projection.scaling_mode = ScalingMode::AutoMin {
min_width: 640.0,
min_height: 480.0,
};
commands.spawn(camera); I didn't check the values, but I assume maybe Camera2dBundle::default() produces different default values for it's OrthographicProjection field compared to OrthographicProject::default() , but was not the case in 0.10.x. |
Beta Was this translation helpful? Give feedback.
It was ..default() shenanigans.. The following works:
I didn't check the values, but I assume maybe Camera2dBundle::default() produces different default values for it's OrthographicProjection field compared to OrthographicProject::default() , but was not the case in 0.10.x.