Merge branch 'anim3'

This commit is contained in:
yuni 2024-04-24 03:09:13 +02:00
commit 03b755b2f0
11 changed files with 40 additions and 7 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -120,7 +120,7 @@ actor 0 0 0 jupiter
clickable no clickable no
physics off physics off
actor 0 593051 0 suitv1 actor 0 593051 0 suitv2
relativeto jupiter relativeto jupiter
orbit 224000e3 0.66 orbit 224000e3 0.66
player yes player yes
@ -207,7 +207,7 @@ actor 0 0 0 moonlet
orbit 221900e3 0.66 orbit 221900e3 0.66
scale 50e3 scale 50e3
angularmomentum 0 0.025 0 angularmomentum 0 0.025 0
actor -48e3 20e3 0 suitv1 actor -48e3 20e3 0 suitv2
relativeto thebe relativeto thebe
id yuni id yuni
name "Yuni" name "Yuni"
@ -362,7 +362,7 @@ actor -3300 10 0 pizzeria
chatid SubduedClippy chatid SubduedClippy
pronoun it pronoun it
actor -45 -4 -4 suitv1 actor -45 -4 -4 suitv2
relativeto pizzeria relativeto pizzeria
name "Nox" name "Nox"
chatid PizzaChef chatid PizzaChef
@ -377,7 +377,7 @@ actor -3300 10 0 pizzeria
angularmomentum 0 0 0 angularmomentum 0 0 0
pronoun he pronoun he
actor 60 -15 -40 suitv1 actor 60 -15 -40 suitv2
relativeto player relativeto player
name Icarus name Icarus
id Icarus id Icarus
@ -394,7 +394,7 @@ actor 60 -15 -40 suitv1
wants maxvelocity 0 wants maxvelocity 0
pronoun it pronoun it
actor -300 0 40 suitv1 actor -300 0 40 suitv2
relativeto player relativeto player
id Drifter id Drifter
name "梓涵" name "梓涵"
@ -442,7 +442,7 @@ actor 100 -18000 2000 "orb_busstop"
name "Light Orb" name "Light Orb"
relativeto busstopclippy relativeto busstopclippy
light "47FF00" 1000000 light "47FF00" 1000000
actor 8 2 0 suitv1 actor 8 2 0 suitv2
relativeto "busstopclippy" relativeto "busstopclippy"
name "Rudy" name "Rudy"
wants maxrotation 0.2 wants maxrotation 0.2

View file

@ -18,12 +18,14 @@ pub struct SkeletonPlugin;
impl Plugin for SkeletonPlugin { impl Plugin for SkeletonPlugin {
fn build(&self, app: &mut App) { fn build(&self, app: &mut App) {
app.add_systems(Update, animate_skeleton_parts); app.add_systems(Update, animate_skeleton_parts);
app.add_systems(Update, play_animations);
} }
} }
pub fn asset_name_to_path(name: &str) -> &'static str { pub fn asset_name_to_path(name: &str) -> &'static str {
match name { match name {
"suit_ar_chefhat" => "models/suit_v1/ar_chefhat.glb#Scene0", "suitv2" => "models/suit_v2/suit_v2.glb#Scene0",
"suit_ar_chefhat" => "models/suit_v2/ar_chefhat.glb#Scene0",
"asteroid1" => "models/asteroid.glb#Scene0", "asteroid1" => "models/asteroid.glb#Scene0",
"asteroid2" => "models/asteroid2.glb#Scene0", "asteroid2" => "models/asteroid2.glb#Scene0",
"asteroid_lum" => "models/asteroid_lum.glb#Scene0", "asteroid_lum" => "models/asteroid_lum.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<AnimationPlayer>>,
asset_server: Res<AssetServer>,
) {
for mut player in &mut players {
let animation = asset_server.load("models/suit_v2/suit_v2.glb#Animation0");
player.play(animation.clone()).repeat();
}
}
//fn play_animations(
// players: Query<(Entity, &Parent, &AnimationPlayer), Added<AnimationPlayer>>,
// 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();
// }
//}