Skip to content

Conversation

TheRawMeatball
Copy link
Member

No description provided.

@cart
Copy link
Member

cart commented Apr 27, 2021

bors r+

bors bot pushed a commit that referenced this pull request Apr 27, 2021
@bors
Copy link
Contributor

bors bot commented Apr 27, 2021

@bors bors bot changed the title Detect camera projection changes [Merged by Bors] - Detect camera projection changes Apr 27, 2021
@bors bors bot closed this Apr 27, 2021
ostwilkens pushed a commit to ostwilkens/bevy that referenced this pull request Jul 27, 2021
johanhelsing pushed a commit to johanhelsing/bevy that referenced this pull request Aug 1, 2021
@OpenSourceJesus
Copy link

OpenSourceJesus commented Apr 22, 2024

The camera doesn't zoom in bevy 0.13.2, regardless of what camera.projection.scale is set to.

use bevy::prelude::*;
use bevy_asset_loader::prelude::*;
use bevy_gltf_components::ComponentsFromGltfPlugin;
use bevy_registry_export::*;

fn main() {
	let app = App::new()
		.add_plugins((
			DefaultPlugins,
			ExportRegistryPlugin::default(),
			ComponentsFromGltfPlugin::default()
		))
		.init_state::<MyStates>()
		.add_loading_state(
			LoadingState::new(MyStates::AssetLoading)
				.continue_to_state(MyStates::Next)
				.load_collection::<LevelAssets>(),
		)
		.add_systems(OnEnter(MyStates::Next), StartLevel)
		.run();
}

#[derive(AssetCollection, Resource)]
struct LevelAssets {
	#[asset(path = "Test.glb#Scene0")]
	level: Handle<Scene>,
}

fn StartLevel(
	mut commands: Commands,
	assets: Res<LevelAssets>,
	assetServer: Res<AssetServer>,
	mut meshes : ResMut<Assets<Mesh>>,
) {
	let mut camera = Camera2dBundle { ..default() };
	camera.projection.scale = 999.0; // <---------------------------------------------- Problem is here
	commands.spawn(camera);
	commands.spawn((
		SceneBundle {
			scene: assets.level.clone(),
			..default()
		},
		Name::new("Test"),
	));
}

#[derive(
	Clone, Eq, PartialEq, Debug, Hash, Default, States,
)]
enum MyStates {
	#[default]
	AssetLoading,
	Next,
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants