diff --git a/src/defs.txt b/src/defs.txt index 8fb37d8..09830f3 100644 --- a/src/defs.txt +++ b/src/defs.txt @@ -120,7 +120,7 @@ actor 0 0 0 jupiter clickable no physics off -actor 0 593051 0 suit +actor 0 593051 0 suitv1 relativeto jupiter orbit 224000e3 0.66 player yes diff --git a/src/skeleton.rs b/src/skeleton.rs index 5478b8a..d8bdb7b 100644 --- a/src/skeleton.rs +++ b/src/skeleton.rs @@ -37,8 +37,13 @@ pub fn asset_name_to_path(name: &str) -> &'static str { } } -pub fn skeleton_name_to_skeletondef(_name: &str) -> Option { - return None; +pub fn skeleton_name_to_skeletondef(name: &str) -> Option { + match name { + "suitv1" => Some(SkeletonDef { + base: "skeleton/suit_v1/base.glb#Scene0".to_string(), + }), + _ => None, + } } pub struct SkeletonPlugin; @@ -49,7 +54,9 @@ impl Plugin for SkeletonPlugin { } #[derive(Component)] pub struct SkeletonLimb; -pub struct SkeletonDef; +pub struct SkeletonDef { + pub base: String, +} //pub fn spawn( // name: &str, @@ -66,13 +73,11 @@ pub fn load( entity_commands: &mut EntityCommands, asset_server: &AssetServer, ) { - let skeletondef = skeleton_name_to_skeletondef(name); - if skeletondef.is_none() { + if let Some(skel) = skeleton_name_to_skeletondef(name) { + entity_commands.insert(load_scene_by_path(skel.base.as_str(), asset_server)); + } else { entity_commands.insert(load_scene_by_path(asset_name_to_path(name), asset_server)); } - else { - //entity_commands.insert(); - } } //pub fn load_scene(