diff --git a/testing/bevy_example/assets/assets_game.assets.ron b/testing/bevy_example/assets/assets_game.assets.ron index 5b1e969..40825c0 100644 --- a/testing/bevy_example/assets/assets_game.assets.ron +++ b/testing/bevy_example/assets/assets_game.assets.ron @@ -1,6 +1,6 @@ ({ - "world":File (path: "models/World.glb"), + /*"world":File (path: "models/World.glb"), "models": Folder ( path: "models/library", - ), + ),*/ }) \ No newline at end of file diff --git a/testing/bevy_example/src/core/mod.rs b/testing/bevy_example/src/core/mod.rs index 1ef7f3e..7c16989 100644 --- a/testing/bevy_example/src/core/mod.rs +++ b/testing/bevy_example/src/core/mod.rs @@ -11,6 +11,7 @@ impl Plugin for CorePlugin { legacy_mode: false, library_folder: "models/library".into(), format: GltfFormat::GLB, + material_library:true, aabbs: true, ..Default::default() }, diff --git a/testing/bevy_example/src/game/in_game.rs b/testing/bevy_example/src/game/in_game.rs index 75be98a..03ecb47 100644 --- a/testing/bevy_example/src/game/in_game.rs +++ b/testing/bevy_example/src/game/in_game.rs @@ -1,5 +1,5 @@ -use bevy::prelude::*; -use bevy_gltf_blueprints::{BluePrintBundle, BlueprintName, GameWorldTag}; +use bevy::{prelude::*, utils::hashbrown::HashMap}; +use bevy_gltf_blueprints::{BluePrintBundle, BlueprintName, BlueprintsList, GameWorldTag, Library, SpawnHere}; use bevy_gltf_worlflow_examples_common_rapier::{assets::GameAssets, GameState, InAppRunning}; use bevy_rapier3d::prelude::Velocity; @@ -7,31 +7,19 @@ use rand::Rng; pub fn setup_game( mut commands: Commands, - game_assets: Res, - models: Res>, + asset_server: Res, mut next_game_state: ResMut>, ) { - commands.insert_resource(AmbientLight { - color: Color::WHITE, - brightness: 0.2, - }); // here we actually spawn our game world/level - commands.spawn(( - SceneBundle { - // note: because of this issue https://github.com/bevyengine/bevy/issues/10436, "world" is now a gltf file instead of a scene - scene: models - .get(game_assets.world.id()) - .expect("main level should have been loaded") - .scenes[0] - .clone(), + SceneBundle{ + scene: asset_server.load("models/World.glb#Scene0"), ..default() }, bevy::prelude::Name::from("world"), GameWorldTag, InAppRunning, )); - next_game_state.set(GameState::InGame) } diff --git a/testing/bevy_example/src/game/mod.rs b/testing/bevy_example/src/game/mod.rs index 99b9b3f..d537091 100644 --- a/testing/bevy_example/src/game/mod.rs +++ b/testing/bevy_example/src/game/mod.rs @@ -97,13 +97,15 @@ impl Plugin for GamePlugin { fn build(&self, app: &mut App) { app.add_systems(Update, (spawn_test).run_if(in_state(GameState::InGame))) .add_systems(Update, validate_export) - .add_systems(Update, generate_screenshot.run_if(on_timer(Duration::from_secs_f32(0.2)))) // TODO: run once .add_systems(OnEnter(AppState::MenuRunning), start_game) .add_systems(OnEnter(AppState::AppRunning), setup_game) + /* .add_systems(Update, generate_screenshot.run_if(on_timer(Duration::from_secs_f32(0.2)))) // TODO: run once + + .add_systems( Update, exit_game.run_if(on_timer(Duration::from_secs_f32(0.5))), - ) // shut down the app after this time + ) // shut down the app after this time*/ ; } }