helo
This commit is contained in:
Binary file not shown.
@@ -1,4 +1,7 @@
|
|||||||
({
|
({
|
||||||
"lebron": File (path: "images/KingLebron.png"),
|
"lebron": File (path: "images/KingLebron.png"),
|
||||||
"wall": File (path: "meshes/House.glb"),
|
"house": File (path: "meshes/House.glb"),
|
||||||
|
"library": Folder (
|
||||||
|
path: "meshes/library",
|
||||||
|
),
|
||||||
})
|
})
|
||||||
|
|||||||
BIN
assets/meshes/library/creepy_jumbo.glb
Normal file
BIN
assets/meshes/library/creepy_jumbo.glb
Normal file
Binary file not shown.
BIN
assets/meshes/library/wall.glb
Normal file
BIN
assets/meshes/library/wall.glb
Normal file
Binary file not shown.
Binary file not shown.
@@ -1,4 +1,4 @@
|
|||||||
use bevy::prelude::*;
|
use bevy::{prelude::*, utils::HashMap};
|
||||||
|
|
||||||
use crate::GameState;
|
use crate::GameState;
|
||||||
use bevy_asset_loader::prelude::*;
|
use bevy_asset_loader::prelude::*;
|
||||||
@@ -30,8 +30,10 @@ pub(crate) struct AudioAssets {}
|
|||||||
|
|
||||||
#[derive(AssetCollection, Resource, Clone)]
|
#[derive(AssetCollection, Resource, Clone)]
|
||||||
pub(crate) struct GltfAssets {
|
pub(crate) struct GltfAssets {
|
||||||
#[asset(key = "wall")]
|
#[asset(key = "house")]
|
||||||
pub(crate) wall: Handle<Gltf>,
|
pub(crate) house: Handle<Gltf>,
|
||||||
|
#[asset(key = "library", collection(typed, mapped))]
|
||||||
|
pub(crate) library: HashMap<String, Handle<Gltf>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(AssetCollection, Resource, Clone)]
|
#[derive(AssetCollection, Resource, Clone)]
|
||||||
|
|||||||
@@ -11,7 +11,11 @@ fn spawn_level(
|
|||||||
models: Res<Assets<Gltf>>,
|
models: Res<Assets<Gltf>>,
|
||||||
gltf_assets: Res<GltfAssets>
|
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()));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user