load the base of the skeleton

This commit is contained in:
yuni 2024-04-22 21:09:05 +02:00
parent a1910c4075
commit 68f274cb90
2 changed files with 14 additions and 9 deletions

View file

@ -120,7 +120,7 @@ actor 0 0 0 jupiter
clickable no clickable no
physics off physics off
actor 0 593051 0 suit actor 0 593051 0 suitv1
relativeto jupiter relativeto jupiter
orbit 224000e3 0.66 orbit 224000e3 0.66
player yes player yes

View file

@ -37,8 +37,13 @@ pub fn asset_name_to_path(name: &str) -> &'static str {
} }
} }
pub fn skeleton_name_to_skeletondef(_name: &str) -> Option<SkeletonDef> { pub fn skeleton_name_to_skeletondef(name: &str) -> Option<SkeletonDef> {
return None; match name {
"suitv1" => Some(SkeletonDef {
base: "skeleton/suit_v1/base.glb#Scene0".to_string(),
}),
_ => None,
}
} }
pub struct SkeletonPlugin; pub struct SkeletonPlugin;
@ -49,7 +54,9 @@ impl Plugin for SkeletonPlugin {
} }
#[derive(Component)] pub struct SkeletonLimb; #[derive(Component)] pub struct SkeletonLimb;
pub struct SkeletonDef; pub struct SkeletonDef {
pub base: String,
}
//pub fn spawn( //pub fn spawn(
// name: &str, // name: &str,
@ -66,13 +73,11 @@ pub fn load(
entity_commands: &mut EntityCommands, entity_commands: &mut EntityCommands,
asset_server: &AssetServer, asset_server: &AssetServer,
) { ) {
let skeletondef = skeleton_name_to_skeletondef(name); if let Some(skel) = skeleton_name_to_skeletondef(name) {
if skeletondef.is_none() { 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)); entity_commands.insert(load_scene_by_path(asset_name_to_path(name), asset_server));
} }
else {
//entity_commands.insert();
}
} }
//pub fn load_scene( //pub fn load_scene(