More new style keyframe translation

This commit is contained in:
Snowram 2020-10-21 00:44:46 +02:00 committed by Robin Gilh
parent e928dbe4db
commit f9f3d33189
17 changed files with 503 additions and 1059 deletions

View File

@ -37,6 +37,13 @@ impl Animation for AlphaAnimation {
let lab = 1.0; let lab = 1.0;
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),
_ => (0.0, 0.0, 0.0),
};
let foot = (((1.0) let foot = (((1.0)
/ (0.2 / (0.2
+ 0.8 + 0.8
@ -62,9 +69,6 @@ impl Animation for AlphaAnimation {
.sqrt()) .sqrt())
* ((anim_time as f32 * lab as f32 * 10.0).sin()); * ((anim_time as f32 * lab as f32 * 10.0).sin());
let movement = anim_time as f32 * 1.0;
let test = (anim_time as f32 * 1.75).sin();
let slower = (((1.0) let slower = (((1.0)
/ (0.05 / (0.05
+ 0.95 + 0.95
@ -84,63 +88,42 @@ impl Animation for AlphaAnimation {
let switch = if random > 0.5 { 1.0 } else { -1.0 }; let switch = if random > 0.5 { 1.0 } else { -1.0 };
if let Some(ToolKind::Sword(_)) = active_tool_kind {
next.hand_l.position = Vec3::new(-4.75, -1.0, 2.5);
next.hand_l.orientation = Quaternion::rotation_x(1.47) * Quaternion::rotation_y(-0.2);
next.hand_l.scale = Vec3::one() * 1.04;
next.hand_r.position = Vec3::new(0.75, -1.5, -0.5);
next.hand_r.orientation = Quaternion::rotation_x(1.47) * Quaternion::rotation_y(0.3);
next.hand_r.scale = Vec3::one() * 1.05;
next.main.position = Vec3::new(0.0, 5.0, -6.0);
next.main.orientation = Quaternion::rotation_x(-0.1)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.head.position = Vec3::new(0.0, skeleton_attr.head.0 + 0.0, skeleton_attr.head.1);
if let Some(stage_section) = stage_section {
match stage_section {
StageSection::Buildup => {
next.control.position =
Vec3::new(-7.0, 7.0 + movement * -4.0, 2.0 + movement * 1.0);
next.control.orientation = Quaternion::rotation_x(movement * -0.5)
* Quaternion::rotation_y(movement * -1.0)
* Quaternion::rotation_z(movement * -1.2);
next.upper_torso.orientation = Quaternion::rotation_z(movement * 1.5);
next.head.orientation = Quaternion::rotation_z(movement * -0.9);
},
StageSection::Swing => {
next.control.position = Vec3::new(-7.0, 3.0 + movement * 16.0, 3.0);
next.control.orientation =
Quaternion::rotation_x(-0.5 + movement * -1.0 * 0.0)
* Quaternion::rotation_y(-1.0 + movement * -0.6)
* Quaternion::rotation_z(-1.2 + movement * 1.3);
next.upper_torso.orientation = Quaternion::rotation_z(1.5 + test * -3.0);
next.head.orientation = Quaternion::rotation_z(-0.9 + test * 2.5);
},
StageSection::Recover => {
next.control.position = Vec3::new(-7.0, 15.0, 2.0);
next.control.orientation = Quaternion::rotation_x(-0.5)
* Quaternion::rotation_y(-1.57 + movement * 1.0)
* Quaternion::rotation_z(0.0);
next.control.scale = Vec3::one();
next.upper_torso.orientation = Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(-1.57 + movement * 0.5);
next.head.orientation = Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(1.57 + movement * -0.5);
},
_ => {},
}
}
}
match active_tool_kind { match active_tool_kind {
Some(ToolKind::Sword(_)) => {
next.hand_l.position = Vec3::new(-4.75, -1.0, 2.5);
next.hand_l.orientation = Quaternion::rotation_x(1.47) * Quaternion::rotation_y(-0.2);
next.hand_l.scale = Vec3::one() * 1.04;
next.hand_r.position = Vec3::new(0.75, -1.5, -0.5);
next.hand_r.orientation = Quaternion::rotation_x(1.47) * Quaternion::rotation_y(0.3);
next.hand_r.scale = Vec3::one() * 1.05;
next.main.position = Vec3::new(0.0, 5.0, -6.0);
next.main.orientation = Quaternion::rotation_x(-0.1)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.head.position = Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1);
next.control.position = Vec3::new(
-7.0,
7.0 + movement1 * -4.0 + movement2 * 16.0 + movement3 * -4.0,
2.0 + movement1 * 1.0,
);
next.control.orientation = Quaternion::rotation_x(movement1 * -0.5)
* Quaternion::rotation_y(movement1 * -1.0 + movement2 * -0.6 + movement3 * 1.0)
* Quaternion::rotation_z(movement1 * -1.2 + movement2 * 1.3);
next.upper_torso.orientation = Quaternion::rotation_z(
movement1 * 1.5 + (movement2 * 1.75).sin() * -3.0 + movement3 * 0.5,
);
next.head.position = Vec3::new(0.0, skeleton_attr.head.0 + 0.0, skeleton_attr.head.1);
next.head.orientation = Quaternion::rotation_z(
movement1 * -0.9 + (movement2 * 1.75).sin() * 2.5 + movement3 * -0.5,
);
},
Some(ToolKind::Dagger(_)) => { Some(ToolKind::Dagger(_)) => {
next.head.position = next.head.position =
Vec3::new(0.0, -2.0 + skeleton_attr.head.0, skeleton_attr.head.1); Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1);
next.head.orientation = Quaternion::rotation_z(slow * -0.25) next.head.orientation = Quaternion::rotation_z(slow * -0.25)
* Quaternion::rotation_x(0.0 + slow * 0.15) * Quaternion::rotation_x(0.0 + slow * 0.15)
* Quaternion::rotation_y(slow * -0.15); * Quaternion::rotation_y(slow * -0.15);
@ -276,7 +259,7 @@ impl Animation for AlphaAnimation {
next.main.scale = Vec3::one() * 1.02; next.main.scale = Vec3::one() * 1.02;
next.head.position = next.head.position =
Vec3::new(0.0, -2.0 + skeleton_attr.head.0, skeleton_attr.head.1); Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1);
next.head.orientation = Quaternion::rotation_z(slower * 0.03) next.head.orientation = Quaternion::rotation_z(slower * 0.03)
* Quaternion::rotation_x(-0.3 + slowersmooth * 0.1) * Quaternion::rotation_x(-0.3 + slowersmooth * 0.1)
* Quaternion::rotation_y(slower * 0.05 + slowersmooth * 0.06) * Quaternion::rotation_y(slower * 0.05 + slowersmooth * 0.06)

View File

@ -3,7 +3,7 @@ use super::{
BipedLargeSkeleton, SkeletonAttr, BipedLargeSkeleton, SkeletonAttr,
}; };
use common::{ use common::{
comp::item::{Hands, ToolKind}, comp::item::ToolKind,
states::utils::StageSection, states::utils::StageSection,
}; };
@ -25,7 +25,7 @@ impl Animation for BetaAnimation {
#[cfg_attr(feature = "be-dyn-lib", export_name = "biped_large_beta")] #[cfg_attr(feature = "be-dyn-lib", export_name = "biped_large_beta")]
fn update_skeleton_inner( fn update_skeleton_inner(
skeleton: &Self::Skeleton, 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, anim_time: f64,
rate: &mut f32, rate: &mut f32,
skeleton_attr: &SkeletonAttr, skeleton_attr: &SkeletonAttr,
@ -33,208 +33,52 @@ impl Animation for BetaAnimation {
*rate = 1.0; *rate = 1.0;
let mut next = (*skeleton).clone(); let mut next = (*skeleton).clone();
let lab = 1.0; let (movement1, movement2, movement3) = match stage_section {
Some(StageSection::Buildup) => (anim_time as f32, 0.0, 0.0),
let fast = (((5.0) Some(StageSection::Cast) => (1.0, anim_time as f32, 0.0),
/ (1.1 + 3.9 * ((anim_time as f32 * lab as f32 * 28.0).sin()).powf(2.0 as f32))) Some(StageSection::Recover) => (1.0, 1.0, anim_time as f32),
.sqrt()) _ => (0.0, 0.0, 0.0),
* ((anim_time as f32 * lab as f32 * 28.0).sin()); };
let footquick = (((5.0)
/ (0.4 + 4.6 * ((anim_time as f32 * lab as f32 * 14.0).sin()).powf(2.0 as f32)))
.sqrt())
* ((anim_time as f32 * lab as f32 * 14.0).sin());
let foot = (((5.0)
/ (1.1 + 3.9 * ((anim_time as f32 * lab as f32 * 14.0).sin()).powf(2.0 as f32)))
.sqrt())
* ((anim_time as f32 * lab as f32 * 14.0).sin());
let slow = (((5.0)
/ (0.6 + 4.4 * ((anim_time as f32 * lab as f32 * 14.0).sin()).powf(2.0 as f32)))
.sqrt())
* ((anim_time as f32 * lab as f32 * 14.0).sin());
let recover = (anim_time as f32 * 8.0).sin();
let movement = anim_time as f32 * 1.0;
let stab = (anim_time as f32 * 2.5).sin();
if let Some(ToolKind::Sword(_)) = active_tool_kind {
next.hand_l.position = Vec3::new(-4.75, -1.0, 2.5);
next.hand_l.orientation = Quaternion::rotation_x(1.47) * Quaternion::rotation_y(-0.2);
next.hand_l.scale = Vec3::one() * 1.04;
next.hand_r.position = Vec3::new(0.75, -1.5, -0.5);
next.hand_r.orientation = Quaternion::rotation_x(1.47) * Quaternion::rotation_y(0.3);
next.hand_r.scale = Vec3::one() * 1.05;
next.main.position = Vec3::new(0.0, 5.0, -6.0);
next.main.orientation = Quaternion::rotation_x(-0.1)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.head.position = Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1);
if let Some(stage_section) = stage_section {
match stage_section {
StageSection::Buildup => {
next.control.position = Vec3::new(
-8.0 + movement * -5.0,
1.0 - recover * 0.8 + movement * 2.0,
2.0 - recover * 0.4,
);
next.control.orientation = Quaternion::rotation_x(-1.57)
* Quaternion::rotation_y(0.0 + movement * 1.5)
* Quaternion::rotation_z(1.0);
next.upper_torso.orientation = Quaternion::rotation_y(-0.1)
* Quaternion::rotation_z(0.4 + movement * 1.5);
next.head.orientation = Quaternion::rotation_y(0.1)
* Quaternion::rotation_z(-0.1 + movement * -1.1);
},
StageSection::Swing => {
next.control.position =
Vec3::new(-8.0 + stab * 30.0, 6.0 + movement * 2.0, 6.0);
next.control.orientation = Quaternion::rotation_x(-1.57)
* Quaternion::rotation_y(1.5 + stab * 0.5)
* Quaternion::rotation_z(1.0 + stab * 1.0);
next.upper_torso.orientation = Quaternion::rotation_y(-0.1)
* Quaternion::rotation_z(1.9 + stab * -0.5);
next.head.orientation = Quaternion::rotation_y(0.1)
* Quaternion::rotation_z(-1.2 + stab * -0.5);
},
StageSection::Recover => {
next.control.position = Vec3::new(10.0 + movement * -5.0, 8.0, 6.0);
next.control.orientation = Quaternion::rotation_x(-1.57)
* Quaternion::rotation_y(2.0)
* Quaternion::rotation_z(2.0);
next.upper_torso.orientation = Quaternion::rotation_y(-0.1)
* Quaternion::rotation_z(1.4 + movement * 1.0);
next.head.orientation =
Quaternion::rotation_y(0.1) * Quaternion::rotation_z(-1.5);
},
_ => {},
}
}
}
match active_tool_kind { match active_tool_kind {
Some(ToolKind::Hammer(_)) => { Some(ToolKind::Sword(_)) => {
next.head.position = next.hand_l.position = Vec3::new(-4.75, -1.0, 2.5);
Vec3::new(0.0, -2.0 + skeleton_attr.head.0, skeleton_attr.head.1); next.hand_l.orientation = Quaternion::rotation_x(1.47) * Quaternion::rotation_y(-0.2);
next.head.orientation = Quaternion::rotation_z(slow * -0.18)
* Quaternion::rotation_x(-0.1 + slow * -0.28)
* Quaternion::rotation_y(0.2 + slow * 0.18);
next.head.scale = Vec3::one() * 1.01;
next.upper_torso.position = Vec3::new(0.0 + foot * 2.0, 0.0, 7.0);
next.upper_torso.orientation = Quaternion::rotation_z(slow * 0.2)
* Quaternion::rotation_x(slow * 0.2)
* Quaternion::rotation_y(slow * -0.1);
next.lower_torso.position = Vec3::new(0.0, 0.0, -5.0);
next.lower_torso.orientation = Quaternion::rotation_z(slow * 0.1)
* Quaternion::rotation_x(slow * 0.1)
* Quaternion::rotation_y(slow * -0.05);
next.hand_l.position = Vec3::new(-0.75, -1.0, -2.5);
next.hand_l.orientation = Quaternion::rotation_x(1.27);
next.hand_l.scale = Vec3::one() * 1.04; next.hand_l.scale = Vec3::one() * 1.04;
next.hand_r.position = Vec3::new(0.75, -1.5, -5.5); next.hand_r.position = Vec3::new(0.75, -1.5, -0.5);
next.hand_r.orientation = Quaternion::rotation_x(1.27); next.hand_r.orientation = Quaternion::rotation_x(1.47) * Quaternion::rotation_y(0.3);
next.hand_r.scale = Vec3::one() * 1.05; next.hand_r.scale = Vec3::one() * 1.05;
next.main.position = Vec3::new(0.0, 6.0, -1.0); next.main.position = Vec3::new(0.0, 5.0, -6.0);
next.main.orientation = Quaternion::rotation_x(-0.3); next.main.orientation = Quaternion::rotation_x(-0.1)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.control.position = Vec3::new(-8.0 + slow * 1.5, 1.5 + slow * 1.0, 0.0); next.head.position = Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1);
next.control.orientation = Quaternion::rotation_x(-1.4)
* Quaternion::rotation_y(slow * 2.0 + 0.7) next.control.position = Vec3::new(
* Quaternion::rotation_z(1.7 - slow * 0.4 + fast * 0.6); -8.0 + movement1 * -5.0 + (movement2 as f32 * 2.5).sin() * 30.0 + movement3 * -5.0,
next.control.scale = Vec3::one(); 1.0 - (movement1 as f32 * 8.0).sin() * 0.8 + movement1 * 2.0 + movement3 * 2.0,
next.foot_l.position = Vec3::new( 2.0 - (movement1 as f32 * 8.0).sin() * 0.4,
-skeleton_attr.foot.0,
footquick * -9.5,
skeleton_attr.foot.2,
); );
next.foot_l.orientation = Quaternion::rotation_x(footquick * 0.3) next.control.orientation = Quaternion::rotation_x(-1.57)
* Quaternion::rotation_y(footquick * -0.6); * Quaternion::rotation_y(
0.0 + movement1 * 1.5 + (movement2 as f32 * 2.5).sin() * 0.5,
next.foot_r.position = )
Vec3::new(skeleton_attr.foot.0, footquick * 9.5, skeleton_attr.foot.2); * Quaternion::rotation_z(1.0 + (movement2 as f32 * 2.5).sin() * 1.0);
next.foot_r.orientation = Quaternion::rotation_x(footquick * -0.3) next.upper_torso.orientation = Quaternion::rotation_y(-0.1)
* Quaternion::rotation_y(footquick * 0.2); * Quaternion::rotation_z(
next.torso.position = Vec3::new(0.0, 0.0, 0.1) * 1.01; 0.4 + movement1 * 1.5 + (movement2 as f32 * 2.5).sin() * -0.5 + movement3 * 1.0,
next.torso.scale = Vec3::one() / 11.0 * 1.01; );
}, next.head.orientation = Quaternion::rotation_y(0.1)
Some(ToolKind::Axe(_)) => { * Quaternion::rotation_z(
next.head.position = -0.1 + movement1 * -1.1 + (movement2 as f32 * 2.5).sin() * -0.5,
Vec3::new(0.0, -2.0 + skeleton_attr.head.0, skeleton_attr.head.1); );
next.head.orientation = Quaternion::rotation_z(slow * -0.18) }
* Quaternion::rotation_x(-0.1 + slow * -0.28)
* Quaternion::rotation_y(0.2 + slow * 0.18);
next.head.scale = Vec3::one() * 1.01;
next.upper_torso.position = Vec3::new(0.0 + foot * 2.0, 0.0, 7.0);
next.upper_torso.orientation = Quaternion::rotation_z(slow * 0.2)
* Quaternion::rotation_x(slow * 0.2)
* Quaternion::rotation_y(slow * -0.1);
next.lower_torso.position = Vec3::new(0.0, 0.0, -5.0);
next.lower_torso.orientation = Quaternion::rotation_z(slow * 0.1)
* Quaternion::rotation_x(slow * 0.1)
* Quaternion::rotation_y(slow * -0.05);
next.hand_l.position = Vec3::new(-0.75, -1.0, -2.5);
next.hand_l.orientation = Quaternion::rotation_x(1.27);
next.hand_l.scale = Vec3::one() * 1.04;
next.hand_r.position = Vec3::new(0.75, -1.5, -5.5);
next.hand_r.orientation = Quaternion::rotation_x(1.27);
next.hand_r.scale = Vec3::one() * 1.05;
next.main.position = Vec3::new(0.0, 6.0, -1.0);
next.main.orientation = Quaternion::rotation_x(-0.3);
next.control.position = Vec3::new(-8.0 + slow * 1.5, 1.5 + slow * 1.0, 0.0);
next.control.orientation = Quaternion::rotation_x(-1.4)
* Quaternion::rotation_y(slow * 2.0 + 0.7)
* Quaternion::rotation_z(1.7 - slow * 0.4 + fast * 0.6);
next.control.scale = Vec3::one();
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
footquick * -9.5,
skeleton_attr.foot.2,
);
next.foot_l.orientation = Quaternion::rotation_x(footquick * 0.3)
* Quaternion::rotation_y(footquick * -0.6);
next.foot_r.position =
Vec3::new(skeleton_attr.foot.0, footquick * 9.5, skeleton_attr.foot.2);
next.foot_r.orientation = Quaternion::rotation_x(footquick * -0.3)
* Quaternion::rotation_y(footquick * 0.2);
next.torso.position = Vec3::new(0.0, 0.0, 0.1) * 1.01;
next.torso.scale = Vec3::one() / 11.0 * 1.01;
},
_ => {}, _ => {},
} }
next.shoulder_l.position = Vec3::new( next.hold.scale = Vec3::one() * 0.0;
-skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1,
skeleton_attr.shoulder.2,
);
next.shoulder_l.orientation = Quaternion::rotation_x(0.0);
next.shoulder_l.scale = Vec3::one();
next.shoulder_r.position = Vec3::new(
skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1,
skeleton_attr.shoulder.2,
);
next.shoulder_r.orientation = Quaternion::rotation_x(0.0);
next.shoulder_r.scale = Vec3::one();
next.second.scale = match (
active_tool_kind.map(|tk| tk.hands()),
second_tool_kind.map(|tk| tk.hands()),
) {
(Some(Hands::OneHand), Some(Hands::OneHand)) => Vec3::one(),
(_, _) => Vec3::zero(),
};
next next
} }
} }

View File

@ -36,42 +36,47 @@ impl Animation for DashAnimation {
) -> Self::Skeleton { ) -> Self::Skeleton {
*rate = 1.0; *rate = 1.0;
let mut next = (*skeleton).clone(); let mut next = (*skeleton).clone();
let lab = 1.0;
let slow = (((5.0) let (movement1, movement2, movement3, _movement4) = match stage_section {
/ (1.1 + 3.9 * ((anim_time as f32 * lab as f32 * 12.4).sin()).powf(2.0 as f32))) Some(StageSection::Buildup) => (anim_time as f32, 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),
_ => (0.0, 0.0, 0.0, 0.0),
};
fn slow (x: f32) -> f32 { (((5.0)
/ (1.1 + 3.9 * ((x * 12.4).sin()).powf(2.0 as f32)))
.sqrt()) .sqrt())
* ((anim_time as f32 * lab as f32 * 12.4).sin()); * ((x * 12.4).sin()) }
let short = (((5.0) fn short (x: f32) -> f32 { (((5.0)
/ (1.5 + 3.5 * ((anim_time as f32 * lab as f32 * 5.0).sin()).powf(2.0 as f32))) / (1.5 + 3.5 * ((x * 5.0).sin()).powf(2.0 as f32)))
.sqrt()) .sqrt())
* ((anim_time as f32 * lab as f32 * 5.0).sin()); * ((x * 5.0).sin()) }
let foothoril = (anim_time as f32 * 5.0 * lab as f32 + PI * 1.45).sin(); fn foothoril (x: f32) -> f32 { (x * 5.0 + PI * 1.45).sin() }
let foothorir = (anim_time as f32 * 5.0 * lab as f32 + PI * (0.45)).sin(); fn foothorir (x: f32) -> f32 { (x * 5.0 + PI * (0.45)).sin() }
let footvertl = (anim_time as f32 * 5.0 * lab as f32).sin(); fn footvertl (x: f32) -> f32 { (x * 5.0).sin() }
let footvertr = (anim_time as f32 * 5.0 * lab as f32 + PI).sin(); fn footvertr (x: f32) -> f32 { (x * 5.0 + PI).sin() }
let footrotl = (((1.0) fn footrotl (x: f32) -> f32 { (((1.0)
/ (0.05 / (0.05
+ (0.95) + (0.95)
* ((anim_time as f32 * 5.0 * lab as f32 + PI * 1.4).sin()).powf(2.0 as f32))) * ((x * 5.0 + PI * 1.4).sin()).powf(2.0 as f32)))
.sqrt()) .sqrt())
* ((anim_time as f32 * 5.0 * lab as f32 + PI * 1.4).sin()); * ((x * 5.0 + PI * 1.4).sin()) }
let footrotr = (((1.0) fn footrotr (x: f32) -> f32 { (((1.0)
/ (0.05 / (0.05
+ (0.95) + (0.95)
* ((anim_time as f32 * 5.0 * lab as f32 + PI * 0.4).sin()).powf(2.0 as f32))) * ((x * 5.0 + PI * 0.4).sin()).powf(2.0 as f32)))
.sqrt()) .sqrt())
* ((anim_time as f32 * 5.0 * lab as f32 + PI * 0.4).sin()); * ((x * 5.0 + PI * 0.4).sin()) }
let shortalt = (anim_time as f32 * lab as f32 * 5.0 + PI / 2.0).sin(); fn shortalt (x: f32) -> f32 { (x * 5.0 + PI / 2.0).sin() }
let movement = (anim_time as f32 * 1.0).min(1.0); next.head.position = Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1);
next.head.position = Vec3::new(0.0, -2.0 + skeleton_attr.head.0, skeleton_attr.head.1);
next.hand_l.position = Vec3::new(-0.75, -1.0, 2.5); next.hand_l.position = Vec3::new(-0.75, -1.0, 2.5);
next.hand_l.orientation = Quaternion::rotation_x(1.47) * Quaternion::rotation_y(-0.2); next.hand_l.orientation = Quaternion::rotation_x(1.47) * Quaternion::rotation_y(-0.2);
@ -87,136 +92,87 @@ impl Animation for DashAnimation {
match active_tool_kind { match active_tool_kind {
//TODO: Inventory //TODO: Inventory
Some(ToolKind::Sword(_)) => { Some(ToolKind::Sword(_)) => {
if let Some(stage_section) = stage_section {
match stage_section {
StageSection::Buildup => {
next.head.orientation = Quaternion::rotation_z(movement * -0.9);
next.upper_torso.orientation = Quaternion::rotation_z(movement * 1.1); next.head.position = Vec3::new(
0.0,
0.0 + skeleton_attr.head.0,
skeleton_attr.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.control.position = Vec3::new(-7.0 + movement * -5.0, 7.0, 2.0); next.upper_torso.position = Vec3::new(
next.control.orientation = Quaternion::rotation_x(movement * -1.0) 0.0,
* Quaternion::rotation_y(movement * 1.5) skeleton_attr.upper_torso.0,
* Quaternion::rotation_z(0.0); skeleton_attr.upper_torso.1 + 2.0 + shortalt(movement2) * -2.5,
next.control.scale = Vec3::one(); );
next.foot_l.position = Vec3::new( next.upper_torso.orientation =
-skeleton_attr.foot.0, Quaternion::rotation_x(movement2.min(1.0) * -0.4 + movement3 * 0.4)
skeleton_attr.foot.1 + movement * -12.0, * Quaternion::rotation_y(movement2.min(1.0) * -0.2 + movement3 * 0.3)
skeleton_attr.foot.2, * Quaternion::rotation_z(movement1 * 1.1 + movement3 * -2.2);
);
next.foot_l.orientation = Quaternion::rotation_x(movement * -1.0);
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1,
skeleton_attr.foot.2,
);
},
StageSection::Charge => {
next.head.position = Vec3::new(
0.0,
-2.0 + skeleton_attr.head.0,
skeleton_attr.head.1 + movement * 1.0,
);
next.head.orientation = Quaternion::rotation_x(0.0) next.control.position = Vec3::new(
* Quaternion::rotation_y(movement * -0.3) -7.0 + movement1 * -5.0 + movement3 * -2.0,
* Quaternion::rotation_z(-0.9 + movement * -0.2 + short * -0.05); 7.0 + movement2.min(1.0) * -2.0,
next.upper_torso.position = Vec3::new( 2.0 + movement2.min(1.0) * 2.0
0.0, );
skeleton_attr.upper_torso.0, next.control.orientation =
skeleton_attr.upper_torso.1 + 2.0 + shortalt * -2.5, Quaternion::rotation_x(movement1 * -1.0 + movement3 * -0.5)
); * Quaternion::rotation_y(movement1 * 1.5 + movement3 * -2.5)
* Quaternion::rotation_z(0.0);
next.control.scale = Vec3::one();
next.upper_torso.orientation = Quaternion::rotation_x(movement * -0.4) next.lower_torso.orientation = Quaternion::rotation_z(short(movement2).min(1.0) * 0.25);
* Quaternion::rotation_y(movement * -0.2)
* Quaternion::rotation_z(1.1);
next.control.position = next.foot_l.position = Vec3::new(
Vec3::new(-13.0, 7.0 + movement * -2.0, 2.0 + movement * 2.0); -skeleton_attr.foot.0,
next.control.orientation = skeleton_attr.foot.1 + movement1 * -12.0 + foothoril(movement2) * -7.5,
Quaternion::rotation_x(-1.0) * Quaternion::rotation_y(1.5); skeleton_attr.foot.2 + ((footvertl(movement2) * -4.0).max(-1.0)),
next.control.scale = Vec3::one(); );
next.foot_l.orientation = Quaternion::rotation_x(movement1 * -1.0 + footrotl(movement2) * -0.6);
next.upper_torso.orientation = Quaternion::rotation_z(short * 0.25); next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
next.foot_l.position = Vec3::new( skeleton_attr.foot.1 + foothorir(movement2) * -7.5,
2.0 - skeleton_attr.foot.0, skeleton_attr.foot.2 + ((footvertr(movement2) * -4.0).max(-1.0)),
skeleton_attr.foot.1 + foothoril * -7.5, );
2.0 + skeleton_attr.foot.2 + ((footvertl * -4.0).max(-1.0)), next.foot_r.orientation =
); Quaternion::rotation_x(-0.6 + footrotr(movement2) * -0.6)
next.foot_l.orientation = * Quaternion::rotation_z(-0.2);
Quaternion::rotation_x(-0.6 + footrotl * -0.6)
* Quaternion::rotation_z(-0.2);
next.foot_r.position = Vec3::new(
2.0 + skeleton_attr.foot.0,
skeleton_attr.foot.1 + foothorir * -7.5,
2.0 + skeleton_attr.foot.2 + ((footvertr * -4.0).max(-1.0)),
);
next.foot_r.orientation =
Quaternion::rotation_x(-0.6 + footrotr * -0.6)
* Quaternion::rotation_z(-0.2);
},
StageSection::Swing => {
next.head.orientation = Quaternion::rotation_y(0.2 + movement * -0.2)
* Quaternion::rotation_z(-1.1 + movement * 1.8);
next.upper_torso.orientation =
Quaternion::rotation_y(-0.2 + movement * 0.3)
* Quaternion::rotation_z(1.1 + movement * -2.2);
next.control.position = Vec3::new(-13.0 + movement * -2.0, 5.0, 4.0);
next.control.orientation =
Quaternion::rotation_x(-1.0 + movement * -0.5)
* Quaternion::rotation_y(1.5 + movement * -2.5);
next.control.scale = Vec3::one();
},
StageSection::Recover => {
next.head.orientation = Quaternion::rotation_z(0.7);
next.upper_torso.orientation = Quaternion::rotation_z(-1.1);
next.control.position = Vec3::new(-15.0, 5.0, 2.0);
next.control.orientation =
Quaternion::rotation_x(-1.5) * Quaternion::rotation_y(-1.0);
next.control.scale = Vec3::one();
},
_ => {},
}
}
}, },
Some(ToolKind::Dagger(_)) => { Some(ToolKind::Dagger(_)) => {
next.head.position = Vec3::new( next.head.position = Vec3::new(
0.0, 0.0,
-2.0 + skeleton_attr.head.0, skeleton_attr.head.0,
-2.0 + skeleton_attr.head.1, -2.0 + skeleton_attr.head.1,
); );
next.head.orientation = Quaternion::rotation_z(0.0) next.head.orientation = Quaternion::rotation_z(0.0)
* Quaternion::rotation_x(0.0) * Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(0.0); * Quaternion::rotation_y(0.0);
next.head.scale = Vec3::one() * 1.01; next.head.scale = Vec3::one();
next.upper_torso.position = Vec3::new(0.0, 0.0, 7.0 + slow * 2.0); next.upper_torso.position = Vec3::new(0.0, 0.0, 7.0 + slow(anim_time as f32) * 2.0);
next.upper_torso.orientation = next.upper_torso.orientation =
Quaternion::rotation_x(-0.5) * Quaternion::rotation_z(-0.7); Quaternion::rotation_x(-0.5) * Quaternion::rotation_z(-0.7);
next.upper_torso.position = Vec3::new(0.0, 3.0, -3.0); next.lower_torso.position = Vec3::new(0.0, 3.0, -3.0);
next.upper_torso.orientation = next.lower_torso.orientation = Quaternion::rotation_x(0.4) * Quaternion::rotation_z(0.3);
Quaternion::rotation_x(0.4) * Quaternion::rotation_z(0.3);
next.hand_l.position = Vec3::new(-0.75, -1.0, -2.5); next.hand_l.position = Vec3::new(-0.75, -1.0, -2.5);
next.hand_l.orientation = Quaternion::rotation_x(1.27); next.hand_l.orientation = Quaternion::rotation_x(1.27);
next.hand_l.scale = Vec3::one() * 1.02; next.hand_l.scale = Vec3::one() * 1.04;
next.hand_r.position = Vec3::new(0.75, -1.5, -5.5); next.hand_r.position = Vec3::new(0.75, -1.5, -5.5);
next.hand_r.orientation = Quaternion::rotation_x(1.27); next.hand_r.orientation = Quaternion::rotation_x(1.27);
next.hand_r.scale = Vec3::one() * 1.02; next.hand_r.scale = Vec3::one() * 1.05;
next.main.position = Vec3::new(0.0, 6.0, -1.0); next.main.position = Vec3::new(0.0, 6.0, -1.0);
next.main.orientation = Quaternion::rotation_x(-0.3); next.main.orientation = Quaternion::rotation_x(-0.3);
next.main.scale = Vec3::one(); next.main.scale = Vec3::one();
next.control.position = Vec3::new(-8.0 - slow * 0.5, 3.0, 3.0); next.control.position = Vec3::new(-8.0 - slow(anim_time as f32) * 0.5, 3.0, 3.0);
next.control.orientation = next.control.orientation =
Quaternion::rotation_x(-0.3) * Quaternion::rotation_z(1.1 + slow * 0.2); Quaternion::rotation_x(-0.3) * Quaternion::rotation_z(1.1 + slow(anim_time as f32) * 0.2);
next.control.scale = Vec3::one(); next.control.scale = Vec3::one();
next.foot_l.position = Vec3::new(-1.4, 2.0, skeleton_attr.foot.2); next.foot_l.position = Vec3::new(-1.4, 2.0, skeleton_attr.foot.2);
next.foot_l.orientation = Quaternion::rotation_x(-0.8); next.foot_l.orientation = Quaternion::rotation_x(-0.8);
@ -226,25 +182,24 @@ impl Animation for DashAnimation {
}, },
_ => {}, _ => {},
} }
match second_tool_kind { match second_tool_kind {
//TODO: Inventory //TODO: Inventory
Some(ToolKind::Dagger(_)) => { Some(ToolKind::Dagger(_)) => {
next.head.position = Vec3::new( next.head.position = Vec3::new(
0.0, 0.0,
-2.0 + skeleton_attr.head.0, skeleton_attr.head.0,
-2.0 + skeleton_attr.head.1, -2.0 + skeleton_attr.head.1,
); );
next.head.orientation = Quaternion::rotation_z(0.0) next.head.orientation = Quaternion::rotation_z(0.0)
* Quaternion::rotation_x(0.0) * Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(0.0); * Quaternion::rotation_y(0.0);
next.head.scale = Vec3::one() * 1.01; next.head.scale = Vec3::one();
next.upper_torso.position = Vec3::new(0.0, 0.0, 7.0 + slow * 2.0); next.upper_torso.position = Vec3::new(0.0, 0.0, 7.0 + slow(anim_time as f32) * 2.0);
next.upper_torso.orientation = Quaternion::rotation_x(0.0); next.upper_torso.orientation = Quaternion::rotation_x(0.0);
next.upper_torso.position = Vec3::new(0.0, 3.0, -3.0); next.lower_torso.position = Vec3::new(0.0, 3.0, -3.0);
next.upper_torso.orientation = Quaternion::rotation_x(0.0); next.lower_torso.orientation = Quaternion::rotation_x(0.0);
next.control.position = Vec3::new(0.0, 0.0, 0.0); next.control.position = Vec3::new(0.0, 0.0, 0.0);
next.control.orientation = Quaternion::rotation_x(0.0); next.control.orientation = Quaternion::rotation_x(0.0);
@ -275,6 +230,10 @@ impl Animation for DashAnimation {
_ => {}, _ => {},
} }
next.hold.scale = Vec3::one() * 0.0;
next.torso.scale = Vec3::one() / 8.0;
next.second.scale = match ( next.second.scale = match (
active_tool_kind.map(|tk| tk.hands()), active_tool_kind.map(|tk| tk.hands()),
second_tool_kind.map(|tk| tk.hands()), second_tool_kind.map(|tk| tk.hands()),
@ -285,4 +244,4 @@ impl Animation for DashAnimation {
next next
} }
} }

View File

@ -34,7 +34,13 @@ impl Animation for LeapAnimation {
*rate = 1.0; *rate = 1.0;
let mut next = (*skeleton).clone(); let mut next = (*skeleton).clone();
let movement = (anim_time as f32 * 1.0).min(1.0); 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::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 { if let Some(ToolKind::Hammer(_)) = active_tool_kind {
next.hand_l.position = Vec3::new(-12.0, 0.0, 0.0); next.hand_l.position = Vec3::new(-12.0, 0.0, 0.0);
@ -46,108 +52,40 @@ impl Animation for LeapAnimation {
next.main.position = Vec3::new(0.0, 0.0, 12.0); next.main.position = Vec3::new(0.0, 0.0, 12.0);
next.main.orientation = Quaternion::rotation_y(-1.57) * Quaternion::rotation_z(1.57); next.main.orientation = Quaternion::rotation_y(-1.57) * Quaternion::rotation_z(1.57);
next.control.position = Vec3::new(6.0, 7.0, 1.0); next.head.position = Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1);
next.control.orientation = Quaternion::rotation_x(0.3)
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,
);
next.control.orientation = Quaternion::rotation_x(0.3 + movement3 * -3.0)
* Quaternion::rotation_y(0.0) * Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0); * Quaternion::rotation_z(movement1 * 0.5 + movement2 * 0.5 + movement3 * 0.5);
next.control.scale = Vec3::one(); next.upper_torso.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.head.position = Vec3::new(0.0, -2.0 + skeleton_attr.head.0, skeleton_attr.head.1); 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);
if let Some(stage_section) = stage_section { next.hand_l.position = Vec3::new(-12.0 + movement3 * 10.0, 0.0, 0.0);
match stage_section {
StageSection::Buildup => {
next.control.position = Vec3::new(6.0, 7.0, 1.0);
next.control.orientation = Quaternion::rotation_x(0.3)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(movement * 0.5);
next.upper_torso.orientation = Quaternion::rotation_x(movement * 0.3)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(movement * 0.5);
next.head.orientation = Quaternion::rotation_x(0.0) next.foot_l.position = Vec3::new(
* Quaternion::rotation_y(0.0) -skeleton_attr.foot.0,
* Quaternion::rotation_z(movement * -0.4); skeleton_attr.foot.1 - 5.0 + movement3 * 13.0,
}, skeleton_attr.foot.2 + movement3 * -5.0,
);
next.foot_l.orientation = Quaternion::rotation_x(-0.8 + movement3 * 1.7);
StageSection::Movement => { next.foot_r.position = Vec3::new(
next.control.position = Vec3::new( skeleton_attr.foot.0,
6.0 + movement * -10.0, skeleton_attr.foot.1 + 8.0 + movement3 * -13.0,
7.0 + movement * 5.0, skeleton_attr.foot.2 + 5.0 + movement3 * -5.0,
1.0 + movement * 5.0, );
); next.foot_r.orientation = Quaternion::rotation_x(0.9 + movement3 * -1.7);
next.control.orientation = Quaternion::rotation_x(0.3)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.5 + movement * 0.5);
next.upper_torso.orientation = Quaternion::rotation_x(0.3 + movement * 0.3)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.5 + movement * 0.2);
next.head.orientation = Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(movement * -0.1)
* Quaternion::rotation_z(-0.4 + movement * -0.2);
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1 - 5.0,
skeleton_attr.foot.2,
);
next.foot_l.orientation = Quaternion::rotation_x(-0.8);
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1 + 8.0,
skeleton_attr.foot.2 + 5.0,
);
next.foot_r.orientation = Quaternion::rotation_x(0.9);
},
StageSection::Swing => {
next.control.position =
Vec3::new(-4.0, 12.0 + movement * 5.0, 6.0 + movement * -7.0);
next.control.orientation = Quaternion::rotation_x(0.3 + movement * -3.0)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(1.0 + movement * 0.5);
next.upper_torso.orientation =
Quaternion::rotation_x(0.6 + movement * -0.9)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.7 + movement * -0.7);
next.head.orientation = Quaternion::rotation_x(movement * 0.2)
* Quaternion::rotation_y(-0.1)
* Quaternion::rotation_z(-0.6 + movement * 0.6);
next.hand_l.position = Vec3::new(-12.0 + movement * 10.0, 0.0, 0.0);
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1 + 8.0,
skeleton_attr.foot.2 - 5.0,
);
next.foot_l.orientation = Quaternion::rotation_x(0.9);
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1 - 5.0,
skeleton_attr.foot.2,
);
next.foot_r.orientation = Quaternion::rotation_x(-0.8);
},
StageSection::Recover => {
next.control.position = Vec3::new(-4.0, 17.0, -1.0);
next.control.orientation = Quaternion::rotation_x(-2.7)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(1.5);
next.upper_torso.orientation =
Quaternion::rotation_x(-0.3 + movement * 0.3)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.head.orientation = Quaternion::rotation_x(0.2)
* Quaternion::rotation_y(-0.1)
* Quaternion::rotation_z(0.0);
next.hand_l.position = Vec3::new(-2.0, 0.0, 0.0);
},
_ => {},
}
}
} else if let Some(ToolKind::Axe(_)) = active_tool_kind { } else if let Some(ToolKind::Axe(_)) = active_tool_kind {
next.hand_l.position = Vec3::new(-0.5, 0.0, 4.0); next.hand_l.position = Vec3::new(-0.5, 0.0, 4.0);
next.hand_l.orientation = Quaternion::rotation_x(PI / 2.0) next.hand_l.orientation = Quaternion::rotation_x(PI / 2.0)
@ -170,169 +108,47 @@ impl Animation for LeapAnimation {
* Quaternion::rotation_z(PI - 0.2); * Quaternion::rotation_z(PI - 0.2);
next.control.scale = Vec3::one(); next.control.scale = Vec3::one();
next.head.position = Vec3::new(0.0, -2.0 + skeleton_attr.head.0, skeleton_attr.head.1); next.head.position = Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1);
if let Some(stage_section) = stage_section { next.control.position = Vec3::new(
match stage_section { -3.0 + movement1 * 3.0,
StageSection::Buildup => { 11.0 + movement1 * 1.0 + movement3 * 3.0,
next.control.position = Vec3::new( 3.0 + movement1 * 12.0 + movement3 * -15.0,
-3.0 + movement * 3.0, );
11.0 + movement * 1.0, next.control.orientation = Quaternion::rotation_x(
3.0 + movement * 12.0, 1.8 + movement1 * -1.0 + movement2 * -0.5 + movement3 * -1.0,
); ) * Quaternion::rotation_y(-0.5 + movement1 * 0.5)
next.control.orientation = Quaternion::rotation_x(1.8 + movement * -1.0) * Quaternion::rotation_z(PI + 0.2 - movement1 * 0.2);
* Quaternion::rotation_y(-0.5 + movement * 0.5)
* Quaternion::rotation_z(PI + 0.2 - movement * 0.2);
next.upper_torso.orientation = Quaternion::rotation_x(movement * -0.3)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(movement * 0.5);
next.head.orientation = Quaternion::rotation_x(0.0 + movement * -0.4); next.torso.orientation = Quaternion::rotation_x(
-0.3 + movement2 * -1.8 * PI + movement3 * -0.2 * PI + movement4 * -0.1 * PI,
) * Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.foot_l.position = Vec3::new( next.head.orientation =
skeleton_attr.foot.0, Quaternion::rotation_x(0.0 + movement1 * -0.4 + movement2 * 0.4 + movement3 * 0.2);
skeleton_attr.foot.1,
skeleton_attr.foot.2 - 8.0,
);
next.foot_r.position = Vec3::new( next.foot_l.position = Vec3::new(
skeleton_attr.foot.0, skeleton_attr.foot.0,
skeleton_attr.foot.1, skeleton_attr.foot.1 + movement2 * 4.0 + movement3 * -8.0,
skeleton_attr.foot.2 - 8.0, skeleton_attr.foot.2 - 8.0 + movement2 * 3.0 + movement3 * -3.0,
); );
next.foot_l.orientation = Quaternion::rotation_x(movement * 0.9); next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1 + movement2 * 4.0 + movement3 * -8.0,
skeleton_attr.foot.2 - 8.0 + movement2 * 3.0 + movement3 * -3.0,
);
next.foot_r.orientation = Quaternion::rotation_x(movement * 0.9); next.foot_l.orientation = Quaternion::rotation_x(movement1 * 0.9 - movement3 * 1.8);
next.lower_torso.orientation = Quaternion::rotation_x(movement * 0.3); next.foot_r.orientation = Quaternion::rotation_x(movement1 * 0.9 - movement3 * 1.8);
next.upper_torso.position = Vec3::new( next.lower_torso.orientation = Quaternion::rotation_x(movement1 * 0.3 + movement2 * 0.1);
0.0,
skeleton_attr.upper_torso.0,
skeleton_attr.upper_torso.1 - 8.0,
);
next.torso.position = Vec3::new(0.0, 0.0, 0.0 + 8.0);
},
StageSection::Movement => { next.upper_torso.position =
next.control.position = Vec3::new(0.0, 12.0, 15.0); Vec3::new(0.0, skeleton_attr.upper_torso.0, skeleton_attr.upper_torso.1 - 8.0);
next.torso.position = Vec3::new(0.0, 0.0, 0.0 + 8.0);
next.upper_torso.position = Vec3::new(
0.0,
skeleton_attr.upper_torso.0,
skeleton_attr.upper_torso.1 - 8.0,
);
next.torso.position = Vec3::new(0.0, 0.0, 0.0 + 8.0);
next.control.orientation = Quaternion::rotation_x(0.8 + movement * -0.5)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(PI);
next.torso.orientation = Quaternion::rotation_x(-0.3 + movement * 6.0)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.head.orientation = Quaternion::rotation_x(-0.4 + movement * 0.4);
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1 + movement * 4.0,
skeleton_attr.foot.2 - 8.0 + movement * 3.0,
);
next.foot_l.orientation = Quaternion::rotation_x(0.9);
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1 + movement * 4.0,
skeleton_attr.foot.2 - 8.0 + movement * 3.0,
);
next.foot_r.orientation = Quaternion::rotation_x(0.9);
next.upper_torso.position = Vec3::new(
0.0,
skeleton_attr.upper_torso.0,
skeleton_attr.upper_torso.1 - 8.0,
);
next.torso.position = Vec3::new(0.0, 0.0, 0.0 + 8.0);
next.torso.orientation = Quaternion::rotation_x(movement * -1.8 * PI);
next.torso.scale = Vec3::one() / 11.0;
next.lower_torso.orientation = Quaternion::rotation_x(0.3 + movement * 0.1);
next.upper_torso.position = Vec3::new(
0.0,
skeleton_attr.upper_torso.0,
skeleton_attr.upper_torso.1 - 8.0,
);
next.torso.position = Vec3::new(0.0, 0.0, 0.0 + 8.0);
},
StageSection::Swing => {
next.control.position =
Vec3::new(0.0, 12.0 + movement * 3.0, 15.0 + movement * -15.0);
next.control.orientation = Quaternion::rotation_x(0.3 + movement * -1.0)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(PI);
next.head.orientation = Quaternion::rotation_x(movement * 0.2);
next.hand_l.position = Vec3::new(-0.5, 0.0, 4.0);
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1 + 4.0 + movement * -8.0,
skeleton_attr.foot.2 - 5.0 + movement * -3.0,
);
next.foot_l.orientation = Quaternion::rotation_x(0.9 - movement * 1.8);
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1 + 4.0 + movement * -8.0,
skeleton_attr.foot.2 - 5.0 + movement * -3.0,
);
next.foot_r.orientation = Quaternion::rotation_x(0.9 - movement * 1.8);
next.torso.orientation =
Quaternion::rotation_x(-1.9 * PI - movement * 0.2 * PI);
next.upper_torso.position = Vec3::new(
0.0,
skeleton_attr.upper_torso.0,
skeleton_attr.upper_torso.1 - 8.0,
);
next.torso.position = Vec3::new(0.0, 0.0, 0.0 + 8.0);
},
StageSection::Recover => {
next.control.position = Vec3::new(0.0, 15.0, 0.0);
next.control.orientation = Quaternion::rotation_x(-0.7)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(PI);
next.head.orientation = Quaternion::rotation_x(0.2);
next.hand_l.position = Vec3::new(-0.5, 0.0, 4.0);
next.upper_torso.position = Vec3::new(
0.0,
skeleton_attr.upper_torso.0,
skeleton_attr.upper_torso.1 - 8.0,
);
next.torso.position = Vec3::new(0.0, 0.0, 0.0 + 8.0);
next.torso.orientation =
Quaternion::rotation_x(-6.7 + movement * -0.1 * PI);
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1 - 4.0,
skeleton_attr.foot.2 - 8.0,
);
next.foot_l.orientation = Quaternion::rotation_x(-0.9);
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1 - 4.0,
skeleton_attr.foot.2 - 8.0,
);
next.foot_r.orientation = Quaternion::rotation_x(-0.9);
},
_ => {},
}
}
} }
next.second.scale = match ( next.second.scale = match (
@ -345,4 +161,4 @@ impl Animation for LeapAnimation {
next next
} }
} }

