From 3238863c269ff19ad098c41c10369b90ef2ce50f Mon Sep 17 00:00:00 2001 From: Joshua Barretto Date: Tue, 16 May 2023 21:10:53 +0100 Subject: [PATCH] Good bird_large mount offsets --- common/src/comp/pet.rs | 1 + common/src/states/utils.rs | 5 ++--- voxygen/anim/src/bird_large/mod.rs | 33 ++++++++++++++++++++++++------ 3 files changed, 30 insertions(+), 9 deletions(-) diff --git a/common/src/comp/pet.rs b/common/src/comp/pet.rs index 83ba6022c1..287d5e886f 100644 --- a/common/src/comp/pet.rs +++ b/common/src/comp/pet.rs @@ -64,6 +64,7 @@ pub fn is_mountable(mount: &Body, rider: Option<&Body>) -> bool { match mount { Body::Humanoid(_) => matches!(rider, Some(Body::BirdMedium(_))), Body::BipedLarge(_) => is_light_enough(rider), + Body::BirdLarge(_) => is_light_enough(rider), Body::QuadrupedMedium(body) => match body.species { quadruped_medium::Species::Alpaca | quadruped_medium::Species::Antelope diff --git a/common/src/states/utils.rs b/common/src/states/utils.rs index b9583a9519..06801809bf 100644 --- a/common/src/states/utils.rs +++ b/common/src/states/utils.rs @@ -274,9 +274,8 @@ impl Body { pub fn jump_impulse(&self) -> Option { match self { Body::Object(_) | Body::Ship(_) | Body::ItemDrop(_) => None, - Body::BipedLarge(_) | Body::Dragon(_) | Body::Golem(_) | Body::QuadrupedLow(_) => { - Some(0.4 * self.mass().0) - }, + Body::BipedLarge(_) | Body::Dragon(_) => Some(0.6 * self.mass().0), + Body::Golem(_) | Body::QuadrupedLow(_) => Some(0.4 * self.mass().0), Body::QuadrupedMedium(_) => Some(0.4 * self.mass().0), Body::Theropod(body) => match body.species { theropod::Species::Snowraptor diff --git a/voxygen/anim/src/bird_large/mod.rs b/voxygen/anim/src/bird_large/mod.rs index b0717d28a3..b958c224c5 100644 --- a/voxygen/anim/src/bird_large/mod.rs +++ b/voxygen/anim/src/bird_large/mod.rs @@ -96,16 +96,22 @@ impl Skeleton for BirdLargeSkeleton { make_bone(foot_l_mat), make_bone(foot_r_mat), ]; + + // Offset from the mounted bone's origin. + let mount_position = (neck_mat * Vec4::from_point(mount_point(&body))) + .homogenized() + .xyz(); + // NOTE: We apply the ori from base_mat externally so we don't need to worry + // about it here for now. + let mount_orientation = self.neck.orientation; + Offsets { lantern: None, viewpoint: Some((head_mat * Vec4::new(0.0, 3.0, 6.0, 1.0)).xyz()), - // TODO: see quadruped_medium for how to animate this mount_bone: Transform { - position: comp::Body::BirdLarge(body) - .mount_offset() - .into_tuple() - .into(), - ..Default::default() + position: mount_position, + orientation: mount_orientation, + scale: Vec3::one(), }, primary_trail_mat: None, secondary_trail_mat: None, @@ -307,3 +313,18 @@ impl<'a> From<&'a Body> for SkeletonAttr { } } } + +fn mount_point(body: &Body) -> Vec3 { + use comp::bird_large::Species::*; + match (body.species, body.body_type) { + (Phoenix, _) => (0.0, -2.0, 6.0), + (Cockatrice, _) => (0.0, 0.0, 6.0), + (Roc, _) => (0.0, 6.0, 3.0), + (FlameWyvern, _) => (0.0, 0.0, 2.5), + (FrostWyvern, _) => (0.0, 2.0, 3.0), + (CloudWyvern, _) => (0.0, 1.0, 3.0), + (SeaWyvern, _) => (0.0, -3.0, 4.0), + (WealdWyvern, _) => (0.0, 0.0, 5.0), + } + .into() +}