This commit is contained in:
AmadeusWM committed 2025-04-05 21:11:15 +02:00
1 parent 4dd5b14ea1
commit 4a9dc86fc0
7 files changed
+15 -6

No files matched your search

Binary file not shown.
+4 -1
View File
@@ -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",
),
})
Binary file not shown.
Binary file not shown.
Binary file not shown.
+5 -3
View File
@@ -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<Gltf>,
#[asset(key = "house")]
pub(crate) house: Handle<Gltf>,
#[asset(key = "library", collection(typed, mapped))]
pub(crate) library: HashMap<String, Handle<Gltf>>,
}
#[derive(AssetCollection, Resource, Clone)]
+6 -2
View File
@@ -11,7 +11,11 @@ fn spawn_level(
models: Res<Assets<Gltf>>,
gltf_assets: Res<GltfAssets>
) {
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()));
// commands.spawn(SceneRoot(gltf.scenes[0].clone()));
let asset = gltf.default_scene.as_ref().unwrap();
commands.spawn(SceneRoot(asset.clone()));
}