View File

@ -38,9 +38,22 @@ impl Animation for ShockwaveAnimation {
*rate = 1.0; *rate = 1.0;
let mut next = (*skeleton).clone(); let mut next = (*skeleton).clone();
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)
},
_ => (0.0, 0.0, 0.0),
};
let movement = (anim_time as f32 * 1.0).min(1.0); let movement = (anim_time as f32 * 1.0).min(1.0);
next.head.position = Vec3::new(0.0, -2.0 + skeleton_attr.head.0, skeleton_attr.head.1); next.head.position = Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1);
next.hand_l.position = Vec3::new(0.0, 0.0, -4.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_l.orientation = Quaternion::rotation_x(1.27) * Quaternion::rotation_y(0.0);
@ -58,122 +71,51 @@ impl Animation for ShockwaveAnimation {
next.control.scale = Vec3::one(); next.control.scale = Vec3::one();
let twist = movement * 0.8; let twist = movement * 0.8;
match active_tool_kind { next.control.position = Vec3::new(
//TODO: Inventory -4.0 + movement1 * 5.0 + movement3 * -5.0,
Some(ToolKind::Staff(_)) => { 7.0 + movement1 * 3.0 + movement3 * -3.0,
if let Some(stage_section) = stage_section { 4.0 + movement1 * 10.0 + movement2 * -2.0 + movement3 * -8.0,
match stage_section { );
StageSection::Buildup => { next.control.orientation =
next.control.position = Vec3::new( Quaternion::rotation_x(-0.3 + movement1 * 0.8 + movement2 * 0.3 + movement3 * -1.1)
-4.0 + movement * 5.0, * Quaternion::rotation_y(0.15 + movement1 * -0.15 + movement2 * 0.3 + movement3 * -0.45)
7.0 + movement * 3.0, * Quaternion::rotation_z(movement1 * 0.8 + movement2 * -0.8);
4.0 + movement * 10.0,
);
next.control.orientation =
Quaternion::rotation_x(-0.3 + movement * 0.8)
* Quaternion::rotation_y(0.15 + movement * -0.15)
* Quaternion::rotation_z(movement * 0.8);
next.head.orientation = Quaternion::rotation_x(movement * 0.4)
* Quaternion::rotation_z(twist * 0.2);
next.upper_torso.position = Vec3::new( next.head.orientation =
0.0, Quaternion::rotation_x(movement1 * 0.4 + movement3 * -0.4)
skeleton_attr.upper_torso.0, * Quaternion::rotation_z(twist * 0.2 + movement2 * -0.8 + movement3 * 0.6);
skeleton_attr.upper_torso.1 + movement * 2.0,
);
next.upper_torso.orientation = Quaternion::rotation_z(twist * -0.2);
next.lower_torso.orientation = Quaternion::rotation_z(twist); next.upper_torso.position = Vec3::new(
0.0,
skeleton_attr.upper_torso.0,
skeleton_attr.upper_torso.1 + movement1 * 2.0 + movement2 * -4.0 + movement3 * 2.0,
);
next.upper_torso.orientation =
Quaternion::rotation_x(movement2 * -0.8 + movement3 * 0.8)
* Quaternion::rotation_z(twist * -0.2 + movement2 * -0.1 + movement3 * 0.3);
if velocity < 0.5 { next.lower_torso.orientation =
next.foot_l.position = Vec3::new( Quaternion::rotation_x(movement2 * 0.3 + movement3 * -0.3)
-skeleton_attr.foot.0, * Quaternion::rotation_z(twist + movement2 * -0.8);
skeleton_attr.foot.1 + movement * -7.0,
skeleton_attr.foot.2,
);
next.foot_l.orientation = Quaternion::rotation_x(movement * -0.8)
* Quaternion::rotation_z(movement * 0.3);
next.foot_r.position = Vec3::new( if velocity < 0.5 {
skeleton_attr.foot.0, next.foot_l.position = Vec3::new(
skeleton_attr.foot.1 + movement * 5.0, -skeleton_attr.foot.0,
skeleton_attr.foot.2, skeleton_attr.foot.1 + movement1 * -7.0 + movement2 * 7.0,
); skeleton_attr.foot.2,
next.foot_r.orientation = Quaternion::rotation_y(movement * -0.3) );
* Quaternion::rotation_z(movement * 0.4); next.foot_l.orientation =
} else { Quaternion::rotation_x(movement1 * -0.8 + movement2 * 0.8)
}; * Quaternion::rotation_z(movement1 * 0.3 + movement2 * -0.3);
},
StageSection::Swing => {
next.control.position = Vec3::new(1.0, 10.0, 14.0 + movement * -2.0);
next.control.orientation = Quaternion::rotation_x(0.5 + movement * 0.3)
* Quaternion::rotation_y(movement * 0.3)
* Quaternion::rotation_z(0.8 + movement * -0.8);
next.head.orientation = Quaternion::rotation_x(0.4) next.foot_r.position = Vec3::new(
* Quaternion::rotation_z(0.2 + movement * -0.8); skeleton_attr.foot.0,
skeleton_attr.foot.1 + movement1 * 5.0 + movement2 * -5.0,
next.upper_torso.position = Vec3::new( skeleton_attr.foot.2,
0.0, );
skeleton_attr.upper_torso.0, next.foot_r.orientation =
skeleton_attr.upper_torso.1 + 2.0 + movement * -4.0, Quaternion::rotation_y(movement1 * -0.3 + movement2 * 0.3)
); * Quaternion::rotation_z(movement1 * 0.4 + movement2 * -0.4);
next.upper_torso.orientation = Quaternion::rotation_x(movement * -0.8)
* Quaternion::rotation_z(movement * -0.3);
next.lower_torso.orientation = Quaternion::rotation_x(movement * 0.3)
* Quaternion::rotation_z(0.8 + movement * -0.8);
if velocity < 0.5 {
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1 - 7.0 + movement * 7.0,
skeleton_attr.foot.2,
);
next.foot_l.orientation =
Quaternion::rotation_x(-0.8 + movement * 0.8)
* Quaternion::rotation_z(0.3 + movement * -0.3);
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1 + 5.0 + movement * -5.0,
skeleton_attr.foot.2,
);
next.foot_r.orientation =
Quaternion::rotation_y(-0.3 + movement * 0.3)
* Quaternion::rotation_z(0.4 + movement * -0.4);
} else {
};
},
StageSection::Recover => {
next.control.position = Vec3::new(
1.0 + movement * -5.0,
10.0 + movement * -3.0,
12.0 + movement * -8.0,
);
next.control.orientation =
Quaternion::rotation_x(0.8 + movement * -1.1)
* Quaternion::rotation_y(movement * -0.15)
* Quaternion::rotation_z(0.0);
next.head.orientation = Quaternion::rotation_x(0.4 + movement * -0.4)
* Quaternion::rotation_z(-0.6 + movement * 0.6);
next.lower_torso.orientation =
Quaternion::rotation_x(0.3 + movement * -0.3);
next.upper_torso.position = Vec3::new(
0.0,
skeleton_attr.upper_torso.0,
skeleton_attr.upper_torso.1 - 2.0 + movement * 2.0,
);
next.upper_torso.orientation =
Quaternion::rotation_x(-0.8 + movement * 0.8)
* Quaternion::rotation_z(-0.3 + movement * 0.3);
},
_ => {},
}
}
},
_ => {},
} }
next.second.scale = match ( next.second.scale = match (
active_tool_kind.map(|tk| tk.hands()), active_tool_kind.map(|tk| tk.hands()),
@ -185,4 +127,4 @@ impl Animation for ShockwaveAnimation {
next next
} }
} }

