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
physics off
actor 0 593051 0 suit
actor 0 593051 0 suitv1
relativeto jupiter
orbit 224000e3 0.66
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> {
return None;
pub fn skeleton_name_to_skeletondef(name: &str) -> Option<SkeletonDef> {
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(