From b4af588a00d366dfebaa82a2b64efdc1e58ab633 Mon Sep 17 00:00:00 2001 From: Justin Shipsey Date: Mon, 27 Apr 2020 05:11:34 +0000 Subject: [PATCH] skel attribute transfer --- voxygen/src/anim/character/alpha.rs | 216 ++++-------------------- voxygen/src/anim/character/beta.rs | 45 +++-- voxygen/src/anim/character/block.rs | 124 +++----------- voxygen/src/anim/character/blockidle.rs | 124 +++----------- voxygen/src/anim/character/charge.rs | 46 ++--- voxygen/src/anim/character/climb.rs | 79 +++++---- voxygen/src/anim/character/dash.rs | 49 ++---- voxygen/src/anim/character/equip.rs | 83 +++------ voxygen/src/anim/character/gliding.rs | 68 ++++---- voxygen/src/anim/character/idle.rs | 84 +++++---- voxygen/src/anim/character/jump.rs | 69 ++++---- voxygen/src/anim/character/mod.rs | 163 ++++++++---------- voxygen/src/anim/character/roll.rs | 86 ++++++---- voxygen/src/anim/character/run.rs | 83 +++++---- voxygen/src/anim/character/shoot.rs | 26 ++- voxygen/src/anim/character/sit.rs | 95 ++++++----- voxygen/src/anim/character/spin.rs | 15 +- voxygen/src/anim/character/stand.rs | 89 +++++----- voxygen/src/anim/character/swim.rs | 79 +++++---- voxygen/src/anim/character/wield.rs | 55 ++---- voxygen/src/anim/mod.rs | 134 --------------- voxygen/src/scene/figure/load.rs | 5 +- 22 files changed, 706 insertions(+), 1111 deletions(-) diff --git a/voxygen/src/anim/character/alpha.rs b/voxygen/src/anim/character/alpha.rs index fc09deca0c..42adecb5e5 100644 --- a/voxygen/src/anim/character/alpha.rs +++ b/voxygen/src/anim/character/alpha.rs @@ -53,27 +53,24 @@ impl Animation for AlphaAnimation { match active_tool_kind { //TODO: Inventory Some(ToolKind::Sword(_)) => { - next.head.offset = Vec3::new( - 0.0 + skeleton_attr.neck_right, - -2.0 + skeleton_attr.neck_forward, - skeleton_attr.neck_height + 14.0, - ); + next.head.offset = + Vec3::new(0.0, -2.0 + skeleton_attr.head.0, skeleton_attr.head.1); next.head.ori = Quaternion::rotation_z(slow * -0.25) * Quaternion::rotation_x(0.0 + slow * 0.15) * Quaternion::rotation_y(slow * -0.15); next.head.scale = Vec3::one() * skeleton_attr.head_scale; - next.chest.offset = Vec3::new(0.0, 0.0, 7.0); + next.chest.offset = Vec3::new(0.0, skeleton_attr.chest.0, skeleton_attr.chest.1); next.chest.ori = Quaternion::rotation_z(slow * 0.4) * Quaternion::rotation_x(0.0 + slow * -0.2) * Quaternion::rotation_y(slow * 0.2); next.chest.scale = Vec3::one(); - next.belt.offset = Vec3::new(0.0, 0.0, -2.0); + next.belt.offset = Vec3::new(0.0, skeleton_attr.belt.0, skeleton_attr.belt.1); next.belt.ori = next.chest.ori * -0.3; next.belt.scale = Vec3::one(); - next.shorts.offset = Vec3::new(0.0, 0.0, -5.0); + next.shorts.offset = Vec3::new(0.0, skeleton_attr.shorts.0, skeleton_attr.shorts.1); next.shorts.ori = next.chest.ori * -0.45; next.shorts.scale = Vec3::one(); @@ -116,9 +113,9 @@ impl Animation for AlphaAnimation { }, Some(ToolKind::Axe(_)) => { next.head.offset = Vec3::new( - 0.0 + skeleton_attr.neck_right + slowax * 2.0, - 0.0 + skeleton_attr.neck_forward + slowax * -2.0, - skeleton_attr.neck_height + 13.0, + 0.0 + slowax * 2.0, + 0.0 + skeleton_attr.head.0 + slowax * -2.0, + skeleton_attr.head.1, ); next.head.ori = Quaternion::rotation_z(slowax * 0.25) * Quaternion::rotation_x(0.0 + slowax * 0.2) @@ -181,11 +178,8 @@ impl Animation for AlphaAnimation { * Quaternion::rotation_y(0.0) * Quaternion::rotation_z(0.0); next.main.scale = Vec3::one(); - next.head.offset = Vec3::new( - 0.0 + skeleton_attr.neck_right, - -2.0 + skeleton_attr.neck_forward, - skeleton_attr.neck_height + 12.0, - ); + next.head.offset = + Vec3::new(0.0, -2.0 + skeleton_attr.head.0, skeleton_attr.head.1); next.head.ori = Quaternion::rotation_z(slower * 0.05) * Quaternion::rotation_x(0.0 + slower * 0.05) * Quaternion::rotation_y(slower * 0.05); @@ -258,29 +252,24 @@ impl Animation for AlphaAnimation { }, Some(ToolKind::Staff(_)) => { next.head.offset = Vec3::new( - 0.0 + skeleton_attr.neck_right, - 0.0 + skeleton_attr.neck_forward + decel * 0.8, - skeleton_attr.neck_height + 14.0, + 0.0, + 0.0 + skeleton_attr.head.0 + decel * 0.8, + skeleton_attr.head.1, ); next.head.ori = Quaternion::rotation_z(decel * 0.25) * Quaternion::rotation_x(0.0 + decel * 0.1) * Quaternion::rotation_y(decel * -0.1); - next.head.scale = Vec3::one() * skeleton_attr.head_scale; - next.chest.offset = Vec3::new(0.0, 0.0, 7.0); next.chest.ori = Quaternion::rotation_z(decel * -0.2) * Quaternion::rotation_x(0.0 + decel * -0.2) * Quaternion::rotation_y(decel * 0.2); - next.chest.scale = Vec3::one(); - next.belt.offset = Vec3::new(0.0, 0.0, -2.0); next.belt.ori = Quaternion::rotation_z(decel * -0.1) * Quaternion::rotation_x(0.0 + decel * -0.1) * Quaternion::rotation_y(decel * 0.1); - next.belt.scale = Vec3::one(); next.shorts.offset = Vec3::new(0.0, 0.0, -5.0); - next.belt.ori = Quaternion::rotation_z(decel * -0.08) + next.shorts.ori = Quaternion::rotation_z(decel * -0.08) * Quaternion::rotation_x(0.0 + decel * -0.08) * Quaternion::rotation_y(decel * 0.08); next.shorts.scale = Vec3::one(); @@ -291,9 +280,7 @@ impl Animation for AlphaAnimation { next.r_hand.ori = Quaternion::rotation_x(1.27); next.r_hand.scale = Vec3::one() * 1.05; next.main.offset = Vec3::new(0.0, 6.0, -4.0); - next.main.ori = Quaternion::rotation_x(-0.3) - * Quaternion::rotation_y(0.0) - * Quaternion::rotation_z(0.0); + next.main.ori = Quaternion::rotation_x(-0.3); next.main.scale = Vec3::one(); next.control.offset = Vec3::new(-8.0 - slow * 1.0, 3.0 - slow * 5.0, 0.0); @@ -302,16 +289,13 @@ impl Animation for AlphaAnimation { * Quaternion::rotation_z(1.4 + slow * 0.5); next.control.scale = Vec3::one(); next.torso.offset = Vec3::new(0.0, 0.0, 0.1) * skeleton_attr.scaler; - next.torso.ori = Quaternion::rotation_z(0.0) - * Quaternion::rotation_x(0.0) - * Quaternion::rotation_y(0.0); next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler; }, Some(ToolKind::Shield(_)) => { next.head.offset = Vec3::new( - 0.0 + skeleton_attr.neck_right, - 0.0 + skeleton_attr.neck_forward + decel * 0.8, - skeleton_attr.neck_height + 21.0, + 0.0, + 0.0 + skeleton_attr.head.0 + decel * 0.8, + skeleton_attr.head.1, ); next.head.ori = Quaternion::rotation_z(decel * 0.25) * Quaternion::rotation_x(0.0 + decel * 0.1) @@ -349,138 +333,19 @@ impl Animation for AlphaAnimation { * Quaternion::rotation_y(0.0 + accel_med * -0.4); next.r_hand.scale = Vec3::one() * 1.01; - next.main.offset = Vec3::new( - -8.0 + accel_slow * 10.0 + skeleton_attr.weapon_x, - 8.0 + accel_fast * 3.0, - 0.0, - ); + next.main.offset = Vec3::new(-8.0 + accel_slow * 10.0, 8.0 + accel_fast * 3.0, 0.0); next.main.ori = Quaternion::rotation_z(-0.8) * Quaternion::rotation_x(0.0 + accel_med * -0.8) * Quaternion::rotation_y(0.0 + accel_med * -0.4); next.main.scale = Vec3::one(); next.torso.offset = Vec3::new(0.0, 0.0, 0.1) * skeleton_attr.scaler; - next.torso.ori = Quaternion::rotation_z(0.0) - * Quaternion::rotation_x(0.0) - * Quaternion::rotation_y(0.0); - next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler; - }, - Some(ToolKind::Bow(_)) => { - next.head.offset = Vec3::new( - 0.0 + skeleton_attr.neck_right, - 0.0 + skeleton_attr.neck_forward + decel * 0.8, - skeleton_attr.neck_height + 21.0, - ); - next.head.ori = Quaternion::rotation_z(decel * -0.25) - * Quaternion::rotation_x(0.0 + decel * -0.1) - * Quaternion::rotation_y(decel * -0.1); - next.head.scale = Vec3::one() * skeleton_attr.head_scale; - - next.chest.offset = Vec3::new(0.0, 0.0, 7.0); - next.chest.ori = Quaternion::rotation_z(decel * -0.2) - * Quaternion::rotation_x(0.0 + decel * -0.2) - * Quaternion::rotation_y(decel * 0.2); - next.chest.scale = Vec3::one(); - - next.belt.offset = Vec3::new(0.0, 0.0, 5.0); - next.belt.ori = Quaternion::rotation_z(decel * -0.1) - * Quaternion::rotation_x(0.0 + decel * -0.1) - * Quaternion::rotation_y(decel * 0.1); - next.belt.scale = Vec3::one(); - - next.shorts.offset = Vec3::new(0.0, 0.0, 2.0); - next.belt.ori = Quaternion::rotation_z(decel * -0.08) - * Quaternion::rotation_x(0.0 + decel * -0.08) - * Quaternion::rotation_y(decel * 0.08); - next.shorts.scale = Vec3::one(); - next.l_hand.offset = Vec3::new(1.0, -4.0, -1.0); - next.l_hand.ori = Quaternion::rotation_x(1.27) - * Quaternion::rotation_y(-0.6) - * Quaternion::rotation_z(-0.3); - next.l_hand.scale = Vec3::one() * 1.05; - next.r_hand.offset = Vec3::new(3.0, -1.0, -6.0); - next.r_hand.ori = Quaternion::rotation_x(1.27) - * Quaternion::rotation_y(-0.6) - * Quaternion::rotation_z(-0.3); - next.r_hand.scale = Vec3::one() * 1.05; - next.main.offset = Vec3::new(3.0, 2.0, -13.0); - next.main.ori = Quaternion::rotation_x(-0.3) - * Quaternion::rotation_y(0.3) - * Quaternion::rotation_z(-0.6); - next.main.scale = Vec3::one(); - - next.control.offset = Vec3::new(-7.0, 6.0, 6.0); - next.control.ori = Quaternion::rotation_x(0.0) - * Quaternion::rotation_y(0.0) - * Quaternion::rotation_z(0.0); - next.control.scale = Vec3::one(); - next.torso.offset = Vec3::new(0.0, 0.0, 0.1) * skeleton_attr.scaler; - next.torso.ori = Quaternion::rotation_z(0.0) - * Quaternion::rotation_x(0.0) - * Quaternion::rotation_y(0.0); - next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler; - }, - Some(ToolKind::Dagger(_)) => { - next.head.offset = Vec3::new( - 0.0 + skeleton_attr.neck_right, - -2.0 + skeleton_attr.neck_forward + decel * 0.8, - skeleton_attr.neck_height + 21.0, - ); - next.head.ori = Quaternion::rotation_z(decel * 0.25) - * Quaternion::rotation_x(0.0 + decel * 0.1) - * Quaternion::rotation_y(decel * -0.1); - next.head.scale = Vec3::one() * skeleton_attr.head_scale; - - next.chest.offset = Vec3::new(0.0, 0.0, 7.0); - next.chest.ori = Quaternion::rotation_z(decel * -0.2) - * Quaternion::rotation_x(0.0 + decel * -0.2) - * Quaternion::rotation_y(decel * 0.2); - next.chest.scale = Vec3::one(); - - next.belt.offset = Vec3::new(0.0, 0.0, 5.0); - next.belt.ori = Quaternion::rotation_z(decel * -0.1) - * Quaternion::rotation_x(0.0 + decel * -0.1) - * Quaternion::rotation_y(decel * 0.1); - next.belt.scale = Vec3::one(); - - next.shorts.offset = Vec3::new(0.0, 0.0, 2.0); - next.belt.ori = Quaternion::rotation_z(decel * -0.08) - * Quaternion::rotation_x(0.0 + decel * -0.08) - * Quaternion::rotation_y(decel * 0.08); - next.shorts.scale = Vec3::one(); - next.l_hand.offset = - Vec3::new(-8.0 + accel_slow * 10.0, 8.0 + accel_fast * 3.0, 0.0); - next.l_hand.ori = Quaternion::rotation_z(-0.8) - * Quaternion::rotation_x(0.0 + accel_med * -0.8) - * Quaternion::rotation_y(0.0 + accel_med * -0.4); - next.l_hand.scale = Vec3::one() * 1.01; - - next.r_hand.offset = - Vec3::new(-8.0 + accel_slow * 10.0, 8.0 + accel_fast * 3.0, -2.0); - next.r_hand.ori = Quaternion::rotation_z(-0.8) - * Quaternion::rotation_x(0.0 + accel_med * -0.8) - * Quaternion::rotation_y(0.0 + accel_med * -0.4); - next.r_hand.scale = Vec3::one() * 1.01; - - next.main.offset = Vec3::new( - -8.0 + accel_slow * 10.0 + skeleton_attr.weapon_x, - 8.0 + accel_fast * 3.0, - 0.0, - ); - next.main.ori = Quaternion::rotation_z(-0.8) - * Quaternion::rotation_x(0.0 + accel_med * -0.8) - * Quaternion::rotation_y(0.0 + accel_med * -0.4); - next.main.scale = Vec3::one(); - next.torso.offset = Vec3::new(0.0, 0.0, 0.1) * skeleton_attr.scaler; - next.torso.ori = Quaternion::rotation_z(0.0) - * Quaternion::rotation_x(0.0) - * Quaternion::rotation_y(0.0); next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler; }, Some(ToolKind::Debug(_)) => { next.head.offset = Vec3::new( - 0.0 + skeleton_attr.neck_right, - -2.0 + skeleton_attr.neck_forward + decel * 0.8, - skeleton_attr.neck_height + 14.0, + 0.0, + -2.0 + skeleton_attr.head.0 + decel * 0.8, + skeleton_attr.head.1, ); next.head.ori = Quaternion::rotation_x(0.0); next.head.scale = Vec3::one() * skeleton_attr.head_scale; @@ -489,15 +354,6 @@ impl Animation for AlphaAnimation { next.chest.ori = Quaternion::rotation_z(decel * -0.2) * Quaternion::rotation_x(0.0 + decel * -0.2) * Quaternion::rotation_y(decel * 0.2); - next.chest.scale = Vec3::one(); - - next.belt.offset = Vec3::new(0.0, 0.0, -2.0); - next.belt.ori = Quaternion::rotation_x(0.0); - next.belt.scale = Vec3::one(); - - next.shorts.offset = Vec3::new(0.0, 0.0, -5.0); - next.belt.ori = Quaternion::rotation_x(0.0); - next.shorts.scale = Vec3::one(); next.l_hand.offset = Vec3::new(-8.0 + accel_slow * 10.0, 8.0 + accel_fast * 3.0, 0.0); @@ -513,44 +369,34 @@ impl Animation for AlphaAnimation { * Quaternion::rotation_y(0.0 + accel_med * -0.4); next.r_hand.scale = Vec3::one() * 1.01; - next.main.offset = Vec3::new( - -8.0 + accel_slow * 10.0 + skeleton_attr.weapon_x, - 8.0 + accel_fast * 3.0, - 0.0, - ); + next.main.offset = Vec3::new(-8.0 + accel_slow * 10.0, 8.0 + accel_fast * 3.0, 0.0); next.main.ori = Quaternion::rotation_z(-0.8) * Quaternion::rotation_x(0.0 + accel_med * -0.8) * Quaternion::rotation_y(0.0 + accel_med * -0.4); next.main.scale = Vec3::one(); next.torso.offset = Vec3::new(0.0, 0.0, 0.1) * skeleton_attr.scaler; - next.torso.ori = Quaternion::rotation_z(0.0) - * Quaternion::rotation_x(0.0) - * Quaternion::rotation_y(0.0); + next.torso.ori = Quaternion::rotation_x(0.0); next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler; }, _ => {}, } - next.lantern.offset = Vec3::new(-5.0, 2.5, 5.5); + next.lantern.offset = Vec3::new( + skeleton_attr.lantern.0, + skeleton_attr.lantern.1, + skeleton_attr.lantern.2, + ); next.lantern.scale = Vec3::one() * 0.65; - next.l_shoulder.offset = Vec3::new(-5.0, 0.0, 4.7); - next.l_shoulder.ori = Quaternion::rotation_x(0.0); next.l_shoulder.scale = Vec3::one() * 1.1; - next.r_shoulder.offset = Vec3::new(5.0, 0.0, 4.7); - next.r_shoulder.ori = Quaternion::rotation_x(0.0); next.r_shoulder.scale = Vec3::one() * 1.1; - next.glider.offset = Vec3::new(0.0, 5.0, 0.0); - next.glider.ori = Quaternion::rotation_y(0.0); + next.glider.offset = Vec3::new(0.0, 0.0, 10.0); + next.glider.scale = Vec3::one() * 0.0; - next.l_control.offset = Vec3::new(0.0, 0.0, 0.0); - next.l_control.ori = Quaternion::rotation_x(0.0); next.l_control.scale = Vec3::one(); - next.r_control.offset = Vec3::new(0.0, 0.0, 0.0); - next.r_control.ori = Quaternion::rotation_x(0.0); next.r_control.scale = Vec3::one(); next } diff --git a/voxygen/src/anim/character/beta.rs b/voxygen/src/anim/character/beta.rs index 5b0b87e28b..687424a68f 100644 --- a/voxygen/src/anim/character/beta.rs +++ b/voxygen/src/anim/character/beta.rs @@ -41,11 +41,8 @@ impl Animation for BetaAnimation { //TODO: Inventory Some(ToolKind::Axe(_)) | Some(ToolKind::Hammer(_)) | Some(ToolKind::Sword(_)) => { //INTENTION: SWORD - next.head.offset = Vec3::new( - 0.0 + skeleton_attr.neck_right, - -2.0 + skeleton_attr.neck_forward, - skeleton_attr.neck_height + 14.0, - ); + next.head.offset = + Vec3::new(0.0, -2.0 + skeleton_attr.head.0, skeleton_attr.head.1); next.head.ori = Quaternion::rotation_z(slow * -0.18) * Quaternion::rotation_x(-0.1 + slow * -0.28) * Quaternion::rotation_y(0.2 + slow * 0.18); @@ -53,19 +50,19 @@ impl Animation for BetaAnimation { next.chest.offset = Vec3::new(0.0 + foot * 2.0, 0.0, 7.0); next.chest.ori = Quaternion::rotation_z(slow * 0.2) - * Quaternion::rotation_x(0.0 + slow * 0.2) + * Quaternion::rotation_x(slow * 0.2) * Quaternion::rotation_y(slow * -0.1); next.chest.scale = Vec3::one(); next.belt.offset = Vec3::new(0.0, 0.0, -2.0); next.belt.ori = Quaternion::rotation_z(slow * 0.1) - * Quaternion::rotation_x(0.0 + slow * 0.1) + * Quaternion::rotation_x(slow * 0.1) * Quaternion::rotation_y(slow * -0.04); next.belt.scale = Vec3::one(); next.shorts.offset = Vec3::new(0.0, 0.0, -5.0); next.shorts.ori = Quaternion::rotation_z(slow * 0.1) - * Quaternion::rotation_x(0.0 + slow * 0.1) + * Quaternion::rotation_x(slow * 0.1) * Quaternion::rotation_y(slow * -0.05); next.shorts.scale = Vec3::one(); @@ -76,9 +73,7 @@ impl Animation for BetaAnimation { next.r_hand.ori = Quaternion::rotation_x(1.27); next.r_hand.scale = Vec3::one() * 1.05; next.main.offset = Vec3::new(0.0, 6.0, -1.0); - next.main.ori = Quaternion::rotation_x(-0.3) - * Quaternion::rotation_y(0.0) - * Quaternion::rotation_z(0.0); + next.main.ori = Quaternion::rotation_x(-0.3); next.main.scale = Vec3::one(); next.control.offset = Vec3::new(-8.0 + slow * 1.5, 1.5 + slow * 1.0, 0.0); @@ -96,37 +91,41 @@ impl Animation for BetaAnimation { * Quaternion::rotation_y(footquick * 0.2); next.r_foot.scale = Vec3::one(); next.torso.offset = Vec3::new(0.0, 0.0, 0.1) * skeleton_attr.scaler; - next.torso.ori = Quaternion::rotation_z(0.0) - * Quaternion::rotation_x(0.0) - * Quaternion::rotation_y(0.0); next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler; }, _ => {}, } - next.l_shoulder.offset = Vec3::new(-5.0, 0.0, 4.7); + next.l_shoulder.offset = Vec3::new( + skeleton_attr.shoulder.0, + skeleton_attr.shoulder.1, + skeleton_attr.shoulder.2, + ); next.l_shoulder.ori = Quaternion::rotation_x(0.0); next.l_shoulder.scale = Vec3::one() * 1.1; - next.r_shoulder.offset = Vec3::new(5.0, 0.0, 4.7); + next.r_shoulder.offset = Vec3::new( + skeleton_attr.shoulder.0, + skeleton_attr.shoulder.1, + skeleton_attr.shoulder.2, + ); next.r_shoulder.ori = Quaternion::rotation_x(0.0); next.r_shoulder.scale = Vec3::one() * 1.1; - next.glider.offset = Vec3::new(0.0, 5.0, 0.0); - next.glider.ori = Quaternion::rotation_y(0.0); + next.glider.offset = Vec3::new(0.0, 0.0, 10.0); next.glider.scale = Vec3::one() * 0.0; - next.lantern.offset = Vec3::new(-5.0, 2.5, 5.5); + next.lantern.offset = Vec3::new( + skeleton_attr.lantern.0, + skeleton_attr.lantern.1, + skeleton_attr.lantern.2, + ); next.lantern.ori = Quaternion::rotation_x(slow * -0.7 + 0.4) * Quaternion::rotation_y(slow * 0.4); next.lantern.scale = Vec3::one() * 0.65; - next.l_control.offset = Vec3::new(0.0, 0.0, 0.0); - next.l_control.ori = Quaternion::rotation_x(0.0); next.l_control.scale = Vec3::one(); - next.r_control.offset = Vec3::new(0.0, 0.0, 0.0); - next.r_control.ori = Quaternion::rotation_x(0.0); next.r_control.scale = Vec3::one(); next } diff --git a/voxygen/src/anim/character/block.rs b/voxygen/src/anim/character/block.rs index a9e58b8756..54b5b57c12 100644 --- a/voxygen/src/anim/character/block.rs +++ b/voxygen/src/anim/character/block.rs @@ -39,9 +39,9 @@ impl Animation for BlockAnimation { * 0.15, ); next.head.offset = Vec3::new( - 0.0 + skeleton_attr.neck_right + wave_slow_cos * 0.2, - -1.0 + skeleton_attr.neck_forward, - skeleton_attr.neck_height + 19.5 + wave_ultra_slow * 0.2, + 0.0 + wave_slow_cos * 0.2, + -1.0 + skeleton_attr.head.0, + skeleton_attr.head.1 + 19.5 + wave_ultra_slow * 0.2, ); next.head.ori = Quaternion::rotation_x(-0.25); next.head.scale = Vec3::one() * 1.01 * skeleton_attr.head_scale; @@ -96,11 +96,7 @@ impl Animation for BlockAnimation { ); next.r_hand.ori = Quaternion::rotation_x(-0.3); next.r_hand.scale = Vec3::one() * 1.01; - next.main.offset = Vec3::new( - -6.0 + skeleton_attr.weapon_x, - 4.5 + skeleton_attr.weapon_y, - 0.0 + wave_ultra_slow * 1.0, - ); + next.main.offset = Vec3::new(-6.0, 4.5, 0.0 + wave_ultra_slow * 1.0); next.main.ori = Quaternion::rotation_x(-0.3) * Quaternion::rotation_y(0.0) * Quaternion::rotation_z(0.0); @@ -117,11 +113,7 @@ impl Animation for BlockAnimation { * Quaternion::rotation_y(0.0) * Quaternion::rotation_z(-0.2); next.r_hand.scale = Vec3::one() * 1.01; - next.main.offset = Vec3::new( - 5.0 + skeleton_attr.weapon_x, - 8.75 + skeleton_attr.weapon_y, - 5.5, - ); + next.main.offset = Vec3::new(5.0, 8.75, 5.5); next.main.ori = Quaternion::rotation_x(-0.3) * Quaternion::rotation_y(-1.35) * Quaternion::rotation_z(-0.85); @@ -143,8 +135,8 @@ impl Animation for BlockAnimation { next.r_hand.ori = Quaternion::rotation_x(-0.3); next.r_hand.scale = Vec3::one() * 1.01; next.main.offset = Vec3::new( - -6.0 + skeleton_attr.weapon_x + wave_ultra_slow_cos * 1.0, - 4.5 + skeleton_attr.weapon_y + wave_ultra_slow_cos * 0.5, + -6.0 + wave_ultra_slow_cos * 1.0, + 4.5 + wave_ultra_slow_cos * 0.5, 0.0 + wave_ultra_slow * 1.0, ); next.main.ori = Quaternion::rotation_x(-0.3) @@ -168,8 +160,8 @@ impl Animation for BlockAnimation { next.r_hand.ori = Quaternion::rotation_x(-0.3); next.r_hand.scale = Vec3::one() * 1.01; next.main.offset = Vec3::new( - -6.0 + skeleton_attr.weapon_x + wave_ultra_slow_cos * 1.0, - 4.5 + skeleton_attr.weapon_y + wave_ultra_slow_cos * 0.5, + -6.0 + wave_ultra_slow_cos * 1.0, + 4.5 + wave_ultra_slow_cos * 0.5, 0.0 + wave_ultra_slow * 1.0, ); next.main.ori = Quaternion::rotation_x(-0.3) @@ -177,96 +169,32 @@ impl Animation for BlockAnimation { * Quaternion::rotation_z(0.0); next.main.scale = Vec3::one(); }, - Some(ToolKind::Bow(_)) => { - next.l_hand.offset = Vec3::new( - -6.0 + wave_ultra_slow_cos * 1.0, - 3.5 + wave_ultra_slow_cos * 0.5, - 0.0 + wave_ultra_slow * 1.0, - ); - next.l_hand.ori = Quaternion::rotation_x(-0.3); - next.l_hand.scale = Vec3::one() * 1.01; - next.r_hand.offset = Vec3::new( - -6.0 + wave_ultra_slow_cos * 1.0, - 3.0 + wave_ultra_slow_cos * 0.5, - -2.0 + wave_ultra_slow * 1.0, - ); - next.r_hand.ori = Quaternion::rotation_x(-0.3); - next.r_hand.scale = Vec3::one() * 1.01; - next.main.offset = Vec3::new( - -6.0 + skeleton_attr.weapon_x + wave_ultra_slow_cos * 1.0, - 4.5 + skeleton_attr.weapon_y + wave_ultra_slow_cos * 0.5, - 0.0 + wave_ultra_slow * 1.0, - ); - next.main.ori = Quaternion::rotation_x(-0.3) - * Quaternion::rotation_y(0.0) - * Quaternion::rotation_z(0.0); - next.main.scale = Vec3::one(); - }, - Some(ToolKind::Dagger(_)) => { - next.l_hand.offset = Vec3::new( - -6.0 + wave_ultra_slow_cos * 1.0, - 3.5 + wave_ultra_slow_cos * 0.5, - 0.0 + wave_ultra_slow * 1.0, - ); - next.l_hand.ori = Quaternion::rotation_x(-0.3); - next.l_hand.scale = Vec3::one() * 1.01; - next.r_hand.offset = Vec3::new(-6.0, 3.0, -2.0); - next.r_hand.ori = Quaternion::rotation_x(-0.3); - next.r_hand.scale = Vec3::one() * 1.01; - next.main.offset = Vec3::new( - -6.0 + skeleton_attr.weapon_x, - 4.5 + skeleton_attr.weapon_y, - 0.0, - ); - next.main.ori = Quaternion::rotation_x(-0.3) - * Quaternion::rotation_y(0.0) - * Quaternion::rotation_z(0.0); - next.main.scale = Vec3::one(); - }, - Some(ToolKind::Debug(_)) => { - next.l_hand.offset = Vec3::new(-7.0, 3.5, 6.5); - next.l_hand.ori = Quaternion::rotation_x(2.07) - * Quaternion::rotation_y(0.0) - * Quaternion::rotation_z(-0.2); - next.l_hand.scale = Vec3::one() * 1.01; - next.r_hand.offset = Vec3::new(7.0, 2.5, 3.75); - next.r_hand.ori = Quaternion::rotation_x(2.07) - * Quaternion::rotation_y(0.0) - * Quaternion::rotation_z(-0.2); - next.r_hand.scale = Vec3::one() * 1.01; - next.main.offset = Vec3::new( - 5.0 + skeleton_attr.weapon_x, - 8.75 + skeleton_attr.weapon_y, - 5.5, - ); - next.main.ori = Quaternion::rotation_x(-0.3) - * Quaternion::rotation_y(-1.35) - * Quaternion::rotation_z(-0.85); - next.main.scale = Vec3::one(); - }, _ => {}, } - //next.l_foot.offset = Vec3::new(-3.4, 0.3, 8.0 + wave_ultra_slow_cos * 0.1); - //next.l_foot.ori = Quaternion::rotation_x(-0.3); - //next.l_foot.scale = Vec3::one(); - //next.r_foot.offset = Vec3::new(3.4, 1.2, 8.0 + wave_ultra_slow * 0.1); - //next.r_foot.ori = Quaternion::rotation_x(0.3); - //next.r_foot.scale = Vec3::one(); - - next.l_shoulder.offset = Vec3::new(-5.0, 0.0, 5.0); - next.l_shoulder.ori = Quaternion::rotation_x(0.0); + next.l_shoulder.offset = Vec3::new( + -skeleton_attr.shoulder.0, + skeleton_attr.shoulder.1, + skeleton_attr.shoulder.2, + ); next.l_shoulder.scale = Vec3::one() * 1.1; - next.r_shoulder.offset = Vec3::new(5.0, 0.0, 5.0); - next.r_shoulder.ori = Quaternion::rotation_x(0.0); + next.r_shoulder.offset = Vec3::new( + skeleton_attr.shoulder.0, + skeleton_attr.shoulder.1, + skeleton_attr.shoulder.2, + ); next.r_shoulder.scale = Vec3::one() * 1.1; next.glider.offset = Vec3::new(0.0, 5.0, 0.0); next.glider.ori = Quaternion::rotation_y(0.0); next.glider.scale = Vec3::one() * 0.0; - next.lantern.offset = Vec3::new(0.0, 0.0, 0.0); + next.lantern.offset = Vec3::new( + skeleton_attr.lantern.0, + skeleton_attr.lantern.1, + skeleton_attr.lantern.2, + ); next.lantern.ori = Quaternion::rotation_x(0.0); next.lantern.scale = Vec3::one() * 0.0; @@ -274,12 +202,8 @@ impl Animation for BlockAnimation { next.torso.ori = Quaternion::rotation_x(0.0); next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler; - next.l_control.offset = Vec3::new(0.0, 0.0, 0.0); - next.l_control.ori = Quaternion::rotation_x(0.0); next.l_control.scale = Vec3::one(); - next.r_control.offset = Vec3::new(0.0, 0.0, 0.0); - next.r_control.ori = Quaternion::rotation_x(0.0); next.r_control.scale = Vec3::one(); next } diff --git a/voxygen/src/anim/character/blockidle.rs b/voxygen/src/anim/character/blockidle.rs index 0c7551b71b..b29f4ff2df 100644 --- a/voxygen/src/anim/character/blockidle.rs +++ b/voxygen/src/anim/character/blockidle.rs @@ -38,9 +38,9 @@ impl Animation for BlockIdleAnimation { * 0.15, ); next.head.offset = Vec3::new( - 0.0 + skeleton_attr.neck_right + wave_slow_cos * 0.2, - -1.0 + skeleton_attr.neck_forward, - skeleton_attr.neck_height + 19.5 + wave_ultra_slow * 0.2, + 0.0 + wave_slow_cos * 0.2, + -1.0 + skeleton_attr.head.0, + skeleton_attr.head.1 + 19.5 + wave_ultra_slow * 0.2, ); next.head.ori = Quaternion::rotation_x(-0.25); next.head.scale = Vec3::one() * 1.01 * skeleton_attr.head_scale; @@ -95,11 +95,7 @@ impl Animation for BlockIdleAnimation { ); next.r_hand.ori = Quaternion::rotation_x(-0.3); next.r_hand.scale = Vec3::one() * 1.01; - next.main.offset = Vec3::new( - -6.0 + skeleton_attr.weapon_x, - 4.5 + skeleton_attr.weapon_y, - 0.0 + wave_ultra_slow * 1.0, - ); + next.main.offset = Vec3::new(-6.0, 4.5, 0.0 + wave_ultra_slow * 1.0); next.main.ori = Quaternion::rotation_x(-0.3) * Quaternion::rotation_y(0.0) * Quaternion::rotation_z(0.0); @@ -116,41 +112,12 @@ impl Animation for BlockIdleAnimation { * Quaternion::rotation_y(0.0) * Quaternion::rotation_z(-0.2); next.r_hand.scale = Vec3::one() * 1.01; - next.main.offset = Vec3::new( - 5.0 + skeleton_attr.weapon_x, - 8.75 + wave_ultra_slow * 2.0 + skeleton_attr.weapon_y, - 5.5, - ); + next.main.offset = Vec3::new(5.0, 8.75 + wave_ultra_slow * 2.0, 5.5); next.main.ori = Quaternion::rotation_x(-0.3) * Quaternion::rotation_y(-1.35) * Quaternion::rotation_z(-0.85); next.main.scale = Vec3::one(); }, - Some(ToolKind::Staff(_)) => { - next.l_hand.offset = Vec3::new( - -6.0 + wave_ultra_slow_cos * 1.0, - 3.5 + wave_ultra_slow_cos * 0.5, - 0.0 + wave_ultra_slow * 1.0, - ); - next.l_hand.ori = Quaternion::rotation_x(-0.3); - next.l_hand.scale = Vec3::one() * 1.01; - next.r_hand.offset = Vec3::new( - -6.0 + wave_ultra_slow_cos * 1.0, - 3.0 + wave_ultra_slow_cos * 0.5, - -2.0 + wave_ultra_slow * 1.0, - ); - next.r_hand.ori = Quaternion::rotation_x(-0.3); - next.r_hand.scale = Vec3::one() * 1.01; - next.main.offset = Vec3::new( - -6.0 + skeleton_attr.weapon_x + wave_ultra_slow_cos * 1.0, - 4.5 + skeleton_attr.weapon_y + wave_ultra_slow_cos * 0.5, - 0.0 + wave_ultra_slow * 1.0, - ); - next.main.ori = Quaternion::rotation_x(-0.3) - * Quaternion::rotation_y(0.0) - * Quaternion::rotation_z(0.0); - next.main.scale = Vec3::one(); - }, Some(ToolKind::Shield(_)) => { next.l_hand.offset = Vec3::new( -6.0 + wave_ultra_slow_cos * 1.0, @@ -167,56 +134,10 @@ impl Animation for BlockIdleAnimation { next.r_hand.ori = Quaternion::rotation_x(-0.3); next.r_hand.scale = Vec3::one() * 1.01; next.main.offset = Vec3::new( - -6.0 + skeleton_attr.weapon_x + wave_ultra_slow_cos * 1.0, - 4.5 + skeleton_attr.weapon_y + wave_ultra_slow_cos * 0.5, - 0.0 + wave_ultra_slow * 1.0, - ); - next.main.ori = Quaternion::rotation_x(-0.3) - * Quaternion::rotation_y(0.0) - * Quaternion::rotation_z(0.0); - next.main.scale = Vec3::one(); - }, - Some(ToolKind::Bow(_)) => { - next.l_hand.offset = Vec3::new( -6.0 + wave_ultra_slow_cos * 1.0, - 3.5 + wave_ultra_slow_cos * 0.5, + 4.5 + wave_ultra_slow_cos * 0.5, 0.0 + wave_ultra_slow * 1.0, ); - next.l_hand.ori = Quaternion::rotation_x(-0.3); - next.l_hand.scale = Vec3::one() * 1.01; - next.r_hand.offset = Vec3::new( - -6.0 + wave_ultra_slow_cos * 1.0, - 3.0 + wave_ultra_slow_cos * 0.5, - -2.0 + wave_ultra_slow * 1.0, - ); - next.r_hand.ori = Quaternion::rotation_x(-0.3); - next.r_hand.scale = Vec3::one() * 1.01; - next.main.offset = Vec3::new( - -6.0 + skeleton_attr.weapon_x + wave_ultra_slow_cos * 1.0, - 4.5 + skeleton_attr.weapon_y + wave_ultra_slow_cos * 0.5, - 0.0 + wave_ultra_slow * 1.0, - ); - next.main.ori = Quaternion::rotation_x(-0.3) - * Quaternion::rotation_y(0.0) - * Quaternion::rotation_z(0.0); - next.main.scale = Vec3::one(); - }, - Some(ToolKind::Dagger(_)) => { - next.l_hand.offset = Vec3::new( - -6.0 + wave_ultra_slow_cos * 1.0, - 3.5 + wave_ultra_slow_cos * 0.5, - 0.0 + wave_ultra_slow * 1.0, - ); - next.l_hand.ori = Quaternion::rotation_x(-0.3); - next.l_hand.scale = Vec3::one() * 1.01; - next.r_hand.offset = Vec3::new(-6.0, 3.0, -2.0); - next.r_hand.ori = Quaternion::rotation_x(-0.3); - next.r_hand.scale = Vec3::one() * 1.01; - next.main.offset = Vec3::new( - -6.0 + skeleton_attr.weapon_x, - 4.5 + skeleton_attr.weapon_y, - 0.0, - ); next.main.ori = Quaternion::rotation_x(-0.3) * Quaternion::rotation_y(0.0) * Quaternion::rotation_z(0.0); @@ -233,11 +154,7 @@ impl Animation for BlockIdleAnimation { * Quaternion::rotation_y(0.0) * Quaternion::rotation_z(-0.2); next.r_hand.scale = Vec3::one() * 1.01; - next.main.offset = Vec3::new( - 5.0 + skeleton_attr.weapon_x, - 8.75 + wave_ultra_slow * 2.0 + skeleton_attr.weapon_y, - 5.5, - ); + next.main.offset = Vec3::new(5.0, 8.75 + wave_ultra_slow * 2.0, 5.5); next.main.ori = Quaternion::rotation_x(-0.3) * Quaternion::rotation_y(-1.35) * Quaternion::rotation_z(-0.85); @@ -253,19 +170,28 @@ impl Animation for BlockIdleAnimation { next.r_foot.ori = Quaternion::rotation_x(0.3); next.r_foot.scale = Vec3::one(); - next.l_shoulder.offset = Vec3::new(-5.0, 0.0, 5.0); - next.l_shoulder.ori = Quaternion::rotation_x(0.0); + next.l_shoulder.offset = Vec3::new( + -skeleton_attr.shoulder.0, + skeleton_attr.shoulder.1, + skeleton_attr.shoulder.2, + ); next.l_shoulder.scale = Vec3::one() * 1.1; - next.r_shoulder.offset = Vec3::new(5.0, 0.0, 5.0); - next.r_shoulder.ori = Quaternion::rotation_x(0.0); + next.r_shoulder.offset = Vec3::new( + skeleton_attr.shoulder.0, + skeleton_attr.shoulder.1, + skeleton_attr.shoulder.2, + ); next.r_shoulder.scale = Vec3::one() * 1.1; - next.glider.offset = Vec3::new(0.0, 5.0, 0.0); - next.glider.ori = Quaternion::rotation_y(0.0); + next.glider.offset = Vec3::new(0.0, 0.0, 10.0); next.glider.scale = Vec3::one() * 0.0; - next.lantern.offset = Vec3::new(0.0, 0.0, 0.0); + next.lantern.offset = Vec3::new( + skeleton_attr.lantern.0, + skeleton_attr.lantern.1, + skeleton_attr.lantern.2, + ); next.lantern.ori = Quaternion::rotation_x(0.0); next.lantern.scale = Vec3::one() * 0.0; @@ -273,12 +199,8 @@ impl Animation for BlockIdleAnimation { next.torso.ori = Quaternion::rotation_x(0.0); next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler; - next.l_control.offset = Vec3::new(0.0, 0.0, 0.0); - next.l_control.ori = Quaternion::rotation_x(0.0); next.l_control.scale = Vec3::one(); - next.r_control.offset = Vec3::new(0.0, 0.0, 0.0); - next.r_control.ori = Quaternion::rotation_x(0.0); next.r_control.scale = Vec3::one(); next } diff --git a/voxygen/src/anim/character/charge.rs b/voxygen/src/anim/character/charge.rs index ea016471d8..9ad1c25605 100644 --- a/voxygen/src/anim/character/charge.rs +++ b/voxygen/src/anim/character/charge.rs @@ -48,26 +48,26 @@ impl Animation for ChargeAnimation { let stopa = ((anim_time as f32).powf(0.9 as f32)).min(5.0); next.head.offset = Vec3::new( - 0.0 + stop * -2.0 + skeleton_attr.neck_right, - -2.0 + stop * 2.5 + skeleton_attr.neck_forward, - skeleton_attr.neck_height + 14.0, + 0.0 + stop * -2.0, + -2.0 + stop * 2.5 + skeleton_attr.head.0, + skeleton_attr.head.1, ); next.head.ori = Quaternion::rotation_z(stop * -1.0) * Quaternion::rotation_x(0.0) * Quaternion::rotation_y(stop * -0.3); next.head.scale = Vec3::one() * skeleton_attr.head_scale; - next.chest.offset = Vec3::new(0.0, 0.0, 7.0); + next.chest.offset = Vec3::new(0.0, skeleton_attr.chest.0, skeleton_attr.chest.1); next.chest.ori = Quaternion::rotation_z(stop * 1.2 + stress * stop * 0.02) * Quaternion::rotation_x(0.0) * Quaternion::rotation_y(0.0); next.chest.scale = Vec3::one(); - next.belt.offset = Vec3::new(0.0, 0.0, -2.0); + next.belt.offset = Vec3::new(0.0, skeleton_attr.belt.0, skeleton_attr.belt.1); next.belt.ori = Quaternion::rotation_z(stop * -0.5); next.belt.scale = Vec3::one(); - next.shorts.offset = Vec3::new(0.0, 0.0, -5.0); + next.shorts.offset = Vec3::new(0.0, skeleton_attr.shorts.0, skeleton_attr.shorts.1); next.shorts.ori = Quaternion::rotation_z(stop * -0.7); next.shorts.scale = Vec3::one(); @@ -93,9 +93,8 @@ impl Animation for ChargeAnimation { 6.0 + quicka * 3.5 * (1.0 / (stopa + 0.1)), 6.0 - stop * 3.0, ); - next.control.ori = Quaternion::rotation_x(stop * -0.2) - * Quaternion::rotation_y(0.0) - * Quaternion::rotation_z(stop * 0.2); + next.control.ori = + Quaternion::rotation_x(stop * -0.2) * Quaternion::rotation_z(stop * 0.2); next.control.scale = Vec3::one(); }, Some(ToolKind::Bow(_)) => { @@ -159,32 +158,37 @@ impl Animation for ChargeAnimation { * Quaternion::rotation_y(0.0); next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler; } - next.back.offset = Vec3::new(0.0, -2.8, 7.25); + next.back.offset = Vec3::new(0.0, skeleton_attr.back.0, skeleton_attr.back.1); next.back.ori = Quaternion::rotation_x(-0.3); next.back.scale = Vec3::one() * 1.02; - next.l_shoulder.offset = Vec3::new(-5.0, 0.0, 4.7); - next.l_shoulder.ori = Quaternion::rotation_x(0.0); + next.l_shoulder.offset = Vec3::new( + -skeleton_attr.shoulder.0, + skeleton_attr.shoulder.1, + skeleton_attr.shoulder.2, + ); next.l_shoulder.scale = Vec3::one() * 1.1; - next.r_shoulder.offset = Vec3::new(5.0, 0.0, 4.7); - next.r_shoulder.ori = Quaternion::rotation_x(0.0); + next.r_shoulder.offset = Vec3::new( + skeleton_attr.shoulder.0, + skeleton_attr.shoulder.1, + skeleton_attr.shoulder.2, + ); next.r_shoulder.scale = Vec3::one() * 1.1; - next.glider.offset = Vec3::new(0.0, 5.0, 0.0); - next.glider.ori = Quaternion::rotation_y(0.0); + next.glider.offset = Vec3::new(0.0, 0.0, 10.0); next.glider.scale = Vec3::one() * 0.0; - next.lantern.offset = Vec3::new(-5.0, 2.5, 5.5); + next.lantern.offset = Vec3::new( + skeleton_attr.lantern.0, + skeleton_attr.lantern.1, + skeleton_attr.lantern.2, + ); next.lantern.ori = Quaternion::rotation_x(0.1) * Quaternion::rotation_y(0.1); next.lantern.scale = Vec3::one() * 0.65; - next.l_control.offset = Vec3::new(0.0, 0.0, 0.0); - next.l_control.ori = Quaternion::rotation_x(0.0); next.l_control.scale = Vec3::one(); - next.r_control.offset = Vec3::new(0.0, 0.0, 0.0); - next.r_control.ori = Quaternion::rotation_x(0.0); next.r_control.scale = Vec3::one(); next } diff --git a/voxygen/src/anim/character/climb.rs b/voxygen/src/anim/character/climb.rs index 5787dd4fc3..23370b68f5 100644 --- a/voxygen/src/anim/character/climb.rs +++ b/voxygen/src/anim/character/climb.rs @@ -39,79 +39,102 @@ impl Animation for ClimbAnimation { next.head.offset = Vec3::new( 0.0, - -4.0 + skeleton_attr.neck_forward, - skeleton_attr.neck_height + 13.50 + smootha * 0.2, + -4.0 + skeleton_attr.head.0, + skeleton_attr.head.1 + smootha * 0.2, ); next.head.ori = Quaternion::rotation_z(smooth * 0.1) * Quaternion::rotation_x(0.6) * Quaternion::rotation_y(quick * 0.1); next.head.scale = Vec3::one() * skeleton_attr.head_scale; - next.chest.offset = Vec3::new(0.0, 1.0, 5.0 + smootha * 1.1); + next.chest.offset = Vec3::new( + 0.0, + skeleton_attr.chest.0 + 1.0, + skeleton_attr.chest.1 + smootha * 1.1, + ); next.chest.ori = Quaternion::rotation_z(quick * 0.25) * Quaternion::rotation_x(-0.15) * Quaternion::rotation_y(quick * -0.12); next.chest.scale = Vec3::one(); - next.belt.offset = Vec3::new(0.0, 1.0, -2.0); + next.belt.offset = Vec3::new(0.0, skeleton_attr.belt.0 + 1.0, skeleton_attr.belt.1); next.belt.ori = Quaternion::rotation_z(quick * 0.0) * Quaternion::rotation_x(0.0); next.belt.scale = Vec3::one(); - next.back.offset = Vec3::new(0.0, -2.8, 7.25); + next.back.offset = Vec3::new(0.0, skeleton_attr.back.0, skeleton_attr.back.1); next.back.ori = Quaternion::rotation_x(-0.2); next.back.scale = Vec3::one() * 1.02; - next.shorts.offset = Vec3::new(0.0, 1.0, -5.0); + next.shorts.offset = Vec3::new(0.0, skeleton_attr.shorts.0 + 1.0, skeleton_attr.shorts.1); next.shorts.ori = Quaternion::rotation_z(quick * 0.0) * Quaternion::rotation_x(0.1) * Quaternion::rotation_y(quick * 0.10); next.shorts.scale = Vec3::one(); - next.l_hand.offset = Vec3::new(-6.0, -0.25 + quicka * 1.5, 6.0 - quick * 4.0); + next.l_hand.offset = Vec3::new( + skeleton_attr.hand.0, + skeleton_attr.hand.1 + quicka * 1.5, + skeleton_attr.hand.2 - quick * 4.0, + ); next.l_hand.ori = Quaternion::rotation_x(2.2 + quicka * 0.5); next.l_hand.scale = Vec3::one(); - next.r_hand.offset = Vec3::new(6.0, -0.25 - quicka * 1.5, 6.0 + quick * 4.0); + next.r_hand.offset = Vec3::new( + skeleton_attr.hand.0, + skeleton_attr.hand.1 - quicka * 1.5, + skeleton_attr.hand.2 + quick * 4.0, + ); next.r_hand.ori = Quaternion::rotation_x(2.2 - quicka * 0.5); next.r_hand.scale = Vec3::one(); - next.l_foot.offset = Vec3::new(-3.4, 1.0, 6.0 + quick * 2.5); + next.l_foot.offset = Vec3::new( + -skeleton_attr.foot.0, + 1.0 + skeleton_attr.foot.1, + skeleton_attr.foot.2 + quick * 2.5, + ); next.l_foot.ori = Quaternion::rotation_x(0.2 - quicka * 0.5); next.l_foot.scale = Vec3::one(); - next.r_foot.offset = Vec3::new(3.4, 1.0, 6.0 - quick * 2.5); + next.r_foot.offset = Vec3::new( + skeleton_attr.foot.0, + 1.0 + skeleton_attr.foot.1, + skeleton_attr.foot.2 - quick * 2.5, + ); next.r_foot.ori = Quaternion::rotation_x(0.2 + quicka * 0.5); next.r_foot.scale = Vec3::one(); - next.l_shoulder.offset = Vec3::new(-5.0, 0.0, 4.7); + next.l_shoulder.offset = Vec3::new( + -skeleton_attr.shoulder.0, + skeleton_attr.shoulder.1, + skeleton_attr.shoulder.2, + ); next.l_shoulder.ori = Quaternion::rotation_x(smootha * 0.15); next.l_shoulder.scale = Vec3::one() * 1.1; - next.r_shoulder.offset = Vec3::new(5.0, 0.0, 4.7); + next.r_shoulder.offset = Vec3::new( + skeleton_attr.shoulder.0, + skeleton_attr.shoulder.1, + skeleton_attr.shoulder.2, + ); next.r_shoulder.ori = Quaternion::rotation_x(smooth * 0.15); next.r_shoulder.scale = Vec3::one() * 1.1; - next.glider.offset = Vec3::new(0.0, 5.0, 0.0); - next.glider.ori = Quaternion::rotation_y(0.0); + next.glider.offset = Vec3::new(0.0, 0.0, 10.0); next.glider.scale = Vec3::one() * 0.0; - next.main.offset = Vec3::new( - -7.0 + skeleton_attr.weapon_x, - -5.0 + skeleton_attr.weapon_y, - 18.0, - ); + next.main.offset = Vec3::new(-7.0, -5.0, 18.0); next.main.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57 + smootha * 0.25); next.main.scale = Vec3::one(); - next.second.offset = Vec3::new( - 0.0 + skeleton_attr.weapon_x, - 0.0 + skeleton_attr.weapon_y, - 0.0, - ); + next.second.offset = Vec3::new(0.0, 0.0, 0.0); next.second.ori = Quaternion::rotation_y(0.0); next.second.scale = Vec3::one() * 0.0; - next.lantern.offset = Vec3::new(-5.0, 2.5, 5.5); + next.lantern.offset = Vec3::new( + skeleton_attr.lantern.0, + skeleton_attr.lantern.1, + skeleton_attr.lantern.2, + ); next.lantern.ori = Quaternion::rotation_x(smooth * -0.3) * Quaternion::rotation_y(smooth * -0.3); next.lantern.scale = Vec3::one() * 0.65; @@ -120,16 +143,10 @@ impl Animation for ClimbAnimation { next.torso.ori = Quaternion::rotation_x(0.0) * Quaternion::rotation_y(0.0); next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler; - next.control.offset = Vec3::new(0.0, 0.0, 0.0); - next.control.ori = Quaternion::rotation_x(0.0); next.control.scale = Vec3::one(); - next.l_control.offset = Vec3::new(0.0, 0.0, 0.0); - next.l_control.ori = Quaternion::rotation_x(0.0); next.l_control.scale = Vec3::one(); - next.r_control.offset = Vec3::new(0.0, 0.0, 0.0); - next.r_control.ori = Quaternion::rotation_x(0.0); next.r_control.scale = Vec3::one(); next } diff --git a/voxygen/src/anim/character/dash.rs b/voxygen/src/anim/character/dash.rs index 9be8006f0b..4993b8f703 100644 --- a/voxygen/src/anim/character/dash.rs +++ b/voxygen/src/anim/character/dash.rs @@ -36,9 +36,9 @@ impl Animation for DashAnimation { //TODO: Inventory Some(ToolKind::Sword(_)) => { next.head.offset = Vec3::new( - 0.0 + skeleton_attr.neck_right, - -2.0 + skeleton_attr.neck_forward, - skeleton_attr.neck_height + 12.0, + 0.0, + -2.0 + skeleton_attr.head.0, + -2.0 + skeleton_attr.head.1, ); next.head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0) @@ -47,15 +47,12 @@ impl Animation for DashAnimation { next.chest.offset = Vec3::new(0.0, 0.0, 7.0 + slow * 2.0); next.chest.ori = Quaternion::rotation_x(-0.5) * Quaternion::rotation_z(-0.7); - next.chest.scale = Vec3::one(); next.belt.offset = Vec3::new(0.0, 1.0, -1.0); next.belt.ori = Quaternion::rotation_x(0.2) * Quaternion::rotation_z(0.2); - next.belt.scale = Vec3::one(); next.shorts.offset = Vec3::new(0.0, 3.0, -3.0); next.shorts.ori = Quaternion::rotation_x(0.4) * Quaternion::rotation_z(0.3); - next.shorts.scale = Vec3::one(); next.l_hand.offset = Vec3::new(0.0, 1.0, 0.0); next.l_hand.ori = Quaternion::rotation_x(1.27); @@ -64,61 +61,43 @@ impl Animation for DashAnimation { next.r_hand.ori = Quaternion::rotation_x(1.27); next.r_hand.scale = Vec3::one() * 1.05; next.main.offset = Vec3::new(0.0, 6.0, -1.0); - next.main.ori = Quaternion::rotation_x(-0.3) - * Quaternion::rotation_y(0.0) - * Quaternion::rotation_z(0.0); + next.main.ori = Quaternion::rotation_x(-0.3); next.main.scale = Vec3::one(); next.control.offset = Vec3::new(-8.0 - slow * 0.5, 3.0 - foot * 0.6, 3.0); - next.control.ori = Quaternion::rotation_x(-0.3) - * Quaternion::rotation_y(0.0) - * Quaternion::rotation_z(1.1 + slow * 0.2); + next.control.ori = + Quaternion::rotation_x(-0.3) * Quaternion::rotation_z(1.1 + slow * 0.2); next.control.scale = Vec3::one(); next.l_foot.offset = Vec3::new(-1.4, foot * 3.0 + 2.0, 8.0); next.l_foot.ori = Quaternion::rotation_x(foot * -0.4 - 0.8); - next.l_foot.scale = Vec3::one(); next.r_foot.offset = Vec3::new(5.4, foot * -3.0 - 1.0, 8.0); next.r_foot.ori = Quaternion::rotation_x(foot * 0.4 - 0.8); - next.r_foot.scale = Vec3::one(); }, _ => {}, } next.head.offset = Vec3::new( - 0.0 + skeleton_attr.neck_right, - -2.0 + skeleton_attr.neck_forward, - skeleton_attr.neck_height + 12.0, + 0.0, + -2.0 + skeleton_attr.head.0, + skeleton_attr.head.1 + 12.0, ); next.head.ori = Quaternion::rotation_x(0.5); - next.l_shoulder.offset = Vec3::new(-5.0, 0.0, 4.7); - next.l_shoulder.ori = Quaternion::rotation_x(0.0); - next.l_shoulder.scale = Vec3::one() * 1.1; - - next.r_shoulder.offset = Vec3::new(5.0, 0.0, 4.7); - next.r_shoulder.ori = Quaternion::rotation_x(0.0); - next.r_shoulder.scale = Vec3::one() * 1.1; - - next.glider.offset = Vec3::new(0.0, 5.0, 0.0); - next.glider.ori = Quaternion::rotation_y(0.0); - next.glider.scale = Vec3::one() * 0.0; - - next.lantern.offset = Vec3::new(-5.0, 2.5, 5.5); + next.lantern.offset = Vec3::new( + skeleton_attr.lantern.0, + skeleton_attr.lantern.1, + skeleton_attr.lantern.2, + ); next.lantern.ori = Quaternion::rotation_x(slow * -0.7 + 0.4) * Quaternion::rotation_y(slow * 0.4); - next.lantern.scale = Vec3::one() * 0.65; next.torso.offset = Vec3::new(0.0, 0.0, 0.1) * skeleton_attr.scaler; next.torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0) * Quaternion::rotation_y(0.0); next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler; - next.l_control.offset = Vec3::new(0.0, 0.0, 0.0); - next.l_control.ori = Quaternion::rotation_x(0.0); next.l_control.scale = Vec3::one(); - next.r_control.offset = Vec3::new(0.0, 0.0, 0.0); - next.r_control.ori = Quaternion::rotation_x(0.0); next.r_control.scale = Vec3::one(); next } diff --git a/voxygen/src/anim/character/equip.rs b/voxygen/src/anim/character/equip.rs index d7c1f2d764..449204f36f 100644 --- a/voxygen/src/anim/character/equip.rs +++ b/voxygen/src/anim/character/equip.rs @@ -51,9 +51,7 @@ impl Animation for EquipAnimation { next.control.offset = Vec3::new(-3.0 + equip_slowa * -1.5, -5.0, 12.0 + equip_slow * 1.5); - next.control.ori = Quaternion::rotation_x(0.0) - * Quaternion::rotation_y(2.5) - * Quaternion::rotation_z(1.57); + next.control.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57); next.control.scale = Vec3::one(); }, Some(ToolKind::Axe(_)) => { @@ -74,9 +72,7 @@ impl Animation for EquipAnimation { next.main.scale = Vec3::one(); next.control.offset = Vec3::new(0.0, 0.0, 0.0); - next.control.ori = Quaternion::rotation_x(0.2) - * Quaternion::rotation_y(-0.3) - * Quaternion::rotation_z(0.0); + next.control.ori = Quaternion::rotation_x(0.2) * Quaternion::rotation_y(-0.3); next.control.scale = Vec3::one(); }, Some(ToolKind::Hammer(_)) => { @@ -87,16 +83,12 @@ impl Animation for EquipAnimation { next.r_hand.ori = Quaternion::rotation_x(0.0) * Quaternion::rotation_y(0.22); next.r_hand.scale = Vec3::one() * 1.06; next.main.offset = Vec3::new(6.0, 7.0, 0.0); - next.main.ori = Quaternion::rotation_x(0.0) - * Quaternion::rotation_y(-1.35) - * Quaternion::rotation_z(1.57); + next.main.ori = Quaternion::rotation_y(-1.35) * Quaternion::rotation_z(1.57); next.main.scale = Vec3::one(); next.control.offset = Vec3::new(-3.0 + equip_slowa * -1.5, -12.0, 12.0 + equip_slow * 1.5); - next.control.ori = Quaternion::rotation_x(0.0) - * Quaternion::rotation_y(1.35 + 2.5) - * Quaternion::rotation_z(0.0); + next.control.ori = Quaternion::rotation_x(0.0) * Quaternion::rotation_y(1.35 + 2.5); next.control.scale = Vec3::one(); }, Some(ToolKind::Staff(_)) => { @@ -127,14 +119,8 @@ impl Animation for EquipAnimation { next.r_hand.offset = Vec3::new(-6.0, 3.0, -2.0); next.r_hand.ori = Quaternion::rotation_x(-0.3); next.r_hand.scale = Vec3::one() * 1.01; - next.main.offset = Vec3::new( - -6.0 + skeleton_attr.weapon_x, - 4.5 + skeleton_attr.weapon_y, - 0.0, - ); - next.main.ori = Quaternion::rotation_x(-0.3) - * Quaternion::rotation_y(0.0) - * Quaternion::rotation_z(0.0); + next.main.offset = Vec3::new(-6.0, 4.5, 0.0); + next.main.ori = Quaternion::rotation_x(-0.3); next.main.scale = Vec3::one(); }, Some(ToolKind::Bow(_)) => { @@ -167,14 +153,8 @@ impl Animation for EquipAnimation { next.r_hand.offset = Vec3::new(-6.0, 3.0, -2.0); next.r_hand.ori = Quaternion::rotation_x(-0.3); next.r_hand.scale = Vec3::one() * 1.01; - next.main.offset = Vec3::new( - -6.0 + skeleton_attr.weapon_x, - 4.5 + skeleton_attr.weapon_y, - 0.0, - ); - next.main.ori = Quaternion::rotation_x(-0.3) - * Quaternion::rotation_y(0.0) - * Quaternion::rotation_z(0.0); + next.main.offset = Vec3::new(-6.0, 4.5, 0.0); + next.main.ori = Quaternion::rotation_x(-0.3); next.main.scale = Vec3::one(); }, Some(ToolKind::Debug(_)) => { @@ -184,15 +164,10 @@ impl Animation for EquipAnimation { * Quaternion::rotation_z(0.0); next.l_hand.scale = Vec3::one() * 1.01; next.r_hand.offset = Vec3::new(7.0, 2.5, -1.25); - next.r_hand.ori = Quaternion::rotation_x(1.27 + wave * 0.25) - * Quaternion::rotation_y(0.0) - * Quaternion::rotation_z(-0.3); + next.r_hand.ori = + Quaternion::rotation_x(1.27 + wave * 0.25) * Quaternion::rotation_z(-0.3); next.r_hand.scale = Vec3::one() * 1.01; - next.main.offset = Vec3::new( - 5.0 + skeleton_attr.weapon_x, - 8.75 + skeleton_attr.weapon_y, - -2.0, - ); + next.main.offset = Vec3::new(5.0, 8.75, -2.0); next.main.ori = Quaternion::rotation_x(-0.3) * Quaternion::rotation_y(-1.27) * Quaternion::rotation_z(wave * -0.25); @@ -216,38 +191,36 @@ impl Animation for EquipAnimation { if velocity > 0.5 { next.torso.offset = Vec3::new(0.0, 0.0, 0.0) * skeleton_attr.scaler; next.torso.ori = Quaternion::rotation_x(-0.2); - next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler; } else { next.head.offset = Vec3::new( 0.0, - -3.0 + skeleton_attr.neck_forward, - skeleton_attr.neck_height + 13.0 + short * 0.2, + -3.0 + skeleton_attr.head.0, + -1.0 + skeleton_attr.head.1 + short * 0.2, ); next.head.ori = Quaternion::rotation_z(head_look.x) * Quaternion::rotation_x(head_look.y); - next.head.scale = Vec3::one() * skeleton_attr.head_scale; - next.l_foot.offset = Vec3::new(-3.4, -2.5, 8.0); + + next.l_foot.offset = Vec3::new( + -skeleton_attr.foot.0, + skeleton_attr.foot.1, + skeleton_attr.foot.2, + ); next.l_foot.ori = Quaternion::rotation_x(wave_ultra_slow_cos * 0.035 - 0.2); - next.l_foot.scale = Vec3::one(); - next.r_foot.offset = Vec3::new(3.4, 3.5, 8.0); + next.r_foot.offset = Vec3::new( + skeleton_attr.foot.0, + skeleton_attr.foot.1, + skeleton_attr.foot.2, + ); next.r_foot.ori = Quaternion::rotation_x(wave_ultra_slow * 0.035); - next.r_foot.scale = Vec3::one(); - next.chest.offset = Vec3::new(0.0, 0.0, 7.0); - next.chest.ori = Quaternion::rotation_z(0.0); - next.chest.scale = Vec3::one(); + next.chest.offset = Vec3::new(0.0, skeleton_attr.chest.0, skeleton_attr.chest.1); - next.belt.offset = Vec3::new(0.0, 0.0, -2.0); - next.belt.ori = Quaternion::rotation_z(0.0); - next.belt.scale = Vec3::one(); + next.belt.offset = Vec3::new(0.0, skeleton_attr.belt.0, skeleton_attr.belt.1); + + next.shorts.offset = Vec3::new(0.0, skeleton_attr.shorts.0, skeleton_attr.shorts.1); - next.shorts.offset = Vec3::new(0.0, 0.0, -5.0); - next.shorts.ori = Quaternion::rotation_z(0.0); - next.shorts.scale = Vec3::one(); next.torso.offset = Vec3::new(0.0, 0.0, 0.1) * skeleton_attr.scaler; - next.torso.ori = Quaternion::rotation_x(0.0); - next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler; } next } diff --git a/voxygen/src/anim/character/gliding.rs b/voxygen/src/anim/character/gliding.rs index 50df85942c..88c3cb956f 100644 --- a/voxygen/src/anim/character/gliding.rs +++ b/voxygen/src/anim/character/gliding.rs @@ -56,94 +56,88 @@ impl Animation for GlidingAnimation { } * 0.8; next.head.offset = Vec3::new( - 0.0 + skeleton_attr.neck_right, - -2.0 + skeleton_attr.neck_forward, - skeleton_attr.neck_height + 12.0, + 0.0, + -2.0 + skeleton_attr.head.0, + -2.0 + skeleton_attr.head.1, ); next.head.ori = Quaternion::rotation_x(0.35 - slow * 0.10 + head_look.y) * Quaternion::rotation_z(head_look.x + slowa * 0.15); - next.head.scale = Vec3::one() * skeleton_attr.head_scale; next.chest.offset = Vec3::new(0.0, 0.0, -2.0); next.chest.ori = Quaternion::rotation_z(slowa * 0.2); - next.chest.scale = Vec3::one(); next.belt.offset = Vec3::new(0.0, 0.0, -2.0); next.belt.ori = Quaternion::rotation_z(slowa * 0.25); - next.belt.scale = Vec3::one(); - next.shorts.offset = Vec3::new(0.0, 0.0, -5.0); + next.shorts.offset = Vec3::new(0.0, skeleton_attr.shorts.0, skeleton_attr.shorts.1); next.shorts.ori = Quaternion::rotation_z(slowa * 0.35); - next.shorts.scale = Vec3::one(); next.l_hand.offset = Vec3::new(-9.5 + slowa * -1.5, -3.0 + slowa * 1.5, 6.0); next.l_hand.ori = Quaternion::rotation_x(-2.7 + slowa * -0.1); - next.l_hand.scale = Vec3::one(); next.r_hand.offset = Vec3::new(9.5 + slowa * -1.5, -3.0 + slowa * -1.5, 6.0); next.r_hand.ori = Quaternion::rotation_x(-2.7 + slowa * -0.10); - next.r_hand.scale = Vec3::one(); - next.l_foot.offset = Vec3::new(-3.4, 1.0, -2.0); + next.l_foot.offset = Vec3::new( + -skeleton_attr.foot.0, + 2.0 + skeleton_attr.foot.1, + -9.0 + skeleton_attr.foot.2, + ); next.l_foot.ori = Quaternion::rotation_x( (wave_stop * -0.7 - quicka * -0.21 + slow * 0.19) * speed * 0.04, ); - next.l_foot.scale = Vec3::one(); - next.r_foot.offset = Vec3::new(3.4, 1.0, -2.0); + next.r_foot.offset = Vec3::new( + skeleton_attr.foot.0, + 2.0 + skeleton_attr.foot.1, + -9.0 + skeleton_attr.foot.2, + ); next.r_foot.ori = Quaternion::rotation_x( (wave_stop * -0.8 + quick * -0.25 + slowb * 0.13) * speed * 0.04, ); next.r_foot.scale = Vec3::one(); - next.l_shoulder.offset = Vec3::new(-5.0, 0.0, 4.7); - next.l_shoulder.ori = Quaternion::rotation_x(0.0); + next.l_shoulder.offset = Vec3::new( + -skeleton_attr.shoulder.0, + skeleton_attr.shoulder.1, + skeleton_attr.shoulder.2, + ); next.l_shoulder.scale = Vec3::one() * 1.1; - next.r_shoulder.offset = Vec3::new(5.0, 0.0, 4.7); - next.r_shoulder.ori = Quaternion::rotation_x(0.0); + next.r_shoulder.offset = Vec3::new( + skeleton_attr.shoulder.0, + skeleton_attr.shoulder.1, + skeleton_attr.shoulder.2, + ); next.r_shoulder.scale = Vec3::one() * 1.1; next.glider.offset = Vec3::new(0.0, -13.0 + slow * 0.10, 6.0); next.glider.ori = Quaternion::rotation_x(1.0) * Quaternion::rotation_y(slowa * 0.04); next.glider.scale = Vec3::one(); - next.main.offset = Vec3::new( - -7.0 + skeleton_attr.weapon_x, - -5.0 + skeleton_attr.weapon_y, - 15.0, - ); + next.main.offset = Vec3::new(-7.0, -5.0, 15.0); next.main.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57); next.main.scale = Vec3::one(); - next.second.offset = Vec3::new( - 0.0 + skeleton_attr.weapon_x, - 0.0 + skeleton_attr.weapon_y, - 0.0, - ); - next.second.ori = Quaternion::rotation_y(0.0); next.second.scale = Vec3::one() * 0.0; - next.lantern.offset = Vec3::new(0.0, 0.0, 0.0); - next.lantern.ori = Quaternion::rotation_x(0.0); - next.lantern.scale = Vec3::one() * 0.0; + next.lantern.offset = Vec3::new( + skeleton_attr.lantern.0, + skeleton_attr.lantern.1, + skeleton_attr.lantern.2, + ); + next.lantern.scale = Vec3::one() * 0.65; next.torso.offset = Vec3::new(0.0, 6.0, 15.0) / 11.0 * skeleton_attr.scaler; next.torso.ori = Quaternion::rotation_x(-0.05 * speed.max(12.0) + slow * 0.10) * Quaternion::rotation_y(tilt * 16.0); next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler; - next.control.offset = Vec3::new(0.0, 0.0, 0.0); - next.control.ori = Quaternion::rotation_x(0.0); next.control.scale = Vec3::one(); - next.l_control.offset = Vec3::new(0.0, 0.0, 0.0); - next.l_control.ori = Quaternion::rotation_x(0.0); next.l_control.scale = Vec3::one(); - next.r_control.offset = Vec3::new(0.0, 0.0, 0.0); - next.r_control.ori = Quaternion::rotation_x(0.0); next.r_control.scale = Vec3::one(); next } diff --git a/voxygen/src/anim/character/idle.rs b/voxygen/src/anim/character/idle.rs index 4ef9a75a3e..3275047a27 100644 --- a/voxygen/src/anim/character/idle.rs +++ b/voxygen/src/anim/character/idle.rs @@ -22,79 +22,97 @@ impl Animation for IdleAnimation { let head_abs = ((anim_time as f32 * 0.5 + PI).sin()) + 1.0; next.head.offset = Vec3::new( - 0.0 + skeleton_attr.neck_right, - -2.0 + skeleton_attr.neck_forward, - skeleton_attr.neck_height + 14.0 + wave_ultra_slow * 0.1 + head_abs * -0.5, + 0.0, + -2.0 + skeleton_attr.head.0, + skeleton_attr.head.1 + wave_ultra_slow * 0.1 + head_abs * -0.5, ); next.head.scale = Vec3::one() * skeleton_attr.head_scale - head_abs * 0.05; - next.chest.offset = Vec3::new(0.0, 0.0, 7.0 + wave_ultra_slow * 0.1); - next.chest.ori = Quaternion::rotation_x(0.0); + next.chest.offset = Vec3::new( + 0.0, + skeleton_attr.chest.0, + skeleton_attr.chest.1 + wave_ultra_slow * 0.1, + ); next.chest.scale = Vec3::one() + head_abs * 0.05; - next.belt.offset = Vec3::new(0.0, 0.0, -2.0 + wave_ultra_slow * 0.1); + next.belt.offset = Vec3::new( + 0.0, + skeleton_attr.belt.0, + skeleton_attr.belt.1 + wave_ultra_slow * 0.1, + ); next.belt.ori = Quaternion::rotation_x(0.0); next.belt.scale = Vec3::one() - head_abs * 0.05; - next.shorts.offset = Vec3::new(0.0, 0.0, -5.0 + wave_ultra_slow * 0.1); + next.shorts.offset = Vec3::new( + 0.0, + skeleton_attr.shorts.0, + skeleton_attr.shorts.1 + wave_ultra_slow * 0.1, + ); next.shorts.ori = Quaternion::rotation_x(0.0); next.shorts.scale = Vec3::one(); next.l_hand.offset = Vec3::new( - -7.0, - -0.25 + wave_ultra_slow_cos * 0.15, - 5.0 + wave_ultra_slow * 0.5, + -skeleton_attr.hand.0, + skeleton_attr.hand.1 + wave_ultra_slow_cos * 0.15, + skeleton_attr.hand.2 + wave_ultra_slow * 0.5, ); next.l_hand.ori = Quaternion::rotation_x(0.0 + wave_ultra_slow * -0.06); next.l_hand.scale = Vec3::one(); next.r_hand.offset = Vec3::new( - 7.0, - -0.25 + wave_ultra_slow_cos * 0.15, - 5.0 + wave_ultra_slow * 0.5 + head_abs * -0.05, + skeleton_attr.hand.0, + skeleton_attr.hand.1 + wave_ultra_slow_cos * 0.15, + skeleton_attr.hand.2 + wave_ultra_slow * 0.5 + head_abs * -0.05, ); next.r_hand.ori = Quaternion::rotation_x(0.0 + wave_ultra_slow * -0.06); next.r_hand.scale = Vec3::one() + head_abs * -0.05; - next.l_foot.offset = Vec3::new(-3.4, -0.1, 8.0); - next.l_foot.ori = Quaternion::identity(); + next.l_foot.offset = Vec3::new( + -skeleton_attr.foot.0, + skeleton_attr.foot.1, + skeleton_attr.foot.2, + ); next.l_foot.scale = Vec3::one(); - next.r_foot.offset = Vec3::new(3.4, -0.1, 8.0); - next.r_foot.ori = Quaternion::identity(); + next.r_foot.offset = Vec3::new( + skeleton_attr.foot.0, + skeleton_attr.foot.1, + skeleton_attr.foot.2, + ); next.r_foot.scale = Vec3::one(); - next.l_shoulder.offset = Vec3::new(-5.0, 0.0, 5.0); + next.l_shoulder.offset = Vec3::new( + -skeleton_attr.shoulder.0, + skeleton_attr.shoulder.0, + skeleton_attr.shoulder.2, + ); next.l_shoulder.ori = Quaternion::rotation_x(0.0); next.l_shoulder.scale = (Vec3::one() + head_abs * -0.05) * 1.15; - next.r_shoulder.offset = Vec3::new(5.0, 0.0, 5.0); + next.r_shoulder.offset = Vec3::new( + skeleton_attr.shoulder.0, + skeleton_attr.shoulder.0, + skeleton_attr.shoulder.2, + ); next.r_shoulder.ori = Quaternion::rotation_x(0.0); next.r_shoulder.scale = (Vec3::one() + head_abs * -0.05) * 1.15; - next.glider.offset = Vec3::new(0.0, 5.0, 0.0); - next.glider.ori = Quaternion::rotation_y(0.0); next.glider.scale = Vec3::one() * 0.0; - next.main.offset = Vec3::new( - -7.0 + skeleton_attr.weapon_x, - -5.0 + skeleton_attr.weapon_y, - 18.0, - ); + next.main.offset = Vec3::new(-7.0, -5.0, 18.0); next.main.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57); next.main.scale = Vec3::one() + head_abs * -0.05; - next.second.offset = Vec3::new( - 0.0 + skeleton_attr.weapon_x, - 0.0 + skeleton_attr.weapon_y, - 0.0, - ); - next.second.ori = Quaternion::rotation_y(0.0); + next.second.offset = Vec3::new(0.0, 0.0, 0.0); next.second.scale = Vec3::one() * 0.0; - next.lantern.offset = Vec3::new(0.0, 0.0, 0.0); + next.lantern.offset = Vec3::new( + skeleton_attr.lantern.0, + skeleton_attr.lantern.1, + skeleton_attr.lantern.2, + ); next.lantern.ori = Quaternion::rotation_x(0.0); next.lantern.scale = Vec3::one() * 0.0; diff --git a/voxygen/src/anim/character/jump.rs b/voxygen/src/anim/character/jump.rs index 9961a6e356..cf9f8453cc 100644 --- a/voxygen/src/anim/character/jump.rs +++ b/voxygen/src/anim/character/jump.rs @@ -21,84 +21,95 @@ impl Animation for JumpAnimation { let stop = (anim_time as f32 * 1.5).min(PI / 2.0).sin(); next.head.offset = Vec3::new( - 0.0 + skeleton_attr.neck_right, - -3.0 + skeleton_attr.neck_forward, - skeleton_attr.neck_height + 13.0, + 0.0, + -3.0 + skeleton_attr.head.0, + -1.0 + skeleton_attr.head.1, ); next.head.ori = Quaternion::rotation_x(0.25 + stop * 0.1 + slow * 0.04); next.head.scale = Vec3::one() * skeleton_attr.head_scale; - next.chest.offset = Vec3::new(0.0, 0.0, 8.0); + next.chest.offset = Vec3::new(0.0, skeleton_attr.chest.0, skeleton_attr.chest.1 + 1.0); next.chest.ori = Quaternion::rotation_z(0.0); next.chest.scale = Vec3::one() * 1.01; - next.belt.offset = Vec3::new(0.0, 0.0, -2.0); + next.belt.offset = Vec3::new(0.0, skeleton_attr.belt.0, skeleton_attr.belt.1); next.belt.ori = Quaternion::rotation_z(0.0); next.belt.scale = Vec3::one(); - next.back.offset = Vec3::new(0.0, -2.8, 7.25); + next.back.offset = Vec3::new(0.0, skeleton_attr.back.0, skeleton_attr.back.1); next.back.ori = Quaternion::rotation_z(0.0); next.back.scale = Vec3::one() * 1.02; - next.shorts.offset = Vec3::new(0.0, 0.0, -5.0); + next.shorts.offset = Vec3::new(0.0, skeleton_attr.shorts.0, skeleton_attr.shorts.1); next.shorts.ori = Quaternion::rotation_z(0.0); next.shorts.scale = Vec3::one(); next.l_hand.offset = Vec3::new( - -6.0 + stop * -1.8, - -0.25 + stop * 2.0, - 2.0 + stop * 3.2 - quick * 0.4, + -skeleton_attr.hand.0 + stop * -1.8, + skeleton_attr.hand.1 + stop * 2.0, + -2.0 + skeleton_attr.hand.2 + stop * 3.2 - quick * 0.4, ); next.l_hand.ori = Quaternion::rotation_x(stop * 1.2 + slow * 0.3) * Quaternion::rotation_y(stop * 0.2); next.l_hand.scale = Vec3::one(); next.r_hand.offset = Vec3::new( - 6.0 + stop * 1.8, - -0.25 + stop * -2.0, - 2.0 + stop * 3.2 - quick * 0.4, + skeleton_attr.hand.0 + stop * 1.8, + skeleton_attr.hand.1 + stop * -2.0, + -2.0 + skeleton_attr.hand.2 + stop * 3.2 - quick * 0.4, ); next.r_hand.ori = Quaternion::rotation_x(-stop * 1.2 + slow * -0.3) * Quaternion::rotation_y(stop * -0.2); next.r_hand.scale = Vec3::one(); - next.l_foot.offset = Vec3::new(-3.4, 1.0, 6.0); + next.l_foot.offset = Vec3::new( + -skeleton_attr.foot.0, + skeleton_attr.foot.1, + skeleton_attr.foot.2, + ); next.l_foot.ori = Quaternion::rotation_x(stop * -1.2 + slow * -0.3); next.l_foot.scale = Vec3::one(); - next.r_foot.offset = Vec3::new(3.4, -1.0, 6.0); + next.r_foot.offset = Vec3::new( + skeleton_attr.foot.0, + skeleton_attr.foot.1, + skeleton_attr.foot.2, + ); next.r_foot.ori = Quaternion::rotation_x(stop * 1.2 + slow * 0.3); next.r_foot.scale = Vec3::one(); - next.l_shoulder.offset = Vec3::new(-5.0, 0.0, 4.7); + next.l_shoulder.offset = Vec3::new( + -skeleton_attr.shoulder.0, + skeleton_attr.shoulder.1, + skeleton_attr.shoulder.2, + ); next.l_shoulder.ori = Quaternion::rotation_x(stop * 0.3); next.l_shoulder.scale = Vec3::one() * 1.1; - next.r_shoulder.offset = Vec3::new(5.0, 0.0, 4.7); + next.r_shoulder.offset = Vec3::new( + skeleton_attr.shoulder.0, + skeleton_attr.shoulder.1, + skeleton_attr.shoulder.2, + ); next.r_shoulder.ori = Quaternion::rotation_x(-stop * 0.3); next.r_shoulder.scale = Vec3::one() * 1.1; next.glider.offset = Vec3::new(0.0, 0.0, 10.0); - next.glider.ori = Quaternion::rotation_y(0.0); next.glider.scale = Vec3::one() * 0.0; - next.main.offset = Vec3::new( - -7.0 + skeleton_attr.weapon_x, - -5.0 + skeleton_attr.weapon_y, - 15.0, - ); + next.main.offset = Vec3::new(-7.0, -5.0, 15.0); next.main.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57); next.main.scale = Vec3::one(); - next.second.offset = Vec3::new( - 0.0 + skeleton_attr.weapon_x, - 0.0 + skeleton_attr.weapon_y, - 0.0, - ); + next.second.offset = Vec3::new(0.0, 0.0, 0.0); next.second.ori = Quaternion::rotation_y(0.0); next.second.scale = Vec3::one() * 0.0; - next.lantern.offset = Vec3::new(-5.0, 2.5, 5.5); + next.lantern.offset = Vec3::new( + skeleton_attr.lantern.0, + skeleton_attr.lantern.1, + skeleton_attr.lantern.2, + ); next.lantern.ori = Quaternion::rotation_x(stop * 1.2 + slow * 0.3) * Quaternion::rotation_y(stop * 0.4 + slow * 0.3); next.lantern.scale = Vec3::one() * 0.65; diff --git a/voxygen/src/anim/character/mod.rs b/voxygen/src/anim/character/mod.rs index db01ba11ad..743fc40798 100644 --- a/voxygen/src/anim/character/mod.rs +++ b/voxygen/src/anim/character/mod.rs @@ -30,7 +30,7 @@ pub use self::{ use super::{Bone, Skeleton}; use crate::render::FigureBoneData; -use common::comp::{self, item::ToolKind}; +use common::comp; #[derive(Clone, Default)] pub struct CharacterSkeleton { @@ -124,12 +124,46 @@ impl Skeleton for CharacterSkeleton { pub struct SkeletonAttr { scaler: f32, head_scale: f32, - neck_height: f32, - neck_forward: f32, - neck_right: f32, - weapon_x: f32, - weapon_y: f32, + head: (f32, f32), + chest: (f32, f32), + belt: (f32, f32), + back: (f32, f32), + shorts: (f32, f32), + hand: (f32, f32, f32), + foot: (f32, f32, f32), + shoulder: (f32, f32, f32), + lantern: (f32, f32, f32), } + +impl Default for SkeletonAttr { + fn default() -> Self { + Self { + scaler: 0.0, + head_scale: 0.0, + head: (0.0, 0.0), + chest: (0.0, 0.0), + belt: (0.0, 0.0), + back: (0.0, 0.0), + shorts: (0.0, 0.0), + hand: (0.0, 0.0, 0.0), + foot: (0.0, 0.0, 0.0), + shoulder: (0.0, 0.0, 0.0), + lantern: (0.0, 0.0, 0.0), + } + } +} + +impl<'a> std::convert::TryFrom<&'a comp::Body> for SkeletonAttr { + type Error = (); + + fn try_from(body: &'a comp::Body) -> Result { + match body { + comp::Body::Humanoid(body) => Ok(SkeletonAttr::from(body)), + _ => Err(()), + } + } +} + impl SkeletonAttr { pub fn calculate_scale(body: &comp::humanoid::Body) -> f32 { use comp::humanoid::{BodyType::*, Race::*}; @@ -150,31 +184,6 @@ impl SkeletonAttr { } } -impl Default for SkeletonAttr { - fn default() -> Self { - Self { - scaler: 1.0, - head_scale: 1.0, - neck_height: 1.0, - neck_forward: 1.0, - neck_right: 1.0, - weapon_x: 1.0, - weapon_y: 1.0, - } - } -} - -impl<'a> std::convert::TryFrom<&'a comp::Body> for SkeletonAttr { - type Error = (); - - fn try_from(body: &'a comp::Body) -> Result { - match body { - comp::Body::Humanoid(body) => Ok(SkeletonAttr::from(body)), - _ => Err(()), - } - } -} - impl<'a> From<&'a comp::humanoid::Body> for SkeletonAttr { fn from(body: &'a comp::humanoid::Body) -> Self { use comp::humanoid::{BodyType::*, Race::*}; @@ -194,69 +203,43 @@ impl<'a> From<&'a comp::humanoid::Body> for SkeletonAttr { (Danari, Male) => 1.15, (Danari, Female) => 1.15, }, - neck_height: match (body.race, body.body_type) { - (Orc, Male) => 0.0, - (Orc, Female) => 0.0, - (Human, Male) => 0.0, - (Human, Female) => 0.0, - (Elf, Male) => 0.0, - (Elf, Female) => 0.0, - (Dwarf, Male) => 0.0, - (Dwarf, Female) => 0.0, - (Undead, Male) => 0.5, - (Undead, Female) => 0.5, - (Danari, Male) => 0.5, - (Danari, Female) => 0.5, + head: match (body.race, body.body_type) { + (Orc, Male) => (0.0, 14.0), + (Orc, Female) => (0.0, 14.0), + (Human, Male) => (0.0, 14.5), + (Human, Female) => (0.0, 14.0), + (Elf, Male) => (0.0, 14.5), + (Elf, Female) => (0.0, 14.5), + (Dwarf, Male) => (0.0, 14.5), + (Dwarf, Female) => (0.0, 14.0), + (Undead, Male) => (0.5, 14.5), + (Undead, Female) => (0.5, 14.5), + (Danari, Male) => (0.5, 14.0), + (Danari, Female) => (0.5, 14.0), }, - neck_forward: match (body.race, body.body_type) { - (Orc, Male) => 0.0, - (Orc, Female) => 0.0, - (Human, Male) => 0.5, - (Human, Female) => 0.0, - (Elf, Male) => 0.5, - (Elf, Female) => 0.5, - (Dwarf, Male) => 0.5, - (Dwarf, Female) => 0.0, - (Undead, Male) => 0.5, - (Undead, Female) => 0.5, - (Danari, Male) => 0.0, - (Danari, Female) => 0.0, + chest: match (body.race, body.body_type) { + (_, _) => (0.0, 7.0), }, - neck_right: match (body.race, body.body_type) { - (Orc, Male) => 0.0, - (Orc, Female) => 0.0, - (Human, Male) => 0.0, - (Human, Female) => 0.0, - (Elf, Male) => 0.0, - (Elf, Female) => 0.0, - (Dwarf, Male) => 0.0, - (Dwarf, Female) => 0.0, - (Undead, Male) => 0.0, - (Undead, Female) => 0.0, - (Danari, Male) => 0.0, - (Danari, Female) => 0.0, + belt: match (body.race, body.body_type) { + (_, _) => (0.0, -2.0), }, - weapon_x: match ToolKind::Empty { - ToolKind::Sword(_) => 0.0, - ToolKind::Axe(_) => 3.0, - ToolKind::Hammer(_) => 0.0, - ToolKind::Shield(_) => 3.0, - ToolKind::Staff(_) => 3.0, - ToolKind::Bow(_) => 0.0, - ToolKind::Dagger(_) => 0.0, - ToolKind::Debug(_) => 0.0, - ToolKind::Empty => 0.0, + back: match (body.race, body.body_type) { + (_, _) => (-3.1, 7.25), }, - weapon_y: match ToolKind::Empty { - ToolKind::Sword(_) => -1.25, - ToolKind::Axe(_) => 0.0, - ToolKind::Hammer(_) => -2.0, - ToolKind::Shield(_) => 0.0, - ToolKind::Staff(_) => 0.0, - ToolKind::Bow(_) => -2.0, - ToolKind::Dagger(_) => -2.0, - ToolKind::Debug(_) => 0.0, - ToolKind::Empty => 0.0, + shorts: match (body.race, body.body_type) { + (_, _) => (0.0, -5.0), + }, + hand: match (body.race, body.body_type) { + (_, _) => (7.0, -0.25, 5.0), + }, + foot: match (body.race, body.body_type) { + (_, _) => (3.4, -0.1, 8.0), + }, + shoulder: match (body.race, body.body_type) { + (_, _) => (5.0, 0.0, 5.0), + }, + lantern: match (body.race, body.body_type) { + (_, _) => (5.0, 2.5, 5.5), }, } } diff --git a/voxygen/src/anim/character/roll.rs b/voxygen/src/anim/character/roll.rs index e7fde1f91c..c37500335c 100644 --- a/voxygen/src/anim/character/roll.rs +++ b/voxygen/src/anim/character/roll.rs @@ -40,29 +40,41 @@ impl Animation for RollAnimation { } * 1.3; next.head.offset = Vec3::new( - 0.0 + skeleton_attr.neck_right, - -2.0 + skeleton_attr.neck_forward, - skeleton_attr.neck_height + 12.0 + wave_dub * -8.0, + 0.0, + -2.0 + skeleton_attr.head.0, + skeleton_attr.head.1 + wave_dub * -8.0, ); next.head.ori = Quaternion::rotation_x(wave_dub * 0.4); next.head.scale = Vec3::one(); - next.chest.offset = Vec3::new(0.0, 0.0, 7.0 + wave_dub * -5.0); + next.chest.offset = Vec3::new( + 0.0, + skeleton_attr.chest.0, + skeleton_attr.chest.1 + wave_dub * -5.0, + ); next.chest.ori = Quaternion::rotation_x(wave_dub * 0.4); next.chest.scale = Vec3::one() * 1.01; - next.belt.offset = Vec3::new(0.0, 0.0, -2.0 + wave_dub * -3.0); + next.belt.offset = Vec3::new( + 0.0, + skeleton_attr.belt.0, + skeleton_attr.belt.0 + wave_dub * -3.0, + ); next.belt.ori = Quaternion::rotation_x(0.0 + wave_dub * 0.4); next.belt.scale = Vec3::one(); - next.shorts.offset = Vec3::new(0.0, 0.0, -5.0 + wave_dub * -2.0); + next.shorts.offset = Vec3::new( + 0.0, + skeleton_attr.shorts.0, + skeleton_attr.shorts.0 + wave_dub * -2.0, + ); next.shorts.ori = Quaternion::rotation_x(0.0 + wave_dub * 0.4); next.shorts.scale = Vec3::one(); next.l_hand.offset = Vec3::new( - -5.5 + wave * -0.5, - -2.0 + wave_quick_cos * -5.5, - 1.0 + wave_quick * 0.5, + -skeleton_attr.chest.0 + wave * -0.5, + skeleton_attr.hand.1 + wave_quick_cos * -5.5, + skeleton_attr.hand.2 + wave_quick * 0.5, ); next.l_hand.ori = @@ -70,53 +82,61 @@ impl Animation for RollAnimation { next.l_hand.scale = Vec3::one(); next.r_hand.offset = Vec3::new( - 5.5 + wave * 0.5, - -2.0 + wave_quick_cos * 2.5, - 1.0 + wave_quick * 3.0, + skeleton_attr.hand.0 + wave * 0.5, + skeleton_attr.hand.1 + wave_quick_cos * 2.5, + skeleton_attr.hand.2 + wave_quick * 3.0, ); next.r_hand.ori = Quaternion::rotation_x(wave_slow * 6.5) * Quaternion::rotation_y(wave * 0.3); next.r_hand.scale = Vec3::one(); - next.l_foot.offset = Vec3::new(-3.4, -0.1, 10.0 - 0.0 + wave_dub * -1.2 + wave_slow * 4.0); + next.l_foot.offset = Vec3::new( + -skeleton_attr.foot.0, + skeleton_attr.foot.1, + skeleton_attr.foot.2 + wave_dub * -1.2 + wave_slow * 4.0, + ); next.l_foot.ori = Quaternion::rotation_x(wave * 0.6); next.l_foot.scale = Vec3::one(); - next.r_foot.offset = Vec3::new(3.4, -0.1, 10.0 - 0.0 + wave_dub * -1.0 + wave_slow * 4.0); + next.r_foot.offset = Vec3::new( + skeleton_attr.foot.0, + skeleton_attr.foot.1, + skeleton_attr.foot.2 + wave_dub * -1.0 + wave_slow * 4.0, + ); next.r_foot.ori = Quaternion::rotation_x(wave * -0.4); next.r_foot.scale = Vec3::one(); - next.l_shoulder.offset = Vec3::new(-5.0, 0.0, 4.7); + next.l_shoulder.offset = Vec3::new( + -skeleton_attr.shoulder.0, + skeleton_attr.shoulder.0, + skeleton_attr.shoulder.2, + ); next.l_shoulder.ori = Quaternion::rotation_x(0.0); next.l_shoulder.scale = Vec3::one() * 1.1; - next.r_shoulder.offset = Vec3::new(5.0, 0.0, 4.7); + next.r_shoulder.offset = Vec3::new( + skeleton_attr.shoulder.0, + skeleton_attr.shoulder.0, + skeleton_attr.shoulder.2, + ); next.r_shoulder.ori = Quaternion::rotation_x(0.0); next.r_shoulder.scale = Vec3::one() * 1.1; - next.glider.offset = Vec3::new(0.0, 5.0, 0.0); - next.glider.ori = Quaternion::rotation_y(0.0); + next.glider.offset = Vec3::new(0.0, 0.0, 10.0); next.glider.scale = Vec3::one() * 0.0; - next.main.offset = Vec3::new( - -7.0 + skeleton_attr.weapon_x, - -5.0 + skeleton_attr.weapon_y, - 15.0, - ); - next.main.ori = Quaternion::rotation_y(2.5) - * Quaternion::rotation_z(1.57) - * Quaternion::rotation_x(0.0); + next.main.offset = Vec3::new(-7.0, -5.0, 15.0); + next.main.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57); next.main.scale = Vec3::one(); - next.second.offset = Vec3::new( - 0.0 + skeleton_attr.weapon_x, - 0.0 + skeleton_attr.weapon_y, - 0.0, - ); - next.second.ori = Quaternion::rotation_y(0.0); + next.second.offset = Vec3::new(0.0, 0.0, 0.0); next.second.scale = Vec3::one() * 0.0; - next.lantern.offset = Vec3::new(-5.0, 2.5, 5.5); + next.lantern.offset = Vec3::new( + skeleton_attr.lantern.0, + skeleton_attr.lantern.1, + skeleton_attr.lantern.2, + ); next.lantern.ori = Quaternion::rotation_x(0.1) * Quaternion::rotation_y(0.1); next.lantern.scale = Vec3::one() * 0.65; diff --git a/voxygen/src/anim/character/run.rs b/voxygen/src/anim/character/run.rs index 64d41f5e67..0e2ad0ef0f 100644 --- a/voxygen/src/anim/character/run.rs +++ b/voxygen/src/anim/character/run.rs @@ -91,84 +91,97 @@ impl Animation for RunAnimation { next.head.offset = Vec3::new( 0.0, - -3.0 + skeleton_attr.neck_forward, - skeleton_attr.neck_height + 13.0 + short * 0.3, + -3.0 + skeleton_attr.head.0, + -1.0 + skeleton_attr.head.1 + short * 0.3, ); next.head.ori = Quaternion::rotation_z(head_look.x + long * -0.1 - short * 0.3) * Quaternion::rotation_x(head_look.y + 0.35); next.head.scale = Vec3::one() * skeleton_attr.head_scale; - next.chest.offset = Vec3::new(0.0, 0.0, 10.5 + short * 1.1 - lower); + next.chest.offset = Vec3::new( + 0.0, + skeleton_attr.chest.0, + skeleton_attr.chest.1 + 1.0 + short * 1.1 - lower, + ); next.chest.ori = Quaternion::rotation_z(short * 0.3 * walkintensity); next.chest.scale = Vec3::one(); - next.belt.offset = Vec3::new(0.0, 0.0, -2.0); + next.belt.offset = Vec3::new(0.0, skeleton_attr.belt.0, skeleton_attr.belt.1); next.belt.ori = Quaternion::rotation_z(short * 0.25); next.belt.scale = Vec3::one(); - next.back.offset = Vec3::new(0.0, -2.8, 7.25); + next.back.offset = Vec3::new(0.0, skeleton_attr.back.0, skeleton_attr.back.1); next.back.ori = Quaternion::rotation_x(-0.25 + short * 0.1 + noisea * 0.1 + noiseb * 0.1); next.back.scale = Vec3::one() * 1.02; - next.shorts.offset = Vec3::new(0.0, 0.0, -5.0); + next.shorts.offset = Vec3::new(0.0, skeleton_attr.shorts.0, skeleton_attr.shorts.1); next.shorts.ori = Quaternion::rotation_z(short * 0.4); next.shorts.scale = Vec3::one(); next.l_hand.offset = Vec3::new( - -6.0 + wave_stop * -1.0 * walkintensity, - -0.25 + short * 3.0 * walkintensity, - 5.0 + short * -1.5 * walkintensity, + -skeleton_attr.hand.0 + wave_stop * 1.0 * walkintensity, + skeleton_attr.hand.1 + short * 3.0 * walkintensity, + 1.0 + skeleton_attr.hand.2 + short * -1.5 * walkintensity, ); - next.l_hand.ori = Quaternion::rotation_x(0.8 + short * 1.2 * walk) - * Quaternion::rotation_y(wave_stop * 0.1); + next.l_hand.ori = Quaternion::rotation_x(0.2 + short * 1.2 * walk) + * Quaternion::rotation_y(wave_stop * -0.1); next.l_hand.scale = Vec3::one(); next.r_hand.offset = Vec3::new( - 6.0 + wave_stop * 1.0 * walkintensity, - -0.25 + short * -3.0 * walkintensity, - 5.0 + short * 1.5 * walkintensity, + skeleton_attr.hand.0 + wave_stop * -1.0 * walkintensity, + skeleton_attr.hand.1 + short * -3.0 * walkintensity, + 1.0 + skeleton_attr.hand.2 + short * 1.5 * walkintensity, ); - next.r_hand.ori = Quaternion::rotation_x(0.8 + short * -1.2 * walk) - * Quaternion::rotation_y(wave_stop * -0.1); + next.r_hand.ori = Quaternion::rotation_x(0.2 + short * -1.2 * walk) + * Quaternion::rotation_y(wave_stop * 0.1); next.r_hand.scale = Vec3::one(); - next.l_foot.offset = Vec3::new(-3.4, foot * 1.0, 9.5); + next.l_foot.offset = Vec3::new( + -skeleton_attr.foot.0, + -skeleton_attr.foot.1 + foot * 1.0, + skeleton_attr.foot.2 + 1.0, + ); next.l_foot.ori = Quaternion::rotation_x(foot * -1.2 * walkintensity); next.l_foot.scale = Vec3::one(); - next.r_foot.offset = Vec3::new(3.4, foot * -1.0, 9.5); + next.r_foot.offset = Vec3::new( + skeleton_attr.foot.0, + -skeleton_attr.foot.1 + foot * -1.0, + skeleton_attr.foot.2 + 1.0, + ); next.r_foot.ori = Quaternion::rotation_x(foot * 1.2 * walkintensity); next.r_foot.scale = Vec3::one(); - next.l_shoulder.offset = Vec3::new(-5.0, -1.0, 4.7); + next.l_shoulder.offset = Vec3::new( + -skeleton_attr.shoulder.0, + skeleton_attr.shoulder.1, + skeleton_attr.shoulder.2, + ); next.l_shoulder.ori = Quaternion::rotation_x(short * 0.15 * walkintensity); next.l_shoulder.scale = Vec3::one() * 1.1; - next.r_shoulder.offset = Vec3::new(5.0, -1.0, 4.7); + next.r_shoulder.offset = Vec3::new( + skeleton_attr.shoulder.0, + skeleton_attr.shoulder.1, + skeleton_attr.shoulder.2, + ); next.r_shoulder.ori = Quaternion::rotation_x(short * -0.15 * walkintensity); next.r_shoulder.scale = Vec3::one() * 1.1; next.glider.offset = Vec3::new(0.0, 0.0, 10.0); - next.glider.ori = Quaternion::rotation_y(0.0); next.glider.scale = Vec3::one() * 0.0; - next.main.offset = Vec3::new( - -7.0 + skeleton_attr.weapon_x, - -6.5 + skeleton_attr.weapon_y, - 15.0, - ); + next.main.offset = Vec3::new(-7.0, -6.5, 15.0); next.main.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57 + short * 0.25); next.main.scale = Vec3::one(); - next.second.offset = Vec3::new( - 0.0 + skeleton_attr.weapon_x, - 0.0 + skeleton_attr.weapon_y, - 0.0, - ); - next.second.ori = Quaternion::rotation_y(0.0); next.second.scale = Vec3::one() * 0.0; - next.lantern.offset = Vec3::new(-5.0, 2.5, 5.5); + next.lantern.offset = Vec3::new( + skeleton_attr.lantern.0, + skeleton_attr.lantern.1, + skeleton_attr.lantern.2, + ); next.lantern.ori = Quaternion::rotation_x(shorte * -0.7 + 0.4) * Quaternion::rotation_y(shorte * 0.4); next.lantern.scale = Vec3::one() * 0.65; @@ -183,12 +196,8 @@ impl Animation for RunAnimation { next.control.ori = Quaternion::rotation_x(0.0); next.control.scale = Vec3::one(); - next.l_control.offset = Vec3::new(0.0, 0.0, 0.0); - next.l_control.ori = Quaternion::rotation_x(0.0); next.l_control.scale = Vec3::one(); - next.r_control.offset = Vec3::new(0.0, 0.0, 0.0); - next.r_control.ori = Quaternion::rotation_x(0.0); next.r_control.scale = Vec3::one(); next diff --git a/voxygen/src/anim/character/shoot.rs b/voxygen/src/anim/character/shoot.rs index 50525f6a49..8a59399797 100644 --- a/voxygen/src/anim/character/shoot.rs +++ b/voxygen/src/anim/character/shoot.rs @@ -32,27 +32,31 @@ impl Animation for ShootAnimation { let exp = ((anim_time as f32).powf(0.3 as f32)).min(1.2); - next.head.offset = Vec3::new( - 0.0 + skeleton_attr.neck_right, - -2.0 + skeleton_attr.neck_forward, - skeleton_attr.neck_height + 14.0, - ); + next.head.offset = Vec3::new(0.0, -2.0 + skeleton_attr.head.0, skeleton_attr.head.1); next.head.ori = Quaternion::rotation_z(exp * -0.4) * Quaternion::rotation_x(0.0) * Quaternion::rotation_y(exp * 0.1); next.head.scale = Vec3::one() * skeleton_attr.head_scale; - next.chest.offset = Vec3::new(0.0, 0.0 - exp * 1.5, 7.0); + next.chest.offset = Vec3::new( + 0.0, + skeleton_attr.chest.0 - exp * 1.5, + skeleton_attr.chest.1, + ); next.chest.ori = Quaternion::rotation_z(0.4 + exp * 1.0) * Quaternion::rotation_x(0.0 + exp * 0.2) * Quaternion::rotation_y(exp * -0.08); next.chest.scale = Vec3::one(); - next.belt.offset = Vec3::new(0.0, 0.0 + exp * 1.0, -2.0); + next.belt.offset = Vec3::new(0.0, skeleton_attr.belt.0 + exp * 1.0, skeleton_attr.belt.1); next.belt.ori = next.chest.ori * -0.1; next.belt.scale = Vec3::one(); - next.shorts.offset = Vec3::new(0.0, exp * 1.0, -5.0); + next.shorts.offset = Vec3::new( + 0.0, + skeleton_attr.shorts.0 + exp * 1.0, + skeleton_attr.shorts.1, + ); next.shorts.ori = next.chest.ori * -0.08; next.shorts.scale = Vec3::one(); @@ -154,7 +158,11 @@ impl Animation for ShootAnimation { next.glider.ori = Quaternion::rotation_y(0.0); next.glider.scale = Vec3::one() * 0.0; - next.lantern.offset = Vec3::new(-5.0, 2.5, 5.5); + next.lantern.offset = Vec3::new( + skeleton_attr.lantern.0, + skeleton_attr.lantern.1, + skeleton_attr.lantern.2, + ); next.lantern.ori = Quaternion::rotation_x(exp * -0.7 + 0.4) * Quaternion::rotation_y(exp * 0.4); next.lantern.scale = Vec3::one() * 0.65; diff --git a/voxygen/src/anim/character/sit.rs b/voxygen/src/anim/character/sit.rs index e9eea8063b..ff02bc3a86 100644 --- a/voxygen/src/anim/character/sit.rs +++ b/voxygen/src/anim/character/sit.rs @@ -36,93 +36,110 @@ impl Animation for SitAnimation { * 0.125, ); next.head.offset = Vec3::new( - 0.0 + skeleton_attr.neck_right, - -3.0 + skeleton_attr.neck_forward, - skeleton_attr.neck_height + 14.0 + slow * 0.1 + stop * -0.8, + 0.0, + -3.0 + skeleton_attr.head.0, + skeleton_attr.head.1 + slow * 0.1 + stop * -0.8, ); next.head.ori = Quaternion::rotation_z(head_look.x + slow * 0.2 - slow * 0.1) * Quaternion::rotation_x((slowa * -0.1 + slow * 0.1 + head_look.y).abs()); next.head.scale = Vec3::one() * skeleton_attr.head_scale; - next.chest.offset = Vec3::new(0.0, stop * -0.4, 7.0 + slow * 0.1 + stop * -0.8); + next.chest.offset = Vec3::new( + 0.0, + skeleton_attr.chest.0 + stop * -0.4, + skeleton_attr.chest.1 + slow * 0.1 + stop * -0.8, + ); next.chest.ori = Quaternion::rotation_x(stop * 0.15); next.chest.scale = Vec3::one() + slow_abs * 0.05; - next.belt.offset = Vec3::new(0.0, stop * 1.2, -2.0); + next.belt.offset = Vec3::new(0.0, skeleton_attr.belt.0 + stop * 1.2, skeleton_attr.belt.1); next.belt.ori = Quaternion::rotation_x(stop * 0.3); next.belt.scale = (Vec3::one() + slow_abs * 0.05) * 1.02; - next.back.offset = Vec3::new(0.0, -2.8, 7.25); - next.back.ori = Quaternion::rotation_z(0.0); + next.back.offset = Vec3::new(0.0, skeleton_attr.back.0, skeleton_attr.back.1); next.back.scale = Vec3::one() * 1.02; - next.shorts.offset = Vec3::new(0.0, stop * 2.5, -5.0 + stop * 0.6); + next.shorts.offset = Vec3::new( + 0.0, + skeleton_attr.shorts.0 + stop * 2.5, + skeleton_attr.shorts.1 + stop * 0.6, + ); next.shorts.ori = Quaternion::rotation_x(stop * 0.6); next.shorts.scale = Vec3::one(); - next.l_hand.offset = Vec3::new(-6.0, -0.25 + slowa * 0.15, 6.0 + slow * 0.7 + stop * -2.0); - - next.l_hand.ori = Quaternion::rotation_x(0.0 + slowa * -0.1 + slow * 0.1); + next.l_hand.offset = Vec3::new( + -skeleton_attr.hand.0, + skeleton_attr.hand.1 + slowa * 0.15, + skeleton_attr.hand.2 + slow * 0.7 + stop * -2.0, + ); + next.l_hand.ori = Quaternion::rotation_x(slowa * -0.1 + slow * 0.1); next.l_hand.scale = Vec3::one() + slow_abs * -0.05; - next.r_hand.offset = Vec3::new(6.0, -0.25 + slowa * 0.15, 6.0 + slow * 0.7 + stop * -2.0); - next.r_hand.ori = Quaternion::rotation_x(0.0 + slow * -0.1 + slowa * 0.1); + next.r_hand.offset = Vec3::new( + skeleton_attr.hand.0, + skeleton_attr.hand.1 + slowa * 0.15, + skeleton_attr.hand.2 + slow * 0.7 + stop * -2.0, + ); + next.r_hand.ori = Quaternion::rotation_x(slow * -0.1 + slowa * 0.1); next.r_hand.scale = Vec3::one() + slow_abs * -0.05; - next.l_foot.offset = Vec3::new(-3.4, -0.1, 8.0); + next.l_foot.offset = Vec3::new( + -skeleton_attr.foot.0, + skeleton_attr.foot.1, + skeleton_attr.foot.2, + ); next.l_foot.ori = Quaternion::rotation_x(slow * 0.1 + stop * 1.2 + slow * 0.1); next.l_foot.scale = Vec3::one(); - next.r_foot.offset = Vec3::new(3.4, -0.1, 8.0); + next.r_foot.offset = Vec3::new( + skeleton_attr.foot.0, + skeleton_attr.foot.1, + skeleton_attr.foot.2, + ); next.r_foot.ori = Quaternion::rotation_x(slowa * 0.1 + stop * 1.2 + slowa * 0.1); next.r_foot.scale = Vec3::one(); - next.l_shoulder.offset = Vec3::new(-5.0, 0.0, 4.7); + next.l_shoulder.offset = Vec3::new( + -skeleton_attr.shoulder.0, + skeleton_attr.shoulder.1, + skeleton_attr.shoulder.2, + ); next.l_shoulder.ori = Quaternion::rotation_x(0.0); next.l_shoulder.scale = (Vec3::one() + slow_abs * -0.05) * 1.15; - next.r_shoulder.offset = Vec3::new(5.0, 0.0, 4.7); + next.r_shoulder.offset = Vec3::new( + skeleton_attr.shoulder.0, + skeleton_attr.shoulder.1, + skeleton_attr.shoulder.2, + ); next.r_shoulder.ori = Quaternion::rotation_x(0.0); next.r_shoulder.scale = (Vec3::one() + slow_abs * -0.05) * 1.15; - next.glider.offset = Vec3::new(0.0, 5.0, 0.0); - next.glider.ori = Quaternion::rotation_y(0.0); + next.glider.offset = Vec3::new(0.0, 0.0, 10.0); next.glider.scale = Vec3::one() * 0.0; - next.main.offset = Vec3::new( - -7.0 + skeleton_attr.weapon_x, - -5.0 + skeleton_attr.weapon_y, - 15.0, - ); + next.main.offset = Vec3::new(-7.0, -5.0, 15.0); next.main.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57); next.main.scale = Vec3::one() + slow_abs * -0.05; - next.second.offset = Vec3::new( - 0.0 + skeleton_attr.weapon_x, - 0.0 + skeleton_attr.weapon_y, - 0.0, - ); + next.second.offset = Vec3::new(0.0, 0.0, 0.0); next.second.ori = Quaternion::rotation_y(0.0); next.second.scale = Vec3::one() * 0.0; - next.lantern.offset = Vec3::new(0.0, 0.0, 0.0); - next.lantern.ori = Quaternion::rotation_x(0.0); - next.lantern.scale = Vec3::one() * 0.0; + next.lantern.offset = Vec3::new( + skeleton_attr.lantern.0, + skeleton_attr.lantern.1, + skeleton_attr.lantern.2, + ); + next.lantern.scale = Vec3::one() * 0.65; next.torso.offset = Vec3::new(0.0, -0.2, stop * -0.16) * skeleton_attr.scaler; - next.torso.ori = Quaternion::rotation_x(0.0); next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler; - next.control.offset = Vec3::new(0.0, 0.0, 0.0); - next.control.ori = Quaternion::rotation_x(0.0); next.control.scale = Vec3::one(); - next.l_control.offset = Vec3::new(0.0, 0.0, 0.0); - next.l_control.ori = Quaternion::rotation_x(0.0); next.l_control.scale = Vec3::one(); - next.r_control.offset = Vec3::new(0.0, 0.0, 0.0); - next.r_control.ori = Quaternion::rotation_x(0.0); next.r_control.scale = Vec3::one(); next } diff --git a/voxygen/src/anim/character/spin.rs b/voxygen/src/anim/character/spin.rs index b82ae289b5..6d59184618 100644 --- a/voxygen/src/anim/character/spin.rs +++ b/voxygen/src/anim/character/spin.rs @@ -56,15 +56,14 @@ impl Animation for SpinAnimation { * Quaternion::rotation_z(1.4 + spin * 0.1); next.control.scale = Vec3::one(); next.head.offset = Vec3::new( - 0.0 + skeleton_attr.neck_right, - -2.0 + skeleton_attr.neck_forward + spin * -0.8, - skeleton_attr.neck_height + 14.0, + 0.0, + -2.0 + skeleton_attr.head.0 + spin * -0.8, + skeleton_attr.head.1, ); next.head.ori = Quaternion::rotation_z(spin * -0.25) * Quaternion::rotation_x(0.0 + spin * -0.1) * Quaternion::rotation_y(spin * -0.2); - next.head.scale = Vec3::one() * skeleton_attr.head_scale; - next.chest.offset = Vec3::new(0.0, 0.0, 7.0); + next.chest.offset = Vec3::new(0.0, skeleton_attr.chest.0, skeleton_attr.chest.1); next.chest.ori = Quaternion::rotation_z(spin * 0.1) * Quaternion::rotation_x(0.0 + spin * 0.1) * Quaternion::rotation_y(decel * -0.2); @@ -106,7 +105,11 @@ impl Animation for SpinAnimation { next.glider.ori = Quaternion::rotation_y(0.0); next.glider.scale = Vec3::one() * 0.0; - next.lantern.offset = Vec3::new(-5.0, 2.5, 5.5); + next.lantern.offset = Vec3::new( + skeleton_attr.lantern.0, + skeleton_attr.lantern.1, + skeleton_attr.lantern.2, + ); next.lantern.ori = Quaternion::rotation_x(spin * -0.7 + 0.4) * Quaternion::rotation_y(spin * 0.4); next.lantern.scale = Vec3::one() * 0.65; diff --git a/voxygen/src/anim/character/stand.rs b/voxygen/src/anim/character/stand.rs index 486d350313..9baadafbf7 100644 --- a/voxygen/src/anim/character/stand.rs +++ b/voxygen/src/anim/character/stand.rs @@ -34,76 +34,93 @@ impl Animation for StandAnimation { * 0.15, ); next.head.offset = Vec3::new( - 0.0 + skeleton_attr.neck_right, - -3.0 + skeleton_attr.neck_forward, - skeleton_attr.neck_height + 14.0 + slow * 0.3 + breathe * -0.05, + 0.0, + -3.0 + skeleton_attr.head.0, + skeleton_attr.head.1 + slow * 0.3 + breathe * -0.05, ); next.head.ori = Quaternion::rotation_z(head_look.x) * Quaternion::rotation_x(head_look.y.abs()); next.head.scale = Vec3::one() * skeleton_attr.head_scale + breathe * -0.05; - next.chest.offset = Vec3::new(0.0, 0.0, 7.0 + slow * 0.3); + next.chest.offset = Vec3::new( + 0.0, + skeleton_attr.chest.0, + skeleton_attr.chest.1 + slow * 0.3, + ); next.chest.ori = Quaternion::rotation_z(head_look.x * 0.6); next.chest.scale = Vec3::one() * 1.01 + breathe * 0.03; - next.belt.offset = Vec3::new(0.0, 0.0, -2.0); + next.belt.offset = Vec3::new(0.0, skeleton_attr.belt.0, skeleton_attr.belt.1); next.belt.ori = Quaternion::rotation_z(head_look.x * -0.1); next.belt.scale = Vec3::one() + breathe * -0.03; - next.back.offset = Vec3::new(0.0, -2.8, 7.25); - next.back.ori = Quaternion::rotation_z(0.0); + next.back.offset = Vec3::new(0.0, skeleton_attr.back.0, skeleton_attr.back.1); next.back.scale = Vec3::one() * 1.02; - next.shorts.offset = Vec3::new(0.0, 0.0, -5.0); + next.shorts.offset = Vec3::new(0.0, skeleton_attr.shorts.0, skeleton_attr.shorts.1); next.shorts.ori = Quaternion::rotation_z(head_look.x * -0.2); next.shorts.scale = Vec3::one() + breathe * -0.03; - next.l_hand.offset = Vec3::new(-7.0, -0.25 + slow * 0.15, 5.0 + slow * 0.5); + next.l_hand.offset = Vec3::new( + -skeleton_attr.hand.0, + skeleton_attr.hand.1 + slow * 0.15, + skeleton_attr.hand.2 + slow * 0.5, + ); - next.l_hand.ori = Quaternion::rotation_x(0.0 + slow * -0.06); + next.l_hand.ori = Quaternion::rotation_x(slow * -0.06); next.l_hand.scale = Vec3::one(); - next.r_hand.offset = Vec3::new(7.0, -0.25 + slow * 0.15, 5.0 + slow * 0.5); - next.r_hand.ori = Quaternion::rotation_x(0.0 + slow * -0.06); + next.r_hand.offset = Vec3::new( + skeleton_attr.hand.0, + skeleton_attr.hand.1 + slow * 0.15, + skeleton_attr.hand.2 + slow * 0.5, + ); + next.r_hand.ori = Quaternion::rotation_x(slow * -0.06); next.r_hand.scale = Vec3::one(); - next.l_foot.offset = Vec3::new(-3.4, -0.1, 8.0); - next.l_foot.ori = Quaternion::identity(); + next.l_foot.offset = Vec3::new( + -skeleton_attr.foot.0, + skeleton_attr.foot.1, + skeleton_attr.foot.2, + ); next.l_foot.scale = Vec3::one(); - next.r_foot.offset = Vec3::new(3.4, -0.1, 8.0); - next.r_foot.ori = Quaternion::identity(); + next.r_foot.offset = Vec3::new( + skeleton_attr.foot.0, + skeleton_attr.foot.1, + skeleton_attr.foot.2, + ); next.r_foot.scale = Vec3::one(); - next.l_shoulder.offset = Vec3::new(-5.0, 0.0, 5.0); - next.l_shoulder.ori = Quaternion::rotation_x(0.0); + next.l_shoulder.offset = Vec3::new( + -skeleton_attr.shoulder.0, + skeleton_attr.shoulder.1, + skeleton_attr.shoulder.2, + ); next.l_shoulder.scale = (Vec3::one() + breathe * -0.05) * 1.15; - next.r_shoulder.offset = Vec3::new(5.0, 0.0, 5.0); - next.r_shoulder.ori = Quaternion::rotation_x(0.0); + next.r_shoulder.offset = Vec3::new( + skeleton_attr.shoulder.0, + skeleton_attr.shoulder.1, + skeleton_attr.shoulder.2, + ); next.r_shoulder.scale = (Vec3::one() + breathe * -0.05) * 1.15; next.glider.offset = Vec3::new(0.0, 0.0, 10.0); - next.glider.ori = Quaternion::rotation_y(0.0); next.glider.scale = Vec3::one() * 0.0; - next.main.offset = Vec3::new( - -7.0 + skeleton_attr.weapon_x, - -5.0 + skeleton_attr.weapon_y, - 15.0, - ); + next.main.offset = Vec3::new(-7.0, -5.0, 15.0); next.main.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57); next.main.scale = Vec3::one(); - next.second.offset = Vec3::new( - 0.0 + skeleton_attr.weapon_x, - 0.0 + skeleton_attr.weapon_y, - 0.0, - ); - next.second.ori = Quaternion::rotation_y(0.0); + next.second.offset = Vec3::new(0.0, 0.0, 0.0); next.second.scale = Vec3::one() * 0.0; - next.lantern.offset = Vec3::new(-5.0, 2.5, 5.5); + next.lantern.offset = Vec3::new( + skeleton_attr.lantern.0, + skeleton_attr.lantern.1, + skeleton_attr.lantern.2, + ); next.lantern.ori = Quaternion::rotation_x(0.1) * Quaternion::rotation_y(0.1); next.lantern.scale = Vec3::one() * 0.65; @@ -111,16 +128,10 @@ impl Animation for StandAnimation { next.torso.ori = Quaternion::rotation_x(0.0); next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler; - next.control.offset = Vec3::new(0.0, 0.0, 0.0); - next.control.ori = Quaternion::rotation_x(0.0); next.control.scale = Vec3::one(); - next.l_control.offset = Vec3::new(0.0, 0.0, 0.0); - next.l_control.ori = Quaternion::rotation_x(0.0); next.l_control.scale = Vec3::one(); - next.r_control.offset = Vec3::new(0.0, 0.0, 0.0); - next.r_control.ori = Quaternion::rotation_x(0.0); next.r_control.scale = Vec3::one(); next } diff --git a/voxygen/src/anim/character/swim.rs b/voxygen/src/anim/character/swim.rs index 5836f7e23e..35787b7804 100644 --- a/voxygen/src/anim/character/swim.rs +++ b/voxygen/src/anim/character/swim.rs @@ -46,74 +46,95 @@ impl Animation for SwimAnimation { next.head.offset = Vec3::new( 0.0, - -3.0 + skeleton_attr.neck_forward, - skeleton_attr.neck_height + 13.0 + short * 0.3, + -3.0 + skeleton_attr.head.0, + skeleton_attr.head.1 - 1.0 + short * 0.3, ); next.head.ori = Quaternion::rotation_z(head_look.x - short * 0.4) * Quaternion::rotation_x(head_look.y + 0.35 + speed * 0.045); next.head.scale = Vec3::one() * skeleton_attr.head_scale; - next.chest.offset = Vec3::new(0.0, 0.0, 7.0 + short * 1.3); + next.chest.offset = Vec3::new( + 0.0, + skeleton_attr.chest.0, + skeleton_attr.chest.1 + short * 1.3, + ); next.chest.ori = Quaternion::rotation_z(short * 0.4); next.chest.scale = Vec3::one(); - next.belt.offset = Vec3::new(0.0, 0.0, -2.0); + next.belt.offset = Vec3::new(0.0, skeleton_attr.belt.0, skeleton_attr.belt.1); next.belt.ori = Quaternion::rotation_z(short * 0.30); next.belt.scale = Vec3::one(); - next.back.offset = Vec3::new(0.0, -2.8, 7.25); + next.back.offset = Vec3::new(0.0, skeleton_attr.back.0, skeleton_attr.back.1); next.back.ori = Quaternion::rotation_z(0.0); next.back.scale = Vec3::one() * 1.02; - next.shorts.offset = Vec3::new(0.0, 0.0, -5.0); + next.shorts.offset = Vec3::new(0.0, skeleton_attr.shorts.0, skeleton_attr.shorts.1); next.shorts.ori = Quaternion::rotation_z(short * 0.5); next.shorts.scale = Vec3::one(); - next.l_hand.offset = Vec3::new(-6.0, -0.25 - foot * 1.2, 5.0 + foot * -3.0); + next.l_hand.offset = Vec3::new( + -skeleton_attr.hand.0, + skeleton_attr.hand.1 - foot * 1.2, + skeleton_attr.hand.2 + foot * -3.0, + ); next.l_hand.ori = Quaternion::rotation_x(0.8 + foot * -0.6) * Quaternion::rotation_y(0.2); next.l_hand.scale = Vec3::one(); - next.r_hand.offset = Vec3::new(6.0, -0.25 + foot * 1.2, 5.0 + foot * 3.0); + next.r_hand.offset = Vec3::new( + skeleton_attr.hand.0, + skeleton_attr.hand.1 + foot * 1.2, + skeleton_attr.hand.2 + foot * 3.0, + ); next.r_hand.ori = Quaternion::rotation_x(0.8 + foot * 0.6) * Quaternion::rotation_y(-0.2); next.r_hand.scale = Vec3::one(); - next.l_foot.offset = Vec3::new(-3.4, 6.0 + foot * 1.2, 0.0 + foot * 6.5); + next.l_foot.offset = Vec3::new( + -skeleton_attr.foot.0, + 4.0 + skeleton_attr.foot.1 + foot * 1.2, + -5.0 + skeleton_attr.foot.2 + foot * 6.5, + ); next.l_foot.ori = Quaternion::rotation_x(-1.40 + foot * 0.6); next.l_foot.scale = Vec3::one(); - next.r_foot.offset = Vec3::new(3.4, 6.0 - foot * 1.2, 0.0 + foot * -6.5); + next.r_foot.offset = Vec3::new( + skeleton_attr.foot.0, + 4.0 + skeleton_attr.foot.1 - foot * 1.2, + -5.0 + skeleton_attr.foot.2 + foot * -6.5, + ); next.r_foot.ori = Quaternion::rotation_x(-1.40 + foot * -0.6); next.r_foot.scale = Vec3::one(); - next.l_shoulder.offset = Vec3::new(-5.0, -1.0, 4.7); + next.l_shoulder.offset = Vec3::new( + -skeleton_attr.shoulder.0, + skeleton_attr.shoulder.0, + skeleton_attr.shoulder.2, + ); next.l_shoulder.ori = Quaternion::rotation_x(short * 0.15); next.l_shoulder.scale = Vec3::one() * 1.1; - next.r_shoulder.offset = Vec3::new(5.0, -1.0, 4.7); + next.r_shoulder.offset = Vec3::new( + skeleton_attr.shoulder.0, + skeleton_attr.shoulder.0, + skeleton_attr.shoulder.2, + ); next.r_shoulder.ori = Quaternion::rotation_x(short * -0.15); next.r_shoulder.scale = Vec3::one() * 1.1; - next.glider.offset = Vec3::new(0.0, 5.0, 0.0); - next.glider.ori = Quaternion::rotation_y(0.0); + next.glider.offset = Vec3::new(0.0, 0.0, 10.0); next.glider.scale = Vec3::one() * 0.0; - next.main.offset = Vec3::new( - -7.0 + skeleton_attr.weapon_x, - -5.0 + skeleton_attr.weapon_y, - 15.0, - ); + next.main.offset = Vec3::new(-7.0, -5.0, 15.0); next.main.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57 + short * 0.25); next.main.scale = Vec3::one(); - next.second.offset = Vec3::new( - 0.0 + skeleton_attr.weapon_x, - 0.0 + skeleton_attr.weapon_y, - 0.0, - ); - next.second.ori = Quaternion::rotation_y(0.0); next.second.scale = Vec3::one() * 0.0; - next.lantern.offset = Vec3::new(-5.0, 2.5, 5.5); + next.lantern.offset = Vec3::new( + skeleton_attr.lantern.0, + skeleton_attr.lantern.1, + skeleton_attr.lantern.2, + ); next.lantern.ori = Quaternion::rotation_x(0.0) * Quaternion::rotation_y(0.0); next.lantern.scale = Vec3::one() * 0.65; @@ -122,16 +143,10 @@ impl Animation for SwimAnimation { Quaternion::rotation_x(speed * -0.190 * wave_stop * 1.05) * Quaternion::rotation_y(0.0); next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler; - next.control.offset = Vec3::new(0.0, 0.0, 0.0); - next.control.ori = Quaternion::rotation_x(0.0); next.control.scale = Vec3::one(); - next.l_control.offset = Vec3::new(0.0, 0.0, 0.0); - next.l_control.ori = Quaternion::rotation_x(0.0); next.l_control.scale = Vec3::one(); - next.r_control.offset = Vec3::new(0.0, 0.0, 0.0); - next.r_control.ori = Quaternion::rotation_x(0.0); next.r_control.scale = Vec3::one(); next diff --git a/voxygen/src/anim/character/wield.rs b/voxygen/src/anim/character/wield.rs index 403796c601..4458f2df08 100644 --- a/voxygen/src/anim/character/wield.rs +++ b/voxygen/src/anim/character/wield.rs @@ -102,7 +102,7 @@ impl Animation for WieldAnimation { * Quaternion::rotation_y(0.5) * Quaternion::rotation_z(-0.27); next.r_hand.scale = Vec3::one() * 1.05; - next.main.offset = Vec3::new(9.2, 8.4, 13.2); + next.main.offset = Vec3::new(12.0, 8.4, 13.2); next.main.ori = Quaternion::rotation_x(-0.3) * Quaternion::rotation_y(3.14 + 0.3) * Quaternion::rotation_z(0.9); @@ -121,11 +121,7 @@ impl Animation for WieldAnimation { next.r_hand.offset = Vec3::new(-6.0, 3.0, -2.0); next.r_hand.ori = Quaternion::rotation_x(-0.3); next.r_hand.scale = Vec3::one() * 1.01; - next.main.offset = Vec3::new( - -6.0 + skeleton_attr.weapon_x, - 4.5 + skeleton_attr.weapon_y, - 0.0, - ); + next.main.offset = Vec3::new(-6.0, 4.5, 0.0); next.main.ori = Quaternion::rotation_x(-0.3) * Quaternion::rotation_y(0.0) * Quaternion::rotation_z(0.0); @@ -150,27 +146,9 @@ impl Animation for WieldAnimation { next.control.offset = Vec3::new(-7.0, 6.0, 6.0); next.control.ori = Quaternion::rotation_x(ultra_slow * 0.2) - * Quaternion::rotation_y(0.0) * Quaternion::rotation_z(ultra_slow_cos * 0.1); next.control.scale = Vec3::one(); }, - Some(ToolKind::Dagger(_)) => { - next.l_hand.offset = Vec3::new(-6.0, 3.5, 0.0); - next.l_hand.ori = Quaternion::rotation_x(-0.3); - next.l_hand.scale = Vec3::one() * 1.01; - next.r_hand.offset = Vec3::new(-6.0, 3.0, -2.0); - next.r_hand.ori = Quaternion::rotation_x(-0.3); - next.r_hand.scale = Vec3::one() * 1.01; - next.main.offset = Vec3::new( - -6.0 + skeleton_attr.weapon_x, - 4.5 + skeleton_attr.weapon_y, - 0.0, - ); - next.main.ori = Quaternion::rotation_x(-0.3) - * Quaternion::rotation_y(0.0) - * Quaternion::rotation_z(0.0); - next.main.scale = Vec3::one(); - }, Some(ToolKind::Debug(_)) => { next.l_hand.offset = Vec3::new(-7.0, 4.0, 3.0); next.l_hand.ori = Quaternion::rotation_x(1.27 + wave * 0.25) @@ -182,11 +160,7 @@ impl Animation for WieldAnimation { * Quaternion::rotation_y(0.0) * Quaternion::rotation_z(-0.3); next.r_hand.scale = Vec3::one() * 1.01; - next.main.offset = Vec3::new( - 5.0 + skeleton_attr.weapon_x, - 8.75 + skeleton_attr.weapon_y, - -2.0, - ); + next.main.offset = Vec3::new(5.0, 8.75, -2.0); next.main.ori = Quaternion::rotation_x(-0.3) * Quaternion::rotation_y(-1.27) * Quaternion::rotation_z(wave * -0.25); @@ -227,29 +201,33 @@ impl Animation for WieldAnimation { * 0.1, ); next.head.offset = Vec3::new( - 0.0 + skeleton_attr.neck_right, - -2.0 + skeleton_attr.neck_forward, - skeleton_attr.neck_height + 14.0 + ultra_slow * 0.1, + 0.0, + -2.0 + skeleton_attr.head.0, + skeleton_attr.head.1 + ultra_slow * 0.1, ); next.head.ori = Quaternion::rotation_z(head_look.x) * Quaternion::rotation_x(head_look.y.abs()); next.head.scale = Vec3::one() * skeleton_attr.head_scale; - next.chest.offset = Vec3::new(0.0 + slow_cos * 0.5, 0.0, 7.0 + ultra_slow * 0.5); + next.chest.offset = Vec3::new( + 0.0 + slow_cos * 0.5, + skeleton_attr.chest.0, + skeleton_attr.chest.1 + ultra_slow * 0.5, + ); next.chest.ori = Quaternion::rotation_y(ultra_slow_cos * 0.04) * Quaternion::rotation_z(0.15); next.chest.scale = Vec3::one(); - next.belt.offset = Vec3::new(0.0, 0.0, -2.0); + next.belt.offset = Vec3::new(0.0, skeleton_attr.belt.0, skeleton_attr.belt.1); next.belt.ori = Quaternion::rotation_y(ultra_slow_cos * 0.03) * Quaternion::rotation_z(0.22); next.belt.scale = Vec3::one() * 1.02; - next.back.offset = Vec3::new(0.0, -2.8, 7.25); + next.back.offset = Vec3::new(0.0, skeleton_attr.back.0, skeleton_attr.back.1); next.back.ori = Quaternion::rotation_x(-0.2); next.back.scale = Vec3::one() * 1.02; - next.shorts.offset = Vec3::new(0.0, 0.0, -5.0); + next.shorts.offset = Vec3::new(0.0, skeleton_attr.shorts.0, skeleton_attr.shorts.1); next.shorts.ori = Quaternion::rotation_z(0.3); next.shorts.scale = Vec3::one(); @@ -262,15 +240,10 @@ impl Animation for WieldAnimation { next.r_foot.scale = Vec3::one(); next.torso.offset = Vec3::new(0.0, 0.0, 0.0) * skeleton_attr.scaler; - next.torso.ori = Quaternion::rotation_x(0.0); next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler; - next.l_control.offset = Vec3::new(0.0, 0.0, 0.0); - next.l_control.ori = Quaternion::rotation_x(0.0); next.l_control.scale = Vec3::one(); - next.r_control.offset = Vec3::new(0.0, 0.0, 0.0); - next.r_control.ori = Quaternion::rotation_x(0.0); next.r_control.scale = Vec3::one(); } diff --git a/voxygen/src/anim/mod.rs b/voxygen/src/anim/mod.rs index 834e021a27..60e67508c6 100644 --- a/voxygen/src/anim/mod.rs +++ b/voxygen/src/anim/mod.rs @@ -13,7 +13,6 @@ pub mod quadruped_medium; pub mod quadruped_small; use crate::render::FigureBoneData; -use common::comp::{self, item::tool::ToolKind}; use vek::*; #[derive(Copy, Clone, Debug)] @@ -63,139 +62,6 @@ pub trait Skeleton: Send + Sync + 'static { // rustc complains that `SkeletonAttr` fields are never read. // Pls remove when they are. -#[allow(dead_code)] -pub struct SkeletonAttr { - scaler: f32, - head_scale: f32, - neck_height: f32, - neck_forward: f32, - neck_right: f32, - weapon_x: f32, - weapon_y: f32, -} - -impl SkeletonAttr { - pub fn calculate_scale(body: &comp::humanoid::Body) -> f32 { - use comp::humanoid::{BodyType::*, Race::*}; - match (body.race, body.body_type) { - (Orc, Male) => 0.95, - (Orc, Female) => 0.8, - (Human, Male) => 0.8, - (Human, Female) => 0.75, - (Elf, Male) => 0.85, - (Elf, Female) => 0.8, - (Dwarf, Male) => 0.1, - (Dwarf, Female) => 0.65, - (Undead, Male) => 0.8, - (Undead, Female) => 0.75, - (Danari, Male) => 0.58, - (Danari, Female) => 0.58, - } - } -} - -impl Default for SkeletonAttr { - fn default() -> Self { - Self { - scaler: 1.0, - head_scale: 1.0, - neck_height: 1.0, - neck_forward: 1.0, - neck_right: 1.0, - weapon_x: 1.0, - weapon_y: 1.0, - } - } -} - -impl<'a> From<&'a comp::humanoid::Body> for SkeletonAttr { - fn from(body: &'a comp::humanoid::Body) -> Self { - use comp::humanoid::{BodyType::*, Race::*}; - Self { - scaler: SkeletonAttr::calculate_scale(body), - head_scale: match (body.race, body.body_type) { - (Orc, Male) => 0.9, - (Orc, Female) => 1.0, - (Human, Male) => 1.0, - (Human, Female) => 1.0, - (Elf, Male) => 0.95, - (Elf, Female) => 1.0, - (Dwarf, Male) => 1.0, - (Dwarf, Female) => 1.0, - (Undead, Male) => 1.0, - (Undead, Female) => 1.0, - (Danari, Male) => 1.15, - (Danari, Female) => 1.15, - }, - neck_height: match (body.race, body.body_type) { - (Orc, Male) => 0.0, - (Orc, Female) => 0.0, - (Human, Male) => 0.0, - (Human, Female) => 0.0, - (Elf, Male) => 0.0, - (Elf, Female) => 0.0, - (Dwarf, Male) => 0.0, - (Dwarf, Female) => 0.0, - (Undead, Male) => 0.5, - (Undead, Female) => 0.5, - (Danari, Male) => 0.5, - (Danari, Female) => 0.5, - }, - neck_forward: match (body.race, body.body_type) { - (Orc, Male) => 0.0, - (Orc, Female) => 0.0, - (Human, Male) => 0.5, - (Human, Female) => 0.0, - (Elf, Male) => 0.5, - (Elf, Female) => 0.5, - (Dwarf, Male) => 0.5, - (Dwarf, Female) => 0.0, - (Undead, Male) => 0.5, - (Undead, Female) => 0.5, - (Danari, Male) => 0.0, - (Danari, Female) => 0.0, - }, - neck_right: match (body.race, body.body_type) { - (Orc, Male) => 0.0, - (Orc, Female) => 0.0, - (Human, Male) => 0.0, - (Human, Female) => 0.0, - (Elf, Male) => 0.0, - (Elf, Female) => 0.0, - (Dwarf, Male) => 0.0, - (Dwarf, Female) => 0.0, - (Undead, Male) => 0.0, - (Undead, Female) => 0.0, - (Danari, Male) => 0.0, - (Danari, Female) => 0.0, - }, - weapon_x: match ToolKind::Empty { - // TODO: Inventory - ToolKind::Sword(_) => 0.0, - ToolKind::Axe(_) => 3.0, - ToolKind::Hammer(_) => 0.0, - ToolKind::Shield(_) => 3.0, - ToolKind::Staff(_) => 3.0, - ToolKind::Bow(_) => 0.0, - ToolKind::Dagger(_) => 0.0, - ToolKind::Debug(_) => 0.0, - ToolKind::Empty => 0.0, - }, - weapon_y: match ToolKind::Empty { - // TODO: Inventory - ToolKind::Sword(_) => -1.25, - ToolKind::Axe(_) => 0.0, - ToolKind::Hammer(_) => -2.0, - ToolKind::Shield(_) => 0.0, - ToolKind::Staff(_) => 0.0, - ToolKind::Bow(_) => -2.0, - ToolKind::Dagger(_) => -2.0, - ToolKind::Debug(_) => 0.0, - ToolKind::Empty => 0.0, - }, - } - } -} pub trait Animation { type Skeleton: Skeleton; diff --git a/voxygen/src/scene/figure/load.rs b/voxygen/src/scene/figure/load.rs index 5cd3bf01c2..d5cc47a654 100644 --- a/voxygen/src/scene/figure/load.rs +++ b/voxygen/src/scene/figure/load.rs @@ -2645,7 +2645,10 @@ pub fn mesh_object( use object::Body; let (name, offset) = match obj { - Body::Arrow => ("weapon.projectile.simple-arrow", Vec3::new(-5.5, -5.5, 0.0)), + Body::Arrow => ( + "weapon.projectile.simple-arrow", + Vec3::new(-0.5, -6.0, -1.5), + ), Body::Bomb => ("object.bomb", Vec3::new(-5.5, -5.5, 0.0)), Body::Scarecrow => ("object.scarecrow", Vec3::new(-9.5, -4.0, 0.0)), Body::Cauldron => ("object.cauldron", Vec3::new(-10.0, -10.0, 0.0)),