From c6d20792356721ad2de8a4d41d1c11d4676bfc11 Mon Sep 17 00:00:00 2001 From: jshipsey Date: Sun, 19 May 2019 13:36:55 -0400 Subject: [PATCH 01/10] attack state Former-commit-id: 4cdbe71013233bc35d1dcac00dd9f45ed4037115 --- common/src/comp/actor.rs | 1 + common/src/sys/control.rs | 2 +- voxygen/src/anim/character/attack.rs | 116 ++++++++++++++++++++++++++ voxygen/src/anim/character/gliding.rs | 16 +++- voxygen/src/anim/character/idle.rs | 16 +++- voxygen/src/anim/character/jump.rs | 17 +++- voxygen/src/anim/character/mod.rs | 16 +++- voxygen/src/anim/character/run.rs | 8 ++ voxygen/src/scene/figure.rs | 30 ++++++- 9 files changed, 205 insertions(+), 17 deletions(-) create mode 100644 voxygen/src/anim/character/attack.rs diff --git a/common/src/comp/actor.rs b/common/src/comp/actor.rs index 109c90ceb8..f17a9f9262 100644 --- a/common/src/comp/actor.rs +++ b/common/src/comp/actor.rs @@ -253,6 +253,7 @@ pub enum Animation { Run, Jump, Gliding, + Attack, } impl Component for AnimationHistory { diff --git a/common/src/sys/control.rs b/common/src/sys/control.rs index 37610a8795..7cdb799db5 100644 --- a/common/src/sys/control.rs +++ b/common/src/sys/control.rs @@ -86,7 +86,7 @@ impl<'a> System<'a> for Sys { if control.move_dir.magnitude() > 0.01 { Animation::Run } else { - Animation::Idle + Animation::Attack } } else if gliding { Animation::Gliding diff --git a/voxygen/src/anim/character/attack.rs b/voxygen/src/anim/character/attack.rs new file mode 100644 index 0000000000..000ef57c92 --- /dev/null +++ b/voxygen/src/anim/character/attack.rs @@ -0,0 +1,116 @@ +// Standard +use std::{f32::consts::PI, ops::Mul}; + +// Library +use vek::*; + +// Local +use super::{super::Animation, CharacterSkeleton, SCALE}; + +pub struct Input { + pub attack: bool, +} +pub struct AttackAnimation; + +impl Animation for AttackAnimation { + type Skeleton = CharacterSkeleton; + type Dependency = f64; + + fn update_skeleton( + skeleton: &Self::Skeleton, + global_time: f64, + anim_time: f64, + ) -> Self::Skeleton { + let mut next = (*skeleton).clone(); + + let wave = (anim_time as f32 * 1.0).sin(); + let wave_cos = (anim_time as f32 * 12.0).cos(); + let wave_slow = (anim_time as f32 * 6.0 + PI).sin(); + let wave_slow_cos = (anim_time as f32 * 6.0 + PI).cos(); + let wave_ultra_slow = (anim_time as f32 * 1.0 + PI).sin(); + let wave_ultra_slow_cos = (anim_time as f32 * 1.0 + PI).cos(); + let wave_dip = (wave_slow.abs() - 0.5).abs(); + + let head_look = Vec2::new( + ((global_time + anim_time) as f32 / 8.0) + .floor() + .mul(7331.0) + .sin() + * 0.5, + ((global_time + anim_time) as f32 / 8.0) + .floor() + .mul(1337.0) + .sin() + * 0.25, + ); + next.head.offset = Vec3::new(5.5, 2.0, 11.0 + wave_ultra_slow * 0.3); + next.head.ori = Quaternion::rotation_z(head_look.x) * Quaternion::rotation_x(head_look.y); + next.head.scale = Vec3::one(); + + next.chest.offset = Vec3::new(5.5, 0.0, 7.0 + wave_ultra_slow * 0.3); + next.chest.ori = Quaternion::rotation_x(0.0); + next.chest.scale = Vec3::one(); + + next.belt.offset = Vec3::new(5.5, 0.0, 5.0 + wave_ultra_slow * 0.3); + next.belt.ori = Quaternion::rotation_x(0.0); + next.belt.scale = Vec3::one(); + + next.shorts.offset = Vec3::new(5.5, 0.0, 2.0 + wave_ultra_slow * 0.3); + next.shorts.ori = Quaternion::rotation_x(0.0); + next.shorts.scale = Vec3::one(); + + next.l_hand.offset = Vec3::new( + -6.0, + -2.0 + wave_ultra_slow_cos * 0.15, + 11.5 + 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( + 9.0, + -2.0 + wave_ultra_slow_cos * 0.15, + 11.5 + wave_ultra_slow * 0.5, + ); + next.r_hand.ori = Quaternion::rotation_x(0.0 + wave_ultra_slow * 0.06); + next.r_hand.scale = Vec3::one(); + + next.l_foot.offset = Vec3::new(-3.3, -0.1, 8.0); + next.l_foot.ori = Quaternion::identity(); + next.l_foot.scale = Vec3::one(); + + next.r_foot.offset = Vec3::new(4.1, -0.1, 8.0); + next.r_foot.ori = Quaternion::identity(); + next.r_foot.scale = Vec3::one(); + + next.weapon.offset = Vec3::new(-5.0, -6.0, 18.0); + next.weapon.ori = Quaternion::rotation_z(wave * 1.0); + next.weapon.scale = Vec3::one(); + + next.l_shoulder.offset = Vec3::new(-10.0, -3.0, 2.5); + next.l_shoulder.ori = Quaternion::rotation_x(0.0); + next.l_shoulder.scale = Vec3::one(); + + next.r_shoulder.offset = Vec3::new(0.0, -3.0, 2.5); + next.r_shoulder.ori = Quaternion::rotation_x(0.0); + next.r_shoulder.scale = Vec3::one(); + + next.draw.offset = Vec3::new(13.5, 0.0, 0.0); + next.draw.ori = Quaternion::rotation_y(0.0); + next.draw.scale = Vec3::one() * 0.0; + + next.l_hold.offset = Vec3::new(0.0, 0.0, 5.0); + next.l_hold.ori = Quaternion::rotation_x(0.0); + next.l_hold.scale = Vec3::one(); + + next.r_hold.offset = Vec3::new(-2.0, -2.5, 0.0); + next.r_hold.ori = Quaternion::rotation_x(0.0); + next.r_hold.scale = Vec3::one(); + + next.torso.offset = Vec3::new(-0.5, -0.2, 0.1); + next.torso.ori = Quaternion::rotation_x(0.0); + next.torso.scale = Vec3::one() / 11.0; + next + } +} diff --git a/voxygen/src/anim/character/gliding.rs b/voxygen/src/anim/character/gliding.rs index 1374ed9497..2bdb528f66 100644 --- a/voxygen/src/anim/character/gliding.rs +++ b/voxygen/src/anim/character/gliding.rs @@ -102,15 +102,23 @@ impl Animation for GlidingAnimation { next.r_shoulder.offset = Vec3::new(0.0, -3.0, 2.5); next.r_shoulder.ori = Quaternion::rotation_x(0.0); next.r_shoulder.scale = Vec3::one(); + + next.draw.offset = Vec3::new(13.5, 3.0, -1.0); + next.draw.ori = Quaternion::rotation_y(wave_very_slow_cos * 0.05); + next.draw.scale = Vec3::one(); + + next.l_hold.offset = Vec3::new(0.0, 0.0, 0.0); + next.l_hold.ori = Quaternion::rotation_x(0.0); + next.l_hold.scale = Vec3::one(); + + next.r_hold.offset = Vec3::new(0.0, 0.0, 0.0); + next.r_hold.ori = Quaternion::rotation_x(0.0); + next.r_hold.scale = Vec3::one(); next.torso.offset = Vec3::new(-0.5, -0.2, 0.0); next.torso.ori = Quaternion::rotation_x(-0.8 + wave_very_slow * 0.10); next.torso.scale = Vec3::one() / 11.0; - next.draw.offset = Vec3::new(13.5, 3.0, -1.0); - next.draw.ori = Quaternion::rotation_y(wave_very_slow_cos * 0.05); - next.draw.scale = Vec3::one(); - next } } diff --git a/voxygen/src/anim/character/idle.rs b/voxygen/src/anim/character/idle.rs index 79f7ce8b2d..d7cc70153f 100644 --- a/voxygen/src/anim/character/idle.rs +++ b/voxygen/src/anim/character/idle.rs @@ -96,13 +96,23 @@ impl Animation for IdleAnimation { next.r_shoulder.ori = Quaternion::rotation_x(0.0); next.r_shoulder.scale = Vec3::one(); + next.draw.offset = Vec3::new(13.5, 0.0, 0.0); + next.draw.ori = Quaternion::rotation_y(0.0); + next.draw.scale = Vec3::one() * 0.0; + + next.l_hold.offset = Vec3::new(0.0, 0.0, 0.0); + next.l_hold.ori = Quaternion::rotation_x(0.0); + next.l_hold.scale = Vec3::one(); + + next.r_hold.offset = Vec3::new(0.0, 0.0, 0.0); + next.r_hold.ori = Quaternion::rotation_x(0.0); + next.r_hold.scale = Vec3::one(); + next.torso.offset = Vec3::new(-0.5, -0.2, 0.1); next.torso.ori = Quaternion::rotation_x(0.0); next.torso.scale = Vec3::one() / 11.0; - next.draw.offset = Vec3::new(13.5, 0.0, 0.0); - next.draw.ori = Quaternion::rotation_y(0.0); - next.draw.scale = Vec3::one() * 0.0; + next } } diff --git a/voxygen/src/anim/character/jump.rs b/voxygen/src/anim/character/jump.rs index d72cad95d3..d9b63cd65e 100644 --- a/voxygen/src/anim/character/jump.rs +++ b/voxygen/src/anim/character/jump.rs @@ -75,13 +75,24 @@ impl Animation for JumpAnimation { next.r_shoulder.ori = Quaternion::rotation_x(0.0); next.r_shoulder.scale = Vec3::one(); + next.draw.offset = Vec3::new(13.5, 0.0, 0.0); + next.draw.ori = Quaternion::rotation_y(0.0); + next.draw.scale = Vec3::one() * 0.0; + + next.l_hold.offset = Vec3::new(0.0, 0.0, 0.0); + next.l_hold.ori = Quaternion::rotation_x(0.0); + next.l_hold.scale = Vec3::one(); + + next.r_hold.offset = Vec3::new(0.0, 0.0, 0.0); + next.r_hold.ori = Quaternion::rotation_x(0.0); + next.r_hold.scale = Vec3::one(); + next.torso.offset = Vec3::new(-0.5, -0.2, 0.0); next.torso.ori = Quaternion::rotation_x(-0.2); next.torso.scale = Vec3::one() / 11.0; - next.draw.offset = Vec3::new(13.5, 0.0, 0.0); - next.draw.ori = Quaternion::rotation_y(0.0); - next.draw.scale = Vec3::one() * 0.0; + + next } } diff --git a/voxygen/src/anim/character/mod.rs b/voxygen/src/anim/character/mod.rs index d1054716a5..9935aa496d 100644 --- a/voxygen/src/anim/character/mod.rs +++ b/voxygen/src/anim/character/mod.rs @@ -2,12 +2,15 @@ pub mod gliding; pub mod idle; pub mod jump; pub mod run; +pub mod attack; // Reexports pub use self::gliding::GlidingAnimation; pub use self::idle::IdleAnimation; pub use self::jump::JumpAnimation; pub use self::run::RunAnimation; +pub use self::attack::AttackAnimation; + // Crate use crate::render::FigureBoneData; @@ -30,6 +33,8 @@ pub struct CharacterSkeleton { l_shoulder: Bone, r_shoulder: Bone, draw: Bone, + l_hold: Bone, + r_hold: Bone, torso: Bone, } @@ -48,6 +53,8 @@ impl CharacterSkeleton { l_shoulder: Bone::default(), r_shoulder: Bone::default(), draw: Bone::default(), + l_hold: Bone::default(), + r_hold: Bone::default(), torso: Bone::default(), } } @@ -58,6 +65,7 @@ impl Skeleton for CharacterSkeleton { 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 weapon_mat = self.weapon.compute_base_matrix(); [ FigureBoneData::new(torso_mat * self.head.compute_base_matrix()), FigureBoneData::new(torso_mat * chest_mat), @@ -67,14 +75,14 @@ impl Skeleton for CharacterSkeleton { FigureBoneData::new(torso_mat * self.r_hand.compute_base_matrix()), 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 * self.weapon.compute_base_matrix()), + FigureBoneData::new(torso_mat * chest_mat * weapon_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 * l_hand_mat * self.draw.compute_base_matrix()), + FigureBoneData::new(torso_mat * weapon_mat * self.l_hold.compute_base_matrix()), + FigureBoneData::new(torso_mat * weapon_mat * self.r_hold.compute_base_matrix()), FigureBoneData::new(torso_mat), FigureBoneData::default(), - FigureBoneData::default(), - FigureBoneData::default(), ] } @@ -91,6 +99,8 @@ impl Skeleton for CharacterSkeleton { self.l_shoulder.interpolate(&target.l_shoulder); self.r_shoulder.interpolate(&target.r_shoulder); self.draw.interpolate(&target.draw); + self.l_hold.interpolate(&target.l_hold); + self.r_hold.interpolate(&target.r_hold); self.torso.interpolate(&target.torso); } } diff --git a/voxygen/src/anim/character/run.rs b/voxygen/src/anim/character/run.rs index fa72a5e70a..c92aea58db 100644 --- a/voxygen/src/anim/character/run.rs +++ b/voxygen/src/anim/character/run.rs @@ -80,6 +80,14 @@ impl Animation for RunAnimation { next.draw.ori = Quaternion::rotation_y(0.0); next.draw.scale = Vec3::one() * 0.0; + next.l_hold.offset = Vec3::new(0.0, 0.0, 0.0); + next.l_hold.ori = Quaternion::rotation_x(0.0); + next.l_hold.scale = Vec3::one(); + + next.r_hold.offset = Vec3::new(0.0, 0.0, 0.0); + next.r_hold.ori = Quaternion::rotation_x(0.0); + next.r_hold.scale = Vec3::one(); + next } } diff --git a/voxygen/src/scene/figure.rs b/voxygen/src/scene/figure.rs index 301f4d5a4c..2c12797791 100644 --- a/voxygen/src/scene/figure.rs +++ b/voxygen/src/scene/figure.rs @@ -69,8 +69,8 @@ impl FigureModelCache { Some(Self::load_left_shoulder(body.shoulder)), Some(Self::load_right_shoulder(body.shoulder)), Some(Self::load_draw(body.draw)), - None, - None, + Some(Self::load_left_hold(body.hand)), + Some(Self::load_right_hold(body.hand)), None, None, ], @@ -221,7 +221,7 @@ impl FigureModelCache { // TODO actually match against other weapons and set the right model _ => "weapon/sword/sword_wood_2h.vox", }, - Vec3::new(0.0, 0.0, -4.0), + Vec3::new(-6.5, -1.5, -4.0), ) } @@ -242,6 +242,7 @@ impl FigureModelCache { Vec3::new(2.5, -0.5, 0.0), ) } + fn load_draw(draw: Draw) -> Mesh { Self::load_mesh( match draw { @@ -251,6 +252,24 @@ impl FigureModelCache { ) } + fn load_left_hold(hand: Hand) -> Mesh { + Self::load_mesh( + match hand { + Hand::Default => "figure/body/hand.vox", + }, + Vec3::new(0.0, -2.5, 0.0), + ) + } + + fn load_right_hold(hand: Hand) -> Mesh { + Self::load_mesh( + match hand { + Hand::Default => "figure/body/hand.vox", + }, + Vec3::new(-2.0, -2.5, 0.0), + ) + } + fn load_pig_head(pig_head: PigHead) -> Mesh { Self::load_mesh( match pig_head { @@ -362,6 +381,11 @@ impl FigureMgr { time, animation_history.time, ), + comp::Animation::Attack => character::AttackAnimation::update_skeleton( + state.skeleton_mut(), + time, + animation_history.time, + ), comp::Animation::Gliding => { character::GlidingAnimation::update_skeleton( state.skeleton_mut(), From 726e6c1d0605264ee90546475336b9db4eee874e Mon Sep 17 00:00:00 2001 From: jshipsey Date: Sun, 19 May 2019 18:01:19 -0400 Subject: [PATCH 02/10] rotation simplification Former-commit-id: abc9b03ddb014946309dd566b443f7d57cb0a71d --- voxygen/src/anim/character/attack.rs | 28 ++++++++++++++-------------- voxygen/src/anim/character/mod.rs | 6 +++--- voxygen/src/scene/figure.rs | 4 ++-- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/voxygen/src/anim/character/attack.rs b/voxygen/src/anim/character/attack.rs index 000ef57c92..4e125ffda4 100644 --- a/voxygen/src/anim/character/attack.rs +++ b/voxygen/src/anim/character/attack.rs @@ -43,19 +43,19 @@ impl Animation for AttackAnimation { .sin() * 0.25, ); - next.head.offset = Vec3::new(5.5, 2.0, 11.0 + wave_ultra_slow * 0.3); - next.head.ori = Quaternion::rotation_z(head_look.x) * Quaternion::rotation_x(head_look.y); + next.head.offset = Vec3::new(5.5, 2.0, 11.0); + next.head.ori = Quaternion::rotation_z(0.0); next.head.scale = Vec3::one(); - next.chest.offset = Vec3::new(5.5, 0.0, 7.0 + wave_ultra_slow * 0.3); + next.chest.offset = Vec3::new(5.5, 0.0, 7.0); next.chest.ori = Quaternion::rotation_x(0.0); next.chest.scale = Vec3::one(); - next.belt.offset = Vec3::new(5.5, 0.0, 5.0 + wave_ultra_slow * 0.3); + next.belt.offset = Vec3::new(5.5, 0.0, 5.0); next.belt.ori = Quaternion::rotation_x(0.0); next.belt.scale = Vec3::one(); - next.shorts.offset = Vec3::new(5.5, 0.0, 2.0 + wave_ultra_slow * 0.3); + next.shorts.offset = Vec3::new(5.5, 0.0, 2.0); next.shorts.ori = Quaternion::rotation_x(0.0); next.shorts.scale = Vec3::one(); @@ -65,15 +65,15 @@ impl Animation for AttackAnimation { 11.5 + wave_ultra_slow * 0.5, ); - next.l_hand.ori = Quaternion::rotation_x(0.0 + wave_ultra_slow * 0.06); + next.l_hand.ori = Quaternion::rotation_x(0.0); next.l_hand.scale = Vec3::one(); next.r_hand.offset = Vec3::new( 9.0, - -2.0 + wave_ultra_slow_cos * 0.15, - 11.5 + wave_ultra_slow * 0.5, + -2.0, + 11.5, ); - next.r_hand.ori = Quaternion::rotation_x(0.0 + wave_ultra_slow * 0.06); + next.r_hand.ori = Quaternion::rotation_x(0.0); next.r_hand.scale = Vec3::one(); next.l_foot.offset = Vec3::new(-3.3, -0.1, 8.0); @@ -84,8 +84,8 @@ impl Animation for AttackAnimation { next.r_foot.ori = Quaternion::identity(); next.r_foot.scale = Vec3::one(); - next.weapon.offset = Vec3::new(-5.0, -6.0, 18.0); - next.weapon.ori = Quaternion::rotation_z(wave * 1.0); + next.weapon.offset = Vec3::new(0.0, 0.0, 0.0); + next.weapon.ori = Quaternion::identity(); next.weapon.scale = Vec3::one(); next.l_shoulder.offset = Vec3::new(-10.0, -3.0, 2.5); @@ -100,11 +100,11 @@ impl Animation for AttackAnimation { next.draw.ori = Quaternion::rotation_y(0.0); next.draw.scale = Vec3::one() * 0.0; - next.l_hold.offset = Vec3::new(0.0, 0.0, 5.0); - next.l_hold.ori = Quaternion::rotation_x(0.0); + next.l_hold.offset = Vec3::new(0.0, 0.0, 25.0); + next.l_hold.ori = Quaternion::rotation_z(wave * 10.0); next.l_hold.scale = Vec3::one(); - next.r_hold.offset = Vec3::new(-2.0, -2.5, 0.0); + next.r_hold.offset = Vec3::new(2.0, 2.5, 0.0); next.r_hold.ori = Quaternion::rotation_x(0.0); next.r_hold.scale = Vec3::one(); diff --git a/voxygen/src/anim/character/mod.rs b/voxygen/src/anim/character/mod.rs index 9935aa496d..539010e28d 100644 --- a/voxygen/src/anim/character/mod.rs +++ b/voxygen/src/anim/character/mod.rs @@ -75,12 +75,12 @@ impl Skeleton for CharacterSkeleton { FigureBoneData::new(torso_mat * self.r_hand.compute_base_matrix()), 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 * weapon_mat), + FigureBoneData::new(torso_mat * chest_mat * self.l_hold.compute_base_matrix() * weapon_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 * l_hand_mat * self.draw.compute_base_matrix()), - FigureBoneData::new(torso_mat * weapon_mat * self.l_hold.compute_base_matrix()), - FigureBoneData::new(torso_mat * weapon_mat * self.r_hold.compute_base_matrix()), + FigureBoneData::new(torso_mat * self.l_hold.compute_base_matrix()), + FigureBoneData::new(torso_mat * self.r_hold.compute_base_matrix()), FigureBoneData::new(torso_mat), FigureBoneData::default(), ] diff --git a/voxygen/src/scene/figure.rs b/voxygen/src/scene/figure.rs index 2c12797791..093470f806 100644 --- a/voxygen/src/scene/figure.rs +++ b/voxygen/src/scene/figure.rs @@ -257,7 +257,7 @@ impl FigureModelCache { match hand { Hand::Default => "figure/body/hand.vox", }, - Vec3::new(0.0, -2.5, 0.0), + Vec3::new(-2.0, -2.5, 0.0), ) } @@ -266,7 +266,7 @@ impl FigureModelCache { match hand { Hand::Default => "figure/body/hand.vox", }, - Vec3::new(-2.0, -2.5, 0.0), + Vec3::new(-2.0, 2.5, 0.0), ) } From e4e045bda660c6f0310988e03227e63a78af18c3 Mon Sep 17 00:00:00 2001 From: jshipsey Date: Wed, 22 May 2019 01:11:31 -0400 Subject: [PATCH 03/10] laying groundwork for combat anims, untangling skeleton Former-commit-id: a17189557788b09f91b720ff695767c9229fc726 --- voxygen/src/anim/character/attack.rs | 42 ++++++++++++++------------- voxygen/src/anim/character/gliding.rs | 37 ++++++++++------------- voxygen/src/anim/character/idle.rs | 17 ++++------- voxygen/src/anim/character/jump.rs | 22 +++++--------- voxygen/src/anim/character/mod.rs | 23 +++++++-------- voxygen/src/anim/character/run.rs | 20 +++++-------- voxygen/src/scene/figure.rs | 27 +++++++---------- 7 files changed, 79 insertions(+), 109 deletions(-) diff --git a/voxygen/src/anim/character/attack.rs b/voxygen/src/anim/character/attack.rs index 4e125ffda4..83f81153b8 100644 --- a/voxygen/src/anim/character/attack.rs +++ b/voxygen/src/anim/character/attack.rs @@ -29,7 +29,11 @@ impl Animation for AttackAnimation { let wave_slow_cos = (anim_time as f32 * 6.0 + PI).cos(); let wave_ultra_slow = (anim_time as f32 * 1.0 + PI).sin(); let wave_ultra_slow_cos = (anim_time as f32 * 1.0 + PI).cos(); - let wave_dip = (wave_slow.abs() - 0.5).abs(); + let wave_stop = (anim_time as f32 * 3.0).min(PI / 2.0).sin(); + let wave_stop_alt = (anim_time as f32 * 28.0).min(PI / 2.0).sin(); + let wave_stop_quick = (anim_time as f32 * 8.0).min(PI / 2.0).sin(); + let peakwave = 1.0- (anim_time as f32 * 1.0).cos(); + let head_look = Vec2::new( ((global_time + anim_time) as f32 / 8.0) @@ -60,21 +64,21 @@ impl Animation for AttackAnimation { next.shorts.scale = Vec3::one(); next.l_hand.offset = Vec3::new( - -6.0, - -2.0 + wave_ultra_slow_cos * 0.15, - 11.5 + wave_ultra_slow * 0.5, - ); + -8.0, + 4.0, + 9.0, + ) / 11.0; - next.l_hand.ori = Quaternion::rotation_x(0.0); - next.l_hand.scale = Vec3::one(); + next.l_hand.ori = Quaternion::rotation_x(0.0 + wave_ultra_slow * 0.5); + next.l_hand.scale = Vec3::one() / 11.0; next.r_hand.offset = Vec3::new( - 9.0, - -2.0, - 11.5, - ); + 8.0, + 4.0, + 6.5, + ) / 11.0; next.r_hand.ori = Quaternion::rotation_x(0.0); - next.r_hand.scale = Vec3::one(); + next.r_hand.scale = Vec3::one() / 11.0; next.l_foot.offset = Vec3::new(-3.3, -0.1, 8.0); next.l_foot.ori = Quaternion::identity(); @@ -84,8 +88,8 @@ impl Animation for AttackAnimation { next.r_foot.ori = Quaternion::identity(); next.r_foot.scale = Vec3::one(); - next.weapon.offset = Vec3::new(0.0, 0.0, 0.0); - next.weapon.ori = Quaternion::identity(); + next.weapon.offset = Vec3::new(-12.0, -2.0, 11.0); + next.weapon.ori = Quaternion::rotation_y(2.5); next.weapon.scale = Vec3::one(); next.l_shoulder.offset = Vec3::new(-10.0, -3.0, 2.5); @@ -100,13 +104,11 @@ impl Animation for AttackAnimation { next.draw.ori = Quaternion::rotation_y(0.0); next.draw.scale = Vec3::one() * 0.0; - next.l_hold.offset = Vec3::new(0.0, 0.0, 25.0); - next.l_hold.ori = Quaternion::rotation_z(wave * 10.0); - next.l_hold.scale = Vec3::one(); - next.r_hold.offset = Vec3::new(2.0, 2.5, 0.0); - next.r_hold.ori = Quaternion::rotation_x(0.0); - next.r_hold.scale = Vec3::one(); + next.left_equip.offset = Vec3::new(-8.0, 4.0, 10.0) / 13.0; + next.left_equip.ori = Quaternion::rotation_x(0.0 + wave_ultra_slow * 0.5) * Quaternion::rotation_z(1.57); + next.left_equip.scale = Vec3::one() / 11.0; + next.torso.offset = Vec3::new(-0.5, -0.2, 0.1); next.torso.ori = Quaternion::rotation_x(0.0); diff --git a/voxygen/src/anim/character/gliding.rs b/voxygen/src/anim/character/gliding.rs index 2bdb528f66..9319c57a3b 100644 --- a/voxygen/src/anim/character/gliding.rs +++ b/voxygen/src/anim/character/gliding.rs @@ -64,20 +64,20 @@ impl Animation for GlidingAnimation { next.shorts.scale = Vec3::one(); next.l_hand.offset = Vec3::new( - -8.0, - -10.0 + wave_very_slow * 2.5, - 18.5 + wave_very_slow * 1.0, - ); - next.l_hand.ori = Quaternion::rotation_x(0.9 - wave_very_slow * 0.10); - next.l_hand.scale = Vec3::one(); + -10.0, + 6.0 - wave_very_slow * 1.50, + 15.0 + wave_very_slow * 0.50, + ) / 11.0; + next.l_hand.ori = Quaternion::rotation_x(0.2 + wave_very_slow_cos * 0.05); + next.l_hand.scale = Vec3::one() / 11.0; next.r_hand.offset = Vec3::new( - 11.0, - -10.0 + wave_very_slow * 2.5, - 18.5 + wave_very_slow * 1.0, - ); - next.r_hand.ori = Quaternion::rotation_x(0.9 - wave_very_slow * 0.10); - next.r_hand.scale = Vec3::one(); + 10.0, + 6.0 - wave_very_slow * 1.50, + 14.5 + wave_very_slow * 0.50, + ) / 11.0; + next.r_hand.ori = Quaternion::rotation_x(0.1 + wave_very_slow * 0.05); + next.r_hand.scale = Vec3::one() / 11.0; next.l_foot.offset = Vec3::new(-3.4, 1.0, 8.0); next.l_foot.ori = Quaternion::rotation_x( @@ -91,7 +91,7 @@ impl Animation for GlidingAnimation { ); next.r_foot.scale = Vec3::one(); - next.weapon.offset = Vec3::new(-5.0, -6.0, 19.0); + next.weapon.offset = Vec3::new(-5.0, -5.0, 12.0); next.weapon.ori = Quaternion::rotation_y(2.5); next.weapon.scale = Vec3::one(); @@ -103,17 +103,10 @@ impl Animation for GlidingAnimation { next.r_shoulder.ori = Quaternion::rotation_x(0.0); next.r_shoulder.scale = Vec3::one(); - next.draw.offset = Vec3::new(13.5, 3.0, -1.0); - next.draw.ori = Quaternion::rotation_y(wave_very_slow_cos * 0.05); + next.draw.offset = Vec3::new(5.5, -9.0 + wave_very_slow * 0.10, 18.0); + next.draw.ori = Quaternion::rotation_x(0.95 - wave_very_slow * 0.15) * Quaternion::rotation_y(wave_very_slow_cos * 0.04); next.draw.scale = Vec3::one(); - next.l_hold.offset = Vec3::new(0.0, 0.0, 0.0); - next.l_hold.ori = Quaternion::rotation_x(0.0); - next.l_hold.scale = Vec3::one(); - - next.r_hold.offset = Vec3::new(0.0, 0.0, 0.0); - next.r_hold.ori = Quaternion::rotation_x(0.0); - next.r_hold.scale = Vec3::one(); next.torso.offset = Vec3::new(-0.5, -0.2, 0.0); next.torso.ori = Quaternion::rotation_x(-0.8 + wave_very_slow * 0.10); diff --git a/voxygen/src/anim/character/idle.rs b/voxygen/src/anim/character/idle.rs index d7cc70153f..aac4e46703 100644 --- a/voxygen/src/anim/character/idle.rs +++ b/voxygen/src/anim/character/idle.rs @@ -63,18 +63,18 @@ impl Animation for IdleAnimation { -6.0, -2.0 + wave_ultra_slow_cos * 0.15, 11.5 + wave_ultra_slow * 0.5, - ); + ) / 11.; next.l_hand.ori = Quaternion::rotation_x(0.0 + wave_ultra_slow * 0.06); - next.l_hand.scale = Vec3::one(); + next.l_hand.scale = Vec3::one() / 11.; next.r_hand.offset = Vec3::new( 9.0, -2.0 + wave_ultra_slow_cos * 0.15, 11.5 + wave_ultra_slow * 0.5, - ); + ) / 11.; next.r_hand.ori = Quaternion::rotation_x(0.0 + wave_ultra_slow * 0.06); - next.r_hand.scale = Vec3::one(); + next.r_hand.scale = Vec3::one() / 11.; next.l_foot.offset = Vec3::new(-3.3, -0.1, 8.0); next.l_foot.ori = Quaternion::identity(); @@ -84,7 +84,7 @@ impl Animation for IdleAnimation { next.r_foot.ori = Quaternion::identity(); next.r_foot.scale = Vec3::one(); - next.weapon.offset = Vec3::new(-5.0, -6.0, 18.0); + next.weapon.offset = Vec3::new(-5.0, -5.0, 12.0); next.weapon.ori = Quaternion::rotation_y(2.5); next.weapon.scale = Vec3::one(); @@ -100,13 +100,6 @@ impl Animation for IdleAnimation { next.draw.ori = Quaternion::rotation_y(0.0); next.draw.scale = Vec3::one() * 0.0; - next.l_hold.offset = Vec3::new(0.0, 0.0, 0.0); - next.l_hold.ori = Quaternion::rotation_x(0.0); - next.l_hold.scale = Vec3::one(); - - next.r_hold.offset = Vec3::new(0.0, 0.0, 0.0); - next.r_hold.ori = Quaternion::rotation_x(0.0); - next.r_hold.scale = Vec3::one(); next.torso.offset = Vec3::new(-0.5, -0.2, 0.1); next.torso.ori = Quaternion::rotation_x(0.0); diff --git a/voxygen/src/anim/character/jump.rs b/voxygen/src/anim/character/jump.rs index d9b63cd65e..4536b8165c 100644 --- a/voxygen/src/anim/character/jump.rs +++ b/voxygen/src/anim/character/jump.rs @@ -47,13 +47,13 @@ impl Animation for JumpAnimation { next.shorts.ori = Quaternion::rotation_z(0.0); next.shorts.scale = Vec3::one(); - next.l_hand.offset = Vec3::new(-6.0, 0.0, 12.0); - next.l_hand.ori = Quaternion::rotation_x(wave_stop_alt * 1.2 - wave_slow * 0.15); - next.l_hand.scale = Vec3::one(); + next.l_hand.offset = Vec3::new(-8.0, 0.0 + wave_stop * 3.2, 7.0 + wave_stop * 3.2 -wave * 0.3) / 11.0; + next.l_hand.ori = Quaternion::rotation_x(wave_stop_alt * 0.6); + next.l_hand.scale = Vec3::one() / 11.0; - next.r_hand.offset = Vec3::new(9.0, 0.0, 12.0); - next.r_hand.ori = Quaternion::rotation_x(wave_stop_alt * -1.2 + wave_slow * 0.15); - next.r_hand.scale = Vec3::one(); + next.r_hand.offset = Vec3::new(8.0, 0.0 + wave_stop * -3.2, 7.0 + wave_stop * 3.2 - wave * 0.3) / 11.0; + next.r_hand.ori = Quaternion::rotation_x(-wave_stop_alt * 0.6); + next.r_hand.scale = Vec3::one() / 11.0; next.l_foot.offset = Vec3::new(-3.4, 1.0, 6.0); next.l_foot.ori = Quaternion::rotation_x(wave_stop * -1.2 - wave_slow * 0.2); @@ -63,7 +63,7 @@ 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.weapon.offset = Vec3::new(-5.0, -6.0, 19.0); + next.weapon.offset = Vec3::new(-5.0, -5.0, 12.0); next.weapon.ori = Quaternion::rotation_y(2.5); next.weapon.scale = Vec3::one(); @@ -79,14 +79,8 @@ impl Animation for JumpAnimation { next.draw.ori = Quaternion::rotation_y(0.0); next.draw.scale = Vec3::one() * 0.0; - next.l_hold.offset = Vec3::new(0.0, 0.0, 0.0); - next.l_hold.ori = Quaternion::rotation_x(0.0); - next.l_hold.scale = Vec3::one(); - next.r_hold.offset = Vec3::new(0.0, 0.0, 0.0); - next.r_hold.ori = Quaternion::rotation_x(0.0); - next.r_hold.scale = Vec3::one(); - + next.torso.offset = Vec3::new(-0.5, -0.2, 0.0); next.torso.ori = Quaternion::rotation_x(-0.2); next.torso.scale = Vec3::one() / 11.0; diff --git a/voxygen/src/anim/character/mod.rs b/voxygen/src/anim/character/mod.rs index 539010e28d..6738970965 100644 --- a/voxygen/src/anim/character/mod.rs +++ b/voxygen/src/anim/character/mod.rs @@ -33,8 +33,7 @@ pub struct CharacterSkeleton { l_shoulder: Bone, r_shoulder: Bone, draw: Bone, - l_hold: Bone, - r_hold: Bone, + left_equip: Bone, torso: Bone, } @@ -53,8 +52,7 @@ impl CharacterSkeleton { l_shoulder: Bone::default(), r_shoulder: Bone::default(), draw: Bone::default(), - l_hold: Bone::default(), - r_hold: Bone::default(), + left_equip: Bone::default(), torso: Bone::default(), } } @@ -71,18 +69,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 * l_hand_mat), - FigureBoneData::new(torso_mat * self.r_hand.compute_base_matrix()), + FigureBoneData::new(l_hand_mat), + FigureBoneData::new(self.r_hand.compute_base_matrix()), 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 * self.l_hold.compute_base_matrix() * weapon_mat), + FigureBoneData::new(torso_mat * chest_mat * weapon_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 * l_hand_mat * self.draw.compute_base_matrix()), - FigureBoneData::new(torso_mat * self.l_hold.compute_base_matrix()), - FigureBoneData::new(torso_mat * self.r_hold.compute_base_matrix()), + FigureBoneData::new(torso_mat * self.draw.compute_base_matrix()), + FigureBoneData::new(self.left_equip.compute_base_matrix()), FigureBoneData::new(torso_mat), FigureBoneData::default(), + FigureBoneData::default(), + + ] } @@ -99,8 +99,7 @@ impl Skeleton for CharacterSkeleton { self.l_shoulder.interpolate(&target.l_shoulder); self.r_shoulder.interpolate(&target.r_shoulder); self.draw.interpolate(&target.draw); - self.l_hold.interpolate(&target.l_hold); - self.r_hold.interpolate(&target.r_hold); + self.left_equip.interpolate(&target.left_equip); self.torso.interpolate(&target.torso); } } diff --git a/voxygen/src/anim/character/run.rs b/voxygen/src/anim/character/run.rs index c92aea58db..0a2b71e283 100644 --- a/voxygen/src/anim/character/run.rs +++ b/voxygen/src/anim/character/run.rs @@ -24,6 +24,7 @@ impl Animation for RunAnimation { let wave_test = (wave.cbrt()); let fuzz_wave = (anim_time as f32 * 12.0).sin(); let wave_cos = (anim_time as f32 * 14.0).cos(); + let wave_cosdouble = (anim_time as f32 * 28.0).cos(); let wave_slow = (anim_time as f32 * 7.0 + PI).sin(); let wave_slow_cos = (anim_time as f32 * 8.0 + PI).cos(); let wave_dip = (wave_slow.abs() - 0.5).abs(); @@ -44,15 +45,15 @@ impl Animation for RunAnimation { next.shorts.ori = Quaternion::rotation_z(wave * 0.6); next.shorts.scale = Vec3::one(); - next.l_hand.offset = Vec3::new(-6.0, 0.0 + wave_cos * 2.5, 11.0 - wave * 1.5); + next.l_hand.offset = Vec3::new(-8.0, 3.0 + wave_cos * 5.0, 9.0 - wave * 2.0) / 11.0; next.l_hand.ori = Quaternion::rotation_x(wave_cos * 0.9); - next.l_hand.scale = Vec3::one(); + next.l_hand.scale = Vec3::one() / 11.0; - next.r_hand.offset = Vec3::new(9.0, 0.0 - wave_cos * 2.5, 11.0 + wave * 1.5); + next.r_hand.offset = Vec3::new(8.0, 3.0 - wave_cos * 5.0, 9.0 + wave * 2.0) / 11.0; next.r_hand.ori = Quaternion::rotation_x(wave_cos * -0.9); - next.r_hand.scale = Vec3::one(); + next.r_hand.scale = Vec3::one() / 11.0; - next.l_foot.offset = Vec3::new(-3.4, 0.0 + wave * 1.0, 6.0); + next.l_foot.offset = Vec3::new(-3.4, 0.0 + wave * 1.0, 6.0); next.l_foot.ori = Quaternion::rotation_x(-0.0 - wave * 1.5); next.l_foot.scale = Vec3::one(); @@ -60,7 +61,7 @@ impl Animation for RunAnimation { next.r_foot.ori = Quaternion::rotation_x(-0.0 + wave * 1.5); next.r_foot.scale = Vec3::one(); - next.weapon.offset = Vec3::new(-5.0, -6.0, 18.0); + next.weapon.offset = Vec3::new(-5.0, -5.0, 12.0); next.weapon.ori = Quaternion::rotation_y(2.5); next.weapon.scale = Vec3::one(); @@ -80,13 +81,6 @@ impl Animation for RunAnimation { next.draw.ori = Quaternion::rotation_y(0.0); next.draw.scale = Vec3::one() * 0.0; - next.l_hold.offset = Vec3::new(0.0, 0.0, 0.0); - next.l_hold.ori = Quaternion::rotation_x(0.0); - next.l_hold.scale = Vec3::one(); - - next.r_hold.offset = Vec3::new(0.0, 0.0, 0.0); - next.r_hold.ori = Quaternion::rotation_x(0.0); - next.r_hold.scale = Vec3::one(); next } diff --git a/voxygen/src/scene/figure.rs b/voxygen/src/scene/figure.rs index 093470f806..911ae52f35 100644 --- a/voxygen/src/scene/figure.rs +++ b/voxygen/src/scene/figure.rs @@ -69,8 +69,8 @@ impl FigureModelCache { Some(Self::load_left_shoulder(body.shoulder)), Some(Self::load_right_shoulder(body.shoulder)), Some(Self::load_draw(body.draw)), - Some(Self::load_left_hold(body.hand)), - Some(Self::load_right_hold(body.hand)), + Some(Self::load_left_equip(body.weapon)), + None, None, None, ], @@ -181,7 +181,7 @@ impl FigureModelCache { match hand { Hand::Default => "figure/body/hand.vox", }, - Vec3::new(2.0, 0.0, -7.0), + Vec3::new(-2.0, -2.5, -2.0), ) } @@ -190,7 +190,7 @@ impl FigureModelCache { match hand { Hand::Default => "figure/body/hand.vox", }, - Vec3::new(2.0, 0.0, -7.0), + Vec3::new(-2.0, -2.5, -2.0), ) } @@ -252,23 +252,18 @@ impl FigureModelCache { ) } - fn load_left_hold(hand: Hand) -> Mesh { + fn load_left_equip(weapon: Weapon) -> Mesh { Self::load_mesh( - match hand { - Hand::Default => "figure/body/hand.vox", + match weapon { + Weapon::Sword => "weapon/sword/sword_wood_2h.vox", + _ => "weapon/sword/sword_wood_2h.vox", + }, - Vec3::new(-2.0, -2.5, 0.0), + Vec3::new(-6.5, -1.5, -5.0), ) } - fn load_right_hold(hand: Hand) -> Mesh { - Self::load_mesh( - match hand { - Hand::Default => "figure/body/hand.vox", - }, - Vec3::new(-2.0, 2.5, 0.0), - ) - } + fn load_pig_head(pig_head: PigHead) -> Mesh { Self::load_mesh( From 921019cf682f76b0c0f3f86ab27e01bb12c8e7fd Mon Sep 17 00:00:00 2001 From: jshipsey Date: Sun, 19 May 2019 13:36:55 -0400 Subject: [PATCH 04/10] attack state Former-commit-id: a97fc3466bb92a12ea59376f058864846ef125f3 --- common/src/comp/actor.rs | 1 + common/src/sys/control.rs | 2 +- voxygen/src/anim/character/attack.rs | 116 ++++++++++++++++++++++++++ voxygen/src/anim/character/gliding.rs | 16 +++- voxygen/src/anim/character/idle.rs | 16 +++- voxygen/src/anim/character/jump.rs | 17 +++- voxygen/src/anim/character/mod.rs | 16 +++- voxygen/src/anim/character/run.rs | 8 ++ voxygen/src/scene/figure.rs | 30 ++++++- 9 files changed, 205 insertions(+), 17 deletions(-) create mode 100644 voxygen/src/anim/character/attack.rs diff --git a/common/src/comp/actor.rs b/common/src/comp/actor.rs index 109c90ceb8..f17a9f9262 100644 --- a/common/src/comp/actor.rs +++ b/common/src/comp/actor.rs @@ -253,6 +253,7 @@ pub enum Animation { Run, Jump, Gliding, + Attack, } impl Component for AnimationHistory { diff --git a/common/src/sys/control.rs b/common/src/sys/control.rs index 0fa60fe0d0..df1b63fc26 100644 --- a/common/src/sys/control.rs +++ b/common/src/sys/control.rs @@ -86,7 +86,7 @@ impl<'a> System<'a> for Sys { if control.move_dir.magnitude() > 0.01 { Animation::Run } else { - Animation::Idle + Animation::Attack } } else if gliding { Animation::Gliding diff --git a/voxygen/src/anim/character/attack.rs b/voxygen/src/anim/character/attack.rs new file mode 100644 index 0000000000..000ef57c92 --- /dev/null +++ b/voxygen/src/anim/character/attack.rs @@ -0,0 +1,116 @@ +// Standard +use std::{f32::consts::PI, ops::Mul}; + +// Library +use vek::*; + +// Local +use super::{super::Animation, CharacterSkeleton, SCALE}; + +pub struct Input { + pub attack: bool, +} +pub struct AttackAnimation; + +impl Animation for AttackAnimation { + type Skeleton = CharacterSkeleton; + type Dependency = f64; + + fn update_skeleton( + skeleton: &Self::Skeleton, + global_time: f64, + anim_time: f64, + ) -> Self::Skeleton { + let mut next = (*skeleton).clone(); + + let wave = (anim_time as f32 * 1.0).sin(); + let wave_cos = (anim_time as f32 * 12.0).cos(); + let wave_slow = (anim_time as f32 * 6.0 + PI).sin(); + let wave_slow_cos = (anim_time as f32 * 6.0 + PI).cos(); + let wave_ultra_slow = (anim_time as f32 * 1.0 + PI).sin(); + let wave_ultra_slow_cos = (anim_time as f32 * 1.0 + PI).cos(); + let wave_dip = (wave_slow.abs() - 0.5).abs(); + + let head_look = Vec2::new( + ((global_time + anim_time) as f32 / 8.0) + .floor() + .mul(7331.0) + .sin() + * 0.5, + ((global_time + anim_time) as f32 / 8.0) + .floor() + .mul(1337.0) + .sin() + * 0.25, + ); + next.head.offset = Vec3::new(5.5, 2.0, 11.0 + wave_ultra_slow * 0.3); + next.head.ori = Quaternion::rotation_z(head_look.x) * Quaternion::rotation_x(head_look.y); + next.head.scale = Vec3::one(); + + next.chest.offset = Vec3::new(5.5, 0.0, 7.0 + wave_ultra_slow * 0.3); + next.chest.ori = Quaternion::rotation_x(0.0); + next.chest.scale = Vec3::one(); + + next.belt.offset = Vec3::new(5.5, 0.0, 5.0 + wave_ultra_slow * 0.3); + next.belt.ori = Quaternion::rotation_x(0.0); + next.belt.scale = Vec3::one(); + + next.shorts.offset = Vec3::new(5.5, 0.0, 2.0 + wave_ultra_slow * 0.3); + next.shorts.ori = Quaternion::rotation_x(0.0); + next.shorts.scale = Vec3::one(); + + next.l_hand.offset = Vec3::new( + -6.0, + -2.0 + wave_ultra_slow_cos * 0.15, + 11.5 + 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( + 9.0, + -2.0 + wave_ultra_slow_cos * 0.15, + 11.5 + wave_ultra_slow * 0.5, + ); + next.r_hand.ori = Quaternion::rotation_x(0.0 + wave_ultra_slow * 0.06); + next.r_hand.scale = Vec3::one(); + + next.l_foot.offset = Vec3::new(-3.3, -0.1, 8.0); + next.l_foot.ori = Quaternion::identity(); + next.l_foot.scale = Vec3::one(); + + next.r_foot.offset = Vec3::new(4.1, -0.1, 8.0); + next.r_foot.ori = Quaternion::identity(); + next.r_foot.scale = Vec3::one(); + + next.weapon.offset = Vec3::new(-5.0, -6.0, 18.0); + next.weapon.ori = Quaternion::rotation_z(wave * 1.0); + next.weapon.scale = Vec3::one(); + + next.l_shoulder.offset = Vec3::new(-10.0, -3.0, 2.5); + next.l_shoulder.ori = Quaternion::rotation_x(0.0); + next.l_shoulder.scale = Vec3::one(); + + next.r_shoulder.offset = Vec3::new(0.0, -3.0, 2.5); + next.r_shoulder.ori = Quaternion::rotation_x(0.0); + next.r_shoulder.scale = Vec3::one(); + + next.draw.offset = Vec3::new(13.5, 0.0, 0.0); + next.draw.ori = Quaternion::rotation_y(0.0); + next.draw.scale = Vec3::one() * 0.0; + + next.l_hold.offset = Vec3::new(0.0, 0.0, 5.0); + next.l_hold.ori = Quaternion::rotation_x(0.0); + next.l_hold.scale = Vec3::one(); + + next.r_hold.offset = Vec3::new(-2.0, -2.5, 0.0); + next.r_hold.ori = Quaternion::rotation_x(0.0); + next.r_hold.scale = Vec3::one(); + + next.torso.offset = Vec3::new(-0.5, -0.2, 0.1); + next.torso.ori = Quaternion::rotation_x(0.0); + next.torso.scale = Vec3::one() / 11.0; + next + } +} diff --git a/voxygen/src/anim/character/gliding.rs b/voxygen/src/anim/character/gliding.rs index 1374ed9497..2bdb528f66 100644 --- a/voxygen/src/anim/character/gliding.rs +++ b/voxygen/src/anim/character/gliding.rs @@ -102,15 +102,23 @@ impl Animation for GlidingAnimation { next.r_shoulder.offset = Vec3::new(0.0, -3.0, 2.5); next.r_shoulder.ori = Quaternion::rotation_x(0.0); next.r_shoulder.scale = Vec3::one(); + + next.draw.offset = Vec3::new(13.5, 3.0, -1.0); + next.draw.ori = Quaternion::rotation_y(wave_very_slow_cos * 0.05); + next.draw.scale = Vec3::one(); + + next.l_hold.offset = Vec3::new(0.0, 0.0, 0.0); + next.l_hold.ori = Quaternion::rotation_x(0.0); + next.l_hold.scale = Vec3::one(); + + next.r_hold.offset = Vec3::new(0.0, 0.0, 0.0); + next.r_hold.ori = Quaternion::rotation_x(0.0); + next.r_hold.scale = Vec3::one(); next.torso.offset = Vec3::new(-0.5, -0.2, 0.0); next.torso.ori = Quaternion::rotation_x(-0.8 + wave_very_slow * 0.10); next.torso.scale = Vec3::one() / 11.0; - next.draw.offset = Vec3::new(13.5, 3.0, -1.0); - next.draw.ori = Quaternion::rotation_y(wave_very_slow_cos * 0.05); - next.draw.scale = Vec3::one(); - next } } diff --git a/voxygen/src/anim/character/idle.rs b/voxygen/src/anim/character/idle.rs index 79f7ce8b2d..d7cc70153f 100644 --- a/voxygen/src/anim/character/idle.rs +++ b/voxygen/src/anim/character/idle.rs @@ -96,13 +96,23 @@ impl Animation for IdleAnimation { next.r_shoulder.ori = Quaternion::rotation_x(0.0); next.r_shoulder.scale = Vec3::one(); + next.draw.offset = Vec3::new(13.5, 0.0, 0.0); + next.draw.ori = Quaternion::rotation_y(0.0); + next.draw.scale = Vec3::one() * 0.0; + + next.l_hold.offset = Vec3::new(0.0, 0.0, 0.0); + next.l_hold.ori = Quaternion::rotation_x(0.0); + next.l_hold.scale = Vec3::one(); + + next.r_hold.offset = Vec3::new(0.0, 0.0, 0.0); + next.r_hold.ori = Quaternion::rotation_x(0.0); + next.r_hold.scale = Vec3::one(); + next.torso.offset = Vec3::new(-0.5, -0.2, 0.1); next.torso.ori = Quaternion::rotation_x(0.0); next.torso.scale = Vec3::one() / 11.0; - next.draw.offset = Vec3::new(13.5, 0.0, 0.0); - next.draw.ori = Quaternion::rotation_y(0.0); - next.draw.scale = Vec3::one() * 0.0; + next } } diff --git a/voxygen/src/anim/character/jump.rs b/voxygen/src/anim/character/jump.rs index d72cad95d3..d9b63cd65e 100644 --- a/voxygen/src/anim/character/jump.rs +++ b/voxygen/src/anim/character/jump.rs @@ -75,13 +75,24 @@ impl Animation for JumpAnimation { next.r_shoulder.ori = Quaternion::rotation_x(0.0); next.r_shoulder.scale = Vec3::one(); + next.draw.offset = Vec3::new(13.5, 0.0, 0.0); + next.draw.ori = Quaternion::rotation_y(0.0); + next.draw.scale = Vec3::one() * 0.0; + + next.l_hold.offset = Vec3::new(0.0, 0.0, 0.0); + next.l_hold.ori = Quaternion::rotation_x(0.0); + next.l_hold.scale = Vec3::one(); + + next.r_hold.offset = Vec3::new(0.0, 0.0, 0.0); + next.r_hold.ori = Quaternion::rotation_x(0.0); + next.r_hold.scale = Vec3::one(); + next.torso.offset = Vec3::new(-0.5, -0.2, 0.0); next.torso.ori = Quaternion::rotation_x(-0.2); next.torso.scale = Vec3::one() / 11.0; - next.draw.offset = Vec3::new(13.5, 0.0, 0.0); - next.draw.ori = Quaternion::rotation_y(0.0); - next.draw.scale = Vec3::one() * 0.0; + + next } } diff --git a/voxygen/src/anim/character/mod.rs b/voxygen/src/anim/character/mod.rs index d1054716a5..9935aa496d 100644 --- a/voxygen/src/anim/character/mod.rs +++ b/voxygen/src/anim/character/mod.rs @@ -2,12 +2,15 @@ pub mod gliding; pub mod idle; pub mod jump; pub mod run; +pub mod attack; // Reexports pub use self::gliding::GlidingAnimation; pub use self::idle::IdleAnimation; pub use self::jump::JumpAnimation; pub use self::run::RunAnimation; +pub use self::attack::AttackAnimation; + // Crate use crate::render::FigureBoneData; @@ -30,6 +33,8 @@ pub struct CharacterSkeleton { l_shoulder: Bone, r_shoulder: Bone, draw: Bone, + l_hold: Bone, + r_hold: Bone, torso: Bone, } @@ -48,6 +53,8 @@ impl CharacterSkeleton { l_shoulder: Bone::default(), r_shoulder: Bone::default(), draw: Bone::default(), + l_hold: Bone::default(), + r_hold: Bone::default(), torso: Bone::default(), } } @@ -58,6 +65,7 @@ impl Skeleton for CharacterSkeleton { 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 weapon_mat = self.weapon.compute_base_matrix(); [ FigureBoneData::new(torso_mat * self.head.compute_base_matrix()), FigureBoneData::new(torso_mat * chest_mat), @@ -67,14 +75,14 @@ impl Skeleton for CharacterSkeleton { FigureBoneData::new(torso_mat * self.r_hand.compute_base_matrix()), 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 * self.weapon.compute_base_matrix()), + FigureBoneData::new(torso_mat * chest_mat * weapon_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 * l_hand_mat * self.draw.compute_base_matrix()), + FigureBoneData::new(torso_mat * weapon_mat * self.l_hold.compute_base_matrix()), + FigureBoneData::new(torso_mat * weapon_mat * self.r_hold.compute_base_matrix()), FigureBoneData::new(torso_mat), FigureBoneData::default(), - FigureBoneData::default(), - FigureBoneData::default(), ] } @@ -91,6 +99,8 @@ impl Skeleton for CharacterSkeleton { self.l_shoulder.interpolate(&target.l_shoulder); self.r_shoulder.interpolate(&target.r_shoulder); self.draw.interpolate(&target.draw); + self.l_hold.interpolate(&target.l_hold); + self.r_hold.interpolate(&target.r_hold); self.torso.interpolate(&target.torso); } } diff --git a/voxygen/src/anim/character/run.rs b/voxygen/src/anim/character/run.rs index fa72a5e70a..c92aea58db 100644 --- a/voxygen/src/anim/character/run.rs +++ b/voxygen/src/anim/character/run.rs @@ -80,6 +80,14 @@ impl Animation for RunAnimation { next.draw.ori = Quaternion::rotation_y(0.0); next.draw.scale = Vec3::one() * 0.0; + next.l_hold.offset = Vec3::new(0.0, 0.0, 0.0); + next.l_hold.ori = Quaternion::rotation_x(0.0); + next.l_hold.scale = Vec3::one(); + + next.r_hold.offset = Vec3::new(0.0, 0.0, 0.0); + next.r_hold.ori = Quaternion::rotation_x(0.0); + next.r_hold.scale = Vec3::one(); + next } } diff --git a/voxygen/src/scene/figure.rs b/voxygen/src/scene/figure.rs index 301f4d5a4c..2c12797791 100644 --- a/voxygen/src/scene/figure.rs +++ b/voxygen/src/scene/figure.rs @@ -69,8 +69,8 @@ impl FigureModelCache { Some(Self::load_left_shoulder(body.shoulder)), Some(Self::load_right_shoulder(body.shoulder)), Some(Self::load_draw(body.draw)), - None, - None, + Some(Self::load_left_hold(body.hand)), + Some(Self::load_right_hold(body.hand)), None, None, ], @@ -221,7 +221,7 @@ impl FigureModelCache { // TODO actually match against other weapons and set the right model _ => "weapon/sword/sword_wood_2h.vox", }, - Vec3::new(0.0, 0.0, -4.0), + Vec3::new(-6.5, -1.5, -4.0), ) } @@ -242,6 +242,7 @@ impl FigureModelCache { Vec3::new(2.5, -0.5, 0.0), ) } + fn load_draw(draw: Draw) -> Mesh { Self::load_mesh( match draw { @@ -251,6 +252,24 @@ impl FigureModelCache { ) } + fn load_left_hold(hand: Hand) -> Mesh { + Self::load_mesh( + match hand { + Hand::Default => "figure/body/hand.vox", + }, + Vec3::new(0.0, -2.5, 0.0), + ) + } + + fn load_right_hold(hand: Hand) -> Mesh { + Self::load_mesh( + match hand { + Hand::Default => "figure/body/hand.vox", + }, + Vec3::new(-2.0, -2.5, 0.0), + ) + } + fn load_pig_head(pig_head: PigHead) -> Mesh { Self::load_mesh( match pig_head { @@ -362,6 +381,11 @@ impl FigureMgr { time, animation_history.time, ), + comp::Animation::Attack => character::AttackAnimation::update_skeleton( + state.skeleton_mut(), + time, + animation_history.time, + ), comp::Animation::Gliding => { character::GlidingAnimation::update_skeleton( state.skeleton_mut(), From 25f05b0add4baca8bd5ebd5e75e6eed6353383f6 Mon Sep 17 00:00:00 2001 From: jshipsey Date: Sun, 19 May 2019 18:01:19 -0400 Subject: [PATCH 05/10] rotation simplification Former-commit-id: a948b8a62f42ff5f516721396c1e066fdd379794 --- voxygen/src/anim/character/attack.rs | 28 ++++++++++++++-------------- voxygen/src/anim/character/mod.rs | 6 +++--- voxygen/src/scene/figure.rs | 4 ++-- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/voxygen/src/anim/character/attack.rs b/voxygen/src/anim/character/attack.rs index 000ef57c92..4e125ffda4 100644 --- a/voxygen/src/anim/character/attack.rs +++ b/voxygen/src/anim/character/attack.rs @@ -43,19 +43,19 @@ impl Animation for AttackAnimation { .sin() * 0.25, ); - next.head.offset = Vec3::new(5.5, 2.0, 11.0 + wave_ultra_slow * 0.3); - next.head.ori = Quaternion::rotation_z(head_look.x) * Quaternion::rotation_x(head_look.y); + next.head.offset = Vec3::new(5.5, 2.0, 11.0); + next.head.ori = Quaternion::rotation_z(0.0); next.head.scale = Vec3::one(); - next.chest.offset = Vec3::new(5.5, 0.0, 7.0 + wave_ultra_slow * 0.3); + next.chest.offset = Vec3::new(5.5, 0.0, 7.0); next.chest.ori = Quaternion::rotation_x(0.0); next.chest.scale = Vec3::one(); - next.belt.offset = Vec3::new(5.5, 0.0, 5.0 + wave_ultra_slow * 0.3); + next.belt.offset = Vec3::new(5.5, 0.0, 5.0); next.belt.ori = Quaternion::rotation_x(0.0); next.belt.scale = Vec3::one(); - next.shorts.offset = Vec3::new(5.5, 0.0, 2.0 + wave_ultra_slow * 0.3); + next.shorts.offset = Vec3::new(5.5, 0.0, 2.0); next.shorts.ori = Quaternion::rotation_x(0.0); next.shorts.scale = Vec3::one(); @@ -65,15 +65,15 @@ impl Animation for AttackAnimation { 11.5 + wave_ultra_slow * 0.5, ); - next.l_hand.ori = Quaternion::rotation_x(0.0 + wave_ultra_slow * 0.06); + next.l_hand.ori = Quaternion::rotation_x(0.0); next.l_hand.scale = Vec3::one(); next.r_hand.offset = Vec3::new( 9.0, - -2.0 + wave_ultra_slow_cos * 0.15, - 11.5 + wave_ultra_slow * 0.5, + -2.0, + 11.5, ); - next.r_hand.ori = Quaternion::rotation_x(0.0 + wave_ultra_slow * 0.06); + next.r_hand.ori = Quaternion::rotation_x(0.0); next.r_hand.scale = Vec3::one(); next.l_foot.offset = Vec3::new(-3.3, -0.1, 8.0); @@ -84,8 +84,8 @@ impl Animation for AttackAnimation { next.r_foot.ori = Quaternion::identity(); next.r_foot.scale = Vec3::one(); - next.weapon.offset = Vec3::new(-5.0, -6.0, 18.0); - next.weapon.ori = Quaternion::rotation_z(wave * 1.0); + next.weapon.offset = Vec3::new(0.0, 0.0, 0.0); + next.weapon.ori = Quaternion::identity(); next.weapon.scale = Vec3::one(); next.l_shoulder.offset = Vec3::new(-10.0, -3.0, 2.5); @@ -100,11 +100,11 @@ impl Animation for AttackAnimation { next.draw.ori = Quaternion::rotation_y(0.0); next.draw.scale = Vec3::one() * 0.0; - next.l_hold.offset = Vec3::new(0.0, 0.0, 5.0); - next.l_hold.ori = Quaternion::rotation_x(0.0); + next.l_hold.offset = Vec3::new(0.0, 0.0, 25.0); + next.l_hold.ori = Quaternion::rotation_z(wave * 10.0); next.l_hold.scale = Vec3::one(); - next.r_hold.offset = Vec3::new(-2.0, -2.5, 0.0); + next.r_hold.offset = Vec3::new(2.0, 2.5, 0.0); next.r_hold.ori = Quaternion::rotation_x(0.0); next.r_hold.scale = Vec3::one(); diff --git a/voxygen/src/anim/character/mod.rs b/voxygen/src/anim/character/mod.rs index 9935aa496d..539010e28d 100644 --- a/voxygen/src/anim/character/mod.rs +++ b/voxygen/src/anim/character/mod.rs @@ -75,12 +75,12 @@ impl Skeleton for CharacterSkeleton { FigureBoneData::new(torso_mat * self.r_hand.compute_base_matrix()), 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 * weapon_mat), + FigureBoneData::new(torso_mat * chest_mat * self.l_hold.compute_base_matrix() * weapon_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 * l_hand_mat * self.draw.compute_base_matrix()), - FigureBoneData::new(torso_mat * weapon_mat * self.l_hold.compute_base_matrix()), - FigureBoneData::new(torso_mat * weapon_mat * self.r_hold.compute_base_matrix()), + FigureBoneData::new(torso_mat * self.l_hold.compute_base_matrix()), + FigureBoneData::new(torso_mat * self.r_hold.compute_base_matrix()), FigureBoneData::new(torso_mat), FigureBoneData::default(), ] diff --git a/voxygen/src/scene/figure.rs b/voxygen/src/scene/figure.rs index 2c12797791..093470f806 100644 --- a/voxygen/src/scene/figure.rs +++ b/voxygen/src/scene/figure.rs @@ -257,7 +257,7 @@ impl FigureModelCache { match hand { Hand::Default => "figure/body/hand.vox", }, - Vec3::new(0.0, -2.5, 0.0), + Vec3::new(-2.0, -2.5, 0.0), ) } @@ -266,7 +266,7 @@ impl FigureModelCache { match hand { Hand::Default => "figure/body/hand.vox", }, - Vec3::new(-2.0, -2.5, 0.0), + Vec3::new(-2.0, 2.5, 0.0), ) } From ceb207a1bf1c0c3f4c255f9d4ffd5f31f70304e4 Mon Sep 17 00:00:00 2001 From: jshipsey Date: Wed, 22 May 2019 01:11:31 -0400 Subject: [PATCH 06/10] laying groundwork for combat anims, untangling skeleton Former-commit-id: 440ea04df1c5a38d02b90131be6cf120edaa207b --- voxygen/src/anim/character/attack.rs | 42 ++++++++++++++------------- voxygen/src/anim/character/gliding.rs | 37 ++++++++++------------- voxygen/src/anim/character/idle.rs | 17 ++++------- voxygen/src/anim/character/jump.rs | 22 +++++--------- voxygen/src/anim/character/mod.rs | 23 +++++++-------- voxygen/src/anim/character/run.rs | 20 +++++-------- voxygen/src/scene/figure.rs | 27 +++++++---------- 7 files changed, 79 insertions(+), 109 deletions(-) diff --git a/voxygen/src/anim/character/attack.rs b/voxygen/src/anim/character/attack.rs index 4e125ffda4..83f81153b8 100644 --- a/voxygen/src/anim/character/attack.rs +++ b/voxygen/src/anim/character/attack.rs @@ -29,7 +29,11 @@ impl Animation for AttackAnimation { let wave_slow_cos = (anim_time as f32 * 6.0 + PI).cos(); let wave_ultra_slow = (anim_time as f32 * 1.0 + PI).sin(); let wave_ultra_slow_cos = (anim_time as f32 * 1.0 + PI).cos(); - let wave_dip = (wave_slow.abs() - 0.5).abs(); + let wave_stop = (anim_time as f32 * 3.0).min(PI / 2.0).sin(); + let wave_stop_alt = (anim_time as f32 * 28.0).min(PI / 2.0).sin(); + let wave_stop_quick = (anim_time as f32 * 8.0).min(PI / 2.0).sin(); + let peakwave = 1.0- (anim_time as f32 * 1.0).cos(); + let head_look = Vec2::new( ((global_time + anim_time) as f32 / 8.0) @@ -60,21 +64,21 @@ impl Animation for AttackAnimation { next.shorts.scale = Vec3::one(); next.l_hand.offset = Vec3::new( - -6.0, - -2.0 + wave_ultra_slow_cos * 0.15, - 11.5 + wave_ultra_slow * 0.5, - ); + -8.0, + 4.0, + 9.0, + ) / 11.0; - next.l_hand.ori = Quaternion::rotation_x(0.0); - next.l_hand.scale = Vec3::one(); + next.l_hand.ori = Quaternion::rotation_x(0.0 + wave_ultra_slow * 0.5); + next.l_hand.scale = Vec3::one() / 11.0; next.r_hand.offset = Vec3::new( - 9.0, - -2.0, - 11.5, - ); + 8.0, + 4.0, + 6.5, + ) / 11.0; next.r_hand.ori = Quaternion::rotation_x(0.0); - next.r_hand.scale = Vec3::one(); + next.r_hand.scale = Vec3::one() / 11.0; next.l_foot.offset = Vec3::new(-3.3, -0.1, 8.0); next.l_foot.ori = Quaternion::identity(); @@ -84,8 +88,8 @@ impl Animation for AttackAnimation { next.r_foot.ori = Quaternion::identity(); next.r_foot.scale = Vec3::one(); - next.weapon.offset = Vec3::new(0.0, 0.0, 0.0); - next.weapon.ori = Quaternion::identity(); + next.weapon.offset = Vec3::new(-12.0, -2.0, 11.0); + next.weapon.ori = Quaternion::rotation_y(2.5); next.weapon.scale = Vec3::one(); next.l_shoulder.offset = Vec3::new(-10.0, -3.0, 2.5); @@ -100,13 +104,11 @@ impl Animation for AttackAnimation { next.draw.ori = Quaternion::rotation_y(0.0); next.draw.scale = Vec3::one() * 0.0; - next.l_hold.offset = Vec3::new(0.0, 0.0, 25.0); - next.l_hold.ori = Quaternion::rotation_z(wave * 10.0); - next.l_hold.scale = Vec3::one(); - next.r_hold.offset = Vec3::new(2.0, 2.5, 0.0); - next.r_hold.ori = Quaternion::rotation_x(0.0); - next.r_hold.scale = Vec3::one(); + next.left_equip.offset = Vec3::new(-8.0, 4.0, 10.0) / 13.0; + next.left_equip.ori = Quaternion::rotation_x(0.0 + wave_ultra_slow * 0.5) * Quaternion::rotation_z(1.57); + next.left_equip.scale = Vec3::one() / 11.0; + next.torso.offset = Vec3::new(-0.5, -0.2, 0.1); next.torso.ori = Quaternion::rotation_x(0.0); diff --git a/voxygen/src/anim/character/gliding.rs b/voxygen/src/anim/character/gliding.rs index 2bdb528f66..9319c57a3b 100644 --- a/voxygen/src/anim/character/gliding.rs +++ b/voxygen/src/anim/character/gliding.rs @@ -64,20 +64,20 @@ impl Animation for GlidingAnimation { next.shorts.scale = Vec3::one(); next.l_hand.offset = Vec3::new( - -8.0, - -10.0 + wave_very_slow * 2.5, - 18.5 + wave_very_slow * 1.0, - ); - next.l_hand.ori = Quaternion::rotation_x(0.9 - wave_very_slow * 0.10); - next.l_hand.scale = Vec3::one(); + -10.0, + 6.0 - wave_very_slow * 1.50, + 15.0 + wave_very_slow * 0.50, + ) / 11.0; + next.l_hand.ori = Quaternion::rotation_x(0.2 + wave_very_slow_cos * 0.05); + next.l_hand.scale = Vec3::one() / 11.0; next.r_hand.offset = Vec3::new( - 11.0, - -10.0 + wave_very_slow * 2.5, - 18.5 + wave_very_slow * 1.0, - ); - next.r_hand.ori = Quaternion::rotation_x(0.9 - wave_very_slow * 0.10); - next.r_hand.scale = Vec3::one(); + 10.0, + 6.0 - wave_very_slow * 1.50, + 14.5 + wave_very_slow * 0.50, + ) / 11.0; + next.r_hand.ori = Quaternion::rotation_x(0.1 + wave_very_slow * 0.05); + next.r_hand.scale = Vec3::one() / 11.0; next.l_foot.offset = Vec3::new(-3.4, 1.0, 8.0); next.l_foot.ori = Quaternion::rotation_x( @@ -91,7 +91,7 @@ impl Animation for GlidingAnimation { ); next.r_foot.scale = Vec3::one(); - next.weapon.offset = Vec3::new(-5.0, -6.0, 19.0); + next.weapon.offset = Vec3::new(-5.0, -5.0, 12.0); next.weapon.ori = Quaternion::rotation_y(2.5); next.weapon.scale = Vec3::one(); @@ -103,17 +103,10 @@ impl Animation for GlidingAnimation { next.r_shoulder.ori = Quaternion::rotation_x(0.0); next.r_shoulder.scale = Vec3::one(); - next.draw.offset = Vec3::new(13.5, 3.0, -1.0); - next.draw.ori = Quaternion::rotation_y(wave_very_slow_cos * 0.05); + next.draw.offset = Vec3::new(5.5, -9.0 + wave_very_slow * 0.10, 18.0); + next.draw.ori = Quaternion::rotation_x(0.95 - wave_very_slow * 0.15) * Quaternion::rotation_y(wave_very_slow_cos * 0.04); next.draw.scale = Vec3::one(); - next.l_hold.offset = Vec3::new(0.0, 0.0, 0.0); - next.l_hold.ori = Quaternion::rotation_x(0.0); - next.l_hold.scale = Vec3::one(); - - next.r_hold.offset = Vec3::new(0.0, 0.0, 0.0); - next.r_hold.ori = Quaternion::rotation_x(0.0); - next.r_hold.scale = Vec3::one(); next.torso.offset = Vec3::new(-0.5, -0.2, 0.0); next.torso.ori = Quaternion::rotation_x(-0.8 + wave_very_slow * 0.10); diff --git a/voxygen/src/anim/character/idle.rs b/voxygen/src/anim/character/idle.rs index d7cc70153f..aac4e46703 100644 --- a/voxygen/src/anim/character/idle.rs +++ b/voxygen/src/anim/character/idle.rs @@ -63,18 +63,18 @@ impl Animation for IdleAnimation { -6.0, -2.0 + wave_ultra_slow_cos * 0.15, 11.5 + wave_ultra_slow * 0.5, - ); + ) / 11.; next.l_hand.ori = Quaternion::rotation_x(0.0 + wave_ultra_slow * 0.06); - next.l_hand.scale = Vec3::one(); + next.l_hand.scale = Vec3::one() / 11.; next.r_hand.offset = Vec3::new( 9.0, -2.0 + wave_ultra_slow_cos * 0.15, 11.5 + wave_ultra_slow * 0.5, - ); + ) / 11.; next.r_hand.ori = Quaternion::rotation_x(0.0 + wave_ultra_slow * 0.06); - next.r_hand.scale = Vec3::one(); + next.r_hand.scale = Vec3::one() / 11.; next.l_foot.offset = Vec3::new(-3.3, -0.1, 8.0); next.l_foot.ori = Quaternion::identity(); @@ -84,7 +84,7 @@ impl Animation for IdleAnimation { next.r_foot.ori = Quaternion::identity(); next.r_foot.scale = Vec3::one(); - next.weapon.offset = Vec3::new(-5.0, -6.0, 18.0); + next.weapon.offset = Vec3::new(-5.0, -5.0, 12.0); next.weapon.ori = Quaternion::rotation_y(2.5); next.weapon.scale = Vec3::one(); @@ -100,13 +100,6 @@ impl Animation for IdleAnimation { next.draw.ori = Quaternion::rotation_y(0.0); next.draw.scale = Vec3::one() * 0.0; - next.l_hold.offset = Vec3::new(0.0, 0.0, 0.0); - next.l_hold.ori = Quaternion::rotation_x(0.0); - next.l_hold.scale = Vec3::one(); - - next.r_hold.offset = Vec3::new(0.0, 0.0, 0.0); - next.r_hold.ori = Quaternion::rotation_x(0.0); - next.r_hold.scale = Vec3::one(); next.torso.offset = Vec3::new(-0.5, -0.2, 0.1); next.torso.ori = Quaternion::rotation_x(0.0); diff --git a/voxygen/src/anim/character/jump.rs b/voxygen/src/anim/character/jump.rs index d9b63cd65e..4536b8165c 100644 --- a/voxygen/src/anim/character/jump.rs +++ b/voxygen/src/anim/character/jump.rs @@ -47,13 +47,13 @@ impl Animation for JumpAnimation { next.shorts.ori = Quaternion::rotation_z(0.0); next.shorts.scale = Vec3::one(); - next.l_hand.offset = Vec3::new(-6.0, 0.0, 12.0); - next.l_hand.ori = Quaternion::rotation_x(wave_stop_alt * 1.2 - wave_slow * 0.15); - next.l_hand.scale = Vec3::one(); + next.l_hand.offset = Vec3::new(-8.0, 0.0 + wave_stop * 3.2, 7.0 + wave_stop * 3.2 -wave * 0.3) / 11.0; + next.l_hand.ori = Quaternion::rotation_x(wave_stop_alt * 0.6); + next.l_hand.scale = Vec3::one() / 11.0; - next.r_hand.offset = Vec3::new(9.0, 0.0, 12.0); - next.r_hand.ori = Quaternion::rotation_x(wave_stop_alt * -1.2 + wave_slow * 0.15); - next.r_hand.scale = Vec3::one(); + next.r_hand.offset = Vec3::new(8.0, 0.0 + wave_stop * -3.2, 7.0 + wave_stop * 3.2 - wave * 0.3) / 11.0; + next.r_hand.ori = Quaternion::rotation_x(-wave_stop_alt * 0.6); + next.r_hand.scale = Vec3::one() / 11.0; next.l_foot.offset = Vec3::new(-3.4, 1.0, 6.0); next.l_foot.ori = Quaternion::rotation_x(wave_stop * -1.2 - wave_slow * 0.2); @@ -63,7 +63,7 @@ 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.weapon.offset = Vec3::new(-5.0, -6.0, 19.0); + next.weapon.offset = Vec3::new(-5.0, -5.0, 12.0); next.weapon.ori = Quaternion::rotation_y(2.5); next.weapon.scale = Vec3::one(); @@ -79,14 +79,8 @@ impl Animation for JumpAnimation { next.draw.ori = Quaternion::rotation_y(0.0); next.draw.scale = Vec3::one() * 0.0; - next.l_hold.offset = Vec3::new(0.0, 0.0, 0.0); - next.l_hold.ori = Quaternion::rotation_x(0.0); - next.l_hold.scale = Vec3::one(); - next.r_hold.offset = Vec3::new(0.0, 0.0, 0.0); - next.r_hold.ori = Quaternion::rotation_x(0.0); - next.r_hold.scale = Vec3::one(); - + next.torso.offset = Vec3::new(-0.5, -0.2, 0.0); next.torso.ori = Quaternion::rotation_x(-0.2); next.torso.scale = Vec3::one() / 11.0; diff --git a/voxygen/src/anim/character/mod.rs b/voxygen/src/anim/character/mod.rs index 539010e28d..6738970965 100644 --- a/voxygen/src/anim/character/mod.rs +++ b/voxygen/src/anim/character/mod.rs @@ -33,8 +33,7 @@ pub struct CharacterSkeleton { l_shoulder: Bone, r_shoulder: Bone, draw: Bone, - l_hold: Bone, - r_hold: Bone, + left_equip: Bone, torso: Bone, } @@ -53,8 +52,7 @@ impl CharacterSkeleton { l_shoulder: Bone::default(), r_shoulder: Bone::default(), draw: Bone::default(), - l_hold: Bone::default(), - r_hold: Bone::default(), + left_equip: Bone::default(), torso: Bone::default(), } } @@ -71,18 +69,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 * l_hand_mat), - FigureBoneData::new(torso_mat * self.r_hand.compute_base_matrix()), + FigureBoneData::new(l_hand_mat), + FigureBoneData::new(self.r_hand.compute_base_matrix()), 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 * self.l_hold.compute_base_matrix() * weapon_mat), + FigureBoneData::new(torso_mat * chest_mat * weapon_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 * l_hand_mat * self.draw.compute_base_matrix()), - FigureBoneData::new(torso_mat * self.l_hold.compute_base_matrix()), - FigureBoneData::new(torso_mat * self.r_hold.compute_base_matrix()), + FigureBoneData::new(torso_mat * self.draw.compute_base_matrix()), + FigureBoneData::new(self.left_equip.compute_base_matrix()), FigureBoneData::new(torso_mat), FigureBoneData::default(), + FigureBoneData::default(), + + ] } @@ -99,8 +99,7 @@ impl Skeleton for CharacterSkeleton { self.l_shoulder.interpolate(&target.l_shoulder); self.r_shoulder.interpolate(&target.r_shoulder); self.draw.interpolate(&target.draw); - self.l_hold.interpolate(&target.l_hold); - self.r_hold.interpolate(&target.r_hold); + self.left_equip.interpolate(&target.left_equip); self.torso.interpolate(&target.torso); } } diff --git a/voxygen/src/anim/character/run.rs b/voxygen/src/anim/character/run.rs index c92aea58db..0a2b71e283 100644 --- a/voxygen/src/anim/character/run.rs +++ b/voxygen/src/anim/character/run.rs @@ -24,6 +24,7 @@ impl Animation for RunAnimation { let wave_test = (wave.cbrt()); let fuzz_wave = (anim_time as f32 * 12.0).sin(); let wave_cos = (anim_time as f32 * 14.0).cos(); + let wave_cosdouble = (anim_time as f32 * 28.0).cos(); let wave_slow = (anim_time as f32 * 7.0 + PI).sin(); let wave_slow_cos = (anim_time as f32 * 8.0 + PI).cos(); let wave_dip = (wave_slow.abs() - 0.5).abs(); @@ -44,15 +45,15 @@ impl Animation for RunAnimation { next.shorts.ori = Quaternion::rotation_z(wave * 0.6); next.shorts.scale = Vec3::one(); - next.l_hand.offset = Vec3::new(-6.0, 0.0 + wave_cos * 2.5, 11.0 - wave * 1.5); + next.l_hand.offset = Vec3::new(-8.0, 3.0 + wave_cos * 5.0, 9.0 - wave * 2.0) / 11.0; next.l_hand.ori = Quaternion::rotation_x(wave_cos * 0.9); - next.l_hand.scale = Vec3::one(); + next.l_hand.scale = Vec3::one() / 11.0; - next.r_hand.offset = Vec3::new(9.0, 0.0 - wave_cos * 2.5, 11.0 + wave * 1.5); + next.r_hand.offset = Vec3::new(8.0, 3.0 - wave_cos * 5.0, 9.0 + wave * 2.0) / 11.0; next.r_hand.ori = Quaternion::rotation_x(wave_cos * -0.9); - next.r_hand.scale = Vec3::one(); + next.r_hand.scale = Vec3::one() / 11.0; - next.l_foot.offset = Vec3::new(-3.4, 0.0 + wave * 1.0, 6.0); + next.l_foot.offset = Vec3::new(-3.4, 0.0 + wave * 1.0, 6.0); next.l_foot.ori = Quaternion::rotation_x(-0.0 - wave * 1.5); next.l_foot.scale = Vec3::one(); @@ -60,7 +61,7 @@ impl Animation for RunAnimation { next.r_foot.ori = Quaternion::rotation_x(-0.0 + wave * 1.5); next.r_foot.scale = Vec3::one(); - next.weapon.offset = Vec3::new(-5.0, -6.0, 18.0); + next.weapon.offset = Vec3::new(-5.0, -5.0, 12.0); next.weapon.ori = Quaternion::rotation_y(2.5); next.weapon.scale = Vec3::one(); @@ -80,13 +81,6 @@ impl Animation for RunAnimation { next.draw.ori = Quaternion::rotation_y(0.0); next.draw.scale = Vec3::one() * 0.0; - next.l_hold.offset = Vec3::new(0.0, 0.0, 0.0); - next.l_hold.ori = Quaternion::rotation_x(0.0); - next.l_hold.scale = Vec3::one(); - - next.r_hold.offset = Vec3::new(0.0, 0.0, 0.0); - next.r_hold.ori = Quaternion::rotation_x(0.0); - next.r_hold.scale = Vec3::one(); next } diff --git a/voxygen/src/scene/figure.rs b/voxygen/src/scene/figure.rs index 093470f806..911ae52f35 100644 --- a/voxygen/src/scene/figure.rs +++ b/voxygen/src/scene/figure.rs @@ -69,8 +69,8 @@ impl FigureModelCache { Some(Self::load_left_shoulder(body.shoulder)), Some(Self::load_right_shoulder(body.shoulder)), Some(Self::load_draw(body.draw)), - Some(Self::load_left_hold(body.hand)), - Some(Self::load_right_hold(body.hand)), + Some(Self::load_left_equip(body.weapon)), + None, None, None, ], @@ -181,7 +181,7 @@ impl FigureModelCache { match hand { Hand::Default => "figure/body/hand.vox", }, - Vec3::new(2.0, 0.0, -7.0), + Vec3::new(-2.0, -2.5, -2.0), ) } @@ -190,7 +190,7 @@ impl FigureModelCache { match hand { Hand::Default => "figure/body/hand.vox", }, - Vec3::new(2.0, 0.0, -7.0), + Vec3::new(-2.0, -2.5, -2.0), ) } @@ -252,23 +252,18 @@ impl FigureModelCache { ) } - fn load_left_hold(hand: Hand) -> Mesh { + fn load_left_equip(weapon: Weapon) -> Mesh { Self::load_mesh( - match hand { - Hand::Default => "figure/body/hand.vox", + match weapon { + Weapon::Sword => "weapon/sword/sword_wood_2h.vox", + _ => "weapon/sword/sword_wood_2h.vox", + }, - Vec3::new(-2.0, -2.5, 0.0), + Vec3::new(-6.5, -1.5, -5.0), ) } - fn load_right_hold(hand: Hand) -> Mesh { - Self::load_mesh( - match hand { - Hand::Default => "figure/body/hand.vox", - }, - Vec3::new(-2.0, 2.5, 0.0), - ) - } + fn load_pig_head(pig_head: PigHead) -> Mesh { Self::load_mesh( From d8cc5bbcf08c17c9d76203d531b8c1ccdf49f3c9 Mon Sep 17 00:00:00 2001 From: jshipsey Date: Wed, 22 May 2019 21:48:13 -0400 Subject: [PATCH 07/10] restored previous animations with new bone setup Former-commit-id: b6bb91e1b8a940caff11f7a78f613806695ce911 --- common/src/sys/control.rs | 2 +- voxygen/src/anim/character/attack.rs | 12 ++++++------ voxygen/src/anim/character/gliding.rs | 11 +++++++---- voxygen/src/anim/character/idle.rs | 28 +++++++++++++-------------- voxygen/src/anim/character/jump.rs | 14 ++++++++------ voxygen/src/anim/character/run.rs | 14 +++++++++----- 6 files changed, 45 insertions(+), 36 deletions(-) diff --git a/common/src/sys/control.rs b/common/src/sys/control.rs index df1b63fc26..0fa60fe0d0 100644 --- a/common/src/sys/control.rs +++ b/common/src/sys/control.rs @@ -86,7 +86,7 @@ impl<'a> System<'a> for Sys { if control.move_dir.magnitude() > 0.01 { Animation::Run } else { - Animation::Attack + Animation::Idle } } else if gliding { Animation::Gliding diff --git a/voxygen/src/anim/character/attack.rs b/voxygen/src/anim/character/attack.rs index 83f81153b8..22a95f94fb 100644 --- a/voxygen/src/anim/character/attack.rs +++ b/voxygen/src/anim/character/attack.rs @@ -69,7 +69,7 @@ impl Animation for AttackAnimation { 9.0, ) / 11.0; - next.l_hand.ori = Quaternion::rotation_x(0.0 + wave_ultra_slow * 0.5); + next.l_hand.ori = Quaternion::rotation_x(0.0 + wave * 2.0 )* Quaternion::rotation_z(wave * 2.0); next.l_hand.scale = Vec3::one() / 11.0; next.r_hand.offset = Vec3::new( @@ -88,25 +88,25 @@ impl Animation for AttackAnimation { next.r_foot.ori = Quaternion::identity(); next.r_foot.scale = Vec3::one(); - next.weapon.offset = Vec3::new(-12.0, -2.0, 11.0); + next.weapon.offset = Vec3::new(-9.0, -5.0, 15.0); next.weapon.ori = Quaternion::rotation_y(2.5); next.weapon.scale = Vec3::one(); next.l_shoulder.offset = Vec3::new(-10.0, -3.0, 2.5); next.l_shoulder.ori = Quaternion::rotation_x(0.0); - next.l_shoulder.scale = Vec3::one(); + next.l_shoulder.scale = Vec3::one() * 1.04; next.r_shoulder.offset = Vec3::new(0.0, -3.0, 2.5); next.r_shoulder.ori = Quaternion::rotation_x(0.0); - next.r_shoulder.scale = Vec3::one(); + next.r_shoulder.scale = Vec3::one() * 1.04; next.draw.offset = Vec3::new(13.5, 0.0, 0.0); next.draw.ori = Quaternion::rotation_y(0.0); next.draw.scale = Vec3::one() * 0.0; - next.left_equip.offset = Vec3::new(-8.0, 4.0, 10.0) / 13.0; - next.left_equip.ori = Quaternion::rotation_x(0.0 + wave_ultra_slow * 0.5) * Quaternion::rotation_z(1.57); + next.left_equip.offset = Vec3::new(-8.0, 4.0, 9.0) / 11.0; + next.left_equip.ori = Quaternion::rotation_x(0.0 + wave * 2.0)* Quaternion::rotation_z(1.57 + wave * 2.0); next.left_equip.scale = Vec3::one() / 11.0; diff --git a/voxygen/src/anim/character/gliding.rs b/voxygen/src/anim/character/gliding.rs index 9319c57a3b..5fd13171e6 100644 --- a/voxygen/src/anim/character/gliding.rs +++ b/voxygen/src/anim/character/gliding.rs @@ -66,7 +66,7 @@ impl Animation for GlidingAnimation { next.l_hand.offset = Vec3::new( -10.0, 6.0 - wave_very_slow * 1.50, - 15.0 + wave_very_slow * 0.50, + 15.0 + wave_very_slow * 0.50, ) / 11.0; next.l_hand.ori = Quaternion::rotation_x(0.2 + wave_very_slow_cos * 0.05); next.l_hand.scale = Vec3::one() / 11.0; @@ -91,22 +91,25 @@ impl Animation for GlidingAnimation { ); next.r_foot.scale = Vec3::one(); - next.weapon.offset = Vec3::new(-5.0, -5.0, 12.0); + next.weapon.offset = Vec3::new(-9.0, -5.0, 15.0); next.weapon.ori = Quaternion::rotation_y(2.5); next.weapon.scale = Vec3::one(); next.l_shoulder.offset = Vec3::new(-10.0, -3.0, 2.5); next.l_shoulder.ori = Quaternion::rotation_x(0.0); - next.l_shoulder.scale = Vec3::one(); + next.l_shoulder.scale = Vec3::one() * 1.04; next.r_shoulder.offset = Vec3::new(0.0, -3.0, 2.5); next.r_shoulder.ori = Quaternion::rotation_x(0.0); - next.r_shoulder.scale = Vec3::one(); + next.r_shoulder.scale = Vec3::one() * 1.04; next.draw.offset = Vec3::new(5.5, -9.0 + wave_very_slow * 0.10, 18.0); next.draw.ori = Quaternion::rotation_x(0.95 - wave_very_slow * 0.15) * Quaternion::rotation_y(wave_very_slow_cos * 0.04); next.draw.scale = Vec3::one(); + next.left_equip.offset = Vec3::new(0.0, 0.0, 5.0) / 11.0; + next.left_equip.ori = Quaternion::rotation_x(0.0);; + next.left_equip.scale = Vec3::one() *0.0; next.torso.offset = Vec3::new(-0.5, -0.2, 0.0); next.torso.ori = Quaternion::rotation_x(-0.8 + wave_very_slow * 0.10); diff --git a/voxygen/src/anim/character/idle.rs b/voxygen/src/anim/character/idle.rs index aac4e46703..725c7f70f6 100644 --- a/voxygen/src/anim/character/idle.rs +++ b/voxygen/src/anim/character/idle.rs @@ -23,13 +23,9 @@ impl Animation for IdleAnimation { ) -> Self::Skeleton { let mut next = (*skeleton).clone(); - let wave = (anim_time as f32 * 12.0).sin(); - let wave_cos = (anim_time as f32 * 12.0).cos(); - let wave_slow = (anim_time as f32 * 6.0 + PI).sin(); - let wave_slow_cos = (anim_time as f32 * 6.0 + PI).cos(); let wave_ultra_slow = (anim_time as f32 * 1.0 + PI).sin(); let wave_ultra_slow_cos = (anim_time as f32 * 1.0 + PI).cos(); - let wave_dip = (wave_slow.abs() - 0.5).abs(); + let head_look = Vec2::new( ((global_time + anim_time) as f32 / 8.0) @@ -60,18 +56,18 @@ impl Animation for IdleAnimation { next.shorts.scale = Vec3::one(); next.l_hand.offset = Vec3::new( - -6.0, + -7.5, -2.0 + wave_ultra_slow_cos * 0.15, - 11.5 + wave_ultra_slow * 0.5, + 8.0 + wave_ultra_slow * 0.5, ) / 11.; next.l_hand.ori = Quaternion::rotation_x(0.0 + wave_ultra_slow * 0.06); next.l_hand.scale = Vec3::one() / 11.; next.r_hand.offset = Vec3::new( - 9.0, + 7.5, -2.0 + wave_ultra_slow_cos * 0.15, - 11.5 + wave_ultra_slow * 0.5, + 8.0 + wave_ultra_slow * 0.5, ) / 11.; next.r_hand.ori = Quaternion::rotation_x(0.0 + wave_ultra_slow * 0.06); next.r_hand.scale = Vec3::one() / 11.; @@ -84,21 +80,25 @@ impl Animation for IdleAnimation { next.r_foot.ori = Quaternion::identity(); next.r_foot.scale = Vec3::one(); - next.weapon.offset = Vec3::new(-5.0, -5.0, 12.0); + next.weapon.offset = Vec3::new(-9.0, -5.0, 15.0); next.weapon.ori = Quaternion::rotation_y(2.5); next.weapon.scale = Vec3::one(); - next.l_shoulder.offset = Vec3::new(-10.0, -3.0, 2.5); + next.l_shoulder.offset = Vec3::new(-10.0, -3.2, 2.5); next.l_shoulder.ori = Quaternion::rotation_x(0.0); - next.l_shoulder.scale = Vec3::one(); + next.l_shoulder.scale = Vec3::one() * 1.04; - next.r_shoulder.offset = Vec3::new(0.0, -3.0, 2.5); + next.r_shoulder.offset = Vec3::new(0.0, -3.2, 2.5); next.r_shoulder.ori = Quaternion::rotation_x(0.0); - next.r_shoulder.scale = Vec3::one(); + next.r_shoulder.scale = Vec3::one() * 1.04; next.draw.offset = Vec3::new(13.5, 0.0, 0.0); next.draw.ori = Quaternion::rotation_y(0.0); next.draw.scale = Vec3::one() * 0.0; + + next.left_equip.offset = Vec3::new(0.0, 0.0, 5.0) / 11.0; + next.left_equip.ori = Quaternion::rotation_x(0.0);; + next.left_equip.scale = Vec3::one() *0.0; next.torso.offset = Vec3::new(-0.5, -0.2, 0.1); diff --git a/voxygen/src/anim/character/jump.rs b/voxygen/src/anim/character/jump.rs index 4536b8165c..b5790ec530 100644 --- a/voxygen/src/anim/character/jump.rs +++ b/voxygen/src/anim/character/jump.rs @@ -47,11 +47,11 @@ impl Animation for JumpAnimation { next.shorts.ori = Quaternion::rotation_z(0.0); next.shorts.scale = Vec3::one(); - next.l_hand.offset = Vec3::new(-8.0, 0.0 + wave_stop * 3.2, 7.0 + wave_stop * 3.2 -wave * 0.3) / 11.0; + next.l_hand.offset = Vec3::new(-8.0, 0.0 + wave_stop * 3.8, 7.0 + wave_stop * 3.2 -wave * 0.4) / 11.0; next.l_hand.ori = Quaternion::rotation_x(wave_stop_alt * 0.6); next.l_hand.scale = Vec3::one() / 11.0; - next.r_hand.offset = Vec3::new(8.0, 0.0 + wave_stop * -3.2, 7.0 + wave_stop * 3.2 - wave * 0.3) / 11.0; + next.r_hand.offset = Vec3::new(8.0, 0.0 + wave_stop * -3.8, 7.0 + wave_stop * 3.2 - wave * 0.4) / 11.0; next.r_hand.ori = Quaternion::rotation_x(-wave_stop_alt * 0.6); next.r_hand.scale = Vec3::one() / 11.0; @@ -63,23 +63,25 @@ 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.weapon.offset = Vec3::new(-5.0, -5.0, 12.0); + next.weapon.offset = Vec3::new(-9.0, -5.0, 15.0); next.weapon.ori = Quaternion::rotation_y(2.5); next.weapon.scale = Vec3::one(); next.l_shoulder.offset = Vec3::new(-10.0, -3.0, 2.5); next.l_shoulder.ori = Quaternion::rotation_x(0.0); - next.l_shoulder.scale = Vec3::one(); + next.l_shoulder.scale = Vec3::one() * 1.04; next.r_shoulder.offset = Vec3::new(0.0, -3.0, 2.5); next.r_shoulder.ori = Quaternion::rotation_x(0.0); - next.r_shoulder.scale = Vec3::one(); + next.r_shoulder.scale = Vec3::one() * 1.04; next.draw.offset = Vec3::new(13.5, 0.0, 0.0); next.draw.ori = Quaternion::rotation_y(0.0); next.draw.scale = Vec3::one() * 0.0; - + next.left_equip.offset = Vec3::new(0.0, 0.0, 5.0) / 11.0; + next.left_equip.ori = Quaternion::rotation_x(0.0);; + next.left_equip.scale = Vec3::one() *0.0; next.torso.offset = Vec3::new(-0.5, -0.2, 0.0); next.torso.ori = Quaternion::rotation_x(-0.2); diff --git a/voxygen/src/anim/character/run.rs b/voxygen/src/anim/character/run.rs index 0a2b71e283..3db351b66e 100644 --- a/voxygen/src/anim/character/run.rs +++ b/voxygen/src/anim/character/run.rs @@ -46,11 +46,11 @@ impl Animation for RunAnimation { next.shorts.scale = Vec3::one(); next.l_hand.offset = Vec3::new(-8.0, 3.0 + wave_cos * 5.0, 9.0 - wave * 2.0) / 11.0; - next.l_hand.ori = Quaternion::rotation_x(wave_cos * 0.9); + next.l_hand.ori = Quaternion::rotation_x(wave_cos * 1.1); next.l_hand.scale = Vec3::one() / 11.0; next.r_hand.offset = Vec3::new(8.0, 3.0 - wave_cos * 5.0, 9.0 + wave * 2.0) / 11.0; - next.r_hand.ori = Quaternion::rotation_x(wave_cos * -0.9); + next.r_hand.ori = Quaternion::rotation_x(wave_cos * -1.1); next.r_hand.scale = Vec3::one() / 11.0; next.l_foot.offset = Vec3::new(-3.4, 0.0 + wave * 1.0, 6.0); @@ -61,22 +61,26 @@ impl Animation for RunAnimation { next.r_foot.ori = Quaternion::rotation_x(-0.0 + wave * 1.5); next.r_foot.scale = Vec3::one(); - next.weapon.offset = Vec3::new(-5.0, -5.0, 12.0); + next.weapon.offset = Vec3::new(-9.0, -5.0, 15.0); next.weapon.ori = Quaternion::rotation_y(2.5); next.weapon.scale = Vec3::one(); next.l_shoulder.offset = Vec3::new(-10.0, -3.0, 2.5); next.l_shoulder.ori = Quaternion::rotation_x(0.0); - next.l_shoulder.scale = Vec3::one(); + next.l_shoulder.scale = Vec3::one() * 1.04; next.r_shoulder.offset = Vec3::new(0.0, -3.0, 2.5); next.r_shoulder.ori = Quaternion::rotation_x(0.0); - next.r_shoulder.scale = Vec3::one(); + next.r_shoulder.scale = Vec3::one() * 1.04; next.torso.offset = Vec3::new(-0.5, -0.2, 0.4); next.torso.ori = Quaternion::rotation_x(-velocity * 0.05 - wave_cos * 0.1); next.torso.scale = Vec3::one() / 11.0; + next.left_equip.offset = Vec3::new(0.0, 0.0, 5.0) / 11.0; + next.left_equip.ori = Quaternion::rotation_x(0.0);; + next.left_equip.scale = Vec3::one() * 0.0; + next.draw.offset = Vec3::new(13.5, 0.0, 0.0); next.draw.ori = Quaternion::rotation_y(0.0); next.draw.scale = Vec3::one() * 0.0; From 358dda5e446a4525d70e5a0bec911be1bf34db18 Mon Sep 17 00:00:00 2001 From: jshipsey Date: Wed, 22 May 2019 22:18:37 -0400 Subject: [PATCH 08/10] tweaks to run, sword position Former-commit-id: 05d91424eaec9c44d960efbee57574653e6b22da --- voxygen/src/anim/character/attack.rs | 6 +++--- voxygen/src/anim/character/gliding.rs | 4 ++-- voxygen/src/anim/character/idle.rs | 2 +- voxygen/src/anim/character/jump.rs | 6 +++--- voxygen/src/anim/character/run.rs | 23 ++++++++++++++++++----- 5 files changed, 27 insertions(+), 14 deletions(-) diff --git a/voxygen/src/anim/character/attack.rs b/voxygen/src/anim/character/attack.rs index 22a95f94fb..91bd3d5f8b 100644 --- a/voxygen/src/anim/character/attack.rs +++ b/voxygen/src/anim/character/attack.rs @@ -92,15 +92,15 @@ impl Animation for AttackAnimation { next.weapon.ori = Quaternion::rotation_y(2.5); next.weapon.scale = Vec3::one(); - next.l_shoulder.offset = Vec3::new(-10.0, -3.0, 2.5); + next.l_shoulder.offset = Vec3::new(-10.0, -3.2, 2.5); next.l_shoulder.ori = Quaternion::rotation_x(0.0); next.l_shoulder.scale = Vec3::one() * 1.04; - next.r_shoulder.offset = Vec3::new(0.0, -3.0, 2.5); + next.r_shoulder.offset = Vec3::new(0.0, -3.2, 2.5); next.r_shoulder.ori = Quaternion::rotation_x(0.0); next.r_shoulder.scale = Vec3::one() * 1.04; - next.draw.offset = Vec3::new(13.5, 0.0, 0.0); + next.draw.offset = Vec3::new(5.5, 0.0, 0.0); next.draw.ori = Quaternion::rotation_y(0.0); next.draw.scale = Vec3::one() * 0.0; diff --git a/voxygen/src/anim/character/gliding.rs b/voxygen/src/anim/character/gliding.rs index 5fd13171e6..7b931ad58a 100644 --- a/voxygen/src/anim/character/gliding.rs +++ b/voxygen/src/anim/character/gliding.rs @@ -95,11 +95,11 @@ impl Animation for GlidingAnimation { next.weapon.ori = Quaternion::rotation_y(2.5); next.weapon.scale = Vec3::one(); - next.l_shoulder.offset = Vec3::new(-10.0, -3.0, 2.5); + next.l_shoulder.offset = Vec3::new(-10.0, -3.2, 2.5); next.l_shoulder.ori = Quaternion::rotation_x(0.0); next.l_shoulder.scale = Vec3::one() * 1.04; - next.r_shoulder.offset = Vec3::new(0.0, -3.0, 2.5); + next.r_shoulder.offset = Vec3::new(0.0, -3.2, 2.5); next.r_shoulder.ori = Quaternion::rotation_x(0.0); next.r_shoulder.scale = Vec3::one() * 1.04; diff --git a/voxygen/src/anim/character/idle.rs b/voxygen/src/anim/character/idle.rs index 725c7f70f6..3a42a3cc63 100644 --- a/voxygen/src/anim/character/idle.rs +++ b/voxygen/src/anim/character/idle.rs @@ -92,7 +92,7 @@ impl Animation for IdleAnimation { next.r_shoulder.ori = Quaternion::rotation_x(0.0); next.r_shoulder.scale = Vec3::one() * 1.04; - next.draw.offset = Vec3::new(13.5, 0.0, 0.0); + next.draw.offset = Vec3::new(5.5, 0.0, 0.0); next.draw.ori = Quaternion::rotation_y(0.0); next.draw.scale = Vec3::one() * 0.0; diff --git a/voxygen/src/anim/character/jump.rs b/voxygen/src/anim/character/jump.rs index b5790ec530..28e72c57e9 100644 --- a/voxygen/src/anim/character/jump.rs +++ b/voxygen/src/anim/character/jump.rs @@ -67,15 +67,15 @@ impl Animation for JumpAnimation { next.weapon.ori = Quaternion::rotation_y(2.5); next.weapon.scale = Vec3::one(); - next.l_shoulder.offset = Vec3::new(-10.0, -3.0, 2.5); + next.l_shoulder.offset = Vec3::new(-10.0, -3.2, 2.5); next.l_shoulder.ori = Quaternion::rotation_x(0.0); next.l_shoulder.scale = Vec3::one() * 1.04; - next.r_shoulder.offset = Vec3::new(0.0, -3.0, 2.5); + next.r_shoulder.offset = Vec3::new(0.0, -3.2, 2.5); next.r_shoulder.ori = Quaternion::rotation_x(0.0); next.r_shoulder.scale = Vec3::one() * 1.04; - next.draw.offset = Vec3::new(13.5, 0.0, 0.0); + next.draw.offset = Vec3::new(5.5, 0.0, 0.0); next.draw.ori = Quaternion::rotation_y(0.0); next.draw.scale = Vec3::one() * 0.0; diff --git a/voxygen/src/anim/character/run.rs b/voxygen/src/anim/character/run.rs index 3db351b66e..71b06d4a16 100644 --- a/voxygen/src/anim/character/run.rs +++ b/voxygen/src/anim/character/run.rs @@ -1,5 +1,5 @@ // Standard -use std::f32::consts::PI; +use std::{f32::consts::PI, ops::Mul}; // Library use vek::*; @@ -29,8 +29,21 @@ impl Animation for RunAnimation { let wave_slow_cos = (anim_time as f32 * 8.0 + PI).cos(); let wave_dip = (wave_slow.abs() - 0.5).abs(); + let head_look = Vec2::new( + ((global_time + anim_time) as f32 / 2.0) + .floor() + .mul(7331.0) + .sin() + * 0.2, + ((global_time + anim_time) as f32 / 2.0) + .floor() + .mul(1337.0) + .sin() + * 0.1, + ); + next.head.offset = Vec3::new(5.5, 2.0, 11.0 + wave_cos * 1.3); - next.head.ori = Quaternion::rotation_x(0.15); + next.head.ori = Quaternion::rotation_z(head_look.x) * Quaternion::rotation_x(head_look.y + 0.35); next.head.scale = Vec3::one(); next.chest.offset = Vec3::new(5.5, 0.0, 7.0 + wave_cos * 1.1); @@ -65,11 +78,11 @@ impl Animation for RunAnimation { next.weapon.ori = Quaternion::rotation_y(2.5); next.weapon.scale = Vec3::one(); - next.l_shoulder.offset = Vec3::new(-10.0, -3.0, 2.5); + next.l_shoulder.offset = Vec3::new(-10.0, -3.2, 2.5); next.l_shoulder.ori = Quaternion::rotation_x(0.0); next.l_shoulder.scale = Vec3::one() * 1.04; - next.r_shoulder.offset = Vec3::new(0.0, -3.0, 2.5); + next.r_shoulder.offset = Vec3::new(0.0, -3.2, 2.5); next.r_shoulder.ori = Quaternion::rotation_x(0.0); next.r_shoulder.scale = Vec3::one() * 1.04; @@ -81,7 +94,7 @@ impl Animation for RunAnimation { next.left_equip.ori = Quaternion::rotation_x(0.0);; next.left_equip.scale = Vec3::one() * 0.0; - next.draw.offset = Vec3::new(13.5, 0.0, 0.0); + next.draw.offset = Vec3::new(5.5, 0.0, 0.0); next.draw.ori = Quaternion::rotation_y(0.0); next.draw.scale = Vec3::one() * 0.0; From cace9c6a8f5545b2556136b87b8f9240e437ed84 Mon Sep 17 00:00:00 2001 From: jshipsey Date: Wed, 22 May 2019 23:36:43 -0400 Subject: [PATCH 09/10] cleaning up inconsistencies in animation code Former-commit-id: 31c8ae92c3ebf9bed01aba29f9a030de334df153 --- common/src/sys/control.rs | 2 +- voxygen/src/anim/character/attack.rs | 20 +++++++++--------- voxygen/src/anim/character/gliding.rs | 19 ++++++++++-------- voxygen/src/anim/character/idle.rs | 29 ++++++++++++--------------- voxygen/src/anim/character/jump.rs | 24 ++++++++++------------ voxygen/src/anim/character/mod.rs | 5 ++++- voxygen/src/anim/character/run.rs | 27 +++++++++++++++---------- voxygen/src/scene/figure.rs | 16 ++++++++++++--- 8 files changed, 80 insertions(+), 62 deletions(-) diff --git a/common/src/sys/control.rs b/common/src/sys/control.rs index df1b63fc26..0fa60fe0d0 100644 --- a/common/src/sys/control.rs +++ b/common/src/sys/control.rs @@ -86,7 +86,7 @@ impl<'a> System<'a> for Sys { if control.move_dir.magnitude() > 0.01 { Animation::Run } else { - Animation::Attack + Animation::Idle } } else if gliding { Animation::Gliding diff --git a/voxygen/src/anim/character/attack.rs b/voxygen/src/anim/character/attack.rs index 793e19d1dc..6126fe3a45 100644 --- a/voxygen/src/anim/character/attack.rs +++ b/voxygen/src/anim/character/attack.rs @@ -47,19 +47,19 @@ impl Animation for AttackAnimation { .sin() * 0.25, ); - next.head.offset = Vec3::new(5.5, 2.0, 11.0); + next.head.offset = Vec3::new(0.0, 2.0, 11.0); next.head.ori = Quaternion::rotation_z(0.0); next.head.scale = Vec3::one(); - next.chest.offset = Vec3::new(5.5, 0.0, 7.0); + next.chest.offset = Vec3::new(0.0, 0.0, 7.0); next.chest.ori = Quaternion::rotation_x(0.0); next.chest.scale = Vec3::one(); - next.belt.offset = Vec3::new(5.5, 0.0, 5.0); + next.belt.offset = Vec3::new(0.0, 0.0, 5.0); next.belt.ori = Quaternion::rotation_x(0.0); next.belt.scale = Vec3::one(); - next.shorts.offset = Vec3::new(5.5, 0.0, 2.0); + next.shorts.offset = Vec3::new(0.0, 0.0, 2.0); next.shorts.ori = Quaternion::rotation_x(0.0); next.shorts.scale = Vec3::one(); @@ -87,7 +87,7 @@ impl Animation for AttackAnimation { next.r_foot.ori = Quaternion::identity(); next.r_foot.scale = Vec3::one(); - next.weapon.offset = Vec3::new(-9.0, -5.0, 15.0); + next.weapon.offset = Vec3::new(-7.0, -5.0, 15.0); next.weapon.ori = Quaternion::rotation_y(2.5); next.weapon.scale = Vec3::one(); @@ -99,8 +99,7 @@ impl Animation for AttackAnimation { next.r_shoulder.ori = Quaternion::rotation_x(0.0); next.r_shoulder.scale = Vec3::one() * 1.04; - next.draw.offset = Vec3::new(5.5, 0.0, 0.0); - + next.draw.offset = Vec3::new(0.0, 5.0, 0.0); next.draw.ori = Quaternion::rotation_y(0.0); next.draw.scale = Vec3::one() * 0.0; @@ -108,8 +107,11 @@ impl Animation for AttackAnimation { next.left_equip.ori = Quaternion::rotation_x(0.0 + wave * 2.0)* Quaternion::rotation_z(1.57 + wave * 2.0); next.left_equip.scale = Vec3::one() / 11.0; - - next.torso.offset = Vec3::new(-0.5, -0.2, 0.1); + next.right_equip.offset = Vec3::new(0.0, 0.0, 5.0) / 11.0; + next.right_equip.ori = Quaternion::rotation_x(0.0);; + next.right_equip.scale = Vec3::one() * 0.0; + + next.torso.offset = Vec3::new(0.0, -0.2, 0.1); next.torso.ori = Quaternion::rotation_x(0.0); next.torso.scale = Vec3::one() / 11.0; next diff --git a/voxygen/src/anim/character/gliding.rs b/voxygen/src/anim/character/gliding.rs index 3e28bc91bd..2834657832 100644 --- a/voxygen/src/anim/character/gliding.rs +++ b/voxygen/src/anim/character/gliding.rs @@ -46,20 +46,20 @@ impl Animation for GlidingAnimation { .sin() * 0.25, ); - next.head.offset = Vec3::new(5.5, 2.0, 12.0); + next.head.offset = Vec3::new(0.0, 2.0, 12.0); next.head.ori = Quaternion::rotation_x(0.35 - wave_very_slow * 0.10 + head_look.y) * Quaternion::rotation_z(head_look.x + wave_very_slow_cos * 0.15); next.head.scale = Vec3::one(); - next.chest.offset = Vec3::new(5.5, 0.0, 8.0); + next.chest.offset = Vec3::new(0.0, 0.0, 8.0); next.chest.ori = Quaternion::rotation_z(wave_very_slow_cos * 0.15); next.chest.scale = Vec3::one(); - next.belt.offset = Vec3::new(5.5, 0.0, 6.0); + next.belt.offset = Vec3::new(0.0, 0.0, 6.0); next.belt.ori = Quaternion::rotation_z(wave_very_slow_cos * 0.20); next.belt.scale = Vec3::one(); - next.shorts.offset = Vec3::new(5.5, 0.0, 3.0); + next.shorts.offset = Vec3::new(0.0, 0.0, 3.0); next.shorts.ori = Quaternion::rotation_z(wave_very_slow_cos * 0.25); next.shorts.scale = Vec3::one(); @@ -92,7 +92,7 @@ impl Animation for GlidingAnimation { ); next.r_foot.scale = Vec3::one(); - next.weapon.offset = Vec3::new(-9.0, -5.0, 15.0); + next.weapon.offset = Vec3::new(-7.0, -5.0, 15.0); next.weapon.ori = Quaternion::rotation_y(2.5); next.weapon.scale = Vec3::one(); @@ -105,16 +105,19 @@ impl Animation for GlidingAnimation { next.r_shoulder.scale = Vec3::one() * 1.04; - next.draw.offset = Vec3::new(5.5, -9.0 + wave_very_slow * 0.10, 18.0); + next.draw.offset = Vec3::new(0.0, -9.0 + wave_very_slow * 0.10, 18.0); next.draw.ori = Quaternion::rotation_x(0.95 - wave_very_slow * 0.15) * Quaternion::rotation_y(wave_very_slow_cos * 0.04); next.draw.scale = Vec3::one(); next.left_equip.offset = Vec3::new(0.0, 0.0, 5.0) / 11.0; next.left_equip.ori = Quaternion::rotation_x(0.0);; next.left_equip.scale = Vec3::one() *0.0; + + next.right_equip.offset = Vec3::new(0.0, 0.0, 5.0) / 11.0; + next.right_equip.ori = Quaternion::rotation_x(0.0);; + next.right_equip.scale = Vec3::one() * 0.0; - - next.torso.offset = Vec3::new(-0.5, -0.2, 0.0); + next.torso.offset = Vec3::new(0.0, -0.2, 0.0); next.torso.ori = Quaternion::rotation_x(-0.8 + wave_very_slow * 0.10); next.torso.scale = Vec3::one() / 11.0; diff --git a/voxygen/src/anim/character/idle.rs b/voxygen/src/anim/character/idle.rs index 8805d2285d..acf5a67596 100644 --- a/voxygen/src/anim/character/idle.rs +++ b/voxygen/src/anim/character/idle.rs @@ -39,19 +39,19 @@ impl Animation for IdleAnimation { .sin() * 0.25, ); - next.head.offset = Vec3::new(5.5, 2.0, 11.0 + wave_ultra_slow * 0.3); + next.head.offset = Vec3::new(0.0, 2.0, 11.0 + wave_ultra_slow * 0.3); next.head.ori = Quaternion::rotation_z(head_look.x) * Quaternion::rotation_x(head_look.y); next.head.scale = Vec3::one(); - next.chest.offset = Vec3::new(5.5, 0.0, 7.0 + wave_ultra_slow * 0.3); + next.chest.offset = Vec3::new(0.0, 0.0, 7.0 + wave_ultra_slow * 0.3); next.chest.ori = Quaternion::rotation_x(0.0); next.chest.scale = Vec3::one(); - next.belt.offset = Vec3::new(5.5, 0.0, 5.0 + wave_ultra_slow * 0.3); + next.belt.offset = Vec3::new(0.0, 0.0, 5.0 + wave_ultra_slow * 0.3); next.belt.ori = Quaternion::rotation_x(0.0); next.belt.scale = Vec3::one(); - next.shorts.offset = Vec3::new(5.5, 0.0, 2.0 + wave_ultra_slow * 0.3); + next.shorts.offset = Vec3::new(0.0, 0.0, 2.0 + wave_ultra_slow * 0.3); next.shorts.ori = Quaternion::rotation_x(0.0); next.shorts.scale = Vec3::one(); @@ -59,7 +59,6 @@ impl Animation for IdleAnimation { -7.5, -2.0 + wave_ultra_slow_cos * 0.15, 8.0 + wave_ultra_slow * 0.5, - 11.5 + wave_ultra_slow * 0.5, ) / 11.0; next.l_hand.ori = Quaternion::rotation_x(0.0 + wave_ultra_slow * 0.06); @@ -74,15 +73,15 @@ impl Animation for IdleAnimation { next.r_hand.ori = Quaternion::rotation_x(0.0 + wave_ultra_slow * 0.06); next.r_hand.scale = Vec3::one() / 11.; - next.l_foot.offset = Vec3::new(-3.3, -0.1, 8.0); + next.l_foot.offset = Vec3::new(-3.4, -0.1, 8.0); next.l_foot.ori = Quaternion::identity(); next.l_foot.scale = Vec3::one(); - next.r_foot.offset = Vec3::new(4.1, -0.1, 8.0); + next.r_foot.offset = Vec3::new(3.4, -0.1, 8.0); next.r_foot.ori = Quaternion::identity(); next.r_foot.scale = Vec3::one(); - next.weapon.offset = Vec3::new(-9.0, -5.0, 15.0); + next.weapon.offset = Vec3::new(-7.0, -5.0, 15.0); next.weapon.ori = Quaternion::rotation_y(2.5); next.weapon.scale = Vec3::one(); @@ -94,21 +93,19 @@ impl Animation for IdleAnimation { next.r_shoulder.ori = Quaternion::rotation_x(0.0); next.r_shoulder.scale = Vec3::one() * 1.04; - next.draw.offset = Vec3::new(5.5, 0.0, 0.0); + next.draw.offset = Vec3::new(0.0, 5.0, 0.0); next.draw.ori = Quaternion::rotation_y(0.0); next.draw.scale = Vec3::one() * 0.0; next.left_equip.offset = Vec3::new(0.0, 0.0, 5.0) / 11.0; next.left_equip.ori = Quaternion::rotation_x(0.0);; - next.left_equip.scale = Vec3::one() *0.0; - + next.left_equip.scale = Vec3::one() * 0.0; - next.draw.offset = Vec3::new(13.5, 0.0, 0.0); - next.draw.ori = Quaternion::rotation_y(0.0); - next.draw.scale = Vec3::one() * 0.0; - + next.right_equip.offset = Vec3::new(0.0, 0.0, 5.0) / 11.0; + next.right_equip.ori = Quaternion::rotation_x(0.0);; + next.right_equip.scale = Vec3::one() * 0.0; - next.torso.offset = Vec3::new(-0.5, -0.2, 0.1); + next.torso.offset = Vec3::new(0.0, -0.2, 0.1); next.torso.ori = Quaternion::rotation_x(0.0); next.torso.scale = Vec3::one() / 11.0; diff --git a/voxygen/src/anim/character/jump.rs b/voxygen/src/anim/character/jump.rs index 3c090a41f8..f1e9c943ca 100644 --- a/voxygen/src/anim/character/jump.rs +++ b/voxygen/src/anim/character/jump.rs @@ -25,19 +25,19 @@ impl Animation for JumpAnimation { let wave_stop_alt = (anim_time as f32 * 5.0).min(PI / 2.0).sin(); - next.head.offset = Vec3::new(5.5, 2.0, 12.0); - next.head.ori = Quaternion::rotation_x(0.25); + next.head.offset = Vec3::new(0.0, 3.0, 13.0); + next.head.ori = Quaternion::rotation_x(0.25 + wave_stop * 0.1 + wave_slow * 0.04); next.head.scale = Vec3::one(); - next.chest.offset = Vec3::new(5.5, 0.0, 8.0); + next.chest.offset = Vec3::new(0.0, 0.0, 8.0); next.chest.ori = Quaternion::rotation_z(0.0); next.chest.scale = Vec3::one(); - next.belt.offset = Vec3::new(5.5, 0.0, 6.0); + next.belt.offset = Vec3::new(0.0, 0.0, 6.0); next.belt.ori = Quaternion::rotation_z(0.0); next.belt.scale = Vec3::one(); - next.shorts.offset = Vec3::new(5.5, 0.0, 3.0); + next.shorts.offset = Vec3::new(0.0, 0.0, 3.0); next.shorts.ori = Quaternion::rotation_z(0.0); next.shorts.scale = Vec3::one(); @@ -57,7 +57,7 @@ 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.weapon.offset = Vec3::new(-9.0, -5.0, 15.0); + next.weapon.offset = Vec3::new(-7.0, -5.0, 15.0); next.weapon.ori = Quaternion::rotation_y(2.5); next.weapon.scale = Vec3::one(); @@ -69,7 +69,7 @@ impl Animation for JumpAnimation { next.r_shoulder.ori = Quaternion::rotation_x(0.0); next.r_shoulder.scale = Vec3::one() * 1.04; - next.draw.offset = Vec3::new(5.5, 0.0, 0.0); + next.draw.offset = Vec3::new(0.0, 5.0, 0.0); next.draw.ori = Quaternion::rotation_y(0.0); next.draw.scale = Vec3::one() * 0.0; @@ -77,13 +77,11 @@ impl Animation for JumpAnimation { next.left_equip.ori = Quaternion::rotation_x(0.0);; next.left_equip.scale = Vec3::one() *0.0; - next.draw.offset = Vec3::new(13.5, 0.0, 0.0); - next.draw.ori = Quaternion::rotation_y(0.0); - next.draw.scale = Vec3::one() * 0.0; + next.right_equip.offset = Vec3::new(0.0, 0.0, 5.0) / 11.0; + next.right_equip.ori = Quaternion::rotation_x(0.0);; + next.right_equip.scale = Vec3::one() * 0.0; - - - next.torso.offset = Vec3::new(-0.5, -0.2, 0.0); + next.torso.offset = Vec3::new(0.0, -0.2, 0.0); next.torso.ori = Quaternion::rotation_x(-0.2); next.torso.scale = Vec3::one() / 11.0; diff --git a/voxygen/src/anim/character/mod.rs b/voxygen/src/anim/character/mod.rs index 6738970965..d6713d907b 100644 --- a/voxygen/src/anim/character/mod.rs +++ b/voxygen/src/anim/character/mod.rs @@ -34,6 +34,7 @@ pub struct CharacterSkeleton { r_shoulder: Bone, draw: Bone, left_equip: Bone, + right_equip: Bone, torso: Bone, } @@ -53,6 +54,7 @@ impl CharacterSkeleton { r_shoulder: Bone::default(), draw: Bone::default(), left_equip: Bone::default(), + right_equip: Bone::default(), torso: Bone::default(), } } @@ -78,9 +80,9 @@ impl Skeleton for CharacterSkeleton { FigureBoneData::new(torso_mat * chest_mat * self.r_shoulder.compute_base_matrix()), FigureBoneData::new(torso_mat * self.draw.compute_base_matrix()), FigureBoneData::new(self.left_equip.compute_base_matrix()), + FigureBoneData::new(self.right_equip.compute_base_matrix()), FigureBoneData::new(torso_mat), FigureBoneData::default(), - FigureBoneData::default(), ] @@ -100,6 +102,7 @@ impl Skeleton for CharacterSkeleton { self.r_shoulder.interpolate(&target.r_shoulder); self.draw.interpolate(&target.draw); self.left_equip.interpolate(&target.left_equip); + self.right_equip.interpolate(&target.right_equip); self.torso.interpolate(&target.torso); } } diff --git a/voxygen/src/anim/character/run.rs b/voxygen/src/anim/character/run.rs index 82c89e87d5..d8292286c4 100644 --- a/voxygen/src/anim/character/run.rs +++ b/voxygen/src/anim/character/run.rs @@ -36,19 +36,19 @@ impl Animation for RunAnimation { * 0.1, ); - next.head.offset = Vec3::new(5.5, 2.0, 11.0 + wave_cos * 1.3); + next.head.offset = Vec3::new(0.0, 3.0, 12.0 + wave_cos * 1.3); next.head.ori = Quaternion::rotation_z(head_look.x) * Quaternion::rotation_x(head_look.y + 0.35); next.head.scale = Vec3::one(); - next.chest.offset = Vec3::new(5.5, 0.0, 7.0 + wave_cos * 1.1); + next.chest.offset = Vec3::new(0.0, 0.0, 7.0 + wave_cos * 1.1); next.chest.ori = Quaternion::rotation_z(wave * 0.1); next.chest.scale = Vec3::one(); - next.belt.offset = Vec3::new(5.5, 0.0, 5.0 + wave_cos * 1.1); + next.belt.offset = Vec3::new(0.0, 0.0, 5.0 + wave_cos * 1.1); next.belt.ori = Quaternion::rotation_z(wave * 0.25); next.belt.scale = Vec3::one(); - next.shorts.offset = Vec3::new(5.5, 0.0, 2.0 + wave_cos * 1.1); + next.shorts.offset = Vec3::new(0.0, 0.0, 2.0 + wave_cos * 1.1); next.shorts.ori = Quaternion::rotation_z(wave * 0.6); next.shorts.scale = Vec3::one(); @@ -68,7 +68,7 @@ impl Animation for RunAnimation { next.r_foot.ori = Quaternion::rotation_x(-0.0 + wave * 1.5); next.r_foot.scale = Vec3::one(); - next.weapon.offset = Vec3::new(-9.0, -5.0, 15.0); + next.weapon.offset = Vec3::new(-7.0, -5.0, 15.0); next.weapon.ori = Quaternion::rotation_y(2.5); next.weapon.scale = Vec3::one(); @@ -80,17 +80,22 @@ impl Animation for RunAnimation { next.r_shoulder.ori = Quaternion::rotation_x(0.0); next.r_shoulder.scale = Vec3::one() * 1.04; - next.torso.offset = Vec3::new(-0.5, -0.2, 0.4); - next.torso.ori = Quaternion::rotation_x(-velocity * 0.05 - wave_cos * 0.1); - next.torso.scale = Vec3::one() / 11.0; + next.draw.offset = Vec3::new(0.0, 5.0, 0.0); + next.draw.ori = Quaternion::rotation_y(0.0); + next.draw.scale = Vec3::one() * 0.0; next.left_equip.offset = Vec3::new(0.0, 0.0, 5.0) / 11.0; next.left_equip.ori = Quaternion::rotation_x(0.0);; next.left_equip.scale = Vec3::one() * 0.0; - next.draw.offset = Vec3::new(5.5, 0.0, 0.0); - next.draw.ori = Quaternion::rotation_y(0.0); - next.draw.scale = Vec3::one() * 0.0; + next.right_equip.offset = Vec3::new(0.0, 0.0, 5.0) / 11.0; + next.right_equip.ori = Quaternion::rotation_x(0.0);; + next.right_equip.scale = Vec3::one() * 0.0; + + next.torso.offset = Vec3::new(0.0, -0.2, 0.4); + next.torso.ori = Quaternion::rotation_x(-velocity * 0.04 - wave_cos * 0.10); + next.torso.scale = Vec3::one() / 11.0; + next diff --git a/voxygen/src/scene/figure.rs b/voxygen/src/scene/figure.rs index 911ae52f35..5cb6506dc4 100644 --- a/voxygen/src/scene/figure.rs +++ b/voxygen/src/scene/figure.rs @@ -70,7 +70,7 @@ impl FigureModelCache { Some(Self::load_right_shoulder(body.shoulder)), Some(Self::load_draw(body.draw)), Some(Self::load_left_equip(body.weapon)), - None, + Some(Self::load_right_equip(body.hand)), None, None, ], @@ -138,6 +138,7 @@ impl FigureModelCache { ) } + fn load_chest(chest: Chest) -> Mesh { Self::load_mesh( match chest { @@ -200,7 +201,7 @@ impl FigureModelCache { Foot::Default => "figure/body/foot.vox", Foot::Dark => "armor/foot/foot_dark.vox", }, - Vec3::new(2.5, -3.5, -9.0), + Vec3::new(-2.5, -3.5, -9.0), ) } @@ -210,7 +211,7 @@ impl FigureModelCache { Foot::Default => "figure/body/foot.vox", Foot::Dark => "armor/foot/foot_dark.vox", }, - Vec3::new(2.5, -3.5, -9.0), + Vec3::new(-2.5, -3.5, -9.0), ) } @@ -262,6 +263,15 @@ impl FigureModelCache { Vec3::new(-6.5, -1.5, -5.0), ) } + fn load_right_equip(hand: Hand) -> Mesh { + Self::load_mesh( + match hand { + Hand::Default => "figure/body/hand.vox", + }, + Vec3::new(-2.0, -2.5, -2.0), + ) + } + From 21b938e21d312fc93be93fc284e68bb211547740 Mon Sep 17 00:00:00 2001 From: jshipsey Date: Thu, 23 May 2019 00:11:07 -0400 Subject: [PATCH 10/10] fixed typo Former-commit-id: 9a102af47e8210b5ec19d92999304f9b6b31b9dd --- voxygen/src/scene/figure.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/voxygen/src/scene/figure.rs b/voxygen/src/scene/figure.rs index 5cb6506dc4..aa831e295e 100644 --- a/voxygen/src/scene/figure.rs +++ b/voxygen/src/scene/figure.rs @@ -273,8 +273,6 @@ impl FigureModelCache { } - - fn load_pig_head(pig_head: PigHead) -> Mesh { Self::load_mesh( match pig_head {