some animation

This commit is contained in:
jshipsey 2021-05-30 12:47:50 -04:00 committed by Sam
parent 35876411cd
commit ca43a0058a
9 changed files with 329 additions and 109 deletions

View File

@ -5,7 +5,7 @@ ItemDef(
kind: Natural, kind: Natural,
hands: Two, hands: Two,
stats: Direct(( stats: Direct((
equip_time_secs: 0.5, equip_time_secs: 0.0,
power: 1.0, power: 1.0,
poise_strength: 1.0, poise_strength: 1.0,
speed: 1.0, speed: 1.0,

View File

@ -19,6 +19,7 @@ impl Animation for AlphaAnimation {
f32, f32,
Option<StageSection>, Option<StageSection>,
f32, f32,
f32,
); );
type Skeleton = BipedLargeSkeleton; type Skeleton = BipedLargeSkeleton;
@ -33,9 +34,10 @@ impl Animation for AlphaAnimation {
(active_tool_kind, active_tool_spec), (active_tool_kind, active_tool_spec),
_second_tool, _second_tool,
velocity, velocity,
_global_time, global_time,
stage_section, stage_section,
acc_vel, acc_vel,
timer,
): Self::Dependency<'a>, ): Self::Dependency<'a>,
anim_time: f32, anim_time: f32,
rate: &mut f32, rate: &mut f32,
@ -63,6 +65,9 @@ impl Animation for AlphaAnimation {
let pullback = 1.0 - move3; let pullback = 1.0 - move3;
let move1 = move1base * pullback; let move1 = move1base * pullback;
let move2 = move2base * 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.position = Vec3::new(0.0, 0.0, 0.0);
next.second.orientation = Quaternion::rotation_x(0.0); next.second.orientation = Quaternion::rotation_x(0.0);
next.shoulder_l.position = Vec3::new( next.shoulder_l.position = Vec3::new(
@ -196,40 +201,70 @@ impl Animation for AlphaAnimation {
* Quaternion::rotation_z(move1 * -0.5 + move2 * 0.6); * Quaternion::rotation_z(move1 * -0.5 + move2 * 0.6);
next.head.orientation = Quaternion::rotation_x(move1 * 0.3); next.head.orientation = Quaternion::rotation_x(move1 * 0.3);
}, },
"Tidal Claws" => { "Tidal Warrior" => {
next.torso.position = Vec3::new(0.0, 0.0, move1 * -0.3); if mirror > 0.0 {
next.upper_torso.orientation = next.head.orientation = Quaternion::rotation_z(move1 * 0.75);
Quaternion::rotation_x(move1 * -0.5 + move2 * -0.4); next.upper_torso.orientation =
next.lower_torso.orientation = Quaternion::rotation_x(move1 * 0.2 + move2 * 0.7)
Quaternion::rotation_x(move1 * 0.5 + move2 * 0.4); * 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( next.shoulder_l.orientation =
move1 * 0.4 + 0.4 * speednorm + (footrotl * -0.2) * speednorm, Quaternion::rotation_x(move1 * 0.3 + move2 * 0.8)
); * Quaternion::rotation_y(move1 * -0.3 + move2 * -0.5);
next.shoulder_r.orientation = Quaternion::rotation_x( next.hand_l.position = Vec3::new(
move1 * 0.4 + 0.4 * speednorm + (footrotl * -0.2) * speednorm, -14.0 + move1 * -2.0 + move2 * 4.0,
); 2.0 + move2 * 4.0,
-4.0 + move2 * 3.0,
);
next.control_l.position = Vec3::new( next.hand_l.orientation =
-14.0 + move2 * 9.0, Quaternion::rotation_x(PI / 3.0 + move2 * 1.5)
12.0 + move1 * 6.0, * Quaternion::rotation_y(move2 * 0.5)
-12.0 + move1 * 9.0, * Quaternion::rotation_z(
); -0.35 + move1 * -0.5 + move2 * 1.0,
next.control_r.position = Vec3::new( );
14.0 + move2 * -9.0, next.hand_r.position = Vec3::new(14.0, 2.0, -4.0);
12.0 + move1 * 6.0,
-12.0 + move1 * 9.0,
);
next.control_l.orientation = next.hand_r.orientation =
Quaternion::rotation_x(PI / 3.0 + move1 * 0.5) Quaternion::rotation_x(PI / 3.0) * Quaternion::rotation_z(0.35);
* Quaternion::rotation_y(-0.15)
* Quaternion::rotation_z(move1 * 0.5 + move2 * -0.6); next.shoulder_r.orientation = Quaternion::rotation_x(0.0);
next.control_r.orientation = next.torso.position = Vec3::new(0.0, move2 * -2.2, move2 * -1.0);
Quaternion::rotation_x(PI / 3.0 + move1 * 0.5) } else {
* Quaternion::rotation_y(0.15) next.head.orientation = Quaternion::rotation_z(move1 * -0.75);
* Quaternion::rotation_z(move1 * -0.5 + move2 * 0.6); next.upper_torso.orientation =
next.head.orientation = Quaternion::rotation_x(move1 * 0.3); 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" => { "Minotaur" => {
next.control_l.position = Vec3::new(0.0, 4.0, 5.0); next.control_l.position = Vec3::new(0.0, 4.0, 5.0);

View File

@ -2,19 +2,23 @@ use super::{
super::{vek::*, Animation}, super::{vek::*, Animation},
BipedLargeSkeleton, SkeletonAttr, BipedLargeSkeleton, SkeletonAttr,
}; };
use common::{comp::item::ToolKind, states::utils::StageSection}; use common::{
comp::item::{AbilitySpec, ToolKind},
states::utils::StageSection,
};
use std::f32::consts::PI; use std::f32::consts::PI;
pub struct BeamAnimation; pub struct BeamAnimation;
impl Animation for BeamAnimation { impl Animation for BeamAnimation {
type Dependency<'a> = ( type Dependency<'a> = (
Option<ToolKind>, (Option<ToolKind>, Option<&'a AbilitySpec>),
Option<ToolKind>, (Option<ToolKind>, Option<&'a AbilitySpec>),
f32, f32,
Vec3<f32>, Vec3<f32>,
Option<StageSection>, Option<StageSection>,
f32, f32,
f32,
); );
type Skeleton = BipedLargeSkeleton; type Skeleton = BipedLargeSkeleton;
@ -25,7 +29,15 @@ impl Animation for BeamAnimation {
#[allow(clippy::single_match)] // TODO: Pending review in #587 #[allow(clippy::single_match)] // TODO: Pending review in #587
fn update_skeleton_inner<'a>( fn update_skeleton_inner<'a>(
skeleton: &Self::Skeleton, 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, anim_time: f32,
rate: &mut f32, rate: &mut f32,
s_a: &SkeletonAttr, 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()) 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()) * ((acc_vel * lab + PI * 0.4).sin())
* speednorm; * 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.position = Vec3::new(0.0, s_a.jaw.0, s_a.jaw.1);
next.jaw.orientation = Quaternion::rotation_x(0.0); 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_l.orientation = Quaternion::rotation_x(0.0);
next.hand_r.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 { match active_tool_kind {
Some(ToolKind::Sceptre) | Some(ToolKind::Staff) => { 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_l.position = Vec3::new(-1.0, 3.0, 12.0);
next.control_r.position = next.control_r.position =
Vec3::new(1.0 + move1 * 5.0, 2.0 + move1 * 1.0, 2.0 + move1 * 14.0); 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.orientation = Quaternion::rotation_x(move1 * -0.1);
next.torso.position = Vec3::new(0.0, 0.0, move1 * 1.0); 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);
};
},
_ => {},
}
}
},
_ => {}, _ => {},
} }

View File

@ -46,7 +46,7 @@ impl Animation for DashAnimation {
let lab: f32 = 0.65 * s_a.tempo; let lab: f32 = 0.65 * s_a.tempo;
let speed = Vec2::<f32>::from(velocity).magnitude(); let speed = Vec2::<f32>::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 foothoril = (acc_vel * lab + PI * 1.45).sin() * speednorm;
let foothorir = (acc_vel * lab + PI * (0.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()) 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.second.orientation = Quaternion::rotation_x(0.0);
next.hand_l.orientation = Quaternion::rotation_x(0.0); next.hand_l.orientation = Quaternion::rotation_x(0.0);
next.hand_r.orientation = Quaternion::rotation_x(0.0); next.hand_r.orientation = Quaternion::rotation_x(0.0);
let (move1base, move2base, move3base, move4) = match stage_section { let (move1base, motion, move2base, move3base, move4) = match stage_section {
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0, 0.0), Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 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::Charge) => (
Some(StageSection::Swing) => (1.0, 1.0, anim_time.powf(4.0), 0.0), 1.0,
Some(StageSection::Recover) => (1.1, 1.0, 1.0, anim_time.powf(4.0)), (acc_vel * lab).sin(),
_ => (0.0, 0.0, 0.0, 0.0), (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 pullback = 1.0 - move4;
let move1 = move1base * pullback; let move1 = move1base * pullback;
@ -189,6 +195,32 @@ impl Animation for DashAnimation {
next.shoulder_r.orientation = Quaternion::rotation_x(-0.3); 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);
},
_ => {}, _ => {},
} }
} }

View File

@ -48,8 +48,8 @@ impl Animation for RunAnimation {
*rate = 1.0; *rate = 1.0;
let lab: f32 = 0.65 * s_a.tempo; let lab: f32 = 0.65 * s_a.tempo;
let speednorm = (speed / 12.0).powf(0.6); let speednorm = (speed.min(16.0) / 12.0).powf(0.6);
let speednormlow = (speed / 12.0).powf(4.0); let speednormlow = (speed.min(16.0) / 12.0).powf(4.0);
let footvertl = (acc_vel * lab + PI * -0.2).sin() * speednorm; let footvertl = (acc_vel * lab + PI * -0.2).sin() * speednorm;
let footvertr = (acc_vel * lab + PI * -1.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 foothoril = (acc_vel * lab + PI * 1.45).sin() * speednorm;
let foothorir = (acc_vel * lab + PI * (0.45)).sin() * speednorm; let foothorir = (acc_vel * lab + PI * (0.45)).sin() * speednorm;
let footstrafel = (acc_vel * lab + PI * 1.45).sin(); let footstrafel = (acc_vel * lab + PI * 1.45).sin() * speednorm;
let footstrafer = (acc_vel * lab + PI * (0.95)).sin(); let footstrafer = (acc_vel * lab + PI * (0.95)).sin() * speednorm;
let footvertsl = (acc_vel * lab).sin(); let footvertsl = (acc_vel * lab).sin() * speednorm;
let footvertsr = (acc_vel * lab + PI * 0.5).sin(); 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 direction = velocity.y * -0.098 * orientation.y + velocity.x * -0.098 * orientation.x;
let side = let side = ((velocity.x * -0.098 * orientation.y + velocity.y * 0.098 * orientation.x)
(velocity.x * -0.098 * orientation.y + velocity.y * 0.098 * orientation.x) * -1.0; * -1.0)
.min(1.0)
.max(-1.0);
let sideabs = side.abs(); let sideabs = side.abs();
let x_tilt = avg_vel.z.atan2(avg_vel.xy().magnitude()); let x_tilt = avg_vel.z.atan2(avg_vel.xy().magnitude());
next.jaw.scale = Vec3::one() * 1.02; next.jaw.scale = Vec3::one() * 1.02;

View File

@ -212,14 +212,17 @@ impl Animation for StunnedAnimation {
next.control_r.orientation = next.control_r.orientation =
Quaternion::rotation_x(PI / 3.0) * Quaternion::rotation_y(0.15); Quaternion::rotation_x(PI / 3.0) * Quaternion::rotation_y(0.15);
}, },
"Tidal Claws" => { "Tidal Warrior" => {
next.control_l.position = Vec3::new(-14.0, 12.0, -12.0); next.head.orientation = Quaternion::rotation_x(move1 * -2.0);
next.control_r.position = Vec3::new(14.0, 12.0, -12.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) next.hand_l.orientation = Quaternion::rotation_x(PI / 3.0)
* Quaternion::rotation_y(-0.15); * Quaternion::rotation_z(-0.35);
next.control_r.orientation = next.hand_r.orientation =
Quaternion::rotation_x(PI / 3.0) * Quaternion::rotation_y(0.15); Quaternion::rotation_x(PI / 3.0) * Quaternion::rotation_z(0.35);
}, },
"Beast Claws" => { "Beast Claws" => {
next.shoulder_l.position = next.shoulder_l.position =

View File

@ -2,15 +2,18 @@ use super::{
super::{vek::*, Animation}, super::{vek::*, Animation},
BipedLargeSkeleton, SkeletonAttr, BipedLargeSkeleton, SkeletonAttr,
}; };
use common::{comp::item::ToolKind, states::utils::StageSection}; use common::{
comp::item::{AbilitySpec, ToolKind},
states::utils::StageSection,
};
use std::f32::consts::PI; use std::f32::consts::PI;
pub struct SummonAnimation; pub struct SummonAnimation;
impl Animation for SummonAnimation { impl Animation for SummonAnimation {
type Dependency<'a> = ( type Dependency<'a> = (
Option<ToolKind>, (Option<ToolKind>, Option<&'a AbilitySpec>),
Option<ToolKind>, (Option<ToolKind>, Option<&'a AbilitySpec>),
Vec3<f32>, Vec3<f32>,
f32, f32,
Option<StageSection>, Option<StageSection>,
@ -25,7 +28,14 @@ impl Animation for SummonAnimation {
#[allow(clippy::approx_constant)] // TODO: Pending review in #587 #[allow(clippy::approx_constant)] // TODO: Pending review in #587
fn update_skeleton_inner<'a>( fn update_skeleton_inner<'a>(
skeleton: &Self::Skeleton, 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, anim_time: f32,
rate: &mut f32, rate: &mut f32,
s_a: &SkeletonAttr, s_a: &SkeletonAttr,
@ -55,21 +65,6 @@ impl Animation for SummonAnimation {
let move1 = move1base * pullback; let move1 = move1base * pullback;
let move2 = move2base * 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.torso.orientation = Quaternion::rotation_z(0.0);
next.main.position = Vec3::new(0.0, 0.0, 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)] #[allow(clippy::single_match)]
match active_tool_kind { match active_tool_kind {
Some(ToolKind::Staff) => { 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.head.orientation = Quaternion::rotation_x(0.0);
next.control_l.position = Vec3::new(-1.0, 3.0, 12.0); next.control_l.position = Vec3::new(-1.0, 3.0, 12.0);
next.control_r.position = Vec3::new( 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) next.control.orientation = Quaternion::rotation_x(-0.2 + move1 * 1.0)
* Quaternion::rotation_y(-0.1 + move2 * -0.8); * 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);
},
_ => {},
}
}
},
_ => {}, _ => {},
} }

View File

@ -251,14 +251,14 @@ impl Animation for WieldAnimation {
next.control_r.orientation = next.control_r.orientation =
Quaternion::rotation_x(PI / 3.0) * Quaternion::rotation_y(0.15); Quaternion::rotation_x(PI / 3.0) * Quaternion::rotation_y(0.15);
}, },
"Tidal Claws" => { "Tidal Warrior" => {
next.control_l.position = Vec3::new(-14.0, 12.0, -12.0); next.hand_l.position = Vec3::new(-14.0, 2.0, -4.0);
next.control_r.position = Vec3::new(14.0, 12.0, -12.0); next.hand_r.position = Vec3::new(14.0, 2.0, -4.0);
next.control_l.orientation = Quaternion::rotation_x(PI / 3.0) next.hand_l.orientation = Quaternion::rotation_x(PI / 3.0)
* Quaternion::rotation_y(-0.15); * Quaternion::rotation_z(-0.35);
next.control_r.orientation = next.hand_r.orientation =
Quaternion::rotation_x(PI / 3.0) * Quaternion::rotation_y(0.15); Quaternion::rotation_x(PI / 3.0) * Quaternion::rotation_z(0.35);
}, },
"Beast Claws" => { "Beast Claws" => {
next.shoulder_l.position = next.shoulder_l.position =

View File

@ -3807,6 +3807,7 @@ impl FigureMgr {
time, time,
Some(s.stage_section), Some(s.stage_section),
state.acc_vel, state.acc_vel,
state.state_time,
), ),
stage_progress, stage_progress,
&mut state_animation_rate, &mut state_animation_rate,
@ -4005,6 +4006,7 @@ impl FigureMgr {
time, time,
Some(s.stage_section), Some(s.stage_section),
state.acc_vel, state.acc_vel,
state.state_time,
), ),
stage_progress, stage_progress,
&mut state_animation_rate, &mut state_animation_rate,
@ -4090,8 +4092,8 @@ impl FigureMgr {
anim::biped_large::SummonAnimation::update_skeleton( anim::biped_large::SummonAnimation::update_skeleton(
&target_base, &target_base,
( (
active_tool_kind, (active_tool_kind, active_tool_spec),
second_tool_kind, (second_tool_kind, second_tool_spec),
rel_vel, rel_vel,
time, time,
Some(s.stage_section), Some(s.stage_section),
@ -4185,12 +4187,13 @@ impl FigureMgr {
anim::biped_large::BeamAnimation::update_skeleton( anim::biped_large::BeamAnimation::update_skeleton(
&target_base, &target_base,
( (
active_tool_kind, (active_tool_kind, active_tool_spec),
second_tool_kind, (second_tool_kind, second_tool_spec),
time, time,
rel_vel, rel_vel,
Some(s.stage_section), Some(s.stage_section),
state.acc_vel, state.acc_vel,
state.state_time,
), ),
stage_progress, stage_progress,
&mut state_animation_rate, &mut state_animation_rate,