View File

@ -142,7 +142,7 @@ impl Animation for SpinAnimation {
next.control.scale = Vec3::one(); next.control.scale = Vec3::one();
next.head.position = Vec3::new( next.head.position = Vec3::new(
0.0, 0.0,
-2.0 + skeleton_attr.head.0 + spin * -0.8, skeleton_attr.head.0 + spin * -0.8,
skeleton_attr.head.1, skeleton_attr.head.1,
); );
next.head.orientation = Quaternion::rotation_z(spin * -0.25) next.head.orientation = Quaternion::rotation_z(spin * -0.25)

View File

@ -73,41 +73,41 @@ impl Animation for AlphaAnimation {
.sqrt()) .sqrt())
* ((anim_time as f32 * lab as f32 * 4.0).sin()); * ((anim_time as f32 * lab as f32 * 4.0).sin());
if let Some(ToolKind::Sword(_)) = active_tool_kind {
next.hand_l.position = Vec3::new(-0.75, -1.0, 2.5);
next.hand_l.orientation = Quaternion::rotation_x(1.47) * Quaternion::rotation_y(-0.2);
next.hand_l.scale = Vec3::one() * 1.05;
next.hand_r.position = Vec3::new(0.75, -1.5, -0.5);
next.hand_r.orientation = Quaternion::rotation_x(1.47) * Quaternion::rotation_y(0.3);
next.hand_r.scale = Vec3::one() * 1.05;
next.main.position = Vec3::new(0.0, 0.0, 2.0);
next.main.orientation = Quaternion::rotation_x(-0.1)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.control.position = Vec3::new(
-7.0,
7.0 + movement1 * -4.0 + movement2 * 16.0 + movement3 * -4.0,
2.0 + movement1 * 1.0,
);
next.control.orientation = Quaternion::rotation_x(movement1 * -0.5)
* Quaternion::rotation_y(movement1 * -1.0 + movement2 * -0.6 + movement3 * 1.0)
* Quaternion::rotation_z(movement1 * -1.2 + movement2 * 1.3);
next.chest.orientation = Quaternion::rotation_z(
movement1 * 1.5 + (movement2 * 1.75).sin() * -3.0 + movement3 * 0.5,
);
next.head.position = Vec3::new(0.0, skeleton_attr.head.0 + 0.0, skeleton_attr.head.1);
next.head.orientation = Quaternion::rotation_z(
movement1 * -0.9 + (movement2 * 1.75).sin() * 2.5 + movement3 * -0.5,
);
}
match active_tool_kind { match active_tool_kind {
//TODO: Inventory //TODO: Inventory
Some(ToolKind::Sword(_)) => {
next.hand_l.position = Vec3::new(-0.75, -1.0, 2.5);
next.hand_l.orientation = Quaternion::rotation_x(1.47) * Quaternion::rotation_y(-0.2);
next.hand_l.scale = Vec3::one() * 1.05;
next.hand_r.position = Vec3::new(0.75, -1.5, -0.5);
next.hand_r.orientation = Quaternion::rotation_x(1.47) * Quaternion::rotation_y(0.3);
next.hand_r.scale = Vec3::one() * 1.05;
next.main.position = Vec3::new(0.0, 0.0, 2.0);
next.main.orientation = Quaternion::rotation_x(-0.1)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.control.position = Vec3::new(
-7.0,
7.0 + movement1 * -4.0 + movement2 * 16.0 + movement3 * -4.0,
2.0 + movement1 * 1.0,
);
next.control.orientation = Quaternion::rotation_x(movement1 * -0.5)
* Quaternion::rotation_y(movement1 * -1.0 + movement2 * -0.6 + movement3 * 1.0)
* Quaternion::rotation_z(movement1 * -1.2 + movement2 * 1.3);
next.chest.orientation = Quaternion::rotation_z(
movement1 * 1.5 + (movement2 * 1.75).sin() * -3.0 + movement3 * 0.5,
);
next.head.position = Vec3::new(0.0, skeleton_attr.head.0 + 0.0, skeleton_attr.head.1);
next.head.orientation = Quaternion::rotation_z(
movement1 * -0.9 + (movement2 * 1.75).sin() * 2.5 + movement3 * -0.5,
);
},
Some(ToolKind::Dagger(_)) => { Some(ToolKind::Dagger(_)) => {
next.head.position = next.head.position =
Vec3::new(0.0, -2.0 + skeleton_attr.head.0, skeleton_attr.head.1); Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1);
next.head.orientation = Quaternion::rotation_z(slow * -0.25) next.head.orientation = Quaternion::rotation_z(slow * -0.25)
* Quaternion::rotation_x(0.0 + slow * 0.15) * Quaternion::rotation_x(0.0 + slow * 0.15)
* Quaternion::rotation_y(slow * -0.15); * Quaternion::rotation_y(slow * -0.15);
@ -251,7 +251,7 @@ impl Animation for AlphaAnimation {
* Quaternion::rotation_z(1.57); * Quaternion::rotation_z(1.57);
next.head.position = next.head.position =
Vec3::new(0.0, -2.0 + skeleton_attr.head.0, skeleton_attr.head.1); Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1);
next.head.orientation = Quaternion::rotation_z(slower * 0.03) next.head.orientation = Quaternion::rotation_z(slower * 0.03)
* Quaternion::rotation_x(slowersmooth * 0.1) * Quaternion::rotation_x(slowersmooth * 0.1)
* Quaternion::rotation_y(slower * 0.05 + slowersmooth * 0.06) * Quaternion::rotation_y(slower * 0.05 + slowersmooth * 0.06)

View File

@ -40,39 +40,39 @@ impl Animation for BetaAnimation {
_ => (0.0, 0.0, 0.0), _ => (0.0, 0.0, 0.0),
}; };
if let Some(ToolKind::Sword(_)) = active_tool_kind {
next.hand_l.position = Vec3::new(-0.75, -1.0, 2.5);
next.hand_l.orientation = Quaternion::rotation_x(1.47) * Quaternion::rotation_y(-0.2);
next.hand_r.position = Vec3::new(0.75, -1.5, -0.5);
next.hand_r.orientation = Quaternion::rotation_x(1.47) * Quaternion::rotation_y(0.3);
next.main.position = Vec3::new(0.0, 0.0, 2.0);
next.main.orientation = Quaternion::rotation_x(-0.1);
next.head.position = Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1);
next.control.position = Vec3::new(
-8.0 + movement1 * -5.0 + (movement2 as f32 * 2.5).sin() * 30.0 + movement3 * -5.0,
1.0 - (movement1 as f32 * 8.0).sin() * 0.8 + movement1 * 2.0 + movement3 * 2.0,
2.0 - (movement1 as f32 * 8.0).sin() * 0.4,
);
next.control.orientation = Quaternion::rotation_x(-1.57)
* Quaternion::rotation_y(
0.0 + movement1 * 1.5 + (movement2 as f32 * 2.5).sin() * 0.5,
)
* Quaternion::rotation_z(1.0 + (movement2 as f32 * 2.5).sin() * 1.0);
next.chest.orientation = Quaternion::rotation_y(-0.1)
* Quaternion::rotation_z(
0.4 + movement1 * 1.5 + (movement2 as f32 * 2.5).sin() * -0.5 + movement3 * 1.0,
);
next.head.orientation = Quaternion::rotation_y(0.1)
* Quaternion::rotation_z(
-0.1 + movement1 * -1.1 + (movement2 as f32 * 2.5).sin() * -0.5,
);
}
match active_tool_kind { match active_tool_kind {
Some(ToolKind::Sword(_)) => {
next.hand_l.position = Vec3::new(-0.75, -1.0, 2.5);
next.hand_l.orientation = Quaternion::rotation_x(1.47) * Quaternion::rotation_y(-0.2);
next.hand_r.position = Vec3::new(0.75, -1.5, -0.5);
next.hand_r.orientation = Quaternion::rotation_x(1.47) * Quaternion::rotation_y(0.3);
next.main.position = Vec3::new(0.0, 0.0, 2.0);
next.main.orientation = Quaternion::rotation_x(-0.1);
next.head.position = Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1);
next.control.position = Vec3::new(
-8.0 + movement1 * -5.0 + (movement2 as f32 * 2.5).sin() * 30.0 + movement3 * -5.0,
1.0 - (movement1 as f32 * 8.0).sin() * 0.8 + movement1 * 2.0 + movement3 * 2.0,
2.0 - (movement1 as f32 * 8.0).sin() * 0.4,
);
next.control.orientation = Quaternion::rotation_x(-1.57)
* Quaternion::rotation_y(
0.0 + movement1 * 1.5 + (movement2 as f32 * 2.5).sin() * 0.5,
)
* Quaternion::rotation_z(1.0 + (movement2 as f32 * 2.5).sin() * 1.0);
next.chest.orientation = Quaternion::rotation_y(-0.1)
* Quaternion::rotation_z(
0.4 + movement1 * 1.5 + (movement2 as f32 * 2.5).sin() * -0.5 + movement3 * 1.0,
);
next.head.orientation = Quaternion::rotation_y(0.1)
* Quaternion::rotation_z(
-0.1 + movement1 * -1.1 + (movement2 as f32 * 2.5).sin() * -0.5,
);
}
_ => {}, _ => {},
} }
next.glider.position = Vec3::new(0.0, 0.0, 10.0); next.glider.position = Vec3::new(0.0, 0.0, 10.0);
next.glider.scale = Vec3::one() * 0.0; next.glider.scale = Vec3::one() * 0.0;

