diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e3ca83fa6..227c50b450 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added sfx for wielding/unwielding weapons - Fixed NPCs attacking the player forever after killing them - Added sfx for collecting, dropping and using inventory items +- New attack animation +- weapon control system ### Changed diff --git a/assets/voxygen/element/frames/banner_top.png b/assets/voxygen/element/frames/banner_top.png index 95d2a663d0..a8f9c1a224 100644 --- a/assets/voxygen/element/frames/banner_top.png +++ b/assets/voxygen/element/frames/banner_top.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9fef31ac181203a09fa2ffc9da905d01b801de6916c719421c6c0824fcc381b6 -size 728 +oid sha256:1f03ab3f90d7abe2ccd67de23b7a7f1e026cb97c8e202a60165397d61b8f9dce +size 4881 diff --git a/assets/voxygen/element/misc_bg/textbox_bot.png b/assets/voxygen/element/misc_bg/textbox_bot.png index 7cbf38faa2..e944fe5eff 100644 --- a/assets/voxygen/element/misc_bg/textbox_bot.png +++ b/assets/voxygen/element/misc_bg/textbox_bot.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:689bb98f756e4795e39e9bf4dcc8696c30aa24972a99064e7a69dcced79a10ef -size 1017 +oid sha256:79e8e39281ebb9293b804ea0535635d69cc455ab4bb6d1103b84ec91e77990c1 +size 6377 diff --git a/assets/voxygen/element/misc_bg/textbox_mid.png b/assets/voxygen/element/misc_bg/textbox_mid.png index 193d78a014..9c271c6c21 100644 --- a/assets/voxygen/element/misc_bg/textbox_mid.png +++ b/assets/voxygen/element/misc_bg/textbox_mid.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b9ff2f6356b696b1d019ae8c9e171578516abd0fe6fa34ccd93ead8195766f7f -size 839 +oid sha256:6d9097face16955fac82b30dbe896796aea1b589db5c9cda2f87d9bc7f63f3a7 +size 6103 diff --git a/assets/voxygen/element/misc_bg/textbox_top.png b/assets/voxygen/element/misc_bg/textbox_top.png index a6ce89cfc1..1f2067cd01 100644 --- a/assets/voxygen/element/misc_bg/textbox_top.png +++ b/assets/voxygen/element/misc_bg/textbox_top.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c14b2e270f868f5621371ad8bd323afb46dd9919e7ff862943483b8de662128e -size 1020 +oid sha256:d770f17e438f4119cba20d54020acac26445467f968015028a3b476c2e97ea83 +size 6358 diff --git a/voxygen/src/anim/biped_large/mod.rs b/voxygen/src/anim/biped_large/mod.rs index 85611e944e..282c094876 100644 --- a/voxygen/src/anim/biped_large/mod.rs +++ b/voxygen/src/anim/biped_large/mod.rs @@ -47,7 +47,7 @@ impl BipedLargeSkeleton { impl Skeleton for BipedLargeSkeleton { type Attr = SkeletonAttr; - fn compute_matrices(&self) -> [FigureBoneData; 16] { + fn compute_matrices(&self) -> [FigureBoneData; 18] { let upper_torso_mat = self.upper_torso.compute_base_matrix(); let shoulder_l_mat = self.shoulder_l.compute_base_matrix(); let shoulder_r_mat = self.shoulder_r.compute_base_matrix(); @@ -78,6 +78,8 @@ impl Skeleton for BipedLargeSkeleton { FigureBoneData::default(), FigureBoneData::default(), FigureBoneData::default(), + FigureBoneData::default(), + FigureBoneData::default(), ] } diff --git a/voxygen/src/anim/bird_medium/mod.rs b/voxygen/src/anim/bird_medium/mod.rs index 0ff89377ae..d5e7832e74 100644 --- a/voxygen/src/anim/bird_medium/mod.rs +++ b/voxygen/src/anim/bird_medium/mod.rs @@ -27,7 +27,7 @@ impl BirdMediumSkeleton { impl Skeleton for BirdMediumSkeleton { type Attr = SkeletonAttr; - fn compute_matrices(&self) -> [FigureBoneData; 16] { + fn compute_matrices(&self) -> [FigureBoneData; 18] { let torso_mat = self.torso.compute_base_matrix(); [ @@ -47,6 +47,8 @@ impl Skeleton for BirdMediumSkeleton { FigureBoneData::default(), FigureBoneData::default(), FigureBoneData::default(), + FigureBoneData::default(), + FigureBoneData::default(), ] } diff --git a/voxygen/src/anim/bird_small/mod.rs b/voxygen/src/anim/bird_small/mod.rs index 610b63122a..763bb2fac8 100644 --- a/voxygen/src/anim/bird_small/mod.rs +++ b/voxygen/src/anim/bird_small/mod.rs @@ -31,7 +31,7 @@ impl BirdSmallSkeleton { impl Skeleton for BirdSmallSkeleton { type Attr = SkeletonAttr; - fn compute_matrices(&self) -> [FigureBoneData; 16] { + fn compute_matrices(&self) -> [FigureBoneData; 18] { let torso_mat = self.torso.compute_base_matrix(); [ @@ -51,6 +51,8 @@ impl Skeleton for BirdSmallSkeleton { FigureBoneData::default(), FigureBoneData::default(), FigureBoneData::default(), + FigureBoneData::default(), + FigureBoneData::default(), ] } diff --git a/voxygen/src/anim/character/attack.rs b/voxygen/src/anim/character/attack.rs index 9ceb9343e8..3cc674e799 100644 --- a/voxygen/src/anim/character/attack.rs +++ b/voxygen/src/anim/character/attack.rs @@ -21,60 +21,65 @@ impl Animation for AttackAnimation { ) -> Self::Skeleton { let mut next = (*skeleton).clone(); - let slow = (anim_time as f32 * 9.0).sin(); - let accel_med = 1.0 - (anim_time as f32 * 16.0).cos(); - let accel_slow = 1.0 - (anim_time as f32 * 12.0).cos(); - let accel_fast = 1.0 - (anim_time as f32 * 24.0).cos(); - let decel = (anim_time as f32 * 16.0).min(PI / 2.0).sin(); + let lab = 1.0; + let accel_med = 1.0 - (anim_time as f32 * 16.0 * lab as f32).cos(); + let accel_slow = 1.0 - (anim_time as f32 * 12.0 * lab as f32).cos(); + let accel_fast = 1.0 - (anim_time as f32 * 24.0 * lab as f32).cos(); + let decel = (anim_time as f32 * 16.0 * lab as f32).min(PI / 2.0).sin(); + + let slow = (((5.0) + / (1.1 + 3.9 * ((anim_time as f32 * lab as f32 * 12.4).sin()).powf(2.0 as f32))) + .sqrt()) + * ((anim_time as f32 * lab as f32 * 12.4).sin()); next.head.offset = Vec3::new( 0.0 + skeleton_attr.neck_right, - -2.0 + skeleton_attr.neck_forward, + -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.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_x(0.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_x(0.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.shorts.ori = Quaternion::rotation_x(0.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(); match active_tool_kind { //TODO: Inventory Some(Tool::Sword) => { - 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.l_hand.offset = Vec3::new(0.0, 1.0, 0.0); + next.l_hand.ori = Quaternion::rotation_x(1.27); + next.l_hand.scale = Vec3::one() * 1.04; + next.r_hand.offset = Vec3::new(0.0, 0.0, -3.0); + 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.scale = Vec3::one(); + + next.control.offset = Vec3::new(-8.0 - slow * 1.0, 3.0 - slow * 5.0, 0.0); + next.control.ori = Quaternion::rotation_x(-1.2) + * Quaternion::rotation_y(slow * 1.5) + * Quaternion::rotation_z(1.4 + slow * 0.5); + next.control.scale = Vec3::one(); }, Some(Tool::Axe) => { next.l_hand.offset = @@ -266,10 +271,17 @@ impl Animation for AttackAnimation { next.lantern.scale = Vec3::one() * 0.0; next.torso.offset = Vec3::new(0.0, -0.2, 0.1) * skeleton_attr.scaler; - next.torso.ori = Quaternion::rotation_z(decel * -0.2) - * Quaternion::rotation_x(0.0 + decel * -0.2) - * Quaternion::rotation_y(decel * 0.2); + 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/block.rs b/voxygen/src/anim/character/block.rs index 17c1415641..53cff1dda0 100644 --- a/voxygen/src/anim/character/block.rs +++ b/voxygen/src/anim/character/block.rs @@ -63,21 +63,23 @@ impl Animation for BlockAnimation { match active_tool_kind { //TODO: Inventory Some(Tool::Sword) => { - next.l_hand.offset = Vec3::new(-6.0, 3.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.l_hand.offset = Vec3::new(0.0, -5.0, -5.0); + next.l_hand.ori = Quaternion::rotation_x(1.27); + next.l_hand.scale = Vec3::one() * 1.04; + next.r_hand.offset = Vec3::new(0.0, -6.0, -8.0); + next.r_hand.ori = Quaternion::rotation_x(1.27); + next.r_hand.scale = Vec3::one() * 1.05; + next.main.offset = Vec3::new(0.0, 0.0, -6.0); next.main.ori = Quaternion::rotation_x(-0.3) * Quaternion::rotation_y(0.0) * Quaternion::rotation_z(0.0); next.main.scale = Vec3::one(); + + next.control.offset = Vec3::new(-8.0, 13.0, 8.0); + next.control.ori = Quaternion::rotation_x(0.2) + * Quaternion::rotation_y(0.4) + * Quaternion::rotation_z(-1.57); + next.control.scale = Vec3::one(); }, Some(Tool::Axe) => { next.l_hand.offset = Vec3::new( diff --git a/voxygen/src/anim/character/blockidle.rs b/voxygen/src/anim/character/blockidle.rs index 67af96d2a2..09ac00407d 100644 --- a/voxygen/src/anim/character/blockidle.rs +++ b/voxygen/src/anim/character/blockidle.rs @@ -62,21 +62,23 @@ impl Animation for BlockIdleAnimation { match active_tool_kind { //TODO: Inventory Some(Tool::Sword) => { - next.l_hand.offset = Vec3::new(-6.0, 3.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.l_hand.offset = Vec3::new(0.0, -5.0, -5.0); + next.l_hand.ori = Quaternion::rotation_x(1.27); + next.l_hand.scale = Vec3::one() * 1.04; + next.r_hand.offset = Vec3::new(0.0, -6.0, -8.0); + next.r_hand.ori = Quaternion::rotation_x(1.27); + next.r_hand.scale = Vec3::one() * 1.05; + next.main.offset = Vec3::new(0.0, 0.0, -6.0); next.main.ori = Quaternion::rotation_x(-0.3) * Quaternion::rotation_y(0.0) * Quaternion::rotation_z(0.0); next.main.scale = Vec3::one(); + + next.control.offset = Vec3::new(-8.0, 13.0, 8.0); + next.control.ori = Quaternion::rotation_x(0.2) + * Quaternion::rotation_y(0.4) + * Quaternion::rotation_z(-1.57); + next.control.scale = Vec3::one(); }, Some(Tool::Axe) => { next.l_hand.offset = Vec3::new( diff --git a/voxygen/src/anim/character/charge.rs b/voxygen/src/anim/character/charge.rs index a0cbe277d5..18203270c9 100644 --- a/voxygen/src/anim/character/charge.rs +++ b/voxygen/src/anim/character/charge.rs @@ -103,6 +103,11 @@ impl Animation for ChargeAnimation { 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.control.offset = Vec3::new(0.0, 0.0, 0.0); + next.control.ori = Quaternion::rotation_x(0.0); + next.control.scale = Vec3::one(); + next } } diff --git a/voxygen/src/anim/character/cidle.rs b/voxygen/src/anim/character/cidle.rs index c4093cf2c3..a33d6d0ed9 100644 --- a/voxygen/src/anim/character/cidle.rs +++ b/voxygen/src/anim/character/cidle.rs @@ -22,7 +22,7 @@ impl Animation for CidleAnimation { ) -> Self::Skeleton { let mut next = (*skeleton).clone(); - let wave_ultra_slow = (anim_time as f32 * 3.0 + PI).sin(); + let wave_ultra_slow = (anim_time as f32 * 0.5 + PI).sin(); let wave_ultra_slow_cos = (anim_time as f32 * 3.0 + PI).cos(); let wave_slow_cos = (anim_time as f32 * 6.0 + PI).cos(); let wave_slow = (anim_time as f32 * 6.0 + PI).sin(); @@ -63,29 +63,23 @@ impl Animation for CidleAnimation { match active_tool_kind { //TODO: Inventory Some(Tool::Sword) => { - next.l_hand.offset = Vec3::new( - -6.0 + wave_ultra_slow_cos * 1.0, - -2.0 + wave_ultra_slow_cos * 0.5, - 1.0 + wave_ultra_slow * 1.0, - ); - next.l_hand.ori = Quaternion::rotation_x(1.27); - next.l_hand.scale = Vec3::one() * 1.0; - next.r_hand.offset = Vec3::new( - -6.0 + wave_ultra_slow_cos * 1.0, - -2.5 + wave_ultra_slow_cos * 0.5, - -1.0 + wave_ultra_slow * 1.0, - ); - next.r_hand.ori = Quaternion::rotation_x(1.27); - 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, - 5.5 + skeleton_attr.weapon_y + wave_ultra_slow_cos * 0.5, - 1.0 + wave_ultra_slow * 1.0, - ); - next.main.ori = Quaternion::rotation_x(-0.3) + next.l_hand.offset = Vec3::new(-0.25, -5.0, -5.0); + next.l_hand.ori = Quaternion::rotation_x(1.47) * Quaternion::rotation_y(-0.2); + next.l_hand.scale = Vec3::one() * 1.04; + next.r_hand.offset = Vec3::new(1.25, -5.5, -8.0); + next.r_hand.ori = Quaternion::rotation_x(1.47) * Quaternion::rotation_y(0.3); + next.r_hand.scale = Vec3::one() * 1.05; + next.main.offset = Vec3::new(0.0, 0.0, -6.0); + next.main.ori = Quaternion::rotation_x(-0.1) * Quaternion::rotation_y(0.0) * Quaternion::rotation_z(0.0); 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(); }, Some(Tool::Axe) => { next.l_hand.offset = Vec3::new( diff --git a/voxygen/src/anim/character/climb.rs b/voxygen/src/anim/character/climb.rs index 769abeecf6..b95ec99a84 100644 --- a/voxygen/src/anim/character/climb.rs +++ b/voxygen/src/anim/character/climb.rs @@ -59,11 +59,11 @@ impl Animation for ClimbAnimation { * Quaternion::rotation_y(wave_test * 0.10); next.shorts.scale = Vec3::one(); - next.l_hand.offset = Vec3::new(-6.0, -0.25 + wave_testc * 1.5, 5.0 - wave_test * 4.0); + next.l_hand.offset = Vec3::new(-6.0, -0.25 + wave_testc * 1.5, 6.0 - wave_test * 4.0); next.l_hand.ori = Quaternion::rotation_x(2.2 + wave_testc * 0.5); next.l_hand.scale = Vec3::one(); - next.r_hand.offset = Vec3::new(6.0, -0.25 - wave_testc * 1.5, 5.0 + wave_test * 4.0); + next.r_hand.offset = Vec3::new(6.0, -0.25 - wave_testc * 1.5, 6.0 + wave_test * 4.0); next.r_hand.ori = Quaternion::rotation_x(2.2 - wave_testc * 0.5); next.r_hand.scale = Vec3::one(); @@ -75,15 +75,6 @@ impl Animation for ClimbAnimation { next.r_foot.ori = Quaternion::rotation_x(0.2 + wave_testc * 0.5); next.r_foot.scale = Vec3::one(); - 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 + wave_cos * 0.25); - next.main.scale = Vec3::one(); - next.l_shoulder.offset = Vec3::new(-5.0, 0.0, 4.7); next.l_shoulder.ori = Quaternion::rotation_x(wave_cos * 0.15); next.l_shoulder.scale = Vec3::one() * 1.1; @@ -96,6 +87,23 @@ impl Animation for ClimbAnimation { 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.ori = + Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57 + wave_cos * 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(0.0, 0.0, 0.0); next.lantern.ori = Quaternion::rotation_x(0.0); next.lantern.scale = Vec3::one() * 0.0; @@ -104,6 +112,17 @@ 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/crun.rs b/voxygen/src/anim/character/crun.rs index 59d1807a69..cf12ef8c56 100644 --- a/voxygen/src/anim/character/crun.rs +++ b/voxygen/src/anim/character/crun.rs @@ -43,23 +43,33 @@ impl Animation for WieldAnimation { match Tool::Bow { //TODO: Inventory - Tool::Sword => { - next.l_hand.offset = Vec3::new(-6.0, 3.75, 0.25); - 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.weapon.offset = Vec3::new( - -6.0 + skeleton_attr.weapon_x, - 4.0 + skeleton_attr.weapon_y, + Some(Tool::Sword) => { + next.l_hand.offset = Vec3::new(0.0, -5.0, -5.0); + next.l_hand.ori = Quaternion::rotation_x(1.27); + next.l_hand.scale = Vec3::one() * 1.04; + next.r_hand.offset = Vec3::new(0.0, -6.0, -8.0); + next.r_hand.ori = Quaternion::rotation_x(1.27); + next.r_hand.scale = Vec3::one() * 1.05; + next.main.offset = Vec3::new( 0.0, + 0.0, + -6.0, ); - next.weapon.ori = Quaternion::rotation_x(-0.3) + next.main.ori = Quaternion::rotation_x(-0.3) * Quaternion::rotation_y(0.0) * Quaternion::rotation_z(0.0); - next.weapon.scale = Vec3::one(); - } + next.main.scale = Vec3::one(); + + next.control.offset = Vec3::new( + -8.0, + 4.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(); + }, Tool::Axe => { next.l_hand.offset = Vec3::new(-6.0, 3.5, 0.0); next.l_hand.ori = Quaternion::rotation_x(-0.3); diff --git a/voxygen/src/anim/character/gliding.rs b/voxygen/src/anim/character/gliding.rs index 955208a3d2..5eacea3e85 100644 --- a/voxygen/src/anim/character/gliding.rs +++ b/voxygen/src/anim/character/gliding.rs @@ -105,14 +105,6 @@ impl Animation for GlidingAnimation { ); next.r_foot.scale = Vec3::one(); - 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); - next.main.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.scale = Vec3::one() * 1.1; @@ -126,6 +118,22 @@ impl Animation for GlidingAnimation { Quaternion::rotation_x(1.0) * Quaternion::rotation_y(wave_very_slow_cos * 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.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; @@ -135,6 +143,17 @@ impl Animation for GlidingAnimation { * 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 87a709ab50..57949cb125 100644 --- a/voxygen/src/anim/character/idle.rs +++ b/voxygen/src/anim/character/idle.rs @@ -56,7 +56,7 @@ impl Animation for IdleAnimation { next.shorts.scale = Vec3::one(); next.l_hand.offset = Vec3::new( - -6.0, + -7.0, -0.25 + wave_ultra_slow_cos * 0.15, 5.0 + wave_ultra_slow * 0.5, ); @@ -65,7 +65,7 @@ impl Animation for IdleAnimation { next.l_hand.scale = Vec3::one(); next.r_hand.offset = Vec3::new( - 6.0, + 7.0, -0.25 + wave_ultra_slow_cos * 0.15, 5.0 + wave_ultra_slow * 0.5 + wave_ultra_slow_abs * -0.05, ); @@ -80,14 +80,6 @@ impl Animation for IdleAnimation { next.r_foot.ori = Quaternion::identity(); next.r_foot.scale = Vec3::one(); - 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); - next.main.scale = Vec3::one() + wave_ultra_slow_abs * -0.05; - next.l_shoulder.offset = Vec3::new(-5.0, 0.0, 5.0); next.l_shoulder.ori = Quaternion::rotation_x(0.0); next.l_shoulder.scale = (Vec3::one() + wave_ultra_slow_abs * -0.05) * 1.15; @@ -100,6 +92,22 @@ impl Animation for IdleAnimation { 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.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57); + next.main.scale = Vec3::one() + wave_ultra_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.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; @@ -108,6 +116,17 @@ impl Animation for IdleAnimation { 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/jump.rs b/voxygen/src/anim/character/jump.rs index 7a93aa4f82..b19f3f5ba4 100644 --- a/voxygen/src/anim/character/jump.rs +++ b/voxygen/src/anim/character/jump.rs @@ -68,14 +68,6 @@ impl Animation for JumpAnimation { next.r_foot.ori = Quaternion::rotation_x(wave_stop * 1.2 + wave_slow * 0.2); next.r_foot.scale = Vec3::one(); - 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); - next.main.scale = Vec3::one(); - next.l_shoulder.offset = Vec3::new(-5.0, 0.0, 4.7); next.l_shoulder.ori = Quaternion::rotation_x(wave_stop_alt * 0.3); next.l_shoulder.scale = Vec3::one() * 1.1; @@ -88,6 +80,22 @@ impl Animation for JumpAnimation { 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.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; @@ -96,6 +104,17 @@ impl Animation for JumpAnimation { next.torso.ori = Quaternion::rotation_x(-0.2); 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/mod.rs b/voxygen/src/anim/character/mod.rs index 6ed75e27e2..727d0f0918 100644 --- a/voxygen/src/anim/character/mod.rs +++ b/voxygen/src/anim/character/mod.rs @@ -37,12 +37,16 @@ pub struct CharacterSkeleton { r_hand: Bone, l_foot: Bone, r_foot: Bone, - main: Bone, l_shoulder: Bone, r_shoulder: Bone, glider: Bone, + main: Bone, + second: Bone, lantern: Bone, torso: Bone, + control: Bone, + l_control: Bone, + r_control: Bone, } impl CharacterSkeleton { @@ -52,11 +56,16 @@ impl CharacterSkeleton { impl Skeleton for CharacterSkeleton { type Attr = SkeletonAttr; - fn compute_matrices(&self) -> [FigureBoneData; 16] { + fn compute_matrices(&self) -> [FigureBoneData; 18] { let chest_mat = self.chest.compute_base_matrix(); let torso_mat = self.torso.compute_base_matrix(); let l_hand_mat = self.l_hand.compute_base_matrix(); + let r_hand_mat = self.r_hand.compute_base_matrix(); + let control_mat = self.control.compute_base_matrix(); + let l_control_mat = self.l_control.compute_base_matrix(); + let r_control_mat = self.r_control.compute_base_matrix(); let main_mat = self.main.compute_base_matrix(); + let second_mat = self.second.compute_base_matrix(); let head_mat = self.head.compute_base_matrix(); [ @@ -64,18 +73,20 @@ impl Skeleton for CharacterSkeleton { FigureBoneData::new(torso_mat * chest_mat), FigureBoneData::new(torso_mat * self.belt.compute_base_matrix()), FigureBoneData::new(torso_mat * self.shorts.compute_base_matrix()), - FigureBoneData::new(torso_mat * chest_mat * l_hand_mat), - FigureBoneData::new(torso_mat * chest_mat * self.r_hand.compute_base_matrix()), + FigureBoneData::new(torso_mat * chest_mat * control_mat * l_control_mat * l_hand_mat), + FigureBoneData::new(torso_mat * chest_mat * control_mat * r_control_mat * r_hand_mat), FigureBoneData::new(torso_mat * self.l_foot.compute_base_matrix()), FigureBoneData::new(torso_mat * self.r_foot.compute_base_matrix()), - FigureBoneData::new(torso_mat * chest_mat * main_mat), FigureBoneData::new(torso_mat * chest_mat * self.l_shoulder.compute_base_matrix()), FigureBoneData::new(torso_mat * chest_mat * self.r_shoulder.compute_base_matrix()), FigureBoneData::new(torso_mat * self.glider.compute_base_matrix()), + FigureBoneData::new(torso_mat * chest_mat * control_mat * l_control_mat * main_mat), + FigureBoneData::new(torso_mat * chest_mat * control_mat * r_control_mat * second_mat), FigureBoneData::new(torso_mat * chest_mat * self.lantern.compute_base_matrix()), FigureBoneData::new(torso_mat), - FigureBoneData::default(), - FigureBoneData::default(), + FigureBoneData::new(control_mat), + FigureBoneData::new(l_control_mat), + FigureBoneData::new(r_control_mat), ] } @@ -88,12 +99,16 @@ impl Skeleton for CharacterSkeleton { self.r_hand.interpolate(&target.r_hand, dt); self.l_foot.interpolate(&target.l_foot, dt); self.r_foot.interpolate(&target.r_foot, dt); - self.main.interpolate(&target.main, dt); self.l_shoulder.interpolate(&target.l_shoulder, dt); self.r_shoulder.interpolate(&target.r_shoulder, dt); self.glider.interpolate(&target.glider, dt); + self.main.interpolate(&target.main, dt); + self.second.interpolate(&target.second, dt); self.lantern.interpolate(&target.lantern, dt); self.torso.interpolate(&target.torso, dt); + self.control.interpolate(&target.control, dt); + self.l_control.interpolate(&target.l_control, dt); + self.r_control.interpolate(&target.r_control, dt); } } diff --git a/voxygen/src/anim/character/roll.rs b/voxygen/src/anim/character/roll.rs index b9fd7fbfa1..5dc42b8eed 100644 --- a/voxygen/src/anim/character/roll.rs +++ b/voxygen/src/anim/character/roll.rs @@ -85,16 +85,6 @@ impl Animation for RollAnimation { next.r_foot.ori = Quaternion::rotation_x(wave * -0.4); next.r_foot.scale = Vec3::one(); - 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.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.scale = Vec3::one() * 1.1; @@ -107,6 +97,24 @@ impl Animation for RollAnimation { 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.ori = Quaternion::rotation_y(2.5) + * Quaternion::rotation_z(1.57) + * Quaternion::rotation_x(0.0); + 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; @@ -115,6 +123,18 @@ impl Animation for RollAnimation { Vec3::new(0.0, 0.0, 0.1 + wave_dub * 16.0) / 11.0 * skeleton_attr.scaler; next.torso.ori = Quaternion::rotation_x(wave_slow * 6.5) * Quaternion::rotation_y(tilt); 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/run.rs b/voxygen/src/anim/character/run.rs index c4e2479248..a4c92e3bce 100644 --- a/voxygen/src/anim/character/run.rs +++ b/voxygen/src/anim/character/run.rs @@ -23,23 +23,36 @@ impl Animation for RunAnimation { let lab = 1.0; let long = (((5.0) - / (1.1 + 3.9 * ((anim_time as f32 * lab as f32 * 1.2).sin()).powf(2.0 as f32))) + / (1.5 + 3.5 * ((anim_time as f32 * lab as f32 * 0.66).sin()).powf(2.0 as f32))) .sqrt()) - * ((anim_time as f32 * lab as f32 * 1.2).sin()); - let short = (((5.0) - / (1.1 + 3.9 * ((anim_time as f32 * lab as f32 * 2.4).sin()).powf(2.0 as f32))) - .sqrt()) - * ((anim_time as f32 * lab as f32 * 1.5).sin()); + * ((anim_time as f32 * lab as f32 * 0.66).sin()); - let wave_stop = (anim_time as f32 * 2.6).min(PI / 2.0).sin(); + let short = (((5.0) + / (1.5 + 3.5 * ((anim_time as f32 * lab as f32 * 1.32).sin()).powf(2.0 as f32))) + .sqrt()) + * ((anim_time as f32 * lab as f32 * 1.32).sin()); + + let shortalt = (((5.0) + / (1.5 + + 3.5 + * ((anim_time as f32 * lab as f32 * 1.32 + PI / 2.0).sin()).powf(2.0 as f32))) + .sqrt()) + * ((anim_time as f32 * lab as f32 * 1.32 + PI / 2.0).sin()); + + let foot = (((5.0) + / (1.1 + 3.9 * ((anim_time as f32 * lab as f32 * 1.32).sin()).powf(2.0 as f32))) + .sqrt()) + * ((anim_time as f32 * lab as f32 * 1.32).sin()); + + let wave_stop = (anim_time as f32 * 2.6).min(PI / 2.0 / 2.0).sin(); let head_look = Vec2::new( - ((global_time + anim_time) as f32 / 4.0) + ((global_time + anim_time) as f32 / 18.0) .floor() .mul(7331.0) .sin() * 0.2, - ((global_time + anim_time) as f32 / 4.0) + ((global_time + anim_time) as f32 / 18.0) .floor() .mul(1337.0) .sin() @@ -70,21 +83,21 @@ impl Animation for RunAnimation { next.head.scale = Vec3::one() * skeleton_attr.head_scale; next.chest.offset = Vec3::new(0.0, 0.0, 7.0 + short * 1.1); - next.chest.ori = Quaternion::rotation_z(long * 0.2); + next.chest.ori = Quaternion::rotation_z(short * 0.2); next.chest.scale = Vec3::one(); next.belt.offset = Vec3::new(0.0, 0.0, 5.0 + short * 1.1); - next.belt.ori = Quaternion::rotation_z(long * 0.35); + next.belt.ori = Quaternion::rotation_z(short * 0.35); next.belt.scale = Vec3::one(); next.shorts.offset = Vec3::new(0.0, 0.0, 2.0 + short * 1.1); - next.shorts.ori = Quaternion::rotation_z(long * 0.6); + next.shorts.ori = Quaternion::rotation_z(short * 0.6); next.shorts.scale = Vec3::one(); next.l_hand.offset = Vec3::new( -6.0 + wave_stop * -1.0, -0.25 + short * 2.0, - 5.0 - long * 1.5, + 5.0 + short * -1.5, ); next.l_hand.ori = Quaternion::rotation_x(0.8 + short * 1.2) * Quaternion::rotation_y(wave_stop * 0.1); @@ -93,20 +106,32 @@ impl Animation for RunAnimation { next.r_hand.offset = Vec3::new( 6.0 + wave_stop * 1.0, -0.25 + short * -2.0, - 5.0 + long * 1.5, + 5.0 + short * 1.5, ); next.r_hand.ori = Quaternion::rotation_x(0.8 + short * -1.2) * Quaternion::rotation_y(wave_stop * -0.1); next.r_hand.scale = Vec3::one(); - next.l_foot.offset = Vec3::new(-3.4, 0.0 + short * 1.0, 6.0); - next.l_foot.ori = Quaternion::rotation_x(-0.0 - short * 1.2); + next.l_foot.offset = Vec3::new(-3.4, foot * 1.0, 6.0); + next.l_foot.ori = Quaternion::rotation_x(foot * -1.2); next.l_foot.scale = Vec3::one(); - next.r_foot.offset = Vec3::new(3.4, short * -1.0, 6.0); - next.r_foot.ori = Quaternion::rotation_x(short * 1.2); + next.r_foot.offset = Vec3::new(3.4, foot * -1.0, 6.0); + next.r_foot.ori = Quaternion::rotation_x(foot * 1.2); next.r_foot.scale = Vec3::one(); + next.l_shoulder.offset = Vec3::new(-5.0, -1.0, 4.7); + 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.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.scale = Vec3::one() * 0.0; + next.main.offset = Vec3::new( -7.0 + skeleton_attr.weapon_x, -5.0 + skeleton_attr.weapon_y, @@ -115,28 +140,36 @@ impl Animation for RunAnimation { next.main.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57 + short * 0.25); next.main.scale = Vec3::one(); - next.l_shoulder.offset = Vec3::new(-5.0, -0.5, 4.7); - 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, -0.5, 4.7); - next.r_shoulder.ori = Quaternion::rotation_x(long * 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.scale = Vec3::one() * 0.0; + 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, 5.0, 0.0); next.lantern.ori = Quaternion::rotation_y(0.0); next.lantern.scale = Vec3::one() * 0.0; - next.torso.offset = Vec3::new(0.0, -0.3 + long * -0.08, 0.4) * skeleton_attr.scaler; + next.torso.offset = Vec3::new(0.0, -0.3 + shortalt * -0.065, 0.4) * skeleton_attr.scaler; next.torso.ori = - Quaternion::rotation_x(wave_stop * speed * -0.06 + wave_stop * speed * -0.005) + Quaternion::rotation_x(wave_stop * speed * -0.05 + wave_stop * speed * -0.005) * Quaternion::rotation_y(tilt); 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/sit.rs b/voxygen/src/anim/character/sit.rs index 2a1d4858bd..a4a8f4a210 100644 --- a/voxygen/src/anim/character/sit.rs +++ b/voxygen/src/anim/character/sit.rs @@ -95,14 +95,6 @@ impl Animation for SitAnimation { ); next.r_foot.scale = Vec3::one(); - 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); - next.main.scale = Vec3::one() + wave_slow_abs * -0.05; - 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() + wave_slow_abs * -0.05) * 1.15; @@ -115,6 +107,22 @@ impl Animation for SitAnimation { 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.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57); + next.main.scale = Vec3::one() + wave_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.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; @@ -122,6 +130,18 @@ impl Animation for SitAnimation { next.torso.offset = Vec3::new(0.0, -0.2, wave_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/stand.rs b/voxygen/src/anim/character/stand.rs index 2116115be7..116cf5db09 100644 --- a/voxygen/src/anim/character/stand.rs +++ b/voxygen/src/anim/character/stand.rs @@ -43,26 +43,25 @@ impl Animation for StandAnimation { next.head.scale = Vec3::one() * skeleton_attr.head_scale; next.chest.offset = Vec3::new(0.0, 0.0, 7.0 + slow * 0.3); - next.chest.ori = Quaternion::rotation_x(0.0); - next.chest.scale = Vec3::one() * 1.01 + breathe * 0.05; + next.chest.ori = Quaternion::rotation_z(head_look.x * 0.6); + next.chest.scale = Vec3::one() * 1.01; next.belt.offset = Vec3::new(0.0, 0.0, 5.0 + slow * 0.3); - next.belt.ori = Quaternion::rotation_x(0.0); + next.belt.ori = Quaternion::rotation_z(head_look.x * 0.4); next.belt.scale = Vec3::one() + breathe * 0.05; next.shorts.offset = Vec3::new(0.0, 0.0, 2.0 + slow * 0.3); next.shorts.ori = Quaternion::rotation_x(0.0); next.shorts.scale = Vec3::one(); - next.l_hand.offset = Vec3::new(-6.0, -0.25 + slow * 0.15, 5.0 + slow * 0.5); + next.l_hand.offset = Vec3::new(-7.0, -0.25 + slow * 0.15, 5.0 + slow * 0.5); next.l_hand.ori = Quaternion::rotation_x(0.0 + slow * -0.06); next.l_hand.scale = Vec3::one(); - next.r_hand.offset = - Vec3::new(6.0, -0.25 + slow * 0.15, 5.0 + slow * 0.5 + breathe * -0.05); + 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.scale = Vec3::one() + breathe * -0.05; + next.r_hand.scale = Vec3::one(); next.l_foot.offset = Vec3::new(-3.4, -0.1, 8.0); next.l_foot.ori = Quaternion::identity(); @@ -72,14 +71,6 @@ impl Animation for StandAnimation { next.r_foot.ori = Quaternion::identity(); next.r_foot.scale = Vec3::one(); - 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); - next.main.scale = Vec3::one() + breathe * -0.05; - next.l_shoulder.offset = Vec3::new(-5.0, 0.0, 5.0); next.l_shoulder.ori = Quaternion::rotation_x(0.0); next.l_shoulder.scale = (Vec3::one() + breathe * -0.05) * 1.15; @@ -92,6 +83,22 @@ impl Animation for StandAnimation { 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.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; @@ -100,6 +107,17 @@ 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 4531e0ae8a..8b8220277d 100644 --- a/voxygen/src/anim/character/swim.rs +++ b/voxygen/src/anim/character/swim.rs @@ -95,15 +95,6 @@ impl Animation for SwimAnimation { next.r_foot.ori = Quaternion::rotation_x(-0.0 + wave_cos * 1.5); next.r_foot.scale = Vec3::one(); - 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 + wave_cos * 0.25); - next.main.scale = Vec3::one(); - next.l_shoulder.offset = Vec3::new(-5.0, 0.0, 4.7); next.l_shoulder.ori = Quaternion::rotation_x(wave_cos * 0.15); next.l_shoulder.scale = Vec3::one() * 1.1; @@ -116,6 +107,23 @@ impl Animation for SwimAnimation { 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.ori = + Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57 + wave_cos * 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(0.0, 5.0, 0.0); next.lantern.ori = Quaternion::rotation_y(0.0); next.lantern.scale = Vec3::one() * 0.0; @@ -126,6 +134,17 @@ impl Animation for SwimAnimation { * 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 68d18d2c9d..9e882fed3c 100644 --- a/voxygen/src/anim/character/wield.rs +++ b/voxygen/src/anim/character/wield.rs @@ -30,21 +30,23 @@ impl Animation for WieldAnimation { match active_tool_kind { //TODO: Inventory Some(Tool::Sword) => { - next.l_hand.offset = Vec3::new(-6.0, -2.0, 1.0); + next.l_hand.offset = Vec3::new(0.0, -5.0, -5.0); next.l_hand.ori = Quaternion::rotation_x(1.27); - next.l_hand.scale = Vec3::one() * 1.00; - next.r_hand.offset = Vec3::new(-6.0, -2.5, -1.0); + next.l_hand.scale = Vec3::one() * 1.04; + next.r_hand.offset = Vec3::new(0.0, -6.0, -8.0); next.r_hand.ori = Quaternion::rotation_x(1.27); - next.r_hand.scale = Vec3::one() * 1.01; - next.main.offset = Vec3::new( - -6.0 + skeleton_attr.weapon_x, - 5.5 + skeleton_attr.weapon_y, - 1.0, - ); + next.r_hand.scale = Vec3::one() * 1.05; + next.main.offset = Vec3::new(0.0, 0.0, -6.0); next.main.ori = Quaternion::rotation_x(-0.3) * Quaternion::rotation_y(0.0) * Quaternion::rotation_z(0.0); next.main.scale = Vec3::one(); + + next.control.offset = Vec3::new(-8.0, 4.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(); }, Some(Tool::Axe) => { next.l_hand.offset = Vec3::new(-6.5, -0.5, 6.0); @@ -200,6 +202,14 @@ impl Animation for WieldAnimation { next.torso.offset = Vec3::new(0.0, 0.3 + wave * -0.08, 0.4) * skeleton_attr.scaler; next.torso.ori = Quaternion::rotation_x(wave_stop * -0.2); 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/critter/mod.rs b/voxygen/src/anim/critter/mod.rs index 9677461239..4a2c05ef6d 100644 --- a/voxygen/src/anim/critter/mod.rs +++ b/voxygen/src/anim/critter/mod.rs @@ -32,7 +32,7 @@ impl CritterSkeleton { impl Skeleton for CritterSkeleton { type Attr = CritterAttr; - fn compute_matrices(&self) -> [FigureBoneData; 16] { + fn compute_matrices(&self) -> [FigureBoneData; 18] { [ FigureBoneData::new(self.head.compute_base_matrix()), FigureBoneData::new(self.chest.compute_base_matrix()), @@ -50,6 +50,8 @@ impl Skeleton for CritterSkeleton { FigureBoneData::default(), FigureBoneData::default(), FigureBoneData::default(), + FigureBoneData::default(), + FigureBoneData::default(), ] } diff --git a/voxygen/src/anim/dragon/mod.rs b/voxygen/src/anim/dragon/mod.rs index c3bfec7e61..131d78dc24 100644 --- a/voxygen/src/anim/dragon/mod.rs +++ b/voxygen/src/anim/dragon/mod.rs @@ -49,7 +49,7 @@ impl DragonSkeleton { impl Skeleton for DragonSkeleton { type Attr = SkeletonAttr; - fn compute_matrices(&self) -> [FigureBoneData; 16] { + fn compute_matrices(&self) -> [FigureBoneData; 18] { let chest_front_mat = self.chest_front.compute_base_matrix(); let wing_in_l_mat = self.wing_in_l.compute_base_matrix(); let wing_in_r_mat = self.wing_in_r.compute_base_matrix(); @@ -72,6 +72,8 @@ impl Skeleton for DragonSkeleton { FigureBoneData::default(), FigureBoneData::default(), FigureBoneData::default(), + FigureBoneData::default(), + FigureBoneData::default(), ] } diff --git a/voxygen/src/anim/fish_medium/mod.rs b/voxygen/src/anim/fish_medium/mod.rs index b085ed7220..5912719299 100644 --- a/voxygen/src/anim/fish_medium/mod.rs +++ b/voxygen/src/anim/fish_medium/mod.rs @@ -35,7 +35,7 @@ impl FishMediumSkeleton { impl Skeleton for FishMediumSkeleton { type Attr = SkeletonAttr; - fn compute_matrices(&self) -> [FigureBoneData; 16] { + fn compute_matrices(&self) -> [FigureBoneData; 18] { let torso_mat = self.torso.compute_base_matrix(); let rear_mat = self.rear.compute_base_matrix(); @@ -56,6 +56,8 @@ impl Skeleton for FishMediumSkeleton { FigureBoneData::default(), FigureBoneData::default(), FigureBoneData::default(), + FigureBoneData::default(), + FigureBoneData::default(), ] } diff --git a/voxygen/src/anim/fish_small/mod.rs b/voxygen/src/anim/fish_small/mod.rs index ed26ef0247..e1b47513f7 100644 --- a/voxygen/src/anim/fish_small/mod.rs +++ b/voxygen/src/anim/fish_small/mod.rs @@ -27,7 +27,7 @@ impl FishSmallSkeleton { impl Skeleton for FishSmallSkeleton { type Attr = SkeletonAttr; - fn compute_matrices(&self) -> [FigureBoneData; 16] { + fn compute_matrices(&self) -> [FigureBoneData; 18] { let torso_mat = self.torso.compute_base_matrix(); [ @@ -47,6 +47,8 @@ impl Skeleton for FishSmallSkeleton { FigureBoneData::default(), FigureBoneData::default(), FigureBoneData::default(), + FigureBoneData::default(), + FigureBoneData::default(), ] } diff --git a/voxygen/src/anim/fixture/mod.rs b/voxygen/src/anim/fixture/mod.rs index 92a68d0125..a243b923a4 100644 --- a/voxygen/src/anim/fixture/mod.rs +++ b/voxygen/src/anim/fixture/mod.rs @@ -13,7 +13,7 @@ impl FixtureSkeleton { impl Skeleton for FixtureSkeleton { type Attr = SkeletonAttr; - fn compute_matrices(&self) -> [FigureBoneData; 16] { + fn compute_matrices(&self) -> [FigureBoneData; 18] { [ FigureBoneData::new(vek::Mat4::identity()), FigureBoneData::new(vek::Mat4::identity()), @@ -31,6 +31,8 @@ impl Skeleton for FixtureSkeleton { FigureBoneData::new(vek::Mat4::identity()), FigureBoneData::new(vek::Mat4::identity()), FigureBoneData::new(vek::Mat4::identity()), + FigureBoneData::new(vek::Mat4::identity()), + FigureBoneData::new(vek::Mat4::identity()), ] } diff --git a/voxygen/src/anim/mod.rs b/voxygen/src/anim/mod.rs index 1a309e95c9..347df6f7e6 100644 --- a/voxygen/src/anim/mod.rs +++ b/voxygen/src/anim/mod.rs @@ -51,7 +51,7 @@ impl Bone { pub trait Skeleton: Send + Sync + 'static { type Attr; - fn compute_matrices(&self) -> [FigureBoneData; 16]; + fn compute_matrices(&self) -> [FigureBoneData; 18]; /// Change the current skeleton to be more like `target`. fn interpolate(&mut self, target: &Self, dt: f32); diff --git a/voxygen/src/anim/object/mod.rs b/voxygen/src/anim/object/mod.rs index d6f3ac510e..b9befc2522 100644 --- a/voxygen/src/anim/object/mod.rs +++ b/voxygen/src/anim/object/mod.rs @@ -15,7 +15,7 @@ const SCALE: f32 = 1.0 / 11.0; impl Skeleton for ObjectSkeleton { type Attr = SkeletonAttr; - fn compute_matrices(&self) -> [FigureBoneData; 16] { + fn compute_matrices(&self) -> [FigureBoneData; 18] { [ FigureBoneData::new(Mat4::scaling_3d(Vec3::broadcast(SCALE))), FigureBoneData::new(Mat4::scaling_3d(Vec3::broadcast(SCALE))), @@ -33,6 +33,8 @@ impl Skeleton for ObjectSkeleton { FigureBoneData::new(Mat4::scaling_3d(Vec3::broadcast(SCALE))), FigureBoneData::new(Mat4::scaling_3d(Vec3::broadcast(SCALE))), FigureBoneData::new(Mat4::scaling_3d(Vec3::broadcast(SCALE))), + FigureBoneData::new(Mat4::scaling_3d(Vec3::broadcast(SCALE))), + FigureBoneData::new(Mat4::scaling_3d(Vec3::broadcast(SCALE))), ] } diff --git a/voxygen/src/anim/quadruped_medium/mod.rs b/voxygen/src/anim/quadruped_medium/mod.rs index 57f36c9c1f..a30eaa0203 100644 --- a/voxygen/src/anim/quadruped_medium/mod.rs +++ b/voxygen/src/anim/quadruped_medium/mod.rs @@ -31,7 +31,7 @@ impl QuadrupedMediumSkeleton { impl Skeleton for QuadrupedMediumSkeleton { type Attr = SkeletonAttr; - fn compute_matrices(&self) -> [FigureBoneData; 16] { + fn compute_matrices(&self) -> [FigureBoneData; 18] { let ears_mat = self.ears.compute_base_matrix(); let head_upper_mat = self.head_upper.compute_base_matrix(); let head_lower_mat = self.head_lower.compute_base_matrix(); @@ -53,6 +53,8 @@ impl Skeleton for QuadrupedMediumSkeleton { FigureBoneData::default(), FigureBoneData::default(), FigureBoneData::default(), + FigureBoneData::default(), + FigureBoneData::default(), ] } diff --git a/voxygen/src/anim/quadruped_small/mod.rs b/voxygen/src/anim/quadruped_small/mod.rs index fb4c559fbf..a277b5aff8 100644 --- a/voxygen/src/anim/quadruped_small/mod.rs +++ b/voxygen/src/anim/quadruped_small/mod.rs @@ -26,7 +26,7 @@ impl QuadrupedSmallSkeleton { impl Skeleton for QuadrupedSmallSkeleton { type Attr = SkeletonAttr; - fn compute_matrices(&self) -> [FigureBoneData; 16] { + fn compute_matrices(&self) -> [FigureBoneData; 18] { [ FigureBoneData::new(self.head.compute_base_matrix()), FigureBoneData::new(self.chest.compute_base_matrix()), @@ -44,6 +44,8 @@ impl Skeleton for QuadrupedSmallSkeleton { FigureBoneData::default(), FigureBoneData::default(), FigureBoneData::default(), + FigureBoneData::default(), + FigureBoneData::default(), ] } diff --git a/voxygen/src/scene/figure/cache.rs b/voxygen/src/scene/figure/cache.rs index fdf0aef8cd..dcace2126d 100644 --- a/voxygen/src/scene/figure/cache.rs +++ b/voxygen/src/scene/figure/cache.rs @@ -172,19 +172,6 @@ impl FigureModelCache { }, CameraMode::FirstPerson => None, }, - if camera_mode != CameraMode::FirstPerson - || character_state - .map(|cs| { - cs.action.is_attack() - || cs.action.is_block() - || cs.action.is_wield() - }) - .unwrap_or_default() - { - Some(mesh_main(equipment.and_then(|e| e.main.as_ref()))) - } else { - None - }, match camera_mode { CameraMode::ThirdPerson => Some( humanoid_armor_shoulder_spec.mesh_left_shoulder(&body), @@ -198,6 +185,19 @@ impl FigureModelCache { CameraMode::FirstPerson => None, }, Some(mesh_glider()), + if camera_mode != CameraMode::FirstPerson + || character_state + .map(|cs| { + cs.action.is_attack() + || cs.action.is_block() + || cs.action.is_wield() + }) + .unwrap_or_default() + { + Some(mesh_main(equipment.and_then(|e| e.main.as_ref()))) + } else { + None + }, Some(mesh_lantern()), None, None,