From ca43a0058a2a46c72bd0b9fc7a86b5fa1a4b1fb6 Mon Sep 17 00:00:00 2001 From: jshipsey Date: Sun, 30 May 2021 12:47:50 -0400 Subject: [PATCH] some animation --- .../items/npc_weapons/unique/tidal_claws.ron | 2 +- voxygen/anim/src/biped_large/alpha.rs | 99 ++++++++++----- voxygen/anim/src/biped_large/beam.rs | 110 ++++++++++++---- voxygen/anim/src/biped_large/dash.rs | 46 ++++++- voxygen/anim/src/biped_large/run.rs | 19 +-- voxygen/anim/src/biped_large/stunned.rs | 17 ++- voxygen/anim/src/biped_large/summon.rs | 120 +++++++++++++++--- voxygen/anim/src/biped_large/wield.rs | 14 +- voxygen/src/scene/figure/mod.rs | 11 +- 9 files changed, 329 insertions(+), 109 deletions(-) diff --git a/assets/common/items/npc_weapons/unique/tidal_claws.ron b/assets/common/items/npc_weapons/unique/tidal_claws.ron index f2f42d6bcc..0d2f505bd8 100644 --- a/assets/common/items/npc_weapons/unique/tidal_claws.ron +++ b/assets/common/items/npc_weapons/unique/tidal_claws.ron @@ -5,7 +5,7 @@ ItemDef( kind: Natural, hands: Two, stats: Direct(( - equip_time_secs: 0.5, + equip_time_secs: 0.0, power: 1.0, poise_strength: 1.0, speed: 1.0, diff --git a/voxygen/anim/src/biped_large/alpha.rs b/voxygen/anim/src/biped_large/alpha.rs index c5ac772d68..f09e75ea2a 100644 --- a/voxygen/anim/src/biped_large/alpha.rs +++ b/voxygen/anim/src/biped_large/alpha.rs @@ -19,6 +19,7 @@ impl Animation for AlphaAnimation { f32, Option, f32, + f32, ); type Skeleton = BipedLargeSkeleton; @@ -33,9 +34,10 @@ impl Animation for AlphaAnimation { (active_tool_kind, active_tool_spec), _second_tool, velocity, - _global_time, + global_time, stage_section, acc_vel, + timer, ): Self::Dependency<'a>, anim_time: f32, rate: &mut f32, @@ -63,6 +65,9 @@ impl Animation for AlphaAnimation { let pullback = 1.0 - move3; let move1 = move1base * pullback; let move2 = move2base * pullback; + let subtract = global_time - timer; + let check = subtract - subtract.trunc(); + let mirror = (check - 0.5).signum(); next.second.position = Vec3::new(0.0, 0.0, 0.0); next.second.orientation = Quaternion::rotation_x(0.0); next.shoulder_l.position = Vec3::new( @@ -196,40 +201,70 @@ impl Animation for AlphaAnimation { * Quaternion::rotation_z(move1 * -0.5 + move2 * 0.6); next.head.orientation = Quaternion::rotation_x(move1 * 0.3); }, - "Tidal Claws" => { - next.torso.position = Vec3::new(0.0, 0.0, move1 * -0.3); - next.upper_torso.orientation = - Quaternion::rotation_x(move1 * -0.5 + move2 * -0.4); - next.lower_torso.orientation = - Quaternion::rotation_x(move1 * 0.5 + move2 * 0.4); + "Tidal Warrior" => { + if mirror > 0.0 { + next.head.orientation = Quaternion::rotation_z(move1 * 0.75); + next.upper_torso.orientation = + Quaternion::rotation_x(move1 * 0.2 + move2 * 0.7) + * Quaternion::rotation_z(move1 * -1.0 + move2 * 1.3); + next.lower_torso.orientation = + Quaternion::rotation_x(move1 * 0.2 + move2 * -0.7) + * Quaternion::rotation_y(move1 * -0.5 + move2 * 0.7) + * Quaternion::rotation_z(move1 * 1.0 + move2 * -1.2); - next.shoulder_l.orientation = Quaternion::rotation_x( - move1 * 0.4 + 0.4 * speednorm + (footrotl * -0.2) * speednorm, - ); - next.shoulder_r.orientation = Quaternion::rotation_x( - move1 * 0.4 + 0.4 * speednorm + (footrotl * -0.2) * speednorm, - ); + next.shoulder_l.orientation = + Quaternion::rotation_x(move1 * 0.3 + move2 * 0.8) + * Quaternion::rotation_y(move1 * -0.3 + move2 * -0.5); + next.hand_l.position = Vec3::new( + -14.0 + move1 * -2.0 + move2 * 4.0, + 2.0 + move2 * 4.0, + -4.0 + move2 * 3.0, + ); - next.control_l.position = Vec3::new( - -14.0 + move2 * 9.0, - 12.0 + move1 * 6.0, - -12.0 + move1 * 9.0, - ); - next.control_r.position = Vec3::new( - 14.0 + move2 * -9.0, - 12.0 + move1 * 6.0, - -12.0 + move1 * 9.0, - ); + next.hand_l.orientation = + Quaternion::rotation_x(PI / 3.0 + move2 * 1.5) + * Quaternion::rotation_y(move2 * 0.5) + * Quaternion::rotation_z( + -0.35 + move1 * -0.5 + move2 * 1.0, + ); + next.hand_r.position = Vec3::new(14.0, 2.0, -4.0); - next.control_l.orientation = - Quaternion::rotation_x(PI / 3.0 + move1 * 0.5) - * Quaternion::rotation_y(-0.15) - * Quaternion::rotation_z(move1 * 0.5 + move2 * -0.6); - next.control_r.orientation = - Quaternion::rotation_x(PI / 3.0 + move1 * 0.5) - * Quaternion::rotation_y(0.15) - * Quaternion::rotation_z(move1 * -0.5 + move2 * 0.6); - next.head.orientation = Quaternion::rotation_x(move1 * 0.3); + next.hand_r.orientation = + Quaternion::rotation_x(PI / 3.0) * Quaternion::rotation_z(0.35); + + next.shoulder_r.orientation = Quaternion::rotation_x(0.0); + next.torso.position = Vec3::new(0.0, move2 * -2.2, move2 * -1.0); + } else { + next.head.orientation = Quaternion::rotation_z(move1 * -0.75); + next.upper_torso.orientation = + Quaternion::rotation_x(move1 * 0.2 + move2 * 0.7) + * Quaternion::rotation_z(move1 * 1.0 + move2 * -1.3); + next.lower_torso.orientation = + Quaternion::rotation_x(move1 * 0.2 + move2 * -0.7) + * Quaternion::rotation_y(move1 * 0.5 + move2 * -0.7) + * Quaternion::rotation_z(move1 * -1.0 + move2 * 1.2); + + next.shoulder_r.orientation = + Quaternion::rotation_x(move1 * 0.3 + move2 * 0.8) + * Quaternion::rotation_y(move1 * 0.3 + move2 * 0.5); + next.hand_r.position = Vec3::new( + 14.0 + move1 * 2.0 + move2 * -4.0, + 2.0 + move2 * 4.0, + -4.0 + move2 * 3.0, + ); + + next.hand_r.orientation = + Quaternion::rotation_x(PI / 3.0 + move2 * 1.5) + * Quaternion::rotation_y(move2 * -0.5) + * Quaternion::rotation_z(0.35 + move1 * 0.5 + move2 * -1.0); + next.hand_l.position = Vec3::new(-14.0, 2.0, -4.0); + + next.hand_l.orientation = Quaternion::rotation_x(PI / 3.0) + * Quaternion::rotation_z(-0.35); + + next.shoulder_l.orientation = Quaternion::rotation_x(0.0); + next.torso.position = Vec3::new(0.0, move2 * -2.2, move2 * -1.0); + }; }, "Minotaur" => { next.control_l.position = Vec3::new(0.0, 4.0, 5.0); diff --git a/voxygen/anim/src/biped_large/beam.rs b/voxygen/anim/src/biped_large/beam.rs index 75633a0454..0d5c92a31a 100644 --- a/voxygen/anim/src/biped_large/beam.rs +++ b/voxygen/anim/src/biped_large/beam.rs @@ -2,19 +2,23 @@ use super::{ super::{vek::*, Animation}, BipedLargeSkeleton, SkeletonAttr, }; -use common::{comp::item::ToolKind, states::utils::StageSection}; +use common::{ + comp::item::{AbilitySpec, ToolKind}, + states::utils::StageSection, +}; use std::f32::consts::PI; pub struct BeamAnimation; impl Animation for BeamAnimation { type Dependency<'a> = ( - Option, - Option, + (Option, Option<&'a AbilitySpec>), + (Option, Option<&'a AbilitySpec>), f32, Vec3, Option, f32, + f32, ); type Skeleton = BipedLargeSkeleton; @@ -25,7 +29,15 @@ impl Animation for BeamAnimation { #[allow(clippy::single_match)] // TODO: Pending review in #587 fn update_skeleton_inner<'a>( skeleton: &Self::Skeleton, - (active_tool_kind, _second_tool_kind, _global_time, velocity, stage_section, acc_vel): Self::Dependency<'a>, + ( + (active_tool_kind, active_tool_spec), + _second_tool_kind, + global_time, + velocity, + stage_section, + acc_vel, + timer, + ): Self::Dependency<'a>, anim_time: f32, rate: &mut f32, s_a: &SkeletonAttr, @@ -46,7 +58,9 @@ impl Animation for BeamAnimation { let footrotr = ((1.0 / (0.5 + (0.5) * ((acc_vel * lab + PI * 0.4).sin()).powi(2))).sqrt()) * ((acc_vel * lab + PI * 0.4).sin()) * speednorm; - + let subtract = global_time - timer; + let check = subtract - subtract.trunc(); + let mirror = (check - 0.5).signum(); next.jaw.position = Vec3::new(0.0, s_a.jaw.0, s_a.jaw.1); next.jaw.orientation = Quaternion::rotation_x(0.0); @@ -58,26 +72,26 @@ impl Animation for BeamAnimation { next.hand_l.orientation = Quaternion::rotation_x(0.0); next.hand_r.orientation = Quaternion::rotation_x(0.0); + let (move1base, move2shake, _move2base, move3) = match stage_section { + Some(StageSection::Buildup) => ( + (anim_time.powf(0.25)).min(1.0), + (anim_time * 15.0 + PI).sin(), + (anim_time * 10.0 + PI).sin(), + 0.0, + ), + Some(StageSection::Cast) => ( + 1.0, + (anim_time * 15.0 + PI).sin(), + anim_time.powf(0.25), + 0.0, + ), + Some(StageSection::Recover) => (1.0, 1.0, 1.0, anim_time), + _ => (0.0, 0.0, 0.0, 0.0), + }; + let pullback = 1.0 - move3; + let move1 = move1base * pullback; match active_tool_kind { Some(ToolKind::Sceptre) | Some(ToolKind::Staff) => { - let (move1base, move2shake, _move2base, move3) = match stage_section { - Some(StageSection::Buildup) => ( - (anim_time.powf(0.25)).min(1.0), - (anim_time * 15.0 + PI).sin(), - (anim_time * 10.0 + PI).sin(), - 0.0, - ), - Some(StageSection::Cast) => ( - 1.0, - (anim_time * 15.0 + PI).sin(), - anim_time.powf(0.25), - 0.0, - ), - Some(StageSection::Recover) => (1.0, 1.0, 1.0, anim_time), - _ => (0.0, 0.0, 0.0, 0.0), - }; - let pullback = 1.0 - move3; - let move1 = move1base * pullback; next.control_l.position = Vec3::new(-1.0, 3.0, 12.0); next.control_r.position = Vec3::new(1.0 + move1 * 5.0, 2.0 + move1 * 1.0, 2.0 + move1 * 14.0); @@ -116,6 +130,56 @@ impl Animation for BeamAnimation { next.torso.orientation = Quaternion::rotation_x(move1 * -0.1); next.torso.position = Vec3::new(0.0, 0.0, move1 * 1.0); }, + Some(ToolKind::Natural) => { + if let Some(AbilitySpec::Custom(spec)) = active_tool_spec { + match spec.as_str() { + "Tidal Warrior" => { + if mirror > 0.0 { + next.head.orientation = Quaternion::rotation_z(move1 * -0.6); + next.upper_torso.orientation = Quaternion::rotation_z(move1 * 0.6); + next.lower_torso.orientation = Quaternion::rotation_z(move1 * -0.6); + + next.shoulder_l.orientation = Quaternion::rotation_z(move1 * 0.3); + next.hand_l.position = Vec3::new(-14.0 + move1 * 3.0, 2.0, -4.0); + + next.hand_l.orientation = + Quaternion::rotation_x(PI / 3.0 + move2shake * -0.07) + * Quaternion::rotation_y(move1 * -0.5) + * Quaternion::rotation_z(-0.35 + move2shake * 0.07); + next.hand_r.position = Vec3::new(14.0 + move1 - 3.0, 2.0, -4.0); + + next.hand_r.orientation = + Quaternion::rotation_x(PI / 3.0 + move2shake * 0.07) + * Quaternion::rotation_y(move1 * -0.5) + * Quaternion::rotation_z(0.35 - move2shake * 0.07); + + next.shoulder_r.orientation = Quaternion::rotation_z(move1 * -0.3); + } else { + next.head.orientation = Quaternion::rotation_z(move1 * 0.6); + next.upper_torso.orientation = Quaternion::rotation_z(move1 * -0.6); + next.lower_torso.orientation = Quaternion::rotation_z(move1 * 0.6); + + next.shoulder_l.orientation = Quaternion::rotation_z(move1 * -0.3); + next.hand_l.position = Vec3::new(-14.0 + move1 * 3.0, 2.0, -4.0); + + next.hand_l.orientation = + Quaternion::rotation_x(PI / 3.0 + move2shake * 0.07) + * Quaternion::rotation_y(move1 * 0.5) + * Quaternion::rotation_z(-0.35 + move2shake * 0.07); + next.hand_r.position = Vec3::new(14.0 + move1 - 3.0, 2.0, -4.0); + + next.hand_r.orientation = + Quaternion::rotation_x(PI / 3.0 + move2shake * -0.07) + * Quaternion::rotation_y(move1 * 0.5) + * Quaternion::rotation_z(0.35 - move2shake * -0.07); + + next.shoulder_r.orientation = Quaternion::rotation_z(move1 * 0.3); + }; + }, + _ => {}, + } + } + }, _ => {}, } diff --git a/voxygen/anim/src/biped_large/dash.rs b/voxygen/anim/src/biped_large/dash.rs index f969de6df9..a949fcca92 100644 --- a/voxygen/anim/src/biped_large/dash.rs +++ b/voxygen/anim/src/biped_large/dash.rs @@ -46,7 +46,7 @@ impl Animation for DashAnimation { let lab: f32 = 0.65 * s_a.tempo; let speed = Vec2::::from(velocity).magnitude(); - let speednorm = (speed / 12.0).powf(0.4); + let speednorm = (speed.min(16.0) / 12.0).powf(0.4); let foothoril = (acc_vel * lab + PI * 1.45).sin() * speednorm; let foothorir = (acc_vel * lab + PI * (0.45)).sin() * speednorm; let footrotl = ((1.0 / (0.5 + (0.5) * ((acc_vel * lab + PI * 1.4).sin()).powi(2))).sqrt()) @@ -64,12 +64,18 @@ impl Animation for DashAnimation { next.second.orientation = Quaternion::rotation_x(0.0); next.hand_l.orientation = Quaternion::rotation_x(0.0); next.hand_r.orientation = Quaternion::rotation_x(0.0); - let (move1base, move2base, move3base, move4) = match stage_section { - Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0, 0.0), - Some(StageSection::Charge) => (1.0, (anim_time.powf(4.0)).min(1.0), 0.0, 0.0), - Some(StageSection::Swing) => (1.0, 1.0, anim_time.powf(4.0), 0.0), - Some(StageSection::Recover) => (1.1, 1.0, 1.0, anim_time.powf(4.0)), - _ => (0.0, 0.0, 0.0, 0.0), + let (move1base, motion, move2base, move3base, move4) = match stage_section { + Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0, 0.0, 0.0), + Some(StageSection::Charge) => ( + 1.0, + (acc_vel * lab).sin(), + (anim_time.powf(4.0)).min(1.0), + 0.0, + 0.0, + ), + Some(StageSection::Swing) => (1.0, 1.0, 1.0, anim_time.powf(4.0), 0.0), + Some(StageSection::Recover) => (1.1, 1.0, 1.0, 1.0, anim_time.powf(4.0)), + _ => (0.0, 0.0, 0.0, 0.0, 0.0), }; let pullback = 1.0 - move4; let move1 = move1base * pullback; @@ -189,6 +195,32 @@ impl Animation for DashAnimation { next.shoulder_r.orientation = Quaternion::rotation_x(-0.3); }, + "Tidal Warrior" => { + next.head.orientation = + Quaternion::rotation_x(0.0) * Quaternion::rotation_z(move1 * -0.3); + next.upper_torso.orientation = Quaternion::rotation_x(move1 * -0.1) + * Quaternion::rotation_z(move1 * 1.57); + next.lower_torso.orientation = Quaternion::rotation_x(move1 * 0.1) + * Quaternion::rotation_x(move1 * -0.1) + * Quaternion::rotation_z(move1 * -0.2); + + next.hand_l.position = Vec3::new(-14.0, 2.0 + motion * 1.5, -4.0); + + next.hand_l.orientation = + Quaternion::rotation_x(PI / 3.0 + move1 * 1.0) + * Quaternion::rotation_y(0.0) + * Quaternion::rotation_z(-0.35 + motion * -0.6); + next.hand_r.position = Vec3::new(14.0, 2.0 + motion * -1.5, -4.0); + + next.hand_r.orientation = + Quaternion::rotation_x(PI / 3.0 + move1 * 1.0) + * Quaternion::rotation_y(0.0) + * Quaternion::rotation_z(0.35 + motion * 0.6); + + next.shoulder_l.orientation = Quaternion::rotation_x(move1 * 0.8); + + next.shoulder_r.orientation = Quaternion::rotation_x(move1 * 0.8); + }, _ => {}, } } diff --git a/voxygen/anim/src/biped_large/run.rs b/voxygen/anim/src/biped_large/run.rs index b39791fd20..6bbd437d13 100644 --- a/voxygen/anim/src/biped_large/run.rs +++ b/voxygen/anim/src/biped_large/run.rs @@ -48,8 +48,8 @@ impl Animation for RunAnimation { *rate = 1.0; let lab: f32 = 0.65 * s_a.tempo; - let speednorm = (speed / 12.0).powf(0.6); - let speednormlow = (speed / 12.0).powf(4.0); + let speednorm = (speed.min(16.0) / 12.0).powf(0.6); + let speednormlow = (speed.min(16.0) / 12.0).powf(4.0); let footvertl = (acc_vel * lab + PI * -0.2).sin() * speednorm; let footvertr = (acc_vel * lab + PI * -1.2).sin() * speednorm; @@ -119,16 +119,17 @@ impl Animation for RunAnimation { let foothoril = (acc_vel * lab + PI * 1.45).sin() * speednorm; let foothorir = (acc_vel * lab + PI * (0.45)).sin() * speednorm; - let footstrafel = (acc_vel * lab + PI * 1.45).sin(); - let footstrafer = (acc_vel * lab + PI * (0.95)).sin(); - let footvertsl = (acc_vel * lab).sin(); - let footvertsr = (acc_vel * lab + PI * 0.5).sin(); + let footstrafel = (acc_vel * lab + PI * 1.45).sin() * speednorm; + let footstrafer = (acc_vel * lab + PI * (0.95)).sin() * speednorm; + let footvertsl = (acc_vel * lab).sin() * speednorm; + let footvertsr = (acc_vel * lab + PI * 0.5).sin() * speednorm; let direction = velocity.y * -0.098 * orientation.y + velocity.x * -0.098 * orientation.x; - let side = - (velocity.x * -0.098 * orientation.y + velocity.y * 0.098 * orientation.x) * -1.0; + let side = ((velocity.x * -0.098 * orientation.y + velocity.y * 0.098 * orientation.x) + * -1.0) + .min(1.0) + .max(-1.0); let sideabs = side.abs(); - let x_tilt = avg_vel.z.atan2(avg_vel.xy().magnitude()); next.jaw.scale = Vec3::one() * 1.02; diff --git a/voxygen/anim/src/biped_large/stunned.rs b/voxygen/anim/src/biped_large/stunned.rs index f8f0ff1e53..dfa3d0861f 100644 --- a/voxygen/anim/src/biped_large/stunned.rs +++ b/voxygen/anim/src/biped_large/stunned.rs @@ -212,14 +212,17 @@ impl Animation for StunnedAnimation { next.control_r.orientation = Quaternion::rotation_x(PI / 3.0) * Quaternion::rotation_y(0.15); }, - "Tidal Claws" => { - next.control_l.position = Vec3::new(-14.0, 12.0, -12.0); - next.control_r.position = Vec3::new(14.0, 12.0, -12.0); + "Tidal Warrior" => { + next.head.orientation = Quaternion::rotation_x(move1 * -2.0); + next.upper_torso.orientation = Quaternion::rotation_z(move1 * 1.0); + next.lower_torso.orientation = Quaternion::rotation_z(move1 * -1.0); + next.hand_l.position = Vec3::new(-14.0, 2.0, -4.0); + next.hand_r.position = Vec3::new(14.0, 2.0, -4.0); - next.control_l.orientation = Quaternion::rotation_x(PI / 3.0) - * Quaternion::rotation_y(-0.15); - next.control_r.orientation = - Quaternion::rotation_x(PI / 3.0) * Quaternion::rotation_y(0.15); + next.hand_l.orientation = Quaternion::rotation_x(PI / 3.0) + * Quaternion::rotation_z(-0.35); + next.hand_r.orientation = + Quaternion::rotation_x(PI / 3.0) * Quaternion::rotation_z(0.35); }, "Beast Claws" => { next.shoulder_l.position = diff --git a/voxygen/anim/src/biped_large/summon.rs b/voxygen/anim/src/biped_large/summon.rs index 9fa16305b5..6c9ad4397a 100644 --- a/voxygen/anim/src/biped_large/summon.rs +++ b/voxygen/anim/src/biped_large/summon.rs @@ -2,15 +2,18 @@ use super::{ super::{vek::*, Animation}, BipedLargeSkeleton, SkeletonAttr, }; -use common::{comp::item::ToolKind, states::utils::StageSection}; +use common::{ + comp::item::{AbilitySpec, ToolKind}, + states::utils::StageSection, +}; use std::f32::consts::PI; pub struct SummonAnimation; impl Animation for SummonAnimation { type Dependency<'a> = ( - Option, - Option, + (Option, Option<&'a AbilitySpec>), + (Option, Option<&'a AbilitySpec>), Vec3, f32, Option, @@ -25,7 +28,14 @@ impl Animation for SummonAnimation { #[allow(clippy::approx_constant)] // TODO: Pending review in #587 fn update_skeleton_inner<'a>( skeleton: &Self::Skeleton, - (active_tool_kind, _second_tool_kind, velocity, _global_time, stage_section, acc_vel): Self::Dependency<'a>, + ( + (active_tool_kind, active_tool_spec), + _second_tool_kind, + velocity, + _global_time, + stage_section, + acc_vel, + ): Self::Dependency<'a>, anim_time: f32, rate: &mut f32, s_a: &SkeletonAttr, @@ -55,21 +65,6 @@ impl Animation for SummonAnimation { let move1 = move1base * pullback; let move2 = move2base * pullback; - next.shoulder_l.position = Vec3::new( - -s_a.shoulder.0, - s_a.shoulder.1, - s_a.shoulder.2 - foothorir * 1.0, - ); - next.shoulder_l.orientation = - Quaternion::rotation_x(move1 * 0.8 + 0.6 * speednorm + (footrotr * -0.2) * speednorm); - - next.shoulder_r.position = Vec3::new( - s_a.shoulder.0, - s_a.shoulder.1, - s_a.shoulder.2 - foothoril * 1.0, - ); - next.shoulder_r.orientation = - Quaternion::rotation_x(move1 * 0.8 + 0.6 * speednorm + (footrotl * -0.2) * speednorm); next.torso.orientation = Quaternion::rotation_z(0.0); next.main.position = Vec3::new(0.0, 0.0, 0.0); @@ -84,6 +79,23 @@ impl Animation for SummonAnimation { #[allow(clippy::single_match)] match active_tool_kind { Some(ToolKind::Staff) => { + next.shoulder_l.position = Vec3::new( + -s_a.shoulder.0, + s_a.shoulder.1, + s_a.shoulder.2 - foothorir * 1.0, + ); + next.shoulder_l.orientation = Quaternion::rotation_x( + move1 * 0.8 + 0.6 * speednorm + (footrotr * -0.2) * speednorm, + ); + + next.shoulder_r.position = Vec3::new( + s_a.shoulder.0, + s_a.shoulder.1, + s_a.shoulder.2 - foothoril * 1.0, + ); + next.shoulder_r.orientation = Quaternion::rotation_x( + move1 * 0.8 + 0.6 * speednorm + (footrotl * -0.2) * speednorm, + ); next.head.orientation = Quaternion::rotation_x(0.0); next.control_l.position = Vec3::new(-1.0, 3.0, 12.0); next.control_r.position = Vec3::new( @@ -108,7 +120,77 @@ impl Animation for SummonAnimation { next.control.orientation = Quaternion::rotation_x(-0.2 + move1 * 1.0) * Quaternion::rotation_y(-0.1 + move2 * -0.8); }, + Some(ToolKind::Natural) => { + if let Some(AbilitySpec::Custom(spec)) = active_tool_spec { + match spec.as_str() { + "Tidal Warrior" => { + let (move1base, move2base, move3) = match stage_section { + Some(StageSection::Buildup) => ((anim_time.powi(2)), 0.0, 0.0), + Some(StageSection::Cast) => (1.0, (anim_time * 30.0).sin(), 0.0), + Some(StageSection::Recover) => (1.0, 1.0, anim_time), + _ => (0.0, 0.0, 0.0), + }; + let pullback = 1.0 - move3; + let move1 = move1base * pullback; + let move2 = move2base * pullback; + next.torso.position = Vec3::new(0.0, 0.0 + move1 * 1.0, move1 * -4.0); + next.upper_torso.position = + Vec3::new(0.0, s_a.upper_torso.0, s_a.upper_torso.1); + next.lower_torso.position = + Vec3::new(0.0, s_a.lower_torso.0, s_a.lower_torso.1); + + next.head.position = + Vec3::new(0.0, s_a.head.0 + move1 * -8.0, s_a.head.1 + move1 * 6.0); + next.shoulder_l.orientation = Quaternion::rotation_x(move1 * 2.5) + * Quaternion::rotation_y(move1 * 0.4 + move2 * 0.05); + next.shoulder_r.orientation = Quaternion::rotation_x(move1 * 2.5) + * Quaternion::rotation_y(move1 * -0.4 + move2 * -0.05); + next.head.orientation = Quaternion::rotation_x(move1 * 1.4) + * Quaternion::rotation_y(move2 * 0.02); + next.upper_torso.orientation = Quaternion::rotation_x(move1 * -1.5) + * Quaternion::rotation_y(move2 * -0.02); + next.lower_torso.orientation = Quaternion::rotation_x(move1 * 0.2) + * Quaternion::rotation_y(move2 * 0.02); + next.hand_l.position = Vec3::new( + -14.0 + move1 * -5.0, + 2.0 + move1 * -2.0, + -4.0 + move1 * 12.0, + ); + next.hand_r.position = Vec3::new( + 14.0 + move1 * 5.0, + 2.0 + move1 * -2.0, + -4.0 + move1 * 12.0, + ); + + next.hand_l.orientation = + Quaternion::rotation_x(PI / 3.0 + move1 * 1.5) + * Quaternion::rotation_y(-move1 * 0.7 + move2 * 0.2) + * Quaternion::rotation_z(-0.35); + next.hand_r.orientation = + Quaternion::rotation_x(PI / 3.0 + move1 * 1.5) + * Quaternion::rotation_y(move1 * 0.7 + move2 * 0.2) + * Quaternion::rotation_z(0.35); + next.leg_l.position = Vec3::new(-s_a.leg.0, s_a.leg.1, s_a.leg.2); + next.leg_l.orientation = + Quaternion::rotation_z(0.0) * Quaternion::rotation_x(move1 * -0.8); + + next.leg_r.position = Vec3::new(s_a.leg.0, s_a.leg.1, s_a.leg.2); + next.foot_l.position = + Vec3::new(-s_a.foot.0, s_a.foot.1 + move1 * -3.0, s_a.foot.2); + next.foot_r.position = + Vec3::new(s_a.foot.0, s_a.foot.1 + move1 * -3.0, s_a.foot.2); + next.leg_r.orientation = + Quaternion::rotation_z(0.0) * Quaternion::rotation_x(move1 * -0.8); + next.foot_l.orientation = + Quaternion::rotation_z(0.0) * Quaternion::rotation_x(move1 * 0.8); + next.foot_r.orientation = + Quaternion::rotation_z(0.0) * Quaternion::rotation_x(move1 * 0.8); + }, + _ => {}, + } + } + }, _ => {}, } diff --git a/voxygen/anim/src/biped_large/wield.rs b/voxygen/anim/src/biped_large/wield.rs index 6a280feb08..a619e49791 100644 --- a/voxygen/anim/src/biped_large/wield.rs +++ b/voxygen/anim/src/biped_large/wield.rs @@ -251,14 +251,14 @@ impl Animation for WieldAnimation { next.control_r.orientation = Quaternion::rotation_x(PI / 3.0) * Quaternion::rotation_y(0.15); }, - "Tidal Claws" => { - next.control_l.position = Vec3::new(-14.0, 12.0, -12.0); - next.control_r.position = Vec3::new(14.0, 12.0, -12.0); + "Tidal Warrior" => { + next.hand_l.position = Vec3::new(-14.0, 2.0, -4.0); + next.hand_r.position = Vec3::new(14.0, 2.0, -4.0); - next.control_l.orientation = Quaternion::rotation_x(PI / 3.0) - * Quaternion::rotation_y(-0.15); - next.control_r.orientation = - Quaternion::rotation_x(PI / 3.0) * Quaternion::rotation_y(0.15); + next.hand_l.orientation = Quaternion::rotation_x(PI / 3.0) + * Quaternion::rotation_z(-0.35); + next.hand_r.orientation = + Quaternion::rotation_x(PI / 3.0) * Quaternion::rotation_z(0.35); }, "Beast Claws" => { next.shoulder_l.position = diff --git a/voxygen/src/scene/figure/mod.rs b/voxygen/src/scene/figure/mod.rs index d5b55c3033..177ba476c6 100644 --- a/voxygen/src/scene/figure/mod.rs +++ b/voxygen/src/scene/figure/mod.rs @@ -3807,6 +3807,7 @@ impl FigureMgr { time, Some(s.stage_section), state.acc_vel, + state.state_time, ), stage_progress, &mut state_animation_rate, @@ -4005,6 +4006,7 @@ impl FigureMgr { time, Some(s.stage_section), state.acc_vel, + state.state_time, ), stage_progress, &mut state_animation_rate, @@ -4090,8 +4092,8 @@ impl FigureMgr { anim::biped_large::SummonAnimation::update_skeleton( &target_base, ( - active_tool_kind, - second_tool_kind, + (active_tool_kind, active_tool_spec), + (second_tool_kind, second_tool_spec), rel_vel, time, Some(s.stage_section), @@ -4185,12 +4187,13 @@ impl FigureMgr { anim::biped_large::BeamAnimation::update_skeleton( &target_base, ( - active_tool_kind, - second_tool_kind, + (active_tool_kind, active_tool_spec), + (second_tool_kind, second_tool_spec), time, rel_vel, Some(s.stage_section), state.acc_vel, + state.state_time, ), stage_progress, &mut state_animation_rate,