diff --git a/assets/level.blend b/assets/level.blend index c7cf0b1..927fc57 100644 Binary files a/assets/level.blend and b/assets/level.blend differ diff --git a/assets/main.assets.ron b/assets/main.assets.ron index de28a0c..3b1df6a 100644 --- a/assets/main.assets.ron +++ b/assets/main.assets.ron @@ -1,4 +1,7 @@ ({ "lebron": File (path: "images/KingLebron.png"), - "wall": File (path: "meshes/House.glb"), + "house": File (path: "meshes/House.glb"), + "library": Folder ( + path: "meshes/library", + ), }) diff --git a/assets/meshes/library/creepy_jumbo.glb b/assets/meshes/library/creepy_jumbo.glb new file mode 100644 index 0000000..e8ef174 Binary files /dev/null and b/assets/meshes/library/creepy_jumbo.glb differ diff --git a/assets/meshes/library/wall.glb b/assets/meshes/library/wall.glb new file mode 100644 index 0000000..2fcf23d Binary files /dev/null and b/assets/meshes/library/wall.glb differ diff --git a/assets/meshes/wall.glb b/assets/meshes/wall.glb deleted file mode 100644 index 0ff4c63..0000000 Binary files a/assets/meshes/wall.glb and /dev/null differ diff --git a/src/asset_loading/mod.rs b/src/asset_loading/mod.rs index 79a6922..04eba14 100644 --- a/src/asset_loading/mod.rs +++ b/src/asset_loading/mod.rs @@ -1,4 +1,4 @@ -use bevy::prelude::*; +use bevy::{prelude::*, utils::HashMap}; use crate::GameState; use bevy_asset_loader::prelude::*; @@ -30,8 +30,10 @@ pub(crate) struct AudioAssets {} #[derive(AssetCollection, Resource, Clone)] pub(crate) struct GltfAssets { - // #[asset(key = "wall")] - // pub(crate) wall: Handle, + #[asset(key = "house")] + pub(crate) house: Handle, + #[asset(key = "library", collection(typed, mapped))] + pub(crate) library: HashMap>, } #[derive(AssetCollection, Resource, Clone)] diff --git a/src/level_instantiation/mod.rs b/src/level_instantiation/mod.rs index 6be58f3..4fa5333 100644 --- a/src/level_instantiation/mod.rs +++ b/src/level_instantiation/mod.rs @@ -11,7 +11,11 @@ fn spawn_level( models: Res>, gltf_assets: Res ) { - // let gltf = models.get(&gltf_assets.wall).unwrap(); + println!("LIBRARY: {:?}", gltf_assets.library); + let jumbo = gltf_assets.library.get("meshes/library/wall.glb").unwrap(); + let gltf = models.get(jumbo).unwrap(); // commands.spawn(SceneRoot(gltf.scenes[0].clone())); + let asset = gltf.default_scene.as_ref().unwrap(); + commands.spawn(SceneRoot(asset.clone())); }