From 8bb0592f9cfe18c86fd7a005cc387ac6b52c51d5 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 25 Oct 2020 16:59:02 +0100 Subject: [PATCH] starting to wire in new wield setup for bipedlarge --- .../voxel/biped_large_central_manifest.ron | 30 ++--- .../voxel/weapon/hammer/2hhammer_troll.vox | Bin 3524 -> 3524 bytes voxygen/src/anim/src/biped_large/equip.rs | 74 +++++++++++ voxygen/src/anim/src/biped_large/idle.rs | 8 +- voxygen/src/anim/src/biped_large/mod.rs | 104 ++++++++++++++- voxygen/src/anim/src/biped_large/wield.rs | 118 +++++++++--------- voxygen/src/scene/figure/mod.rs | 13 +- 7 files changed, 267 insertions(+), 80 deletions(-) create mode 100644 voxygen/src/anim/src/biped_large/equip.rs diff --git a/assets/voxygen/voxel/biped_large_central_manifest.ron b/assets/voxygen/voxel/biped_large_central_manifest.ron index 34d2510180..49cdbf1642 100644 --- a/assets/voxygen/voxel/biped_large_central_manifest.ron +++ b/assets/voxygen/voxel/biped_large_central_manifest.ron @@ -25,14 +25,14 @@ central: ("armor.empty"), ), main: ( - offset: (-5.0, -5.5, -5.0), + offset: (-5.0, -5.5, -4.0), central: ("weapon.hammer.2hhammer_ogre"), ) ), (Ogre, Female): ( head: ( offset: (-9.0, -5.5, -6.0), - central: ("npc.ogre.female..head"), + central: ("npc.ogre.female.head"), ), torso_upper: ( offset: (-6.0, -5.0, -6.0), @@ -55,7 +55,7 @@ central: ("armor.empty"), ), main: ( - offset: (-2.5, -5.5, -5.0), + offset: (-2.5, -5.5, -4.0), central: ("weapon.staff.firestaff_ogre"), ) ), @@ -205,7 +205,7 @@ central: ("armor.empty"), ), main: ( - offset: (-5.0, -6.5, -4.0), + offset: (-4.0, -6.0, -4.0), central: ("weapon.hammer.2hhammer_troll"), ) ), @@ -235,7 +235,7 @@ central: ("armor.empty"), ), main: ( - offset: (-5.0, -6.5, -4.0), + offset: (-4.0, -6.0, -4.0), central: ("weapon.hammer.2hhammer_troll"), ) ), @@ -265,7 +265,7 @@ central: ("armor.empty"), ), main: ( - offset: (-5.0, -6.5, -4.0), + offset: (-1.5, -9.0, -4.0), central: ("weapon.sword.greatsword_2h_dullahan"), ) ), @@ -295,7 +295,7 @@ central: ("armor.empty"), ), main: ( - offset: (-5.0, -6.5, -4.0), + offset: (-1.5, -9.0, -4.0), central: ("weapon.sword.greatsword_2h_dullahan"), ) ), @@ -325,7 +325,7 @@ central: ("armor.empty"), ), main: ( - offset: (-1.5, -9.0, -10.0), + offset: (0.0, 0.0, 0.0), central: ("armor.empty"), ) ), @@ -355,7 +355,7 @@ central: ("armor.empty"), ), main: ( - offset: (-1.5, -9.0, -10.0), + offset: (0.0, 0.0, 0.0), central: ("armor.empty"), ) ), @@ -385,7 +385,7 @@ central: ("armor.empty"), ), main: ( - offset: (-3.5, -3.0, -5.0), + offset: (-3.0, -3.0, -4.0), central: ("weapon.staff.firestaff_saurok"), ) ), @@ -415,7 +415,7 @@ central: ("armor.empty"), ), main: ( - offset: (-3.5, -3.0, -5.0), + offset: (-3.0, -3.0, -4.0), central: ("weapon.staff.firestaff_saurok"), ) ), @@ -445,7 +445,7 @@ central: ("armor.empty"), ), main: ( - offset: (-1.5, -3.0, -5.0), + offset: (-1.5, -4.0, -4.0), central: ("weapon.sword.long_2h_saurok"), ) ), @@ -475,7 +475,7 @@ central: ("armor.empty"), ), main: ( - offset: (-1.5, -3.0, -5.0), + offset: (-1.5, -4.0, -4.0), central: ("weapon.sword.long_2h_saurok"), ) ), @@ -505,7 +505,7 @@ central: ("armor.empty"), ), main: ( - offset: (-2.5, -4.0, -7.0), + offset: (-1.5, -4.0, -16.5), central: ("weapon.bow.longbow_saurok"), ) ), @@ -535,7 +535,7 @@ central: ("armor.empty"), ), main: ( - offset: (-2.5, -4.0, -7.0), + offset: (-1.5, -4.0, -16.5), central: ("weapon.bow.longbow_saurok"), ) ), diff --git a/assets/voxygen/voxel/weapon/hammer/2hhammer_troll.vox b/assets/voxygen/voxel/weapon/hammer/2hhammer_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^Y$veB0$m!FA+#fh_K-%}67j@{MEZo0PF1~!DhF_}CJB^0C^wnds zX~R)@^7*gH#O`r<>&G|C#hqn2+G_oW|0I`eJ<`1@`#&x6%*$uw&<`%iH_!i4zWs}9 za{E(>AlJ2={vU&4nc@HQmLh^Sp*OXlU*$sTx>97BH&lC>k>;w7hr~msM cH%aFM_5OXAlxth|$;A4{rFz@h50X{?0$K`2Pyhe` diff --git a/voxygen/src/anim/src/biped_large/equip.rs b/voxygen/src/anim/src/biped_large/equip.rs new file mode 100644 index 0000000000..d5ebd762cf --- /dev/null +++ b/voxygen/src/anim/src/biped_large/equip.rs @@ -0,0 +1,74 @@ +use super::{ + super::{vek::*, Animation}, + BipedLargeSkeleton, SkeletonAttr, +}; +use common::comp::item::{Hands, ToolKind}; +use std::f32::consts::PI; + +pub struct EquipAnimation; + +impl Animation for EquipAnimation { + type Dependency = (Option, Option, f32, f64); + type Skeleton = BipedLargeSkeleton; + + #[cfg(feature = "use-dyn-lib")] + const UPDATE_FN: &'static [u8] = b"biped_large_equip\0"; + + #[cfg_attr(feature = "be-dyn-lib", export_name = "biped_large_equip")] + #[allow(clippy::approx_constant)] // TODO: Pending review in #587 + fn update_skeleton_inner( + skeleton: &Self::Skeleton, + (active_tool_kind, second_tool_kind, velocity, _global_time): Self::Dependency, + anim_time: f64, + rate: &mut f32, + _s_a: &SkeletonAttr, + ) -> Self::Skeleton { + *rate = 1.0; + let mut next = (*skeleton).clone(); + let lab = 1.0; + + let equip_slow = 1.0 + (anim_time as f32 * 12.0 + PI).cos(); + let equip_slowa = 1.0 + (anim_time as f32 * 12.0 + PI / 4.0).cos(); + next.hand_l.orientation = Quaternion::rotation_x(0.0) + * Quaternion::rotation_y(-2.3) + * Quaternion::rotation_z(-1.57); + next.hand_r.orientation = Quaternion::rotation_x(0.0) + * Quaternion::rotation_y(-2.3) + * Quaternion::rotation_z(1.57); + next.control.position = Vec3::new(equip_slowa * -1.5, 0.0, equip_slow * 1.5); + + match active_tool_kind { + Some(ToolKind::Sword(_)) => { + next.hand_l.position = Vec3::new(-8.0, -5.0, 17.0); + next.hand_r.position = Vec3::new(-6.0, -4.5, 14.0); + }, + Some(ToolKind::Axe(_)) => { + next.hand_l.position = Vec3::new(-7.0, -5.0, 17.0); + next.hand_r.position = Vec3::new(-5.0, -4.5, 14.0); + }, + Some(ToolKind::Hammer(_)) => { + next.hand_l.position = Vec3::new(-5.0, -5.0, 13.0); + next.hand_r.position = Vec3::new(-3.0, -4.5, 10.0); + }, + Some(ToolKind::Staff(_)) | Some(ToolKind::Sceptre(_)) => { + next.hand_l.position = Vec3::new(-3.0, -5.0, 8.0); + next.hand_r.position = Vec3::new(-1.75, -4.5, 5.0); + }, + Some(ToolKind::Bow(_)) => { + next.hand_l.position = Vec3::new(-3.0, -5.0, 9.0); + next.hand_r.position = Vec3::new(-1.75, -4.5, 7.0); + }, + _ => {}, + } + + next.second.scale = match ( + active_tool_kind.map(|tk| tk.hands()), + second_tool_kind.map(|tk| tk.hands()), + ) { + (Some(Hands::OneHand), Some(Hands::OneHand)) => Vec3::one(), + (_, _) => Vec3::zero(), + }; + + next + } +} diff --git a/voxygen/src/anim/src/biped_large/idle.rs b/voxygen/src/anim/src/biped_large/idle.rs index 047b898910..514044441a 100644 --- a/voxygen/src/anim/src/biped_large/idle.rs +++ b/voxygen/src/anim/src/biped_large/idle.rs @@ -63,12 +63,12 @@ impl Animation for IdleAnimation { next.head.scale = Vec3::one() * 1.02 + breathe * 0.4; next.upper_torso.position = - Vec3::new(0.0, s_a.upper_torso.0, s_a.upper_torso.1 + torso * 0.5); + Vec3::new(0.0, s_a.upper_torso.0, s_a.upper_torso.1 + torso * -0.5); next.upper_torso.orientation = Quaternion::rotation_x(-breathe); next.upper_torso.scale = Vec3::one() - breathe * 0.4; next.lower_torso.position = - Vec3::new(0.0, s_a.lower_torso.0, s_a.lower_torso.1 + torso * 0.15); + Vec3::new(0.0, s_a.lower_torso.0, s_a.lower_torso.1 + torso * 0.5); next.lower_torso.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(breathe); next.lower_torso.scale = Vec3::one() * 1.02 + breathe * 0.4; @@ -109,9 +109,9 @@ impl Animation for IdleAnimation { next.leg_r.position = Vec3::new(s_a.leg.0, s_a.leg.1, s_a.leg.2 + torso * 0.2); next.leg_r.scale = Vec3::one() * 1.02; - next.foot_l.position = Vec3::new(-s_a.foot.0, s_a.foot.1, s_a.foot.2 + torso * -0.6); + next.foot_l.position = Vec3::new(-s_a.foot.0, s_a.foot.1, s_a.foot.2); - next.foot_r.position = Vec3::new(s_a.foot.0, s_a.foot.1, s_a.foot.2 + torso * -0.6); + next.foot_r.position = Vec3::new(s_a.foot.0, s_a.foot.1, s_a.foot.2); next.torso.position = Vec3::new(0.0, 0.0, 0.0) / 8.0; next.torso.scale = Vec3::one() / 8.0; diff --git a/voxygen/src/anim/src/biped_large/mod.rs b/voxygen/src/anim/src/biped_large/mod.rs index 1562ba6876..ed0155fbb8 100644 --- a/voxygen/src/anim/src/biped_large/mod.rs +++ b/voxygen/src/anim/src/biped_large/mod.rs @@ -12,13 +12,14 @@ pub mod shoot; pub mod spin; pub mod spinmelee; pub mod wield; +pub mod equip; // Reexports pub use self::{ alpha::AlphaAnimation, beam::BeamAnimation, beta::BetaAnimation, charge::ChargeAnimation, dash::DashAnimation, idle::IdleAnimation, jump::JumpAnimation, leapmelee::LeapAnimation, run::RunAnimation, shockwave::ShockwaveAnimation, shoot::ShootAnimation, spin::SpinAnimation, - spinmelee::SpinMeleeAnimation, wield::WieldAnimation, + spinmelee::SpinMeleeAnimation, wield::WieldAnimation, equip::EquipAnimation, }; use super::{make_bone, vek::*, FigureBoneData, Skeleton}; @@ -119,6 +120,21 @@ pub struct SkeletonAttr { hand: (f32, f32, f32), leg: (f32, f32, f32), foot: (f32, f32, f32), + shl: (f32, f32, f32, f32, f32, f32), + shr: (f32, f32, f32, f32, f32, f32), + sc: (f32, f32, f32, f32, f32, f32), + hhl: (f32, f32, f32, f32, f32, f32), + hhr: (f32, f32, f32, f32, f32, f32), + hc: (f32, f32, f32, f32, f32, f32), + sthl: (f32, f32, f32, f32, f32, f32), + sthr: (f32, f32, f32, f32, f32, f32), + stc: (f32, f32, f32, f32, f32, f32), + ahl: (f32, f32, f32, f32, f32, f32), + ahr: (f32, f32, f32, f32, f32, f32), + ac: (f32, f32, f32, f32, f32, f32), + bhl: (f32, f32, f32, f32, f32, f32), + bhr: (f32, f32, f32, f32, f32, f32), + bc: (f32, f32, f32, f32, f32, f32), beast: bool, } @@ -145,6 +161,21 @@ impl Default for SkeletonAttr { hand: (0.0, 0.0, 0.0), leg: (0.0, 0.0, 0.0), foot: (0.0, 0.0, 0.0), + shl: (0.0, 0.0, 0.0, 0.0, 0.0, 0.0), + shr: (0.0, 0.0, 0.0, 0.0, 0.0, 0.0), + sc: (0.0, 0.0, 0.0, 0.0, 0.0, 0.0), + hhl: (0.0, 0.0, 10.0, 0.0, 0.0, 0.0), + hhr: (0.0, 0.0, 0.0, 0.0, 0.0, 0.0), + hc: (0.0, 0.0, 0.0, 0.0, 0.0, 0.0), + sthl: (0.0, 0.0, 10.0, 0.0, 0.0, 0.0), + sthr: (0.0, 0.0, 0.0, 0.0, 0.0, 0.0), + stc: (0.0, 0.0, 0.0, 0.0, 0.0, 0.0), + ahl: (0.0, 0.0, 10.0, 0.0, 0.0, 0.0), + ahr: (0.0, 0.0, 0.0, 0.0, 0.0, 0.0), + ac: (0.0, 0.0, 0.0, 0.0, 0.0, 0.0), + bhl: (0.0, 0.0, 10.0, 0.0, 0.0, 0.0), + bhr: (0.0, 0.0, 0.0, 0.0, 0.0, 0.0), + bc: (0.0, 0.0, 0.0, 0.0, 0.0, 0.0), beast: false, } } @@ -182,7 +213,7 @@ impl<'a> From<&'a Body> for SkeletonAttr { (Ogre, Female) => (0.0, 28.0), (Cyclops, _) => (-2.0, 27.0), (Wendigo, _) => (-1.0, 29.0), - (Troll, _) => (-1.0, 27.5), + (Troll, _) => (-1.0, 26.5), (Dullahan, _) => (0.0, 29.0), (Werewolf, _) => (3.0, 26.0), (Occultsaurok, _) => (3.0, 23.0), @@ -260,6 +291,75 @@ impl<'a> From<&'a Body> for SkeletonAttr { (Mightysaurok, _) => (3.5, 2.0, -12.0), (Slysaurok, _) => (3.5, 2.0, -12.0), }, + shl: match (body.species, body.body_type) { + (Dullahan, _) => (-4.75, -11.0, 8.5, 1.47, -0.2, 0.0), + (Mightysaurok, _) => (-4.75, -11.0, 8.5, 1.47, -0.2, 0.0), + (_, _) => (-4.75, -1.0, 2.5, 1.47, -0.2, 0.0), + }, + shr: match (body.species, body.body_type) { + (Dullahan, _) => (5.75, -11.5, 4.5, 1.47, 0.3, 0.0), + (Mightysaurok, _) => (-4.75, -11.0, 8.5, 1.47, -0.2, 0.0), + (_, _) => (3.75, -1.5, -0.5, 1.47, 0.3, 0.0), + }, + sc: match (body.species, body.body_type) { + (Dullahan, _) => (-7.0, 17.0, -16.0, -0.1, 0.0, 0.0), + (Mightysaurok, _) => (-4.75, -11.0, 8.5, 1.47, -0.2, 0.0), + (_, _) => (-7.0, 7.0, -10.0, -0.1, 0.0, 0.0), + }, + hhl: match (body.species, body.body_type) { + (Ogre, Male) => (-6.0, -10.0, 17.0, 1.57, -0.57, 0.0), + (Cyclops, _) => (-6.0, -10.0, 17.0, 1.57, -0.57, 0.0), + (Troll, _) => (-6.0, -10.0, 17.0, 1.57, -0.57, 0.0), + (_, _) => (-6.0, -10.0, 17.0, 1.57, -0.57, 0.0), + }, + hhr: match (body.species, body.body_type) { + (Ogre, Male) => (-6.0, -10.0, 0.0, 1.57, -0.57, 0.0), + (Cyclops, _) => (-6.0, -10.0, 0.0, 1.57, -0.57, 0.0), + (Troll, _) => (-6.0, -10.0, 0.0, 1.57, -0.57, 0.0), + (_, _) => (-6.0, -10.0, 0.0, 1.57, -0.57, 0.0), + }, + hc: match (body.species, body.body_type) { + (Ogre, Male) => (8.5, 6.0, -12.0, -0.57, -1.57, 1.0), + (Cyclops, _) => (8.5, 6.0, -12.0, -0.57, -1.57, 1.0), + (Troll, _) => (8.5, 6.0, -12.0, -0.57, -1.57, 1.0), + (_, _) => (8.5, 6.0, -12.0, -0.57, -1.57, 1.0), + }, + sthl: match (body.species, body.body_type) { + (Ogre, Female) => (11.0, 5.0, -4.0, 1.27, 0.0, 0.0), + (Occultsaurok, _) => (11.0, 5.0, -4.0, 1.27, 0.0, 0.0), + (_, _) => (11.0, 5.0, -4.0, 1.27, 0.0, 0.0), + }, + sthr: match (body.species, body.body_type) { + (Ogre, Female) => (17.0, 7.5, 2.0, 1.57, 0.8, 0.0), + (Occultsaurok, _) => (17.0, 7.5, 2.0, 1.57, 0.8, 0.0), + (_, _) => (17.0, 7.5, 2.0, 1.57, 0.8, 0.0), + }, + stc: match (body.species, body.body_type) { + (Ogre, Female) => (-18.0, 1.0, -2.0, -0.3, 0.15, 0.0), + (Occultsaurok, _) => (-18.0, 1.0, -2.0, -0.3, 0.15, 0.0), + (_, _) => (-18.0, 1.0, -2.0, -0.3, 0.15, 0.0), + }, + ahl: match (body.species, body.body_type) { + (_, _) => (-0.5, -1.0, 7.0, 1.87, 0.0, 0.0), + }, + ahr: match (body.species, body.body_type) { + (_, _) => (0.0, -1.0, 1.0, 4.34, 0.2, 0.0), + }, + ac: match (body.species, body.body_type) { + (_, _) => (-8.0, 11.0, 3.0, 2.0, 0.0, 3.14), + }, + bhl: match (body.species, body.body_type) { + (Slysaurok, _) => (3.0, 2.5, 0.0, 1.2, -0.6, -0.3), + (_, _) => (3.0, 2.5, 0.0, 1.2, -0.6, -0.3), + }, + bhr: match (body.species, body.body_type) { + (Slysaurok, _) => (3.0, 2.5, 0.0, 1.2, -0.6, -0.3), + (_, _) => (5.9, 5.5, -5.0, 1.2, -0.6, -0.3), + }, + bc: match (body.species, body.body_type) { + (Slysaurok, _) => (3.0, 2.5, 0.0, 1.2, -0.6, -0.3), + (_, _) => (-7.0, 3.0, -8.0, 0.0, 0.0, 0.0), + }, beast: matches!((body.species, body.body_type), (Werewolf, _)), } } diff --git a/voxygen/src/anim/src/biped_large/wield.rs b/voxygen/src/anim/src/biped_large/wield.rs index c254a7a492..7982ac041f 100644 --- a/voxygen/src/anim/src/biped_large/wield.rs +++ b/voxygen/src/anim/src/biped_large/wield.rs @@ -59,6 +59,21 @@ impl Animation for WieldAnimation { * 0.25, ); + let breathe = if s_a.beast { + // Controls for the beast breathing + let intensity = 0.04; + let lenght = 1.5; + let chop = 0.2; + let chop_freq = 60.0; + intensity * (lenght * anim_time as f32).sin() + + 0.05 + * chop + * (anim_time as f32 * chop_freq).sin() + * (anim_time as f32 * lenght).cos() + } else { + 0.0 + }; + let foothoril = (((1.0) / (0.4 + (0.6) @@ -120,9 +135,7 @@ impl Animation for WieldAnimation { * Quaternion::rotation_z(test * 0.02); next.main.position = Vec3::new(0.0, 0.0, 0.0); - next.main.orientation = Quaternion::rotation_x(0.0) - * Quaternion::rotation_y(-1.57) - * Quaternion::rotation_z(1.0); + next.main.orientation = Quaternion::rotation_y(0.0); if velocity > 0.5 { next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1) * 1.02; @@ -137,8 +150,6 @@ impl Animation for WieldAnimation { next.lower_torso.orientation = Quaternion::rotation_z(short * 0.15) * Quaternion::rotation_x(0.14); - next.jaw.orientation = Quaternion::rotation_x(slow * 0.05); - next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1); next.tail.orientation = Quaternion::rotation_z(0.0 + slow * 0.2 + tailmove.x) * Quaternion::rotation_x(0.0); @@ -169,18 +180,18 @@ impl Animation for WieldAnimation { next.head.orientation = Quaternion::rotation_z(look.x * 0.6) * Quaternion::rotation_x(look.y * 0.6); - next.upper_torso.position = Vec3::new(0.0, s_a.upper_torso.0, s_a.upper_torso.1); + next.upper_torso.position = Vec3::new(0.0, s_a.upper_torso.0, s_a.upper_torso.1 + torso * -0.5); next.upper_torso.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - next.lower_torso.position = Vec3::new(0.0, s_a.lower_torso.0, s_a.lower_torso.1); + next.lower_torso.position = Vec3::new(0.0, s_a.lower_torso.0, s_a.lower_torso.1 + torso * 0.5); next.lower_torso.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); next.lower_torso.scale = Vec3::one() * 1.02; next.jaw.position = Vec3::new(0.0, s_a.jaw.0 - slower * 0.12, s_a.jaw.1 + slow * 0.2); - next.jaw.orientation = Quaternion::rotation_x(slow * 0.05); + next.jaw.orientation = Quaternion::rotation_x(-0.1 + breathe * 2.0); next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1); next.tail.orientation = Quaternion::rotation_z(0.0 + slow * 0.2 + tailmove.x) @@ -201,32 +212,30 @@ impl Animation for WieldAnimation { } match active_tool_kind { Some(ToolKind::Sword(_)) => { - next.hand_l.position = Vec3::new(-4.75, -1.0, 2.5); + next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2); next.hand_l.orientation = - Quaternion::rotation_x(1.47) * Quaternion::rotation_y(-0.2); - next.hand_r.position = Vec3::new(3.75, -1.5, -0.5); + Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4); + next.hand_r.position = Vec3::new(s_a.shr.0, s_a.shr.1, s_a.shr.2); next.hand_r.orientation = - Quaternion::rotation_x(1.47) * Quaternion::rotation_y(0.3); - next.main.position = Vec3::new(3.0, 6.0, -5.0); - next.main.orientation = Quaternion::rotation_x(-0.1); + Quaternion::rotation_x(s_a.shr.3) * Quaternion::rotation_y(s_a.shr.4); + next.main.position = Vec3::new(0.0, 0.0, 0.0); + next.main.orientation = Quaternion::rotation_y(0.0); - next.control.position = Vec3::new(-7.0, 7.0, -10.0); + next.control.position = Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2); next.control.orientation = Quaternion::rotation_x(u_slow * 0.15) * Quaternion::rotation_z(u_slowalt * 0.08); }, Some(ToolKind::Bow(_)) => { - next.hand_l.position = Vec3::new(3.0, 2.5, 0.0); - next.hand_l.orientation = Quaternion::rotation_x(1.20) - * Quaternion::rotation_y(-0.6) - * Quaternion::rotation_z(-0.3); - next.hand_r.position = Vec3::new(5.9, 5.5, -5.0); - next.hand_r.orientation = Quaternion::rotation_x(1.20) - * Quaternion::rotation_y(-0.6) - * Quaternion::rotation_z(-0.3); - next.main.position = Vec3::new(8.0, 8.0, -13.0); - next.main.orientation = Quaternion::rotation_x(-0.3) - * Quaternion::rotation_y(0.3) - * Quaternion::rotation_z(-0.6); + next.hand_l.position = Vec3::new(s_a.bhl.0, s_a.bhl.1, s_a.bhl.2); + next.hand_l.orientation = Quaternion::rotation_x(s_a.bhl.3) + * Quaternion::rotation_y(s_a.bhl.4) + * Quaternion::rotation_z(s_a.bhl.5); + next.hand_r.position = Vec3::new(s_a.bhr.0, s_a.bhr.1, s_a.bhr.2); + next.hand_r.orientation = Quaternion::rotation_x(s_a.bhr.3) + * Quaternion::rotation_y(s_a.bhr.4) + * Quaternion::rotation_z(s_a.bhr.5); + next.main.position = Vec3::new(0.0, 0.0, 0.0); + next.main.orientation = Quaternion::rotation_y(0.0); next.hold.position = Vec3::new(1.2, -1.0, -14.2); next.hold.orientation = Quaternion::rotation_x(-1.7) @@ -234,50 +243,50 @@ impl Animation for WieldAnimation { * Quaternion::rotation_z(-0.1); next.hold.scale = Vec3::one() * 1.0; - next.control.position = Vec3::new(-7.0, 3.0, -8.0); + next.control.position = Vec3::new(s_a.bc.0, s_a.bc.1, s_a.bc.2); next.control.orientation = Quaternion::rotation_x(u_slow * 0.2) * Quaternion::rotation_z(u_slowalt * 0.1); }, Some(ToolKind::Hammer(_)) => { next.hand_l.position = - Vec3::new(-s_a.hand.0 - 7.0, s_a.hand.1 - 7.0, s_a.hand.2 + 10.0); + Vec3::new(s_a.hhl.0, s_a.hhl.1, s_a.hhl.2); next.hand_l.orientation = - Quaternion::rotation_x(0.57) * Quaternion::rotation_z(1.57); + Quaternion::rotation_x(s_a.hhl.3) + * Quaternion::rotation_y(s_a.hhl.4) + * Quaternion::rotation_z(s_a.hhl.5); next.hand_r.position = - Vec3::new(s_a.hand.0 - 7.0, s_a.hand.1 - 7.0, s_a.hand.2 + 10.0); + Vec3::new(s_a.hhr.0, s_a.hhr.1, s_a.hhr.2); next.hand_r.orientation = - Quaternion::rotation_x(0.57) * Quaternion::rotation_z(1.57); - next.hand_r.orientation = - Quaternion::rotation_x(0.57) * Quaternion::rotation_z(1.57); + Quaternion::rotation_x(s_a.hhr.3) + * Quaternion::rotation_y(s_a.hhr.4) + * Quaternion::rotation_z(s_a.hhr.5); - next.control.position = Vec3::new(7.0, 9.0, -10.0); - next.control.orientation = Quaternion::rotation_x(test * 0.02) - * Quaternion::rotation_y(test * 0.02) - * Quaternion::rotation_z(test * 0.02); + next.control.position = Vec3::new(s_a.hc.0, s_a.hc.1, s_a.hc.2); + next.control.orientation = Quaternion::rotation_x(s_a.hc.3 + test * 0.02) + * Quaternion::rotation_y(s_a.hc.4 + test * 0.02) + * Quaternion::rotation_z(s_a.hc.5 + test * 0.02); next.main.position = Vec3::new(0.0, 0.0, 0.0); - next.main.orientation = Quaternion::rotation_x(0.0) - * Quaternion::rotation_y(-1.57) - * Quaternion::rotation_z(1.0); + next.main.orientation = Quaternion::rotation_y(0.0); }, Some(ToolKind::Staff(_)) => { - next.hand_l.position = Vec3::new(11.0, 5.0, -4.0); + next.hand_l.position = Vec3::new(s_a.sthl.0, s_a.sthl.1, s_a.sthl.2); next.hand_l.orientation = - Quaternion::rotation_x(1.27) * Quaternion::rotation_y(0.0); - next.hand_r.position = Vec3::new(17.0, 7.5, 2.0); + Quaternion::rotation_x(s_a.sthl.3) * Quaternion::rotation_y(s_a.sthl.4); + next.hand_r.position = Vec3::new(s_a.sthr.0, s_a.sthr.1, s_a.sthr.2); next.hand_r.orientation = - Quaternion::rotation_x(1.57) * Quaternion::rotation_y(0.8); + Quaternion::rotation_x(s_a.sthr.3) * Quaternion::rotation_y(s_a.sthr.4); next.shoulder_r.position = Vec3::new(s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2); next.shoulder_r.orientation = Quaternion::rotation_z(0.4) * Quaternion::rotation_x(1.0); - next.main.position = Vec3::new(10.0, 12.5, 13.2); - next.main.orientation = Quaternion::rotation_y(PI); + next.main.position = Vec3::new(0.0, 0.0, 0.0); + next.main.orientation = Quaternion::rotation_y(0.0); - next.control.position = Vec3::new(-18.0, 1.0, -2.0); + next.control.position = Vec3::new(s_a.stc.0, s_a.stc.1, s_a.stc.2); next.control.orientation = Quaternion::rotation_x(-0.3 + u_slow * 0.1) * Quaternion::rotation_y(0.15) * Quaternion::rotation_z(u_slowalt * 0.08); @@ -314,10 +323,8 @@ impl Animation for WieldAnimation { next.second.orientation = Quaternion::rotation_x(PI); - next.main.position = Vec3::new(-5.0, -7.0, 7.0); - next.main.orientation = Quaternion::rotation_x(PI) - * Quaternion::rotation_y(0.6) - * Quaternion::rotation_z(1.57); + next.main.position = Vec3::new(0.0, 0.0, 0.0); + next.main.orientation = Quaternion::rotation_y(0.0); next.shoulder_l.position = Vec3::new(-s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2); @@ -369,11 +376,8 @@ impl Animation for WieldAnimation { next.control.position = Vec3::new(0.0, 0.0, 0.0); next.control.orientation = Quaternion::rotation_z(0.0); - next.main.position = Vec3::new(-5.0, -7.0, 7.0); - next.main.orientation = Quaternion::rotation_x(PI) - * Quaternion::rotation_y(0.6) - * Quaternion::rotation_z(1.57); - next.main.scale = Vec3::one() * 1.02; + next.main.position = Vec3::new(0.0, 0.0, 0.0); + next.main.orientation = Quaternion::rotation_y(0.0); next.shoulder_l.position = Vec3::new( -s_a.shoulder.0, diff --git a/voxygen/src/scene/figure/mod.rs b/voxygen/src/scene/figure/mod.rs index da88b544c9..0442225b08 100644 --- a/voxygen/src/scene/figure/mod.rs +++ b/voxygen/src/scene/figure/mod.rs @@ -2214,8 +2214,8 @@ impl FigureMgr { let target_base = match ( physics.on_ground, - vel.0.magnitude_squared() > 0.15, // Moving - physics.in_fluid.is_some(), // In water + vel.0.magnitude_squared() > MOVING_THRESHOLD_SQR, // Moving + physics.in_fluid.is_some(), // In water ) { // Standing (true, false, false) => anim::biped_large::IdleAnimation::update_skeleton( @@ -2250,6 +2250,15 @@ impl FigureMgr { ), }; let target_bones = match &character { + CharacterState::Equipping { .. } => { + anim::biped_large::EquipAnimation::update_skeleton( + &target_base, + (active_tool_kind, second_tool_kind, vel.0.magnitude(), time), + state.state_time, + &mut state_animation_rate, + skeleton_attr, + ) + }, CharacterState::Wielding { .. } => { anim::biped_large::WieldAnimation::update_skeleton( &target_base,