diff --git a/assets/common/abilities/axe/spin.ron b/assets/common/abilities/axe/spin.ron index ef6f426a89..906396fb05 100644 --- a/assets/common/abilities/axe/spin.ron +++ b/assets/common/abilities/axe/spin.ron @@ -3,7 +3,7 @@ SpinMelee( swing_duration: 0.6, recover_duration: 0.2, base_damage: 70, - base_poise_damage: 55, + base_poise_damage: 25, knockback: ( strength: 0.0, direction: Away), range: 3.5, damage_effect: None, diff --git a/voxygen/anim/src/character/alpha.rs b/voxygen/anim/src/character/alpha.rs index d3833e55e5..b9e774e118 100644 --- a/voxygen/anim/src/character/alpha.rs +++ b/voxygen/anim/src/character/alpha.rs @@ -47,12 +47,15 @@ impl Animation for AlphaAnimation { let (move1, move2, move3, move2h) = match stage_section { Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0, 0.0), - Some(StageSection::Swing) => (1.0, anim_time.powi(4), 0.0, anim_time.powf(0.25)), + Some(StageSection::Swing) => (1.0, anim_time.powi(2), 0.0, anim_time.powf(0.25)), Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4), 1.0), /* hmm maybe don' */ // t complete the // recovery? _ => (0.0, 0.0, 0.0, 0.0), }; + + next.main.position = Vec3::new(0.0, 0.0, 0.0); + next.main.orientation = Quaternion::rotation_x(0.0); next.second.position = Vec3::new(0.0, 0.0, 0.0); next.second.orientation = Quaternion::rotation_z(0.0); next.torso.position = Vec3::new(0.0, 0.0, 0.1) * s_a.scaler; @@ -64,28 +67,22 @@ impl Animation for AlphaAnimation { next.main.orientation = Quaternion::rotation_x(0.0); next.chest.orientation = - Quaternion::rotation_z(move1 * 1.5 + (move2 * 1.75).sin() * -3.0 + move3 * 0.5); + Quaternion::rotation_z(move1 * 1.1 + move2 * -2.0 + move3 * 0.5); next.head.position = Vec3::new(0.0 + move2 * 2.0, s_a.head.0, s_a.head.1); - next.head.orientation = Quaternion::rotation_z( - move1 * -0.9 + (move2 * 1.75).sin() * 2.5 + move3 * -0.5, - ); + next.head.orientation = + Quaternion::rotation_z(move1 * -0.9 + move2 * 1.8 + move3 * -0.5); }, Some(ToolKind::Axe) => { - next.main.position = Vec3::new(0.0, 0.0, 0.0); - next.main.orientation = Quaternion::rotation_x(0.0); - - next.head.position = - Vec3::new(0. + move2 * 2.0, s_a.head.0 + move2 * 2.0, s_a.head.1); - let (move1, move2, move3) = match stage_section { Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0), Some(StageSection::Swing) => (1.0, anim_time, 0.0), Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)), _ => (0.0, 0.0, 0.0), }; - + next.head.position = + Vec3::new(0. + move2 * 2.0, s_a.head.0 + move2 * 2.0, s_a.head.1); next.chest.orientation = Quaternion::rotation_x(0.0 + move1 * 0.6 + move2 * -0.6 + move3 * 0.4) * Quaternion::rotation_y(0.0 + move1 * 0.0 + move2 * 0.0 + move3 * 0.0) @@ -104,8 +101,6 @@ impl Animation for AlphaAnimation { let pullback = (1.0 - move3); let moveret1 = move1 * pullback; let moveret2 = move2 * pullback; - next.main.position = Vec3::new(0.0, 0.0, 0.0); - next.main.orientation = Quaternion::rotation_x(0.0); next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1); next.head.orientation = Quaternion::rotation_x((moveret1 * 0.1 + moveret2 * 0.3)) @@ -135,17 +130,22 @@ impl Animation for AlphaAnimation { 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.0 + move2 * 10.0, s_a.sc.1 + move1 * -4.0 + move2 * 16.0 + move3 * -4.0, s_a.sc.2 + move1 * 1.0, ); - next.control.orientation = Quaternion::rotation_x(s_a.sc.3 + move1 * -0.5) - * Quaternion::rotation_y( - s_a.sc.4 + move1 * -1.0 + move2 * -0.6 + move3 * 1.0, - ) - * Quaternion::rotation_z(s_a.sc.5 + move1 * -1.2 + move2 * 1.3); + next.control.orientation = Quaternion::rotation_x(s_a.sc.3 + move1 * -1.3) + * Quaternion::rotation_y(s_a.sc.4 + move1 * -0.7 + move2 * 1.2) + * Quaternion::rotation_z(s_a.sc.5 + move1 * -1.57); }, Some(ToolKind::Axe) => { + 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) * 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.ahr.3) * Quaternion::rotation_z(s_a.ahr.5); + let (move1, move2, move3) = match stage_section { Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0), Some(StageSection::Swing) => (1.0, anim_time, 0.0), @@ -200,51 +200,47 @@ impl Animation for AlphaAnimation { }; match hands { - (Some(Hands::One), Some(Hands::One)) | (Some(Hands::One), None) => { - match ability_info.and_then(|a| a.tool) { - Some(ToolKind::Sword) | Some(ToolKind::SwordSimple) => { - next.control_l.position = Vec3::new(-7.0, 8.0, 2.0); - next.control_l.orientation = Quaternion::rotation_x(-0.3 + move2 * 2.0) - * Quaternion::rotation_y(move1 * -1.2 + move2 * -1.5) - * Quaternion::rotation_z(move2 * 1.5); - next.hand_l.position = Vec3::new(0.0, -0.5, 0.0); - next.hand_l.orientation = Quaternion::rotation_x(1.57) - }, - Some(ToolKind::Axe) => { - next.control_l.position = Vec3::new( - -7.0 + move2 * 5.0, - 8.0 + move1 * 3.0 + move2 * 7.0, - 2.0 + move1 * -6.0 + move2 * 10.0, - ); - next.control_l.orientation = Quaternion::rotation_x(-0.3 + move2 * 2.0) - * Quaternion::rotation_y(move1 * -1.2 + move2 * -2.5) - * Quaternion::rotation_z(move2 * 1.5); - next.hand_l.position = Vec3::new(0.0, -0.5, 0.0); - next.hand_l.orientation = Quaternion::rotation_x(1.57) - }, - Some(ToolKind::Hammer) - | Some(ToolKind::HammerSimple) - | Some(ToolKind::Pick) => { - next.control_l.position = Vec3::new( - -7.0, - 8.0 + move1 * -4.0 + move2 * 4.0, - 2.0 + move1 * 16.0 + move2 * -19.0, - ); - next.control_l.orientation = - Quaternion::rotation_x(-0.3 + move1 * 1.9 + move2 * -3.0) - * Quaternion::rotation_y(0.0) - * Quaternion::rotation_z(0.0); - next.hand_l.position = Vec3::new(0.0, -0.5, 0.0); - next.hand_l.orientation = Quaternion::rotation_x(1.57) - }, + (Some(Hands::One), _) => match ability_info.and_then(|a| a.tool) { + Some(ToolKind::Sword) | Some(ToolKind::SwordSimple) => { + next.control_l.position = Vec3::new(-7.0, 8.0, 2.0); + next.control_l.orientation = Quaternion::rotation_x(-0.3 + move2 * 2.0) + * Quaternion::rotation_y(move1 * -1.2 + move2 * -1.5) + * Quaternion::rotation_z(move2 * 1.5); + next.hand_l.position = Vec3::new(0.0, -0.5, 0.0); + next.hand_l.orientation = Quaternion::rotation_x(1.57) + }, + Some(ToolKind::Axe) => { + next.control_l.position = Vec3::new( + -7.0 + move2 * 5.0, + 8.0 + move1 * 3.0 + move2 * 7.0, + 2.0 + move1 * -6.0 + move2 * 10.0, + ); + next.control_l.orientation = Quaternion::rotation_x(-0.3 + move2 * 2.0) + * Quaternion::rotation_y(move1 * -1.2 + move2 * -2.5) + * Quaternion::rotation_z(move2 * 1.5); + next.hand_l.position = Vec3::new(0.0, -0.5, 0.0); + next.hand_l.orientation = Quaternion::rotation_x(1.57) + }, + Some(ToolKind::Hammer) | Some(ToolKind::HammerSimple) | Some(ToolKind::Pick) => { + next.control_l.position = Vec3::new( + -7.0, + 8.0 + move1 * -4.0 + move2 * 4.0, + 2.0 + move1 * 16.0 + move2 * -19.0, + ); + next.control_l.orientation = + Quaternion::rotation_x(-0.3 + move1 * 1.9 + move2 * -3.0) + * Quaternion::rotation_y(0.0) + * Quaternion::rotation_z(0.0); + next.hand_l.position = Vec3::new(0.0, -0.5, 0.0); + next.hand_l.orientation = Quaternion::rotation_x(1.57) + }, - _ => {}, - } + _ => {}, }, (_, _) => {}, }; match hands { - (Some(Hands::One), Some(Hands::One)) | (None, Some(Hands::One)) => { + (None | Some(Hands::One), Some(Hands::One)) => { match ability_info.and_then(|a| a.tool) { Some(ToolKind::Sword) | Some(ToolKind::SwordSimple) => { next.control_r.position = Vec3::new(7.0 + move2 * 8.0, 8.0, 2.0); diff --git a/voxygen/anim/src/character/beta.rs b/voxygen/anim/src/character/beta.rs index d6d977e9a5..1b1c834336 100644 --- a/voxygen/anim/src/character/beta.rs +++ b/voxygen/anim/src/character/beta.rs @@ -6,6 +6,7 @@ use common::{ comp::item::{Hands, ToolKind}, states::utils::{AbilityInfo, StageSection}, }; +use std::f32::consts::PI; pub struct BetaAnimation; @@ -49,29 +50,96 @@ impl Animation for BetaAnimation { Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)), _ => (0.0, 0.0, 0.0), }; - + next.second.position = Vec3::new(0.0, 0.0, 0.0); + next.second.orientation = Quaternion::rotation_z(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); + match ability_info.and_then(|a| a.tool) { + Some(ToolKind::Sword) => { + next.chest.orientation = Quaternion::rotation_x(0.15) + * Quaternion::rotation_y((-0.1) * (1.0 - move3)) + * Quaternion::rotation_z((0.4 + move1 * 1.5 + move2 * -2.5) * (1.0 - move3)); + next.head.orientation = Quaternion::rotation_z(-0.4 + move1 * -1.0 + move2 * 1.5); + }, + _ => {}, + } + match hands { + (Some(Hands::Two), _) => match ability_info.and_then(|a| a.tool) { + Some(ToolKind::Sword) | Some(ToolKind::SwordSimple) => { + 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 + move1 * -3.0 + move2 * -2.0) * (1.0 - move3), - s_a.sc.1 + (-1.4 + move1 * 3.0 + move2 * 3.0) * (1.0 - move3), - s_a.sc.2 + (-1.9 + move1 * 2.5 * (1.0 - move3)), - ); - next.control.orientation = Quaternion::rotation_x(s_a.sc.3 + (-1.7) * (1.0 - move3)) - * Quaternion::rotation_y(s_a.sc.4 + (0.4 + move1 * 1.5 + move2 * -2.5) * (1.0 - move3)) - * Quaternion::rotation_z(s_a.sc.5 + (1.67 + move2 * 1.57) * (1.0 - move3)); - next.chest.orientation = Quaternion::rotation_x(0.15) - * Quaternion::rotation_y((-0.1) * (1.0 - move3)) - * Quaternion::rotation_z((0.4 + move1 * 1.5 + move2 * -2.5) * (1.0 - move3)); - next.head.orientation = Quaternion::rotation_z((-0.4) * (1.0 - move3)); + next.control.position = Vec3::new( + s_a.sc.0 + (-1.4 + move1 * -3.0 + move2 * -2.0) * (1.0 - move3), + s_a.sc.1 + (-1.4 + move1 * 3.0 + move2 * 3.0) * (1.0 - move3), + s_a.sc.2 + (-1.9 + move1 * 2.5 * (1.0 - move3)), + ); + next.control.orientation = + Quaternion::rotation_x(s_a.sc.3 + (-1.7) * (1.0 - move3)) + * Quaternion::rotation_y( + s_a.sc.4 + (0.4 + move1 * 1.5 + move2 * -2.5) * (1.0 - move3), + ) + * Quaternion::rotation_z( + s_a.sc.5 + (1.67 + move2 * 1.57) * (1.0 - move3), + ); + }, + _ => {}, + }, + (_, _) => {}, + }; + + match hands { + (Some(Hands::One), _) => match ability_info.and_then(|a| a.tool) { + Some(ToolKind::Sword) | Some(ToolKind::SwordSimple) => { + next.control_l.position = Vec3::new(-12.0, 8.0, 2.0); + next.control_l.orientation = Quaternion::rotation_x(1.7) + * Quaternion::rotation_y(-3.7 + move1 * 0.5) + * Quaternion::rotation_z(3.69); + next.hand_l.position = Vec3::new(0.0, -0.5, 0.0); + next.hand_l.orientation = Quaternion::rotation_x(1.57) + }, + + _ => {}, + }, + (_, _) => {}, + }; + match hands { + (None | Some(Hands::One), Some(Hands::One)) => { + match ability_info.and_then(|a| a.tool) { + Some(ToolKind::Sword) | Some(ToolKind::SwordSimple) => { + next.control_r.position = Vec3::new(0.0 + move1 * -8.0, 13.0, 2.0); + next.control_r.orientation = Quaternion::rotation_x(1.7) + * Quaternion::rotation_y(-2.3 + move1 * -1.3) + * Quaternion::rotation_z(3.69); + next.hand_r.position = Vec3::new(0.0, -0.5, 0.0); + next.hand_r.orientation = Quaternion::rotation_x(1.57) + }, + + _ => {}, + } + }, + (_, _) => {}, + }; + + match hands { + (None, None) | (None, Some(Hands::One)) => { + next.hand_l.position = Vec3::new(-4.5, 8.0, 5.0); + next.hand_l.orientation = Quaternion::rotation_x(1.9) * Quaternion::rotation_y(-0.5) + }, + (_, _) => {}, + }; + match hands { + (None, None) | (Some(Hands::One), None) => { + next.hand_r.position = Vec3::new(4.5, 8.0, 5.0); + next.hand_r.orientation = Quaternion::rotation_x(1.9) * Quaternion::rotation_y(0.5) + }, + (_, _) => {}, + }; next } diff --git a/voxygen/anim/src/character/jump.rs b/voxygen/anim/src/character/jump.rs index fae86e1af7..7702dd9f2f 100644 --- a/voxygen/anim/src/character/jump.rs +++ b/voxygen/anim/src/character/jump.rs @@ -34,13 +34,9 @@ impl Animation for JumpAnimation { let mut next = (*skeleton).clone(); let slow = (anim_time * 7.0).sin(); - let random = - ((((2.0 * ((global_time - anim_time) - ((global_time - anim_time).round()))).abs()) - * 10.0) - .round()) - / 10.0; - - let switch = if random > 0.5 { 1.0 } else { -1.0 }; + let subtract = global_time - anim_time as f32; + let check = subtract - subtract.trunc(); + let switch = (check - 0.5).signum(); let speed = Vec2::::from(velocity).magnitude(); let speednorm = (speed / 10.0).min(1.0); @@ -90,7 +86,7 @@ impl Animation for JumpAnimation { next.shorts.orientation = Quaternion::rotation_x(speednorm * 0.5) * Quaternion::rotation_z(tilt * 3.0); - if random > 0.5 { + if switch > 0.0 { next.hand_l.position = Vec3::new( -s_a.hand.0, 1.0 + s_a.hand.1 + 4.0, @@ -194,11 +190,33 @@ impl Animation for JumpAnimation { next.torso.orientation = Quaternion::rotation_x(0.0); next.torso.scale = Vec3::one() / 11.0 * s_a.scaler; + match hands { + (Some(Hands::One), _) => match active_tool_kind { + Some(ToolKind::Axe) | Some(ToolKind::Hammer) | Some(ToolKind::Sword) => { + next.main.position = Vec3::new(-4.0, -5.0, 10.0); + next.main.orientation = + Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57); + }, + + _ => {}, + }, + (_, _) => {}, + }; + match hands { + (None | Some(Hands::One), Some(Hands::One)) => match second_tool_kind { + Some(ToolKind::Axe) | Some(ToolKind::Hammer) | Some(ToolKind::Sword) => { + next.second.position = Vec3::new(4.0, -5.5, 10.0); + next.second.orientation = + Quaternion::rotation_y(-2.5) * Quaternion::rotation_z(1.57); + }, + _ => {}, + }, + (_, _) => {}, + }; next.second.scale = match hands { - (Some(Hands::One), Some(Hands::One)) => Vec3::one(), + (Some(Hands::One) | None, Some(Hands::One)) => Vec3::one(), (_, _) => Vec3::zero(), }; - next } } diff --git a/voxygen/anim/src/character/leapmelee.rs b/voxygen/anim/src/character/leapmelee.rs index e5af095266..2c2553ccc1 100644 --- a/voxygen/anim/src/character/leapmelee.rs +++ b/voxygen/anim/src/character/leapmelee.rs @@ -169,38 +169,34 @@ impl Animation for LeapAnimation { }; match hands { - (Some(Hands::One), Some(Hands::One)) | (Some(Hands::One), None) => { - match ability_info.and_then(|a| a.tool) { - Some(ToolKind::Axe) => { - next.control_l.position = - Vec3::new(-7.0 + move3 * 4.0, 8.0 + move3 * 8.0, 2.0 + move3 * -4.0); - next.control_l.orientation = - Quaternion::rotation_x(-0.3 + move2 * 1.0 + move3 * -2.0) - * Quaternion::rotation_y(move2 * -0.5 + move3 * 1.9); - next.hand_l.position = Vec3::new(0.0, -0.5, 0.0); - next.hand_l.orientation = Quaternion::rotation_x(1.57) - }, - Some(ToolKind::Hammer) - | Some(ToolKind::HammerSimple) - | Some(ToolKind::Pick) => { - next.control_l.position = Vec3::new( - -7.0, - 8.0 + move2 * -5.0 + move3 * 9.0, - 2.0 + move2 * 8.0 + move3 * -12.0, - ); - next.control_l.orientation = - Quaternion::rotation_x(-0.3 + move2 * 1.5 + move3 * -2.5); - next.hand_l.position = Vec3::new(0.0, -0.5, 0.0); - next.hand_l.orientation = Quaternion::rotation_x(1.57) - }, + (Some(Hands::One), _) => match ability_info.and_then(|a| a.tool) { + Some(ToolKind::Axe) => { + next.control_l.position = + Vec3::new(-7.0 + move3 * 4.0, 8.0 + move3 * 8.0, 2.0 + move3 * -4.0); + next.control_l.orientation = + Quaternion::rotation_x(-0.3 + move2 * 1.0 + move3 * -2.0) + * Quaternion::rotation_y(move2 * -0.5 + move3 * 1.9); + next.hand_l.position = Vec3::new(0.0, -0.5, 0.0); + next.hand_l.orientation = Quaternion::rotation_x(1.57) + }, + Some(ToolKind::Hammer) | Some(ToolKind::HammerSimple) | Some(ToolKind::Pick) => { + next.control_l.position = Vec3::new( + -7.0, + 8.0 + move2 * -5.0 + move3 * 9.0, + 2.0 + move2 * 8.0 + move3 * -12.0, + ); + next.control_l.orientation = + Quaternion::rotation_x(-0.3 + move2 * 1.5 + move3 * -2.5); + next.hand_l.position = Vec3::new(0.0, -0.5, 0.0); + next.hand_l.orientation = Quaternion::rotation_x(1.57) + }, - _ => {}, - } + _ => {}, }, (_, _) => {}, }; match hands { - (Some(Hands::One), Some(Hands::One)) | (None, Some(Hands::One)) => { + (None | Some(Hands::One), Some(Hands::One)) => { match ability_info.and_then(|a| a.tool) { Some(ToolKind::Axe) => { next.control_r.position = Vec3::new( diff --git a/voxygen/anim/src/character/run.rs b/voxygen/anim/src/character/run.rs index 42970f8f98..68ba2d8a5d 100644 --- a/voxygen/anim/src/character/run.rs +++ b/voxygen/anim/src/character/run.rs @@ -253,11 +253,34 @@ impl Animation for RunAnimation { next.torso.position = Vec3::new(0.0, 0.0, 0.0) * s_a.scaler; next.torso.scale = Vec3::one() / 11.0 * s_a.scaler; - next.second.scale = match hands { - (Some(Hands::One), Some(Hands::One)) => Vec3::one(), - (_, _) => Vec3::zero(), + match hands { + (Some(Hands::One), _) => match active_tool_kind { + Some(ToolKind::Axe) | Some(ToolKind::Hammer) | Some(ToolKind::Sword) => { + next.main.position = Vec3::new(-4.0, -5.0, 10.0); + next.main.orientation = + Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57); + }, + + _ => {}, + }, + (_, _) => {}, + }; + match hands { + (None | Some(Hands::One), Some(Hands::One)) => match second_tool_kind { + Some(ToolKind::Axe) | Some(ToolKind::Hammer) | Some(ToolKind::Sword) => { + next.second.position = Vec3::new(4.0, -5.5, 10.0); + next.second.orientation = + Quaternion::rotation_y(-2.5) * Quaternion::rotation_z(1.57); + }, + _ => {}, + }, + (_, _) => {}, }; + next.second.scale = match hands { + (Some(Hands::One) | None, Some(Hands::One)) => Vec3::one(), + (_, _) => Vec3::zero(), + }; next } } diff --git a/voxygen/anim/src/character/spin.rs b/voxygen/anim/src/character/spin.rs index 74ce5a86c3..48732538de 100644 --- a/voxygen/anim/src/character/spin.rs +++ b/voxygen/anim/src/character/spin.rs @@ -29,7 +29,7 @@ impl Animation for SpinAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, ( - active_tool_kind, + _active_tool_kind, _second_tool_kind, hands, _velocity, @@ -51,68 +51,37 @@ impl Animation for SpinAnimation { _ => (0.0, 0.0, 0.0), }; let pullback = 1.0 - movement3; - let movement1 = movement1base * pullback; - let movement2 = movement2base * pullback; - + let move1 = movement1base * pullback; + let move2 = movement2base * pullback; + next.second.position = Vec3::new(0.0, 0.0, 0.0); + next.second.orientation = Quaternion::rotation_z(0.0); + next.main.position = Vec3::new(0.0, 0.0, 0.0); + next.main.orientation = Quaternion::rotation_x(0.0); next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1); - match active_tool_kind { + match ability_info.and_then(|a| a.tool) { Some(ToolKind::Sword) => { - 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.control.position = Vec3::new( - s_a.sc.0 + movement1 * 2.0 + movement2 * -12.0 + movement3 * -7.0, - s_a.sc.1 + 8.0 + movement1 * 0.6 + movement2 * -15.0 + movement3 * -10.0, - s_a.sc.2 + 1.0 + movement1 * 0.6 + movement2 * 1.5 + movement3 * -4.0, - ); - next.control.orientation = - Quaternion::rotation_x(-0.5 + s_a.sc.3 + movement1 * -1.2) - * Quaternion::rotation_y( - s_a.sc.4 - 0.6 + movement1 * 0.0 + movement2 * -1.7, - ) - * Quaternion::rotation_z(s_a.sc.5 + 0.1 + movement1 * 1.57); next.head.position = Vec3::new( - 0.0 + 2.0 + movement2 * -2.0, - 2.0 + movement2 * -2.0 + s_a.head.0, + 0.0 + 2.0 + move2 * -2.0, + 2.0 + move2 * -2.0 + s_a.head.0, s_a.head.1, ); - next.chest.orientation = Quaternion::rotation_x(movement2 * 0.15) - * Quaternion::rotation_y( - movement1 * -0.1 + movement2 * 0.15 + movement3 * -0.1, - ) - * Quaternion::rotation_z( - -1.0 + movement1 * -0.6 + movement2 * 1.0 + movement3 * 0.5, - ); + next.chest.orientation = Quaternion::rotation_x(move2 * -0.15) + * Quaternion::rotation_y(move1 * -0.1 + move2 * 0.15) + * Quaternion::rotation_z(-1.0 + move1 * -0.6 + move2 * 1.6); - next.belt.orientation = Quaternion::rotation_x(movement1 * 0.1) - * Quaternion::rotation_z(movement2.sin() * 0.5); + next.belt.orientation = + Quaternion::rotation_x(move1 * 0.1) * Quaternion::rotation_z(move2.sin() * 0.5); - next.shorts.orientation = Quaternion::rotation_x(movement1 * 0.1) - * Quaternion::rotation_z(movement2.sin() * 1.5); + next.shorts.orientation = + Quaternion::rotation_x(move1 * 0.1) * Quaternion::rotation_z(move2.sin() * 1.5); - next.head.orientation = Quaternion::rotation_y(movement1 * 0.1 + movement2 * -0.1) - * Quaternion::rotation_z(1.07 + movement1 * 0.4 + movement2 * -1.1); + next.head.orientation = Quaternion::rotation_x(move2 * 0.15) + * Quaternion::rotation_z(1.07 + move1 * 0.4 + move2 * -1.5); }, Some(ToolKind::Axe) => { - 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.ahl.0, s_a.ahl.1, s_a.ahl.2); - 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.ahr.3) * Quaternion::rotation_z(s_a.ahr.5); - let (movement1, movement2, movement3) = match stage_section { Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0), Some(StageSection::Swing) => (1.0, anim_time, 0.0), @@ -120,19 +89,6 @@ impl Animation for SpinAnimation { _ => (0.0, 0.0, 0.0), }; - next.control.position = Vec3::new( - s_a.ac.0 + (-3.0 + movement1 * 0.0 + movement2 * -2.0), - s_a.ac.1 + (-3.5 + movement1 * -4.6 + movement2 * 5.0), - s_a.ac.2 + (-11.0 + movement1 * 10.0 + movement2 * -4.0), - ); - next.control.orientation = - Quaternion::rotation_x(s_a.ac.3 + (-2.6 + movement1 * 0.0 + movement2 * -0.6)) - * Quaternion::rotation_y( - s_a.ac.4 + (0.2 + movement1 * -0.5 + movement2 * 0.0), - ) - * Quaternion::rotation_z( - s_a.ac.5 + (-0.5 + movement1 * -3.0 + movement2 * 0.5), - ); next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1); next.chest.orientation = Quaternion::rotation_x(0.4 + movement2 * -0.5) @@ -170,9 +126,134 @@ impl Animation for SpinAnimation { ); next.foot_r.orientation = Quaternion::rotation_x(movement1 * -0.5 + movement2 * -0.5); + next.head.orientation = Quaternion::rotation_x(movement2 * 0.25) + * Quaternion::rotation_z(movement2 * 0.8); }, _ => {}, } + match hands { + (Some(Hands::Two), _) => match ability_info.and_then(|a| a.tool) { + Some(ToolKind::Sword) | Some(ToolKind::SwordSimple) => { + 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.control.position = Vec3::new( + s_a.sc.0 + move1 * 2.0 + move2 * -7.0, + s_a.sc.1 + 8.0 + move1 * 0.6 + move2 * -15.0, + s_a.sc.2 + 1.0 + move1 * 0.6 + move2 * 1.5, + ); + next.control.orientation = + Quaternion::rotation_x(-0.5 + s_a.sc.3 + move1 * -1.2) + * Quaternion::rotation_y(s_a.sc.4 - 0.6 + move1 * 0.0 + move2 * -0.2) + * Quaternion::rotation_z(s_a.sc.5 + 0.1 + move1 * 1.57); + }, + Some(ToolKind::Axe) => { + 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) * 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.ahr.3) * Quaternion::rotation_z(s_a.ahr.5); + let (move1, move2, _move3) = match stage_section { + Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0), + Some(StageSection::Swing) => (1.0, anim_time, 0.0), + Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)), + _ => (0.0, 0.0, 0.0), + }; + next.control.position = Vec3::new( + s_a.ac.0 + move1 * -1.0 + move2 * -2.0, + s_a.ac.1 + move1 * -3.0 + move2 * 3.0, + s_a.ac.2 + move1 * 6.0 + move2 * -15.0, + ); + next.control.orientation = + Quaternion::rotation_x(s_a.ac.3 + move1 * 0.0 + move2 * -3.0) + * Quaternion::rotation_y(s_a.ac.4 + move1 * -0.0 + move2 * -0.4) + * Quaternion::rotation_z(s_a.ac.5 + move1 * -2.0 + move2 * -1.0) + }, + _ => {}, + }, + (_, _) => {}, + }; + + match hands { + (Some(Hands::One), _) => match ability_info.and_then(|a| a.tool) { + Some(ToolKind::Sword) | Some(ToolKind::SwordSimple) => { + next.control_l.position = Vec3::new(-7.0 + move2 * -5.0, 8.0, 2.0); + next.control_l.orientation = Quaternion::rotation_x(1.7) + * Quaternion::rotation_y(-2.7 + move1 * -1.0 + move2 * 2.0) + * Quaternion::rotation_z(1.5 + move1 * PI); + next.hand_l.position = Vec3::new(0.0, -0.5, 0.0); + next.hand_l.orientation = Quaternion::rotation_x(1.57) + }, + Some(ToolKind::Axe) => { + next.control_l.position = Vec3::new( + -2.0 + move1 * -5.0, + 18.0 + move1 * -10.0, + 6.0 + move1 * -10.0, + ); + next.control_l.orientation = Quaternion::rotation_x(1.7 + move2 * 1.5) + * Quaternion::rotation_y(-3.7) + * Quaternion::rotation_z(1.5 + move2 * 1.57); + next.hand_l.position = Vec3::new(0.0, -0.5, 0.0); + next.hand_l.orientation = Quaternion::rotation_x(1.57) + }, + + _ => {}, + }, + (_, _) => {}, + }; + match hands { + (None | Some(Hands::One), Some(Hands::One)) => { + match ability_info.and_then(|a| a.tool) { + Some(ToolKind::Sword) | Some(ToolKind::SwordSimple) => { + next.control_r.position = + Vec3::new(15.0 + move2 * -15.0, 8.0 + move2 * 5.0, 2.0); + next.control_r.orientation = Quaternion::rotation_x(1.7) + * Quaternion::rotation_y(-3.3 + move1 * -1.0 + move2 * 2.0) + * Quaternion::rotation_z(1.5 + move1 * PI); + next.hand_r.position = Vec3::new(0.0, -0.5, 0.0); + next.hand_r.orientation = Quaternion::rotation_x(1.57) + }, + Some(ToolKind::Axe) => { + next.control_r.position = Vec3::new( + 12.0 + move1 * -10.0, + 18.0 + move1 * -10.0, + 4.0 + move1 * -2.0, + ); + next.control_r.orientation = Quaternion::rotation_x(1.7 + move2 * 1.5) + * Quaternion::rotation_y(-3.3) + * Quaternion::rotation_z(1.5 + move2 * 1.57); + next.hand_r.position = Vec3::new(0.0, -0.5, 0.0); + next.hand_r.orientation = Quaternion::rotation_x(1.57) + }, + + _ => {}, + } + }, + (_, _) => {}, + }; + + match hands { + (None, None) | (None, Some(Hands::One)) => { + next.hand_l.position = Vec3::new(-4.5, 8.0, 5.0); + next.hand_l.orientation = Quaternion::rotation_x(1.9) * Quaternion::rotation_y(-0.5) + }, + (_, _) => {}, + }; + match hands { + (None, None) | (Some(Hands::One), None) => { + next.hand_r.position = Vec3::new(4.5, 8.0, 5.0); + next.hand_r.orientation = Quaternion::rotation_x(1.9) * Quaternion::rotation_y(0.5) + }, + (_, _) => {}, + }; next } } diff --git a/voxygen/anim/src/character/spinmelee.rs b/voxygen/anim/src/character/spinmelee.rs index edbafc1432..e166079e6d 100644 --- a/voxygen/anim/src/character/spinmelee.rs +++ b/voxygen/anim/src/character/spinmelee.rs @@ -30,7 +30,7 @@ impl Animation for SpinMeleeAnimation { fn update_skeleton_inner( skeleton: &Self::Skeleton, ( - active_tool_kind, + _active_tool_kind, _second_tool_kind, hands, _velocity, @@ -157,13 +157,15 @@ impl Animation for SpinMeleeAnimation { match ability_info.and_then(|a| a.tool) { Some(ToolKind::Sword) => { next.control_l.position = Vec3::new(-7.0, 8.0, 2.0); - next.control_l.orientation = Quaternion::rotation_x(-0.3 + move1 * -1.2); + next.control_l.orientation = Quaternion::rotation_x(-0.3 + move1 * -0.5) + * Quaternion::rotation_z(move1 * 1.57); next.hand_l.position = Vec3::new(0.0, -0.5, 0.0); next.hand_l.orientation = Quaternion::rotation_x(1.57) }, Some(ToolKind::Axe) => { next.control_l.position = Vec3::new(-7.0, 8.0, 2.0); - next.control_l.orientation = Quaternion::rotation_x(-0.3 + move1 * -1.2); + next.control_l.orientation = Quaternion::rotation_x(-0.3 + move1 * -1.3) + * Quaternion::rotation_z(move1 * -1.57); next.hand_l.position = Vec3::new(0.0, -0.5, 0.0); next.hand_l.orientation = Quaternion::rotation_x(1.57) }, @@ -177,14 +179,17 @@ impl Animation for SpinMeleeAnimation { (Some(Hands::One), Some(Hands::One)) | (None, Some(Hands::One)) => { match ability_info.and_then(|a| a.tool) { Some(ToolKind::Sword) => { - next.control_r.position = Vec3::new(7.0, 8.0, 2.0); - next.control_r.orientation = Quaternion::rotation_x(-0.3 + move1 * -1.2); + next.control_r.position = Vec3::new(7.0, 8.0, 2.0 + move1 * 10.0); + next.control_r.orientation = Quaternion::rotation_x(-0.3 + move1 * -1.2) + * Quaternion::rotation_y(move1 * 0.8) + * Quaternion::rotation_z(move1 * 1.57); next.hand_r.position = Vec3::new(0.0, -0.5, 0.0); next.hand_r.orientation = Quaternion::rotation_x(1.57) }, Some(ToolKind::Axe) => { next.control_r.position = Vec3::new(7.0, 8.0, 2.0); - next.control_r.orientation = Quaternion::rotation_x(-0.3 + move1 * -1.2); + next.control_r.orientation = Quaternion::rotation_x(-0.3 + move1 * -1.6) + * Quaternion::rotation_z(move1 * -1.57); next.hand_r.position = Vec3::new(0.0, -0.5, 0.0); next.hand_r.orientation = Quaternion::rotation_x(1.57) }, diff --git a/voxygen/anim/src/character/stand.rs b/voxygen/anim/src/character/stand.rs index 6dc8cf2dcc..44d45a8a78 100644 --- a/voxygen/anim/src/character/stand.rs +++ b/voxygen/anim/src/character/stand.rs @@ -117,29 +117,25 @@ impl Animation for StandAnimation { }; match hands { - (Some(Hands::One), Some(Hands::One)) | (Some(Hands::One), None) => { - match active_tool_kind { - Some(ToolKind::Axe) | Some(ToolKind::Hammer) | Some(ToolKind::Sword) => { - next.main.position = Vec3::new(-4.0, -5.0, 10.0); - next.main.orientation = - Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57); - }, + (Some(Hands::One), _) => match active_tool_kind { + Some(ToolKind::Axe) | Some(ToolKind::Hammer) | Some(ToolKind::Sword) => { + next.main.position = Vec3::new(-4.0, -5.0, 10.0); + next.main.orientation = + Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57); + }, - _ => {}, - } + _ => {}, }, (_, _) => {}, }; match hands { - (Some(Hands::One), Some(Hands::One)) | (None, Some(Hands::One)) => { - match second_tool_kind { - Some(ToolKind::Axe) | Some(ToolKind::Hammer) | Some(ToolKind::Sword) => { - next.second.position = Vec3::new(4.0, -5.5, 10.0); - next.second.orientation = - Quaternion::rotation_y(-2.5) * Quaternion::rotation_z(1.57); - }, - _ => {}, - } + (None | Some(Hands::One), Some(Hands::One)) => match second_tool_kind { + Some(ToolKind::Axe) | Some(ToolKind::Hammer) | Some(ToolKind::Sword) => { + next.second.position = Vec3::new(4.0, -5.5, 10.0); + next.second.orientation = + Quaternion::rotation_y(-2.5) * Quaternion::rotation_z(1.57); + }, + _ => {}, }, (_, _) => {}, }; @@ -149,12 +145,10 @@ impl Animation for StandAnimation { next.torso.position = Vec3::new(0.0, 0.0, 0.0) * s_a.scaler; next.second.scale = Vec3::one(); - next.second.scale = match hands { - (None, Some(Hands::One)) | (Some(Hands::One), Some(Hands::One)) => Vec3::one(), + (Some(Hands::One) | None, Some(Hands::One)) => Vec3::one(), (_, _) => Vec3::zero(), }; - next } } diff --git a/voxygen/anim/src/character/wield.rs b/voxygen/anim/src/character/wield.rs index d1db54739c..028a20c560 100644 --- a/voxygen/anim/src/character/wield.rs +++ b/voxygen/anim/src/character/wield.rs @@ -48,7 +48,7 @@ impl Animation for WieldAnimation { *rate = 1.0; let lab: f32 = 1.0; let speed = Vec2::::from(velocity).magnitude(); - + let speednorm = speed / 9.5; let mut next = (*skeleton).clone(); let head_look = Vec2::new( (global_time + anim_time / 3.0).floor().mul(7331.0).sin() * 0.2, @@ -102,7 +102,7 @@ impl Animation for WieldAnimation { next.second.position = Vec3::new(0.0, 0.0, 0.0); next.second.orientation = Quaternion::rotation_z(0.0); if speed > 0.2 && velocity.z == 0.0 { - next.chest.orientation = Quaternion::rotation_z(short * 0.1 + strafe * 0.7) + next.chest.orientation = Quaternion::rotation_z(short * 0.1 + strafe * 0.7 * speednorm) * Quaternion::rotation_y(strafe * 0.2) * Quaternion::rotation_x(((direction * 0.8).min(0.3)) * (1.0 - tilt.abs())); next.head.orientation = @@ -345,7 +345,7 @@ impl Animation for WieldAnimation { (_, _) => {}, }; match hands { - (Some(Hands::One), Some(Hands::One)) | (Some(Hands::One), None) => { + (Some(Hands::One), _) => { next.control_l.position = Vec3::new(-7.0, 8.0, 2.0); next.control_l.orientation = Quaternion::rotation_x(-0.3); next.hand_l.position = Vec3::new(0.0, -0.5, 0.0); @@ -354,7 +354,7 @@ impl Animation for WieldAnimation { (_, _) => {}, }; match hands { - (Some(Hands::One), Some(Hands::One)) | (None, Some(Hands::One)) => { + (None | Some(Hands::One), Some(Hands::One)) => { next.control_r.position = Vec3::new(7.0, 8.0, 2.0); next.control_r.orientation = Quaternion::rotation_x(-0.3); next.hand_r.position = Vec3::new(0.0, -0.5, 0.0); diff --git a/voxygen/src/scene/figure/mod.rs b/voxygen/src/scene/figure/mod.rs index 3ddc0416b0..d794f37f49 100644 --- a/voxygen/src/scene/figure/mod.rs +++ b/voxygen/src/scene/figure/mod.rs @@ -1161,29 +1161,21 @@ impl FigureMgr { ) }, CharacterState::LeapMelee(s) => { - let stage_progress = match active_tool_kind { - Some(ToolKind::Axe | ToolKind::Hammer) => { - let stage_time = s.timer.as_secs_f32(); - match s.stage_section { - StageSection::Buildup => { - stage_time - / s.static_data.buildup_duration.as_secs_f32() - }, - StageSection::Movement => { - stage_time - / s.static_data.movement_duration.as_secs_f32() - }, - StageSection::Swing => { - stage_time / s.static_data.swing_duration.as_secs_f32() - }, - StageSection::Recover => { - stage_time - / s.static_data.recover_duration.as_secs_f32() - }, - _ => 0.0, - } + let stage_time = s.timer.as_secs_f32(); + let stage_progress = match s.stage_section { + StageSection::Buildup => { + stage_time / s.static_data.buildup_duration.as_secs_f32() }, - _ => state.state_time, + StageSection::Movement => { + stage_time / s.static_data.movement_duration.as_secs_f32() + }, + StageSection::Swing => { + stage_time / s.static_data.swing_duration.as_secs_f32() + }, + StageSection::Recover => { + stage_time / s.static_data.recover_duration.as_secs_f32() + }, + _ => 0.0, }; anim::character::LeapAnimation::update_skeleton( @@ -1203,25 +1195,18 @@ impl FigureMgr { ) }, CharacterState::SpinMelee(s) => { - let stage_progress = match active_tool_kind { - Some(ToolKind::Axe | ToolKind::Sword) => { - let stage_time = s.timer.as_secs_f32(); - match s.stage_section { - StageSection::Buildup => { - stage_time - / s.static_data.buildup_duration.as_secs_f32() - }, - StageSection::Swing => { - stage_time / s.static_data.swing_duration.as_secs_f32() - }, - StageSection::Recover => { - stage_time - / s.static_data.recover_duration.as_secs_f32() - }, - _ => 0.0, - } + let stage_time = s.timer.as_secs_f32(); + let stage_progress = match s.stage_section { + StageSection::Buildup => { + stage_time / s.static_data.buildup_duration.as_secs_f32() }, - _ => state.state_time, + StageSection::Swing => { + stage_time / s.static_data.swing_duration.as_secs_f32() + }, + StageSection::Recover => { + stage_time / s.static_data.recover_duration.as_secs_f32() + }, + _ => 0.0, }; anim::character::SpinMeleeAnimation::update_skeleton(