View File

@ -56,7 +56,7 @@ impl Animation for DanceAnimation {
* 0.15, * 0.15,
); );
next.head.position = Vec3::new(0.0, -2.0 + skeleton_attr.head.0, skeleton_attr.head.1); next.head.position = Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1);
next.head.orientation = Quaternion::rotation_z(short * -0.6) next.head.orientation = Quaternion::rotation_z(short * -0.6)
* Quaternion::rotation_x(0.2 + head_look.y.max(0.0) + shorte.abs() * -0.2); * Quaternion::rotation_x(0.2 + head_look.y.max(0.0) + shorte.abs() * -0.2);
next.head.scale = Vec3::one() * skeleton_attr.head_scale; next.head.scale = Vec3::one() * skeleton_attr.head_scale;

View File

@ -36,49 +36,54 @@ impl Animation for DashAnimation {
) -> Self::Skeleton { ) -> Self::Skeleton {
*rate = 1.0; *rate = 1.0;
let mut next = (*skeleton).clone(); let mut next = (*skeleton).clone();
let lab = 1.0;
let slow = (((5.0) let (movement1, movement2, movement3, _movement4) = match stage_section {
/ (1.1 + 3.9 * ((anim_time as f32 * lab as f32 * 12.4).sin()).powf(2.0 as f32))) Some(StageSection::Buildup) => (anim_time as f32, 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),
_ => (0.0, 0.0, 0.0, 0.0),
};
fn slow (x: f32) -> f32 { (((5.0)
/ (1.1 + 3.9 * ((x * 12.4).sin()).powf(2.0 as f32)))
.sqrt()) .sqrt())
* ((anim_time as f32 * lab as f32 * 12.4).sin()); * ((x * 12.4).sin()) }
let short = (((5.0) fn short (x: f32) -> f32 { (((5.0)
/ (1.5 + 3.5 * ((anim_time as f32 * lab as f32 * 5.0).sin()).powf(2.0 as f32))) / (1.5 + 3.5 * ((x * 5.0).sin()).powf(2.0 as f32)))
.sqrt()) .sqrt())
* ((anim_time as f32 * lab as f32 * 5.0).sin()); * ((x * 5.0).sin()) }
let foothoril = (anim_time as f32 * 5.0 * lab as f32 + PI * 1.45).sin(); fn foothoril (x: f32) -> f32 { (x * 5.0 + PI * 1.45).sin() }
let foothorir = (anim_time as f32 * 5.0 * lab as f32 + PI * (0.45)).sin(); fn foothorir (x: f32) -> f32 { (x * 5.0 + PI * (0.45)).sin() }
let footvertl = (anim_time as f32 * 5.0 * lab as f32).sin(); fn footvertl (x: f32) -> f32 { (x * 5.0).sin() }
let footvertr = (anim_time as f32 * 5.0 * lab as f32 + PI).sin(); fn footvertr (x: f32) -> f32 { (x * 5.0 + PI).sin() }
let footrotl = (((1.0) fn footrotl (x: f32) -> f32 { (((1.0)
/ (0.05 / (0.05
+ (0.95) + (0.95)
* ((anim_time as f32 * 5.0 * lab as f32 + PI * 1.4).sin()).powf(2.0 as f32))) * ((x * 5.0 + PI * 1.4).sin()).powf(2.0 as f32)))
.sqrt()) .sqrt())
* ((anim_time as f32 * 5.0 * lab as f32 + PI * 1.4).sin()); * ((x * 5.0 + PI * 1.4).sin()) }
let footrotr = (((1.0) fn footrotr (x: f32) -> f32 { (((1.0)
/ (0.05 / (0.05
+ (0.95) + (0.95)
* ((anim_time as f32 * 5.0 * lab as f32 + PI * 0.4).sin()).powf(2.0 as f32))) * ((x * 5.0 + PI * 0.4).sin()).powf(2.0 as f32)))
.sqrt()) .sqrt())
* ((anim_time as f32 * 5.0 * lab as f32 + PI * 0.4).sin()); * ((x * 5.0 + PI * 0.4).sin()) }
let shortalt = (anim_time as f32 * lab as f32 * 5.0 + PI / 2.0).sin(); fn shortalt (x: f32) -> f32 { (x * 5.0 + PI / 2.0).sin() }
let movement = (anim_time as f32 * 1.0).min(1.0); next.head.position = Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1);
next.head.position = Vec3::new(0.0, -2.0 + skeleton_attr.head.0, skeleton_attr.head.1);
next.hand_l.position = Vec3::new(-0.75, -1.0, 2.5); next.hand_l.position = Vec3::new(-0.75, -1.0, 2.5);
next.hand_l.orientation = Quaternion::rotation_x(1.47) * Quaternion::rotation_y(-0.2); next.hand_l.orientation = Quaternion::rotation_x(1.47) * Quaternion::rotation_y(-0.2);
next.hand_l.scale = Vec3::one() * 1.04; next.hand_l.scale = Vec3::one() * 1.02;
next.hand_r.position = Vec3::new(0.75, -1.5, -0.5); next.hand_r.position = Vec3::new(0.75, -1.5, -0.5);
next.hand_r.orientation = Quaternion::rotation_x(1.47) * Quaternion::rotation_y(0.3); next.hand_r.orientation = Quaternion::rotation_x(1.47) * Quaternion::rotation_y(0.3);
next.hand_r.scale = Vec3::one() * 1.05; next.hand_r.scale = Vec3::one() * 1.02;
next.main.position = Vec3::new(0.0, 0.0, 2.0); next.main.position = Vec3::new(0.0, 0.0, 2.0);
next.main.orientation = Quaternion::rotation_x(-0.1) next.main.orientation = Quaternion::rotation_x(-0.1)
* Quaternion::rotation_y(0.0) * Quaternion::rotation_y(0.0)
@ -87,107 +92,62 @@ impl Animation for DashAnimation {
match active_tool_kind { match active_tool_kind {
//TODO: Inventory //TODO: Inventory
Some(ToolKind::Sword(_)) => { Some(ToolKind::Sword(_)) => {
if let Some(stage_section) = stage_section {
match stage_section {
StageSection::Buildup => {
next.head.orientation = Quaternion::rotation_z(movement * -0.9);
next.chest.orientation = Quaternion::rotation_z(movement * 1.1); next.head.position = Vec3::new(
0.0,
0.0 + skeleton_attr.head.0,
skeleton_attr.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.control.position = Vec3::new(-7.0 + movement * -5.0, 7.0, 2.0); next.chest.position = Vec3::new(
next.control.orientation = Quaternion::rotation_x(movement * -1.0) 0.0,
* Quaternion::rotation_y(movement * 1.5) skeleton_attr.chest.0,
* Quaternion::rotation_z(0.0); skeleton_attr.chest.1 + 2.0 + shortalt(movement2) * -2.5,
next.control.scale = Vec3::one(); );
next.foot_l.position = Vec3::new( next.chest.orientation =
-skeleton_attr.foot.0, Quaternion::rotation_x(movement2.min(1.0) * -0.4 + movement3 * 0.4)
skeleton_attr.foot.1 + movement * -12.0, * Quaternion::rotation_y(movement2.min(1.0) * -0.2 + movement3 * 0.3)
skeleton_attr.foot.2, * Quaternion::rotation_z(movement1 * 1.1 + movement3 * -2.2);
);
next.foot_l.orientation = Quaternion::rotation_x(movement * -1.0);
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1,
skeleton_attr.foot.2,
);
},
StageSection::Charge => {
next.head.position = Vec3::new(
0.0,
-2.0 + skeleton_attr.head.0,
skeleton_attr.head.1 + movement * 1.0,
);
next.head.orientation = Quaternion::rotation_x(0.0) next.control.position = Vec3::new(
* Quaternion::rotation_y(movement * -0.3) -7.0 + movement1 * -5.0 + movement3 * -2.0,
* Quaternion::rotation_z(-0.9 + movement * -0.2 + short * -0.05); 7.0 + movement2.min(1.0) * -2.0,
next.chest.position = Vec3::new( 2.0 + movement2.min(1.0) * 2.0
0.0, );
skeleton_attr.chest.0, next.control.orientation =
skeleton_attr.chest.1 + 2.0 + shortalt * -2.5, Quaternion::rotation_x(movement1 * -1.0 + movement3 * -0.5)
); * Quaternion::rotation_y(movement1 * 1.5 + movement3 * -2.5)
* Quaternion::rotation_z(0.0);
next.control.scale = Vec3::one();
next.chest.orientation = Quaternion::rotation_x(movement * -0.4) next.shorts.orientation = Quaternion::rotation_z(short(movement2).min(1.0) * 0.25);
* Quaternion::rotation_y(movement * -0.2)
* Quaternion::rotation_z(1.1);
next.control.position = next.belt.orientation = Quaternion::rotation_z(short(movement2).min(1.0) * 0.1);
Vec3::new(-13.0, 7.0 + movement * -2.0, 2.0 + movement * 2.0);
next.control.orientation =
Quaternion::rotation_x(-1.0) * Quaternion::rotation_y(1.5);
next.control.scale = Vec3::one();
next.shorts.orientation = Quaternion::rotation_z(short * 0.25); next.foot_l.position = Vec3::new(
next.belt.orientation = Quaternion::rotation_z(short * 0.1); -skeleton_attr.foot.0,
next.foot_l.position = Vec3::new( skeleton_attr.foot.1 + movement1 * -12.0 + foothoril(movement2) * -7.5,
2.0 - skeleton_attr.foot.0, skeleton_attr.foot.2 + ((footvertl(movement2) * -4.0).max(-1.0)),
skeleton_attr.foot.1 + foothoril * -7.5, );
2.0 + skeleton_attr.foot.2 + ((footvertl * -4.0).max(-1.0)), next.foot_l.orientation = Quaternion::rotation_x(movement1 * -1.0 + footrotl(movement2) * -0.6);
);
next.foot_l.orientation =
Quaternion::rotation_x(-0.6 + footrotl * -0.6)
* Quaternion::rotation_z(-0.2);
next.foot_r.position = Vec3::new( next.foot_r.position = Vec3::new(
2.0 + skeleton_attr.foot.0, skeleton_attr.foot.0,
skeleton_attr.foot.1 + foothorir * -7.5, skeleton_attr.foot.1 + foothorir(movement2) * -7.5,
2.0 + skeleton_attr.foot.2 + ((footvertr * -4.0).max(-1.0)), skeleton_attr.foot.2 + ((footvertr(movement2) * -4.0).max(-1.0)),
); );
next.foot_r.orientation = next.foot_r.orientation =
Quaternion::rotation_x(-0.6 + footrotr * -0.6) Quaternion::rotation_x(-0.6 + footrotr(movement2) * -0.6)
* Quaternion::rotation_z(-0.2); * Quaternion::rotation_z(-0.2);
},
StageSection::Swing => {
next.head.orientation = Quaternion::rotation_y(0.2 + movement * -0.2)
* Quaternion::rotation_z(-1.1 + movement * 1.8);
next.chest.orientation = Quaternion::rotation_y(-0.2 + movement * 0.3)
* Quaternion::rotation_z(1.1 + movement * -2.2);
next.control.position = Vec3::new(-13.0 + movement * -2.0, 5.0, 4.0);
next.control.orientation =
Quaternion::rotation_x(-1.0 + movement * -0.5)
* Quaternion::rotation_y(1.5 + movement * -2.5);
next.control.scale = Vec3::one();
},
StageSection::Recover => {
next.head.orientation = Quaternion::rotation_z(0.7);
next.chest.orientation = Quaternion::rotation_z(-1.1);
next.control.position = Vec3::new(-15.0, 5.0, 2.0);
next.control.orientation =
Quaternion::rotation_x(-1.5) * Quaternion::rotation_y(-1.0);
next.control.scale = Vec3::one();
},
_ => {},
}
}
}, },
Some(ToolKind::Dagger(_)) => { Some(ToolKind::Dagger(_)) => {
next.head.position = Vec3::new( next.head.position = Vec3::new(
0.0, 0.0,
-2.0 + skeleton_attr.head.0, skeleton_attr.head.0,
-2.0 + skeleton_attr.head.1, -2.0 + skeleton_attr.head.1,
); );
next.head.orientation = Quaternion::rotation_z(0.0) next.head.orientation = Quaternion::rotation_z(0.0)
@ -195,7 +155,7 @@ impl Animation for DashAnimation {
* Quaternion::rotation_y(0.0); * Quaternion::rotation_y(0.0);
next.head.scale = Vec3::one() * skeleton_attr.head_scale; next.head.scale = Vec3::one() * skeleton_attr.head_scale;
next.chest.position = Vec3::new(0.0, 0.0, 7.0 + slow * 2.0); next.chest.position = Vec3::new(0.0, 0.0, 7.0 + slow(anim_time as f32) * 2.0);
next.chest.orientation = next.chest.orientation =
Quaternion::rotation_x(-0.5) * Quaternion::rotation_z(-0.7); Quaternion::rotation_x(-0.5) * Quaternion::rotation_z(-0.7);
@ -215,9 +175,9 @@ impl Animation for DashAnimation {
next.main.orientation = Quaternion::rotation_x(-0.3); next.main.orientation = Quaternion::rotation_x(-0.3);
next.main.scale = Vec3::one(); next.main.scale = Vec3::one();
next.control.position = Vec3::new(-8.0 - slow * 0.5, 3.0, 3.0); next.control.position = Vec3::new(-8.0 - slow(anim_time as f32) * 0.5, 3.0, 3.0);
next.control.orientation = next.control.orientation =
Quaternion::rotation_x(-0.3) * Quaternion::rotation_z(1.1 + slow * 0.2); Quaternion::rotation_x(-0.3) * Quaternion::rotation_z(1.1 + slow(anim_time as f32) * 0.2);
next.control.scale = Vec3::one(); next.control.scale = Vec3::one();
next.foot_l.position = Vec3::new(-1.4, 2.0, skeleton_attr.foot.2); next.foot_l.position = Vec3::new(-1.4, 2.0, skeleton_attr.foot.2);
next.foot_l.orientation = Quaternion::rotation_x(-0.8); next.foot_l.orientation = Quaternion::rotation_x(-0.8);
@ -227,13 +187,12 @@ impl Animation for DashAnimation {
}, },
_ => {}, _ => {},
} }
match second_tool_kind { match second_tool_kind {
//TODO: Inventory //TODO: Inventory
Some(ToolKind::Dagger(_)) => { Some(ToolKind::Dagger(_)) => {
next.head.position = Vec3::new( next.head.position = Vec3::new(
0.0, 0.0,
-2.0 + skeleton_attr.head.0, skeleton_attr.head.0,
-2.0 + skeleton_attr.head.1, -2.0 + skeleton_attr.head.1,
); );
next.head.orientation = Quaternion::rotation_z(0.0) next.head.orientation = Quaternion::rotation_z(0.0)
@ -241,7 +200,7 @@ impl Animation for DashAnimation {
* Quaternion::rotation_y(0.0); * Quaternion::rotation_y(0.0);
next.head.scale = Vec3::one() * skeleton_attr.head_scale; next.head.scale = Vec3::one() * skeleton_attr.head_scale;
next.chest.position = Vec3::new(0.0, 0.0, 7.0 + slow * 2.0); next.chest.position = Vec3::new(0.0, 0.0, 7.0 + slow(anim_time as f32) * 2.0);
next.chest.orientation = Quaternion::rotation_x(0.0); next.chest.orientation = Quaternion::rotation_x(0.0);
next.belt.position = Vec3::new(0.0, 1.0, -1.0); next.belt.position = Vec3::new(0.0, 1.0, -1.0);
@ -289,7 +248,7 @@ impl Animation for DashAnimation {
skeleton_attr.lantern.2, skeleton_attr.lantern.2,
); );
next.lantern.orientation = next.lantern.orientation =
Quaternion::rotation_x(slow * -0.7 + 0.4) * Quaternion::rotation_y(slow * 0.4); Quaternion::rotation_x(slow(anim_time as f32) * -0.7 + 0.4) * Quaternion::rotation_y(slow(anim_time as f32) * 0.4);
next.hold.scale = Vec3::one() * 0.0; next.hold.scale = Vec3::one() * 0.0;
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler; next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
@ -308,4 +267,4 @@ impl Animation for DashAnimation {
next next
} }
} }

View File

@ -195,7 +195,7 @@ impl Animation for EquipAnimation {
} else { } else {
next.head.position = Vec3::new( next.head.position = Vec3::new(
0.0, 0.0,
-3.0 + skeleton_attr.head.0, 0.0 + skeleton_attr.head.0,
skeleton_attr.head.1 + short * 0.2, skeleton_attr.head.1 + short * 0.2,
); );
next.head.orientation = next.head.orientation =

View File

@ -52,7 +52,7 @@ impl Animation for LeapAnimation {
next.main.position = Vec3::new(0.0, 0.0, 0.0); 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(-1.57) * Quaternion::rotation_z(1.57);
next.head.position = Vec3::new(0.0, -2.0 + skeleton_attr.head.0, skeleton_attr.head.1); next.head.position = Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1);
next.control.position = Vec3::new( next.control.position = Vec3::new(
6.0 + movement1 * -10.0, 6.0 + movement1 * -10.0,
@ -106,7 +106,7 @@ impl Animation for LeapAnimation {
* Quaternion::rotation_z(PI - 0.2); * Quaternion::rotation_z(PI - 0.2);
next.control.scale = Vec3::one(); next.control.scale = Vec3::one();
next.head.position = Vec3::new(0.0, -2.0 + skeleton_attr.head.0, skeleton_attr.head.1); next.head.position = Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1);
next.control.position = Vec3::new( next.control.position = Vec3::new(
-3.0 + movement1 * 3.0, -3.0 + movement1 * 3.0,

View File

@ -38,9 +38,20 @@ impl Animation for ShockwaveAnimation {
*rate = 1.0; *rate = 1.0;
let mut next = (*skeleton).clone(); let mut next = (*skeleton).clone();
let movement = (anim_time as f32 * 1.0).min(1.0); 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)
},
_ => (0.0, 0.0, 0.0),
};
next.head.position = Vec3::new(0.0, -2.0 + skeleton_attr.head.0, skeleton_attr.head.1); next.head.position = Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1);
next.hand_l.position = Vec3::new(0.0, 0.0, -4.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_l.orientation = Quaternion::rotation_x(1.27) * Quaternion::rotation_y(0.0);
@ -53,129 +64,59 @@ impl Animation for ShockwaveAnimation {
next.control.orientation = Quaternion::rotation_x(-0.3) next.control.orientation = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(0.15) * Quaternion::rotation_y(0.15)
* Quaternion::rotation_z(0.0); * Quaternion::rotation_z(0.0);
let twist = movement * 0.8; next.control.scale = Vec3::one();
match active_tool_kind { let twist = movement1 * 0.8;
//TODO: Inventory
Some(ToolKind::Staff(_)) => {
if let Some(stage_section) = stage_section {
match stage_section {
StageSection::Buildup => {
next.control.position = Vec3::new(
-4.0 + movement * 5.0,
7.0 + movement * 3.0,
4.0 + movement * 10.0,
);
next.control.orientation =
Quaternion::rotation_x(-0.3 + movement * 0.8)
* Quaternion::rotation_y(0.15 + movement * -0.15)
* Quaternion::rotation_z(movement * 0.8);
next.head.orientation = Quaternion::rotation_x(movement * 0.4)
* Quaternion::rotation_z(twist * 0.2);
next.chest.position = Vec3::new( next.control.position = Vec3::new(
0.0, -4.0 + movement1 * 5.0 + movement3 * -5.0,
skeleton_attr.chest.0, 7.0 + movement1 * 3.0 + movement3 * -3.0,
skeleton_attr.chest.1 + movement * 2.0, 4.0 + movement1 * 10.0 + movement2 * -2.0 + movement3 * -8.0,
); );
next.chest.orientation = Quaternion::rotation_z(twist * -0.2); next.control.orientation =
Quaternion::rotation_x(-0.3 + movement1 * 0.8 + movement2 * 0.3 + movement3 * -1.1)
* Quaternion::rotation_y(0.15 + movement1 * -0.15 + movement2 * 0.3 + movement3 * -0.45)
* Quaternion::rotation_z(movement1 * 0.8 + movement2 * -0.8);
next.belt.orientation = Quaternion::rotation_z(twist * 0.6); 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.shorts.orientation = Quaternion::rotation_z(twist); next.chest.position = Vec3::new(
0.0,
skeleton_attr.chest.0,
skeleton_attr.chest.1 + movement1 * 2.0 + movement2 * -4.0 + movement3 * 2.0,
);
next.chest.orientation =
Quaternion::rotation_x(movement2 * -0.8 + movement3 * 0.8)
* Quaternion::rotation_z(twist * -0.2 + movement2 * -0.1 + movement3 * 0.3);
if velocity < 0.5 { next.belt.orientation =
next.foot_l.position = Vec3::new( Quaternion::rotation_x(movement2 * 0.2 + movement3 * -0.2)
-skeleton_attr.foot.0, * Quaternion::rotation_z(twist * 0.6 + movement2 * -0.48);
skeleton_attr.foot.1 + movement * -7.0,
skeleton_attr.foot.2,
);
next.foot_l.orientation = Quaternion::rotation_x(movement * -0.8)
* Quaternion::rotation_z(movement * 0.3);
next.foot_r.position = Vec3::new( next.shorts.orientation =
skeleton_attr.foot.0, Quaternion::rotation_x(movement2 * 0.3 + movement3 * -0.3)
skeleton_attr.foot.1 + movement * 5.0, * Quaternion::rotation_z(twist + movement2 * -0.8);
skeleton_attr.foot.2,
);
next.foot_r.orientation = Quaternion::rotation_y(movement * -0.3)
* Quaternion::rotation_z(movement * 0.4);
} else {
};
},
StageSection::Swing => {
next.control.position = Vec3::new(1.0, 10.0, 14.0 + movement * -2.0);
next.control.orientation = Quaternion::rotation_x(0.5 + movement * 0.3)
* Quaternion::rotation_y(movement * 0.3)
* Quaternion::rotation_z(0.8 + movement * -0.8);
next.head.orientation = Quaternion::rotation_x(0.4) if velocity < 0.5 {
* Quaternion::rotation_z(0.2 + movement * -0.8); next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1 + movement1 * -7.0 + movement2 * 7.0,
skeleton_attr.foot.2,
);
next.foot_l.orientation =
Quaternion::rotation_x(movement1 * -0.8 + movement2 * 0.8)
* Quaternion::rotation_z(movement1 * 0.3 + movement2 * -0.3);
next.chest.position = Vec3::new( next.foot_r.position = Vec3::new(
0.0, skeleton_attr.foot.0,
skeleton_attr.chest.0, skeleton_attr.foot.1 + movement1 * 5.0 + movement2 * -5.0,
skeleton_attr.chest.1 + 2.0 + movement * -4.0, skeleton_attr.foot.2,
); );
next.chest.orientation = Quaternion::rotation_x(movement * -0.8) next.foot_r.orientation =
* Quaternion::rotation_z(movement * -0.3); Quaternion::rotation_y(movement1 * -0.3 + movement2 * 0.3)
* Quaternion::rotation_z(movement1 * 0.4 + movement2 * -0.4);
next.belt.orientation = Quaternion::rotation_x(movement * 0.2)
* Quaternion::rotation_z(0.48 + movement * -0.48);
next.shorts.orientation = Quaternion::rotation_x(movement * 0.3)
* Quaternion::rotation_z(0.8 + movement * -0.8);
if velocity < 0.5 {
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1 - 7.0 + movement * 7.0,
skeleton_attr.foot.2,
);
next.foot_l.orientation =
Quaternion::rotation_x(-0.8 + movement * 0.8)
* Quaternion::rotation_z(0.3 + movement * -0.3);
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1 + 5.0 + movement * -5.0,
skeleton_attr.foot.2,
);
next.foot_r.orientation =
Quaternion::rotation_y(-0.3 + movement * 0.3)
* Quaternion::rotation_z(0.4 + movement * -0.4);
} else {
};
},
StageSection::Recover => {
next.control.position = Vec3::new(
1.0 + movement * -5.0,
10.0 + movement * -3.0,
12.0 + movement * -8.0,
);
next.control.orientation =
Quaternion::rotation_x(0.8 + movement * -1.1)
* Quaternion::rotation_y(movement * -0.15)
* Quaternion::rotation_z(0.0);
next.head.orientation = Quaternion::rotation_x(0.4 + movement * -0.4)
* Quaternion::rotation_z(-0.6 + movement * 0.6);
next.belt.orientation = Quaternion::rotation_x(0.2 + movement * -0.2);
next.shorts.orientation = Quaternion::rotation_x(0.3 + movement * -0.3);
next.chest.position = Vec3::new(
0.0,
skeleton_attr.chest.0,
skeleton_attr.chest.1 - 2.0 + movement * 2.0,
);
next.chest.orientation = Quaternion::rotation_x(-0.8 + movement * 0.8)
* Quaternion::rotation_z(-0.3 + movement * 0.3);
},
_ => {},
}
}
},
_ => {},
} }
next.second.scale = match ( next.second.scale = match (
active_tool_kind.map(|tk| tk.hands()), active_tool_kind.map(|tk| tk.hands()),
@ -187,4 +128,4 @@ impl Animation for ShockwaveAnimation {
next next
} }
} }

View File

@ -38,7 +38,7 @@ impl Animation for ShootAnimation {
let exp = ((anim_time as f32).powf(0.3 as f32)).min(1.2); let exp = ((anim_time as f32).powf(0.3 as f32)).min(1.2);
next.head.position = Vec3::new(0.0, -2.0 + skeleton_attr.head.0, skeleton_attr.head.1); next.head.position = Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1);
next.head.orientation = Quaternion::rotation_z(exp * -0.4) next.head.orientation = Quaternion::rotation_z(exp * -0.4)
* Quaternion::rotation_x(0.0) * Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(exp * 0.1); * Quaternion::rotation_y(exp * 0.1);

View File

@ -41,7 +41,7 @@ impl Animation for StandAnimation {
); );
next.head.position = Vec3::new( next.head.position = Vec3::new(
0.0, 0.0,
skeleton_attr.head.0, 2.0 + skeleton_attr.head.0,
skeleton_attr.head.1 + slow * 0.3 + breathe * -0.05, skeleton_attr.head.1 + slow * 0.3 + breathe * -0.05,
); );
next.head.orientation = Quaternion::rotation_z(head_look.x) next.head.orientation = Quaternion::rotation_z(head_look.x)

View File

@ -98,7 +98,7 @@ impl Animation for SwimWieldAnimation {
} else { } else {
next.head.position = Vec3::new( next.head.position = Vec3::new(
0.0, 0.0,
-2.0 + skeleton_attr.head.0, skeleton_attr.head.0,
skeleton_attr.head.1 + u_slow * 0.1, skeleton_attr.head.1 + u_slow * 0.1,
); );
next.head.orientation = next.head.orientation =

View File

@ -70,7 +70,7 @@ impl Animation for WieldAnimation {
} else { } else {
next.head.position = Vec3::new( next.head.position = Vec3::new(
0.0, 0.0,
-2.0 + skeleton_attr.head.0, 0.0 + skeleton_attr.head.0,
skeleton_attr.head.1 + u_slow * 0.1, skeleton_attr.head.1 + u_slow * 0.1,
); );
next.head.orientation = next.head.orientation =
@ -154,7 +154,7 @@ impl Animation for WieldAnimation {
if speed < 0.5 { if speed < 0.5 {
next.head.position = Vec3::new( next.head.position = Vec3::new(
0.0, 0.0,
-1.5 + skeleton_attr.head.0, 0.0 + skeleton_attr.head.0,
skeleton_attr.head.1 + u_slow * 0.1, skeleton_attr.head.1 + u_slow * 0.1,
); );
next.head.orientation = Quaternion::rotation_z(head_look.x) next.head.orientation = Quaternion::rotation_z(head_look.x)