diff --git a/src/data/defs.txt b/src/data/defs.txt index 9969574..54aca91 100644 --- a/src/data/defs.txt +++ b/src/data/defs.txt @@ -120,7 +120,7 @@ actor 0 0 0 jupiter clickable no physics off -actor 0 593051 0 suitv1 +actor 0 593051 0 suitv2 relativeto jupiter orbit 224000e3 0.66 player yes @@ -207,7 +207,7 @@ actor 0 0 0 moonlet orbit 221900e3 0.66 scale 50e3 angularmomentum 0 0.025 0 - actor -48e3 20e3 0 suitv1 + actor -48e3 20e3 0 suitv2 relativeto thebe id yuni name "Yuni" @@ -362,7 +362,7 @@ actor -3300 10 0 pizzeria chatid SubduedClippy pronoun it - actor -45 -4 -4 suitv1 + actor -45 -4 -4 suitv2 relativeto pizzeria name "Nox" chatid PizzaChef @@ -377,7 +377,7 @@ actor -3300 10 0 pizzeria angularmomentum 0 0 0 pronoun he -actor 60 -15 -40 suitv1 +actor 60 -15 -40 suitv2 relativeto player name Icarus id Icarus @@ -394,7 +394,7 @@ actor 60 -15 -40 suitv1 wants maxvelocity 0 pronoun it -actor -300 0 40 suitv1 +actor -300 0 40 suitv2 relativeto player id Drifter name "梓涵" @@ -442,7 +442,7 @@ actor 100 -18000 2000 "orb_busstop" name "Light Orb" relativeto busstopclippy light "47FF00" 1000000 - actor 8 2 0 suitv1 + actor 8 2 0 suitv2 relativeto "busstopclippy" name "Rudy" wants maxrotation 0.2 diff --git a/src/skeleton.rs b/src/skeleton.rs index 3ffb755..2cd259b 100644 --- a/src/skeleton.rs +++ b/src/skeleton.rs @@ -18,11 +18,13 @@ pub struct SkeletonPlugin; impl Plugin for SkeletonPlugin { fn build(&self, app: &mut App) { app.add_systems(Update, animate_skeleton_parts); + app.add_systems(Update, play_animations); } } pub fn asset_name_to_path(name: &str) -> &'static str { match name { + "suitv2" => "models/animtest.glb#Scene0", "suit_ar_chefhat" => "models/suit_v1/ar_chefhat.glb#Scene0", "asteroid1" => "models/asteroid.glb#Scene0", "asteroid2" => "models/asteroid2.glb#Scene0", @@ -327,3 +329,34 @@ pub fn animate_human_float(mut trans: &mut Transform, limb: &Limb, mirror: bool, _ => {}, } } + +fn play_animations( + mut players: Query<&mut AnimationPlayer, Added>, + asset_server: Res, +) { + for mut player in &mut players { + let animation = asset_server.load("models/animtest.glb#Animation0"); + player.play(animation.clone()).repeat(); + } +} + +//fn play_animations( +// players: Query<(Entity, &Parent, &AnimationPlayer), Added>, +// q_parents: Query<(Entity, &Parent)>, +// world: &World, +//) { +// for (entity, parent, player) in &players { +// info!("Got player!"); +//// dbg!(world.inspect_entity(entity)); +//// let parent_entity = q_parents.get(parent.get()); +//// if let Ok((parent_entity, parent_parents)) = parent_entity { +//// //dbg!(world.inspect_entity(parent_entity)); +//// let parent_entity = q_parents.get(parent_parents.get()); +//// if let Ok((parent_entity, parent_parents)) = parent_entity { +//// dbg!(world.inspect_entity(parent_entity)); +//// } +//// } +// //dbg!(player); +// //player.play(animations.0[0].clone_weak()).repeat(); +// } +//}