From 3bb839da857b4183ef22dbc119824c81ba1a86b3 Mon Sep 17 00:00:00 2001 From: jshipsey Date: Tue, 3 Nov 2020 00:55:46 -0500 Subject: [PATCH] convert humanoid anims, warnings --- voxygen/src/anim/src/biped_large/alpha.rs | 35 +------- voxygen/src/anim/src/biped_large/beam.rs | 52 ++++++----- voxygen/src/anim/src/biped_large/beta.rs | 59 ++++++------ voxygen/src/anim/src/biped_large/charge.rs | 3 +- voxygen/src/anim/src/biped_large/dash.rs | 7 +- voxygen/src/anim/src/biped_large/equip.rs | 4 +- voxygen/src/anim/src/biped_large/mod.rs | 17 +--- voxygen/src/anim/src/biped_large/run.rs | 19 ++-- voxygen/src/anim/src/biped_large/shockwave.rs | 1 - voxygen/src/anim/src/biped_large/shoot.rs | 1 - voxygen/src/anim/src/biped_large/spinmelee.rs | 2 +- voxygen/src/anim/src/character/beam.rs | 62 ++++++------- voxygen/src/anim/src/character/beta.rs | 59 ++++++------ voxygen/src/anim/src/character/block.rs | 21 ++--- voxygen/src/anim/src/character/chargeswing.rs | 67 +------------- voxygen/src/anim/src/character/dash.rs | 55 ++++++------ voxygen/src/anim/src/character/glidewield.rs | 4 +- voxygen/src/anim/src/character/gliding.rs | 6 +- voxygen/src/anim/src/character/leapmelee.rs | 90 +++++++++---------- voxygen/src/anim/src/character/mod.rs | 7 +- voxygen/src/anim/src/character/repeater.rs | 38 +++----- voxygen/src/anim/src/character/shockwave.rs | 50 ++++++----- voxygen/src/anim/src/character/spinmelee.rs | 16 ++-- voxygen/src/anim/src/character/wield.rs | 6 +- 24 files changed, 268 insertions(+), 413 deletions(-) diff --git a/voxygen/src/anim/src/biped_large/alpha.rs b/voxygen/src/anim/src/biped_large/alpha.rs index fc349d2667..0dbdf44c74 100644 --- a/voxygen/src/anim/src/biped_large/alpha.rs +++ b/voxygen/src/anim/src/biped_large/alpha.rs @@ -24,7 +24,7 @@ impl Animation for AlphaAnimation { #[allow(clippy::approx_constant)] // TODO: Pending review in #587 fn update_skeleton_inner( skeleton: &Self::Skeleton, - (active_tool_kind, _second_tool_kind, velocity, global_time, stage_section): Self::Dependency, + (active_tool_kind, _second_tool_kind, velocity, _global_time, stage_section): Self::Dependency, anim_time: f64, rate: &mut f32, s_a: &SkeletonAttr, @@ -48,15 +48,6 @@ impl Animation for AlphaAnimation { .sqrt()) * ((anim_time as f32 * lab as f32 * 2.0 * velocity).sin()); let slowersmooth = (anim_time as f32 * lab as f32 * 4.0).sin(); - let push = anim_time as f32 * lab as f32 * 4.0; - let slow = (((5.0) - / (0.4 + 4.6 * ((anim_time as f32 * lab as f32 * 9.0).sin()).powf(2.0 as f32))) - .sqrt()) - * ((anim_time as f32 * lab as f32 * 9.0).sin()); - let axe = (((1.0) - / (0.05 + 0.95 * ((anim_time as f32 * lab as f32 * 8.0).sin()).powf(2.0 as f32))) - .sqrt()) - * ((anim_time as f32 * lab as f32 * 8.0).sin()); let slower = (((1.0) / (0.0001 + 0.999 * ((anim_time as f32 * lab as f32 * 4.0).sin()).powf(2.0 as f32))) .sqrt()) @@ -96,30 +87,6 @@ impl Animation for AlphaAnimation { movement1 * -0.9 + (movement2 * 1.75).sin() * 2.5 + movement3 * -0.5, ); }, - Some(ToolKind::Axe(_)) => { - next.head.position = Vec3::new(0.0, 0.0 + s_a.head.0, s_a.head.1); - next.head.orientation = Quaternion::rotation_z(0.1 + axe * 0.2) - * Quaternion::rotation_x(0.0) - * Quaternion::rotation_y(0.2); - - next.upper_torso.position = Vec3::new(0.0, 0.0, 7.0); - next.upper_torso.orientation = Quaternion::rotation_z(0.2 + axe * 0.2); - - next.lower_torso.position = Vec3::new(0.0, 0.0, -5.0); - next.lower_torso.orientation = Quaternion::rotation_z(0.2 + axe * -0.2); - - next.hand_l.position = Vec3::new(-0.5, 0.0, 4.0); - next.hand_l.orientation = Quaternion::rotation_x(PI / 2.0); - next.hand_r.position = Vec3::new(0.5, 0.0, -2.5); - next.hand_r.orientation = Quaternion::rotation_x(PI / 2.0); - next.main.position = Vec3::new(-0.0, -2.0, -1.0); - next.main.orientation = Quaternion::rotation_x(0.0); - - next.control.position = Vec3::new(2.0 + axe * -7.0, 11.0, 3.0); - next.control.orientation = Quaternion::rotation_x(1.6) - * Quaternion::rotation_y(-2.0 + axe * 0.5) - * Quaternion::rotation_z(PI * 0.4); - }, Some(ToolKind::Hammer(_)) => { next.hand_l.position = Vec3::new(-12.0, 0.0, 0.0); next.hand_l.orientation = diff --git a/voxygen/src/anim/src/biped_large/beam.rs b/voxygen/src/anim/src/biped_large/beam.rs index 53b0cc9dc2..faad5fd161 100644 --- a/voxygen/src/anim/src/biped_large/beam.rs +++ b/voxygen/src/anim/src/biped_large/beam.rs @@ -43,8 +43,8 @@ impl Animation for BeamAnimation { next.hand_l.orientation = Quaternion::rotation_x(1.27) * Quaternion::rotation_y(0.0); next.hand_r.position = Vec3::new(0.0, 0.0, 2.0); next.hand_r.orientation = Quaternion::rotation_x(1.57) * Quaternion::rotation_y(0.2); - next.main.position = Vec3::new(0.0, 0.0, 13.2); - next.main.orientation = Quaternion::rotation_y(PI); + next.main.position = Vec3::new(0.0, 0.0, 0.0); + next.main.orientation = Quaternion::rotation_y(0.0); next.control.position = Vec3::new(-4.0, 7.0, 4.0); next.control.orientation = Quaternion::rotation_x(-0.3) @@ -54,41 +54,39 @@ impl Animation for BeamAnimation { match active_tool_kind { Some(ToolKind::Staff(_)) | Some(ToolKind::Sceptre(_)) => { next.control.position = Vec3::new( - -4.0 + movement1 * 16.0 + movement3 * -16.0, - 7.0 + movement1 + (movement2 * 8.0).sin() * 2.0 + movement3 * -1.0, - 4.0 + movement1 * 4.0 + movement3 * -4.0, + s_a.stc.0 + (movement1 * 16.0) * (1.0 - movement3), + s_a.stc.1 + (movement1 + (movement2 * 8.0).sin() * 2.0) * (1.0 - movement3), + s_a.stc.2 + (movement1 * 10.0) * (1.0 - movement3), ); next.control.orientation = - Quaternion::rotation_x(-0.3 + movement1 * -1.2 + movement3 * 1.2) + Quaternion::rotation_x(s_a.stc.3 + (movement1 * -1.2) * (1.0 - movement3)) * Quaternion::rotation_y( - 0.15 + movement1 * -1.4 - + (movement2 * 16.0).sin() * 0.07 - + movement3 * 1.4, + s_a.stc.4 + + (movement1 * -1.4 + (movement2 * 16.0).sin() * 0.07) + * (1.0 - movement3), ) * Quaternion::rotation_z( - movement1 * -1.7 - + (movement2 * 8.0 + PI / 4.0).sin() * 0.3 - + movement3 * 1.7, + (movement1 * -1.7 + (movement2 * 8.0 + PI / 4.0).sin() * 0.3) + * (1.0 - movement3), ); - next.head.orientation = Quaternion::rotation_x(0.0) * Quaternion::rotation_z(0.0); + next.head.orientation = Quaternion::rotation_x(0.0); next.hand_l.position = Vec3::new( - 0.0 + movement1 * -1.0 + (movement2 * 8.0).sin() * 3.5 + movement3, - 0.0 + movement1 * -5.0 + 0.0 + (movement1 * -1.0 + (movement2 * 8.0).sin() * 3.5) * (1.0 - movement3), + 0.0 + (movement1 * -5.0 + (movement2 * 8.0).sin() * -2.0 - + (movement2 * 16.0).sin() * -1.5 - + movement3 * 5.0, - -4.0 + movement1 * 19.0 - + (movement2 * 8.0 + PI / 2.0).sin() * 3.5 - + movement3 * -19.0, + + (movement2 * 16.0).sin() * -1.5) + * (1.0 - movement3), + -4.0 + (movement1 * 19.0 + (movement2 * 8.0 + PI / 2.0).sin() * 3.5) + * (1.0 - movement3), ); - next.hand_l.orientation = Quaternion::rotation_x(1.57 + movement3 * -0.3) - * Quaternion::rotation_y( - movement1 * -1.1 - + (movement2 * 8.0 + PI / 2.0).sin() * -0.3 - + movement3 * 1.1, - ) - * Quaternion::rotation_z(movement1 * -2.8 + movement3 * 2.8); + next.hand_l.orientation = + Quaternion::rotation_x(s_a.sthr.3 + (movement1 * -0.3) * (1.0 - movement3)) + * Quaternion::rotation_y( + (movement1 * -1.1 + (movement2 * 8.0 + PI / 2.0).sin() * -0.3) + * (1.0 - movement3), + ) + * Quaternion::rotation_z((movement1 * -2.8) * (1.0 - movement3)); if velocity < 0.5 { next.head.orientation = diff --git a/voxygen/src/anim/src/biped_large/beta.rs b/voxygen/src/anim/src/biped_large/beta.rs index af1850e773..bff3414b05 100644 --- a/voxygen/src/anim/src/biped_large/beta.rs +++ b/voxygen/src/anim/src/biped_large/beta.rs @@ -22,7 +22,7 @@ impl Animation for BetaAnimation { #[cfg_attr(feature = "be-dyn-lib", export_name = "biped_large_beta")] fn update_skeleton_inner( skeleton: &Self::Skeleton, - (active_tool_kind, _second_tool_kind, _velocity, _global_time, stage_section): Self::Dependency, + (_active_tool_kind, _second_tool_kind, _velocity, _global_time, stage_section): Self::Dependency, anim_time: f64, rate: &mut f32, s_a: &SkeletonAttr, @@ -37,41 +37,32 @@ impl Animation for BetaAnimation { _ => (0.0, 0.0, 0.0), }; - match active_tool_kind { - Some(ToolKind::Sword(_)) => { - next.main.position = Vec3::new(0.0, 0.0, 0.0); - next.main.orientation = Quaternion::rotation_x(0.0); + next.main.position = Vec3::new(0.0, 0.0, 0.0); + next.main.orientation = Quaternion::rotation_x(0.0); - next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2); - next.hand_l.orientation = - Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4); - next.hand_r.position = Vec3::new(s_a.shr.0, s_a.shr.1, s_a.shr.2); - next.hand_r.orientation = - Quaternion::rotation_x(s_a.shr.3) * Quaternion::rotation_y(s_a.shr.4); + next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2); + next.hand_l.orientation = + Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4); + next.hand_r.position = Vec3::new(s_a.shr.0, s_a.shr.1, s_a.shr.2); + next.hand_r.orientation = + Quaternion::rotation_x(s_a.shr.3) * Quaternion::rotation_y(s_a.shr.4); - next.control.position = Vec3::new( - s_a.sc.0 + (-1.4 + movement1 * -3.0 + movement2 * -2.0) * (1.0 - movement3), - s_a.sc.1 + (-1.4 + movement1 * 3.0 + movement2 * 3.0) * (1.0 - movement3), - s_a.sc.2 + (-1.9 + movement1 * 2.5 * (1.0 - movement3)), - ); - next.control.orientation = - Quaternion::rotation_x(s_a.sc.3 + (-1.7) * (1.0 - movement3)) - * Quaternion::rotation_y( - s_a.sc.4 - + (0.4 + movement1 * 1.5 + movement2 * -2.5) * (1.0 - movement3), - ) - * Quaternion::rotation_z( - s_a.sc.5 + (1.67 + movement2 * 1.57) * (1.0 - movement3), - ); - next.upper_torso.orientation = Quaternion::rotation_x(0.15) - * Quaternion::rotation_y((-0.1) * (1.0 - movement3)) - * Quaternion::rotation_z( - (0.4 + movement1 * 1.5 + movement2 * -2.5) * (1.0 - movement3), - ); - next.head.orientation = Quaternion::rotation_z((-0.4) * (1.0 - movement3)); - }, - _ => {}, - } + next.control.position = Vec3::new( + s_a.sc.0 + (-1.4 + movement1 * -3.0 + movement2 * -2.0) * (1.0 - movement3), + s_a.sc.1 + (-1.4 + movement1 * 3.0 + movement2 * 3.0) * (1.0 - movement3), + s_a.sc.2 + (-1.9 + movement1 * 2.5 * (1.0 - movement3)), + ); + next.control.orientation = Quaternion::rotation_x(s_a.sc.3 + (-1.7) * (1.0 - movement3)) + * Quaternion::rotation_y( + s_a.sc.4 + (0.4 + movement1 * 1.5 + movement2 * -2.5) * (1.0 - movement3), + ) + * Quaternion::rotation_z(s_a.sc.5 + (1.67 + movement2 * 1.57) * (1.0 - movement3)); + next.upper_torso.orientation = Quaternion::rotation_x(0.15) + * Quaternion::rotation_y((-0.1) * (1.0 - movement3)) + * Quaternion::rotation_z( + (0.4 + movement1 * 1.5 + movement2 * -2.5) * (1.0 - movement3), + ); + next.head.orientation = Quaternion::rotation_z((-0.4) * (1.0 - movement3)); next } diff --git a/voxygen/src/anim/src/biped_large/charge.rs b/voxygen/src/anim/src/biped_large/charge.rs index 3e9529f954..72554c733b 100644 --- a/voxygen/src/anim/src/biped_large/charge.rs +++ b/voxygen/src/anim/src/biped_large/charge.rs @@ -3,7 +3,6 @@ use super::{ BipedLargeSkeleton, SkeletonAttr, }; use common::comp::item::ToolKind; -use std::{f32::consts::PI, ops::Mul}; pub struct ChargeAnimation; @@ -24,7 +23,7 @@ impl Animation for ChargeAnimation { #[cfg_attr(feature = "be-dyn-lib", export_name = "biped_large_charge")] fn update_skeleton_inner( skeleton: &Self::Skeleton, - (active_tool_kind, _second_tool_kind, velocity, orientation, last_ori, global_time): Self::Dependency, + (active_tool_kind, _second_tool_kind, velocity, orientation, last_ori, _global_time): Self::Dependency, anim_time: f64, _rate: &mut f32, s_a: &SkeletonAttr, diff --git a/voxygen/src/anim/src/biped_large/dash.rs b/voxygen/src/anim/src/biped_large/dash.rs index 4ac29aa8e7..cc6d8231d6 100644 --- a/voxygen/src/anim/src/biped_large/dash.rs +++ b/voxygen/src/anim/src/biped_large/dash.rs @@ -23,7 +23,7 @@ impl Animation for DashAnimation { #[allow(clippy::single_match)] // TODO: Pending review in #587 fn update_skeleton_inner( skeleton: &Self::Skeleton, - (active_tool_kind, second_tool_kind, _global_time, stage_section): Self::Dependency, + (active_tool_kind, _second_tool_kind, _global_time, stage_section): Self::Dependency, anim_time: f64, rate: &mut f32, s_a: &SkeletonAttr, @@ -115,11 +115,6 @@ impl Animation for DashAnimation { next.foot_r.orientation = Quaternion::rotation_x(-0.6 + footrotr(movement2) * -0.6) * Quaternion::rotation_z(-0.2); }, - Some(ToolKind::Dagger(_)) => {}, - _ => {}, - } - match second_tool_kind { - Some(ToolKind::Dagger(_)) => {}, _ => {}, } diff --git a/voxygen/src/anim/src/biped_large/equip.rs b/voxygen/src/anim/src/biped_large/equip.rs index 73dfac08a1..7aa7552573 100644 --- a/voxygen/src/anim/src/biped_large/equip.rs +++ b/voxygen/src/anim/src/biped_large/equip.rs @@ -42,8 +42,8 @@ impl Animation for EquipAnimation { next.hand_r.position = Vec3::new(-5.0, -4.5, 14.0); }, Some(ToolKind::Hammer(_)) => { - next.hand_l.position = Vec3::new(-5.0 - 10.0, -5.0, 13.0 - 10.0); - next.hand_r.position = Vec3::new(-3.0 - 10.0, -4.5, 10.0 - 10.0); + next.hand_l.position = Vec3::new(-5.0 - 10.0, -5.0, 3.0); + next.hand_r.position = Vec3::new(-3.0 - 10.0, -4.5, 0.0); }, Some(ToolKind::Staff(_)) | Some(ToolKind::Sceptre(_)) => { next.hand_l.position = Vec3::new(-3.0, -5.0, 8.0); diff --git a/voxygen/src/anim/src/biped_large/mod.rs b/voxygen/src/anim/src/biped_large/mod.rs index 034eaa00e0..182bd668cf 100644 --- a/voxygen/src/anim/src/biped_large/mod.rs +++ b/voxygen/src/anim/src/biped_large/mod.rs @@ -130,9 +130,6 @@ pub struct SkeletonAttr { sthl: (f32, f32, f32, f32, f32, f32), sthr: (f32, f32, f32, f32, f32, f32), stc: (f32, f32, f32, f32, f32, f32), - ahl: (f32, f32, f32, f32, f32, f32), - ahr: (f32, f32, f32, f32, f32, f32), - ac: (f32, f32, f32, f32, f32, f32), bhl: (f32, f32, f32, f32, f32, f32), bhr: (f32, f32, f32, f32, f32, f32), bc: (f32, f32, f32, f32, f32, f32), @@ -171,9 +168,6 @@ impl Default for SkeletonAttr { sthl: (0.0, 0.0, 10.0, 0.0, 0.0, 0.0), sthr: (0.0, 0.0, 0.0, 0.0, 0.0, 0.0), stc: (0.0, 0.0, 0.0, 0.0, 0.0, 0.0), - ahl: (0.0, 0.0, 10.0, 0.0, 0.0, 0.0), - ahr: (0.0, 0.0, 0.0, 0.0, 0.0, 0.0), - ac: (0.0, 0.0, 0.0, 0.0, 0.0, 0.0), bhl: (0.0, 0.0, 10.0, 0.0, 0.0, 0.0), bhr: (0.0, 0.0, 0.0, 0.0, 0.0, 0.0), bc: (0.0, 0.0, 0.0, 0.0, 0.0, 0.0), @@ -336,19 +330,10 @@ impl<'a> From<&'a Body> for SkeletonAttr { (_, _) => (17.0, 7.5, 2.0, 1.57, 0.8, 0.0), }, stc: match (body.species, body.body_type) { - (Ogre, Female) => (-18.0, 1.0, -2.0, -0.3, 0.15, 0.0), + (Ogre, Female) => (-10.0, 1.0, -18.0, -0.3, 0.15, 0.0), (Occultsaurok, _) => (-10.0, 7.0, -22.0, -0.3, 0.15, 0.0), (_, _) => (-18.0, 1.0, -2.0, -0.3, 0.15, 0.0), }, - ahl: match (body.species, body.body_type) { - (_, _) => (-0.5, -1.0, 7.0, 1.87, 0.0, 0.0), - }, - ahr: match (body.species, body.body_type) { - (_, _) => (0.0, -1.0, 1.0, 4.34, 0.2, 0.0), - }, - ac: match (body.species, body.body_type) { - (_, _) => (-8.0, 11.0, 3.0, 2.0, 0.0, 3.14), - }, bhl: match (body.species, body.body_type) { (Slysaurok, _) => (-1.0, -12.0, 1.0, 1.57, 0.0, 0.0), (_, _) => (3.0, 2.5, 0.0, 1.2, -0.6, -0.3), diff --git a/voxygen/src/anim/src/biped_large/run.rs b/voxygen/src/anim/src/biped_large/run.rs index 4b680785e4..b6550dcc0e 100644 --- a/voxygen/src/anim/src/biped_large/run.rs +++ b/voxygen/src/anim/src/biped_large/run.rs @@ -7,16 +7,17 @@ use std::{f32::consts::PI, ops::Mul}; pub struct RunAnimation; +type RunAnimationDependency = ( + Option, + Option, + f32, + Vec3, + Vec3, + f64, + Vec3, +); impl Animation for RunAnimation { - type Dependency = ( - Option, - Option, - f32, - Vec3, - Vec3, - f64, - Vec3, - ); + type Dependency = RunAnimationDependency; type Skeleton = BipedLargeSkeleton; #[cfg(feature = "use-dyn-lib")] diff --git a/voxygen/src/anim/src/biped_large/shockwave.rs b/voxygen/src/anim/src/biped_large/shockwave.rs index 2c0f57eda6..b22003a654 100644 --- a/voxygen/src/anim/src/biped_large/shockwave.rs +++ b/voxygen/src/anim/src/biped_large/shockwave.rs @@ -3,7 +3,6 @@ use super::{ BipedLargeSkeleton, SkeletonAttr, }; use common::{comp::item::ToolKind, states::utils::StageSection}; -use std::f32::consts::PI; pub struct ShockwaveAnimation; diff --git a/voxygen/src/anim/src/biped_large/shoot.rs b/voxygen/src/anim/src/biped_large/shoot.rs index ebc71e6f28..e188cb5c2e 100644 --- a/voxygen/src/anim/src/biped_large/shoot.rs +++ b/voxygen/src/anim/src/biped_large/shoot.rs @@ -3,7 +3,6 @@ use super::{ BipedLargeSkeleton, SkeletonAttr, }; use common::comp::item::ToolKind; -use std::{f32::consts::PI, ops::Mul}; pub struct ShootAnimation; diff --git a/voxygen/src/anim/src/biped_large/spinmelee.rs b/voxygen/src/anim/src/biped_large/spinmelee.rs index f90659c589..815f598be7 100644 --- a/voxygen/src/anim/src/biped_large/spinmelee.rs +++ b/voxygen/src/anim/src/biped_large/spinmelee.rs @@ -31,7 +31,7 @@ impl Animation for SpinMeleeAnimation { ) -> Self::Skeleton { *rate = 1.0; let lab = 1.0; - let (movement1, movement2, movement3) = match stage_section { + let (_movement1, movement2, movement3) = match stage_section { Some(StageSection::Buildup) => (anim_time as f32, 0.0, 0.0), Some(StageSection::Swing) => (1.0, anim_time as f32, 0.0), Some(StageSection::Recover) => (1.0, 1.0, anim_time as f32), diff --git a/voxygen/src/anim/src/character/beam.rs b/voxygen/src/anim/src/character/beam.rs index da812b121b..4bd3614a63 100644 --- a/voxygen/src/anim/src/character/beam.rs +++ b/voxygen/src/anim/src/character/beam.rs @@ -39,12 +39,14 @@ impl Animation for BeamAnimation { _ => (0.0, 0.0, 0.0), }; - next.hand_l.position = Vec3::new(0.0, 0.0, -4.0); - next.hand_l.orientation = Quaternion::rotation_x(1.27) * Quaternion::rotation_y(0.0); - next.hand_r.position = Vec3::new(0.0, 0.0, 2.0); - next.hand_r.orientation = Quaternion::rotation_x(1.57) * Quaternion::rotation_y(0.2); - next.main.position = Vec3::new(0.0, 0.0, 13.2); - next.main.orientation = Quaternion::rotation_y(PI); + next.hand_l.position = Vec3::new(s_a.sthl.0, s_a.sthl.1, s_a.sthl.2); + next.hand_l.orientation = + Quaternion::rotation_x(s_a.sthl.3) * Quaternion::rotation_y(s_a.sthl.4); + next.hand_r.position = Vec3::new(s_a.sthr.0, s_a.sthr.1, s_a.sthl.2); + next.hand_r.orientation = + Quaternion::rotation_x(s_a.sthr.3) * Quaternion::rotation_y(s_a.sthr.4); + next.main.position = Vec3::new(0.0, 0.0, 0.0); + next.main.orientation = Quaternion::rotation_x(0.0); next.control.position = Vec3::new(-4.0, 7.0, 4.0); next.control.orientation = Quaternion::rotation_x(-0.3) @@ -54,41 +56,39 @@ impl Animation for BeamAnimation { match active_tool_kind { Some(ToolKind::Staff(_)) | Some(ToolKind::Sceptre(_)) => { next.control.position = Vec3::new( - -4.0 + movement1 * 16.0 + movement3 * -16.0, - 7.0 + movement1 + (movement2 * 8.0).sin() * 2.0 + movement3 * -1.0, - 4.0 + movement1 * 4.0 + movement3 * -4.0, + s_a.stc.0 + (movement1 * 16.0) * (1.0 - movement3), + s_a.stc.1 + (movement1 + (movement2 * 8.0).sin() * 2.0) * (1.0 - movement3), + s_a.stc.2 + (movement1 * 10.0) * (1.0 - movement3), ); next.control.orientation = - Quaternion::rotation_x(-0.3 + movement1 * -1.2 + movement3 * 1.2) + Quaternion::rotation_x(s_a.stc.3 + (movement1 * -1.2) * (1.0 - movement3)) * Quaternion::rotation_y( - 0.15 + movement1 * -1.4 - + (movement2 * 16.0).sin() * 0.07 - + movement3 * 1.4, + s_a.stc.4 + + (movement1 * -1.4 + (movement2 * 16.0).sin() * 0.07) + * (1.0 - movement3), ) * Quaternion::rotation_z( - movement1 * -1.7 - + (movement2 * 8.0 + PI / 4.0).sin() * 0.3 - + movement3 * 1.7, + (movement1 * -1.7 + (movement2 * 8.0 + PI / 4.0).sin() * 0.3) + * (1.0 - movement3), ); - next.head.orientation = Quaternion::rotation_x(0.0) * Quaternion::rotation_z(0.0); + next.head.orientation = Quaternion::rotation_x(0.0); next.hand_l.position = Vec3::new( - 0.0 + movement1 * -1.0 + (movement2 * 8.0).sin() * 3.5 + movement3, - 0.0 + movement1 * -5.0 + 0.0 + (movement1 * -1.0 + (movement2 * 8.0).sin() * 3.5) * (1.0 - movement3), + 0.0 + (movement1 * -5.0 + (movement2 * 8.0).sin() * -2.0 - + (movement2 * 16.0).sin() * -1.5 - + movement3 * 5.0, - -4.0 + movement1 * 19.0 - + (movement2 * 8.0 + PI / 2.0).sin() * 3.5 - + movement3 * -19.0, + + (movement2 * 16.0).sin() * -1.5) + * (1.0 - movement3), + -4.0 + (movement1 * 19.0 + (movement2 * 8.0 + PI / 2.0).sin() * 3.5) + * (1.0 - movement3), ); - next.hand_l.orientation = Quaternion::rotation_x(1.57 + movement3 * -0.3) - * Quaternion::rotation_y( - movement1 * -1.1 - + (movement2 * 8.0 + PI / 2.0).sin() * -0.3 - + movement3 * 1.1, - ) - * Quaternion::rotation_z(movement1 * -2.8 + movement3 * 2.8); + next.hand_l.orientation = + Quaternion::rotation_x(s_a.sthr.3 + (movement1 * -0.3) * (1.0 - movement3)) + * Quaternion::rotation_y( + (movement1 * -1.1 + (movement2 * 8.0 + PI / 2.0).sin() * -0.3) + * (1.0 - movement3), + ) + * Quaternion::rotation_z((movement1 * -2.8) * (1.0 - movement3)); if velocity < 0.5 { next.head.orientation = diff --git a/voxygen/src/anim/src/character/beta.rs b/voxygen/src/anim/src/character/beta.rs index b47826dc3e..275ee8fd88 100644 --- a/voxygen/src/anim/src/character/beta.rs +++ b/voxygen/src/anim/src/character/beta.rs @@ -22,7 +22,7 @@ impl Animation for BetaAnimation { #[cfg_attr(feature = "be-dyn-lib", export_name = "character_beta")] fn update_skeleton_inner( skeleton: &Self::Skeleton, - (active_tool_kind, _second_tool_kind, _velocity, _global_time, stage_section): Self::Dependency, + (_active_tool_kind, _second_tool_kind, _velocity, _global_time, stage_section): Self::Dependency, anim_time: f64, rate: &mut f32, s_a: &SkeletonAttr, @@ -37,41 +37,32 @@ impl Animation for BetaAnimation { _ => (0.0, 0.0, 0.0), }; - match active_tool_kind { - Some(ToolKind::Sword(_)) => { - next.main.position = Vec3::new(0.0, 0.0, 0.0); - next.main.orientation = Quaternion::rotation_x(0.0); + next.main.position = Vec3::new(0.0, 0.0, 0.0); + next.main.orientation = Quaternion::rotation_x(0.0); - next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2); - next.hand_l.orientation = - Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4); - next.hand_r.position = Vec3::new(s_a.shr.0, s_a.shr.1, s_a.shr.2); - next.hand_r.orientation = - Quaternion::rotation_x(s_a.shr.3) * Quaternion::rotation_y(s_a.shr.4); + next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2); + next.hand_l.orientation = + Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4); + next.hand_r.position = Vec3::new(s_a.shr.0, s_a.shr.1, s_a.shr.2); + next.hand_r.orientation = + Quaternion::rotation_x(s_a.shr.3) * Quaternion::rotation_y(s_a.shr.4); - next.control.position = Vec3::new( - s_a.sc.0 + (-1.4 + movement1 * -3.0 + movement2 * -2.0) * (1.0 - movement3), - s_a.sc.1 + (-1.4 + movement1 * 3.0 + movement2 * 3.0) * (1.0 - movement3), - s_a.sc.2 + (-1.9 + movement1 * 2.5 * (1.0 - movement3)), - ); - next.control.orientation = - Quaternion::rotation_x(s_a.sc.3 + (-1.7) * (1.0 - movement3)) - * Quaternion::rotation_y( - s_a.sc.4 - + (0.4 + movement1 * 1.5 + movement2 * -2.5) * (1.0 - movement3), - ) - * Quaternion::rotation_z( - s_a.sc.5 + (1.67 + movement2 * 1.57) * (1.0 - movement3), - ); - next.chest.orientation = Quaternion::rotation_x(0.15) - * Quaternion::rotation_y((-0.1) * (1.0 - movement3)) - * Quaternion::rotation_z( - (0.4 + movement1 * 1.5 + movement2 * -2.5) * (1.0 - movement3), - ); - next.head.orientation = Quaternion::rotation_z((-0.4) * (1.0 - movement3)); - }, - _ => {}, - } + next.control.position = Vec3::new( + s_a.sc.0 + (-1.4 + movement1 * -3.0 + movement2 * -2.0) * (1.0 - movement3), + s_a.sc.1 + (-1.4 + movement1 * 3.0 + movement2 * 3.0) * (1.0 - movement3), + s_a.sc.2 + (-1.9 + movement1 * 2.5 * (1.0 - movement3)), + ); + next.control.orientation = Quaternion::rotation_x(s_a.sc.3 + (-1.7) * (1.0 - movement3)) + * Quaternion::rotation_y( + s_a.sc.4 + (0.4 + movement1 * 1.5 + movement2 * -2.5) * (1.0 - movement3), + ) + * Quaternion::rotation_z(s_a.sc.5 + (1.67 + movement2 * 1.57) * (1.0 - movement3)); + next.chest.orientation = Quaternion::rotation_x(0.15) + * Quaternion::rotation_y((-0.1) * (1.0 - movement3)) + * Quaternion::rotation_z( + (0.4 + movement1 * 1.5 + movement2 * -2.5) * (1.0 - movement3), + ); + next.head.orientation = Quaternion::rotation_z((-0.4) * (1.0 - movement3)); next } diff --git a/voxygen/src/anim/src/character/block.rs b/voxygen/src/anim/src/character/block.rs index c5c9ce9957..c36fcb8e71 100644 --- a/voxygen/src/anim/src/character/block.rs +++ b/voxygen/src/anim/src/character/block.rs @@ -16,7 +16,7 @@ impl Animation for BlockAnimation { #[cfg_attr(feature = "be-dyn-lib", export_name = "character_block")] fn update_skeleton_inner( skeleton: &Self::Skeleton, - (active_tool_kind, _second_tool_kind, _global_time): Self::Dependency, + (_active_tool_kind, _second_tool_kind, _global_time): Self::Dependency, _anim_time: f64, _rate: &mut f32, s_a: &SkeletonAttr, @@ -26,19 +26,12 @@ impl Animation for BlockAnimation { next.head.position = Vec3::new(0.0, -1.0 + s_a.head.0, s_a.head.1 + 19.5); next.head.orientation = Quaternion::rotation_x(-0.25); - match active_tool_kind { - Some(ToolKind::Shield(_)) => { - next.hand_l.position = - Vec3::new(s_a.hand.0 - 6.0, s_a.hand.1 + 3.5, s_a.hand.2 + 0.0); - next.hand_l.orientation = Quaternion::rotation_x(-0.3); - next.hand_r.position = - Vec3::new(s_a.hand.0 - 6.0, s_a.hand.1 + 3.0, s_a.hand.2 - 2.0); - next.hand_r.orientation = Quaternion::rotation_x(-0.3); - next.main.position = Vec3::new(0.0, 0.0, 0.0); - next.main.orientation = Quaternion::rotation_x(-0.3); - }, - _ => {}, - } + next.hand_l.position = Vec3::new(s_a.hand.0 - 6.0, s_a.hand.1 + 3.5, s_a.hand.2 + 0.0); + next.hand_l.orientation = Quaternion::rotation_x(-0.3); + next.hand_r.position = Vec3::new(s_a.hand.0 - 6.0, s_a.hand.1 + 3.0, s_a.hand.2 - 2.0); + next.hand_r.orientation = Quaternion::rotation_x(-0.3); + next.main.position = Vec3::new(0.0, 0.0, 0.0); + next.main.orientation = Quaternion::rotation_x(-0.3); next.torso.position = Vec3::new(0.0, -0.2, 0.1) * s_a.scaler; diff --git a/voxygen/src/anim/src/character/chargeswing.rs b/voxygen/src/anim/src/character/chargeswing.rs index 697d5bc8b2..b0f569d52c 100644 --- a/voxygen/src/anim/src/character/chargeswing.rs +++ b/voxygen/src/anim/src/character/chargeswing.rs @@ -3,7 +3,6 @@ use super::{ CharacterSkeleton, SkeletonAttr, }; use common::{comp::item::ToolKind, states::utils::StageSection}; -use std::f32::consts::PI; pub struct ChargeswingAnimation; impl Animation for ChargeswingAnimation { @@ -23,14 +22,13 @@ impl Animation for ChargeswingAnimation { #[allow(clippy::approx_constant)] // TODO: Pending review in #587 fn update_skeleton_inner( skeleton: &Self::Skeleton, - (active_tool_kind, _second_tool_kind, velocity, _global_time, stage_section): Self::Dependency, + (active_tool_kind, _second_tool_kind, _velocity, _global_time, stage_section): Self::Dependency, anim_time: f64, rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { *rate = 1.0; let mut next = (*skeleton).clone(); - let speed = Vec2::::from(velocity).magnitude(); let lab = 1.0; @@ -40,27 +38,6 @@ impl Animation for ChargeswingAnimation { * ((anim_time as f32 * lab as f32 * 8.0).sin()); // end spin stuff - let movement = anim_time as f32 * 1.0; - - let foothoril = (anim_time as f32 * 8.0 * lab as f32 + PI * 1.45).sin(); - let foothorir = (anim_time as f32 * 8.0 * lab as f32 + PI * (0.45)).sin(); - - let footvertl = (anim_time as f32 * 8.0 * lab as f32).sin(); - let footvertr = (anim_time as f32 * 8.0 * lab as f32 + PI).sin(); - let footrotl = (((1.0) - / (0.5 - + (0.5) - * ((anim_time as f32 * 8.0 * lab as f32 + PI * 1.4).sin()).powf(2.0 as f32))) - .sqrt()) - * ((anim_time as f32 * 8.0 * lab as f32 + PI * 1.4).sin()); - - let footrotr = (((1.0) - / (0.5 - + (0.5) - * ((anim_time as f32 * 8.0 * lab as f32 + PI * 0.4).sin()).powf(2.0 as f32))) - .sqrt()) - * ((anim_time as f32 * 8.0 * lab as f32 + PI * 0.4).sin()); - let (movement1, movement2, movement3, tension) = match stage_section { Some(StageSection::Charge) => ( (anim_time as f32).min(1.0), @@ -109,48 +86,6 @@ impl Animation for ChargeswingAnimation { next.head.orientation = Quaternion::rotation_z((movement1 * -1.5 + movement2 * 2.2) * (1.0 - movement3)); next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1); - if let Some(stage_section) = stage_section { - match stage_section { - StageSection::Charge => { - - /*if speed > 0.5 { - next.foot_l.position = Vec3::new( - -s_a.foot.0, - s_a.foot.1 + foothoril * -2.5 - 3.5, - s_a.foot.2 + ((footvertl * -1.2).max(-1.0)), - ); - - next.foot_r.position = Vec3::new( - s_a.foot.0, - s_a.foot.1 + foothorir * -2.5 + 6.0, - s_a.foot.2 + ((footvertr * -1.2).max(-1.0)), - ); - - next.foot_l.orientation = - Quaternion::rotation_x(-0.4 + footrotl * -0.2) - * Quaternion::rotation_z((movement * 0.5).min(0.5)); - - next.foot_r.orientation = - Quaternion::rotation_x(-0.4 + footrotr * -0.2) - * Quaternion::rotation_z((movement * 0.5).min(0.5)); - } else { - next.foot_l.position = - Vec3::new(-s_a.foot.0, s_a.foot.1 - 5.0, s_a.foot.2); - - next.foot_r.position = - Vec3::new(s_a.foot.0, s_a.foot.1 + 7.0, s_a.foot.2); - - next.foot_l.orientation = - Quaternion::rotation_x(-0.2) * Quaternion::rotation_z(0.5); - - next.foot_r.orientation = - Quaternion::rotation_x(0.2) * Quaternion::rotation_z(0.5); - }; - */ - }, - _ => {}, - } - } } next } diff --git a/voxygen/src/anim/src/character/dash.rs b/voxygen/src/anim/src/character/dash.rs index e40f27282e..051364a6ba 100644 --- a/voxygen/src/anim/src/character/dash.rs +++ b/voxygen/src/anim/src/character/dash.rs @@ -5,9 +5,6 @@ use super::{ use common::{comp::item::ToolKind, states::utils::StageSection}; use std::f32::consts::PI; -pub struct Input { - pub attack: bool, -} pub struct DashAnimation; impl Animation for DashAnimation { @@ -26,7 +23,7 @@ impl Animation for DashAnimation { #[allow(clippy::single_match)] // TODO: Pending review in #587 fn update_skeleton_inner( skeleton: &Self::Skeleton, - (active_tool_kind, second_tool_kind, _global_time, stage_section): Self::Dependency, + (active_tool_kind, _second_tool_kind, _global_time, stage_section): Self::Dependency, anim_time: f64, rate: &mut f32, s_a: &SkeletonAttr, @@ -34,11 +31,11 @@ impl Animation for DashAnimation { *rate = 1.0; let mut next = (*skeleton).clone(); - let (movement1, movement2, movement3, _movement4) = match stage_section { - Some(StageSection::Buildup) => (anim_time as f32, 0.0, 0.0, 0.0), + let (movement1, movement2, movement3, movement4) = match stage_section { + Some(StageSection::Buildup) => ((anim_time as f32).powf(0.25), 0.0, 0.0, 0.0), Some(StageSection::Charge) => (1.0, anim_time as f32, 0.0, 0.0), Some(StageSection::Swing) => (1.0, 1.0, anim_time as f32, 0.0), - Some(StageSection::Recover) => (1.1, 1.0, 1.0, anim_time as f32), + Some(StageSection::Recover) => (1.1, 1.0, 1.0, (anim_time as f32).powf(4.0)), _ => (0.0, 0.0, 0.0, 0.0), }; @@ -83,33 +80,42 @@ impl Animation for DashAnimation { Quaternion::rotation_x(s_a.shr.3) * Quaternion::rotation_y(s_a.shr.4); next.control.position = Vec3::new( - s_a.sc.0 + movement1 * -5.0 + movement3 * -2.0, - s_a.sc.1 + movement2.min(1.0) * -2.0, - s_a.sc.2 + movement2.min(1.0) * 2.0, + s_a.sc.0 + (movement1 * -5.0 + movement3 * -2.0) * (1.0 - movement4), + s_a.sc.1 + (movement2.min(1.0) * -2.0) * (1.0 - movement4), + s_a.sc.2 + (movement2.min(1.0) * 2.0) * (1.0 - movement4), + ); + next.control.orientation = Quaternion::rotation_x( + s_a.sc.3 + (movement1 * -1.0 + movement3 * -0.5) * (1.0 - movement4), + ) * Quaternion::rotation_y( + s_a.sc.4 + (movement1 * 1.5 + movement3 * -2.5) * (1.0 - movement4), ); - next.control.orientation = - Quaternion::rotation_x(s_a.sc.3 + movement1 * -1.0 + movement3 * -0.5) - * Quaternion::rotation_y(s_a.sc.4 + movement1 * 1.5 + movement3 * -2.5); next.head.position = Vec3::new(0.0, 0.0 + s_a.head.0, s_a.head.1 + movement2.min(1.0) * 1.0); - next.head.orientation = Quaternion::rotation_x(0.0) - * Quaternion::rotation_y(movement2.min(1.0) * -0.3 + movement3 * 0.3) - * Quaternion::rotation_z(movement1 * -0.9 + movement3 * 1.6); + next.head.orientation = + Quaternion::rotation_y(movement2.min(1.0) * -0.3 + movement3 * 0.3) + * (1.0 - movement4) + * Quaternion::rotation_z(movement1 * -0.9 + movement3 * 1.6) + * (1.0 - movement4); next.chest.position = Vec3::new( 0.0, s_a.chest.0, - s_a.chest.1 + 2.0 + shortalt(movement2) * -2.5, + s_a.chest.1 + (2.0 + shortalt(movement2) * -2.5) * (1.0 - movement4), + ); + next.chest.orientation = Quaternion::rotation_x( + (movement2.min(1.0) * -0.4 + movement3 * 0.4) * (1.0 - movement4), + ) * Quaternion::rotation_y( + (movement2.min(1.0) * -0.2 + movement3 * 0.3) * (1.0 - movement4), + ) * Quaternion::rotation_z( + (movement1 * 1.1 + movement3 * -2.2) * (1.0 - movement4), ); - next.chest.orientation = - Quaternion::rotation_x(movement2.min(1.0) * -0.4 + movement3 * 0.4) - * Quaternion::rotation_y(movement2.min(1.0) * -0.2 + movement3 * 0.3) - * Quaternion::rotation_z(movement1 * 1.1 + movement3 * -2.2); - next.shorts.orientation = Quaternion::rotation_z(short(movement2).min(1.0) * 0.25); + next.shorts.orientation = + Quaternion::rotation_z((short(movement2).min(1.0) * 0.25) * (1.0 - movement4)); - next.belt.orientation = Quaternion::rotation_z(short(movement2).min(1.0) * 0.1); + next.belt.orientation = + Quaternion::rotation_z((short(movement2).min(1.0) * 0.1) * (1.0 - movement4)); next.foot_l.position = Vec3::new( -s_a.foot.0, @@ -129,9 +135,6 @@ impl Animation for DashAnimation { }, _ => {}, } - match second_tool_kind { - _ => {}, - } next.lantern.orientation = Quaternion::rotation_x(slow(anim_time as f32) * -0.7 + 0.4) * Quaternion::rotation_y(slow(anim_time as f32) * 0.4); diff --git a/voxygen/src/anim/src/character/glidewield.rs b/voxygen/src/anim/src/character/glidewield.rs index d62f831f05..6f269088cf 100644 --- a/voxygen/src/anim/src/character/glidewield.rs +++ b/voxygen/src/anim/src/character/glidewield.rs @@ -36,10 +36,10 @@ impl Animation for GlideWieldAnimation { *rate = 1.0; next.hand_l.position = Vec3::new(-2.0 - s_a.hand.0, s_a.hand.1, s_a.hand.2 + 15.0); - next.hand_l.orientation = Quaternion::rotation_x(3.35); + next.hand_l.orientation = Quaternion::rotation_x(3.35) * Quaternion::rotation_y(0.2); next.hand_r.position = Vec3::new(2.0 + s_a.hand.0, s_a.hand.1, s_a.hand.2 + 15.0); - next.hand_r.orientation = Quaternion::rotation_x(3.35); + next.hand_r.orientation = Quaternion::rotation_x(3.35) * Quaternion::rotation_y(-0.2); next.glider.scale = Vec3::one() * 1.0; if speed > 0.5 { diff --git a/voxygen/src/anim/src/character/gliding.rs b/voxygen/src/anim/src/character/gliding.rs index cef603155f..d230e919e8 100644 --- a/voxygen/src/anim/src/character/gliding.rs +++ b/voxygen/src/anim/src/character/gliding.rs @@ -86,10 +86,12 @@ impl Animation for GlidingAnimation { next.shorts.orientation = Quaternion::rotation_z(slowa * 0.12 + tilt * tiltcancel * 16.0); next.hand_l.position = Vec3::new(-9.5, -3.0, 10.0); - next.hand_l.orientation = Quaternion::rotation_x(-2.7 + slowa * -0.1); + next.hand_l.orientation = + Quaternion::rotation_x(-2.7 + slowa * -0.1) * Quaternion::rotation_y(0.2); next.hand_r.position = Vec3::new(9.5, -3.0, 10.0); - next.hand_r.orientation = Quaternion::rotation_x(-2.7 + slowa * -0.10); + next.hand_r.orientation = + Quaternion::rotation_x(-2.7 + slowa * -0.10) * Quaternion::rotation_y(-0.2); next.foot_l.position = Vec3::new( -s_a.foot.0, diff --git a/voxygen/src/anim/src/character/leapmelee.rs b/voxygen/src/anim/src/character/leapmelee.rs index 6ae0b2a216..e31ea1af95 100644 --- a/voxygen/src/anim/src/character/leapmelee.rs +++ b/voxygen/src/anim/src/character/leapmelee.rs @@ -33,47 +33,46 @@ impl Animation for LeapAnimation { let (movement1, movement2, movement3, movement4) = match stage_section { Some(StageSection::Buildup) => (anim_time as f32, 0.0, 0.0, 0.0), - Some(StageSection::Movement) => (1.0, anim_time as f32, 0.0, 0.0), - Some(StageSection::Swing) => (1.0, 1.0, anim_time as f32, 0.0), + Some(StageSection::Movement) => (1.0, (anim_time as f32).powf(0.25), 0.0, 0.0), + Some(StageSection::Swing) => (1.0, 1.0, (anim_time as f32).powf(0.25), 0.0), Some(StageSection::Recover) => (1.0, 1.0, 1.0, anim_time as f32), _ => (0.0, 0.0, 0.0, 0.0), }; if let Some(ToolKind::Hammer(_)) = active_tool_kind { - next.hand_l.position = Vec3::new(-12.0, 0.0, 0.0); - next.hand_l.orientation = Quaternion::rotation_x(PI) * Quaternion::rotation_y(0.0); - next.hand_l.scale = Vec3::one() * 1.04; - next.hand_r.position = Vec3::new(2.0, 0.0, 0.0); - next.hand_r.orientation = Quaternion::rotation_x(PI) * Quaternion::rotation_y(0.0); - next.hand_r.scale = Vec3::one() * 1.04; + next.hand_l.position = Vec3::new(s_a.hhl.0, s_a.hhl.1, s_a.hhl.2); + next.hand_l.orientation = Quaternion::rotation_x(s_a.hhl.3); + next.hand_r.position = Vec3::new(s_a.hhr.0, s_a.hhr.1, s_a.hhr.2); + next.hand_r.orientation = Quaternion::rotation_x(s_a.hhr.3); next.main.position = Vec3::new(0.0, 0.0, 0.0); - next.main.orientation = Quaternion::rotation_y(-1.57) * Quaternion::rotation_z(1.57); + next.main.orientation = Quaternion::rotation_y(0.0) * Quaternion::rotation_z(0.0); next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1); next.control.position = Vec3::new( - 6.0 + movement1 * -10.0, - 7.0 + movement2 * 5.0 + movement3 * 5.0, - 1.0 + movement2 * 5.0 + movement3 * -7.0, + s_a.hc.0 + movement2 * -10.0 + movement3 * 6.0, + s_a.hc.1 + movement2 * 5.0 + movement3 * 7.0, + s_a.hc.2 + movement2 * 5.0 + movement3 * -10.0, ); - next.control.orientation = Quaternion::rotation_x(0.3 + movement3 * -3.0) - * Quaternion::rotation_y(0.0) - * Quaternion::rotation_z(movement1 * 0.5 + movement2 * 0.5 + movement3 * 0.5); - next.chest.orientation = Quaternion::rotation_x( - movement1 * 0.3 + movement2 * 0.3 + movement3 * -0.9 + movement4 * 0.3, - ) * Quaternion::rotation_y(0.0) - * Quaternion::rotation_z(movement1 * 0.5 + movement2 * 0.2 + movement3 * -0.7); + next.control.orientation = + Quaternion::rotation_x(s_a.hc.3 + movement2 * 1.57 + movement3 * -2.3) + * Quaternion::rotation_y(s_a.hc.4 + movement2 * 1.3) + * Quaternion::rotation_z(s_a.hc.5 + movement2 * -1.0 + movement3 * 0.5); + next.chest.orientation = + Quaternion::rotation_x( + movement1 * 0.3 + movement2 * 0.3 + movement3 * -0.9 + movement4 * 0.3, + ) * Quaternion::rotation_z(movement1 * 0.5 + movement2 * 0.2 + movement3 * -0.7); next.head.orientation = Quaternion::rotation_x(movement3 * 0.2) * Quaternion::rotation_y(0.0 + movement2 * -0.1) * Quaternion::rotation_z(movement1 * -0.4 + movement2 * -0.2 + movement3 * 0.6); - next.hand_l.position = Vec3::new(-12.0 + movement3 * 10.0, 0.0, 0.0); + //next.hand_l.position = Vec3::new(-12.0 + movement3 * 10.0, 0.0, 0.0); next.foot_l.position = Vec3::new( -s_a.foot.0, - s_a.foot.1 - 5.0 + movement3 * 13.0, - s_a.foot.2 + movement3 * -5.0, + s_a.foot.1 + movement3 * 13.0, + s_a.foot.2 + movement3 * -2.0, ); next.foot_l.orientation = Quaternion::rotation_x(-0.8 + movement3 * 1.7); @@ -84,32 +83,30 @@ impl Animation for LeapAnimation { ); next.foot_r.orientation = Quaternion::rotation_x(0.9 + movement3 * -1.7); } else if let Some(ToolKind::Axe(_)) = active_tool_kind { - next.hand_l.position = Vec3::new(-0.5, 0.0, 4.0); - next.hand_l.orientation = Quaternion::rotation_x(PI / 2.0); - next.hand_r.position = Vec3::new(0.5, 0.0, -2.5); - next.hand_r.orientation = Quaternion::rotation_x(PI / 2.0); - next.main.position = Vec3::new(-0.0, -2.0, -1.0); - next.main.orientation = Quaternion::rotation_x(0.0); - - next.control.position = Vec3::new(-3.0, 11.0, 3.0); - next.control.orientation = Quaternion::rotation_x(1.8) - * Quaternion::rotation_y(-0.5) - * Quaternion::rotation_z(PI - 0.2); + next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2); + next.hand_l.orientation = Quaternion::rotation_x(s_a.ahl.3); + next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2); + next.hand_r.orientation = Quaternion::rotation_x(s_a.ahr.3); + next.main.position = Vec3::new(0.0, 0.0, 0.0); + next.main.orientation = Quaternion::rotation_y(0.0) * Quaternion::rotation_z(0.0); next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1); next.control.position = Vec3::new( - -3.0 + movement1 * 3.0, - 11.0 + movement1 * 1.0 + movement3 * 3.0, - 3.0 + movement1 * 12.0 + movement3 * -15.0, + s_a.ac.0 + movement1 * 8.0, + s_a.ac.1 + movement1 * 4.0 + movement3 * 3.0, + s_a.ac.2 + movement1 * 6.0 + movement2 * 1.0 + movement3 * -14.0, ); next.control.orientation = Quaternion::rotation_x( - 1.8 + movement1 * -1.0 + movement2 * -0.5 + movement3 * -1.0, - ) * Quaternion::rotation_y(-0.5 + movement1 * 0.5) - * Quaternion::rotation_z(PI + 0.2 - movement1 * 0.2); + s_a.ac.3 + movement1 * -2.0 + movement2 * 0.7 + movement3 * -2.3 + ) * Quaternion::rotation_y(s_a.ac.4)// + movement1 * 0.5) + * Quaternion::rotation_z(s_a.ac.5+movement1*PI); // - movement1 * 0.2); next.torso.orientation = Quaternion::rotation_x( - -0.3 + movement2 * -1.8 * PI + movement3 * -0.2 * PI + movement4 * -0.1 * PI, + -0.3 + movement2 * -1.6 * PI + + movement2 * -0.3 + + movement3 * -0.2 * PI + + movement4 * -0.1 * PI, ) * Quaternion::rotation_y(0.0) * Quaternion::rotation_z(0.0); @@ -117,25 +114,26 @@ impl Animation for LeapAnimation { Quaternion::rotation_x(0.0 + movement1 * -0.4 + movement2 * 0.4 + movement3 * 0.2); next.foot_l.position = Vec3::new( - s_a.foot.0, - s_a.foot.1 + movement2 * 4.0 + movement3 * -8.0, - s_a.foot.2 - 8.0 + movement2 * 3.0 + movement3 * -3.0, + -s_a.foot.0, + s_a.foot.1 + movement2 * 4.0 + movement3 * -1.0, + s_a.foot.2, ); next.foot_r.position = Vec3::new( s_a.foot.0, s_a.foot.1 + movement2 * 4.0 + movement3 * -8.0, - s_a.foot.2 - 8.0 + movement2 * 3.0 + movement3 * -3.0, + s_a.foot.2 + movement3 * -3.0, ); - next.foot_l.orientation = Quaternion::rotation_x(movement1 * 0.9 - movement3 * 1.8); + next.foot_l.orientation = + Quaternion::rotation_x(movement1 * 0.9 - movement2 * 1.0 + movement3 * 1.8); next.foot_r.orientation = Quaternion::rotation_x(movement1 * 0.9 - movement3 * 1.8); next.belt.orientation = Quaternion::rotation_x(movement1 * 0.22 + movement2 * 0.1); next.shorts.orientation = Quaternion::rotation_x(movement1 * 0.3 + movement2 * 0.1); - next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1 - 8.0); + next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1); } next diff --git a/voxygen/src/anim/src/character/mod.rs b/voxygen/src/anim/src/character/mod.rs index 7cf1681036..1751b456f5 100644 --- a/voxygen/src/anim/src/character/mod.rs +++ b/voxygen/src/anim/src/character/mod.rs @@ -42,6 +42,7 @@ pub use self::{ use super::{make_bone, vek::*, FigureBoneData, Skeleton}; use common::comp; use core::convert::TryFrom; +use std::f32::consts::PI; pub type Body = comp::humanoid::Body; @@ -277,13 +278,13 @@ impl<'a> From<&'a Body> for SkeletonAttr { (_, _) => (-5.0, 5.0, -1.0, -0.3, 0.15, 0.0), }, ahl: match (body.species, body.body_type) { - (_, _) => (-0.5, -1.0, 7.0, 1.87, 0.0, 0.0), + (_, _) => (-0.5, -1.0, 7.0, 1.17, PI, 0.0), }, ahr: match (body.species, body.body_type) { - (_, _) => (0.0, -1.0, 1.0, 4.34, 0.2, 0.0), + (_, _) => (0.0, -1.0, 1.0, -2.0, 0.0, PI), }, ac: match (body.species, body.body_type) { - (_, _) => (-8.0, 11.0, 3.0, 2.0, 0.0, 3.14), + (_, _) => (-8.0, 11.0, 3.0, 2.0, 0.0, 0.0), }, bhl: match (body.species, body.body_type) { (_, _) => (0.0, -4.0, 1.0, 1.57, 0.0, 0.0), diff --git a/voxygen/src/anim/src/character/repeater.rs b/voxygen/src/anim/src/character/repeater.rs index c71d02e7cd..2f5c754f07 100644 --- a/voxygen/src/anim/src/character/repeater.rs +++ b/voxygen/src/anim/src/character/repeater.rs @@ -43,27 +43,16 @@ impl Animation for RepeaterAnimation { fn fire(x: f32) -> f32 { (x * 18.0).sin() } if let Some(ToolKind::Bow(_)) = active_tool_kind { - next.hand_l.position = Vec3::new(2.0, 1.5, 0.0); - next.hand_l.orientation = Quaternion::rotation_x(1.20) - * Quaternion::rotation_y(-0.6) - * Quaternion::rotation_z(-0.3); - next.hand_r.position = Vec3::new(5.9, 4.5, -5.0); - next.hand_r.orientation = Quaternion::rotation_x(1.20) - * Quaternion::rotation_y(-0.6) - * Quaternion::rotation_z(-0.3); - next.main.position = Vec3::new(3.0, 2.0, -13.0); - next.main.orientation = Quaternion::rotation_x(-0.3) - * Quaternion::rotation_y(0.3) - * Quaternion::rotation_z(-0.6); + next.hand_l.position = Vec3::new(s_a.bhl.0, s_a.bhl.1, s_a.bhl.2); + next.hand_l.orientation = Quaternion::rotation_x(s_a.bhl.3); + next.hand_r.position = Vec3::new(s_a.bhr.0, s_a.bhr.1, s_a.bhr.2); + next.hand_r.orientation = Quaternion::rotation_x(s_a.bhr.3); + next.main.position = Vec3::new(0.0, 0.0, 0.0); + next.main.orientation = Quaternion::rotation_y(0.0) * Quaternion::rotation_z(0.0); next.hold.position = Vec3::new(1.2, -1.0, -5.2); - next.hold.orientation = Quaternion::rotation_x(-1.7) - * Quaternion::rotation_y(0.0) - * Quaternion::rotation_z(-0.1); - next.hold.scale = Vec3::one() * 1.0; - - next.control.position = Vec3::new(-7.0, 6.0, 6.0); - next.control.orientation = Quaternion::rotation_x(0.0) * Quaternion::rotation_z(0.0); + next.hold.orientation = Quaternion::rotation_x(-1.7) * Quaternion::rotation_z(-0.1); + next.hold.scale = Vec3::one() * 1.0 * (1.0 - movement3); next.foot_l.position = Vec3::new( -s_a.foot.0 + movement1 * -0.75 - 0.75, @@ -91,12 +80,13 @@ impl Animation for RepeaterAnimation { next.belt.position = Vec3::new(0.0, s_a.belt.0 + movement1 * 2.0, s_a.belt.1); next.belt.orientation = Quaternion::rotation_x(movement1 * 0.2); next.control.position = Vec3::new( - -7.0 + movement1 * 5.0, - 6.0 + movement1 * 3.0, - 6.0 + movement1 * 1.0, + s_a.bc.0 + movement1 * 5.0, + s_a.bc.1 + movement1 * 3.0, + s_a.bc.2 + movement1 * 1.0, ); - next.control.orientation = - Quaternion::rotation_x(movement1 * 0.4) * Quaternion::rotation_y(movement1 * 0.8); + next.control.orientation = Quaternion::rotation_x(s_a.bc.3 + movement1 * 0.4) + * Quaternion::rotation_y(s_a.bc.4 + movement1 * 0.8) + * Quaternion::rotation_z(s_a.bc.5); next.head.orientation = Quaternion::rotation_y(movement1 * 0.15 + movement2 * 0.05); next.torso.orientation = Quaternion::rotation_x(movement1 * 0.1 + movement2 * 0.1 + movement3 * 0.15); diff --git a/voxygen/src/anim/src/character/shockwave.rs b/voxygen/src/anim/src/character/shockwave.rs index c021010623..22569a62da 100644 --- a/voxygen/src/anim/src/character/shockwave.rs +++ b/voxygen/src/anim/src/character/shockwave.rs @@ -3,7 +3,6 @@ use super::{ CharacterSkeleton, SkeletonAttr, }; use common::{comp::item::ToolKind, states::utils::StageSection}; -use std::f32::consts::PI; pub struct Input { pub attack: bool, @@ -44,46 +43,49 @@ impl Animation for ShockwaveAnimation { next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1); - next.hand_l.position = Vec3::new(0.0, 0.0, -4.0); - next.hand_l.orientation = Quaternion::rotation_x(1.27) * Quaternion::rotation_y(0.0); - next.hand_r.position = Vec3::new(0.0, 0.0, 2.0); - next.hand_r.orientation = Quaternion::rotation_x(1.57) * Quaternion::rotation_y(0.2); - next.main.position = Vec3::new(0.0, 0.0, 13.2); - next.main.orientation = Quaternion::rotation_y(PI); + next.hand_l.position = Vec3::new(s_a.sthl.0, s_a.sthl.1, s_a.sthl.2); + next.hand_l.orientation = + Quaternion::rotation_x(s_a.sthl.3) * Quaternion::rotation_y(s_a.sthl.4); + next.hand_r.position = Vec3::new(s_a.sthr.0, s_a.sthr.1, s_a.sthr.2); + next.hand_r.orientation = + Quaternion::rotation_x(s_a.sthr.3) * Quaternion::rotation_y(s_a.sthr.4); + next.main.position = Vec3::new(0.0, 0.0, 0.0); + next.main.orientation = Quaternion::rotation_x(0.0); - next.control.position = Vec3::new(-4.0, 7.0, 4.0); - next.control.orientation = Quaternion::rotation_x(-0.3) * Quaternion::rotation_y(0.15); + next.control.position = Vec3::new(s_a.stc.0, s_a.stc.1, s_a.stc.2); + next.control.orientation = + Quaternion::rotation_x(s_a.stc.3) * Quaternion::rotation_y(s_a.stc.4); let twist = movement1 * 0.8; next.control.position = Vec3::new( - -4.0 + movement1 * 5.0 + movement3 * -5.0, - 7.0 + movement1 * 3.0 + movement3 * -3.0, - 4.0 + movement1 * 10.0 + movement2 * -2.0 + movement3 * -8.0, + s_a.stc.0 + (movement1 * 5.0) * (1.0 - movement3), + s_a.stc.1 + (movement1 * 5.0) * (1.0 - movement3), + s_a.stc.2 + (movement1 * 10.0 + movement2 * -10.0) * (1.0 - movement3), ); next.control.orientation = - Quaternion::rotation_x(-0.3 + movement1 * 0.8 + movement2 * 0.3 + movement3 * -1.1) + Quaternion::rotation_x(s_a.stc.3 + (movement1 * 0.8) * (1.0 - movement3)) * Quaternion::rotation_y( - 0.15 + movement1 * -0.15 + movement2 * 0.3 + movement3 * -0.45, + s_a.stc.4 + (movement1 * -0.15 + movement2 * -0.15) * (1.0 - movement3), ) - * Quaternion::rotation_z(movement1 * 0.8 + movement2 * -0.8); + * Quaternion::rotation_z((movement1 * 0.8 + movement2 * -0.8) * (1.0 - movement3)); - next.head.orientation = Quaternion::rotation_x(movement1 * 0.4 + movement3 * -0.4) - * Quaternion::rotation_z(twist * 0.2 + movement2 * -0.8 + movement3 * 0.6); + next.head.orientation = Quaternion::rotation_x((movement1 * 0.4) * (1.0 - movement3)) + * Quaternion::rotation_z((twist * 0.2 + movement2 * -0.8) * (1.0 - movement3)); next.chest.position = Vec3::new( 0.0, s_a.chest.0, - s_a.chest.1 + movement1 * 2.0 + movement2 * -4.0 + movement3 * 2.0, + s_a.chest.1 + (movement1 * 2.0 + movement2 * -4.0) * (1.0 - movement3), ); - next.chest.orientation = Quaternion::rotation_x(movement2 * -0.8 + movement3 * 0.8) - * Quaternion::rotation_z(twist * -0.2 + movement2 * -0.1 + movement3 * 0.3); + next.chest.orientation = Quaternion::rotation_x((movement2 * -0.8) * (1.0 - movement3)) + * Quaternion::rotation_z(twist * -0.2 + movement2 * -0.1 + (1.0 - movement3)); - next.belt.orientation = Quaternion::rotation_x(movement2 * 0.2 + movement3 * -0.2) - * Quaternion::rotation_z(twist * 0.6 + movement2 * -0.48); + next.belt.orientation = Quaternion::rotation_x((movement2 * 0.2) * (1.0 - movement3)) + * Quaternion::rotation_z((twist * 0.6 + movement2 * -0.48) * (1.0 - movement3)); - next.shorts.orientation = Quaternion::rotation_x(movement2 * 0.3 + movement3 * -0.3) - * Quaternion::rotation_z(twist + movement2 * -0.8); + next.shorts.orientation = Quaternion::rotation_x((movement2 * 0.3) * (1.0 - movement3)) + * Quaternion::rotation_z((twist + movement2 * -0.8) * (1.0 - movement3)); if velocity < 0.5 { next.foot_l.position = Vec3::new( diff --git a/voxygen/src/anim/src/character/spinmelee.rs b/voxygen/src/anim/src/character/spinmelee.rs index b51737f03c..84b7ac69d0 100644 --- a/voxygen/src/anim/src/character/spinmelee.rs +++ b/voxygen/src/anim/src/character/spinmelee.rs @@ -73,16 +73,20 @@ impl Animation for SpinMeleeAnimation { next.hand_r.orientation = Quaternion::rotation_x(s_a.shr.3) * Quaternion::rotation_y(s_a.shr.4); - next.control.position = Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2); + next.control.position = Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2 + movement1 * 2.0); next.control.orientation = - Quaternion::rotation_x(s_a.sc.3 - PI / 2.0 + movement3 * PI / 2.0) - * Quaternion::rotation_z(s_a.sc.5 - PI / 2.0 + movement3 * PI / 2.0); + Quaternion::rotation_x(s_a.sc.3 + movement1 * -PI / 2.5 + movement3 * PI / 2.0) + * Quaternion::rotation_z( + s_a.sc.5 + movement1 * -PI / 2.0 + movement3 * PI / 2.0, + ); next.torso.orientation = Quaternion::rotation_z(movement2 * PI * 2.0); - next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1); - next.chest.orientation = Quaternion::rotation_y(0.3 + movement3 * -0.3); + next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + movement1 * -2.0); + next.chest.orientation = Quaternion::rotation_x(movement1 * -0.3) + * Quaternion::rotation_y(movement1 * 0.15 + movement3 * -0.15); next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1); - next.head.orientation = Quaternion::rotation_x(-0.15 + movement3 * 0.15); + next.head.orientation = Quaternion::rotation_x(movement1 * 0.2 + movement3 * 0.15) + * Quaternion::rotation_z(movement2 * 0.8 + movement3 * -0.6); next.belt.orientation = Quaternion::rotation_x(0.1); next.shorts.orientation = Quaternion::rotation_x(0.2); }, diff --git a/voxygen/src/anim/src/character/wield.rs b/voxygen/src/anim/src/character/wield.rs index e3a53e21ac..71b7cabf6a 100644 --- a/voxygen/src/anim/src/character/wield.rs +++ b/voxygen/src/anim/src/character/wield.rs @@ -155,9 +155,11 @@ impl Animation for WieldAnimation { } else { } next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2); - next.hand_l.orientation = Quaternion::rotation_x(s_a.ahl.3); + next.hand_l.orientation = + Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4); next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2); - next.hand_r.orientation = Quaternion::rotation_x(s_a.ac.3); + next.hand_r.orientation = + Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5); next.control.position = Vec3::new(s_a.ac.0, s_a.ac.1, s_a.ac.2); next.control.orientation = Quaternion::rotation_x(s_a.ac.3)