adjust skeleton_attr to s_a

This commit is contained in:
jshipsey 2020-10-20 19:05:52 -04:00 committed by Robin Gilh
parent f9f3d33189
commit e5734c1829
66 changed files with 1506 additions and 3189 deletions

View File

@ -30,7 +30,7 @@ impl Animation for AlphaAnimation {
(active_tool_kind, second_tool_kind, velocity, global_time, stage_section): Self::Dependency,
anim_time: f64,
rate: &mut f32,
skeleton_attr: &SkeletonAttr,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
*rate = 1.0;
let mut next = (*skeleton).clone();
@ -91,17 +91,19 @@ impl Animation for AlphaAnimation {
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.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.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.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
next.control.position = Vec3::new(
-7.0,
@ -116,34 +118,25 @@ impl Animation for AlphaAnimation {
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.position = Vec3::new(0.0, s_a.head.0 + 0.0, s_a.head.1);
next.head.orientation = Quaternion::rotation_z(
movement1 * -0.9 + (movement2 * 1.75).sin() * 2.5 + movement3 * -0.5,
);
},
Some(ToolKind::Dagger(_)) => {
next.head.position =
Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1);
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
next.head.orientation = Quaternion::rotation_z(slow * -0.25)
* Quaternion::rotation_x(0.0 + slow * 0.15)
* Quaternion::rotation_y(slow * -0.15);
next.head.scale = Vec3::one() * 1.01;
next.upper_torso.position = Vec3::new(
0.0,
skeleton_attr.upper_torso.0,
skeleton_attr.upper_torso.1,
);
next.upper_torso.position = Vec3::new(0.0, s_a.upper_torso.0, s_a.upper_torso.1);
next.upper_torso.orientation = Quaternion::rotation_z(slow * 0.4)
* Quaternion::rotation_x(0.0 + slow * -0.2)
* Quaternion::rotation_y(slow * 0.2);
next.upper_torso.scale = Vec3::one();
next.lower_torso.position = Vec3::new(
0.0,
skeleton_attr.lower_torso.0,
skeleton_attr.lower_torso.1,
);
next.lower_torso.position = Vec3::new(0.0, s_a.lower_torso.0, s_a.lower_torso.1);
next.lower_torso.orientation = next.upper_torso.orientation * -0.45;
next.hand_l.position = Vec3::new(0.0, 0.0, 0.0);
@ -161,18 +154,18 @@ impl Animation for AlphaAnimation {
next.second.orientation = Quaternion::rotation_x(0.0);
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1 + slow * -3.0 + quick * 3.0 - 4.0,
skeleton_attr.foot.2 + skeleton_attr.foot.2,
-s_a.foot.0,
s_a.foot.1 + slow * -3.0 + quick * 3.0 - 4.0,
s_a.foot.2 + s_a.foot.2,
);
next.foot_l.orientation = Quaternion::rotation_x(slow * 0.6)
* Quaternion::rotation_y((slow * -0.2).max(0.0));
next.foot_l.scale = Vec3::one();
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1 + slow * 3.0 + quick * -3.0 + 5.0,
skeleton_attr.foot.2 + skeleton_attr.foot.2,
s_a.foot.0,
s_a.foot.1 + slow * 3.0 + quick * -3.0 + 5.0,
s_a.foot.2 + s_a.foot.2,
);
next.foot_r.orientation = Quaternion::rotation_x(slow * -0.6)
* Quaternion::rotation_y((slow * 0.2).min(0.0));
@ -185,26 +178,17 @@ impl Animation for AlphaAnimation {
next.torso.scale = Vec3::one() / 8.0 * 1.01;
},
Some(ToolKind::Axe(_)) => {
next.head.position =
Vec3::new(0.0, 0.0 + skeleton_attr.head.0, skeleton_attr.head.1);
next.head.position = Vec3::new(0.0, 0.0 + s_a.head.0, s_a.head.1);
next.head.orientation = Quaternion::rotation_z(0.1 + axe * 0.2)
* Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(0.2);
next.head.scale = Vec3::one() * 1.01;
next.upper_torso.position = Vec3::new(
0.0,
skeleton_attr.upper_torso.0,
skeleton_attr.upper_torso.1,
);
next.upper_torso.position = Vec3::new(0.0, s_a.upper_torso.0, s_a.upper_torso.1);
next.upper_torso.orientation = Quaternion::rotation_z(0.2 + axe * 0.2);
next.upper_torso.scale = Vec3::one();
next.lower_torso.position = Vec3::new(
0.0,
skeleton_attr.lower_torso.0,
skeleton_attr.lower_torso.1,
);
next.lower_torso.position = Vec3::new(0.0, s_a.lower_torso.0, s_a.lower_torso.1);
next.lower_torso.orientation = Quaternion::rotation_z(0.2 + axe * -0.2);
next.hand_l.position = Vec3::new(-0.5, 0.0, 4.0);
@ -234,20 +218,14 @@ impl Animation for AlphaAnimation {
next.torso.scale = Vec3::one() / 8.0 * 1.01;
},
Some(ToolKind::Hammer(_)) => {
next.hand_l.position = Vec3::new(
-skeleton_attr.hand.0 - 7.0,
skeleton_attr.hand.1 - 7.0,
skeleton_attr.hand.2 + 10.0,
);
next.hand_l.position =
Vec3::new(-s_a.hand.0 - 7.0, s_a.hand.1 - 7.0, s_a.hand.2 + 10.0);
next.hand_l.orientation =
Quaternion::rotation_x(0.57) * Quaternion::rotation_z(1.57);
next.hand_l.scale = Vec3::one() * 1.02;
next.hand_r.position = Vec3::new(
skeleton_attr.hand.0 - 7.0,
skeleton_attr.hand.1 - 7.0,
skeleton_attr.hand.2 + 10.0,
);
next.hand_r.position =
Vec3::new(s_a.hand.0 - 7.0, s_a.hand.1 - 7.0, s_a.hand.2 + 10.0);
next.hand_r.orientation =
Quaternion::rotation_x(0.57) * Quaternion::rotation_z(1.57);
next.hand_r.scale = Vec3::one() * 1.02;
@ -258,29 +236,20 @@ impl Animation for AlphaAnimation {
* Quaternion::rotation_z(1.0);
next.main.scale = Vec3::one() * 1.02;
next.head.position =
Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1);
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
next.head.orientation = Quaternion::rotation_z(slower * 0.03)
* Quaternion::rotation_x(-0.3 + slowersmooth * 0.1)
* Quaternion::rotation_y(slower * 0.05 + slowersmooth * 0.06)
* Quaternion::rotation_z((slowersmooth * -0.4).max(0.0));
next.head.scale = Vec3::one() * 1.01;
next.upper_torso.position = Vec3::new(
0.0,
skeleton_attr.upper_torso.0,
skeleton_attr.upper_torso.1,
);
next.upper_torso.position = Vec3::new(0.0, s_a.upper_torso.0, s_a.upper_torso.1);
next.upper_torso.orientation =
Quaternion::rotation_z(slower * 0.18 + slowersmooth * 0.15)
* Quaternion::rotation_x(0.0 + slower * 0.18 + slowersmooth * 0.15)
* Quaternion::rotation_y(0.0);
next.lower_torso.position = Vec3::new(
0.0,
skeleton_attr.lower_torso.0,
skeleton_attr.lower_torso.1,
);
next.lower_torso.position = Vec3::new(0.0, s_a.lower_torso.0, s_a.lower_torso.1);
next.lower_torso.orientation =
Quaternion::rotation_z(slower * -0.1 + slowersmooth * -0.075)
* Quaternion::rotation_x(0.0 + slower * -0.1)
@ -291,14 +260,12 @@ impl Animation for AlphaAnimation {
next.torso.scale = Vec3::one() / 8.0 * 1.01;
if velocity > 0.5 {
next.foot_l.position =
Vec3::new(-skeleton_attr.foot.0, foot * -6.0, skeleton_attr.foot.2);
next.foot_l.position = Vec3::new(-s_a.foot.0, foot * -6.0, s_a.foot.2);
next.foot_l.orientation = Quaternion::rotation_x(foot * -0.4)
* Quaternion::rotation_z((slower * 0.3).max(0.0));
next.foot_l.scale = Vec3::one();
next.foot_r.position =
Vec3::new(skeleton_attr.foot.0, foot * 6.0, skeleton_attr.foot.2);
next.foot_r.position = Vec3::new(s_a.foot.0, foot * 6.0, s_a.foot.2);
next.foot_r.orientation = Quaternion::rotation_x(foot * 0.4)
* Quaternion::rotation_z((slower * 0.3).max(0.0));
next.foot_r.scale = Vec3::one();
@ -307,20 +274,13 @@ impl Animation for AlphaAnimation {
Quaternion::rotation_z(0.0) * Quaternion::rotation_x(-0.15);
next.torso.scale = Vec3::one() / 8.0 * 1.01;
} else {
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
-2.5,
skeleton_attr.foot.2 + (slower * 2.5).max(0.0),
);
next.foot_l.position =
Vec3::new(-s_a.foot.0, -2.5, s_a.foot.2 + (slower * 2.5).max(0.0));
next.foot_l.orientation = Quaternion::rotation_x(slower * -0.2 - 0.2)
* Quaternion::rotation_z((slower * 1.0).max(0.0));
next.foot_l.scale = Vec3::one();
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
3.5 - slower * 2.0,
skeleton_attr.foot.2,
);
next.foot_r.position = Vec3::new(s_a.foot.0, 3.5 - slower * 2.0, s_a.foot.2);
next.foot_r.orientation = Quaternion::rotation_x(slower * 0.1)
* Quaternion::rotation_z((slower * 0.5).max(0.0));
next.foot_r.scale = Vec3::one();
@ -365,11 +325,7 @@ impl Animation for AlphaAnimation {
next.control.scale = Vec3::one();
},
Some(ToolKind::Shield(_)) => {
next.head.position = Vec3::new(
0.0,
0.0 + skeleton_attr.head.0 + decel * 0.8,
skeleton_attr.head.1,
);
next.head.position = Vec3::new(0.0, 0.0 + s_a.head.0 + decel * 0.8, s_a.head.1);
next.head.orientation = Quaternion::rotation_z(decel * 0.25)
* Quaternion::rotation_x(0.0 + decel * 0.1)
* Quaternion::rotation_y(decel * -0.1);
@ -416,35 +372,24 @@ impl Animation for AlphaAnimation {
},
Some(ToolKind::NpcWeapon(_)) => {
if switch > 0.0 {
next.head.position =
Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1) * 1.02;
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1) * 1.02;
next.head.orientation = Quaternion::rotation_z((twist * -0.5).max(-1.0))
* Quaternion::rotation_x(-0.2);
next.head.scale = Vec3::one() * 1.02;
next.upper_torso.position = Vec3::new(
0.0,
skeleton_attr.upper_torso.0,
skeleton_attr.upper_torso.1,
);
next.upper_torso.position =
Vec3::new(0.0, s_a.upper_torso.0, s_a.upper_torso.1);
next.upper_torso.orientation = Quaternion::rotation_z((twist * 0.5).min(1.0))
* Quaternion::rotation_x(0.0);
next.upper_torso.scale = Vec3::one();
next.lower_torso.position = Vec3::new(
0.0,
skeleton_attr.lower_torso.0,
skeleton_attr.lower_torso.1,
);
next.lower_torso.position =
Vec3::new(0.0, s_a.lower_torso.0, s_a.lower_torso.1);
next.lower_torso.orientation = Quaternion::rotation_z((twist * -0.5).max(-1.0))
* Quaternion::rotation_x(0.0);
next.lower_torso.scale = Vec3::one();
next.hand_r.position = Vec3::new(
skeleton_attr.hand.0,
skeleton_attr.hand.1,
skeleton_attr.hand.2,
);
next.hand_r.position = Vec3::new(s_a.hand.0, s_a.hand.1, s_a.hand.2);
next.hand_r.orientation =
Quaternion::rotation_z(-1.5) * Quaternion::rotation_x(0.0);
next.hand_r.scale = Vec3::one() * 1.02;
@ -457,26 +402,19 @@ impl Animation for AlphaAnimation {
next.tail.orientation = Quaternion::rotation_z(twist * 0.5);
} else {
next.head.position =
Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1) * 1.02;
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1) * 1.02;
next.head.orientation = Quaternion::rotation_z((twist * 0.5).min(1.0))
* Quaternion::rotation_x(-0.2);
next.head.scale = Vec3::one() * 1.02;
next.upper_torso.position = Vec3::new(
0.0,
skeleton_attr.upper_torso.0,
skeleton_attr.upper_torso.1,
);
next.upper_torso.position =
Vec3::new(0.0, s_a.upper_torso.0, s_a.upper_torso.1);
next.upper_torso.orientation = Quaternion::rotation_z((twist * -0.5).max(-1.0))
* Quaternion::rotation_x(0.0);
next.upper_torso.scale = Vec3::one();
next.lower_torso.position = Vec3::new(
0.0,
skeleton_attr.lower_torso.0,
skeleton_attr.lower_torso.1,
);
next.lower_torso.position =
Vec3::new(0.0, s_a.lower_torso.0, s_a.lower_torso.1);
next.lower_torso.orientation = Quaternion::rotation_z((twist * 0.5).min(1.0))
* Quaternion::rotation_x(0.0);
next.lower_torso.scale = Vec3::one();
@ -487,11 +425,7 @@ impl Animation for AlphaAnimation {
* Quaternion::rotation_z(0.0);
next.arm_control_l.scale = Vec3::one() * 1.02;
next.hand_l.position = Vec3::new(
-skeleton_attr.hand.0,
skeleton_attr.hand.1,
skeleton_attr.hand.2,
);
next.hand_l.position = Vec3::new(-s_a.hand.0, s_a.hand.1, s_a.hand.2);
next.hand_l.orientation =
Quaternion::rotation_z(1.5) * Quaternion::rotation_x(0.0);
next.hand_l.scale = Vec3::one() * 1.02;

View File

@ -8,9 +8,6 @@ use common::{
};
use std::f32::consts::PI;
pub struct Input {
pub attack: bool,
}
pub struct BeamAnimation;
impl Animation for BeamAnimation {
@ -33,7 +30,7 @@ impl Animation for BeamAnimation {
(active_tool_kind, second_tool_kind, _global_time, velocity, stage_section): Self::Dependency,
anim_time: f64,
rate: &mut f32,
skeleton_attr: &SkeletonAttr,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
*rate = 1.0;
let mut next = (*skeleton).clone();
@ -105,19 +102,13 @@ impl Animation for BeamAnimation {
next.head.orientation =
Quaternion::rotation_z(movement1 * -0.5 + (movement2 * 16.0).sin() * 0.05);
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1 + movement1 * -3.0,
skeleton_attr.foot.2,
);
next.foot_l.position =
Vec3::new(-s_a.foot.0, s_a.foot.1 + movement1 * -3.0, s_a.foot.2);
next.foot_l.orientation = Quaternion::rotation_x(movement1 * -0.5)
* Quaternion::rotation_z(movement1 * 0.5);
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1 + movement1 * 4.0,
skeleton_attr.foot.2,
);
next.foot_r.position =
Vec3::new(s_a.foot.0, s_a.foot.1 + movement1 * 4.0, s_a.foot.2);
next.foot_r.orientation = Quaternion::rotation_z(movement1 * 0.5);
next.upper_torso.orientation =
Quaternion::rotation_x(movement1 * -0.2 + (movement2 * 8.0).sin() * 0.05)

View File

@ -2,10 +2,7 @@ use super::{
super::{vek::*, Animation},
BipedLargeSkeleton, SkeletonAttr,
};
use common::{
comp::item::ToolKind,
states::utils::StageSection,
};
use common::{comp::item::ToolKind, states::utils::StageSection};
pub struct BetaAnimation;
@ -28,7 +25,7 @@ impl Animation for BetaAnimation {
(active_tool_kind, _second_tool_kind, _velocity, _global_time, stage_section): Self::Dependency,
anim_time: f64,
rate: &mut f32,
skeleton_attr: &SkeletonAttr,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
*rate = 1.0;
let mut next = (*skeleton).clone();
@ -43,20 +40,24 @@ impl Animation for BetaAnimation {
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.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.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.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
next.control.position = Vec3::new(
-8.0 + movement1 * -5.0 + (movement2 as f32 * 2.5).sin() * 30.0 + movement3 * -5.0,
-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,
);
@ -67,13 +68,15 @@ impl Animation for BetaAnimation {
* Quaternion::rotation_z(1.0 + (movement2 as f32 * 2.5).sin() * 1.0);
next.upper_torso.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,
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,
);
}
},
_ => {},
}
@ -81,4 +84,4 @@ impl Animation for BetaAnimation {
next
}
}
}

View File

@ -27,7 +27,7 @@ impl Animation for ChargeAnimation {
(active_tool_kind, _second_tool_kind, velocity, orientation, last_ori, global_time): Self::Dependency,
anim_time: f64,
_rate: &mut f32,
skeleton_attr: &SkeletonAttr,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
@ -114,89 +114,50 @@ impl Animation for ChargeAnimation {
0.0
} * 1.3;
next.head.position = Vec3::new(
stop * -2.0,
-3.5 + stop * 2.5 + skeleton_attr.head.0,
skeleton_attr.head.1,
);
next.head.position = Vec3::new(stop * -2.0, -3.5 + stop * 2.5 + s_a.head.0, s_a.head.1);
next.head.orientation =
Quaternion::rotation_z(stop * -1.0 + tilt * -2.0) * Quaternion::rotation_y(stop * -0.3);
next.head.scale = Vec3::one() * 1.02;
next.upper_torso.position = Vec3::new(
0.0,
skeleton_attr.upper_torso.0,
skeleton_attr.upper_torso.1,
);
next.upper_torso.position = Vec3::new(0.0, s_a.upper_torso.0, s_a.upper_torso.1);
next.upper_torso.orientation =
Quaternion::rotation_z(stop * 1.2 + stress * stop * 0.02 + tilt * -2.0);
next.lower_torso.position = Vec3::new(
0.0,
skeleton_attr.lower_torso.0,
skeleton_attr.lower_torso.1,
);
next.lower_torso.position = Vec3::new(0.0, s_a.lower_torso.0, s_a.lower_torso.1);
next.lower_torso.orientation = Quaternion::rotation_z(stop * -0.7 + tilt * 4.0);
if velocity < 0.5 {
next.jaw.position = Vec3::new(
0.0,
skeleton_attr.jaw.0 - slower * 0.12,
skeleton_attr.jaw.1 + slow * 0.2,
);
next.jaw.position = Vec3::new(0.0, s_a.jaw.0 - slower * 0.12, s_a.jaw.1 + slow * 0.2);
next.jaw.orientation = Quaternion::rotation_x(slow * 0.05);
next.jaw.scale = Vec3::one() * 0.98;
next.tail.position = Vec3::new(0.0, skeleton_attr.tail.0, skeleton_attr.tail.1);
next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1);
next.tail.orientation =
Quaternion::rotation_z(0.0 + slow * 0.2 + tailmove.x) * Quaternion::rotation_x(0.0);
next.tail.scale = Vec3::one();
next.shoulder_l.position = Vec3::new(
-skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1,
skeleton_attr.shoulder.2,
);
next.shoulder_l.position = Vec3::new(-s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2);
next.shoulder_l.orientation = Quaternion::rotation_z(0.0) * 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.position = Vec3::new(s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2);
next.shoulder_r.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.shoulder_r.scale = Vec3::one();
next.leg_l.position = Vec3::new(
-skeleton_attr.leg.0,
skeleton_attr.leg.1,
skeleton_attr.leg.2 + breathe * 0.2,
) * 1.02;
next.leg_l.position =
Vec3::new(-s_a.leg.0, s_a.leg.1, s_a.leg.2 + breathe * 0.2) * 1.02;
next.leg_l.orientation = Quaternion::rotation_z(0.0);
next.leg_l.scale = Vec3::one() * 1.02;
next.leg_r.position = Vec3::new(
skeleton_attr.leg.0,
skeleton_attr.leg.1,
skeleton_attr.leg.2 + breathe * 0.2,
) * 1.02;
next.leg_r.position = Vec3::new(s_a.leg.0, s_a.leg.1, s_a.leg.2 + breathe * 0.2) * 1.02;
next.leg_r.orientation = Quaternion::rotation_z(0.0);
next.leg_r.scale = Vec3::one() * 1.02;
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1,
skeleton_attr.foot.2,
);
next.foot_l.position = Vec3::new(-s_a.foot.0, s_a.foot.1, s_a.foot.2);
next.foot_l.orientation = Quaternion::rotation_z(0.0);
next.foot_l.scale = Vec3::one();
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1,
skeleton_attr.foot.2,
);
next.foot_r.position = Vec3::new(s_a.foot.0, s_a.foot.1, s_a.foot.2);
next.foot_r.orientation = Quaternion::rotation_z(0.0);
next.foot_r.scale = Vec3::one();
@ -210,15 +171,11 @@ impl Animation for ChargeAnimation {
* Quaternion::rotation_z(test * 0.02);
next.control.scale = Vec3::one();
} else {
next.jaw.position = Vec3::new(
0.0,
skeleton_attr.jaw.0 - slower * 0.12,
skeleton_attr.jaw.1 + slow * 0.2,
);
next.jaw.position = Vec3::new(0.0, s_a.jaw.0 - slower * 0.12, s_a.jaw.1 + slow * 0.2);
next.jaw.orientation = Quaternion::rotation_x(slow * 0.05);
next.jaw.scale = Vec3::one() * 0.98;
next.tail.position = Vec3::new(0.0, skeleton_attr.tail.0, skeleton_attr.tail.1);
next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1);
next.tail.orientation =
Quaternion::rotation_z(0.0 + slow * 0.2 + tailmove.x) * Quaternion::rotation_x(0.0);
next.tail.scale = Vec3::one();
@ -227,38 +184,30 @@ impl Animation for ChargeAnimation {
next.torso.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(-0.25);
next.torso.scale = Vec3::one() / 8.0;
next.leg_l.position = Vec3::new(
-skeleton_attr.leg.0,
skeleton_attr.leg.1,
skeleton_attr.leg.2,
) * 0.98;
next.leg_l.position = Vec3::new(-s_a.leg.0, s_a.leg.1, s_a.leg.2) * 0.98;
next.leg_l.orientation =
Quaternion::rotation_z(short * 0.18) * Quaternion::rotation_x(foothoril * 0.3);
next.leg_l.scale = Vec3::one() * 0.98;
next.leg_r.position = Vec3::new(
skeleton_attr.leg.0,
skeleton_attr.leg.1,
skeleton_attr.leg.2,
) * 0.98;
next.leg_r.position = Vec3::new(s_a.leg.0, s_a.leg.1, s_a.leg.2) * 0.98;
next.leg_r.orientation =
Quaternion::rotation_z(short * 0.18) * Quaternion::rotation_x(foothorir * 0.3);
next.leg_r.scale = Vec3::one() * 0.98;
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
4.0 + skeleton_attr.foot.1 + foothoril * 8.5,
skeleton_attr.foot.2 + ((footvertl * 6.5).max(0.0)),
-s_a.foot.0,
4.0 + s_a.foot.1 + foothoril * 8.5,
s_a.foot.2 + ((footvertl * 6.5).max(0.0)),
);
next.foot_l.orientation =
Quaternion::rotation_x(-0.5 + footrotl * 0.85) * Quaternion::rotation_y(0.0);
next.foot_l.scale = Vec3::one();
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
4.0 + skeleton_attr.foot.1 + foothorir * 8.5,
skeleton_attr.foot.2 + ((footvertr * 6.5).max(0.0)),
s_a.foot.0,
4.0 + s_a.foot.1 + foothorir * 8.5,
s_a.foot.2 + ((footvertr * 6.5).max(0.0)),
);
next.foot_r.orientation =
Quaternion::rotation_x(-0.5 + footrotr * 0.85) * Quaternion::rotation_y(0.0);
@ -279,9 +228,9 @@ impl Animation for ChargeAnimation {
next.hand_r.scale = Vec3::one() * 1.05;
next.shoulder_l.position = Vec3::new(
-skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1 + foothoril * -1.0,
skeleton_attr.shoulder.2,
-s_a.shoulder.0,
s_a.shoulder.1 + foothoril * -1.0,
s_a.shoulder.2,
);
next.shoulder_l.orientation = Quaternion::rotation_x(1.4 + footrotl * -0.06)
* Quaternion::rotation_y(-0.9)
@ -289,19 +238,19 @@ impl Animation for ChargeAnimation {
next.shoulder_l.scale = Vec3::one();
next.shoulder_r.position = Vec3::new(
skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1 + foothorir * -1.0,
skeleton_attr.shoulder.2,
s_a.shoulder.0,
s_a.shoulder.1 + foothorir * -1.0,
s_a.shoulder.2,
);
next.shoulder_r.orientation = Quaternion::rotation_x(1.3 + footrotr * -0.06)
* Quaternion::rotation_y(-0.5) //1.9
* Quaternion::rotation_z(footrotr * -0.05);
next.shoulder_r.scale = Vec3::one();
next.jaw.position = Vec3::new(0.0, skeleton_attr.jaw.0, skeleton_attr.jaw.1);
next.jaw.position = Vec3::new(0.0, s_a.jaw.0, s_a.jaw.1);
next.jaw.orientation = Quaternion::rotation_x(stop * 0.05);
next.tail.position = Vec3::new(0.0, skeleton_attr.tail.0, skeleton_attr.tail.1);
next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1);
next.tail.orientation = Quaternion::rotation_z(0.02 * stress * stop + tilt * 2.0)
* Quaternion::rotation_x(-0.2 * stop);
next.tail.scale = Vec3::one();
@ -334,9 +283,9 @@ impl Animation for ChargeAnimation {
next.hand_r.scale = Vec3::one() * 1.05;
next.shoulder_l.position = Vec3::new(
-skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1 + foothoril * -1.0,
skeleton_attr.shoulder.2,
-s_a.shoulder.0,
s_a.shoulder.1 + foothoril * -1.0,
s_a.shoulder.2,
);
next.shoulder_l.orientation = Quaternion::rotation_x(0.5 + footrotl * -0.16)
* Quaternion::rotation_y(0.1)
@ -344,16 +293,16 @@ impl Animation for ChargeAnimation {
next.shoulder_l.scale = Vec3::one();
next.shoulder_r.position = Vec3::new(
skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1 + foothorir * -1.0,
skeleton_attr.shoulder.2,
s_a.shoulder.0,
s_a.shoulder.1 + foothorir * -1.0,
s_a.shoulder.2,
);
next.shoulder_r.orientation = Quaternion::rotation_x(0.5 + footrotr * -0.16)
* Quaternion::rotation_y(-0.1)
* Quaternion::rotation_z(footrotr * -0.1);
next.shoulder_r.scale = Vec3::one();
next.tail.position = Vec3::new(0.0, skeleton_attr.tail.0, skeleton_attr.tail.1);
next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1);
next.tail.orientation = Quaternion::rotation_z(0.02 * stress * stop + tilt * 2.0)
* Quaternion::rotation_x(-0.2 * stop);
next.tail.scale = Vec3::one();

View File

@ -8,9 +8,6 @@ use common::{
};
use std::f32::consts::PI;
pub struct Input {
pub attack: bool,
}
pub struct DashAnimation;
impl Animation for DashAnimation {
@ -32,7 +29,7 @@ impl Animation for DashAnimation {
(active_tool_kind, second_tool_kind, _global_time, stage_section): Self::Dependency,
anim_time: f64,
rate: &mut f32,
skeleton_attr: &SkeletonAttr,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
*rate = 1.0;
let mut next = (*skeleton).clone();
@ -45,38 +42,33 @@ impl Animation for DashAnimation {
_ => (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())
* ((x * 12.4).sin()) }
fn slow(x: f32) -> f32 {
(((5.0) / (1.1 + 3.9 * ((x * 12.4).sin()).powf(2.0 as f32))).sqrt())
* ((x * 12.4).sin())
}
fn short (x: f32) -> f32 { (((5.0)
/ (1.5 + 3.5 * ((x * 5.0).sin()).powf(2.0 as f32)))
.sqrt())
* ((x * 5.0).sin()) }
fn foothoril (x: f32) -> f32 { (x * 5.0 + PI * 1.45).sin() }
fn foothorir (x: f32) -> f32 { (x * 5.0 + PI * (0.45)).sin() }
fn short(x: f32) -> f32 {
(((5.0) / (1.5 + 3.5 * ((x * 5.0).sin()).powf(2.0 as f32))).sqrt()) * ((x * 5.0).sin())
}
fn foothoril(x: f32) -> f32 { (x * 5.0 + PI * 1.45).sin() }
fn foothorir(x: f32) -> f32 { (x * 5.0 + PI * (0.45)).sin() }
fn footvertl (x: f32) -> f32 { (x * 5.0).sin() }
fn footvertr (x: f32) -> f32 { (x * 5.0 + PI).sin() }
fn footvertl(x: f32) -> f32 { (x * 5.0).sin() }
fn footvertr(x: f32) -> f32 { (x * 5.0 + PI).sin() }
fn footrotl (x: f32) -> f32 { (((1.0)
/ (0.05
+ (0.95)
* ((x * 5.0 + PI * 1.4).sin()).powf(2.0 as f32)))
.sqrt())
* ((x * 5.0 + PI * 1.4).sin()) }
fn footrotl(x: f32) -> f32 {
(((1.0) / (0.05 + (0.95) * ((x * 5.0 + PI * 1.4).sin()).powf(2.0 as f32))).sqrt())
* ((x * 5.0 + PI * 1.4).sin())
}
fn footrotr (x: f32) -> f32 { (((1.0)
/ (0.05
+ (0.95)
* ((x * 5.0 + PI * 0.4).sin()).powf(2.0 as f32)))
.sqrt())
* ((x * 5.0 + PI * 0.4).sin()) }
fn footrotr(x: f32) -> f32 {
(((1.0) / (0.05 + (0.95) * ((x * 5.0 + PI * 0.4).sin()).powf(2.0 as f32))).sqrt())
* ((x * 5.0 + PI * 0.4).sin())
}
fn shortalt (x: f32) -> f32 { (x * 5.0 + PI / 2.0).sin() }
fn shortalt(x: f32) -> f32 { (x * 5.0 + PI / 2.0).sin() }
next.head.position = Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1);
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
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);
@ -92,62 +84,54 @@ impl Animation for DashAnimation {
match active_tool_kind {
//TODO: Inventory
Some(ToolKind::Sword(_)) => {
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)
next.head.position =
Vec3::new(0.0, 0.0 + s_a.head.0, s_a.head.1 + movement2.min(1.0) * 1.0);
next.head.orientation = Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(movement2.min(1.0) * -0.3 + movement3 * 0.3)
* Quaternion::rotation_z(movement1 * -0.9 + movement3 * 1.6);
next.upper_torso.position = Vec3::new(
0.0,
skeleton_attr.upper_torso.0,
skeleton_attr.upper_torso.1 + 2.0 + shortalt(movement2) * -2.5,
s_a.upper_torso.0,
s_a.upper_torso.1 + 2.0 + shortalt(movement2) * -2.5,
);
next.upper_torso.orientation =
Quaternion::rotation_x(movement2.min(1.0) * -0.4 + movement3 * 0.4)
* Quaternion::rotation_y(movement2.min(1.0) * -0.2 + movement3 * 0.3)
* Quaternion::rotation_z(movement1 * 1.1 + movement3 * -2.2);
* Quaternion::rotation_y(movement2.min(1.0) * -0.2 + movement3 * 0.3)
* Quaternion::rotation_z(movement1 * 1.1 + movement3 * -2.2);
next.control.position = Vec3::new(
-7.0 + movement1 * -5.0 + movement3 * -2.0,
7.0 + movement2.min(1.0) * -2.0,
2.0 + movement2.min(1.0) * 2.0
2.0 + movement2.min(1.0) * 2.0,
);
next.control.orientation =
Quaternion::rotation_x(movement1 * -1.0 + movement3 * -0.5)
* Quaternion::rotation_y(movement1 * 1.5 + movement3 * -2.5)
* Quaternion::rotation_z(0.0);
* Quaternion::rotation_y(movement1 * 1.5 + movement3 * -2.5)
* Quaternion::rotation_z(0.0);
next.control.scale = Vec3::one();
next.lower_torso.orientation = Quaternion::rotation_z(short(movement2).min(1.0) * 0.25);
next.lower_torso.orientation =
Quaternion::rotation_z(short(movement2).min(1.0) * 0.25);
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1 + movement1 * -12.0 + foothoril(movement2) * -7.5,
skeleton_attr.foot.2 + ((footvertl(movement2) * -4.0).max(-1.0)),
-s_a.foot.0,
s_a.foot.1 + movement1 * -12.0 + foothoril(movement2) * -7.5,
s_a.foot.2 + ((footvertl(movement2) * -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(movement1 * -1.0 + footrotl(movement2) * -0.6);
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1 + foothorir(movement2) * -7.5,
skeleton_attr.foot.2 + ((footvertr(movement2) * -4.0).max(-1.0)),
s_a.foot.0,
s_a.foot.1 + foothorir(movement2) * -7.5,
s_a.foot.2 + ((footvertr(movement2) * -4.0).max(-1.0)),
);
next.foot_r.orientation =
Quaternion::rotation_x(-0.6 + footrotr(movement2) * -0.6)
next.foot_r.orientation = Quaternion::rotation_x(-0.6 + footrotr(movement2) * -0.6)
* Quaternion::rotation_z(-0.2);
},
Some(ToolKind::Dagger(_)) => {
next.head.position = Vec3::new(
0.0,
skeleton_attr.head.0,
-2.0 + skeleton_attr.head.1,
);
next.head.position = Vec3::new(0.0, s_a.head.0, -2.0 + s_a.head.1);
next.head.orientation = Quaternion::rotation_z(0.0)
* Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(0.0);
@ -158,7 +142,8 @@ impl Animation for DashAnimation {
Quaternion::rotation_x(-0.5) * Quaternion::rotation_z(-0.7);
next.lower_torso.position = Vec3::new(0.0, 3.0, -3.0);
next.lower_torso.orientation = Quaternion::rotation_x(0.4) * Quaternion::rotation_z(0.3);
next.lower_torso.orientation =
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.orientation = Quaternion::rotation_x(1.27);
@ -171,13 +156,13 @@ impl Animation for DashAnimation {
next.main.scale = Vec3::one();
next.control.position = Vec3::new(-8.0 - slow(anim_time as f32) * 0.5, 3.0, 3.0);
next.control.orientation =
Quaternion::rotation_x(-0.3) * Quaternion::rotation_z(1.1 + slow(anim_time as f32) * 0.2);
next.control.orientation = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_z(1.1 + slow(anim_time as f32) * 0.2);
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, s_a.foot.2);
next.foot_l.orientation = Quaternion::rotation_x(-0.8);
next.foot_r.position = Vec3::new(5.4, -1.0, skeleton_attr.foot.2);
next.foot_r.position = Vec3::new(5.4, -1.0, s_a.foot.2);
next.foot_r.orientation = Quaternion::rotation_x(-0.8);
},
_ => {},
@ -185,11 +170,7 @@ impl Animation for DashAnimation {
match second_tool_kind {
//TODO: Inventory
Some(ToolKind::Dagger(_)) => {
next.head.position = Vec3::new(
0.0,
skeleton_attr.head.0,
-2.0 + skeleton_attr.head.1,
);
next.head.position = Vec3::new(0.0, s_a.head.0, -2.0 + s_a.head.1);
next.head.orientation = Quaternion::rotation_z(0.0)
* Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(0.0);
@ -221,10 +202,10 @@ impl Animation for DashAnimation {
next.second.orientation = Quaternion::rotation_x(-0.3);
next.second.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, s_a.foot.2);
next.foot_l.orientation = Quaternion::rotation_x(-0.8);
next.foot_r.position = Vec3::new(5.4, -1.0, skeleton_attr.foot.2);
next.foot_r.position = Vec3::new(5.4, -1.0, s_a.foot.2);
next.foot_r.orientation = Quaternion::rotation_x(-0.8);
},
_ => {},
@ -244,4 +225,4 @@ impl Animation for DashAnimation {
next
}
}
}

View File

@ -19,7 +19,7 @@ impl Animation for IdleAnimation {
global_time: Self::Dependency,
anim_time: f64,
_rate: &mut f32,
skeleton_attr: &SkeletonAttr,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
@ -54,7 +54,7 @@ impl Animation for IdleAnimation {
* 0.125,
);
let breathe = if skeleton_attr.beast {
let breathe = if s_a.beast {
// Controls for the beast breathing
let intensity = 0.04;
let lenght = 1.5;
@ -69,46 +69,32 @@ impl Animation for IdleAnimation {
0.0
};
next.head.position = Vec3::new(
0.0,
skeleton_attr.head.0,
skeleton_attr.head.1 + torso * 0.2,
) * 1.02;
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1 + torso * 0.2) * 1.02;
next.head.orientation =
Quaternion::rotation_z(look.x * 0.6) * Quaternion::rotation_x(look.y * 0.6 + breathe);
next.head.scale = Vec3::one() * 1.02 + breathe * 0.4;
next.upper_torso.position = Vec3::new(
0.0,
skeleton_attr.upper_torso.0,
skeleton_attr.upper_torso.1 + torso * 0.5,
);
next.upper_torso.position =
Vec3::new(0.0, s_a.upper_torso.0, s_a.upper_torso.1 + torso * 0.5);
next.upper_torso.orientation =
Quaternion::rotation_z(0.0) * Quaternion::rotation_x(-breathe);
next.upper_torso.scale = Vec3::one() - breathe * 0.4;
next.lower_torso.position = Vec3::new(
0.0,
skeleton_attr.lower_torso.0,
skeleton_attr.lower_torso.1 + torso * 0.15,
);
next.lower_torso.position =
Vec3::new(0.0, s_a.lower_torso.0, s_a.lower_torso.1 + torso * 0.15);
next.lower_torso.orientation =
Quaternion::rotation_z(0.0) * Quaternion::rotation_x(breathe);
next.lower_torso.scale = Vec3::one() * 1.02 + breathe * 0.4;
if skeleton_attr.beast {
next.jaw.position = Vec3::new(0.0, skeleton_attr.jaw.0, skeleton_attr.jaw.1);
if s_a.beast {
next.jaw.position = Vec3::new(0.0, s_a.jaw.0, s_a.jaw.1);
} else {
next.jaw.position = Vec3::new(
0.0,
skeleton_attr.jaw.0 - slower * 0.12,
skeleton_attr.jaw.1 + slow * 0.2,
);
next.jaw.position = Vec3::new(0.0, s_a.jaw.0 - slower * 0.12, s_a.jaw.1 + slow * 0.2);
}
next.jaw.orientation = Quaternion::rotation_x(-0.1 + breathe * 2.0);
next.jaw.scale = Vec3::one() * 0.98;
next.tail.position = Vec3::new(0.0, skeleton_attr.tail.0, skeleton_attr.tail.1);
next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1);
next.tail.orientation =
Quaternion::rotation_z(0.0 + slow * 0.2 + tailmove.x) * Quaternion::rotation_x(0.0);
next.tail.scale = Vec3::one();
@ -127,35 +113,19 @@ impl Animation for IdleAnimation {
Quaternion::rotation_x(PI) * Quaternion::rotation_y(0.6) * Quaternion::rotation_z(1.57);
next.main.scale = Vec3::one() * 1.02;
next.shoulder_l.position = Vec3::new(
-skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1,
skeleton_attr.shoulder.2,
);
next.shoulder_l.position = Vec3::new(-s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2);
next.shoulder_l.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(breathe);
next.shoulder_l.scale = Vec3::one() + breathe;
next.shoulder_r.position = Vec3::new(
skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1,
skeleton_attr.shoulder.2,
);
next.shoulder_r.position = Vec3::new(s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2);
next.shoulder_r.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(breathe);
next.shoulder_r.scale = Vec3::one() + breathe;
next.hand_l.position = Vec3::new(
-skeleton_attr.hand.0,
skeleton_attr.hand.1,
skeleton_attr.hand.2 + torso * 0.6,
);
next.hand_l.position = Vec3::new(-s_a.hand.0, s_a.hand.1, s_a.hand.2 + torso * 0.6);
next.hand_l.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.hand_l.scale = Vec3::one() * 1.02;
next.hand_r.position = Vec3::new(
skeleton_attr.hand.0,
skeleton_attr.hand.1,
skeleton_attr.hand.2 + torso * 0.6,
);
next.hand_r.position = Vec3::new(s_a.hand.0, s_a.hand.1, s_a.hand.2 + torso * 0.6);
next.hand_r.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.hand_r.scale = Vec3::one() * 1.02;
@ -164,35 +134,19 @@ impl Animation for IdleAnimation {
next.leg_control_l.scale = Vec3::one() * 1.0;
next.leg_l.position = Vec3::new(
-skeleton_attr.leg.0,
skeleton_attr.leg.1,
skeleton_attr.leg.2 + torso * 0.2,
);
next.leg_l.position = Vec3::new(-s_a.leg.0, s_a.leg.1, s_a.leg.2 + torso * 0.2);
next.leg_l.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.leg_l.scale = Vec3::one() * 1.02;
next.leg_r.position = Vec3::new(
skeleton_attr.leg.0,
skeleton_attr.leg.1,
skeleton_attr.leg.2 + torso * 0.2,
);
next.leg_r.position = Vec3::new(s_a.leg.0, s_a.leg.1, s_a.leg.2 + torso * 0.2);
next.leg_r.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.leg_r.scale = Vec3::one() * 1.02;
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1,
skeleton_attr.foot.2 + torso * -0.6,
);
next.foot_l.position = Vec3::new(-s_a.foot.0, s_a.foot.1, s_a.foot.2 + torso * -0.6);
next.foot_l.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.foot_l.scale = Vec3::one();
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1,
skeleton_attr.foot.2 + torso * -0.6,
);
next.foot_r.position = Vec3::new(s_a.foot.0, s_a.foot.1, s_a.foot.2 + torso * -0.6);
next.foot_r.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.foot_r.scale = Vec3::one();

View File

@ -19,7 +19,7 @@ impl Animation for JumpAnimation {
_global_time: Self::Dependency,
anim_time: f64,
_rate: &mut f32,
skeleton_attr: &SkeletonAttr,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
@ -28,39 +28,25 @@ impl Animation for JumpAnimation {
let wave_slow = (anim_time as f32 * 0.8).sin();
next.head.position = Vec3::new(
0.0,
skeleton_attr.head.0,
skeleton_attr.head.1 + torso * 0.2,
) * 1.02;
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1 + torso * 0.2) * 1.02;
next.head.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.head.scale = Vec3::one() * 1.02;
next.upper_torso.position = Vec3::new(
0.0,
skeleton_attr.upper_torso.0,
skeleton_attr.upper_torso.1 + torso * 0.5,
);
next.upper_torso.position =
Vec3::new(0.0, s_a.upper_torso.0, s_a.upper_torso.1 + torso * 0.5);
next.upper_torso.orientation = Quaternion::rotation_x(-0.3);
next.upper_torso.scale = Vec3::one();
next.lower_torso.position = Vec3::new(
0.0,
skeleton_attr.lower_torso.0,
skeleton_attr.lower_torso.1 + torso * 0.15,
);
next.lower_torso.position =
Vec3::new(0.0, s_a.lower_torso.0, s_a.lower_torso.1 + torso * 0.15);
next.lower_torso.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.2);
next.lower_torso.scale = Vec3::one() * 1.02;
next.jaw.position = Vec3::new(0.0, skeleton_attr.jaw.0, skeleton_attr.jaw.1);
next.jaw.position = Vec3::new(0.0, s_a.jaw.0, s_a.jaw.1);
next.jaw.orientation = Quaternion::rotation_x(wave_slow * 0.09);
next.jaw.scale = Vec3::one();
next.tail.position = Vec3::new(
0.0,
skeleton_attr.tail.0,
skeleton_attr.tail.1 + torso * 0.0,
);
next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1 + torso * 0.0);
next.tail.orientation = Quaternion::rotation_z(0.0);
next.tail.scale = Vec3::one();
@ -78,67 +64,35 @@ impl Animation for JumpAnimation {
Quaternion::rotation_x(PI) * Quaternion::rotation_y(0.6) * Quaternion::rotation_z(1.57);
next.main.scale = Vec3::one() * 1.02;
next.shoulder_l.position = Vec3::new(
-skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1,
skeleton_attr.shoulder.2,
);
next.shoulder_l.position = Vec3::new(-s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2);
next.shoulder_l.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.5);
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.position = Vec3::new(s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2);
next.shoulder_r.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(-0.5);
next.shoulder_r.scale = Vec3::one();
next.hand_l.position = Vec3::new(
-skeleton_attr.hand.0,
skeleton_attr.hand.1,
skeleton_attr.hand.2 + torso * 0.6,
);
next.hand_l.position = Vec3::new(-s_a.hand.0, s_a.hand.1, s_a.hand.2 + torso * 0.6);
next.hand_l.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.8);
next.hand_l.scale = Vec3::one() * 1.02;
next.hand_r.position = Vec3::new(
skeleton_attr.hand.0,
skeleton_attr.hand.1,
skeleton_attr.hand.2 + torso * 0.6,
);
next.hand_r.position = Vec3::new(s_a.hand.0, s_a.hand.1, s_a.hand.2 + torso * 0.6);
next.hand_r.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(-0.8);
next.hand_r.scale = Vec3::one() * 1.02;
next.leg_l.position = Vec3::new(
-skeleton_attr.leg.0,
skeleton_attr.leg.1,
skeleton_attr.leg.2 + torso * 0.2,
) * 1.02;
next.leg_l.position = Vec3::new(-s_a.leg.0, s_a.leg.1, s_a.leg.2 + torso * 0.2) * 1.02;
next.leg_l.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(-0.4);
next.leg_l.scale = Vec3::one() * 1.02;
next.leg_r.position = Vec3::new(
skeleton_attr.leg.0,
skeleton_attr.leg.1,
skeleton_attr.leg.2 + torso * 0.2,
) * 1.02;
next.leg_r.position = Vec3::new(s_a.leg.0, s_a.leg.1, s_a.leg.2 + torso * 0.2) * 1.02;
next.leg_r.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.4);
next.leg_r.scale = Vec3::one() * 1.02;
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
-5.0 + skeleton_attr.foot.1,
skeleton_attr.foot.2,
);
next.foot_l.position = Vec3::new(-s_a.foot.0, -5.0 + s_a.foot.1, s_a.foot.2);
next.foot_l.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(-0.4);
next.foot_l.scale = Vec3::one();
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
5.0 + skeleton_attr.foot.1,
skeleton_attr.foot.2,
);
next.foot_r.position = Vec3::new(s_a.foot.0, 5.0 + s_a.foot.1, s_a.foot.2);
next.foot_r.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.4);
next.foot_r.scale = Vec3::one();

View File

@ -29,7 +29,7 @@ impl Animation for LeapAnimation {
(active_tool_kind, second_tool_kind, _velocity, _global_time, stage_section): Self::Dependency,
anim_time: f64,
rate: &mut f32,
skeleton_attr: &SkeletonAttr,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
*rate = 1.0;
let mut next = (*skeleton).clone();
@ -52,7 +52,7 @@ impl Animation for LeapAnimation {
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.head.position = Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1);
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
next.control.position = Vec3::new(
6.0 + movement1 * -10.0,
@ -74,16 +74,16 @@ impl Animation for LeapAnimation {
next.hand_l.position = Vec3::new(-12.0 + movement3 * 10.0, 0.0, 0.0);
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1 - 5.0 + movement3 * 13.0,
skeleton_attr.foot.2 + movement3 * -5.0,
-s_a.foot.0,
s_a.foot.1 - 5.0 + movement3 * 13.0,
s_a.foot.2 + movement3 * -5.0,
);
next.foot_l.orientation = Quaternion::rotation_x(-0.8 + movement3 * 1.7);
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1 + 8.0 + movement3 * -13.0,
skeleton_attr.foot.2 + 5.0 + movement3 * -5.0,
s_a.foot.0,
s_a.foot.1 + 8.0 + movement3 * -13.0,
s_a.foot.2 + 5.0 + movement3 * -5.0,
);
next.foot_r.orientation = Quaternion::rotation_x(0.9 + movement3 * -1.7);
} else if let Some(ToolKind::Axe(_)) = active_tool_kind {
@ -108,7 +108,7 @@ impl Animation for LeapAnimation {
* Quaternion::rotation_z(PI - 0.2);
next.control.scale = Vec3::one();
next.head.position = Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1);
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
next.control.position = Vec3::new(
-3.0 + movement1 * 3.0,
@ -129,25 +129,25 @@ impl Animation for LeapAnimation {
Quaternion::rotation_x(0.0 + movement1 * -0.4 + movement2 * 0.4 + movement3 * 0.2);
next.foot_l.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,
s_a.foot.0,
s_a.foot.1 + movement2 * 4.0 + movement3 * -8.0,
s_a.foot.2 - 8.0 + movement2 * 3.0 + movement3 * -3.0,
);
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,
s_a.foot.0,
s_a.foot.1 + movement2 * 4.0 + movement3 * -8.0,
s_a.foot.2 - 8.0 + movement2 * 3.0 + movement3 * -3.0,
);
next.foot_l.orientation = Quaternion::rotation_x(movement1 * 0.9 - movement3 * 1.8);
next.foot_r.orientation = Quaternion::rotation_x(movement1 * 0.9 - movement3 * 1.8);
next.lower_torso.orientation = Quaternion::rotation_x(movement1 * 0.3 + movement2 * 0.1);
next.lower_torso.orientation =
Quaternion::rotation_x(movement1 * 0.3 + movement2 * 0.1);
next.upper_torso.position =
Vec3::new(0.0, skeleton_attr.upper_torso.0, skeleton_attr.upper_torso.1 - 8.0);
next.upper_torso.position = Vec3::new(0.0, s_a.upper_torso.0, s_a.upper_torso.1 - 8.0);
next.torso.position = Vec3::new(0.0, 0.0, 0.0 + 8.0);
}
@ -161,4 +161,4 @@ impl Animation for LeapAnimation {
next
}
}
}

View File

@ -19,7 +19,7 @@ impl Animation for RunAnimation {
(velocity, orientation, last_ori, global_time, avg_vel): Self::Dependency,
anim_time: f64,
rate: &mut f32,
skeleton_attr: &SkeletonAttr,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let speed = Vec2::<f32>::from(velocity).magnitude();
@ -127,8 +127,8 @@ impl Animation for RunAnimation {
let x_tilt = avg_vel.z.atan2(avg_vel.xy().magnitude());
if skeleton_attr.beast {
next.head.position = Vec3::new(0.0, skeleton_attr.head.0, 3.0 + skeleton_attr.head.1);
if s_a.beast {
next.head.position = Vec3::new(0.0, s_a.head.0, 3.0 + s_a.head.1);
next.head.orientation = Quaternion::rotation_x(
look.y * 0.3 + (speedavg * 0.05) + amplitude * short * -0.18,
) * Quaternion::rotation_z(
@ -136,11 +136,11 @@ impl Animation for RunAnimation {
) * Quaternion::rotation_y(tilt * 0.8);
next.head.scale = Vec3::one();
next.jaw.position = Vec3::new(0.0, skeleton_attr.jaw.0, skeleton_attr.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.scale = Vec3::one() * 1.02;
next.tail.position = Vec3::new(0.0, skeleton_attr.tail.0, skeleton_attr.tail.1);
next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1);
next.tail.orientation =
Quaternion::rotation_x(canceler * 1.0 + amplitude * shortalt * 0.1)
* Quaternion::rotation_z(tilt * 1.5);
@ -148,8 +148,8 @@ impl Animation for RunAnimation {
next.upper_torso.position = Vec3::new(
0.0,
skeleton_attr.upper_torso.0,
skeleton_attr.upper_torso.1, //xtilt
s_a.upper_torso.0,
s_a.upper_torso.1, //xtilt
);
next.upper_torso.orientation = Quaternion::rotation_x(
(amplitude * (short * -0.0).max(-0.2)) + 0.0 * (canceler * 6.0).min(1.0), //x_tilt
@ -157,11 +157,7 @@ impl Animation for RunAnimation {
* Quaternion::rotation_z(tilt * -1.5);
next.upper_torso.scale = Vec3::one();
next.lower_torso.position = Vec3::new(
0.0,
skeleton_attr.lower_torso.0,
skeleton_attr.lower_torso.1,
);
next.lower_torso.position = Vec3::new(0.0, s_a.lower_torso.0, s_a.lower_torso.1);
next.lower_torso.orientation =
Quaternion::rotation_x(amplitude * short * -0.25 + canceler * -0.4)
* Quaternion::rotation_z(tilt * 1.8)
@ -190,24 +186,16 @@ impl Animation for RunAnimation {
* Quaternion::rotation_y(tilt * 1.5);
next.arm_control_r.scale = Vec3::one() * 1.02;
next.shoulder_l.position = Vec3::new(
-skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1,
skeleton_attr.shoulder.2,
);
next.shoulder_l.position = Vec3::new(-s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2);
next.shoulder_l.scale = Vec3::one() * 1.02;
next.shoulder_r.position = Vec3::new(
skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1,
skeleton_attr.shoulder.2,
);
next.shoulder_r.position = Vec3::new(s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2);
next.shoulder_r.scale = Vec3::one() * 1.02;
next.hand_l.position = Vec3::new(
-skeleton_attr.hand.0,
skeleton_attr.hand.1 + foot1a * 1.0,
skeleton_attr.hand.2 + (foot1a * -3.0).max(1.0) * amplitude2,
-s_a.hand.0,
s_a.hand.1 + foot1a * 1.0,
s_a.hand.2 + (foot1a * -3.0).max(1.0) * amplitude2,
);
next.hand_l.orientation =
Quaternion::rotation_x(amplitude2 * foot1b * 0.9 + canceler * 0.9)
@ -215,9 +203,9 @@ impl Animation for RunAnimation {
next.hand_l.scale = Vec3::one() * 0.96;
next.hand_r.position = Vec3::new(
skeleton_attr.hand.0,
skeleton_attr.hand.1 + foot2a * 1.0,
skeleton_attr.hand.2 + (foot2a * -3.0).max(1.0) * amplitude2,
s_a.hand.0,
s_a.hand.1 + foot2a * 1.0,
s_a.hand.2 + (foot2a * -3.0).max(1.0) * amplitude2,
);
next.hand_r.orientation =
Quaternion::rotation_x(amplitude2 * foot2b * 0.9 + canceler * 0.7)
@ -246,33 +234,25 @@ impl Animation for RunAnimation {
* Quaternion::rotation_z(tilt * -1.5);
next.leg_control_r.scale = Vec3::one() * 1.02;
next.leg_l.position = Vec3::new(
-skeleton_attr.leg.0,
skeleton_attr.leg.1,
skeleton_attr.leg.2,
);
next.leg_l.position = Vec3::new(-s_a.leg.0, s_a.leg.1, s_a.leg.2);
next.leg_l.scale = Vec3::one() * 1.0;
next.leg_r.position = Vec3::new(
skeleton_attr.leg.0,
skeleton_attr.leg.1,
skeleton_attr.leg.2,
);
next.leg_r.position = Vec3::new(s_a.leg.0, s_a.leg.1, s_a.leg.2);
next.leg_r.scale = Vec3::one() * 1.0;
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1 + foot3a * 2.0,
skeleton_attr.foot.2 + (foot3b * 4.0 * amplitude2).max(-1.0),
-s_a.foot.0,
s_a.foot.1 + foot3a * 2.0,
s_a.foot.2 + (foot3b * 4.0 * amplitude2).max(-1.0),
);
next.foot_l.orientation = Quaternion::rotation_x(amplitude2 * foot3b * 0.45 + 0.5)
* Quaternion::rotation_y(tilt * -1.0);
next.foot_l.scale = Vec3::one() * 0.96;
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1 + foot4a * 2.0,
skeleton_attr.foot.2 + (foot4b * 4.0 * amplitude2).max(-1.0),
s_a.foot.0,
s_a.foot.1 + foot4a * 2.0,
s_a.foot.2 + (foot4b * 4.0 * amplitude2).max(-1.0),
);
next.foot_r.orientation = Quaternion::rotation_x(amplitude2 * foot4b * 0.45 + 0.5)
* Quaternion::rotation_y(tilt * -1.0);
@ -289,33 +269,26 @@ impl Animation for RunAnimation {
next.hold.scale = Vec3::one() * 0.0;
} else {
next.head.position = Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1) * 1.02;
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1) * 1.02;
next.head.orientation =
Quaternion::rotation_z(short * -0.18) * Quaternion::rotation_x(-0.05);
next.head.scale = Vec3::one() * 1.02;
next.upper_torso.position = Vec3::new(
0.0,
skeleton_attr.upper_torso.0,
skeleton_attr.upper_torso.1 + shortalt * -1.5,
);
next.upper_torso.position =
Vec3::new(0.0, s_a.upper_torso.0, s_a.upper_torso.1 + shortalt * -1.5);
next.upper_torso.orientation = Quaternion::rotation_z(short * 0.18);
next.upper_torso.scale = Vec3::one();
next.lower_torso.position = Vec3::new(
0.0,
skeleton_attr.lower_torso.0,
skeleton_attr.lower_torso.1,
);
next.lower_torso.position = Vec3::new(0.0, s_a.lower_torso.0, s_a.lower_torso.1);
next.lower_torso.orientation =
Quaternion::rotation_z(short * 0.15) * Quaternion::rotation_x(0.14);
next.lower_torso.scale = Vec3::one() * 1.02;
next.jaw.position = Vec3::new(0.0, skeleton_attr.jaw.0, skeleton_attr.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.scale = Vec3::one() * 1.02;
next.tail.position = Vec3::new(0.0, skeleton_attr.tail.0, skeleton_attr.tail.1);
next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1);
next.tail.orientation = Quaternion::rotation_x(shortalt * 0.3);
next.tail.scale = Vec3::one();
@ -336,9 +309,9 @@ impl Animation for RunAnimation {
next.main.scale = Vec3::one() * 1.02;
next.shoulder_l.position = Vec3::new(
-skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1 + foothoril * -3.0,
skeleton_attr.shoulder.2,
-s_a.shoulder.0,
s_a.shoulder.1 + foothoril * -3.0,
s_a.shoulder.2,
);
next.shoulder_l.orientation = Quaternion::rotation_x(footrotl * -0.36)
* Quaternion::rotation_y(0.1)
@ -346,9 +319,9 @@ impl Animation for RunAnimation {
next.shoulder_l.scale = Vec3::one();
next.shoulder_r.position = Vec3::new(
skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1 + foothorir * -3.0,
skeleton_attr.shoulder.2,
s_a.shoulder.0,
s_a.shoulder.1 + foothorir * -3.0,
s_a.shoulder.2,
);
next.shoulder_r.orientation = Quaternion::rotation_x(footrotr * -0.36)
* Quaternion::rotation_y(-0.1)
@ -356,55 +329,47 @@ impl Animation for RunAnimation {
next.shoulder_r.scale = Vec3::one();
next.hand_l.position = Vec3::new(
-1.0 + -skeleton_attr.hand.0,
skeleton_attr.hand.1 + foothoril * -4.0,
skeleton_attr.hand.2 + foothoril * 1.0,
-1.0 + -s_a.hand.0,
s_a.hand.1 + foothoril * -4.0,
s_a.hand.2 + foothoril * 1.0,
);
next.hand_l.orientation = Quaternion::rotation_x(0.15 + (handhoril * -1.2).max(-0.3))
* Quaternion::rotation_y(handhoril * -0.1);
next.hand_l.scale = Vec3::one() * 1.02;
next.hand_r.position = Vec3::new(
1.0 + skeleton_attr.hand.0,
skeleton_attr.hand.1 + foothorir * -4.0,
skeleton_attr.hand.2 + foothorir * 1.0,
1.0 + s_a.hand.0,
s_a.hand.1 + foothorir * -4.0,
s_a.hand.2 + foothorir * 1.0,
);
next.hand_r.orientation = Quaternion::rotation_x(0.15 + (handhorir * -1.2).max(-0.3))
* Quaternion::rotation_y(handhorir * 0.1);
next.hand_r.scale = Vec3::one() * 1.02;
next.leg_l.position = Vec3::new(
-skeleton_attr.leg.0,
skeleton_attr.leg.1,
skeleton_attr.leg.2,
) * 0.98;
next.leg_l.position = Vec3::new(-s_a.leg.0, s_a.leg.1, s_a.leg.2) * 0.98;
next.leg_l.orientation =
Quaternion::rotation_z(short * 0.18) * Quaternion::rotation_x(foothoril * 0.3);
next.leg_l.scale = Vec3::one() * 0.98;
next.leg_r.position = Vec3::new(
skeleton_attr.leg.0,
skeleton_attr.leg.1,
skeleton_attr.leg.2,
) * 0.98;
next.leg_r.position = Vec3::new(s_a.leg.0, s_a.leg.1, s_a.leg.2) * 0.98;
next.leg_r.orientation =
Quaternion::rotation_z(short * 0.18) * Quaternion::rotation_x(foothorir * 0.3);
next.leg_r.scale = Vec3::one() * 0.98;
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1 + foothoril * 8.5,
skeleton_attr.foot.2 + ((footvertl * 6.5).max(0.0)),
-s_a.foot.0,
s_a.foot.1 + foothoril * 8.5,
s_a.foot.2 + ((footvertl * 6.5).max(0.0)),
);
next.foot_l.orientation =
Quaternion::rotation_x(-0.5 + footrotl * 0.85) * Quaternion::rotation_y(0.0);
next.foot_l.scale = Vec3::one();
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1 + foothorir * 8.5,
skeleton_attr.foot.2 + ((footvertr * 6.5).max(0.0)),
s_a.foot.0,
s_a.foot.1 + foothorir * 8.5,
s_a.foot.2 + ((footvertr * 6.5).max(0.0)),
);
next.foot_r.orientation =
Quaternion::rotation_x(-0.5 + footrotr * 0.85) * Quaternion::rotation_y(0.0);

View File

@ -8,9 +8,6 @@ use common::{
};
use std::f32::consts::PI;
pub struct Input {
pub attack: bool,
}
pub struct ShockwaveAnimation;
impl Animation for ShockwaveAnimation {
@ -33,27 +30,21 @@ impl Animation for ShockwaveAnimation {
(active_tool_kind, second_tool_kind, _global_time, velocity, stage_section): Self::Dependency,
anim_time: f64,
rate: &mut f32,
skeleton_attr: &SkeletonAttr,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
*rate = 1.0;
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)
},
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);
next.head.position = Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1);
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
next.hand_l.position = Vec3::new(0.0, 0.0, -4.0);
next.hand_l.orientation = Quaternion::rotation_x(1.27) * Quaternion::rotation_y(0.0);
@ -78,43 +69,40 @@ impl Animation for ShockwaveAnimation {
);
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);
* Quaternion::rotation_y(
0.15 + movement1 * -0.15 + movement2 * 0.3 + movement3 * -0.45,
)
* Quaternion::rotation_z(movement1 * 0.8 + movement2 * -0.8);
next.head.orientation =
Quaternion::rotation_x(movement1 * 0.4 + movement3 * -0.4)
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.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,
s_a.upper_torso.0,
s_a.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)
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);
next.lower_torso.orientation =
Quaternion::rotation_x(movement2 * 0.3 + movement3 * -0.3)
next.lower_torso.orientation = Quaternion::rotation_x(movement2 * 0.3 + movement3 * -0.3)
* Quaternion::rotation_z(twist + movement2 * -0.8);
if velocity < 0.5 {
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1 + movement1 * -7.0 + movement2 * 7.0,
skeleton_attr.foot.2,
-s_a.foot.0,
s_a.foot.1 + movement1 * -7.0 + movement2 * 7.0,
s_a.foot.2,
);
next.foot_l.orientation =
Quaternion::rotation_x(movement1 * -0.8 + movement2 * 0.8)
next.foot_l.orientation = Quaternion::rotation_x(movement1 * -0.8 + movement2 * 0.8)
* Quaternion::rotation_z(movement1 * 0.3 + movement2 * -0.3);
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1 + movement1 * 5.0 + movement2 * -5.0,
skeleton_attr.foot.2,
s_a.foot.0,
s_a.foot.1 + movement1 * 5.0 + movement2 * -5.0,
s_a.foot.2,
);
next.foot_r.orientation =
Quaternion::rotation_y(movement1 * -0.3 + movement2 * 0.3)
next.foot_r.orientation = Quaternion::rotation_y(movement1 * -0.3 + movement2 * 0.3)
* Quaternion::rotation_z(movement1 * 0.4 + movement2 * -0.4);
}
next.second.scale = match (
@ -127,4 +115,4 @@ impl Animation for ShockwaveAnimation {
next
}
}
}

View File

@ -20,7 +20,7 @@ impl Animation for ShootAnimation {
(active_tool_kind, _second_tool_kind, velocity, global_time): Self::Dependency,
anim_time: f64,
_rate: &mut f32,
skeleton_attr: &SkeletonAttr,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
@ -95,91 +95,54 @@ impl Animation for ShootAnimation {
next.hold.scale = Vec3::one() * 0.0;
if velocity < 0.5 {
next.head.position = Vec3::new(
0.0,
skeleton_attr.head.0,
skeleton_attr.head.1 + breathe * 0.2,
) * 1.02;
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1 + breathe * 0.2) * 1.02;
next.head.orientation =
Quaternion::rotation_z(look.x * 0.6) * Quaternion::rotation_x(look.y * 0.6);
next.head.scale = Vec3::one() * 1.02;
next.upper_torso.position = Vec3::new(
0.0,
skeleton_attr.upper_torso.0,
skeleton_attr.upper_torso.1 + breathe * 0.5,
);
next.upper_torso.position =
Vec3::new(0.0, s_a.upper_torso.0, s_a.upper_torso.1 + breathe * 0.5);
next.upper_torso.orientation =
Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.upper_torso.scale = Vec3::one();
next.lower_torso.position = Vec3::new(
0.0,
skeleton_attr.lower_torso.0,
skeleton_attr.lower_torso.1 + breathe * 0.15,
);
next.lower_torso.position =
Vec3::new(0.0, s_a.lower_torso.0, s_a.lower_torso.1 + breathe * 0.15);
next.lower_torso.orientation =
Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.lower_torso.scale = Vec3::one() * 1.02;
next.jaw.position = Vec3::new(
0.0,
skeleton_attr.jaw.0 - slower * 0.12,
skeleton_attr.jaw.1 + slow * 0.2,
);
next.jaw.position = Vec3::new(0.0, s_a.jaw.0 - slower * 0.12, s_a.jaw.1 + slow * 0.2);
next.jaw.orientation = Quaternion::rotation_x(slow * 0.05);
next.jaw.scale = Vec3::one() * 0.98;
next.tail.position = Vec3::new(0.0, skeleton_attr.tail.0, skeleton_attr.tail.1);
next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1);
next.tail.orientation =
Quaternion::rotation_z(0.0 + slow * 0.2 + tailmove.x) * Quaternion::rotation_x(0.0);
next.tail.scale = Vec3::one();
next.shoulder_l.position = Vec3::new(
-skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1,
skeleton_attr.shoulder.2,
);
next.shoulder_l.position = Vec3::new(-s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2);
next.shoulder_l.orientation = Quaternion::rotation_z(0.0) * 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.position = Vec3::new(s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2);
next.shoulder_r.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.shoulder_r.scale = Vec3::one();
next.leg_l.position = Vec3::new(
-skeleton_attr.leg.0,
skeleton_attr.leg.1,
skeleton_attr.leg.2 + breathe * 0.2,
) * 1.02;
next.leg_l.position =
Vec3::new(-s_a.leg.0, s_a.leg.1, s_a.leg.2 + breathe * 0.2) * 1.02;
next.leg_l.orientation = Quaternion::rotation_z(0.0);
next.leg_l.scale = Vec3::one() * 1.02;
next.leg_r.position = Vec3::new(
skeleton_attr.leg.0,
skeleton_attr.leg.1,
skeleton_attr.leg.2 + breathe * 0.2,
) * 1.02;
next.leg_r.position = Vec3::new(s_a.leg.0, s_a.leg.1, s_a.leg.2 + breathe * 0.2) * 1.02;
next.leg_r.orientation = Quaternion::rotation_z(0.0);
next.leg_r.scale = Vec3::one() * 1.02;
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1,
skeleton_attr.foot.2,
);
next.foot_l.position = Vec3::new(-s_a.foot.0, s_a.foot.1, s_a.foot.2);
next.foot_l.orientation = Quaternion::rotation_z(0.0);
next.foot_l.scale = Vec3::one();
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1,
skeleton_attr.foot.2,
);
next.foot_r.position = Vec3::new(s_a.foot.0, s_a.foot.1, s_a.foot.2);
next.foot_r.orientation = Quaternion::rotation_z(0.0);
next.foot_r.scale = Vec3::one();
@ -193,45 +156,34 @@ impl Animation for ShootAnimation {
* Quaternion::rotation_z(test * 0.02);
next.control.scale = Vec3::one();
} else {
next.head.position = Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1) * 1.02;
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1) * 1.02;
next.head.orientation =
Quaternion::rotation_z(short * -0.18) * Quaternion::rotation_x(-0.05);
next.head.scale = Vec3::one() * 1.02;
next.upper_torso.position = Vec3::new(
0.0,
skeleton_attr.upper_torso.0,
skeleton_attr.upper_torso.1 + shortalt * -1.5,
);
next.upper_torso.position =
Vec3::new(0.0, s_a.upper_torso.0, s_a.upper_torso.1 + shortalt * -1.5);
next.upper_torso.orientation = Quaternion::rotation_z(short * 0.18);
next.upper_torso.scale = Vec3::one();
next.lower_torso.position = Vec3::new(
0.0,
skeleton_attr.lower_torso.0,
skeleton_attr.lower_torso.1,
);
next.lower_torso.position = Vec3::new(0.0, s_a.lower_torso.0, s_a.lower_torso.1);
next.lower_torso.orientation =
Quaternion::rotation_z(short * 0.15) * Quaternion::rotation_x(0.14);
next.lower_torso.scale = Vec3::one() * 1.02;
next.jaw.position = Vec3::new(
0.0,
skeleton_attr.jaw.0 - slower * 0.12,
skeleton_attr.jaw.1 + slow * 0.2,
);
next.jaw.position = Vec3::new(0.0, s_a.jaw.0 - slower * 0.12, s_a.jaw.1 + slow * 0.2);
next.jaw.orientation = Quaternion::rotation_x(slow * 0.05);
next.jaw.scale = Vec3::one() * 1.02;
next.tail.position = Vec3::new(0.0, skeleton_attr.tail.0, skeleton_attr.tail.1);
next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1);
next.tail.orientation =
Quaternion::rotation_z(0.0 + slow * 0.2 + tailmove.x) * Quaternion::rotation_x(0.0);
next.tail.scale = Vec3::one();
next.shoulder_l.position = Vec3::new(
-skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1 + foothoril * -1.0,
skeleton_attr.shoulder.2,
-s_a.shoulder.0,
s_a.shoulder.1 + foothoril * -1.0,
s_a.shoulder.2,
);
next.shoulder_l.orientation = Quaternion::rotation_x(0.5 + footrotl * -0.16)
* Quaternion::rotation_y(0.1)
@ -239,9 +191,9 @@ impl Animation for ShootAnimation {
next.shoulder_l.scale = Vec3::one();
next.shoulder_r.position = Vec3::new(
skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1 + foothorir * -1.0,
skeleton_attr.shoulder.2,
s_a.shoulder.0,
s_a.shoulder.1 + foothorir * -1.0,
s_a.shoulder.2,
);
next.shoulder_r.orientation = Quaternion::rotation_x(0.5 + footrotr * -0.16)
* Quaternion::rotation_y(-0.1)
@ -252,38 +204,30 @@ impl Animation for ShootAnimation {
next.torso.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(-0.25);
next.torso.scale = Vec3::one() / 8.0;
next.leg_l.position = Vec3::new(
-skeleton_attr.leg.0,
skeleton_attr.leg.1,
skeleton_attr.leg.2,
) * 0.98;
next.leg_l.position = Vec3::new(-s_a.leg.0, s_a.leg.1, s_a.leg.2) * 0.98;
next.leg_l.orientation =
Quaternion::rotation_z(short * 0.18) * Quaternion::rotation_x(foothoril * 0.3);
next.leg_l.scale = Vec3::one() * 0.98;
next.leg_r.position = Vec3::new(
skeleton_attr.leg.0,
skeleton_attr.leg.1,
skeleton_attr.leg.2,
) * 0.98;
next.leg_r.position = Vec3::new(s_a.leg.0, s_a.leg.1, s_a.leg.2) * 0.98;
next.leg_r.orientation =
Quaternion::rotation_z(short * 0.18) * Quaternion::rotation_x(foothorir * 0.3);
next.leg_r.scale = Vec3::one() * 0.98;
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
4.0 + skeleton_attr.foot.1 + foothoril * 8.5,
skeleton_attr.foot.2 + ((footvertl * 6.5).max(0.0)),
-s_a.foot.0,
4.0 + s_a.foot.1 + foothoril * 8.5,
s_a.foot.2 + ((footvertl * 6.5).max(0.0)),
);
next.foot_l.orientation =
Quaternion::rotation_x(-0.5 + footrotl * 0.85) * Quaternion::rotation_y(0.0);
next.foot_l.scale = Vec3::one();
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
4.0 + skeleton_attr.foot.1 + foothorir * 8.5,
skeleton_attr.foot.2 + ((footvertr * 6.5).max(0.0)),
s_a.foot.0,
4.0 + s_a.foot.1 + foothorir * 8.5,
s_a.foot.2 + ((footvertr * 6.5).max(0.0)),
);
next.foot_r.orientation =
Quaternion::rotation_x(-0.5 + footrotr * 0.85) * Quaternion::rotation_y(0.0);
@ -305,9 +249,9 @@ impl Animation for ShootAnimation {
next.hand_r.scale = Vec3::one() * 1.02;
next.shoulder_l.position = Vec3::new(
-skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1 + foothoril * -1.0,
skeleton_attr.shoulder.2,
-s_a.shoulder.0,
s_a.shoulder.1 + foothoril * -1.0,
s_a.shoulder.2,
);
next.shoulder_l.orientation = Quaternion::rotation_x(1.4 + footrotl * -0.06)
* Quaternion::rotation_y(-0.9)
@ -315,16 +259,16 @@ impl Animation for ShootAnimation {
next.shoulder_l.scale = Vec3::one();
next.shoulder_r.position = Vec3::new(
skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1 + foothorir * -1.0,
skeleton_attr.shoulder.2,
s_a.shoulder.0,
s_a.shoulder.1 + foothorir * -1.0,
s_a.shoulder.2,
);
next.shoulder_r.orientation = Quaternion::rotation_x(1.8 + footrotr * -0.06)
* Quaternion::rotation_y(-0.5) //1.9
* Quaternion::rotation_z(footrotr * -0.05);
next.shoulder_r.scale = Vec3::one();
next.jaw.position = Vec3::new(0.0, skeleton_attr.jaw.0, skeleton_attr.jaw.1);
next.jaw.position = Vec3::new(0.0, s_a.jaw.0, s_a.jaw.1);
next.jaw.orientation = Quaternion::rotation_x(-0.2);
next.main.position = Vec3::new(7.0, 5.0, -13.0);
@ -349,22 +293,16 @@ impl Animation for ShootAnimation {
Quaternion::rotation_x(1.57) * Quaternion::rotation_y(0.2);
next.hand_r.scale = Vec3::one() * 1.02;
next.jaw.position = Vec3::new(0.0, skeleton_attr.jaw.0, skeleton_attr.jaw.1);
next.jaw.position = Vec3::new(0.0, s_a.jaw.0, s_a.jaw.1);
next.shoulder_l.position = Vec3::new(
-skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1,
skeleton_attr.shoulder.2,
);
next.shoulder_l.position =
Vec3::new(-s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2);
next.shoulder_l.orientation =
Quaternion::rotation_z(0.0) * Quaternion::rotation_x(2.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.position =
Vec3::new(s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2);
next.shoulder_r.orientation =
Quaternion::rotation_z(0.4) * Quaternion::rotation_x(2.0);
next.shoulder_r.scale = Vec3::one();

View File

@ -8,9 +8,6 @@ use common::{
};
use std::f32::consts::PI;
pub struct Input {
pub attack: bool,
}
pub struct SpinAnimation;
impl Animation for SpinAnimation {
@ -31,7 +28,7 @@ impl Animation for SpinAnimation {
(active_tool_kind, second_tool_kind, _global_time, stage_section): Self::Dependency,
anim_time: f64,
rate: &mut f32,
skeleton_attr: &SkeletonAttr,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
*rate = 1.0;
let mut next = (*skeleton).clone();
@ -55,7 +52,7 @@ impl Animation for SpinAnimation {
let stab = (anim_time as f32 * 8.0).sin();
let rotate = (anim_time as f32 * 1.0).sin();
next.head.position = Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1);
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
if let Some(ToolKind::Sword(_)) = active_tool_kind {
next.hand_l.position = Vec3::new(-4.75, -1.0, 2.5);
@ -140,19 +137,11 @@ impl Animation for SpinAnimation {
* Quaternion::rotation_y(0.2 + spin * -2.0)
* Quaternion::rotation_z(1.4 + spin * 0.1);
next.control.scale = Vec3::one();
next.head.position = Vec3::new(
0.0,
skeleton_attr.head.0 + spin * -0.8,
skeleton_attr.head.1,
);
next.head.position = Vec3::new(0.0, s_a.head.0 + spin * -0.8, s_a.head.1);
next.head.orientation = Quaternion::rotation_z(spin * -0.25)
* Quaternion::rotation_x(0.0 + spin * -0.1)
* Quaternion::rotation_y(spin * -0.2);
next.upper_torso.position = Vec3::new(
0.0,
skeleton_attr.upper_torso.0,
skeleton_attr.upper_torso.1,
);
next.upper_torso.position = Vec3::new(0.0, s_a.upper_torso.0, s_a.upper_torso.1);
next.upper_torso.orientation = Quaternion::rotation_z(spin * 0.1)
* Quaternion::rotation_x(0.0 + spin * 0.1)
* Quaternion::rotation_y(decel * -0.2);
@ -166,13 +155,11 @@ impl Animation for SpinAnimation {
* Quaternion::rotation_y(0.0);
next.torso.scale = Vec3::one() / 11.0 * 1.01;
next.foot_l.position =
Vec3::new(-skeleton_attr.foot.0, foot * 1.0, skeleton_attr.foot.2);
next.foot_l.position = Vec3::new(-s_a.foot.0, foot * 1.0, s_a.foot.2);
next.foot_l.orientation = Quaternion::rotation_x(foot * -1.2);
next.foot_l.scale = Vec3::one();
next.foot_r.position =
Vec3::new(skeleton_attr.foot.0, foot * -1.0, skeleton_attr.foot.2);
next.foot_r.position = Vec3::new(s_a.foot.0, foot * -1.0, s_a.foot.2);
next.foot_r.orientation = Quaternion::rotation_x(foot * 1.2);
next.foot_r.scale = Vec3::one();

View File

@ -30,7 +30,7 @@ impl Animation for SpinMeleeAnimation {
(active_tool_kind, second_tool_kind, velocity, _global_time, stage_section): Self::Dependency,
anim_time: f64,
rate: &mut f32,
skeleton_attr: &SkeletonAttr,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
*rate = 1.0;
let lab = 1.0;
@ -73,8 +73,7 @@ impl Animation for SpinMeleeAnimation {
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);
next.head.position = Vec3::new(0.0, s_a.head.0 + 0.0, s_a.head.1);
if let Some(stage_section) = stage_section {
match stage_section {
@ -86,58 +85,49 @@ impl Animation for SpinMeleeAnimation {
* Quaternion::rotation_z(movement * -1.5);
next.upper_torso.position = Vec3::new(
0.0,
skeleton_attr.upper_torso.0 + movement * -1.0,
skeleton_attr.upper_torso.1 + movement * -2.5,
s_a.upper_torso.0 + movement * -1.0,
s_a.upper_torso.1 + movement * -2.5,
);
next.upper_torso.orientation = Quaternion::rotation_x(movement * -1.1)
* Quaternion::rotation_z(movement * -0.35);
next.lower_torso.orientation = Quaternion::rotation_z(movement * 0.5);
next.head.position = Vec3::new(
0.0,
skeleton_attr.head.0 - 2.0 + movement * -6.0,
skeleton_attr.head.1 + movement * -4.0,
s_a.head.0 - 2.0 + movement * -6.0,
s_a.head.1 + movement * -4.0,
);
next.head.orientation = Quaternion::rotation_x(movement * 0.9)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(movement * 0.05);
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1 + movement * 4.0,
skeleton_attr.foot.2,
);
next.foot_l.position =
Vec3::new(-s_a.foot.0, s_a.foot.1 + movement * 4.0, s_a.foot.2);
next.foot_l.orientation = Quaternion::rotation_x(movement * 0.2);
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1 + movement * -12.0,
skeleton_attr.foot.2 + movement * 1.0 + quick * 1.0,
s_a.foot.0,
s_a.foot.1 + movement * -12.0,
s_a.foot.2 + movement * 1.0 + quick * 1.0,
);
next.foot_r.orientation = Quaternion::rotation_x(movement * -1.0)
* Quaternion::rotation_z(movement * -0.8);
},
StageSection::Swing => {
next.head.position =
Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1);
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
next.control.position = Vec3::new(-7.0, 7.0, 2.0);
next.control.orientation = Quaternion::rotation_x(-PI / 2.0)
* Quaternion::rotation_z(-PI / 2.0);
next.torso.orientation = Quaternion::rotation_z(movement * PI * 2.0);
next.upper_torso.position = Vec3::new(
0.0,
skeleton_attr.upper_torso.0,
skeleton_attr.upper_torso.1,
);
next.upper_torso.position =
Vec3::new(0.0, s_a.upper_torso.0, s_a.upper_torso.1);
next.upper_torso.orientation = Quaternion::rotation_y(0.3);
next.head.position =
Vec3::new(0.0, skeleton_attr.head.0 - 2.0, skeleton_attr.head.1);
next.head.position = Vec3::new(0.0, s_a.head.0 - 2.0, s_a.head.1);
next.head.orientation = Quaternion::rotation_x(-0.15);
next.lower_torso.orientation = Quaternion::rotation_x(0.2);
},
StageSection::Recover => {
next.head.position =
Vec3::new(0.0, skeleton_attr.head.0 - 2.0, skeleton_attr.head.1);
next.head.position = Vec3::new(0.0, s_a.head.0 - 2.0, s_a.head.1);
next.control.position = Vec3::new(-7.0, 7.0, 2.0);
next.control.orientation =
Quaternion::rotation_x(-PI / 2.0 + movement * PI / 2.0)
@ -172,15 +162,12 @@ impl Animation for SpinMeleeAnimation {
* Quaternion::rotation_z(1.4);
next.control.scale = Vec3::one();
next.head.position = Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1);
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
next.head.orientation = Quaternion::rotation_z(0.0)
* Quaternion::rotation_x(-0.15)
* Quaternion::rotation_y(0.08);
next.upper_torso.position = Vec3::new(
0.0,
skeleton_attr.upper_torso.0 - 3.0,
skeleton_attr.upper_torso.1 - 2.0,
);
next.upper_torso.position =
Vec3::new(0.0, s_a.upper_torso.0 - 3.0, s_a.upper_torso.1 - 2.0);
next.upper_torso.orientation = Quaternion::rotation_z(0.0)
* Quaternion::rotation_x(-0.1)
* Quaternion::rotation_y(0.3);
@ -201,46 +188,31 @@ impl Animation for SpinMeleeAnimation {
* Quaternion::rotation_y(0.0);
next.torso.scale = Vec3::one() / 11.0 * 1.01;
if velocity.z.abs() > 0.1 {
next.foot_l.position =
Vec3::new(-skeleton_attr.foot.0, 8.0, skeleton_attr.foot.2 + 2.0);
next.foot_l.position = Vec3::new(-s_a.foot.0, 8.0, s_a.foot.2 + 2.0);
next.foot_l.orientation =
Quaternion::rotation_x(1.0) * Quaternion::rotation_z(0.0);
next.foot_l.scale = Vec3::one();
next.foot_r.position =
Vec3::new(skeleton_attr.foot.0, 8.0, skeleton_attr.foot.2 + 2.0);
next.foot_r.position = Vec3::new(s_a.foot.0, 8.0, s_a.foot.2 + 2.0);
next.foot_r.orientation = Quaternion::rotation_x(1.0);
next.foot_r.scale = Vec3::one();
} else if speed < 0.5 {
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
2.0 + quick * -6.0,
skeleton_attr.foot.2,
);
next.foot_l.position = Vec3::new(-s_a.foot.0, 2.0 + quick * -6.0, s_a.foot.2);
next.foot_l.orientation = Quaternion::rotation_x(0.5 + slowersmooth * 0.2)
* Quaternion::rotation_z(0.0);
next.foot_l.scale = Vec3::one();
next.foot_r.position =
Vec3::new(skeleton_attr.foot.0, 4.0, skeleton_attr.foot.2);
next.foot_r.position = Vec3::new(s_a.foot.0, 4.0, s_a.foot.2);
next.foot_r.orientation = Quaternion::rotation_x(0.5 - slowersmooth * 0.2)
* Quaternion::rotation_y(-0.4);
next.foot_r.scale = Vec3::one();
} else {
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
2.0 + quick * -6.0,
skeleton_attr.foot.2,
);
next.foot_l.position = Vec3::new(-s_a.foot.0, 2.0 + quick * -6.0, s_a.foot.2);
next.foot_l.orientation = Quaternion::rotation_x(0.5 + slowersmooth * 0.2)
* Quaternion::rotation_z(0.0);
next.foot_l.scale = Vec3::one();
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
2.0 + quick * 6.0,
skeleton_attr.foot.2,
);
next.foot_r.position = Vec3::new(s_a.foot.0, 2.0 + quick * 6.0, s_a.foot.2);
next.foot_r.orientation = Quaternion::rotation_x(0.5 - slowersmooth * 0.2)
* Quaternion::rotation_z(0.0);
next.foot_r.scale = Vec3::one();

View File

@ -20,7 +20,7 @@ impl Animation for WieldAnimation {
(active_tool_kind, _second_tool_kind, velocity, global_time): Self::Dependency,
anim_time: f64,
_rate: &mut f32,
skeleton_attr: &SkeletonAttr,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let head_look = Vec2::new(
@ -108,28 +108,17 @@ impl Animation for WieldAnimation {
let shortalt = (anim_time as f32 * lab as f32 * 16.0 + PI / 2.0).sin();
if skeleton_attr.beast {
next.jaw.position = Vec3::new(0.0, skeleton_attr.jaw.0, skeleton_attr.jaw.1);
if s_a.beast {
next.jaw.position = Vec3::new(0.0, s_a.jaw.0, s_a.jaw.1);
} else {
next.jaw.position = Vec3::new(
0.0,
skeleton_attr.jaw.0 - slower * 0.12,
skeleton_attr.jaw.1 + slow * 0.2,
);
next.jaw.position = Vec3::new(0.0, s_a.jaw.0 - slower * 0.12, s_a.jaw.1 + slow * 0.2);
next.hand_l.position = Vec3::new(
-skeleton_attr.hand.0 - 7.0,
skeleton_attr.hand.1 - 7.0,
skeleton_attr.hand.2 + 10.0,
);
next.hand_l.position =
Vec3::new(-s_a.hand.0 - 7.0, s_a.hand.1 - 7.0, s_a.hand.2 + 10.0);
next.hand_l.orientation = Quaternion::rotation_x(0.57) * Quaternion::rotation_z(1.57);
next.hand_l.scale = Vec3::one() * 1.02;
next.hand_r.position = Vec3::new(
skeleton_attr.hand.0 - 7.0,
skeleton_attr.hand.1 - 7.0,
skeleton_attr.hand.2 + 10.0,
);
next.hand_r.position = Vec3::new(s_a.hand.0 - 7.0, s_a.hand.1 - 7.0, s_a.hand.2 + 10.0);
next.hand_r.orientation = Quaternion::rotation_x(0.57) * Quaternion::rotation_z(1.57);
next.hand_r.scale = Vec3::one() * 1.02;
next.hand_r.orientation = Quaternion::rotation_x(0.57) * Quaternion::rotation_z(1.57);
@ -148,25 +137,17 @@ impl Animation for WieldAnimation {
next.main.scale = Vec3::one() * 1.02;
if velocity > 0.5 {
next.head.position =
Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1) * 1.02;
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1) * 1.02;
next.head.orientation =
Quaternion::rotation_z(short * -0.18) * Quaternion::rotation_x(-0.05);
next.head.scale = Vec3::one() * 1.02;
next.upper_torso.position = Vec3::new(
0.0,
skeleton_attr.upper_torso.0,
skeleton_attr.upper_torso.1 + shortalt * -1.5,
);
next.upper_torso.position =
Vec3::new(0.0, s_a.upper_torso.0, s_a.upper_torso.1 + shortalt * -1.5);
next.upper_torso.orientation = Quaternion::rotation_z(short * 0.18);
next.upper_torso.scale = Vec3::one();
next.lower_torso.position = Vec3::new(
0.0,
skeleton_attr.lower_torso.0,
skeleton_attr.lower_torso.1,
);
next.lower_torso.position = Vec3::new(0.0, s_a.lower_torso.0, s_a.lower_torso.1);
next.lower_torso.orientation =
Quaternion::rotation_z(short * 0.15) * Quaternion::rotation_x(0.14);
next.lower_torso.scale = Vec3::one() * 1.02;
@ -174,15 +155,15 @@ impl Animation for WieldAnimation {
next.jaw.orientation = Quaternion::rotation_x(slow * 0.05);
next.jaw.scale = Vec3::one() * 0.98;
next.tail.position = Vec3::new(0.0, skeleton_attr.tail.0, skeleton_attr.tail.1);
next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1);
next.tail.orientation = Quaternion::rotation_z(0.0 + slow * 0.2 + tailmove.x)
* Quaternion::rotation_x(0.0);
next.tail.scale = Vec3::one();
next.shoulder_l.position = Vec3::new(
-skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1 + foothoril * -1.0,
skeleton_attr.shoulder.2,
-s_a.shoulder.0,
s_a.shoulder.1 + foothoril * -1.0,
s_a.shoulder.2,
);
next.shoulder_l.orientation = Quaternion::rotation_x(0.5 + footrotl * -0.16)
* Quaternion::rotation_y(0.1)
@ -190,9 +171,9 @@ impl Animation for WieldAnimation {
next.shoulder_l.scale = Vec3::one();
next.shoulder_r.position = Vec3::new(
skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1 + foothorir * -1.0,
skeleton_attr.shoulder.2,
s_a.shoulder.0,
s_a.shoulder.1 + foothorir * -1.0,
s_a.shoulder.2,
);
next.shoulder_r.orientation = Quaternion::rotation_x(0.5 + footrotr * -0.16)
* Quaternion::rotation_y(-0.1)
@ -204,93 +185,60 @@ impl Animation for WieldAnimation {
Quaternion::rotation_z(0.0) * Quaternion::rotation_x(-0.25);
next.torso.scale = Vec3::one() / 8.0;
} else {
next.head.position = Vec3::new(
0.0,
skeleton_attr.head.0,
skeleton_attr.head.1 + breathe * 0.2,
) * 1.02;
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1 + breathe * 0.2) * 1.02;
next.head.orientation =
Quaternion::rotation_z(look.x * 0.6) * Quaternion::rotation_x(look.y * 0.6);
next.head.scale = Vec3::one() * 1.02;
next.upper_torso.position = Vec3::new(
0.0,
skeleton_attr.upper_torso.0,
skeleton_attr.upper_torso.1 + breathe * 0.5,
);
next.upper_torso.position =
Vec3::new(0.0, s_a.upper_torso.0, s_a.upper_torso.1 + breathe * 0.5);
next.upper_torso.orientation =
Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.upper_torso.scale = Vec3::one();
next.lower_torso.position = Vec3::new(
0.0,
skeleton_attr.lower_torso.0,
skeleton_attr.lower_torso.1 + breathe * 0.15,
);
next.lower_torso.position =
Vec3::new(0.0, s_a.lower_torso.0, s_a.lower_torso.1 + breathe * 0.15);
next.lower_torso.orientation =
Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.lower_torso.scale = Vec3::one() * 1.02;
next.jaw.position = Vec3::new(
0.0,
skeleton_attr.jaw.0 - slower * 0.12,
skeleton_attr.jaw.1 + slow * 0.2,
);
next.jaw.position =
Vec3::new(0.0, s_a.jaw.0 - slower * 0.12, s_a.jaw.1 + slow * 0.2);
next.jaw.orientation = Quaternion::rotation_x(slow * 0.05);
next.jaw.scale = Vec3::one() * 0.98;
next.tail.position = Vec3::new(0.0, skeleton_attr.tail.0, skeleton_attr.tail.1);
next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1);
next.tail.orientation = Quaternion::rotation_z(0.0 + slow * 0.2 + tailmove.x)
* Quaternion::rotation_x(0.0);
next.tail.scale = Vec3::one();
next.shoulder_l.position = Vec3::new(
-skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1,
skeleton_attr.shoulder.2,
);
next.shoulder_l.position =
Vec3::new(-s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2);
next.shoulder_l.orientation =
Quaternion::rotation_z(0.0) * 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.position =
Vec3::new(s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2);
next.shoulder_r.orientation =
Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.shoulder_r.scale = Vec3::one();
next.leg_l.position = Vec3::new(
-skeleton_attr.leg.0,
skeleton_attr.leg.1,
skeleton_attr.leg.2 + breathe * 0.2,
) * 1.02;
next.leg_l.position =
Vec3::new(-s_a.leg.0, s_a.leg.1, s_a.leg.2 + breathe * 0.2) * 1.02;
next.leg_l.orientation = Quaternion::rotation_z(0.0);
next.leg_l.scale = Vec3::one() * 1.02;
next.leg_r.position = Vec3::new(
skeleton_attr.leg.0,
skeleton_attr.leg.1,
skeleton_attr.leg.2 + breathe * 0.2,
) * 1.02;
next.leg_r.position =
Vec3::new(s_a.leg.0, s_a.leg.1, s_a.leg.2 + breathe * 0.2) * 1.02;
next.leg_r.orientation = Quaternion::rotation_z(0.0);
next.leg_r.scale = Vec3::one() * 1.02;
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1,
skeleton_attr.foot.2,
);
next.foot_l.position = Vec3::new(-s_a.foot.0, s_a.foot.1, s_a.foot.2);
next.foot_l.orientation = Quaternion::rotation_z(0.0);
next.foot_l.scale = Vec3::one();
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1,
skeleton_attr.foot.2,
);
next.foot_r.position = Vec3::new(s_a.foot.0, s_a.foot.1, s_a.foot.2);
next.foot_r.orientation = Quaternion::rotation_z(0.0);
next.foot_r.scale = Vec3::one();
@ -356,22 +304,16 @@ impl Animation for WieldAnimation {
},
Some(ToolKind::Axe(_)) => {
if velocity < 0.5 {
next.head.position = Vec3::new(
0.0,
-3.5 + skeleton_attr.head.0,
skeleton_attr.head.1 + u_slow * 0.1,
);
next.head.position =
Vec3::new(0.0, -3.5 + s_a.head.0, s_a.head.1 + u_slow * 0.1);
next.head.orientation = Quaternion::rotation_z(head_look.x)
* Quaternion::rotation_x(0.35 + head_look.y.abs());
next.head.scale = Vec3::one() * 1.01;
next.upper_torso.orientation = Quaternion::rotation_x(-0.35)
* Quaternion::rotation_y(u_slowalt * 0.04)
* Quaternion::rotation_z(0.15);
next.lower_torso.position = Vec3::new(
0.0,
1.0 + skeleton_attr.lower_torso.0,
skeleton_attr.lower_torso.1,
);
next.lower_torso.position =
Vec3::new(0.0, 1.0 + s_a.lower_torso.0, s_a.lower_torso.1);
next.lower_torso.orientation =
Quaternion::rotation_x(0.15) * Quaternion::rotation_z(0.25);
next.control.orientation = Quaternion::rotation_x(1.8)
@ -429,20 +371,14 @@ impl Animation for WieldAnimation {
next.control.scale = Vec3::one();
},
Some(ToolKind::Hammer(_)) => {
next.hand_l.position = Vec3::new(
-skeleton_attr.hand.0 - 7.0,
skeleton_attr.hand.1 - 7.0,
skeleton_attr.hand.2 + 10.0,
);
next.hand_l.position =
Vec3::new(-s_a.hand.0 - 7.0, s_a.hand.1 - 7.0, s_a.hand.2 + 10.0);
next.hand_l.orientation =
Quaternion::rotation_x(0.57) * Quaternion::rotation_z(1.57);
next.hand_l.scale = Vec3::one() * 1.02;
next.hand_r.position = Vec3::new(
skeleton_attr.hand.0 - 7.0,
skeleton_attr.hand.1 - 7.0,
skeleton_attr.hand.2 + 10.0,
);
next.hand_r.position =
Vec3::new(s_a.hand.0 - 7.0, s_a.hand.1 - 7.0, s_a.hand.2 + 10.0);
next.hand_r.orientation =
Quaternion::rotation_x(0.57) * Quaternion::rotation_z(1.57);
next.hand_r.scale = Vec3::one() * 1.02;
@ -472,20 +408,14 @@ impl Animation for WieldAnimation {
Quaternion::rotation_x(1.57) * Quaternion::rotation_y(0.8);
next.hand_r.scale = Vec3::one() * 1.05;
next.shoulder_l.position = Vec3::new(
-skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1,
skeleton_attr.shoulder.2,
);
next.shoulder_l.position =
Vec3::new(-s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2);
next.shoulder_l.orientation =
Quaternion::rotation_z(0.0) * 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.position =
Vec3::new(s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2);
next.shoulder_r.orientation =
Quaternion::rotation_z(0.4) * Quaternion::rotation_x(1.0);
next.shoulder_r.scale = Vec3::one();
@ -500,38 +430,26 @@ impl Animation for WieldAnimation {
next.control.scale = Vec3::one();
},
Some(ToolKind::NpcWeapon(_)) => {
next.shoulder_l.position = Vec3::new(
-skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1,
skeleton_attr.shoulder.2,
);
next.shoulder_l.position =
Vec3::new(-s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2);
next.shoulder_l.orientation =
Quaternion::rotation_z(0.0) * Quaternion::rotation_x(breathe);
next.shoulder_l.scale = Vec3::one() + breathe;
next.shoulder_r.position = Vec3::new(
skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1,
skeleton_attr.shoulder.2,
);
next.shoulder_r.position =
Vec3::new(s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2);
next.shoulder_r.orientation =
Quaternion::rotation_z(0.0) * Quaternion::rotation_x(breathe);
next.shoulder_r.scale = Vec3::one() + breathe;
next.hand_l.position = Vec3::new(
-skeleton_attr.hand.0,
skeleton_attr.hand.1,
skeleton_attr.hand.2 + torso * 0.6,
);
next.hand_l.position =
Vec3::new(-s_a.hand.0, s_a.hand.1, s_a.hand.2 + torso * 0.6);
next.hand_l.orientation =
Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.hand_l.scale = Vec3::one() * 1.02;
next.hand_r.position = Vec3::new(
skeleton_attr.hand.0,
skeleton_attr.hand.1,
skeleton_attr.hand.2 + torso * 0.6,
);
next.hand_r.position =
Vec3::new(s_a.hand.0, s_a.hand.1, s_a.hand.2 + torso * 0.6);
next.hand_r.orientation =
Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.hand_r.scale = Vec3::one() * 1.02;
@ -540,29 +458,20 @@ impl Animation for WieldAnimation {
next.control.orientation = Quaternion::rotation_z(0.0);
next.control.scale = Vec3::one();
if velocity < 0.5 {
next.head.position = Vec3::new(
0.0,
skeleton_attr.head.0,
skeleton_attr.head.1 + torso * 0.2,
) * 1.02;
next.head.position =
Vec3::new(0.0, s_a.head.0, s_a.head.1 + torso * 0.2) * 1.02;
next.head.orientation = Quaternion::rotation_z(look.x * 0.6)
* Quaternion::rotation_x(look.y * 0.6 + breathe);
next.head.scale = Vec3::one() * 1.02 + breathe * 0.4;
next.upper_torso.position = Vec3::new(
0.0,
skeleton_attr.upper_torso.0,
skeleton_attr.upper_torso.1 + torso * 0.5,
);
next.upper_torso.position =
Vec3::new(0.0, s_a.upper_torso.0, s_a.upper_torso.1 + torso * 0.5);
next.upper_torso.orientation =
Quaternion::rotation_z(0.0) * Quaternion::rotation_x(-breathe);
next.upper_torso.scale = Vec3::one() - breathe * 0.4;
next.lower_torso.position = Vec3::new(
0.0,
skeleton_attr.lower_torso.0,
skeleton_attr.lower_torso.1 + torso * 0.15,
);
next.lower_torso.position =
Vec3::new(0.0, s_a.lower_torso.0, s_a.lower_torso.1 + torso * 0.15);
next.lower_torso.orientation =
Quaternion::rotation_z(0.0) * Quaternion::rotation_x(breathe);
next.lower_torso.scale = Vec3::one() * 1.02 + breathe * 0.4;
@ -570,8 +479,7 @@ impl Animation for WieldAnimation {
next.jaw.orientation = Quaternion::rotation_x(-0.1 + breathe * 2.0);
next.jaw.scale = Vec3::one() * 0.98;
next.tail.position =
Vec3::new(0.0, skeleton_attr.tail.0, skeleton_attr.tail.1);
next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1);
next.tail.orientation =
Quaternion::rotation_z(0.0 + slow * 0.2 + tailmove.x)
* Quaternion::rotation_x(0.0);
@ -593,38 +501,26 @@ impl Animation for WieldAnimation {
* Quaternion::rotation_z(1.57);
next.main.scale = Vec3::one() * 1.02;
next.shoulder_l.position = Vec3::new(
-skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1,
skeleton_attr.shoulder.2,
);
next.shoulder_l.position =
Vec3::new(-s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2);
next.shoulder_l.orientation =
Quaternion::rotation_z(0.0) * Quaternion::rotation_x(breathe);
next.shoulder_l.scale = Vec3::one() + breathe;
next.shoulder_r.position = Vec3::new(
skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1,
skeleton_attr.shoulder.2,
);
next.shoulder_r.position =
Vec3::new(s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2);
next.shoulder_r.orientation =
Quaternion::rotation_z(0.0) * Quaternion::rotation_x(breathe);
next.shoulder_r.scale = Vec3::one() + breathe;
next.hand_l.position = Vec3::new(
-skeleton_attr.hand.0,
skeleton_attr.hand.1,
skeleton_attr.hand.2 + torso * 0.6,
);
next.hand_l.position =
Vec3::new(-s_a.hand.0, s_a.hand.1, s_a.hand.2 + torso * 0.6);
next.hand_l.orientation =
Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.hand_l.scale = Vec3::one() * 1.02;
next.hand_r.position = Vec3::new(
skeleton_attr.hand.0,
skeleton_attr.hand.1,
skeleton_attr.hand.2 + torso * 0.6,
);
next.hand_r.position =
Vec3::new(s_a.hand.0, s_a.hand.1, s_a.hand.2 + torso * 0.6);
next.hand_r.orientation =
Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.hand_r.scale = Vec3::one() * 1.02;
@ -634,38 +530,24 @@ impl Animation for WieldAnimation {
next.leg_control_l.scale = Vec3::one() * 1.0;
next.leg_l.position = Vec3::new(
-skeleton_attr.leg.0,
skeleton_attr.leg.1,
skeleton_attr.leg.2 + torso * 0.2,
);
next.leg_l.position =
Vec3::new(-s_a.leg.0, s_a.leg.1, s_a.leg.2 + torso * 0.2);
next.leg_l.orientation =
Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.leg_l.scale = Vec3::one();
next.leg_r.position = Vec3::new(
skeleton_attr.leg.0,
skeleton_attr.leg.1,
skeleton_attr.leg.2 + torso * 0.2,
);
next.leg_r.position =
Vec3::new(s_a.leg.0, s_a.leg.1, s_a.leg.2 + torso * 0.2);
next.leg_r.orientation =
Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.leg_r.scale = Vec3::one();
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1,
skeleton_attr.foot.2,
);
next.foot_l.position = Vec3::new(-s_a.foot.0, s_a.foot.1, s_a.foot.2);
next.foot_l.orientation =
Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.foot_l.scale = Vec3::one();
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1,
skeleton_attr.foot.2,
);
next.foot_r.position = Vec3::new(s_a.foot.0, s_a.foot.1, s_a.foot.2);
next.foot_r.orientation =
Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.foot_r.scale = Vec3::one();
@ -682,36 +564,27 @@ impl Animation for WieldAnimation {
next.hold.scale = Vec3::one() * 0.0;
} else {
next.head.position =
Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1) * 1.02;
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1) * 1.02;
next.head.orientation =
Quaternion::rotation_z(short * -0.18) * Quaternion::rotation_x(-0.05);
next.head.scale = Vec3::one() * 1.02;
next.upper_torso.position = Vec3::new(
0.0,
skeleton_attr.upper_torso.0,
skeleton_attr.upper_torso.1 + shortalt * -1.5,
);
next.upper_torso.position =
Vec3::new(0.0, s_a.upper_torso.0, s_a.upper_torso.1 + shortalt * -1.5);
next.upper_torso.orientation = Quaternion::rotation_z(short * 0.18);
next.upper_torso.scale = Vec3::one();
next.lower_torso.position = Vec3::new(
0.0,
skeleton_attr.lower_torso.0,
skeleton_attr.lower_torso.1,
);
next.lower_torso.position =
Vec3::new(0.0, s_a.lower_torso.0, s_a.lower_torso.1);
next.lower_torso.orientation =
Quaternion::rotation_z(short * 0.15) * Quaternion::rotation_x(0.14);
next.lower_torso.scale = Vec3::one() * 1.02;
next.jaw.position =
Vec3::new(0.0, skeleton_attr.jaw.0, skeleton_attr.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.scale = Vec3::one() * 1.02;
next.tail.position =
Vec3::new(0.0, skeleton_attr.tail.0, skeleton_attr.tail.1);
next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1);
next.tail.orientation = Quaternion::rotation_x(shortalt * 0.3);
next.tail.scale = Vec3::one();
@ -732,9 +605,9 @@ impl Animation for WieldAnimation {
next.main.scale = Vec3::one() * 1.02;
next.shoulder_l.position = Vec3::new(
-skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1 + foothoril * -3.0,
skeleton_attr.shoulder.2,
-s_a.shoulder.0,
s_a.shoulder.1 + foothoril * -3.0,
s_a.shoulder.2,
);
next.shoulder_l.orientation = Quaternion::rotation_x(footrotl * -0.36)
* Quaternion::rotation_y(0.1)
@ -742,9 +615,9 @@ impl Animation for WieldAnimation {
next.shoulder_l.scale = Vec3::one();
next.shoulder_r.position = Vec3::new(
skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1 + foothorir * -3.0,
skeleton_attr.shoulder.2,
s_a.shoulder.0,
s_a.shoulder.1 + foothorir * -3.0,
s_a.shoulder.2,
);
next.shoulder_r.orientation = Quaternion::rotation_x(footrotr * -0.36)
* Quaternion::rotation_y(-0.1)
@ -752,9 +625,9 @@ impl Animation for WieldAnimation {
next.shoulder_r.scale = Vec3::one();
next.hand_l.position = Vec3::new(
-1.0 + -skeleton_attr.hand.0,
skeleton_attr.hand.1 + foothoril * -4.0,
skeleton_attr.hand.2 + foothoril * 1.0,
-1.0 + -s_a.hand.0,
s_a.hand.1 + foothoril * -4.0,
s_a.hand.2 + foothoril * 1.0,
);
next.hand_l.orientation =
Quaternion::rotation_x(0.15 + (handhoril * -1.2).max(-0.3))
@ -762,47 +635,39 @@ impl Animation for WieldAnimation {
next.hand_l.scale = Vec3::one() * 1.02;
next.hand_r.position = Vec3::new(
1.0 + skeleton_attr.hand.0,
skeleton_attr.hand.1 + foothorir * -4.0,
skeleton_attr.hand.2 + foothorir * 1.0,
1.0 + s_a.hand.0,
s_a.hand.1 + foothorir * -4.0,
s_a.hand.2 + foothorir * 1.0,
);
next.hand_r.orientation =
Quaternion::rotation_x(0.15 + (handhorir * -1.2).max(-0.3))
* Quaternion::rotation_y(handhorir * 0.1);
next.hand_r.scale = Vec3::one() * 1.02;
next.leg_l.position = Vec3::new(
-skeleton_attr.leg.0,
skeleton_attr.leg.1,
skeleton_attr.leg.2,
) * 0.98;
next.leg_l.position = Vec3::new(-s_a.leg.0, s_a.leg.1, s_a.leg.2) * 0.98;
next.leg_l.orientation = Quaternion::rotation_z(short * 0.18)
* Quaternion::rotation_x(foothoril * 0.3);
next.leg_l.scale = Vec3::one() * 0.98;
next.leg_r.position = Vec3::new(
skeleton_attr.leg.0,
skeleton_attr.leg.1,
skeleton_attr.leg.2,
) * 0.98;
next.leg_r.position = Vec3::new(s_a.leg.0, s_a.leg.1, s_a.leg.2) * 0.98;
next.leg_r.orientation = Quaternion::rotation_z(short * 0.18)
* Quaternion::rotation_x(foothorir * 0.3);
next.leg_r.scale = Vec3::one() * 0.98;
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1 + foothoril * 8.5,
skeleton_attr.foot.2 + ((footvertl * 6.5).max(0.0)),
-s_a.foot.0,
s_a.foot.1 + foothoril * 8.5,
s_a.foot.2 + ((footvertl * 6.5).max(0.0)),
);
next.foot_l.orientation = Quaternion::rotation_x(-0.5 + footrotl * 0.85)
* Quaternion::rotation_y(0.0);
next.foot_l.scale = Vec3::one();
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1 + foothorir * 8.5,
skeleton_attr.foot.2 + ((footvertr * 6.5).max(0.0)),
s_a.foot.0,
s_a.foot.1 + foothorir * 8.5,
s_a.foot.2 + ((footvertr * 6.5).max(0.0)),
);
next.foot_r.orientation = Quaternion::rotation_x(-0.5 + footrotr * 0.85)
* Quaternion::rotation_y(0.0);

View File

@ -20,7 +20,7 @@ impl Animation for FeedAnimation {
global_time: Self::Dependency,
anim_time: f64,
_rate: &mut f32,
skeleton_attr: &SkeletonAttr,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
@ -42,54 +42,37 @@ impl Animation for FeedAnimation {
* 0.25,
);
next.head.position =
Vec3::new(0.0, skeleton_attr.head.0 + 1.0, -2.0 + skeleton_attr.head.1);
next.head.position = Vec3::new(0.0, s_a.head.0 + 1.0, -2.0 + s_a.head.1);
next.head.orientation = Quaternion::rotation_z(duck_head_look.x)
* Quaternion::rotation_x(-0.3 / skeleton_attr.feed + wave_slow_cos * 0.03 + wave * 0.1);
* Quaternion::rotation_x(-0.3 / s_a.feed + wave_slow_cos * 0.03 + wave * 0.1);
next.head.scale = Vec3::one();
next.torso.position = Vec3::new(
0.0,
skeleton_attr.chest.0 + skeleton_attr.feed,
-1.0 - 5.0 * (skeleton_attr.feed - 1.0) + wave_slow * 0.3 + skeleton_attr.chest.1,
s_a.chest.0 + s_a.feed,
-1.0 - 5.0 * (s_a.feed - 1.0) + wave_slow * 0.3 + s_a.chest.1,
) / 11.0;
next.torso.orientation = Quaternion::rotation_x(-0.5 * skeleton_attr.feed)
* Quaternion::rotation_y(wave_slow * 0.03);
next.torso.orientation =
Quaternion::rotation_x(-0.5 * s_a.feed) * Quaternion::rotation_y(wave_slow * 0.03);
next.torso.scale = Vec3::one() / 11.0;
next.tail.position = Vec3::new(0.0, skeleton_attr.tail.0, skeleton_attr.tail.1);
next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1);
next.tail.orientation = Quaternion::rotation_x(wave_slow_cos * 0.03);
next.tail.scale = Vec3::one();
next.wing_l.position = Vec3::new(
-skeleton_attr.wing.0,
skeleton_attr.wing.1,
skeleton_attr.wing.2,
);
next.wing_l.position = Vec3::new(-s_a.wing.0, s_a.wing.1, s_a.wing.2);
next.wing_l.orientation = Quaternion::rotation_y(0.4 - wave_slow * 0.1);
next.wing_l.scale = Vec3::one() * 1.05;
next.wing_r.position = Vec3::new(
skeleton_attr.wing.0,
skeleton_attr.wing.1,
skeleton_attr.wing.2,
);
next.wing_r.position = Vec3::new(s_a.wing.0, s_a.wing.1, s_a.wing.2);
next.wing_r.orientation = Quaternion::rotation_y(-0.4 + wave_slow * 0.1);
next.wing_r.scale = Vec3::one() * 1.05;
next.leg_l.position = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1,
skeleton_attr.foot.2,
) / 11.0;
next.leg_l.position = Vec3::new(-s_a.foot.0, s_a.foot.1, s_a.foot.2) / 11.0;
next.leg_l.orientation = Quaternion::rotation_y(0.0);
next.leg_l.scale = Vec3::one() / 11.0;
next.leg_r.position = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1,
skeleton_attr.foot.2,
) / 11.0;
next.leg_r.position = Vec3::new(s_a.foot.0, s_a.foot.1, s_a.foot.2) / 11.0;
next.leg_r.orientation = Quaternion::rotation_x(0.0);
next.leg_r.scale = Vec3::one() / 11.0;
next

View File

@ -19,7 +19,7 @@ impl Animation for FlyAnimation {
_global_time: Self::Dependency,
anim_time: f64,
_rate: &mut f32,
skeleton_attr: &SkeletonAttr,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
@ -30,60 +30,36 @@ impl Animation for FlyAnimation {
let center = (anim_time as f32 * lab as f32 + PI / 2.0).sin();
let centeroffset = (anim_time as f32 * lab as f32 + PI * 1.5).sin();
next.head.position = Vec3::new(
0.0,
skeleton_attr.head.0 + 0.5,
skeleton_attr.head.1 + center * 0.5 - 1.0,
);
next.head.position = Vec3::new(0.0, s_a.head.0 + 0.5, s_a.head.1 + center * 0.5 - 1.0);
next.head.orientation =
Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0 + center * 0.03);
next.head.scale = Vec3::one();
next.torso.position = Vec3::new(
0.0,
skeleton_attr.chest.0 + centeroffset * 0.6,
center * 0.6 + skeleton_attr.chest.1,
s_a.chest.0 + centeroffset * 0.6,
center * 0.6 + s_a.chest.1,
) / 11.0;
next.torso.orientation = Quaternion::rotation_y(center * 0.05);
next.torso.scale = Vec3::one() / 11.0;
next.tail.position = Vec3::new(
0.0,
skeleton_attr.tail.0,
skeleton_attr.tail.1 + centeroffset * 0.6,
);
next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1 + centeroffset * 0.6);
next.tail.orientation = Quaternion::rotation_x(center * 0.03);
next.tail.scale = Vec3::one();
next.wing_l.position = Vec3::new(
-skeleton_attr.wing.0,
skeleton_attr.wing.1,
skeleton_attr.wing.2,
);
next.wing_l.position = Vec3::new(-s_a.wing.0, s_a.wing.1, s_a.wing.2);
next.wing_l.orientation = Quaternion::rotation_y((0.57 + footl * 1.2).max(0.0));
next.wing_l.scale = Vec3::one() * 1.05;
next.wing_r.position = Vec3::new(
skeleton_attr.wing.0,
skeleton_attr.wing.1,
skeleton_attr.wing.2,
);
next.wing_r.position = Vec3::new(s_a.wing.0, s_a.wing.1, s_a.wing.2);
next.wing_r.orientation = Quaternion::rotation_y((-0.57 + footr * 1.2).min(0.0));
next.wing_r.scale = Vec3::one() * 1.05;
next.leg_l.position = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1,
skeleton_attr.foot.2,
) / 11.0;
next.leg_l.position = Vec3::new(-s_a.foot.0, s_a.foot.1, s_a.foot.2) / 11.0;
next.leg_l.orientation = Quaternion::rotation_x(-1.3 + footl * 0.06);
next.leg_l.scale = Vec3::one() / 11.0;
next.leg_r.position = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1,
skeleton_attr.foot.2,
) / 11.0;
next.leg_r.position = Vec3::new(s_a.foot.0, s_a.foot.1, s_a.foot.2) / 11.0;
next.leg_r.orientation = Quaternion::rotation_x(-1.3 + footr * 0.06);
next.leg_r.scale = Vec3::one() / 11.0;
next

View File

@ -20,7 +20,7 @@ impl Animation for IdleAnimation {
global_time: Self::Dependency,
anim_time: f64,
_rate: &mut f32,
skeleton_attr: &SkeletonAttr,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
@ -40,52 +40,32 @@ impl Animation for IdleAnimation {
* 0.25,
);
next.head.position = Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1);
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
next.head.orientation = Quaternion::rotation_z(duck_head_look.x)
* Quaternion::rotation_x(-duck_head_look.y.abs() + wave_slow_cos * 0.03);
next.head.scale = Vec3::one();
next.torso.position = Vec3::new(
0.0,
skeleton_attr.chest.0,
wave_slow * 0.3 + skeleton_attr.chest.1,
) / 11.0;
next.torso.position = Vec3::new(0.0, s_a.chest.0, wave_slow * 0.3 + s_a.chest.1) / 11.0;
next.torso.orientation = Quaternion::rotation_y(wave_slow * 0.03);
next.torso.scale = Vec3::one() / 11.0;
next.tail.position = Vec3::new(0.0, skeleton_attr.tail.0, skeleton_attr.tail.1);
next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1);
next.tail.orientation = Quaternion::rotation_x(wave_slow_cos * 0.03);
next.tail.scale = Vec3::one();
next.wing_l.position = Vec3::new(
-skeleton_attr.wing.0,
skeleton_attr.wing.1,
skeleton_attr.wing.2,
);
next.wing_l.position = Vec3::new(-s_a.wing.0, s_a.wing.1, s_a.wing.2);
next.wing_l.orientation = Quaternion::rotation_z(0.0);
next.wing_l.scale = Vec3::one() * 1.05;
next.wing_r.position = Vec3::new(
skeleton_attr.wing.0,
skeleton_attr.wing.1,
skeleton_attr.wing.2,
);
next.wing_r.position = Vec3::new(s_a.wing.0, s_a.wing.1, s_a.wing.2);
next.wing_r.orientation = Quaternion::rotation_y(0.0);
next.wing_r.scale = Vec3::one() * 1.05;
next.leg_l.position = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1,
skeleton_attr.foot.2,
) / 11.0;
next.leg_l.position = Vec3::new(-s_a.foot.0, s_a.foot.1, s_a.foot.2) / 11.0;
next.leg_l.orientation = Quaternion::rotation_y(0.0);
next.leg_l.scale = Vec3::one() / 11.0;
next.leg_r.position = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1,
skeleton_attr.foot.2,
) / 11.0;
next.leg_r.position = Vec3::new(s_a.foot.0, s_a.foot.1, s_a.foot.2) / 11.0;
next.leg_r.orientation = Quaternion::rotation_x(0.0);
next.leg_r.scale = Vec3::one() / 11.0;
next

View File

@ -19,7 +19,7 @@ impl Animation for RunAnimation {
(_velocity, _global_time): Self::Dependency,
anim_time: f64,
_rate: &mut f32,
skeleton_attr: &SkeletonAttr,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
@ -30,60 +30,36 @@ impl Animation for RunAnimation {
let center = (anim_time as f32 * lab as f32 + PI / 2.0).sin();
let centeroffset = (anim_time as f32 * lab as f32 + PI * 1.5).sin();
next.head.position = Vec3::new(
0.0,
skeleton_attr.head.0,
skeleton_attr.head.1 + center * 0.5,
);
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1 + center * 0.5);
next.head.orientation =
Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0 + center * 0.03);
next.head.scale = Vec3::one();
next.torso.position = Vec3::new(
0.0,
skeleton_attr.chest.0 + centeroffset * 0.6,
center * 0.6 + skeleton_attr.chest.1,
s_a.chest.0 + centeroffset * 0.6,
center * 0.6 + s_a.chest.1,
) / 11.0;
next.torso.orientation = Quaternion::rotation_y(center * 0.05);
next.torso.scale = Vec3::one() / 11.0;
next.tail.position = Vec3::new(
0.0,
skeleton_attr.tail.0,
skeleton_attr.tail.1 + centeroffset * 0.6,
);
next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1 + centeroffset * 0.6);
next.tail.orientation = Quaternion::rotation_x(center * 0.03);
next.tail.scale = Vec3::one();
next.wing_l.position = Vec3::new(
-skeleton_attr.wing.0,
skeleton_attr.wing.1,
skeleton_attr.wing.2,
);
next.wing_l.position = Vec3::new(-s_a.wing.0, s_a.wing.1, s_a.wing.2);
next.wing_l.orientation = Quaternion::rotation_y((footl * 0.35).max(0.0));
next.wing_l.scale = Vec3::one() * 1.05;
next.wing_r.position = Vec3::new(
skeleton_attr.wing.0,
skeleton_attr.wing.1,
skeleton_attr.wing.2,
);
next.wing_r.position = Vec3::new(s_a.wing.0, s_a.wing.1, s_a.wing.2);
next.wing_r.orientation = Quaternion::rotation_y((footr * 0.35).min(0.0));
next.wing_r.scale = Vec3::one() * 1.05;
next.leg_l.position = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1 + footl * 1.0,
skeleton_attr.foot.2,
) / 11.0;
next.leg_l.position = Vec3::new(-s_a.foot.0, s_a.foot.1 + footl * 1.0, s_a.foot.2) / 11.0;
next.leg_l.orientation = Quaternion::rotation_x(footl * 0.5);
next.leg_l.scale = Vec3::one() / 11.0;
next.leg_r.position = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1 + footr * 1.0,
skeleton_attr.foot.2,
) / 11.0;
next.leg_r.position = Vec3::new(s_a.foot.0, s_a.foot.1 + footr * 1.0, s_a.foot.2) / 11.0;
next.leg_r.orientation = Quaternion::rotation_x(footr * 0.5);
next.leg_r.scale = Vec3::one() / 11.0;
next

View File

@ -30,7 +30,7 @@ impl Animation for AlphaAnimation {
(active_tool_kind, second_tool_kind, velocity, _global_time, stage_section): Self::Dependency,
anim_time: f64,
rate: &mut f32,
skeleton_attr: &SkeletonAttr,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
*rate = 1.0;
let mut next = (*skeleton).clone();
@ -77,10 +77,12 @@ impl Animation for AlphaAnimation {
//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.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.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)
@ -100,28 +102,26 @@ impl Animation for AlphaAnimation {
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.position = Vec3::new(0.0, s_a.head.0 + 0.0, s_a.head.1);
next.head.orientation = Quaternion::rotation_z(
movement1 * -0.9 + (movement2 * 1.75).sin() * 2.5 + movement3 * -0.5,
);
},
Some(ToolKind::Dagger(_)) => {
next.head.position =
Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1);
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
next.head.orientation = Quaternion::rotation_z(slow * -0.25)
* Quaternion::rotation_x(0.0 + slow * 0.15)
* Quaternion::rotation_y(slow * -0.15);
next.chest.position = Vec3::new(0.0, skeleton_attr.chest.0, skeleton_attr.chest.1);
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1);
next.chest.orientation = Quaternion::rotation_z(slow * 0.4)
* Quaternion::rotation_x(0.0 + slow * -0.2)
* Quaternion::rotation_y(slow * 0.2);
next.belt.position = Vec3::new(0.0, skeleton_attr.belt.0, skeleton_attr.belt.1);
next.belt.position = Vec3::new(0.0, s_a.belt.0, s_a.belt.1);
next.belt.orientation = next.chest.orientation * -0.3;
next.shorts.position =
Vec3::new(0.0, skeleton_attr.shorts.0, skeleton_attr.shorts.1);
next.shorts.position = Vec3::new(0.0, s_a.shorts.0, s_a.shorts.1);
next.shorts.orientation = next.chest.orientation * -0.45;
next.hand_l.position = Vec3::new(0.0, 0.0, 0.0);
@ -164,20 +164,14 @@ impl Animation for AlphaAnimation {
// * Quaternion::rotation_z(1.4 + slow * -0.5);
// next.control.scale = Vec3::one();
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
slow * -3.0 + quick * 3.0 - 4.0,
skeleton_attr.foot.2,
);
next.foot_l.position =
Vec3::new(-s_a.foot.0, slow * -3.0 + quick * 3.0 - 4.0, s_a.foot.2);
next.foot_l.orientation = Quaternion::rotation_x(slow * 0.6)
* Quaternion::rotation_y((slow * -0.2).max(0.0));
next.foot_l.scale = Vec3::one();
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
slow * 3.0 + quick * -3.0 + 5.0,
skeleton_attr.foot.2,
);
next.foot_r.position =
Vec3::new(s_a.foot.0, slow * 3.0 + quick * -3.0 + 5.0, s_a.foot.2);
next.foot_r.orientation = Quaternion::rotation_x(slow * -0.6)
* Quaternion::rotation_y((slow * 0.2).min(0.0));
next.foot_r.scale = Vec3::one();
@ -185,19 +179,18 @@ impl Animation for AlphaAnimation {
next.lantern.orientation =
Quaternion::rotation_x(slow * -0.7 + 0.4) * Quaternion::rotation_y(slow * 0.4);
next.torso.position = Vec3::new(0.0, 0.0, 0.1) * skeleton_attr.scaler;
next.torso.position = Vec3::new(0.0, 0.0, 0.1) * s_a.scaler;
next.torso.orientation = Quaternion::rotation_z(0.0)
* Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(0.0);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
next.torso.scale = Vec3::one() / 11.0 * s_a.scaler;
},
Some(ToolKind::Axe(_)) => {
next.head.position =
Vec3::new(0.0, 0.0 + skeleton_attr.head.0, skeleton_attr.head.1);
next.head.position = Vec3::new(0.0, 0.0 + s_a.head.0, s_a.head.1);
next.head.orientation = Quaternion::rotation_z(0.1 + axe * 0.2)
* Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(0.2);
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
next.head.scale = Vec3::one() * s_a.head_scale;
next.chest.position = Vec3::new(0.0, 0.0, 7.0);
next.chest.orientation = Quaternion::rotation_z(0.2 + axe * 0.2);
@ -231,11 +224,11 @@ impl Animation for AlphaAnimation {
next.lantern.orientation =
Quaternion::rotation_x(0.4) * Quaternion::rotation_y(0.0);
next.torso.position = Vec3::new(0.0, 0.0, 0.1) * skeleton_attr.scaler;
next.torso.position = Vec3::new(0.0, 0.0, 0.1) * s_a.scaler;
next.torso.orientation = Quaternion::rotation_z(0.0)
* Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(0.0);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
next.torso.scale = Vec3::one() / 11.0 * s_a.scaler;
},
Some(ToolKind::Hammer(_)) => {
next.hand_l.position = Vec3::new(-12.0, 0.0, 0.0);
@ -250,13 +243,12 @@ impl Animation for AlphaAnimation {
* Quaternion::rotation_y(-1.57)
* Quaternion::rotation_z(1.57);
next.head.position =
Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1);
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
next.head.orientation = Quaternion::rotation_z(slower * 0.03)
* Quaternion::rotation_x(slowersmooth * 0.1)
* Quaternion::rotation_y(slower * 0.05 + slowersmooth * 0.06)
* Quaternion::rotation_z((slowersmooth * -0.4).max(0.0));
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
next.head.scale = Vec3::one() * s_a.head_scale;
next.chest.position = Vec3::new(0.0, 0.0, 7.0);
next.chest.orientation =
@ -279,47 +271,38 @@ impl Animation for AlphaAnimation {
next.lantern.orientation = Quaternion::rotation_x(slower * -0.7 + 0.4)
* Quaternion::rotation_y(slower * 0.4);
next.torso.position = Vec3::new(0.0, 0.0, 0.1) * skeleton_attr.scaler;
next.torso.position = Vec3::new(0.0, 0.0, 0.1) * s_a.scaler;
next.torso.orientation = Quaternion::rotation_z(0.0);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
next.torso.scale = Vec3::one() / 11.0 * s_a.scaler;
if velocity > 0.5 {
next.foot_l.position =
Vec3::new(-skeleton_attr.foot.0, foot * -6.0, skeleton_attr.foot.2);
next.foot_l.position = Vec3::new(-s_a.foot.0, foot * -6.0, s_a.foot.2);
next.foot_l.orientation = Quaternion::rotation_x(foot * -0.4)
* Quaternion::rotation_z((slower * 0.3).max(0.0));
next.foot_l.scale = Vec3::one();
next.foot_r.position =
Vec3::new(skeleton_attr.foot.0, foot * 6.0, skeleton_attr.foot.2);
next.foot_r.position = Vec3::new(s_a.foot.0, foot * 6.0, s_a.foot.2);
next.foot_r.orientation = Quaternion::rotation_x(foot * 0.4)
* Quaternion::rotation_z((slower * 0.3).max(0.0));
next.foot_r.scale = Vec3::one();
next.torso.position = Vec3::new(0.0, 0.0, 0.1) * skeleton_attr.scaler;
next.torso.position = Vec3::new(0.0, 0.0, 0.1) * s_a.scaler;
next.torso.orientation =
Quaternion::rotation_z(0.0) * Quaternion::rotation_x(-0.15);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
next.torso.scale = Vec3::one() / 11.0 * s_a.scaler;
} else {
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
-2.5,
skeleton_attr.foot.2 + (slower * 2.5).max(0.0),
);
next.foot_l.position =
Vec3::new(-s_a.foot.0, -2.5, s_a.foot.2 + (slower * 2.5).max(0.0));
next.foot_l.orientation = Quaternion::rotation_x(slower * -0.2 - 0.2)
* Quaternion::rotation_z((slower * 1.0).max(0.0));
next.foot_l.scale = Vec3::one();
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
3.5 - slower * 2.0,
skeleton_attr.foot.2,
);
next.foot_r.position = Vec3::new(s_a.foot.0, 3.5 - slower * 2.0, s_a.foot.2);
next.foot_r.orientation = Quaternion::rotation_x(slower * 0.1)
* Quaternion::rotation_z((slower * 0.5).max(0.0));
next.foot_r.scale = Vec3::one();
next.torso.position = Vec3::new(0.0, 0.0, 0.1) * skeleton_attr.scaler;
next.torso.position = Vec3::new(0.0, 0.0, 0.1) * s_a.scaler;
next.torso.orientation = Quaternion::rotation_z(0.0);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
next.torso.scale = Vec3::one() / 11.0 * s_a.scaler;
}
next.control.scale = Vec3::one();
@ -329,9 +312,9 @@ impl Animation for AlphaAnimation {
* Quaternion::rotation_z(1.4 + slowersmooth * 0.2);
next.control.scale = Vec3::one();
next.torso.position = Vec3::new(0.0, 0.0, 0.1) * skeleton_attr.scaler;
next.torso.position = Vec3::new(0.0, 0.0, 0.1) * s_a.scaler;
next.torso.orientation = Quaternion::rotation_z(0.0);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
next.torso.scale = Vec3::one() / 11.0 * s_a.scaler;
},
Some(ToolKind::Staff(_)) | Some(ToolKind::Sceptre(_)) => {
next.head.orientation =
@ -369,9 +352,9 @@ impl Animation for AlphaAnimation {
* Quaternion::rotation_x(PI)
* Quaternion::rotation_y(0.0);
next.main.scale = Vec3::one();
next.torso.position = Vec3::new(0.0, 0.0, 0.1) * skeleton_attr.scaler;
next.torso.position = Vec3::new(0.0, 0.0, 0.1) * s_a.scaler;
next.torso.orientation = Quaternion::rotation_x(0.0);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
next.torso.scale = Vec3::one() / 11.0 * s_a.scaler;
},
_ => {},
}

View File

@ -30,7 +30,7 @@ impl Animation for BeamAnimation {
(active_tool_kind, second_tool_kind, _global_time, velocity, stage_section): Self::Dependency,
anim_time: f64,
rate: &mut f32,
skeleton_attr: &SkeletonAttr,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
*rate = 1.0;
let mut next = (*skeleton).clone();
@ -97,19 +97,13 @@ impl Animation for BeamAnimation {
next.head.orientation =
Quaternion::rotation_z(movement1 * -0.5 + (movement2 * 16.0).sin() * 0.05);
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1 + movement1 * -3.0,
skeleton_attr.foot.2,
);
next.foot_l.position =
Vec3::new(-s_a.foot.0, s_a.foot.1 + movement1 * -3.0, s_a.foot.2);
next.foot_l.orientation = Quaternion::rotation_x(movement1 * -0.5)
* Quaternion::rotation_z(movement1 * 0.5);
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1 + movement1 * 4.0,
skeleton_attr.foot.2,
);
next.foot_r.position =
Vec3::new(s_a.foot.0, s_a.foot.1 + movement1 * 4.0, s_a.foot.2);
next.foot_r.orientation = Quaternion::rotation_z(movement1 * 0.5);
next.chest.orientation =
Quaternion::rotation_x(movement1 * -0.2 + (movement2 * 8.0).sin() * 0.05)

View File

@ -28,7 +28,7 @@ impl Animation for BetaAnimation {
(active_tool_kind, second_tool_kind, _velocity, _global_time, stage_section): Self::Dependency,
anim_time: f64,
rate: &mut f32,
skeleton_attr: &SkeletonAttr,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
*rate = 1.0;
let mut next = (*skeleton).clone();
@ -43,16 +43,20 @@ impl Animation for BetaAnimation {
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_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.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.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
next.control.position = Vec3::new(
-8.0 + movement1 * -5.0 + (movement2 as f32 * 2.5).sin() * 30.0 + movement3 * -5.0,
-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,
);
@ -63,13 +67,15 @@ impl Animation for BetaAnimation {
* 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,
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,
);
}
},
_ => {},
}

View File

@ -20,7 +20,7 @@ impl Animation for BlockAnimation {
(active_tool_kind, second_tool_kind, global_time): Self::Dependency,
anim_time: f64,
_rate: &mut f32,
skeleton_attr: &SkeletonAttr,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
@ -36,33 +36,23 @@ impl Animation for BlockAnimation {
.sin()
* 0.15,
);
next.head.position = Vec3::new(
0.0,
-1.0 + skeleton_attr.head.0,
skeleton_attr.head.1 + 19.5,
);
next.head.position = Vec3::new(0.0, -1.0 + s_a.head.0, s_a.head.1 + 19.5);
next.head.orientation = Quaternion::rotation_x(-0.25);
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
next.head.scale = Vec3::one() * s_a.head_scale;
next.chest.position = Vec3::new(0.0, skeleton_attr.chest.0, skeleton_attr.chest.1);
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1);
next.belt.position = Vec3::new(0.0, skeleton_attr.belt.0, skeleton_attr.belt.1);
next.belt.position = Vec3::new(0.0, s_a.belt.0, s_a.belt.1);
next.shorts.position = Vec3::new(0.0, skeleton_attr.shorts.0, skeleton_attr.shorts.1);
next.shorts.position = Vec3::new(0.0, s_a.shorts.0, s_a.shorts.1);
match active_tool_kind {
Some(ToolKind::Shield(_)) => {
next.hand_l.position = Vec3::new(
skeleton_attr.hand.0 - 6.0,
skeleton_attr.hand.1 + 3.5,
skeleton_attr.hand.2 + 0.0,
);
next.hand_l.position =
Vec3::new(s_a.hand.0 - 6.0, s_a.hand.1 + 3.5, s_a.hand.2 + 0.0);
next.hand_l.orientation = Quaternion::rotation_x(-0.3);
next.hand_r.position = Vec3::new(
skeleton_attr.hand.0 - 6.0,
skeleton_attr.hand.1 + 3.0,
skeleton_attr.hand.2 - 2.0,
);
next.hand_r.position =
Vec3::new(s_a.hand.0 - 6.0, s_a.hand.1 + 3.0, s_a.hand.2 - 2.0);
next.hand_r.orientation = Quaternion::rotation_x(-0.3);
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_x(-0.3);
@ -73,15 +63,11 @@ impl Animation for BlockAnimation {
next.glider.position = Vec3::new(0.0, 0.0, 10.0);
next.glider.scale = Vec3::one() * 0.0;
next.lantern.position = Vec3::new(
skeleton_attr.lantern.0,
skeleton_attr.lantern.1,
skeleton_attr.lantern.2,
);
next.lantern.position = Vec3::new(s_a.lantern.0, s_a.lantern.1, s_a.lantern.2);
next.lantern.scale = Vec3::one() * 0.65;
next.hold.scale = Vec3::one() * 0.0;
next.torso.position = Vec3::new(0.0, -0.2, 0.1) * skeleton_attr.scaler;
next.torso.position = Vec3::new(0.0, -0.2, 0.1) * s_a.scaler;
next.second.scale = match (
active_tool_kind.map(|tk| tk.hands()),

View File

@ -29,7 +29,7 @@ impl Animation for ChargeAnimation {
(active_tool_kind, second_tool_kind, velocity, orientation, last_ori, _global_time): Self::Dependency,
anim_time: f64,
rate: &mut f32,
skeleton_attr: &SkeletonAttr,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
*rate = 1.0;
@ -76,23 +76,19 @@ impl Animation for ChargeAnimation {
0.0
} * 1.3;
next.head.position = Vec3::new(
stop * -2.0,
-1.5 + stop * 2.5 + skeleton_attr.head.0,
skeleton_attr.head.1,
);
next.head.position = Vec3::new(stop * -2.0, -1.5 + stop * 2.5 + s_a.head.0, s_a.head.1);
next.head.orientation =
Quaternion::rotation_z(stop * -1.0 + tilt * -2.0) * Quaternion::rotation_y(stop * -0.3);
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
next.head.scale = Vec3::one() * s_a.head_scale;
next.chest.position = Vec3::new(0.0, skeleton_attr.chest.0, skeleton_attr.chest.1);
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1);
next.chest.orientation =
Quaternion::rotation_z(stop * 1.2 + stress * stop * 0.02 + tilt * -2.0);
next.belt.position = Vec3::new(0.0, skeleton_attr.belt.0, skeleton_attr.belt.1);
next.belt.position = Vec3::new(0.0, s_a.belt.0, s_a.belt.1);
next.belt.orientation = Quaternion::rotation_z(stop * -0.5 + tilt * 2.0);
next.shorts.position = Vec3::new(0.0, skeleton_attr.shorts.0, skeleton_attr.shorts.1);
next.shorts.position = Vec3::new(0.0, s_a.shorts.0, s_a.shorts.1);
next.shorts.orientation = Quaternion::rotation_z(stop * -0.7 + tilt * 4.0);
match active_tool_kind {
@ -160,42 +156,39 @@ impl Animation for ChargeAnimation {
if velocity > 0.2 {
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0 - foot * 1.5,
skeleton_attr.foot.1 + foote * 2.0,
skeleton_attr.foot.2,
-s_a.foot.0 - foot * 1.5,
s_a.foot.1 + foote * 2.0,
s_a.foot.2,
);
next.foot_l.orientation = Quaternion::rotation_x(foote * -0.1)
* Quaternion::rotation_z(0.4)
* Quaternion::rotation_y(0.15);
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0 + foot * 1.5,
skeleton_attr.foot.1 + foote * -1.5,
skeleton_attr.foot.2,
s_a.foot.0 + foot * 1.5,
s_a.foot.1 + foote * -1.5,
s_a.foot.2,
);
next.foot_r.orientation = Quaternion::rotation_x(0.0)
* Quaternion::rotation_z(0.4)
* Quaternion::rotation_y(0.0);
} else {
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
-s_a.foot.0,
-2.5 + stop * -1.3,
skeleton_attr.foot.2 + tilt * -4.0 * foot,
s_a.foot.2 + tilt * -4.0 * foot,
);
next.foot_l.orientation =
Quaternion::rotation_x(stop * -0.2 - 0.2 + stop * stress * 0.02)
* Quaternion::rotation_z(stop * 0.1)
* Quaternion::rotation_y(stop * 0.08);
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
3.5 + stop * 1.5,
skeleton_attr.foot.2 + tilt * 4.0 * foot,
);
next.foot_r.position =
Vec3::new(s_a.foot.0, 3.5 + stop * 1.5, s_a.foot.2 + tilt * 4.0 * foot);
next.foot_r.orientation =
Quaternion::rotation_x(stop * 0.1) * Quaternion::rotation_z(stop * 0.1);
}
next.back.position = Vec3::new(0.0, skeleton_attr.back.0, skeleton_attr.back.1);
next.back.position = Vec3::new(0.0, s_a.back.0, s_a.back.1);
next.back.orientation = Quaternion::rotation_x(-0.3);
next.glider.position = Vec3::new(0.0, 0.0, 10.0);

View File

@ -29,7 +29,7 @@ impl Animation for ChargeswingAnimation {
(active_tool_kind, second_tool_kind, velocity, _global_time, stage_section): Self::Dependency,
anim_time: f64,
rate: &mut f32,
skeleton_attr: &SkeletonAttr,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
*rate = 1.0;
let mut next = (*skeleton).clone();
@ -91,8 +91,7 @@ impl Animation for ChargeswingAnimation {
)
* Quaternion::rotation_z(0.0 + (movement * 0.2).min(0.5));
next.chest.position =
Vec3::new(0.0, skeleton_attr.chest.0, skeleton_attr.chest.1);
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1);
next.chest.orientation =
Quaternion::rotation_z((movement * 2.0).min(PI / 2.0));
next.belt.orientation =
@ -102,8 +101,8 @@ impl Animation for ChargeswingAnimation {
next.head.position = Vec3::new(
0.0,
skeleton_attr.head.0 - 2.0 + (movement * 2.0).min(2.0),
skeleton_attr.head.1,
s_a.head.0 - 2.0 + (movement * 2.0).min(2.0),
s_a.head.1,
);
next.head.orientation =
@ -113,15 +112,15 @@ impl Animation for ChargeswingAnimation {
next.shorts.orientation = Quaternion::rotation_z(short * 0.15);
if speed > 0.5 {
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1 + foothoril * -2.5 - 3.5,
skeleton_attr.foot.2 + ((footvertl * -1.2).max(-1.0)),
-s_a.foot.0,
s_a.foot.1 + foothoril * -2.5 - 3.5,
s_a.foot.2 + ((footvertl * -1.2).max(-1.0)),
);
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1 + foothorir * -2.5 + 6.0,
skeleton_attr.foot.2 + ((footvertr * -1.2).max(-1.0)),
s_a.foot.0,
s_a.foot.1 + foothorir * -2.5 + 6.0,
s_a.foot.2 + ((footvertr * -1.2).max(-1.0)),
);
next.foot_l.orientation =
@ -132,17 +131,11 @@ impl Animation for ChargeswingAnimation {
Quaternion::rotation_x(-0.4 + footrotr * -0.2)
* Quaternion::rotation_z((movement * 0.5).min(0.5));
} else {
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1 - 5.0,
skeleton_attr.foot.2,
);
next.foot_l.position =
Vec3::new(-s_a.foot.0, s_a.foot.1 - 5.0, s_a.foot.2);
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1 + 7.0,
skeleton_attr.foot.2,
);
next.foot_r.position =
Vec3::new(s_a.foot.0, s_a.foot.1 + 7.0, s_a.foot.2);
next.foot_l.orientation =
Quaternion::rotation_x(-0.2) * Quaternion::rotation_z(0.5);

View File

@ -26,7 +26,7 @@ impl Animation for ClimbAnimation {
(active_tool_kind, second_tool_kind, velocity, _orientation, global_time): Self::Dependency,
anim_time: f64,
rate: &mut f32,
skeleton_attr: &SkeletonAttr,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let lateral = Vec2::<f32>::from(velocity).magnitude();
@ -64,45 +64,36 @@ impl Animation for ClimbAnimation {
let stagnant = if speed > -0.7 { 1.0 } else { 0.0 }; //sets static position when there is no movement
if speed > 0.7 || lateral > 0.1 {
next.head.position = Vec3::new(
0.0,
-4.0 + skeleton_attr.head.0,
skeleton_attr.head.1 + smootha * 0.2,
);
next.head.position = Vec3::new(0.0, -4.0 + s_a.head.0, s_a.head.1 + smootha * 0.2);
next.head.orientation = Quaternion::rotation_z(smooth * 0.1)
* Quaternion::rotation_x(0.6)
* Quaternion::rotation_y(quick * 0.1);
next.chest.position = Vec3::new(
0.0,
skeleton_attr.chest.0,
skeleton_attr.chest.1 + smootha * 1.1,
);
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + smootha * 1.1);
next.chest.orientation = Quaternion::rotation_z(quick * 0.25)
* Quaternion::rotation_x(-0.15)
* Quaternion::rotation_y(quick * -0.12);
next.belt.position = Vec3::new(0.0, skeleton_attr.belt.0 + 1.0, skeleton_attr.belt.1);
next.belt.position = Vec3::new(0.0, s_a.belt.0 + 1.0, s_a.belt.1);
next.back.orientation = Quaternion::rotation_x(-0.2);
next.shorts.position =
Vec3::new(0.0, skeleton_attr.shorts.0 + 1.0, skeleton_attr.shorts.1);
next.shorts.position = Vec3::new(0.0, s_a.shorts.0 + 1.0, s_a.shorts.1);
next.shorts.orientation = Quaternion::rotation_z(quick * 0.0)
* Quaternion::rotation_x(0.1)
* Quaternion::rotation_y(quick * 0.10);
next.hand_l.position = Vec3::new(
-skeleton_attr.hand.0,
4.0 + skeleton_attr.hand.1 + quicka * 1.5,
5.0 + skeleton_attr.hand.2 - quick * 4.0,
-s_a.hand.0,
4.0 + s_a.hand.1 + quicka * 1.5,
5.0 + s_a.hand.2 - quick * 4.0,
);
next.hand_l.orientation = Quaternion::rotation_x(2.2 + quicka * 0.5);
next.hand_r.position = Vec3::new(
skeleton_attr.hand.0,
5.0 + skeleton_attr.hand.1 - quicka * 1.5,
5.0 + skeleton_attr.hand.2 + quick * 4.0,
s_a.hand.0,
5.0 + s_a.hand.1 - quicka * 1.5,
5.0 + s_a.hand.2 + quick * 4.0,
);
next.hand_r.orientation = Quaternion::rotation_x(2.2 - quicka * 0.5);
@ -140,18 +131,12 @@ impl Animation for ClimbAnimation {
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
},
}
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
5.0 + skeleton_attr.foot.1,
skeleton_attr.foot.2 + quick * 2.5,
);
next.foot_l.position =
Vec3::new(-s_a.foot.0, 5.0 + s_a.foot.1, s_a.foot.2 + quick * 2.5);
next.foot_l.orientation = Quaternion::rotation_x(0.2 - quicka * 0.5);
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
4.0 + skeleton_attr.foot.1,
skeleton_attr.foot.2 - quick * 2.5,
);
next.foot_r.position =
Vec3::new(s_a.foot.0, 4.0 + s_a.foot.1, s_a.foot.2 - quick * 2.5);
next.foot_r.orientation = Quaternion::rotation_x(0.2 + quicka * 0.5);
next.shoulder_l.orientation = Quaternion::rotation_x(smootha * 0.15);
@ -171,60 +156,54 @@ impl Animation for ClimbAnimation {
next.lantern.orientation =
Quaternion::rotation_x(smooth * -0.3) * Quaternion::rotation_y(smooth * -0.3);
next.torso.position = Vec3::new(0.0, -0.2 + smooth * -0.08, 0.4) * skeleton_attr.scaler;
next.torso.position = Vec3::new(0.0, -0.2 + smooth * -0.08, 0.4) * s_a.scaler;
} else {
next.head.position = Vec3::new(
0.0,
-1.0 - stagnant + skeleton_attr.head.0,
skeleton_attr.head.1,
);
next.head.position = Vec3::new(0.0, -1.0 - stagnant + s_a.head.0, s_a.head.1);
next.head.orientation = Quaternion::rotation_x(
-0.25 * (1.0 - stagnant) + stagnant * 2.0 * head_look.x.abs(),
) * Quaternion::rotation_z(stagnant * 3.5 * head_look.x.abs());
next.chest.position =
Vec3::new(0.0, 1.0 + skeleton_attr.chest.0, skeleton_attr.chest.1);
next.chest.position = Vec3::new(0.0, 1.0 + s_a.chest.0, s_a.chest.1);
next.chest.orientation = Quaternion::rotation_z(0.6 * stagnant)
* Quaternion::rotation_x((0.2 + drop * 0.05) * (1.0 - stagnant));
next.belt.position = Vec3::new(0.0, skeleton_attr.belt.0 + 0.5, skeleton_attr.belt.1);
next.belt.position = Vec3::new(0.0, s_a.belt.0 + 0.5, s_a.belt.1);
next.belt.orientation = Quaternion::rotation_x(0.1 + dropa * 0.1);
next.back.orientation = Quaternion::rotation_x(
-0.2 + dropa * 0.1 - 0.15 * (1.0 - stagnant) + stagnant * 0.1,
);
next.shorts.position =
Vec3::new(0.0, skeleton_attr.shorts.0 + 1.0, skeleton_attr.shorts.1);
next.shorts.position = Vec3::new(0.0, s_a.shorts.0 + 1.0, s_a.shorts.1);
next.shorts.orientation = Quaternion::rotation_x(0.1 + dropa * 0.12 * (1.0 - stagnant));
next.hand_l.position = Vec3::new(
-skeleton_attr.hand.0,
7.5 + stagnant * -5.0 + skeleton_attr.hand.1,
7.0 + stagnant * -7.0 + skeleton_attr.hand.2 + dropa * -1.0 * (1.0 - stagnant),
-s_a.hand.0,
7.5 + stagnant * -5.0 + s_a.hand.1,
7.0 + stagnant * -7.0 + s_a.hand.2 + dropa * -1.0 * (1.0 - stagnant),
);
next.hand_l.orientation = Quaternion::rotation_x(2.2 + stagnant * -1.4)
* Quaternion::rotation_y((0.3 + dropa * 0.1) * (1.0 - stagnant));
next.hand_r.position = Vec3::new(
skeleton_attr.hand.0,
7.5 + stagnant * -2.5 + skeleton_attr.hand.1,
5.0 + skeleton_attr.hand.2 + drop * -1.0 * (1.0 - stagnant),
s_a.hand.0,
7.5 + stagnant * -2.5 + s_a.hand.1,
5.0 + s_a.hand.2 + drop * -1.0 * (1.0 - stagnant),
);
next.hand_r.orientation = Quaternion::rotation_x(2.2)
* Quaternion::rotation_y(-0.3 + drop * 0.1 * (1.0 - stagnant));
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
4.0 + stagnant * 3.0 + skeleton_attr.foot.1,
1.0 + skeleton_attr.foot.2 + drop * -2.0 * (1.0 - stagnant),
-s_a.foot.0,
4.0 + stagnant * 3.0 + s_a.foot.1,
1.0 + s_a.foot.2 + drop * -2.0 * (1.0 - stagnant),
);
next.foot_l.orientation = Quaternion::rotation_x(0.55 + drop * 0.1 * (1.0 - stagnant));
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
2.0 + stagnant * 4.0 + skeleton_attr.foot.1,
-2.0 + skeleton_attr.foot.2 + smooth * 1.0 * (1.0 - stagnant),
s_a.foot.0,
2.0 + stagnant * 4.0 + s_a.foot.1,
-2.0 + s_a.foot.2 + smooth * 1.0 * (1.0 - stagnant),
);
next.foot_r.orientation =
Quaternion::rotation_x(0.2 + smooth * 0.15 * (1.0 - stagnant));
@ -235,7 +214,7 @@ impl Animation for ClimbAnimation {
next.main.position = Vec3::new(-7.0, -5.0, 18.0);
next.main.orientation = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
next.torso.position = Vec3::new(0.0, -0.2, 0.4) * skeleton_attr.scaler;
next.torso.position = Vec3::new(0.0, -0.2, 0.4) * s_a.scaler;
};
next.second.scale = match (

View File

@ -20,7 +20,7 @@ impl Animation for DanceAnimation {
(active_tool_kind, second_tool_kind, global_time): Self::Dependency,
anim_time: f64,
rate: &mut f32,
skeleton_attr: &SkeletonAttr,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
@ -56,83 +56,71 @@ impl Animation for DanceAnimation {
* 0.15,
);
next.head.position = Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1);
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
next.head.orientation = Quaternion::rotation_z(short * -0.6)
* 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() * s_a.head_scale;
next.chest.position = Vec3::new(
0.0,
skeleton_attr.chest.0,
skeleton_attr.chest.1 + shortealt * 1.5,
);
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + shortealt * 1.5);
next.chest.orientation = Quaternion::rotation_z(short * 0.35)
* Quaternion::rotation_y(shorte * 0.08)
* Quaternion::rotation_x(foot * 0.07);
next.chest.scale = Vec3::one();
next.belt.position = Vec3::new(0.0, skeleton_attr.belt.0, skeleton_attr.belt.1);
next.belt.position = Vec3::new(0.0, s_a.belt.0, s_a.belt.1);
next.belt.orientation = Quaternion::rotation_z(shorte * 0.25);
next.belt.scale = Vec3::one();
next.back.position = Vec3::new(0.0, skeleton_attr.back.0, skeleton_attr.back.1);
next.back.position = Vec3::new(0.0, s_a.back.0, s_a.back.1);
next.back.orientation =
Quaternion::rotation_x(-0.25 + shorte * 0.1 + noisea * 0.1 + noiseb * 0.1);
next.back.scale = Vec3::one() * 1.02;
next.shorts.position = Vec3::new(0.0, skeleton_attr.shorts.0, skeleton_attr.shorts.1);
next.shorts.position = Vec3::new(0.0, s_a.shorts.0, s_a.shorts.1);
next.shorts.orientation = Quaternion::rotation_z(foot * 0.35);
next.shorts.scale = Vec3::one();
next.hand_l.position = Vec3::new(
1.0 - skeleton_attr.hand.0,
2.0 + skeleton_attr.hand.1 + shortealt * -3.0,
skeleton_attr.hand.2 + shortealt * -0.75,
1.0 - s_a.hand.0,
2.0 + s_a.hand.1 + shortealt * -3.0,
s_a.hand.2 + shortealt * -0.75,
);
next.hand_l.orientation =
Quaternion::rotation_x(1.4 + foot * 0.15) * Quaternion::rotation_y(0.2);
next.hand_l.scale = Vec3::one();
next.hand_r.position = Vec3::new(
-1.0 + skeleton_attr.hand.0,
2.0 + skeleton_attr.hand.1 + shortealt * 3.0,
skeleton_attr.hand.2 + shortealt * 0.75,
-1.0 + s_a.hand.0,
2.0 + s_a.hand.1 + shortealt * 3.0,
s_a.hand.2 + shortealt * 0.75,
);
next.hand_r.orientation =
Quaternion::rotation_x(1.4 + foot * -0.15) * Quaternion::rotation_y(-0.2);
next.hand_r.scale = Vec3::one();
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0 + foot * 0.8,
1.5 + -skeleton_attr.foot.1 + foot * -4.0,
skeleton_attr.foot.2 + 2.0,
-s_a.foot.0 + foot * 0.8,
1.5 + -s_a.foot.1 + foot * -4.0,
s_a.foot.2 + 2.0,
);
next.foot_l.orientation =
Quaternion::rotation_x(foot * -0.3) * Quaternion::rotation_z(short * -0.15);
next.foot_l.scale = Vec3::one();
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0 + foot * 0.8,
1.5 + -skeleton_attr.foot.1 + foot * 4.0,
skeleton_attr.foot.2 + 2.0,
s_a.foot.0 + foot * 0.8,
1.5 + -s_a.foot.1 + foot * 4.0,
s_a.foot.2 + 2.0,
);
next.foot_r.orientation =
Quaternion::rotation_x(foot * 0.3) * Quaternion::rotation_z(short * 0.15);
next.foot_r.scale = Vec3::one();
next.shoulder_l.position = Vec3::new(
-skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1,
skeleton_attr.shoulder.2,
);
next.shoulder_l.position = Vec3::new(-s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2);
next.shoulder_l.orientation = Quaternion::rotation_x(shorte * 0.15);
next.shoulder_l.scale = Vec3::one() * 1.1;
next.shoulder_r.position = Vec3::new(
skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1,
skeleton_attr.shoulder.2,
);
next.shoulder_r.position = Vec3::new(s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2);
next.shoulder_r.orientation = Quaternion::rotation_x(shorte * -0.15);
next.shoulder_r.scale = Vec3::one() * 1.1;
@ -176,19 +164,15 @@ impl Animation for DanceAnimation {
}
next.second.scale = Vec3::one();
next.lantern.position = Vec3::new(
skeleton_attr.lantern.0,
skeleton_attr.lantern.1,
skeleton_attr.lantern.2,
);
next.lantern.position = Vec3::new(s_a.lantern.0, s_a.lantern.1, s_a.lantern.2);
next.lantern.orientation =
Quaternion::rotation_x(shorte * 0.7 + 0.4) * Quaternion::rotation_y(shorte * 0.4);
next.lantern.scale = Vec3::one() * 0.65;
next.hold.scale = Vec3::one() * 0.0;
next.torso.position = Vec3::new(0.0, -0.3, 0.0) * skeleton_attr.scaler;
next.torso.position = Vec3::new(0.0, -0.3, 0.0) * s_a.scaler;
next.torso.orientation = Quaternion::rotation_z(short * -0.2);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
next.torso.scale = Vec3::one() / 11.0 * s_a.scaler;
next.control.position = Vec3::new(0.0, 0.0, 0.0);
next.control.orientation = Quaternion::rotation_x(0.0);

View File

@ -32,7 +32,7 @@ impl Animation for DashAnimation {
(active_tool_kind, second_tool_kind, _global_time, stage_section): Self::Dependency,
anim_time: f64,
rate: &mut f32,
skeleton_attr: &SkeletonAttr,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
*rate = 1.0;
let mut next = (*skeleton).clone();
@ -45,38 +45,33 @@ impl Animation for DashAnimation {
_ => (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())
* ((x * 12.4).sin()) }
fn slow(x: f32) -> f32 {
(((5.0) / (1.1 + 3.9 * ((x * 12.4).sin()).powf(2.0 as f32))).sqrt())
* ((x * 12.4).sin())
}
fn short (x: f32) -> f32 { (((5.0)
/ (1.5 + 3.5 * ((x * 5.0).sin()).powf(2.0 as f32)))
.sqrt())
* ((x * 5.0).sin()) }
fn foothoril (x: f32) -> f32 { (x * 5.0 + PI * 1.45).sin() }
fn foothorir (x: f32) -> f32 { (x * 5.0 + PI * (0.45)).sin() }
fn short(x: f32) -> f32 {
(((5.0) / (1.5 + 3.5 * ((x * 5.0).sin()).powf(2.0 as f32))).sqrt()) * ((x * 5.0).sin())
}
fn foothoril(x: f32) -> f32 { (x * 5.0 + PI * 1.45).sin() }
fn foothorir(x: f32) -> f32 { (x * 5.0 + PI * (0.45)).sin() }
fn footvertl (x: f32) -> f32 { (x * 5.0).sin() }
fn footvertr (x: f32) -> f32 { (x * 5.0 + PI).sin() }
fn footvertl(x: f32) -> f32 { (x * 5.0).sin() }
fn footvertr(x: f32) -> f32 { (x * 5.0 + PI).sin() }
fn footrotl (x: f32) -> f32 { (((1.0)
/ (0.05
+ (0.95)
* ((x * 5.0 + PI * 1.4).sin()).powf(2.0 as f32)))
.sqrt())
* ((x * 5.0 + PI * 1.4).sin()) }
fn footrotl(x: f32) -> f32 {
(((1.0) / (0.05 + (0.95) * ((x * 5.0 + PI * 1.4).sin()).powf(2.0 as f32))).sqrt())
* ((x * 5.0 + PI * 1.4).sin())
}
fn footrotr (x: f32) -> f32 { (((1.0)
/ (0.05
+ (0.95)
* ((x * 5.0 + PI * 0.4).sin()).powf(2.0 as f32)))
.sqrt())
* ((x * 5.0 + PI * 0.4).sin()) }
fn footrotr(x: f32) -> f32 {
(((1.0) / (0.05 + (0.95) * ((x * 5.0 + PI * 0.4).sin()).powf(2.0 as f32))).sqrt())
* ((x * 5.0 + PI * 0.4).sin())
}
fn shortalt (x: f32) -> f32 { (x * 5.0 + PI / 2.0).sin() }
fn shortalt(x: f32) -> f32 { (x * 5.0 + PI / 2.0).sin() }
next.head.position = Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1);
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
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);
@ -92,36 +87,31 @@ impl Animation for DashAnimation {
match active_tool_kind {
//TODO: Inventory
Some(ToolKind::Sword(_)) => {
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)
next.head.position =
Vec3::new(0.0, 0.0 + s_a.head.0, s_a.head.1 + movement2.min(1.0) * 1.0);
next.head.orientation = Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(movement2.min(1.0) * -0.3 + movement3 * 0.3)
* Quaternion::rotation_z(movement1 * -0.9 + movement3 * 1.6);
next.chest.position = Vec3::new(
0.0,
skeleton_attr.chest.0,
skeleton_attr.chest.1 + 2.0 + shortalt(movement2) * -2.5,
s_a.chest.0,
s_a.chest.1 + 2.0 + shortalt(movement2) * -2.5,
);
next.chest.orientation =
Quaternion::rotation_x(movement2.min(1.0) * -0.4 + movement3 * 0.4)
* Quaternion::rotation_y(movement2.min(1.0) * -0.2 + movement3 * 0.3)
* Quaternion::rotation_z(movement1 * 1.1 + movement3 * -2.2);
* Quaternion::rotation_y(movement2.min(1.0) * -0.2 + movement3 * 0.3)
* Quaternion::rotation_z(movement1 * 1.1 + movement3 * -2.2);
next.control.position = Vec3::new(
-7.0 + movement1 * -5.0 + movement3 * -2.0,
7.0 + movement2.min(1.0) * -2.0,
2.0 + movement2.min(1.0) * 2.0
2.0 + movement2.min(1.0) * 2.0,
);
next.control.orientation =
Quaternion::rotation_x(movement1 * -1.0 + movement3 * -0.5)
* Quaternion::rotation_y(movement1 * 1.5 + movement3 * -2.5)
* Quaternion::rotation_z(0.0);
* Quaternion::rotation_y(movement1 * 1.5 + movement3 * -2.5)
* Quaternion::rotation_z(0.0);
next.control.scale = Vec3::one();
next.shorts.orientation = Quaternion::rotation_z(short(movement2).min(1.0) * 0.25);
@ -129,31 +119,27 @@ impl Animation for DashAnimation {
next.belt.orientation = Quaternion::rotation_z(short(movement2).min(1.0) * 0.1);
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1 + movement1 * -12.0 + foothoril(movement2) * -7.5,
skeleton_attr.foot.2 + ((footvertl(movement2) * -4.0).max(-1.0)),
-s_a.foot.0,
s_a.foot.1 + movement1 * -12.0 + foothoril(movement2) * -7.5,
s_a.foot.2 + ((footvertl(movement2) * -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(movement1 * -1.0 + footrotl(movement2) * -0.6);
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1 + foothorir(movement2) * -7.5,
skeleton_attr.foot.2 + ((footvertr(movement2) * -4.0).max(-1.0)),
s_a.foot.0,
s_a.foot.1 + foothorir(movement2) * -7.5,
s_a.foot.2 + ((footvertr(movement2) * -4.0).max(-1.0)),
);
next.foot_r.orientation =
Quaternion::rotation_x(-0.6 + footrotr(movement2) * -0.6)
next.foot_r.orientation = Quaternion::rotation_x(-0.6 + footrotr(movement2) * -0.6)
* Quaternion::rotation_z(-0.2);
},
Some(ToolKind::Dagger(_)) => {
next.head.position = Vec3::new(
0.0,
skeleton_attr.head.0,
-2.0 + skeleton_attr.head.1,
);
next.head.position = Vec3::new(0.0, s_a.head.0, -2.0 + s_a.head.1);
next.head.orientation = Quaternion::rotation_z(0.0)
* Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(0.0);
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
next.head.scale = Vec3::one() * s_a.head_scale;
next.chest.position = Vec3::new(0.0, 0.0, 7.0 + slow(anim_time as f32) * 2.0);
next.chest.orientation =
@ -176,13 +162,13 @@ impl Animation for DashAnimation {
next.main.scale = Vec3::one();
next.control.position = Vec3::new(-8.0 - slow(anim_time as f32) * 0.5, 3.0, 3.0);
next.control.orientation =
Quaternion::rotation_x(-0.3) * Quaternion::rotation_z(1.1 + slow(anim_time as f32) * 0.2);
next.control.orientation = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_z(1.1 + slow(anim_time as f32) * 0.2);
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, s_a.foot.2);
next.foot_l.orientation = Quaternion::rotation_x(-0.8);
next.foot_r.position = Vec3::new(5.4, -1.0, skeleton_attr.foot.2);
next.foot_r.position = Vec3::new(5.4, -1.0, s_a.foot.2);
next.foot_r.orientation = Quaternion::rotation_x(-0.8);
},
_ => {},
@ -190,15 +176,11 @@ impl Animation for DashAnimation {
match second_tool_kind {
//TODO: Inventory
Some(ToolKind::Dagger(_)) => {
next.head.position = Vec3::new(
0.0,
skeleton_attr.head.0,
-2.0 + skeleton_attr.head.1,
);
next.head.position = Vec3::new(0.0, s_a.head.0, -2.0 + s_a.head.1);
next.head.orientation = Quaternion::rotation_z(0.0)
* Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(0.0);
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
next.head.scale = Vec3::one() * s_a.head_scale;
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);
@ -233,25 +215,21 @@ impl Animation for DashAnimation {
next.second.orientation = Quaternion::rotation_x(-0.3);
next.second.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, s_a.foot.2);
next.foot_l.orientation = Quaternion::rotation_x(-0.8);
next.foot_r.position = Vec3::new(5.4, -1.0, skeleton_attr.foot.2);
next.foot_r.position = Vec3::new(5.4, -1.0, s_a.foot.2);
next.foot_r.orientation = Quaternion::rotation_x(-0.8);
},
_ => {},
}
next.lantern.position = Vec3::new(
skeleton_attr.lantern.0,
skeleton_attr.lantern.1,
skeleton_attr.lantern.2,
);
next.lantern.orientation =
Quaternion::rotation_x(slow(anim_time as f32) * -0.7 + 0.4) * Quaternion::rotation_y(slow(anim_time as f32) * 0.4);
next.lantern.position = Vec3::new(s_a.lantern.0, s_a.lantern.1, s_a.lantern.2);
next.lantern.orientation = Quaternion::rotation_x(slow(anim_time as f32) * -0.7 + 0.4)
* Quaternion::rotation_y(slow(anim_time as f32) * 0.4);
next.hold.scale = Vec3::one() * 0.0;
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
next.torso.scale = Vec3::one() / 11.0 * s_a.scaler;
next.control_l.scale = Vec3::one();
@ -267,4 +245,4 @@ impl Animation for DashAnimation {
next
}
}
}

View File

@ -20,7 +20,7 @@ impl Animation for EquipAnimation {
(active_tool_kind, second_tool_kind, velocity, global_time): Self::Dependency,
anim_time: f64,
rate: &mut f32,
skeleton_attr: &SkeletonAttr,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
*rate = 1.0;
let mut next = (*skeleton).clone();
@ -190,38 +190,26 @@ impl Animation for EquipAnimation {
next.hold.scale = Vec3::one() * 0.0;
if velocity > 0.5 {
next.torso.position = Vec3::new(0.0, 0.0, 0.0) * skeleton_attr.scaler;
next.torso.position = Vec3::new(0.0, 0.0, 0.0) * s_a.scaler;
next.torso.orientation = Quaternion::rotation_x(-0.2);
} else {
next.head.position = Vec3::new(
0.0,
0.0 + skeleton_attr.head.0,
skeleton_attr.head.1 + short * 0.2,
);
next.head.position = Vec3::new(0.0, 0.0 + s_a.head.0, s_a.head.1 + short * 0.2);
next.head.orientation =
Quaternion::rotation_z(head_look.x) * Quaternion::rotation_x(head_look.y);
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1,
skeleton_attr.foot.2,
);
next.foot_l.position = Vec3::new(-s_a.foot.0, s_a.foot.1, s_a.foot.2);
next.foot_l.orientation = Quaternion::rotation_x(wave_ultra_slow_cos * 0.035 - 0.2);
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1,
skeleton_attr.foot.2,
);
next.foot_r.position = Vec3::new(s_a.foot.0, s_a.foot.1, s_a.foot.2);
next.foot_r.orientation = Quaternion::rotation_x(wave_ultra_slow * 0.035);
next.chest.position = Vec3::new(0.0, skeleton_attr.chest.0, skeleton_attr.chest.1);
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1);
next.belt.position = Vec3::new(0.0, skeleton_attr.belt.0, skeleton_attr.belt.1);
next.belt.position = Vec3::new(0.0, s_a.belt.0, s_a.belt.1);
next.shorts.position = Vec3::new(0.0, skeleton_attr.shorts.0, skeleton_attr.shorts.1);
next.shorts.position = Vec3::new(0.0, s_a.shorts.0, s_a.shorts.1);
next.torso.position = Vec3::new(0.0, 0.0, 0.0) * skeleton_attr.scaler;
next.torso.position = Vec3::new(0.0, 0.0, 0.0) * s_a.scaler;
}
next.second.scale = match (

View File

@ -30,7 +30,7 @@ impl Animation for GlideWieldAnimation {
(active_tool_kind, second_tool_kind, velocity, _orientation, _last_ori, _global_time): Self::Dependency,
anim_time: f64,
rate: &mut f32,
skeleton_attr: &SkeletonAttr,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let speed = Vec2::<f32>::from(velocity).magnitude();
@ -43,19 +43,11 @@ impl Animation for GlideWieldAnimation {
.sqrt())
* ((anim_time as f32 * lab as f32 * 16.0).sin());
next.hand_l.position = Vec3::new(
-2.0 - skeleton_attr.hand.0,
skeleton_attr.hand.1,
skeleton_attr.hand.2 + 15.0,
);
next.hand_l.position = Vec3::new(-2.0 - s_a.hand.0, s_a.hand.1, s_a.hand.2 + 15.0);
next.hand_l.orientation = Quaternion::rotation_x(3.35);
next.hand_l.scale = Vec3::one();
next.hand_r.position = Vec3::new(
2.0 + skeleton_attr.hand.0,
skeleton_attr.hand.1,
skeleton_attr.hand.2 + 15.0,
);
next.hand_r.position = Vec3::new(2.0 + s_a.hand.0, s_a.hand.1, s_a.hand.2 + 15.0);
next.hand_r.orientation = Quaternion::rotation_x(3.35);
next.hand_r.scale = Vec3::one();

View File

@ -30,7 +30,7 @@ impl Animation for GlidingAnimation {
(active_tool_kind, second_tool_kind, velocity, orientation, last_ori, global_time): Self::Dependency,
anim_time: f64,
_rate: &mut f32,
skeleton_attr: &SkeletonAttr,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
@ -76,17 +76,17 @@ impl Animation for GlidingAnimation {
anim_time as f32
};
next.head.position = Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1);
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
next.head.orientation = Quaternion::rotation_x(0.35 - slow * 0.10 + head_look.y)
* Quaternion::rotation_z(head_look.x + slowa * 0.15);
next.chest.position = Vec3::new(0.0, skeleton_attr.chest.0, skeleton_attr.chest.1);
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1);
next.chest.orientation = Quaternion::rotation_z(slowa * 0.02);
next.belt.position = Vec3::new(0.0, 0.0, -2.0);
next.belt.orientation = Quaternion::rotation_z(slowa * 0.1 + tilt * tiltcancel * 12.0);
next.shorts.position = Vec3::new(0.0, skeleton_attr.shorts.0, skeleton_attr.shorts.1);
next.shorts.position = Vec3::new(0.0, s_a.shorts.0, s_a.shorts.1);
next.shorts.orientation = Quaternion::rotation_z(slowa * 0.12 + tilt * tiltcancel * 16.0);
next.hand_l.position = Vec3::new(-9.5, -3.0, 10.0);
@ -96,18 +96,18 @@ impl Animation for GlidingAnimation {
next.hand_r.orientation = Quaternion::rotation_x(-2.7 + slowa * -0.10);
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1 + slowa * -1.0 + tilt * tiltcancel * -35.0,
-1.0 + skeleton_attr.foot.2,
-s_a.foot.0,
s_a.foot.1 + slowa * -1.0 + tilt * tiltcancel * -35.0,
-1.0 + s_a.foot.2,
);
next.foot_l.orientation = Quaternion::rotation_x(
(wave_stop * -0.7 - quicka * -0.21 + slow * 0.19) * speed * 0.04,
) * Quaternion::rotation_z(tilt * tiltcancel * 20.0);
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1 + slowa * 1.0 + tilt * tiltcancel * 35.0,
-1.0 + skeleton_attr.foot.2,
s_a.foot.0,
s_a.foot.1 + slowa * 1.0 + tilt * tiltcancel * 35.0,
-1.0 + s_a.foot.2,
);
next.foot_r.orientation = Quaternion::rotation_x(
(wave_stop * -0.8 + quick * -0.25 + slowb * 0.13) * speed * 0.04,
@ -135,7 +135,7 @@ impl Animation for GlidingAnimation {
},
}
next.torso.position = Vec3::new(0.0, -4.0, 10.0) / 11.0 * skeleton_attr.scaler;
next.torso.position = Vec3::new(0.0, -4.0, 10.0) / 11.0 * s_a.scaler;
next.torso.orientation = Quaternion::rotation_x(-0.06 * speed.max(12.0) + slow * 0.04)
* Quaternion::rotation_y(tilt * tiltcancel * 32.0);

View File

@ -20,7 +20,7 @@ impl Animation for IdleAnimation {
(active_tool_kind, second_tool_kind, _global_time): Self::Dependency,
anim_time: f64,
_rate: &mut f32,
skeleton_attr: &SkeletonAttr,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
@ -30,79 +30,51 @@ impl Animation for IdleAnimation {
next.head.position = Vec3::new(
0.0,
skeleton_attr.head.0,
skeleton_attr.head.1 + wave_ultra_slow * 0.1 + head_abs * -0.5,
s_a.head.0,
s_a.head.1 + wave_ultra_slow * 0.1 + head_abs * -0.5,
);
next.head.scale = Vec3::one() * skeleton_attr.head_scale - head_abs * 0.05;
next.head.scale = Vec3::one() * s_a.head_scale - head_abs * 0.05;
next.chest.position = Vec3::new(
0.0,
skeleton_attr.chest.0,
skeleton_attr.chest.1 + wave_ultra_slow * 0.1,
);
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + wave_ultra_slow * 0.1);
next.chest.scale = Vec3::one() + head_abs * 0.05;
next.belt.position = Vec3::new(
0.0,
skeleton_attr.belt.0,
skeleton_attr.belt.1 + wave_ultra_slow * 0.1,
);
next.belt.position = Vec3::new(0.0, s_a.belt.0, s_a.belt.1 + wave_ultra_slow * 0.1);
next.belt.orientation = Quaternion::rotation_x(0.0);
next.belt.scale = Vec3::one() - head_abs * 0.05;
next.shorts.position = Vec3::new(
0.0,
skeleton_attr.shorts.0,
skeleton_attr.shorts.1 + wave_ultra_slow * 0.1,
);
next.shorts.position = Vec3::new(0.0, s_a.shorts.0, s_a.shorts.1 + wave_ultra_slow * 0.1);
next.shorts.orientation = Quaternion::rotation_x(0.0);
next.back.position = Vec3::new(0.0, skeleton_attr.back.0, skeleton_attr.back.1);
next.back.position = Vec3::new(0.0, s_a.back.0, s_a.back.1);
next.back.scale = Vec3::one() * 1.02;
next.hand_l.position = Vec3::new(
-skeleton_attr.hand.0,
skeleton_attr.hand.1 + wave_ultra_slow_cos * 0.15,
skeleton_attr.hand.2 + wave_ultra_slow * 0.5,
-s_a.hand.0,
s_a.hand.1 + wave_ultra_slow_cos * 0.15,
s_a.hand.2 + wave_ultra_slow * 0.5,
);
next.hand_l.orientation = Quaternion::rotation_x(0.0 + wave_ultra_slow * -0.06);
next.hand_r.position = Vec3::new(
skeleton_attr.hand.0,
skeleton_attr.hand.1 + wave_ultra_slow_cos * 0.15,
skeleton_attr.hand.2 + wave_ultra_slow * 0.5 + head_abs * -0.05,
s_a.hand.0,
s_a.hand.1 + wave_ultra_slow_cos * 0.15,
s_a.hand.2 + wave_ultra_slow * 0.5 + head_abs * -0.05,
);
next.hand_r.orientation = Quaternion::rotation_x(0.0 + wave_ultra_slow * -0.06);
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1,
skeleton_attr.foot.2,
);
next.foot_l.position = Vec3::new(-s_a.foot.0, s_a.foot.1, s_a.foot.2);
next.foot_l.scale = Vec3::one();
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1,
skeleton_attr.foot.2,
);
next.foot_r.position = Vec3::new(s_a.foot.0, s_a.foot.1, s_a.foot.2);
next.foot_r.scale = Vec3::one();
next.shoulder_l.position = Vec3::new(
-skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1,
skeleton_attr.shoulder.2,
);
next.shoulder_l.position = Vec3::new(-s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2);
next.shoulder_l.orientation = Quaternion::rotation_x(0.0);
next.shoulder_l.scale = (Vec3::one() + head_abs * -0.05) * 1.15;
next.shoulder_r.position = Vec3::new(
skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1,
skeleton_attr.shoulder.2,
);
next.shoulder_r.position = Vec3::new(s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2);
next.shoulder_r.orientation = Quaternion::rotation_x(0.0);
next.shoulder_r.scale = (Vec3::one() + head_abs * -0.05) * 1.15;
@ -145,17 +117,13 @@ impl Animation for IdleAnimation {
}
next.second.scale = Vec3::one();
next.lantern.position = Vec3::new(
skeleton_attr.lantern.0,
skeleton_attr.lantern.1,
skeleton_attr.lantern.2,
);
next.lantern.position = Vec3::new(s_a.lantern.0, s_a.lantern.1, s_a.lantern.2);
next.lantern.orientation = Quaternion::rotation_x(0.1) * Quaternion::rotation_y(0.1);
next.lantern.scale = Vec3::one() * 0.65;
next.hold.scale = Vec3::one() * 0.0;
next.torso.position = Vec3::new(0.0, -0.2, 0.1) * skeleton_attr.scaler;
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
next.torso.position = Vec3::new(0.0, -0.2, 0.1) * s_a.scaler;
next.torso.scale = Vec3::one() / 11.0 * s_a.scaler;
next.second.scale = match (
active_tool_kind.map(|tk| tk.hands()),
second_tool_kind.map(|tk| tk.hands()),

View File

@ -26,7 +26,7 @@ impl Animation for JumpAnimation {
(active_tool_kind, second_tool_kind, orientation, last_ori, global_time): Self::Dependency,
anim_time: f64,
_rate: &mut f32,
skeleton_attr: &SkeletonAttr,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let slow = (anim_time as f32 * 7.0).sin();
@ -55,91 +55,72 @@ impl Animation for JumpAnimation {
0.0
} * 1.3;
next.head.position = Vec3::new(
0.0,
-1.0 + skeleton_attr.head.0,
-1.0 + skeleton_attr.head.1,
);
next.head.position = Vec3::new(0.0, -1.0 + s_a.head.0, -1.0 + s_a.head.1);
next.head.orientation =
Quaternion::rotation_x(0.25 + slow * 0.04) * Quaternion::rotation_z(tilt * -2.5);
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
next.head.scale = Vec3::one() * s_a.head_scale;
next.chest.position = Vec3::new(0.0, skeleton_attr.chest.0, skeleton_attr.chest.1 + 1.0);
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + 1.0);
next.chest.orientation = Quaternion::rotation_z(tilt * -2.0);
next.belt.position = Vec3::new(0.0, skeleton_attr.belt.0, skeleton_attr.belt.1);
next.belt.position = Vec3::new(0.0, s_a.belt.0, s_a.belt.1);
next.belt.orientation = Quaternion::rotation_z(tilt * 2.0);
next.back.position = Vec3::new(0.0, skeleton_attr.back.0, skeleton_attr.back.1);
next.back.position = Vec3::new(0.0, s_a.back.0, s_a.back.1);
next.back.orientation = Quaternion::rotation_z(0.0);
next.back.scale = Vec3::one() * 1.02;
next.shorts.position = Vec3::new(0.0, skeleton_attr.shorts.0, skeleton_attr.shorts.1);
next.shorts.position = Vec3::new(0.0, s_a.shorts.0, s_a.shorts.1);
next.shorts.orientation = Quaternion::rotation_z(tilt * 3.0);
if random > 0.5 {
next.hand_l.position = Vec3::new(
-skeleton_attr.hand.0,
1.0 + skeleton_attr.hand.1 + 4.0,
2.0 + skeleton_attr.hand.2 + slow * 1.5,
-s_a.hand.0,
1.0 + s_a.hand.1 + 4.0,
2.0 + s_a.hand.2 + slow * 1.5,
);
next.hand_l.orientation =
Quaternion::rotation_x(1.9 + slow * 0.4) * Quaternion::rotation_y(0.2);
next.hand_l.scale = Vec3::one();
next.hand_r.position = Vec3::new(
skeleton_attr.hand.0,
skeleton_attr.hand.1 - 3.0,
skeleton_attr.hand.2 + slow * 1.5,
);
next.hand_r.position = Vec3::new(s_a.hand.0, s_a.hand.1 - 3.0, s_a.hand.2 + slow * 1.5);
next.hand_r.orientation =
Quaternion::rotation_x(-0.5 + slow * -0.4) * Quaternion::rotation_y(-0.2);
next.hand_r.scale = Vec3::one();
} else {
next.hand_l.position = Vec3::new(
-skeleton_attr.hand.0,
skeleton_attr.hand.1 - 3.0,
skeleton_attr.hand.2 + slow * 1.5,
);
next.hand_l.position =
Vec3::new(-s_a.hand.0, s_a.hand.1 - 3.0, s_a.hand.2 + slow * 1.5);
next.hand_l.orientation =
Quaternion::rotation_x(-0.5 + slow * -0.4) * Quaternion::rotation_y(0.2);
next.hand_r.position = Vec3::new(
skeleton_attr.hand.0,
1.0 + skeleton_attr.hand.1 + 4.0,
2.0 + skeleton_attr.hand.2 + slow * 1.5,
s_a.hand.0,
1.0 + s_a.hand.1 + 4.0,
2.0 + s_a.hand.2 + slow * 1.5,
);
next.hand_r.orientation =
Quaternion::rotation_x(1.9 + slow * 0.4) * Quaternion::rotation_y(-0.2);
};
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1 - 6.0 * switch,
1.0 + skeleton_attr.foot.2 + slow * 1.5,
-s_a.foot.0,
s_a.foot.1 - 6.0 * switch,
1.0 + s_a.foot.2 + slow * 1.5,
);
next.foot_l.orientation = Quaternion::rotation_x(-1.2 * switch + slow * -0.2 * switch);
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1 + 6.0 * switch,
1.0 + skeleton_attr.foot.2 + slow * 1.5,
s_a.foot.0,
s_a.foot.1 + 6.0 * switch,
1.0 + s_a.foot.2 + slow * 1.5,
);
next.foot_r.orientation = Quaternion::rotation_x(1.2 * switch + slow * 0.2 * switch);
next.shoulder_l.position = Vec3::new(
-skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1,
skeleton_attr.shoulder.2,
);
next.shoulder_l.position = Vec3::new(-s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2);
next.shoulder_l.orientation = Quaternion::rotation_x(0.4 * switch);
next.shoulder_l.scale = Vec3::one() * 1.1;
next.shoulder_r.position = Vec3::new(
skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1,
skeleton_attr.shoulder.2,
);
next.shoulder_r.position = Vec3::new(s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2);
next.shoulder_r.orientation = Quaternion::rotation_x(-0.4 * switch);
next.shoulder_r.scale = Vec3::one() * 1.1;
@ -183,19 +164,15 @@ impl Animation for JumpAnimation {
}
next.second.scale = Vec3::one();
next.lantern.position = Vec3::new(
skeleton_attr.lantern.0,
skeleton_attr.lantern.1,
skeleton_attr.lantern.2,
);
next.lantern.position = Vec3::new(s_a.lantern.0, s_a.lantern.1, s_a.lantern.2);
next.lantern.orientation = Quaternion::rotation_x(1.0 * switch + slow * 0.3 * switch)
* Quaternion::rotation_y(0.6 * switch + slow * 0.3 * switch);
next.lantern.scale = Vec3::one() * 0.65;
next.hold.scale = Vec3::one() * 0.0;
next.torso.position = Vec3::new(0.0, 0.0, 0.0) * skeleton_attr.scaler;
next.torso.position = Vec3::new(0.0, 0.0, 0.0) * s_a.scaler;
next.torso.orientation = Quaternion::rotation_x(-0.2);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
next.torso.scale = Vec3::one() / 11.0 * s_a.scaler;
next.second.scale = match (
active_tool_kind.map(|tk| tk.hands()),

View File

@ -29,7 +29,7 @@ impl Animation for LeapAnimation {
(active_tool_kind, second_tool_kind, _velocity, _global_time, stage_section): Self::Dependency,
anim_time: f64,
rate: &mut f32,
skeleton_attr: &SkeletonAttr,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
*rate = 1.0;
let mut next = (*skeleton).clone();
@ -52,7 +52,7 @@ impl Animation for LeapAnimation {
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.head.position = Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1);
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
next.control.position = Vec3::new(
6.0 + movement1 * -10.0,
@ -74,16 +74,16 @@ impl Animation for LeapAnimation {
next.hand_l.position = Vec3::new(-12.0 + movement3 * 10.0, 0.0, 0.0);
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1 - 5.0 + movement3 * 13.0,
skeleton_attr.foot.2 + movement3 * -5.0,
-s_a.foot.0,
s_a.foot.1 - 5.0 + movement3 * 13.0,
s_a.foot.2 + movement3 * -5.0,
);
next.foot_l.orientation = Quaternion::rotation_x(-0.8 + movement3 * 1.7);
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1 + 8.0 + movement3 * -13.0,
skeleton_attr.foot.2 + 5.0 + movement3 * -5.0,
s_a.foot.0,
s_a.foot.1 + 8.0 + movement3 * -13.0,
s_a.foot.2 + 5.0 + movement3 * -5.0,
);
next.foot_r.orientation = Quaternion::rotation_x(0.9 + movement3 * -1.7);
} else if let Some(ToolKind::Axe(_)) = active_tool_kind {
@ -106,7 +106,7 @@ impl Animation for LeapAnimation {
* Quaternion::rotation_z(PI - 0.2);
next.control.scale = Vec3::one();
next.head.position = Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1);
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
next.control.position = Vec3::new(
-3.0 + movement1 * 3.0,
@ -127,15 +127,15 @@ impl Animation for LeapAnimation {
Quaternion::rotation_x(0.0 + movement1 * -0.4 + movement2 * 0.4 + movement3 * 0.2);
next.foot_l.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,
s_a.foot.0,
s_a.foot.1 + movement2 * 4.0 + movement3 * -8.0,
s_a.foot.2 - 8.0 + movement2 * 3.0 + movement3 * -3.0,
);
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,
s_a.foot.0,
s_a.foot.1 + movement2 * 4.0 + movement3 * -8.0,
s_a.foot.2 - 8.0 + movement2 * 3.0 + movement3 * -3.0,
);
next.foot_l.orientation = Quaternion::rotation_x(movement1 * 0.9 - movement3 * 1.8);
@ -145,9 +145,8 @@ impl Animation for LeapAnimation {
next.belt.orientation = Quaternion::rotation_x(movement1 * 0.22 + movement2 * 0.1);
next.shorts.orientation = Quaternion::rotation_x(movement1 * 0.3 + movement2 * 0.1);
next.chest.position =
Vec3::new(0.0, skeleton_attr.chest.0, skeleton_attr.chest.1 - 8.0);
next.torso.position = Vec3::new(0.0, 0.0, 0.0 + 8.0) * skeleton_attr.scaler / 11.0;
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1 - 8.0);
next.torso.position = Vec3::new(0.0, 0.0, 0.0 + 8.0) * s_a.scaler / 11.0;
}
next.second.scale = match (

View File

@ -28,7 +28,7 @@ impl Animation for RepeaterAnimation {
(active_tool_kind, second_tool_kind, _velocity, _global_time, stage_section): Self::Dependency,
anim_time: f64,
rate: &mut f32,
skeleton_attr: &SkeletonAttr,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
*rate = 1.0;
let mut next = (*skeleton).clone();
@ -66,31 +66,28 @@ impl Animation for RepeaterAnimation {
match stage_section {
StageSection::Movement => {
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0 + movement * -0.75 - 0.75,
skeleton_attr.foot.1 + movement * 4.0 + 4.0,
skeleton_attr.foot.2 + movement * 2.5 + 2.5,
-s_a.foot.0 + movement * -0.75 - 0.75,
s_a.foot.1 + movement * 4.0 + 4.0,
s_a.foot.2 + movement * 2.5 + 2.5,
);
next.foot_l.orientation = Quaternion::rotation_x(movement * 0.6 + 0.6)
* Quaternion::rotation_z(movement * 0.3 + 0.3);
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0 + movement * 0.75 + 0.75,
skeleton_attr.foot.1 + movement * 4.0 + 4.0,
skeleton_attr.foot.2 + movement * 2.5 + 2.5,
s_a.foot.0 + movement * 0.75 + 0.75,
s_a.foot.1 + movement * 4.0 + 4.0,
s_a.foot.2 + movement * 2.5 + 2.5,
);
next.foot_r.orientation = Quaternion::rotation_x(movement * 0.6 + 0.6)
* Quaternion::rotation_z(movement * -0.3 - 0.3);
next.shorts.position = Vec3::new(
0.0,
skeleton_attr.shorts.0 + movement * 4.0,
skeleton_attr.shorts.1 + movement * 1.0,
s_a.shorts.0 + movement * 4.0,
s_a.shorts.1 + movement * 1.0,
);
next.shorts.orientation = Quaternion::rotation_x(movement * 0.6);
next.belt.position = Vec3::new(
0.0,
skeleton_attr.belt.0 + movement * 2.0,
skeleton_attr.belt.1,
);
next.belt.position =
Vec3::new(0.0, s_a.belt.0 + movement * 2.0, s_a.belt.1);
next.belt.orientation = Quaternion::rotation_x(movement * 0.2);
next.control.position = Vec3::new(
-7.0 + movement * 5.0,
@ -104,29 +101,19 @@ impl Animation for RepeaterAnimation {
},
StageSection::Buildup => {
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0 - 1.5,
skeleton_attr.foot.1 + 8.0,
skeleton_attr.foot.2 + 5.0,
);
next.foot_l.position =
Vec3::new(-s_a.foot.0 - 1.5, s_a.foot.1 + 8.0, s_a.foot.2 + 5.0);
next.foot_l.orientation = Quaternion::rotation_x(1.2 + movement * -0.2)
* Quaternion::rotation_z(0.6);
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0 + 1.5,
skeleton_attr.foot.1 + 8.0,
skeleton_attr.foot.2 + 5.0,
);
next.foot_r.position =
Vec3::new(s_a.foot.0 + 1.5, s_a.foot.1 + 8.0, s_a.foot.2 + 5.0);
next.foot_r.orientation = Quaternion::rotation_x(1.2 + movement * -0.2)
* Quaternion::rotation_z(-0.6);
next.shorts.position = Vec3::new(
0.0,
skeleton_attr.shorts.0 + 4.0,
skeleton_attr.shorts.1 + 1.0,
);
next.shorts.position =
Vec3::new(0.0, s_a.shorts.0 + 4.0, s_a.shorts.1 + 1.0);
next.shorts.orientation = Quaternion::rotation_x(0.6);
next.belt.position =
Vec3::new(0.0, skeleton_attr.belt.0 + 2.0, skeleton_attr.belt.1);
next.belt.position = Vec3::new(0.0, s_a.belt.0 + 2.0, s_a.belt.1);
next.belt.orientation = Quaternion::rotation_x(0.2);
next.control.position = Vec3::new(-2.0, 9.0, 7.0);
next.control.orientation =
@ -136,29 +123,19 @@ impl Animation for RepeaterAnimation {
},
StageSection::Shoot => {
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0 - 1.5,
skeleton_attr.foot.1 + 8.0,
skeleton_attr.foot.2 + 5.0,
);
next.foot_l.position =
Vec3::new(-s_a.foot.0 - 1.5, s_a.foot.1 + 8.0, s_a.foot.2 + 5.0);
next.foot_l.orientation =
Quaternion::rotation_x(1.0) * Quaternion::rotation_z(0.6);
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0 + 1.5,
skeleton_attr.foot.1 + 8.0,
skeleton_attr.foot.2 + 5.0,
);
next.foot_r.position =
Vec3::new(s_a.foot.0 + 1.5, s_a.foot.1 + 8.0, s_a.foot.2 + 5.0);
next.foot_r.orientation =
Quaternion::rotation_x(1.0) * Quaternion::rotation_z(-0.6);
next.shorts.position = Vec3::new(
0.0,
skeleton_attr.shorts.0 + 4.0,
skeleton_attr.shorts.1 + 1.0,
);
next.shorts.position =
Vec3::new(0.0, s_a.shorts.0 + 4.0, s_a.shorts.1 + 1.0);
next.shorts.orientation = Quaternion::rotation_x(0.6);
next.belt.position =
Vec3::new(0.0, skeleton_attr.belt.0 + 2.0, skeleton_attr.belt.1);
next.belt.position = Vec3::new(0.0, s_a.belt.0 + 2.0, s_a.belt.1);
next.belt.orientation = Quaternion::rotation_x(0.2);
next.control.position = Vec3::new(-2.0, 9.0, 7.0);
next.control.orientation =

View File

@ -27,7 +27,7 @@ impl Animation for RollAnimation {
(active_tool_kind, second_tool_kind, orientation, last_ori, _global_time): Self::Dependency,
anim_time: f64,
rate: &mut f32,
skeleton_attr: &SkeletonAttr,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
*rate = 1.0;
let mut next = (*skeleton).clone();
@ -47,52 +47,32 @@ impl Animation for RollAnimation {
0.0
};
next.head.position = Vec3::new(0.0, skeleton_attr.head.0 + 3.0, skeleton_attr.head.1 - 1.0);
next.head.position = Vec3::new(0.0, s_a.head.0 + 3.0, s_a.head.1 - 1.0);
next.head.orientation = Quaternion::rotation_x(-0.75);
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
next.head.scale = Vec3::one() * s_a.head_scale;
next.chest.position = Vec3::new(0.0, skeleton_attr.chest.0, -9.5 + skeleton_attr.chest.1);
next.chest.position = Vec3::new(0.0, s_a.chest.0, -9.5 + s_a.chest.1);
next.chest.orientation = Quaternion::rotation_x(-0.2);
next.belt.position = Vec3::new(0.0, skeleton_attr.belt.0 + 1.0, skeleton_attr.belt.1 + 1.0);
next.belt.position = Vec3::new(0.0, s_a.belt.0 + 1.0, s_a.belt.1 + 1.0);
next.belt.orientation = Quaternion::rotation_x(0.55);
next.back.position = Vec3::new(0.0, skeleton_attr.back.0, skeleton_attr.back.1);
next.back.position = Vec3::new(0.0, s_a.back.0, s_a.back.1);
next.shorts.position = Vec3::new(
0.0,
skeleton_attr.shorts.0 + 4.5,
skeleton_attr.shorts.1 + 2.5,
);
next.shorts.position = Vec3::new(0.0, s_a.shorts.0 + 4.5, s_a.shorts.1 + 2.5);
next.shorts.orientation = Quaternion::rotation_x(0.8);
next.hand_l.position = Vec3::new(
-skeleton_attr.hand.0,
skeleton_attr.hand.1 + 1.0,
skeleton_attr.hand.2 + 2.0,
);
next.hand_l.position = Vec3::new(-s_a.hand.0, s_a.hand.1 + 1.0, s_a.hand.2 + 2.0);
next.hand_l.orientation = Quaternion::rotation_x(0.6);
next.hand_r.position = Vec3::new(
-1.0 + skeleton_attr.hand.0,
skeleton_attr.hand.1 + 1.0,
skeleton_attr.hand.2 + 2.0,
);
next.hand_r.position = Vec3::new(-1.0 + s_a.hand.0, s_a.hand.1 + 1.0, s_a.hand.2 + 2.0);
next.hand_r.orientation = Quaternion::rotation_x(0.6);
next.foot_l.position = Vec3::new(
1.0 - skeleton_attr.foot.0,
skeleton_attr.foot.1 + 5.5,
skeleton_attr.foot.2 - 5.0,
);
next.foot_l.position = Vec3::new(1.0 - s_a.foot.0, s_a.foot.1 + 5.5, s_a.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.5,
skeleton_attr.foot.2 - 5.0,
);
next.foot_r.position = Vec3::new(s_a.foot.0, s_a.foot.1 + 5.5, s_a.foot.2 - 5.0);
next.foot_r.orientation = Quaternion::rotation_x(0.9);
next.glider.position = Vec3::new(0.0, 0.0, 10.0);
@ -136,10 +116,10 @@ impl Animation for RollAnimation {
next.lantern.scale = Vec3::one() * 0.65;
next.hold.scale = Vec3::one() * 0.0;
next.torso.position = Vec3::new(0.0, 0.0, 8.0) / 11.0 * skeleton_attr.scaler;
next.torso.position = Vec3::new(0.0, 0.0, 8.0) / 11.0 * s_a.scaler;
next.torso.orientation =
Quaternion::rotation_x(spin * -10.0) * Quaternion::rotation_z(tilt * -10.0);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
next.torso.scale = Vec3::one() / 11.0 * s_a.scaler;
next.second.scale = match (
active_tool_kind.map(|tk| tk.hands()),

View File

@ -31,7 +31,7 @@ impl Animation for RunAnimation {
(active_tool_kind, second_tool_kind, velocity, orientation, last_ori, global_time, avg_vel): Self::Dependency,
anim_time: f64,
rate: &mut f32,
skeleton_attr: &SkeletonAttr,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
@ -112,20 +112,16 @@ impl Animation for RunAnimation {
0.0
} * 1.3;
next.head.position = Vec3::new(
0.0,
-1.0 + skeleton_attr.head.0,
skeleton_attr.head.1 + short * 0.1,
);
next.head.position = Vec3::new(0.0, -1.0 + s_a.head.0, s_a.head.1 + short * 0.1);
next.head.orientation =
Quaternion::rotation_z(tilt * -2.5 + head_look.x * 0.2 - short * 0.1)
* Quaternion::rotation_x(head_look.y + 0.45 - lower * 0.35);
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
next.head.scale = Vec3::one() * s_a.head_scale;
next.chest.position = Vec3::new(
0.0,
skeleton_attr.chest.0,
skeleton_attr.chest.1 + 2.0 + shortalt * -1.5 - lower,
s_a.chest.0,
s_a.chest.1 + 2.0 + shortalt * -1.5 - lower,
);
next.chest.orientation = Quaternion::rotation_z(short * 0.18 * walkintensity + tilt * -0.6)
* Quaternion::rotation_y(tilt * 1.6)
@ -133,73 +129,57 @@ impl Animation for RunAnimation {
impact * 0.06 + shortalter * 0.035 + wave_stop * speed * -0.09 + (tilt.abs()),
);
next.belt.position = Vec3::new(
0.0,
0.25 + skeleton_attr.belt.0,
0.25 + skeleton_attr.belt.1,
);
next.belt.position = Vec3::new(0.0, 0.25 + s_a.belt.0, 0.25 + s_a.belt.1);
next.belt.orientation = Quaternion::rotation_x(0.1)
* Quaternion::rotation_z(short * 0.1 + tilt * -1.1)
* Quaternion::rotation_y(tilt * 0.5);
next.back.position = Vec3::new(0.0, skeleton_attr.back.0, skeleton_attr.back.1);
next.back.position = Vec3::new(0.0, s_a.back.0, s_a.back.1);
next.back.orientation =
Quaternion::rotation_x(-0.25 + short * 0.1 + noisea * 0.1 + noiseb * 0.1);
next.shorts.position = Vec3::new(
0.0,
0.65 + skeleton_attr.shorts.0,
0.65 + skeleton_attr.shorts.1,
);
next.shorts.position = Vec3::new(0.0, 0.65 + s_a.shorts.0, 0.65 + s_a.shorts.1);
next.shorts.orientation = Quaternion::rotation_x(0.2)
* Quaternion::rotation_z(short * 0.25 + tilt * -1.5)
* Quaternion::rotation_y(tilt * 0.7);
next.hand_l.position = Vec3::new(
-skeleton_attr.hand.0 + foothorir * -1.3,
3.0 + skeleton_attr.hand.1 + foothorir * -7.0 * walkintensity,
1.5 + skeleton_attr.hand.2 - foothorir * 5.5 * walkintensity,
-s_a.hand.0 + foothorir * -1.3,
3.0 + s_a.hand.1 + foothorir * -7.0 * walkintensity,
1.5 + s_a.hand.2 - foothorir * 5.5 * walkintensity,
);
next.hand_l.orientation = Quaternion::rotation_x(0.6 + footrotr * -1.2 * walkintensity)
* Quaternion::rotation_y(footrotr * 0.4 * walkintensity);
next.hand_r.position = Vec3::new(
skeleton_attr.hand.0 + foothoril * 1.3,
3.0 + skeleton_attr.hand.1 + foothoril * -6.5 * walkintensity,
1.5 + skeleton_attr.hand.2 - foothoril * 7.0 * walkintensity,
s_a.hand.0 + foothoril * 1.3,
3.0 + s_a.hand.1 + foothoril * -6.5 * walkintensity,
1.5 + s_a.hand.2 - foothoril * 7.0 * walkintensity,
);
next.hand_r.orientation = Quaternion::rotation_x(0.6 + footrotl * -1.2 * walkintensity)
* Quaternion::rotation_y(footrotl * -0.4 * walkintensity);
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
-1.5 + skeleton_attr.foot.1 + foothoril * -8.5 * walkintensity - lower * 1.0,
2.0 + skeleton_attr.foot.2 + ((footvertl * -2.7).max(-1.0)) * walkintensity,
-s_a.foot.0,
-1.5 + s_a.foot.1 + foothoril * -8.5 * walkintensity - lower * 1.0,
2.0 + s_a.foot.2 + ((footvertl * -2.7).max(-1.0)) * walkintensity,
);
next.foot_l.orientation = Quaternion::rotation_x(-0.2 + footrotl * -1.2 * walkintensity)
* Quaternion::rotation_y(tilt * 1.8);
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
-1.5 + skeleton_attr.foot.1 + foothorir * -8.5 * walkintensity - lower * 1.0,
2.0 + skeleton_attr.foot.2 + ((footvertr * -2.7).max(-1.0)) * walkintensity,
s_a.foot.0,
-1.5 + s_a.foot.1 + foothorir * -8.5 * walkintensity - lower * 1.0,
2.0 + s_a.foot.2 + ((footvertr * -2.7).max(-1.0)) * walkintensity,
);
next.foot_r.orientation = Quaternion::rotation_x(-0.2 + footrotr * -1.2 * walkintensity)
* Quaternion::rotation_y(tilt * 1.8);
next.shoulder_l.position = Vec3::new(
-skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1,
skeleton_attr.shoulder.2,
);
next.shoulder_l.position = Vec3::new(-s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2);
next.shoulder_l.orientation = Quaternion::rotation_x(short * 0.15 * walkintensity);
next.shoulder_l.scale = Vec3::one() * 1.1;
next.shoulder_r.position = Vec3::new(
skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1,
skeleton_attr.shoulder.2,
);
next.shoulder_r.position = Vec3::new(s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2);
next.shoulder_r.orientation = Quaternion::rotation_x(short * -0.15 * walkintensity);
next.shoulder_r.scale = Vec3::one() * 1.1;
@ -241,18 +221,14 @@ impl Animation for RunAnimation {
},
}
next.lantern.position = Vec3::new(
skeleton_attr.lantern.0,
skeleton_attr.lantern.1,
skeleton_attr.lantern.2,
);
next.lantern.position = Vec3::new(s_a.lantern.0, s_a.lantern.1, s_a.lantern.2);
next.lantern.orientation =
Quaternion::rotation_x(shorte * 0.7 + 0.4) * Quaternion::rotation_y(shorte * 0.4);
next.lantern.scale = Vec3::one() * 0.65;
next.hold.scale = Vec3::one() * 0.0;
next.torso.position = Vec3::new(0.0, -0.3, 0.0) * skeleton_attr.scaler;
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
next.torso.position = Vec3::new(0.0, -0.3, 0.0) * s_a.scaler;
next.torso.scale = Vec3::one() / 11.0 * s_a.scaler;
next.second.scale = match (
active_tool_kind.map(|tk| tk.hands()),

View File

@ -33,25 +33,19 @@ impl Animation for ShockwaveAnimation {
(active_tool_kind, second_tool_kind, _global_time, velocity, stage_section): Self::Dependency,
anim_time: f64,
rate: &mut f32,
skeleton_attr: &SkeletonAttr,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
*rate = 1.0;
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)
},
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, skeleton_attr.head.0, skeleton_attr.head.1);
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
next.hand_l.position = Vec3::new(0.0, 0.0, -4.0);
next.hand_l.orientation = Quaternion::rotation_x(1.27) * Quaternion::rotation_y(0.0);
@ -75,47 +69,43 @@ impl Animation for ShockwaveAnimation {
);
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);
* Quaternion::rotation_y(
0.15 + movement1 * -0.15 + movement2 * 0.3 + movement3 * -0.45,
)
* Quaternion::rotation_z(movement1 * 0.8 + movement2 * -0.8);
next.head.orientation =
Quaternion::rotation_x(movement1 * 0.4 + movement3 * -0.4)
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.chest.position = Vec3::new(
0.0,
skeleton_attr.chest.0,
skeleton_attr.chest.1 + movement1 * 2.0 + movement2 * -4.0 + movement3 * 2.0,
s_a.chest.0,
s_a.chest.1 + movement1 * 2.0 + movement2 * -4.0 + movement3 * 2.0,
);
next.chest.orientation =
Quaternion::rotation_x(movement2 * -0.8 + movement3 * 0.8)
next.chest.orientation = Quaternion::rotation_x(movement2 * -0.8 + movement3 * 0.8)
* Quaternion::rotation_z(twist * -0.2 + movement2 * -0.1 + movement3 * 0.3);
next.belt.orientation =
Quaternion::rotation_x(movement2 * 0.2 + movement3 * -0.2)
next.belt.orientation = Quaternion::rotation_x(movement2 * 0.2 + movement3 * -0.2)
* Quaternion::rotation_z(twist * 0.6 + movement2 * -0.48);
next.shorts.orientation =
Quaternion::rotation_x(movement2 * 0.3 + movement3 * -0.3)
next.shorts.orientation = Quaternion::rotation_x(movement2 * 0.3 + movement3 * -0.3)
* Quaternion::rotation_z(twist + movement2 * -0.8);
if velocity < 0.5 {
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1 + movement1 * -7.0 + movement2 * 7.0,
skeleton_attr.foot.2,
-s_a.foot.0,
s_a.foot.1 + movement1 * -7.0 + movement2 * 7.0,
s_a.foot.2,
);
next.foot_l.orientation =
Quaternion::rotation_x(movement1 * -0.8 + movement2 * 0.8)
next.foot_l.orientation = Quaternion::rotation_x(movement1 * -0.8 + movement2 * 0.8)
* Quaternion::rotation_z(movement1 * 0.3 + movement2 * -0.3);
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1 + movement1 * 5.0 + movement2 * -5.0,
skeleton_attr.foot.2,
s_a.foot.0,
s_a.foot.1 + movement1 * 5.0 + movement2 * -5.0,
s_a.foot.2,
);
next.foot_r.orientation =
Quaternion::rotation_y(movement1 * -0.3 + movement2 * 0.3)
next.foot_r.orientation = Quaternion::rotation_y(movement1 * -0.3 + movement2 * 0.3)
* Quaternion::rotation_z(movement1 * 0.4 + movement2 * -0.4);
}
next.second.scale = match (
@ -128,4 +118,4 @@ impl Animation for ShockwaveAnimation {
next
}
}
}

View File

@ -20,7 +20,7 @@ impl Animation for ShootAnimation {
(active_tool_kind, second_tool_kind, velocity, _global_time): Self::Dependency,
anim_time: f64,
rate: &mut f32,
skeleton_attr: &SkeletonAttr,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
*rate = 1.0;
@ -38,29 +38,21 @@ impl Animation for ShootAnimation {
let exp = ((anim_time as f32).powf(0.3 as f32)).min(1.2);
next.head.position = Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1);
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
next.head.orientation = Quaternion::rotation_z(exp * -0.4)
* Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(exp * 0.1);
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
next.head.scale = Vec3::one() * s_a.head_scale;
next.chest.position = Vec3::new(
0.0,
skeleton_attr.chest.0 - exp * 1.5,
skeleton_attr.chest.1,
);
next.chest.position = Vec3::new(0.0, s_a.chest.0 - exp * 1.5, s_a.chest.1);
next.chest.orientation = Quaternion::rotation_z(0.4 + exp * 1.0)
* Quaternion::rotation_x(0.0 + exp * 0.2)
* Quaternion::rotation_y(exp * -0.08);
next.belt.position = Vec3::new(0.0, skeleton_attr.belt.0 + exp * 1.0, skeleton_attr.belt.1);
next.belt.position = Vec3::new(0.0, s_a.belt.0 + exp * 1.0, s_a.belt.1);
next.belt.orientation = next.chest.orientation * -0.1;
next.shorts.position = Vec3::new(
0.0,
skeleton_attr.shorts.0 + exp * 1.0,
skeleton_attr.shorts.1,
);
next.shorts.position = Vec3::new(0.0, s_a.shorts.0 + exp * 1.0, s_a.shorts.1);
next.shorts.orientation = next.chest.orientation * -0.08;
match active_tool_kind {
@ -101,39 +93,34 @@ impl Animation for ShootAnimation {
}
if velocity > 0.5 {
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0 - foot * 1.0 + exp * -1.0,
-s_a.foot.0 - foot * 1.0 + exp * -1.0,
foote * 0.8 + exp * 1.5,
skeleton_attr.foot.2,
s_a.foot.2,
);
next.foot_l.orientation = Quaternion::rotation_x(exp * 0.5)
* Quaternion::rotation_z(exp * 0.4)
* Quaternion::rotation_y(0.15);
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0 + foot * 1.0 + exp * 1.0,
s_a.foot.0 + foot * 1.0 + exp * 1.0,
foote * -0.8 + exp * -1.0,
skeleton_attr.foot.2,
s_a.foot.2,
);
next.foot_r.orientation = Quaternion::rotation_x(exp * -0.5)
* Quaternion::rotation_z(exp * 0.4)
* Quaternion::rotation_y(0.0);
next.torso.orientation = Quaternion::rotation_x(-0.15);
} else {
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
-2.5,
skeleton_attr.foot.2 + exp * 2.5,
);
next.foot_l.position = Vec3::new(-s_a.foot.0, -2.5, s_a.foot.2 + exp * 2.5);
next.foot_l.orientation =
Quaternion::rotation_x(exp * -0.2 - 0.2) * Quaternion::rotation_z(exp * 1.0);
next.foot_r.position =
Vec3::new(skeleton_attr.foot.0, 3.5 - exp * 2.0, skeleton_attr.foot.2);
next.foot_r.position = Vec3::new(s_a.foot.0, 3.5 - exp * 2.0, s_a.foot.2);
next.foot_r.orientation =
Quaternion::rotation_x(exp * 0.1) * Quaternion::rotation_z(exp * 0.5);
next.torso.position = Vec3::new(0.0, 0.0, 0.1) * skeleton_attr.scaler;
next.torso.position = Vec3::new(0.0, 0.0, 0.1) * s_a.scaler;
next.torso.orientation = Quaternion::rotation_z(0.0);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
next.torso.scale = Vec3::one() / 11.0 * s_a.scaler;
}
next.back.orientation = Quaternion::rotation_x(-0.3);

View File

@ -20,7 +20,7 @@ impl Animation for SitAnimation {
(active_tool_kind, second_tool_kind, global_time): Self::Dependency,
anim_time: f64,
_rate: &mut f32,
skeleton_attr: &SkeletonAttr,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
@ -41,80 +41,55 @@ impl Animation for SitAnimation {
.sin()
* 0.125,
);
next.head.position = Vec3::new(
0.0,
skeleton_attr.head.0,
skeleton_attr.head.1 + slow * 0.1 + stop * -0.8,
);
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1 + slow * 0.1 + stop * -0.8);
next.head.orientation = Quaternion::rotation_z(head_look.x + slow * 0.2 - slow * 0.1)
* Quaternion::rotation_x((slowa * -0.1 + slow * 0.1 + head_look.y).abs());
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
next.head.scale = Vec3::one() * s_a.head_scale;
next.chest.position = Vec3::new(
0.0,
skeleton_attr.chest.0 + stop * -0.4,
skeleton_attr.chest.1 + slow * 0.1 + stop * -0.8,
s_a.chest.0 + stop * -0.4,
s_a.chest.1 + slow * 0.1 + stop * -0.8,
);
next.chest.orientation = Quaternion::rotation_x(stop * 0.15);
next.chest.scale = Vec3::one() + slow_abs * 0.05;
next.belt.position =
Vec3::new(0.0, skeleton_attr.belt.0 + stop * 1.2, skeleton_attr.belt.1);
next.belt.position = Vec3::new(0.0, s_a.belt.0 + stop * 1.2, s_a.belt.1);
next.belt.orientation = Quaternion::rotation_x(stop * 0.3);
next.belt.scale = (Vec3::one() + slow_abs * 0.05) * 1.02;
next.back.position = Vec3::new(0.0, skeleton_attr.back.0, skeleton_attr.back.1);
next.back.position = Vec3::new(0.0, s_a.back.0, s_a.back.1);
next.shorts.position = Vec3::new(
0.0,
skeleton_attr.shorts.0 + stop * 2.5,
skeleton_attr.shorts.1 + stop * 0.6,
);
next.shorts.position = Vec3::new(0.0, s_a.shorts.0 + stop * 2.5, s_a.shorts.1 + stop * 0.6);
next.shorts.orientation = Quaternion::rotation_x(stop * 0.6);
next.hand_l.position = Vec3::new(
-skeleton_attr.hand.0,
skeleton_attr.hand.1 + slowa * 0.15,
skeleton_attr.hand.2 + slow * 0.7 + stop * -2.0,
-s_a.hand.0,
s_a.hand.1 + slowa * 0.15,
s_a.hand.2 + slow * 0.7 + stop * -2.0,
);
next.hand_l.orientation = Quaternion::rotation_x(slowa * -0.1 + slow * 0.1);
next.hand_l.scale = Vec3::one() + slow_abs * -0.05;
next.hand_r.position = Vec3::new(
skeleton_attr.hand.0,
skeleton_attr.hand.1 + slowa * 0.15,
skeleton_attr.hand.2 + slow * 0.7 + stop * -2.0,
s_a.hand.0,
s_a.hand.1 + slowa * 0.15,
s_a.hand.2 + slow * 0.7 + stop * -2.0,
);
next.hand_r.orientation = Quaternion::rotation_x(slow * -0.1 + slowa * 0.1);
next.hand_r.scale = Vec3::one() + slow_abs * -0.05;
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
4.0 + skeleton_attr.foot.1,
3.0 + skeleton_attr.foot.2,
);
next.foot_l.position = Vec3::new(-s_a.foot.0, 4.0 + s_a.foot.1, 3.0 + s_a.foot.2);
next.foot_l.orientation = Quaternion::rotation_x(slow * 0.1 + stop * 1.2 + slow * 0.1);
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
4.0 + skeleton_attr.foot.1,
3.0 + skeleton_attr.foot.2,
);
next.foot_r.position = Vec3::new(s_a.foot.0, 4.0 + s_a.foot.1, 3.0 + s_a.foot.2);
next.foot_r.orientation = Quaternion::rotation_x(slowa * 0.1 + stop * 1.2 + slowa * 0.1);
next.shoulder_l.position = Vec3::new(
-skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1,
skeleton_attr.shoulder.2,
);
next.shoulder_l.position = Vec3::new(-s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2);
next.shoulder_l.orientation = Quaternion::rotation_x(0.0);
next.shoulder_l.scale = (Vec3::one() + slow_abs * -0.05) * 1.15;
next.shoulder_r.position = Vec3::new(
skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1,
skeleton_attr.shoulder.2,
);
next.shoulder_r.position = Vec3::new(s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2);
next.shoulder_r.orientation = Quaternion::rotation_x(0.0);
next.shoulder_r.scale = (Vec3::one() + slow_abs * -0.05) * 1.15;
@ -154,7 +129,7 @@ impl Animation for SitAnimation {
},
}
next.torso.position = Vec3::new(0.0, -0.2, stop * -0.16) * skeleton_attr.scaler;
next.torso.position = Vec3::new(0.0, -0.2, stop * -0.16) * s_a.scaler;
next.second.scale = match (
active_tool_kind.map(|tk| tk.hands()),

View File

@ -21,7 +21,7 @@ impl Animation for SneakAnimation {
(_active_tool_kind, velocity, orientation, last_ori, global_time): Self::Dependency,
anim_time: f64,
rate: &mut f32,
skeleton_attr: &SkeletonAttr,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let speed = Vec2::<f32>::from(velocity).magnitude();
@ -93,39 +93,23 @@ impl Animation for SneakAnimation {
next.hold.scale = Vec3::one() * 0.0;
if speed > 0.5 {
next.hand_l.position = Vec3::new(
1.0 - skeleton_attr.hand.0,
4.0 + skeleton_attr.hand.1,
1.0 + skeleton_attr.hand.2,
);
next.hand_l.position = Vec3::new(1.0 - s_a.hand.0, 4.0 + s_a.hand.1, 1.0 + s_a.hand.2);
next.hand_l.orientation = Quaternion::rotation_x(1.0);
next.hand_r.position = Vec3::new(
-1.0 + skeleton_attr.hand.0,
-1.0 + skeleton_attr.hand.1,
skeleton_attr.hand.2,
);
next.hand_r.position = Vec3::new(-1.0 + s_a.hand.0, -1.0 + s_a.hand.1, s_a.hand.2);
next.hand_r.orientation = Quaternion::rotation_x(0.4);
next.head.position = Vec3::new(
0.0,
-1.0 + skeleton_attr.head.0,
-1.0 + skeleton_attr.head.1 + short * 0.06,
);
next.head.position =
Vec3::new(0.0, -1.0 + s_a.head.0, -1.0 + s_a.head.1 + short * 0.06);
next.head.orientation =
Quaternion::rotation_z(tilt * -2.5 + head_look.x * 0.2 - short * 0.06)
* Quaternion::rotation_x(head_look.y + 0.45);
next.chest.position = Vec3::new(
0.0,
skeleton_attr.chest.0,
-1.0 + skeleton_attr.chest.1 + shortalt * -0.5,
);
next.chest.position = Vec3::new(0.0, s_a.chest.0, -1.0 + s_a.chest.1 + shortalt * -0.5);
next.chest.orientation = Quaternion::rotation_z(0.3 + short * 0.08 + tilt * -0.2)
* Quaternion::rotation_y(tilt * 0.8)
* Quaternion::rotation_x(-0.5);
next.belt.position =
Vec3::new(0.0, 0.5 + skeleton_attr.belt.0, 0.7 + skeleton_attr.belt.1);
next.belt.position = Vec3::new(0.0, 0.5 + s_a.belt.0, 0.7 + s_a.belt.1);
next.belt.orientation = Quaternion::rotation_z(short * 0.1 + tilt * -1.1)
* Quaternion::rotation_y(tilt * 0.5)
* Quaternion::rotation_x(0.2);
@ -136,29 +120,25 @@ impl Animation for SneakAnimation {
next.back.orientation =
Quaternion::rotation_x(-0.25 + short * 0.1 + noisea * 0.1 + noiseb * 0.1);
next.shorts.position = Vec3::new(
0.0,
1.0 + skeleton_attr.shorts.0,
1.0 + skeleton_attr.shorts.1,
);
next.shorts.position = Vec3::new(0.0, 1.0 + s_a.shorts.0, 1.0 + s_a.shorts.1);
next.shorts.orientation = Quaternion::rotation_z(short * 0.16 + tilt * -1.5)
* Quaternion::rotation_y(tilt * 0.7)
* Quaternion::rotation_x(0.3);
next.shorts.scale = Vec3::one();
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1 + foothoril * -10.5 * walkintensity - lower * 1.0,
1.0 + skeleton_attr.foot.2 + ((footvertl * -1.7).max(-1.0)) * walkintensity,
-s_a.foot.0,
s_a.foot.1 + foothoril * -10.5 * walkintensity - lower * 1.0,
1.0 + s_a.foot.2 + ((footvertl * -1.7).max(-1.0)) * walkintensity,
);
next.foot_l.orientation =
Quaternion::rotation_x(-0.2 + footrotl * -0.8 * walkintensity)
* Quaternion::rotation_y(tilt * 1.8);
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1 + foothorir * -10.5 * walkintensity - lower * 1.0,
1.0 + skeleton_attr.foot.2 + ((footvertr * -1.7).max(-1.0)) * walkintensity,
s_a.foot.0,
s_a.foot.1 + foothorir * -10.5 * walkintensity - lower * 1.0,
1.0 + s_a.foot.2 + ((footvertr * -1.7).max(-1.0)) * walkintensity,
);
next.foot_r.orientation =
Quaternion::rotation_x(-0.2 + footrotr * -0.8 * walkintensity)
@ -173,54 +153,34 @@ impl Animation for SneakAnimation {
} else {
next.head.position = Vec3::new(
0.0,
-1.0 + skeleton_attr.head.0,
-2.0 + skeleton_attr.head.1 + slow * 0.1 + breathe * -0.05,
-1.0 + s_a.head.0,
-2.0 + s_a.head.1 + slow * 0.1 + breathe * -0.05,
);
next.head.orientation = Quaternion::rotation_z(head_look.x)
* Quaternion::rotation_x(0.6 + head_look.y.abs());
next.chest.position = Vec3::new(
0.0,
skeleton_attr.chest.0,
-3.0 + skeleton_attr.chest.1 + slow * 0.1,
);
next.chest.position = Vec3::new(0.0, s_a.chest.0, -3.0 + s_a.chest.1 + slow * 0.1);
next.chest.orientation = Quaternion::rotation_x(-0.7);
next.belt.position = Vec3::new(0.0, skeleton_attr.belt.0, skeleton_attr.belt.1);
next.belt.position = Vec3::new(0.0, s_a.belt.0, s_a.belt.1);
next.belt.orientation = Quaternion::rotation_z(0.3 + head_look.x * -0.1);
next.hand_l.position = Vec3::new(
1.0 - skeleton_attr.hand.0,
5.0 + skeleton_attr.hand.1,
0.0 + skeleton_attr.hand.2,
);
next.hand_l.position = Vec3::new(1.0 - s_a.hand.0, 5.0 + s_a.hand.1, 0.0 + s_a.hand.2);
next.hand_l.orientation = Quaternion::rotation_x(1.35);
next.hand_r.position = Vec3::new(
-1.0 + skeleton_attr.hand.0,
skeleton_attr.hand.1,
skeleton_attr.hand.2,
);
next.hand_r.position = Vec3::new(-1.0 + s_a.hand.0, s_a.hand.1, s_a.hand.2);
next.hand_r.orientation = Quaternion::rotation_x(0.4);
next.glider.orientation = Quaternion::rotation_x(0.35);
next.glider.position = Vec3::new(0.0, 0.0, 10.0);
next.shorts.position = Vec3::new(0.0, skeleton_attr.shorts.0, skeleton_attr.shorts.1);
next.shorts.position = Vec3::new(0.0, s_a.shorts.0, s_a.shorts.1);
next.shorts.orientation = Quaternion::rotation_z(0.6 + head_look.x * -0.2);
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
-6.0 + skeleton_attr.foot.1,
1.0 + skeleton_attr.foot.2,
);
next.foot_l.position = Vec3::new(-s_a.foot.0, -6.0 + s_a.foot.1, 1.0 + s_a.foot.2);
next.foot_l.orientation = Quaternion::rotation_x(-0.5);
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
4.0 + skeleton_attr.foot.1,
skeleton_attr.foot.2,
);
next.foot_r.position = Vec3::new(s_a.foot.0, 4.0 + s_a.foot.1, s_a.foot.2);
next.shoulder_l.scale = (Vec3::one() + breathe * -0.05) * 1.15;

View File

@ -31,7 +31,7 @@ impl Animation for SpinAnimation {
(active_tool_kind, second_tool_kind, _global_time, stage_section): Self::Dependency,
anim_time: f64,
rate: &mut f32,
skeleton_attr: &SkeletonAttr,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
*rate = 1.0;
let mut next = (*skeleton).clone();
@ -57,7 +57,7 @@ impl Animation for SpinAnimation {
fn slow(x: f32) -> f32 { (x * 8.0).sin() }
next.head.position = Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1);
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
if let Some(ToolKind::Sword(_)) = active_tool_kind {
next.hand_l.position = Vec3::new(-0.75, -1.0, 2.5);
@ -122,15 +122,11 @@ impl Animation for SpinAnimation {
next.control.orientation = Quaternion::rotation_x(-1.7)
* Quaternion::rotation_y(0.2 + spin * -2.0)
* Quaternion::rotation_z(1.4 + spin * 0.1);
next.head.position = Vec3::new(
0.0,
-1.0 + skeleton_attr.head.0 + spin * -0.8,
skeleton_attr.head.1,
);
next.head.position = Vec3::new(0.0, -1.0 + s_a.head.0 + spin * -0.8, s_a.head.1);
next.head.orientation = Quaternion::rotation_z(spin * -0.25)
* Quaternion::rotation_x(0.0 + spin * -0.1)
* Quaternion::rotation_y(spin * -0.2);
next.chest.position = Vec3::new(0.0, skeleton_attr.chest.0, skeleton_attr.chest.1);
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1);
next.chest.orientation = Quaternion::rotation_z(spin * 0.1)
* Quaternion::rotation_x(0.0 + spin * 0.1)
* Quaternion::rotation_y(decel * -0.2);
@ -142,13 +138,11 @@ impl Animation for SpinAnimation {
next.belt.orientation = next.chest.orientation * -0.08;
next.torso.orientation = Quaternion::rotation_z((spin * 7.0).max(0.3));
next.foot_l.position =
Vec3::new(-skeleton_attr.foot.0, foot * 1.0, skeleton_attr.foot.2);
next.foot_l.position = Vec3::new(-s_a.foot.0, foot * 1.0, s_a.foot.2);
next.foot_l.orientation = Quaternion::rotation_x(foot * -1.2);
next.foot_l.scale = Vec3::one();
next.foot_r.position =
Vec3::new(skeleton_attr.foot.0, foot * -1.0, skeleton_attr.foot.2);
next.foot_r.position = Vec3::new(s_a.foot.0, foot * -1.0, s_a.foot.2);
next.foot_r.orientation = Quaternion::rotation_x(foot * 1.2);
next.lantern.orientation =

View File

@ -30,7 +30,7 @@ impl Animation for SpinMeleeAnimation {
(active_tool_kind, second_tool_kind, velocity, _global_time, stage_section): Self::Dependency,
anim_time: f64,
rate: &mut f32,
skeleton_attr: &SkeletonAttr,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
*rate = 1.0;
let lab = 1.0;
@ -71,8 +71,7 @@ impl Animation for SpinMeleeAnimation {
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);
next.head.position = Vec3::new(0.0, s_a.head.0 + 0.0, s_a.head.1);
if let Some(stage_section) = stage_section {
match stage_section {
@ -84,8 +83,8 @@ impl Animation for SpinMeleeAnimation {
* Quaternion::rotation_z(movement * -1.5);
next.chest.position = Vec3::new(
0.0,
skeleton_attr.chest.0 + movement * -1.0,
skeleton_attr.chest.1 + movement * -2.5,
s_a.chest.0 + movement * -1.0,
s_a.chest.1 + movement * -2.5,
);
next.chest.orientation = Quaternion::rotation_x(movement * -1.1)
* Quaternion::rotation_z(movement * -0.35);
@ -93,48 +92,41 @@ impl Animation for SpinMeleeAnimation {
next.shorts.orientation = Quaternion::rotation_z(movement * 0.5);
next.head.position = Vec3::new(
0.0,
skeleton_attr.head.0 - 2.0 + movement * -6.0,
skeleton_attr.head.1 + movement * -4.0,
s_a.head.0 - 2.0 + movement * -6.0,
s_a.head.1 + movement * -4.0,
);
next.head.orientation = Quaternion::rotation_x(movement * 0.9)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(movement * 0.05);
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1 + movement * 4.0,
skeleton_attr.foot.2,
);
next.foot_l.position =
Vec3::new(-s_a.foot.0, s_a.foot.1 + movement * 4.0, s_a.foot.2);
next.foot_l.orientation = Quaternion::rotation_x(movement * 0.2);
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1 + movement * -12.0,
skeleton_attr.foot.2 + movement * 1.0 + quick * 1.0,
s_a.foot.0,
s_a.foot.1 + movement * -12.0,
s_a.foot.2 + movement * 1.0 + quick * 1.0,
);
next.foot_r.orientation = Quaternion::rotation_x(movement * -1.0)
* Quaternion::rotation_z(movement * -0.8);
},
StageSection::Swing => {
next.head.position =
Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1);
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
next.control.position = Vec3::new(-7.0, 7.0, 2.0);
next.control.orientation = Quaternion::rotation_x(-PI / 2.0)
* Quaternion::rotation_z(-PI / 2.0);
next.torso.orientation = Quaternion::rotation_z(movement * PI * 2.0);
next.chest.position =
Vec3::new(0.0, skeleton_attr.chest.0, skeleton_attr.chest.1);
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1);
next.chest.orientation = Quaternion::rotation_y(0.3);
next.head.position =
Vec3::new(0.0, skeleton_attr.head.0 - 2.0, skeleton_attr.head.1);
next.head.position = Vec3::new(0.0, s_a.head.0 - 2.0, s_a.head.1);
next.head.orientation = Quaternion::rotation_x(-0.15);
next.belt.orientation = Quaternion::rotation_x(0.1);
next.shorts.orientation = Quaternion::rotation_x(0.2);
},
StageSection::Recover => {
next.head.position =
Vec3::new(0.0, skeleton_attr.head.0 - 2.0, skeleton_attr.head.1);
next.head.position = Vec3::new(0.0, s_a.head.0 - 2.0, s_a.head.1);
next.control.position = Vec3::new(-7.0, 7.0, 2.0);
next.control.orientation =
Quaternion::rotation_x(-PI / 2.0 + movement * PI / 2.0)
@ -168,11 +160,7 @@ impl Animation for SpinMeleeAnimation {
next.head.orientation = Quaternion::rotation_z(0.0)
* Quaternion::rotation_x(-0.15)
* Quaternion::rotation_y(0.08);
next.chest.position = Vec3::new(
0.0,
skeleton_attr.chest.0 - 3.0,
skeleton_attr.chest.1 - 2.0,
);
next.chest.position = Vec3::new(0.0, s_a.chest.0 - 3.0, s_a.chest.1 - 2.0);
next.chest.orientation = Quaternion::rotation_z(0.0)
* Quaternion::rotation_x(-0.1)
* Quaternion::rotation_y(0.3);
@ -189,45 +177,30 @@ impl Animation for SpinMeleeAnimation {
-xshift * (anim_time as f32).min(0.6),
-yshift * (anim_time as f32).min(0.6),
0.0,
) * skeleton_attr.scaler;
) * s_a.scaler;
next.torso.orientation = Quaternion::rotation_z(spin * -16.0)
* Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(0.0);
if velocity.z.abs() > 0.1 {
next.foot_l.position =
Vec3::new(-skeleton_attr.foot.0, 8.0, skeleton_attr.foot.2 + 2.0);
next.foot_l.position = Vec3::new(-s_a.foot.0, 8.0, s_a.foot.2 + 2.0);
next.foot_l.orientation =
Quaternion::rotation_x(1.0) * Quaternion::rotation_z(0.0);
next.foot_r.position =
Vec3::new(skeleton_attr.foot.0, 8.0, skeleton_attr.foot.2 + 2.0);
next.foot_r.position = Vec3::new(s_a.foot.0, 8.0, s_a.foot.2 + 2.0);
next.foot_r.orientation = Quaternion::rotation_x(1.0);
} else if speed < 0.5 {
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
2.0 + quick * -6.0,
skeleton_attr.foot.2,
);
next.foot_l.position = Vec3::new(-s_a.foot.0, 2.0 + quick * -6.0, s_a.foot.2);
next.foot_l.orientation = Quaternion::rotation_x(0.5 + slowersmooth * 0.2)
* Quaternion::rotation_z(0.0);
next.foot_r.position =
Vec3::new(skeleton_attr.foot.0, 4.0, skeleton_attr.foot.2);
next.foot_r.position = Vec3::new(s_a.foot.0, 4.0, s_a.foot.2);
next.foot_r.orientation = Quaternion::rotation_x(0.5 - slowersmooth * 0.2)
* Quaternion::rotation_y(-0.4);
} else {
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
2.0 + quick * -6.0,
skeleton_attr.foot.2,
);
next.foot_l.position = Vec3::new(-s_a.foot.0, 2.0 + quick * -6.0, s_a.foot.2);
next.foot_l.orientation = Quaternion::rotation_x(0.5 + slowersmooth * 0.2);
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
2.0 + quick * 6.0,
skeleton_attr.foot.2,
);
next.foot_r.position = Vec3::new(s_a.foot.0, 2.0 + quick * 6.0, s_a.foot.2);
next.foot_r.orientation = Quaternion::rotation_x(0.5 - slowersmooth * 0.2);
};
},

View File

@ -20,7 +20,7 @@ impl Animation for StandAnimation {
(active_tool_kind, second_tool_kind, global_time, avg_vel): Self::Dependency,
anim_time: f64,
_rate: &mut f32,
skeleton_attr: &SkeletonAttr,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
@ -41,88 +41,60 @@ impl Animation for StandAnimation {
);
next.head.position = Vec3::new(
0.0,
2.0 + skeleton_attr.head.0,
skeleton_attr.head.1 + slow * 0.3 + breathe * -0.05,
2.0 + s_a.head.0,
s_a.head.1 + slow * 0.3 + breathe * -0.05,
);
next.head.orientation = Quaternion::rotation_z(head_look.x)
* Quaternion::rotation_x(impact * -0.02 + head_look.y.abs());
next.head.scale = Vec3::one() * skeleton_attr.head_scale + breathe * -0.05;
next.head.scale = Vec3::one() * s_a.head_scale + breathe * -0.05;
next.chest.position = Vec3::new(
0.0,
skeleton_attr.chest.0,
skeleton_attr.chest.1 + slow * 0.3 + impact * 0.2,
);
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + slow * 0.3 + impact * 0.2);
next.chest.orientation =
Quaternion::rotation_z(head_look.x * 0.6) * Quaternion::rotation_x(impact * 0.04);
next.chest.scale = Vec3::one() * 1.01 + breathe * 0.03;
next.belt.position = Vec3::new(
0.0,
skeleton_attr.belt.0 + impact * 0.005,
skeleton_attr.belt.1,
);
next.belt.position = Vec3::new(0.0, s_a.belt.0 + impact * 0.005, s_a.belt.1);
next.belt.orientation =
Quaternion::rotation_z(head_look.x * -0.1) * Quaternion::rotation_x(impact * -0.03);
next.belt.scale = Vec3::one() + breathe * -0.03;
next.back.position = Vec3::new(0.0, skeleton_attr.back.0, skeleton_attr.back.1);
next.back.position = Vec3::new(0.0, s_a.back.0, s_a.back.1);
next.back.scale = Vec3::one() * 1.02;
next.shorts.position = Vec3::new(
0.0,
skeleton_attr.shorts.0 + impact * -0.2,
skeleton_attr.shorts.1,
);
next.shorts.position = Vec3::new(0.0, s_a.shorts.0 + impact * -0.2, s_a.shorts.1);
next.shorts.orientation =
Quaternion::rotation_z(head_look.x * -0.2) * Quaternion::rotation_x(impact * -0.04);
next.shorts.scale = Vec3::one() + breathe * -0.03;
next.hand_l.position = Vec3::new(
-skeleton_attr.hand.0,
skeleton_attr.hand.1 + slow * 0.15 - impact * 0.2,
skeleton_attr.hand.2 + slow * 0.5 + impact * -0.1,
-s_a.hand.0,
s_a.hand.1 + slow * 0.15 - impact * 0.2,
s_a.hand.2 + slow * 0.5 + impact * -0.1,
);
next.hand_l.orientation = Quaternion::rotation_x(slow * -0.06 + impact * -0.1);
next.hand_l.scale = Vec3::one() * 1.04;
next.hand_r.position = Vec3::new(
skeleton_attr.hand.0,
skeleton_attr.hand.1 + slow * 0.15 - impact * 0.2,
skeleton_attr.hand.2 + slow * 0.5 + impact * -0.1,
s_a.hand.0,
s_a.hand.1 + slow * 0.15 - impact * 0.2,
s_a.hand.2 + slow * 0.5 + impact * -0.1,
);
next.hand_r.orientation = Quaternion::rotation_x(slow * -0.06 + impact * -0.1);
next.hand_r.scale = Vec3::one() * 1.04;
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1 - impact * 0.15,
skeleton_attr.foot.2,
);
next.foot_l.position = Vec3::new(-s_a.foot.0, s_a.foot.1 - impact * 0.15, s_a.foot.2);
next.foot_l.orientation = Quaternion::rotation_x(impact * 0.02);
next.foot_l.scale = Vec3::one();
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1 + impact * 0.15,
skeleton_attr.foot.2,
);
next.foot_r.position = Vec3::new(s_a.foot.0, s_a.foot.1 + impact * 0.15, s_a.foot.2);
next.foot_r.orientation = Quaternion::rotation_x(impact * -0.02);
next.foot_r.scale = Vec3::one();
next.shoulder_l.position = Vec3::new(
-skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1,
skeleton_attr.shoulder.2,
);
next.shoulder_l.position = Vec3::new(-s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2);
next.shoulder_l.scale = (Vec3::one() + breathe * -0.05) * 1.15;
next.shoulder_r.position = Vec3::new(
skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1,
skeleton_attr.shoulder.2,
);
next.shoulder_r.position = Vec3::new(s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2);
next.shoulder_r.scale = (Vec3::one() + breathe * -0.05) * 1.15;
next.glider.position = Vec3::new(0.0, 0.0, 10.0);
@ -166,17 +138,13 @@ impl Animation for StandAnimation {
}
next.second.scale = Vec3::one();
next.lantern.position = Vec3::new(
skeleton_attr.lantern.0,
skeleton_attr.lantern.1,
skeleton_attr.lantern.2,
);
next.lantern.position = Vec3::new(s_a.lantern.0, s_a.lantern.1, s_a.lantern.2);
next.lantern.orientation = Quaternion::rotation_x(0.1) * Quaternion::rotation_y(0.1);
next.lantern.scale = Vec3::one() * 0.65;
next.torso.position = Vec3::new(0.0, 0.0, 0.0) * skeleton_attr.scaler;
next.torso.position = Vec3::new(0.0, 0.0, 0.0) * s_a.scaler;
next.torso.orientation = Quaternion::rotation_x(0.0);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
next.torso.scale = Vec3::one() / 11.0 * s_a.scaler;
next.second.scale = match (
active_tool_kind.map(|tk| tk.hands()),

View File

@ -31,7 +31,7 @@ impl Animation for SwimAnimation {
(active_tool_kind, second_tool_kind, velocity, orientation, last_ori, global_time, avg_vel): Self::Dependency,
anim_time: f64,
rate: &mut f32,
skeleton_attr: &SkeletonAttr,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let avgspeed = Vec2::<f32>::from(avg_vel).magnitude();
@ -93,11 +93,7 @@ impl Animation for SwimAnimation {
let abstilt = tilt.abs();
let squash = if abstilt > 0.2 { 0.35 } else { 1.0 }; //condenses the body at strong turns
next.head.position = Vec3::new(
0.0,
-3.0 + skeleton_attr.head.0,
skeleton_attr.head.1 - 1.0 + short * 0.3,
);
next.head.position = Vec3::new(0.0, -3.0 + s_a.head.0, s_a.head.1 - 1.0 + short * 0.3);
next.head.orientation =
Quaternion::rotation_z(head_look.x * 0.3 + short * -0.2 * intensity + tilt * 3.0)
* Quaternion::rotation_x(
@ -106,75 +102,67 @@ impl Animation for SwimAnimation {
+ velocity.z * 0.03
- (abstilt * 1.8).min(0.0),
);
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
next.head.scale = Vec3::one() * s_a.head_scale;
next.chest.position = Vec3::new(
0.0,
skeleton_attr.chest.0,
-10.0 + skeleton_attr.chest.1 + short * 0.3 * intensity,
s_a.chest.0,
-10.0 + s_a.chest.1 + short * 0.3 * intensity,
);
next.chest.orientation = Quaternion::rotation_z(short * 0.1 * intensity);
next.belt.position = Vec3::new(0.0, skeleton_attr.belt.0, skeleton_attr.belt.1);
next.belt.position = Vec3::new(0.0, s_a.belt.0, s_a.belt.1);
next.belt.orientation = Quaternion::rotation_x(velocity.z.abs() * -0.005 + abstilt * 1.0)
* Quaternion::rotation_z(short * -0.2 * intensity);
next.belt.scale = Vec3::one();
next.back.position = Vec3::new(0.0, skeleton_attr.back.0, skeleton_attr.back.1);
next.back.position = Vec3::new(0.0, s_a.back.0, s_a.back.1);
next.back.scale = Vec3::one() * 1.02;
next.shorts.position = Vec3::new(0.0, skeleton_attr.shorts.0, skeleton_attr.shorts.1);
next.shorts.position = Vec3::new(0.0, s_a.shorts.0, s_a.shorts.1);
next.shorts.orientation = Quaternion::rotation_x(velocity.z.abs() * -0.005 + abstilt * 1.0)
* Quaternion::rotation_z(short * -0.3 * intensity);
next.shorts.scale = Vec3::one();
next.hand_l.position = Vec3::new(
-1.0 - skeleton_attr.hand.0,
1.5 + skeleton_attr.hand.1 - foot * 2.0 * intensity * squash,
intensity * 5.0 + skeleton_attr.hand.2 + foot * -5.0 * intensity * squash,
-1.0 - s_a.hand.0,
1.5 + s_a.hand.1 - foot * 2.0 * intensity * squash,
intensity * 5.0 + s_a.hand.2 + foot * -5.0 * intensity * squash,
);
next.hand_l.orientation = Quaternion::rotation_x(1.5 + foot * -1.2 * intensity * squash)
* Quaternion::rotation_y(0.4 + foot * -0.35);
next.hand_l.scale = Vec3::one() * 1.04;
next.hand_r.position = Vec3::new(
1.0 + skeleton_attr.hand.0,
1.5 + skeleton_attr.hand.1 + foot * 2.0 * intensity * squash,
intensity * 5.0 + skeleton_attr.hand.2 + foot * 5.0 * intensity * squash,
1.0 + s_a.hand.0,
1.5 + s_a.hand.1 + foot * 2.0 * intensity * squash,
intensity * 5.0 + s_a.hand.2 + foot * 5.0 * intensity * squash,
);
next.hand_r.orientation = Quaternion::rotation_x(1.5 + foot * 1.2 * intensity * squash)
* Quaternion::rotation_y(-0.4 + foot * -0.35);
next.hand_r.scale = Vec3::one() * 1.04;
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1 + foothoril * 1.5 * intensity * squash,
-10.0 + skeleton_attr.foot.2 + footrotl * 3.0 * intensity * squash,
-s_a.foot.0,
s_a.foot.1 + foothoril * 1.5 * intensity * squash,
-10.0 + s_a.foot.2 + footrotl * 3.0 * intensity * squash,
);
next.foot_l.orientation =
Quaternion::rotation_x(-0.8 * squash + footrotl * 0.4 * intensity * squash);
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1 + foothorir * 1.5 * intensity * squash,
-10.0 + skeleton_attr.foot.2 + footrotr * 3.0 * intensity * squash,
s_a.foot.0,
s_a.foot.1 + foothorir * 1.5 * intensity * squash,
-10.0 + s_a.foot.2 + footrotr * 3.0 * intensity * squash,
);
next.foot_r.orientation =
Quaternion::rotation_x(-0.8 * squash + footrotr * 0.4 * intensity * squash);
next.shoulder_l.position = Vec3::new(
-skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1,
skeleton_attr.shoulder.2,
);
next.shoulder_l.position = Vec3::new(-s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2);
next.shoulder_l.orientation = Quaternion::rotation_x(short * 0.15 * intensity);
next.shoulder_l.scale = Vec3::one() * 1.1;
next.shoulder_r.position = Vec3::new(
skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1,
skeleton_attr.shoulder.2,
);
next.shoulder_r.position = Vec3::new(s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2);
next.shoulder_r.orientation = Quaternion::rotation_x(short * -0.15 * intensity);
next.shoulder_r.scale = Vec3::one() * 1.1;
@ -217,11 +205,7 @@ impl Animation for SwimAnimation {
}
next.second.scale = Vec3::one();
next.lantern.position = Vec3::new(
skeleton_attr.lantern.0,
skeleton_attr.lantern.1,
skeleton_attr.lantern.2,
);
next.lantern.position = Vec3::new(s_a.lantern.0, s_a.lantern.1, s_a.lantern.2);
next.lantern.scale = Vec3::one() * 0.65;
next.hold.scale = Vec3::one() * 0.0;
@ -230,13 +214,13 @@ impl Animation for SwimAnimation {
} else {
avgtotal
};
next.torso.position = Vec3::new(0.0, 0.0, 1.0 - avgspeed * 0.05) * skeleton_attr.scaler;
next.torso.position = Vec3::new(0.0, 0.0, 1.0 - avgspeed * 0.05) * s_a.scaler;
next.torso.orientation = Quaternion::rotation_x(
(((1.0 / switch) * PI / 2.0 + avg_vel.z * 0.12).min(1.57) - PI / 2.0)
+ avgspeed * avg_vel.z * -0.003,
) * Quaternion::rotation_y(tilt * 8.0)
* Quaternion::rotation_z(tilt * 8.0);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
next.torso.scale = Vec3::one() / 11.0 * s_a.scaler;
next.second.scale = match (
active_tool_kind.map(|tk| tk.hands()),

View File

@ -21,7 +21,7 @@ impl Animation for SwimWieldAnimation {
(active_tool_kind, second_tool_kind, velocity, global_time): Self::Dependency,
anim_time: f64,
rate: &mut f32,
skeleton_attr: &SkeletonAttr,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
*rate = 1.0;
@ -70,73 +70,58 @@ impl Animation for SwimWieldAnimation {
let noiseb = (anim_time as f32 * 19.0 + PI / 4.0).sin();
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1 + foothoril * 1.5 * intensity,
-10.0 + skeleton_attr.foot.2 + footrotl * 3.0 * intensity,
-s_a.foot.0,
s_a.foot.1 + foothoril * 1.5 * intensity,
-10.0 + s_a.foot.2 + footrotl * 3.0 * intensity,
);
next.foot_l.orientation = Quaternion::rotation_x(-0.8 + footrotl * 0.4 * intensity);
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1 + foothorir * 1.5 * intensity,
-10.0 + skeleton_attr.foot.2 + footrotr * 3.0 * intensity,
s_a.foot.0,
s_a.foot.1 + foothorir * 1.5 * intensity,
-10.0 + s_a.foot.2 + footrotr * 3.0 * intensity,
);
next.foot_r.orientation = Quaternion::rotation_x(-0.8 + footrotr * 0.4 * intensity);
next.hold.scale = Vec3::one() * 0.0;
if velocity > 0.01 {
next.torso.position = Vec3::new(0.0, 0.0, 1.0) * skeleton_attr.scaler;
next.torso.position = Vec3::new(0.0, 0.0, 1.0) * s_a.scaler;
next.torso.orientation = Quaternion::rotation_x(velocity * -0.05);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
next.torso.scale = Vec3::one() / 11.0 * s_a.scaler;
next.back.position = Vec3::new(0.0, skeleton_attr.back.0, skeleton_attr.back.1);
next.back.position = Vec3::new(0.0, s_a.back.0, s_a.back.1);
next.back.orientation = Quaternion::rotation_x(
(-0.5 + short * 0.3 + noisea * 0.3 + noiseb * 0.3).min(-0.1),
);
next.back.scale = Vec3::one() * 1.02;
} else {
next.head.position = Vec3::new(
0.0,
skeleton_attr.head.0,
skeleton_attr.head.1 + u_slow * 0.1,
);
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1 + u_slow * 0.1);
next.head.orientation =
Quaternion::rotation_z(head_look.x) * Quaternion::rotation_x(head_look.y.abs());
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
next.head.scale = Vec3::one() * s_a.head_scale;
next.chest.position = Vec3::new(
0.0 + slowalt * 0.5,
skeleton_attr.chest.0,
skeleton_attr.chest.1 + u_slow * 0.5,
);
next.torso.position = Vec3::new(0.0, 0.0, 0.0) * skeleton_attr.scaler;
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
next.chest.position =
Vec3::new(0.0 + slowalt * 0.5, s_a.chest.0, s_a.chest.1 + u_slow * 0.5);
next.torso.position = Vec3::new(0.0, 0.0, 0.0) * s_a.scaler;
next.torso.scale = Vec3::one() / 11.0 * s_a.scaler;
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
-2.0 + skeleton_attr.foot.1,
skeleton_attr.foot.2,
);
next.foot_l.position = Vec3::new(-s_a.foot.0, -2.0 + s_a.foot.1, s_a.foot.2);
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
2.0 + skeleton_attr.foot.1,
skeleton_attr.foot.2,
);
next.foot_r.position = Vec3::new(s_a.foot.0, 2.0 + s_a.foot.1, s_a.foot.2);
next.chest.orientation =
Quaternion::rotation_y(u_slowalt * 0.04) * Quaternion::rotation_z(0.25);
next.belt.position = Vec3::new(0.0, skeleton_attr.belt.0, skeleton_attr.belt.1);
next.belt.position = Vec3::new(0.0, s_a.belt.0, s_a.belt.1);
next.belt.orientation =
Quaternion::rotation_y(u_slowalt * 0.03) * Quaternion::rotation_z(0.22);
next.belt.scale = Vec3::one() * 1.02;
next.back.position = Vec3::new(0.0, skeleton_attr.back.0, skeleton_attr.back.1);
next.back.position = Vec3::new(0.0, s_a.back.0, s_a.back.1);
next.back.orientation = Quaternion::rotation_x(-0.2);
next.back.scale = Vec3::one() * 1.02;
next.shorts.position = Vec3::new(0.0, skeleton_attr.shorts.0, skeleton_attr.shorts.1);
next.shorts.position = Vec3::new(0.0, s_a.shorts.0, s_a.shorts.1);
next.shorts.orientation = Quaternion::rotation_z(0.3);
}
match active_tool_kind {
@ -194,24 +179,19 @@ impl Animation for SwimWieldAnimation {
},
Some(ToolKind::Axe(_)) => {
if velocity < 0.5 {
next.head.position = Vec3::new(
0.0,
-3.5 + skeleton_attr.head.0,
skeleton_attr.head.1 + u_slow * 0.1,
);
next.head.position =
Vec3::new(0.0, -3.5 + s_a.head.0, s_a.head.1 + u_slow * 0.1);
next.head.orientation = Quaternion::rotation_z(head_look.x)
* Quaternion::rotation_x(0.35 + head_look.y.abs());
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
next.head.scale = Vec3::one() * s_a.head_scale;
next.chest.orientation = Quaternion::rotation_x(-0.35)
* Quaternion::rotation_y(u_slowalt * 0.04)
* Quaternion::rotation_z(0.15);
next.belt.position =
Vec3::new(0.0, 1.0 + skeleton_attr.belt.0, skeleton_attr.belt.1);
next.belt.position = Vec3::new(0.0, 1.0 + s_a.belt.0, s_a.belt.1);
next.belt.orientation = Quaternion::rotation_x(0.15)
* Quaternion::rotation_y(u_slowalt * 0.03)
* Quaternion::rotation_z(0.15);
next.shorts.position =
Vec3::new(0.0, 1.0 + skeleton_attr.shorts.0, skeleton_attr.shorts.1);
next.shorts.position = Vec3::new(0.0, 1.0 + s_a.shorts.0, s_a.shorts.1);
next.shorts.orientation =
Quaternion::rotation_x(0.15) * Quaternion::rotation_z(0.25);
next.control.orientation = Quaternion::rotation_x(1.8)
@ -365,7 +345,7 @@ impl Animation for SwimWieldAnimation {
if velocity < 0.5 {
next.head.orientation = Quaternion::rotation_z(head_look.x)
* Quaternion::rotation_x(-0.2 + head_look.y.abs());
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
next.head.scale = Vec3::one() * s_a.head_scale;
}
next.hand_l.position = Vec3::new(9.0, 1.0, 1.0);
next.hand_l.orientation =

View File

@ -21,7 +21,7 @@ impl Animation for WieldAnimation {
(active_tool_kind, second_tool_kind, velocity, global_time): Self::Dependency,
anim_time: f64,
rate: &mut f32,
skeleton_attr: &SkeletonAttr,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
*rate = 1.0;
let lab = 1.0;
@ -68,41 +68,26 @@ impl Animation for WieldAnimation {
(-0.5 + short * 0.3 + noisea * 0.3 + noiseb * 0.3).min(-0.1),
);
} else {
next.head.position = Vec3::new(
0.0,
0.0 + skeleton_attr.head.0,
skeleton_attr.head.1 + u_slow * 0.1,
);
next.head.position = Vec3::new(0.0, 0.0 + s_a.head.0, s_a.head.1 + u_slow * 0.1);
next.head.orientation =
Quaternion::rotation_z(head_look.x) * Quaternion::rotation_x(head_look.y.abs());
next.chest.position = Vec3::new(
0.0 + slowalt * 0.5,
skeleton_attr.chest.0,
skeleton_attr.chest.1 + u_slow * 0.5,
);
next.chest.position =
Vec3::new(0.0 + slowalt * 0.5, s_a.chest.0, s_a.chest.1 + u_slow * 0.5);
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
-2.0 + skeleton_attr.foot.1,
skeleton_attr.foot.2,
);
next.foot_l.position = Vec3::new(-s_a.foot.0, -2.0 + s_a.foot.1, s_a.foot.2);
next.foot_l.orientation = Quaternion::rotation_x(u_slowalt * 0.035 - 0.2);
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
2.0 + skeleton_attr.foot.1,
skeleton_attr.foot.2,
);
next.foot_r.position = Vec3::new(s_a.foot.0, 2.0 + s_a.foot.1, s_a.foot.2);
next.foot_r.orientation = Quaternion::rotation_x(u_slow * 0.035);
next.chest.orientation =
Quaternion::rotation_y(u_slowalt * 0.04) * Quaternion::rotation_z(0.15);
next.belt.position = Vec3::new(0.0, skeleton_attr.belt.0, skeleton_attr.belt.1);
next.belt.position = Vec3::new(0.0, s_a.belt.0, s_a.belt.1);
next.back.orientation = Quaternion::rotation_x(-0.2);
next.shorts.position = Vec3::new(0.0, skeleton_attr.shorts.0, skeleton_attr.shorts.1);
next.shorts.position = Vec3::new(0.0, s_a.shorts.0, s_a.shorts.1);
next.shorts.orientation = Quaternion::rotation_z(0.3);
}
match active_tool_kind {
@ -152,23 +137,18 @@ impl Animation for WieldAnimation {
},
Some(ToolKind::Axe(_)) => {
if speed < 0.5 {
next.head.position = Vec3::new(
0.0,
0.0 + skeleton_attr.head.0,
skeleton_attr.head.1 + u_slow * 0.1,
);
next.head.position =
Vec3::new(0.0, 0.0 + s_a.head.0, s_a.head.1 + u_slow * 0.1);
next.head.orientation = Quaternion::rotation_z(head_look.x)
* Quaternion::rotation_x(0.35 + head_look.y.abs());
next.chest.orientation = Quaternion::rotation_x(-0.35)
* Quaternion::rotation_y(u_slowalt * 0.04)
* Quaternion::rotation_z(0.15);
next.belt.position =
Vec3::new(0.0, 1.0 + skeleton_attr.belt.0, skeleton_attr.belt.1);
next.belt.position = Vec3::new(0.0, 1.0 + s_a.belt.0, s_a.belt.1);
next.belt.orientation = Quaternion::rotation_x(0.15)
* Quaternion::rotation_y(u_slowalt * 0.03)
* Quaternion::rotation_z(0.15);
next.shorts.position =
Vec3::new(0.0, 1.0 + skeleton_attr.shorts.0, skeleton_attr.shorts.1);
next.shorts.position = Vec3::new(0.0, 1.0 + s_a.shorts.0, s_a.shorts.1);
next.shorts.orientation =
Quaternion::rotation_x(0.15) * Quaternion::rotation_z(0.25);
next.control.orientation = Quaternion::rotation_x(1.8)
@ -212,9 +192,9 @@ impl Animation for WieldAnimation {
Some(ToolKind::Staff(_)) | Some(ToolKind::Sceptre(_)) => {
if speed > 0.5 && velocity.z == 0.0 {
next.hand_r.position = Vec3::new(
4.0 + skeleton_attr.hand.0 + foothoril * 1.3,
-2.0 + skeleton_attr.hand.1 + foothoril * -6.5,
-2.0 + skeleton_attr.hand.2 - foothoril * 7.0,
4.0 + s_a.hand.0 + foothoril * 1.3,
-2.0 + s_a.hand.1 + foothoril * -6.5,
-2.0 + s_a.hand.2 - foothoril * 7.0,
);
next.hand_r.orientation = Quaternion::rotation_x(0.6 + footrotl * -1.2)
* Quaternion::rotation_y(footrotl * -0.4);

View File

@ -19,7 +19,7 @@ impl Animation for FlyAnimation {
_global_time: Self::Dependency,
anim_time: f64,
_rate: &mut f32,
skeleton_attr: &SkeletonAttr,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
@ -40,8 +40,8 @@ impl Animation for FlyAnimation {
next.head_upper.position = Vec3::new(
0.0,
skeleton_attr.head_upper.0,
skeleton_attr.head_upper.1 + wave_ultra_slow * 0.20,
s_a.head_upper.0,
s_a.head_upper.1 + wave_ultra_slow * 0.20,
);
next.head_upper.orientation =
Quaternion::rotation_z(0.0) * Quaternion::rotation_x(wave_ultra_slow * -0.10);
@ -49,8 +49,8 @@ impl Animation for FlyAnimation {
next.head_lower.position = Vec3::new(
0.0,
skeleton_attr.head_lower.0,
skeleton_attr.head_lower.1 + wave_ultra_slow * 0.20,
s_a.head_lower.0,
s_a.head_lower.1 + wave_ultra_slow * 0.20,
);
next.head_lower.orientation =
Quaternion::rotation_z(0.0) * Quaternion::rotation_x(wave_ultra_slow * -0.10);
@ -58,102 +58,59 @@ impl Animation for FlyAnimation {
next.jaw.position = Vec3::new(
0.0,
skeleton_attr.jaw.0 - wave_ultra_slow_cos * 0.12,
skeleton_attr.jaw.1 + wave_slow * 0.2,
s_a.jaw.0 - wave_ultra_slow_cos * 0.12,
s_a.jaw.1 + wave_slow * 0.2,
);
next.jaw.orientation = Quaternion::rotation_x(wave_slow * 0.03);
next.jaw.scale = Vec3::one() * 1.05;
next.tail_front.position = Vec3::new(
0.0,
skeleton_attr.tail_front.0,
skeleton_attr.tail_front.1 + centeroffset * 0.6,
);
next.tail_front.position =
Vec3::new(0.0, s_a.tail_front.0, s_a.tail_front.1 + centeroffset * 0.6);
next.tail_front.orientation = Quaternion::rotation_x(center * 0.03);
next.tail_front.scale = Vec3::one() * 0.98;
next.tail_rear.position = Vec3::new(
0.0,
skeleton_attr.tail_rear.0,
skeleton_attr.tail_rear.1 + centeroffset * 0.6,
);
next.tail_rear.position =
Vec3::new(0.0, s_a.tail_rear.0, s_a.tail_rear.1 + centeroffset * 0.6);
next.tail_rear.orientation = Quaternion::rotation_x(center * 0.03);
next.tail_rear.scale = Vec3::one() * 0.98;
next.chest_front.position = Vec3::new(
0.0,
skeleton_attr.chest_front.0,
skeleton_attr.chest_front.1,
);
next.chest_front.position = Vec3::new(0.0, s_a.chest_front.0, s_a.chest_front.1);
next.chest_front.orientation = Quaternion::rotation_y(center * 0.05);
next.chest_front.scale = Vec3::one();
next.chest_rear.position =
Vec3::new(0.0, skeleton_attr.chest_rear.0, skeleton_attr.chest_rear.1);
next.chest_rear.position = Vec3::new(0.0, s_a.chest_rear.0, s_a.chest_rear.1);
next.chest_rear.orientation = Quaternion::rotation_y(center * 0.05);
next.chest_rear.scale = Vec3::one();
next.foot_fl.position = Vec3::new(
-skeleton_attr.feet_f.0,
skeleton_attr.feet_f.1,
skeleton_attr.feet_f.2,
);
next.foot_fl.position = Vec3::new(-s_a.feet_f.0, s_a.feet_f.1, s_a.feet_f.2);
next.foot_fl.orientation = Quaternion::rotation_x(-1.3 + footl * 0.06);
next.foot_fl.scale = Vec3::one();
next.foot_fr.position = Vec3::new(
skeleton_attr.feet_f.0,
skeleton_attr.feet_f.1,
skeleton_attr.feet_f.2,
);
next.foot_fr.position = Vec3::new(s_a.feet_f.0, s_a.feet_f.1, s_a.feet_f.2);
next.foot_fr.orientation = Quaternion::rotation_x(-1.3 + footr * 0.06);
next.foot_fr.scale = Vec3::one();
next.foot_bl.position = Vec3::new(
-skeleton_attr.feet_b.0,
skeleton_attr.feet_b.1,
skeleton_attr.feet_b.2,
);
next.foot_bl.position = Vec3::new(-s_a.feet_b.0, s_a.feet_b.1, s_a.feet_b.2);
next.foot_bl.orientation = Quaternion::rotation_x(-1.3 + footl * 0.06);
next.foot_bl.scale = Vec3::one();
next.foot_br.position = Vec3::new(
skeleton_attr.feet_b.0,
skeleton_attr.feet_b.1,
skeleton_attr.feet_b.2,
);
next.foot_br.position = Vec3::new(s_a.feet_b.0, s_a.feet_b.1, s_a.feet_b.2);
next.foot_br.orientation = Quaternion::rotation_x(-1.3 + footr * 0.06);
next.foot_br.scale = Vec3::one();
next.wing_in_l.position = Vec3::new(
-skeleton_attr.wing_in.0,
skeleton_attr.wing_in.1,
skeleton_attr.wing_in.2,
);
next.wing_in_l.position = Vec3::new(-s_a.wing_in.0, s_a.wing_in.1, s_a.wing_in.2);
next.wing_in_l.orientation = Quaternion::rotation_y(0.4 + wingl * 0.6);
next.wing_in_l.scale = Vec3::one();
next.wing_in_r.position = Vec3::new(
skeleton_attr.wing_in.0,
skeleton_attr.wing_in.1,
skeleton_attr.wing_in.2,
);
next.wing_in_r.position = Vec3::new(s_a.wing_in.0, s_a.wing_in.1, s_a.wing_in.2);
next.wing_in_r.orientation = Quaternion::rotation_y(-0.4 + wingr * 0.6);
next.wing_in_r.scale = Vec3::one();
next.wing_out_l.position = Vec3::new(
-skeleton_attr.wing_out.0,
skeleton_attr.wing_out.1,
skeleton_attr.wing_out.2,
);
next.wing_out_l.position = Vec3::new(-s_a.wing_out.0, s_a.wing_out.1, s_a.wing_out.2);
next.wing_out_l.orientation = Quaternion::rotation_y((0.35 + wingl * 0.6).max(0.2));
next.wing_out_l.scale = Vec3::one();
next.wing_out_r.position = Vec3::new(
skeleton_attr.wing_out.0,
skeleton_attr.wing_out.1,
skeleton_attr.wing_out.2,
);
next.wing_out_r.position = Vec3::new(s_a.wing_out.0, s_a.wing_out.1, s_a.wing_out.2);
next.wing_out_r.orientation = Quaternion::rotation_y((-0.35 + wingr * 0.6).min(-0.2));
next.wing_out_r.scale = Vec3::one();

View File

@ -19,7 +19,7 @@ impl Animation for IdleAnimation {
global_time: Self::Dependency,
anim_time: f64,
_rate: &mut f32,
skeleton_attr: &SkeletonAttr,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
@ -40,114 +40,69 @@ impl Animation for IdleAnimation {
* 0.25,
);
next.head_upper.position = Vec3::new(
0.0,
skeleton_attr.head_upper.0,
skeleton_attr.head_upper.1 + ultra_slow * 0.20,
);
next.head_upper.position =
Vec3::new(0.0, s_a.head_upper.0, s_a.head_upper.1 + ultra_slow * 0.20);
next.head_upper.orientation = Quaternion::rotation_z(0.8 * dragon_look.x)
* Quaternion::rotation_x(0.8 * dragon_look.y);
next.head_upper.scale = Vec3::one();
next.head_lower.position = Vec3::new(
0.0,
skeleton_attr.head_lower.0,
skeleton_attr.head_lower.1 + ultra_slow * 0.20,
);
next.head_lower.position =
Vec3::new(0.0, s_a.head_lower.0, s_a.head_lower.1 + ultra_slow * 0.20);
next.head_lower.orientation = Quaternion::rotation_z(0.8 * dragon_look.x)
* Quaternion::rotation_x(-0.2 + 0.8 * dragon_look.y);
next.head_lower.scale = Vec3::one() * 1.05;
next.jaw.position = Vec3::new(0.0, skeleton_attr.jaw.0, skeleton_attr.jaw.1);
next.jaw.position = Vec3::new(0.0, s_a.jaw.0, s_a.jaw.1);
next.jaw.orientation = Quaternion::rotation_x(slow * 0.04);
next.jaw.scale = Vec3::one() * 1.05;
next.chest_front.position = Vec3::new(
0.0,
skeleton_attr.chest_front.0,
skeleton_attr.chest_front.1,
);
next.chest_front.position = Vec3::new(0.0, s_a.chest_front.0, s_a.chest_front.1);
next.chest_front.orientation = Quaternion::rotation_y(0.0);
next.chest_front.scale = Vec3::one() * 1.05;
next.chest_rear.position =
Vec3::new(0.0, skeleton_attr.chest_rear.0, skeleton_attr.chest_rear.1);
next.chest_rear.position = Vec3::new(0.0, s_a.chest_rear.0, s_a.chest_rear.1);
next.chest_rear.orientation = Quaternion::rotation_y(0.0);
next.chest_rear.scale = Vec3::one() * 1.05;
next.tail_front.position =
Vec3::new(0.0, skeleton_attr.tail_front.0, skeleton_attr.tail_front.1);
next.tail_front.position = Vec3::new(0.0, s_a.tail_front.0, s_a.tail_front.1);
next.tail_front.orientation =
Quaternion::rotation_z(slowalt * 0.10) * Quaternion::rotation_x(0.1);
next.tail_front.scale = Vec3::one() * 0.98;
next.tail_rear.position =
Vec3::new(0.0, skeleton_attr.tail_rear.0, skeleton_attr.tail_rear.1);
next.tail_rear.position = Vec3::new(0.0, s_a.tail_rear.0, s_a.tail_rear.1);
next.tail_rear.orientation =
Quaternion::rotation_z(slowalt * 0.12) * Quaternion::rotation_x(0.05);
next.tail_rear.scale = Vec3::one() * 0.98;
next.foot_fl.position = Vec3::new(
-skeleton_attr.feet_f.0,
skeleton_attr.feet_f.1,
skeleton_attr.feet_f.2,
);
next.foot_fl.position = Vec3::new(-s_a.feet_f.0, s_a.feet_f.1, s_a.feet_f.2);
next.foot_fl.orientation = Quaternion::rotation_x(0.0);
next.foot_fl.scale = Vec3::one();
next.foot_fr.position = Vec3::new(
skeleton_attr.feet_f.0,
skeleton_attr.feet_f.1,
skeleton_attr.feet_f.2,
);
next.foot_fr.position = Vec3::new(s_a.feet_f.0, s_a.feet_f.1, s_a.feet_f.2);
next.foot_fr.orientation = Quaternion::rotation_x(0.0);
next.foot_fr.scale = Vec3::one();
next.foot_bl.position = Vec3::new(
-skeleton_attr.feet_b.0,
skeleton_attr.feet_b.1,
skeleton_attr.feet_b.2,
);
next.foot_bl.position = Vec3::new(-s_a.feet_b.0, s_a.feet_b.1, s_a.feet_b.2);
next.foot_bl.orientation = Quaternion::rotation_x(0.0);
next.foot_bl.scale = Vec3::one();
next.foot_br.position = Vec3::new(
skeleton_attr.feet_b.0,
skeleton_attr.feet_b.1,
skeleton_attr.feet_b.2,
);
next.foot_br.position = Vec3::new(s_a.feet_b.0, s_a.feet_b.1, s_a.feet_b.2);
next.foot_br.orientation = Quaternion::rotation_x(0.0);
next.foot_br.scale = Vec3::one();
next.wing_in_l.position = Vec3::new(
-skeleton_attr.wing_in.0,
skeleton_attr.wing_in.1,
skeleton_attr.wing_in.2,
);
next.wing_in_l.position = Vec3::new(-s_a.wing_in.0, s_a.wing_in.1, s_a.wing_in.2);
next.wing_in_l.orientation = Quaternion::rotation_y(0.8 + slow * 0.02);
next.wing_in_l.scale = Vec3::one();
next.wing_in_r.position = Vec3::new(
skeleton_attr.wing_in.0,
skeleton_attr.wing_in.1,
skeleton_attr.wing_in.2,
);
next.wing_in_r.position = Vec3::new(s_a.wing_in.0, s_a.wing_in.1, s_a.wing_in.2);
next.wing_in_r.orientation = Quaternion::rotation_y(-0.8 - slow * 0.02);
next.wing_in_r.scale = Vec3::one();
next.wing_out_l.position = Vec3::new(
-skeleton_attr.wing_out.0,
skeleton_attr.wing_out.1,
skeleton_attr.wing_out.2,
);
next.wing_out_l.position = Vec3::new(-s_a.wing_out.0, s_a.wing_out.1, s_a.wing_out.2);
next.wing_out_l.orientation = Quaternion::rotation_y(-2.0 + slow * 0.02);
next.wing_out_l.scale = Vec3::one();
next.wing_out_r.position = Vec3::new(
skeleton_attr.wing_out.0,
skeleton_attr.wing_out.1,
skeleton_attr.wing_out.2,
);
next.wing_out_r.position = Vec3::new(s_a.wing_out.0, s_a.wing_out.1, s_a.wing_out.2);
next.wing_out_r.orientation = Quaternion::rotation_y(2.0 - slow * 0.02);
next.wing_out_r.scale = Vec3::one();

View File

@ -19,7 +19,7 @@ impl Animation for RunAnimation {
(_velocity, orientation, last_ori, _global_time, avg_vel): Self::Dependency,
anim_time: f64,
_rate: &mut f32,
skeleton_attr: &SkeletonAttr,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
@ -70,15 +70,13 @@ impl Animation for RunAnimation {
let center = (anim_time as f32 * lab as f32 + PI / 2.0).sin();
let centeroffset = (anim_time as f32 * lab as f32 + PI * 1.5).sin();
next.head_upper.position =
Vec3::new(0.0, skeleton_attr.head_upper.0, skeleton_attr.head_upper.1);
next.head_upper.position = Vec3::new(0.0, s_a.head_upper.0, s_a.head_upper.1);
next.head_upper.orientation = Quaternion::rotation_x(short * -0.03 - 0.1)
* Quaternion::rotation_z(tilt * -1.2)
* Quaternion::rotation_y(tilt * 0.8);
next.head_upper.scale = Vec3::one();
next.head_lower.position =
Vec3::new(0.0, skeleton_attr.head_lower.0, skeleton_attr.head_lower.1);
next.head_lower.position = Vec3::new(0.0, s_a.head_lower.0, s_a.head_lower.1);
next.head_lower.orientation = Quaternion::rotation_z(tilt * -0.8)
* Quaternion::rotation_x(short * -0.05)
* Quaternion::rotation_y(tilt * 0.3);
@ -86,111 +84,86 @@ impl Animation for RunAnimation {
next.jaw.position = Vec3::new(
0.0,
skeleton_attr.jaw.0 - wave_ultra_slow_cos * 0.12,
skeleton_attr.jaw.1 + wave_slow * 0.2,
s_a.jaw.0 - wave_ultra_slow_cos * 0.12,
s_a.jaw.1 + wave_slow * 0.2,
);
next.jaw.orientation = Quaternion::rotation_x(wave_slow * 0.03);
next.jaw.scale = Vec3::one() * 1.05;
next.tail_front.position = Vec3::new(
0.0,
skeleton_attr.tail_front.0,
skeleton_attr.tail_front.1 + centeroffset * 0.6,
);
next.tail_front.position =
Vec3::new(0.0, s_a.tail_front.0, s_a.tail_front.1 + centeroffset * 0.6);
next.tail_front.orientation =
Quaternion::rotation_x(center * 0.03) * Quaternion::rotation_z(tilt * 1.5);
next.tail_front.scale = Vec3::one() * 0.98;
next.tail_rear.position = Vec3::new(
0.0,
skeleton_attr.tail_rear.0,
skeleton_attr.tail_rear.1 + centeroffset * 0.6,
);
next.tail_rear.position =
Vec3::new(0.0, s_a.tail_rear.0, s_a.tail_rear.1 + centeroffset * 0.6);
next.tail_rear.orientation =
Quaternion::rotation_x(center * 0.03) * Quaternion::rotation_z(tilt * 1.5);
next.tail_rear.scale = Vec3::one() * 0.98;
next.chest_front.position = Vec3::new(
0.0,
skeleton_attr.chest_front.0,
skeleton_attr.chest_front.1 + shortalt * 2.5 + x_tilt * 10.0,
s_a.chest_front.0,
s_a.chest_front.1 + shortalt * 2.5 + x_tilt * 10.0,
);
next.chest_front.orientation = Quaternion::rotation_x(short * 0.13 + x_tilt)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(tilt * -1.5);
next.chest_front.scale = Vec3::one();
next.chest_rear.position = Vec3::new(
0.0,
skeleton_attr.chest_rear.0,
skeleton_attr.chest_rear.1 + shortalt * 0.2,
);
next.chest_rear.position =
Vec3::new(0.0, s_a.chest_rear.0, s_a.chest_rear.1 + shortalt * 0.2);
next.chest_rear.orientation = Quaternion::rotation_x(short * 0.1)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(tilt * 1.8);
next.chest_rear.scale = Vec3::one();
next.foot_fl.position = Vec3::new(
-skeleton_attr.feet_f.0,
skeleton_attr.feet_f.1 + horilf * 2.5,
skeleton_attr.feet_f.2 + vertlf * 5.0 * skeleton_attr.height - 0.5,
-s_a.feet_f.0,
s_a.feet_f.1 + horilf * 2.5,
s_a.feet_f.2 + vertlf * 5.0 * s_a.height - 0.5,
);
next.foot_fl.orientation = Quaternion::rotation_x(horilf * 0.6);
next.foot_fl.scale = Vec3::one();
next.foot_fr.position = Vec3::new(
skeleton_attr.feet_f.0,
skeleton_attr.feet_f.1 + horirfoffset * 2.5,
skeleton_attr.feet_f.2 + vertrfoffset * 5.0 * skeleton_attr.height - 0.5,
s_a.feet_f.0,
s_a.feet_f.1 + horirfoffset * 2.5,
s_a.feet_f.2 + vertrfoffset * 5.0 * s_a.height - 0.5,
);
next.foot_fr.orientation = Quaternion::rotation_x(horirb * 0.6);
next.foot_fr.scale = Vec3::one();
next.foot_bl.position = Vec3::new(
-skeleton_attr.feet_b.0,
skeleton_attr.feet_b.1 + horilboffset * 3.0,
skeleton_attr.feet_b.2 + vertlboffset * 5.0 * skeleton_attr.height - 0.5,
-s_a.feet_b.0,
s_a.feet_b.1 + horilboffset * 3.0,
s_a.feet_b.2 + vertlboffset * 5.0 * s_a.height - 0.5,
);
next.foot_bl.orientation = Quaternion::rotation_x(horilf * 0.55);
next.foot_bl.scale = Vec3::one();
next.foot_br.position = Vec3::new(
skeleton_attr.feet_b.0,
skeleton_attr.feet_b.1 + horirb * 3.0,
skeleton_attr.feet_b.2 + vertrb * 5.0 * skeleton_attr.height - 0.5,
s_a.feet_b.0,
s_a.feet_b.1 + horirb * 3.0,
s_a.feet_b.2 + vertrb * 5.0 * s_a.height - 0.5,
);
next.foot_br.orientation = Quaternion::rotation_x(horirb * 0.55);
next.foot_br.scale = Vec3::one();
next.wing_in_l.position = Vec3::new(
-skeleton_attr.wing_in.0,
skeleton_attr.wing_in.1,
skeleton_attr.wing_in.2,
);
next.wing_in_l.position = Vec3::new(-s_a.wing_in.0, s_a.wing_in.1, s_a.wing_in.2);
next.wing_in_l.orientation = Quaternion::rotation_y(0.8 + tilt * 1.0);
next.wing_in_l.scale = Vec3::one();
next.wing_in_r.position = Vec3::new(
skeleton_attr.wing_in.0,
skeleton_attr.wing_in.1,
skeleton_attr.wing_in.2,
);
next.wing_in_r.position = Vec3::new(s_a.wing_in.0, s_a.wing_in.1, s_a.wing_in.2);
next.wing_in_r.orientation = Quaternion::rotation_y(-0.8 + tilt * 1.0);
next.wing_in_r.scale = Vec3::one();
next.wing_out_l.position = Vec3::new(
-skeleton_attr.wing_out.0,
skeleton_attr.wing_out.1,
skeleton_attr.wing_out.2,
);
next.wing_out_l.position = Vec3::new(-s_a.wing_out.0, s_a.wing_out.1, s_a.wing_out.2);
next.wing_out_l.orientation = Quaternion::rotation_y(-2.0 + tilt * 1.0);
next.wing_out_l.scale = Vec3::one();
next.wing_out_r.position = Vec3::new(
skeleton_attr.wing_out.0,
skeleton_attr.wing_out.1,
skeleton_attr.wing_out.2,
);
next.wing_out_r.position = Vec3::new(s_a.wing_out.0, s_a.wing_out.1, s_a.wing_out.2);
next.wing_out_r.orientation = Quaternion::rotation_y(2.0 + tilt * 1.0);
next.wing_out_r.scale = Vec3::one();

View File

@ -20,7 +20,7 @@ impl Animation for AlphaAnimation {
(_velocity, global_time): Self::Dependency,
anim_time: f64,
_rate: &mut f32,
skeleton_attr: &SkeletonAttr,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
@ -45,147 +45,99 @@ impl Animation for AlphaAnimation {
let switch = if random > 0.5 { 1.0 } else { -1.0 };
if switch > 0.0 {
next.head.position = Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1) * 1.02;
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1) * 1.02;
next.head.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(-0.2);
next.head.scale = Vec3::one() * 1.02;
next.upper_torso.position = Vec3::new(
0.0,
skeleton_attr.upper_torso.0,
skeleton_attr.upper_torso.1,
) / 8.0;
next.upper_torso.position = Vec3::new(0.0, s_a.upper_torso.0, s_a.upper_torso.1) / 8.0;
next.upper_torso.orientation =
Quaternion::rotation_z(twist * 1.1) * Quaternion::rotation_x(0.0);
next.upper_torso.scale = Vec3::one() / 8.0;
next.lower_torso.position = Vec3::new(
0.0,
skeleton_attr.lower_torso.0,
skeleton_attr.lower_torso.1,
);
next.lower_torso.position = Vec3::new(0.0, s_a.lower_torso.0, s_a.lower_torso.1);
next.lower_torso.orientation =
Quaternion::rotation_z(twist * -1.1) * Quaternion::rotation_x(0.0);
next.lower_torso.scale = Vec3::one();
next.shoulder_l.position = Vec3::new(
-skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1,
skeleton_attr.shoulder.2,
);
next.shoulder_l.position = Vec3::new(-s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2);
next.shoulder_l.orientation = Quaternion::rotation_z(0.0) * 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.position = Vec3::new(s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2);
next.shoulder_r.orientation =
Quaternion::rotation_z(0.0) * Quaternion::rotation_x(slower * 0.4);
next.shoulder_r.scale = Vec3::one();
next.hand_l.position = Vec3::new(
-skeleton_attr.hand.0,
skeleton_attr.hand.1,
skeleton_attr.hand.2,
);
next.hand_l.position = Vec3::new(-s_a.hand.0, s_a.hand.1, s_a.hand.2);
next.hand_l.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.hand_l.scale = Vec3::one() * 1.02;
next.hand_r.position = Vec3::new(
skeleton_attr.hand.0,
skeleton_attr.hand.1,
skeleton_attr.hand.2,
);
next.hand_r.position = Vec3::new(s_a.hand.0, s_a.hand.1, s_a.hand.2);
next.hand_r.orientation =
Quaternion::rotation_z(0.0) * Quaternion::rotation_x(slower * 0.35);
next.hand_r.scale = Vec3::one() * 1.02;
} else {
next.head.position = Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1) * 1.02;
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1) * 1.02;
next.head.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(-0.2);
next.head.scale = Vec3::one() * 1.02;
next.upper_torso.position = Vec3::new(
0.0,
skeleton_attr.upper_torso.0,
skeleton_attr.upper_torso.1,
) / 8.0;
next.upper_torso.position = Vec3::new(0.0, s_a.upper_torso.0, s_a.upper_torso.1) / 8.0;
next.upper_torso.orientation =
Quaternion::rotation_z(twist * -1.1) * Quaternion::rotation_x(0.0);
next.upper_torso.scale = Vec3::one() / 8.0;
next.lower_torso.position = Vec3::new(
0.0,
skeleton_attr.lower_torso.0,
skeleton_attr.lower_torso.1,
);
next.lower_torso.position = Vec3::new(0.0, s_a.lower_torso.0, s_a.lower_torso.1);
next.lower_torso.orientation =
Quaternion::rotation_z(twist * 1.1) * Quaternion::rotation_x(0.0);
next.lower_torso.scale = Vec3::one();
next.shoulder_l.position = Vec3::new(
-skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1,
skeleton_attr.shoulder.2,
);
next.shoulder_l.position = Vec3::new(-s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2);
next.shoulder_l.orientation =
Quaternion::rotation_z(0.0) * Quaternion::rotation_x(slower * 0.4);
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.position = Vec3::new(s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2);
next.shoulder_r.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.shoulder_r.scale = Vec3::one();
next.hand_l.position = Vec3::new(
-skeleton_attr.hand.0,
skeleton_attr.hand.1,
skeleton_attr.hand.2,
);
next.hand_l.position = Vec3::new(-s_a.hand.0, s_a.hand.1, s_a.hand.2);
next.hand_l.orientation =
Quaternion::rotation_z(0.0) * Quaternion::rotation_x(slower * 0.35);
next.hand_l.scale = Vec3::one() * 1.02;
next.hand_r.position = Vec3::new(
skeleton_attr.hand.0,
skeleton_attr.hand.1,
skeleton_attr.hand.2,
);
next.hand_r.position = Vec3::new(s_a.hand.0, s_a.hand.1, s_a.hand.2);
next.hand_r.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.hand_r.scale = Vec3::one() * 1.02;
};
/*
next.leg_l.position = Vec3::new(
-skeleton_attr.leg.0,
skeleton_attr.leg.1,
skeleton_attr.leg.2,
-s_a.leg.0,
s_a.leg.1,
s_a.leg.2,
) * 1.02;
next.leg_l.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.leg_l.scale = Vec3::one() * 1.02;
next.leg_r.position = Vec3::new(
skeleton_attr.leg.0,
skeleton_attr.leg.1,
skeleton_attr.leg.2,
s_a.leg.0,
s_a.leg.1,
s_a.leg.2,
) * 1.02;
next.leg_r.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.leg_r.scale = Vec3::one() * 1.02;
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1,
skeleton_attr.foot.2,
-s_a.foot.0,
s_a.foot.1,
s_a.foot.2,
);
next.foot_l.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.foot_l.scale = Vec3::one();
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1,
skeleton_attr.foot.2,
s_a.foot.0,
s_a.foot.1,
s_a.foot.2,
);
next.foot_r.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.foot_r.scale = Vec3::one();

View File

@ -20,7 +20,7 @@ impl Animation for IdleAnimation {
global_time: Self::Dependency,
anim_time: f64,
_rate: &mut f32,
skeleton_attr: &SkeletonAttr,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
@ -40,100 +40,55 @@ impl Animation for IdleAnimation {
* 0.25,
);
next.head.position = Vec3::new(
0.0,
skeleton_attr.head.0,
skeleton_attr.head.1 + breathe * 0.2,
) * 1.02;
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1 + breathe * 0.2) * 1.02;
next.head.orientation =
Quaternion::rotation_z(look.x * 0.6) * Quaternion::rotation_x(look.y * 0.6);
next.head.scale = Vec3::one() * 1.02;
next.jaw.position = Vec3::new(
0.0,
skeleton_attr.jaw.0 - breathe * 0.12,
skeleton_attr.jaw.1 + breathe * 0.2,
) * 1.02;
next.jaw.position =
Vec3::new(0.0, s_a.jaw.0 - breathe * 0.12, s_a.jaw.1 + breathe * 0.2) * 1.02;
next.jaw.orientation = Quaternion::rotation_x(-0.1 + breathe * 0.1);
next.jaw.scale = Vec3::one() * 1.02;
next.upper_torso.position = Vec3::new(
0.0,
skeleton_attr.upper_torso.0,
skeleton_attr.upper_torso.1 + breathe * 0.5,
) / 8.0;
next.upper_torso.position =
Vec3::new(0.0, s_a.upper_torso.0, s_a.upper_torso.1 + breathe * 0.5) / 8.0;
next.upper_torso.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.upper_torso.scale = Vec3::one() / 8.0;
next.lower_torso.position = Vec3::new(
0.0,
skeleton_attr.lower_torso.0,
skeleton_attr.lower_torso.1 + breathe * -0.2,
);
next.lower_torso.position =
Vec3::new(0.0, s_a.lower_torso.0, s_a.lower_torso.1 + breathe * -0.2);
next.lower_torso.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.lower_torso.scale = Vec3::one();
next.shoulder_l.position = Vec3::new(
-skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1,
skeleton_attr.shoulder.2,
);
next.shoulder_l.position = Vec3::new(-s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2);
next.shoulder_l.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(-0.2);
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.position = Vec3::new(s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2);
next.shoulder_r.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(-0.2);
next.shoulder_r.scale = Vec3::one();
next.hand_l.position = Vec3::new(
-skeleton_attr.hand.0,
skeleton_attr.hand.1,
skeleton_attr.hand.2 + breathe * 0.6,
);
next.hand_l.position = Vec3::new(-s_a.hand.0, s_a.hand.1, s_a.hand.2 + breathe * 0.6);
next.hand_l.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.2);
next.hand_l.scale = Vec3::one() * 1.02;
next.hand_r.position = Vec3::new(
skeleton_attr.hand.0,
skeleton_attr.hand.1,
skeleton_attr.hand.2 + breathe * 0.6,
);
next.hand_r.position = Vec3::new(s_a.hand.0, s_a.hand.1, s_a.hand.2 + breathe * 0.6);
next.hand_r.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.2);
next.hand_r.scale = Vec3::one() * 1.02;
next.leg_l.position = Vec3::new(
-skeleton_attr.leg.0,
skeleton_attr.leg.1,
skeleton_attr.leg.2 + breathe * -0.2,
) * 1.02;
next.leg_l.position = Vec3::new(-s_a.leg.0, s_a.leg.1, s_a.leg.2 + breathe * -0.2) * 1.02;
next.leg_l.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.leg_l.scale = Vec3::one() * 1.02;
next.leg_r.position = Vec3::new(
skeleton_attr.leg.0,
skeleton_attr.leg.1,
skeleton_attr.leg.2 + breathe * -0.2,
) * 1.02;
next.leg_r.position = Vec3::new(s_a.leg.0, s_a.leg.1, s_a.leg.2 + breathe * -0.2) * 1.02;
next.leg_r.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.leg_r.scale = Vec3::one() * 1.02;
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1,
skeleton_attr.foot.2 + breathe * -0.2,
);
next.foot_l.position = Vec3::new(-s_a.foot.0, s_a.foot.1, s_a.foot.2 + breathe * -0.2);
next.foot_l.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.foot_l.scale = Vec3::one();
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1,
skeleton_attr.foot.2 + breathe * -0.2,
);
next.foot_r.position = Vec3::new(s_a.foot.0, s_a.foot.1, s_a.foot.2 + breathe * -0.2);
next.foot_r.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.foot_r.scale = Vec3::one();

View File

@ -18,83 +18,47 @@ impl Animation for JumpAnimation {
_global_time: Self::Dependency,
_anim_time: f64,
_rate: &mut f32,
skeleton_attr: &SkeletonAttr,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
next.head.position = Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1) * 1.02;
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1) * 1.02;
next.head.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.head.scale = Vec3::one() * 1.02;
next.upper_torso.position = Vec3::new(
0.0,
skeleton_attr.upper_torso.0,
skeleton_attr.upper_torso.1,
) / 8.0;
next.upper_torso.position = Vec3::new(0.0, s_a.upper_torso.0, s_a.upper_torso.1) / 8.0;
next.upper_torso.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.upper_torso.scale = Vec3::one() / 8.0;
next.shoulder_l.position = Vec3::new(
-skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1,
skeleton_attr.shoulder.2,
);
next.shoulder_l.position = Vec3::new(-s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2);
next.shoulder_l.orientation = Quaternion::rotation_z(0.0) * 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.position = Vec3::new(s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2);
next.shoulder_r.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.shoulder_r.scale = Vec3::one();
next.hand_l.position = Vec3::new(
-skeleton_attr.hand.0,
skeleton_attr.hand.1,
skeleton_attr.hand.2,
);
next.hand_l.position = Vec3::new(-s_a.hand.0, s_a.hand.1, s_a.hand.2);
next.hand_l.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.hand_l.scale = Vec3::one() * 1.02;
next.hand_r.position = Vec3::new(
skeleton_attr.hand.0,
skeleton_attr.hand.1,
skeleton_attr.hand.2,
);
next.hand_r.position = Vec3::new(s_a.hand.0, s_a.hand.1, s_a.hand.2);
next.hand_r.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.hand_r.scale = Vec3::one() * 1.02;
next.leg_l.position = Vec3::new(
-skeleton_attr.leg.0,
skeleton_attr.leg.1,
skeleton_attr.leg.2,
) * 1.02;
next.leg_l.position = Vec3::new(-s_a.leg.0, s_a.leg.1, s_a.leg.2) * 1.02;
next.leg_l.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.leg_l.scale = Vec3::one() * 1.02;
next.leg_r.position = Vec3::new(
skeleton_attr.leg.0,
skeleton_attr.leg.1,
skeleton_attr.leg.2,
) * 1.02;
next.leg_r.position = Vec3::new(s_a.leg.0, s_a.leg.1, s_a.leg.2) * 1.02;
next.leg_r.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.leg_r.scale = Vec3::one() * 1.02;
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1,
skeleton_attr.foot.2,
) / 8.0;
next.foot_l.position = Vec3::new(-s_a.foot.0, s_a.foot.1, s_a.foot.2) / 8.0;
next.foot_l.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.foot_l.scale = Vec3::one() / 8.0;
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1,
skeleton_attr.foot.2,
) / 8.0;
next.foot_r.position = Vec3::new(s_a.foot.0, s_a.foot.1, s_a.foot.2) / 8.0;
next.foot_r.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.foot_r.scale = Vec3::one() / 8.0;

View File

@ -20,7 +20,7 @@ impl Animation for RunAnimation {
(_velocity, orientation, last_ori, _global_time): Self::Dependency,
anim_time: f64,
_rate: &mut f32,
skeleton_attr: &SkeletonAttr,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
@ -69,85 +69,54 @@ impl Animation for RunAnimation {
} else {
0.0
} * 1.3;
next.head.position = Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1) * 1.02;
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1) * 1.02;
next.head.orientation = Quaternion::rotation_z(short * -0.3) * Quaternion::rotation_x(-0.2);
next.head.scale = Vec3::one() * 1.02;
next.jaw.position = Vec3::new(0.0, skeleton_attr.jaw.0, skeleton_attr.jaw.1) * 1.02;
next.jaw.position = Vec3::new(0.0, s_a.jaw.0, s_a.jaw.1) * 1.02;
next.jaw.scale = Vec3::one() * 1.02;
next.upper_torso.position = Vec3::new(
0.0,
skeleton_attr.upper_torso.0,
skeleton_attr.upper_torso.1 + short * 1.0,
) / 8.0;
next.upper_torso.position =
Vec3::new(0.0, s_a.upper_torso.0, s_a.upper_torso.1 + short * 1.0) / 8.0;
next.upper_torso.orientation =
Quaternion::rotation_z(tilt * -4.0 + short * 0.40) * Quaternion::rotation_x(0.0);
next.upper_torso.scale = Vec3::one() / 8.0;
next.lower_torso.position = Vec3::new(
0.0,
skeleton_attr.lower_torso.0,
skeleton_attr.lower_torso.1,
);
next.lower_torso.position = Vec3::new(0.0, s_a.lower_torso.0, s_a.lower_torso.1);
next.lower_torso.orientation = Quaternion::rotation_z(tilt * 4.0 + shortalt * 0.2);
next.lower_torso.scale = Vec3::one();
next.shoulder_l.position = Vec3::new(
-skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1,
skeleton_attr.shoulder.2,
);
next.shoulder_l.position = Vec3::new(-s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2);
next.shoulder_l.orientation = Quaternion::rotation_z(footrotl * 0.07)
* Quaternion::rotation_y(0.15)
* Quaternion::rotation_x(footrotl * -0.25);
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.position = Vec3::new(s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2);
next.shoulder_r.orientation = Quaternion::rotation_z(footrotr * -0.07)
* Quaternion::rotation_y(-0.15)
* Quaternion::rotation_x(footrotr * -0.25);
next.shoulder_r.scale = Vec3::one();
next.hand_l.position = Vec3::new(
-skeleton_attr.hand.0,
skeleton_attr.hand.1,
skeleton_attr.hand.2,
);
next.hand_l.position = Vec3::new(-s_a.hand.0, s_a.hand.1, s_a.hand.2);
next.hand_l.orientation = Quaternion::rotation_x(0.3 + footrotl * -0.06)
* Quaternion::rotation_y(0.1)
* Quaternion::rotation_z(-0.35 + footrotl * -0.1);
next.hand_l.scale = Vec3::one() * 1.02;
next.hand_r.position = Vec3::new(
skeleton_attr.hand.0,
skeleton_attr.hand.1,
skeleton_attr.hand.2,
);
next.hand_r.position = Vec3::new(s_a.hand.0, s_a.hand.1, s_a.hand.2);
next.hand_r.orientation = Quaternion::rotation_x(0.3 + footrotr * -0.06)
* Quaternion::rotation_y(-0.1)
* Quaternion::rotation_z(0.35 + footrotr * 0.1);
next.hand_r.scale = Vec3::one() * 1.02;
next.leg_l.position = Vec3::new(
-skeleton_attr.leg.0,
skeleton_attr.leg.1,
skeleton_attr.leg.2,
) * 1.02;
next.leg_l.position = Vec3::new(-s_a.leg.0, s_a.leg.1, s_a.leg.2) * 1.02;
next.leg_l.orientation = Quaternion::rotation_x(footrotl * 0.3)
* Quaternion::rotation_y(0.1)
* Quaternion::rotation_z(footrotl * -0.2);
next.leg_l.scale = Vec3::one() * 1.02;
next.leg_r.position = Vec3::new(
skeleton_attr.leg.0,
skeleton_attr.leg.1,
skeleton_attr.leg.2,
) * 1.02;
next.leg_r.position = Vec3::new(s_a.leg.0, s_a.leg.1, s_a.leg.2) * 1.02;
next.leg_r.orientation = Quaternion::rotation_x(footrotr * 0.3)
* Quaternion::rotation_y(-0.1)
@ -155,18 +124,18 @@ impl Animation for RunAnimation {
next.leg_r.scale = Vec3::one() * 1.02;
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1 + foothoril * 2.0,
skeleton_attr.foot.2 + (footvertl * 3.0).max(0.0),
-s_a.foot.0,
s_a.foot.1 + foothoril * 2.0,
s_a.foot.2 + (footvertl * 3.0).max(0.0),
);
next.foot_l.orientation =
Quaternion::rotation_x(footrotl * 0.2) * Quaternion::rotation_y(-0.08);
next.foot_l.scale = Vec3::one() * 0.98;
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1 + foothorir * 2.0,
skeleton_attr.foot.2 + (footvertr * 3.0).max(0.0),
s_a.foot.0,
s_a.foot.1 + foothorir * 2.0,
s_a.foot.2 + (footvertr * 3.0).max(0.0),
);
next.foot_r.orientation = Quaternion::rotation_z(0.0)
* Quaternion::rotation_x(footrotr * 0.2)

View File

@ -20,7 +20,7 @@ impl Animation for ShockwaveAnimation {
(velocity, _global_time): Self::Dependency,
anim_time: f64,
_rate: &mut f32,
skeleton_attr: &SkeletonAttr,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
@ -35,93 +35,83 @@ impl Animation for ShockwaveAnimation {
.sqrt())
* ((anim_time as f32 * lab as f32 * 2.0 - 0.5 * PI).sin())
+ 1.0;
next.head.position = Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1) * 1.02;
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1) * 1.02;
next.head.orientation =
Quaternion::rotation_z((-twist * 2.0).max(-PI)) * Quaternion::rotation_x(0.0);
next.head.scale = Vec3::one() * 1.02;
next.upper_torso.position = Vec3::new(
0.0,
skeleton_attr.upper_torso.0,
skeleton_attr.upper_torso.1 + slower * -3.0 + breathe * 1.0,
s_a.upper_torso.0,
s_a.upper_torso.1 + slower * -3.0 + breathe * 1.0,
) / 8.0;
next.upper_torso.orientation =
Quaternion::rotation_z((twist * 2.0).min(PI)) * Quaternion::rotation_x(0.0);
next.upper_torso.scale = Vec3::one() / 8.0;
next.lower_torso.position = Vec3::new(
0.0,
skeleton_attr.lower_torso.0,
skeleton_attr.lower_torso.1 + slower * 1.0,
);
next.lower_torso.position =
Vec3::new(0.0, s_a.lower_torso.0, s_a.lower_torso.1 + slower * 1.0);
next.lower_torso.orientation =
Quaternion::rotation_z((-twist * 2.0).max(-PI)) * Quaternion::rotation_x(0.0);
next.lower_torso.scale = Vec3::one();
next.shoulder_l.position = Vec3::new(
-skeleton_attr.shoulder.0 - 2.0,
skeleton_attr.shoulder.1,
skeleton_attr.shoulder.2 - slower * 1.0,
-s_a.shoulder.0 - 2.0,
s_a.shoulder.1,
s_a.shoulder.2 - slower * 1.0,
);
next.shoulder_l.orientation =
Quaternion::rotation_z(0.0) * Quaternion::rotation_y(0.6 + slower * -0.3);
next.shoulder_l.scale = Vec3::one();
next.shoulder_r.position = Vec3::new(
skeleton_attr.shoulder.0 + 2.0,
skeleton_attr.shoulder.1,
skeleton_attr.shoulder.2 - slower * 1.0,
s_a.shoulder.0 + 2.0,
s_a.shoulder.1,
s_a.shoulder.2 - slower * 1.0,
);
next.shoulder_r.orientation =
Quaternion::rotation_z(0.0) * Quaternion::rotation_y(-0.6 + slower * 0.3);
next.shoulder_r.scale = Vec3::one();
next.hand_l.position = Vec3::new(
-skeleton_attr.hand.0 - 1.0,
skeleton_attr.hand.1,
skeleton_attr.hand.2 - slower * 0.5 + breathe * -1.0,
-s_a.hand.0 - 1.0,
s_a.hand.1,
s_a.hand.2 - slower * 0.5 + breathe * -1.0,
);
next.hand_l.orientation =
Quaternion::rotation_z(0.0) * Quaternion::rotation_y(-0.6 + slower * 0.3);
next.hand_l.scale = Vec3::one() * 1.02;
next.hand_r.position = Vec3::new(
skeleton_attr.hand.0 + 1.0,
skeleton_attr.hand.1,
skeleton_attr.hand.2 - slower * 0.5 + breathe * -1.0,
s_a.hand.0 + 1.0,
s_a.hand.1,
s_a.hand.2 - slower * 0.5 + breathe * -1.0,
);
next.hand_r.orientation =
Quaternion::rotation_z(0.0) * Quaternion::rotation_y(0.6 + slower * -0.3);
next.hand_r.scale = Vec3::one() * 1.02;
if velocity < 0.5 {
next.leg_l.position = Vec3::new(
-skeleton_attr.leg.0,
skeleton_attr.leg.1,
skeleton_attr.leg.2 + slower * -0.5,
) * 1.02;
next.leg_l.position =
Vec3::new(-s_a.leg.0, s_a.leg.1, s_a.leg.2 + slower * -0.5) * 1.02;
next.leg_l.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.leg_l.scale = Vec3::one() * 1.02;
next.leg_r.position = Vec3::new(
skeleton_attr.leg.0,
skeleton_attr.leg.1,
skeleton_attr.leg.2 + slower * -0.5,
) * 1.02;
next.leg_r.position = Vec3::new(s_a.leg.0, s_a.leg.1, s_a.leg.2 + slower * -0.5) * 1.02;
next.leg_r.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.leg_r.scale = Vec3::one() * 1.02;
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1,
skeleton_attr.foot.2 + slower * 2.5 + breathe * -1.0,
-s_a.foot.0,
s_a.foot.1,
s_a.foot.2 + slower * 2.5 + breathe * -1.0,
);
next.foot_l.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.foot_l.scale = Vec3::one();
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1,
skeleton_attr.foot.2 + slower * 2.5 + breathe * -1.0,
s_a.foot.0,
s_a.foot.1,
s_a.foot.2 + slower * 2.5 + breathe * -1.0,
);
next.foot_r.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.foot_r.scale = Vec3::one();

View File

@ -19,7 +19,7 @@ impl Animation for AlphaAnimation {
(velocity, _global_time): Self::Dependency,
anim_time: f64,
_rate: &mut f32,
skeleton_attr: &SkeletonAttr,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
@ -31,71 +31,49 @@ impl Animation for AlphaAnimation {
/ (0.001 + 0.9999 * ((anim_time as f32 * 7.0 + PI * 0.0).sin()).powf(2.0 as f32)))
.sqrt())
* ((anim_time as f32 * 7.0 + PI * 0.0).sin());
next.head_upper.position =
Vec3::new(0.0, skeleton_attr.head_upper.0, skeleton_attr.head_upper.1);
next.head_upper.position = Vec3::new(0.0, s_a.head_upper.0, s_a.head_upper.1);
next.head_upper.orientation =
Quaternion::rotation_z(short * 0.3) * Quaternion::rotation_x(0.0);
next.head_upper.scale = Vec3::one();
next.head_lower.position =
Vec3::new(0.0, skeleton_attr.head_lower.0, skeleton_attr.head_lower.1);
next.head_lower.position = Vec3::new(0.0, s_a.head_lower.0, s_a.head_lower.1);
next.head_lower.orientation =
Quaternion::rotation_z(short * 0.2) * Quaternion::rotation_y(short * -0.4);
next.head_lower.scale = Vec3::one();
next.jaw.position = Vec3::new(0.0, skeleton_attr.jaw.0, skeleton_attr.jaw.1);
next.jaw.position = Vec3::new(0.0, s_a.jaw.0, s_a.jaw.1);
next.jaw.orientation = Quaternion::rotation_x(-0.2 + quick * 0.3);
next.jaw.scale = Vec3::one() * 0.98;
next.chest.position = Vec3::new(0.0, skeleton_attr.chest.0, skeleton_attr.chest.1)
* skeleton_attr.scaler
/ 11.0;
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1) * s_a.scaler / 11.0;
next.chest.orientation = Quaternion::rotation_y(short * -0.07);
next.chest.scale = Vec3::one() * skeleton_attr.scaler / 11.0;
next.chest.scale = Vec3::one() * s_a.scaler / 11.0;
next.tail_front.position =
Vec3::new(0.0, skeleton_attr.tail_front.0, skeleton_attr.tail_front.1);
next.tail_front.position = Vec3::new(0.0, s_a.tail_front.0, s_a.tail_front.1);
next.tail_front.orientation = Quaternion::rotation_x(0.15)
* Quaternion::rotation_y(short * 0.2)
* Quaternion::rotation_z(short * 0.3);
next.tail_front.scale = Vec3::one() * 0.98;
next.tail_rear.position =
Vec3::new(0.0, skeleton_attr.tail_rear.0, skeleton_attr.tail_rear.1);
next.tail_rear.position = Vec3::new(0.0, s_a.tail_rear.0, s_a.tail_rear.1);
next.tail_rear.orientation = Quaternion::rotation_y(short * 0.5)
* Quaternion::rotation_x(-0.12)
* Quaternion::rotation_z(short * 0.3);
next.tail_rear.scale = Vec3::one() * 0.98;
if velocity < 1.0 {
next.foot_fl.position = Vec3::new(
-skeleton_attr.feet_f.0,
skeleton_attr.feet_f.1,
skeleton_attr.feet_f.2,
);
next.foot_fl.position = Vec3::new(-s_a.feet_f.0, s_a.feet_f.1, s_a.feet_f.2);
next.foot_fl.orientation = Quaternion::rotation_y(short * 0.12);
next.foot_fl.scale = Vec3::one();
next.foot_fr.position = Vec3::new(
skeleton_attr.feet_f.0,
skeleton_attr.feet_f.1,
skeleton_attr.feet_f.2,
);
next.foot_fr.position = Vec3::new(s_a.feet_f.0, s_a.feet_f.1, s_a.feet_f.2);
next.foot_fr.orientation = Quaternion::rotation_y(short * 0.12);
next.foot_fr.scale = Vec3::one();
next.foot_bl.position = Vec3::new(
-skeleton_attr.feet_b.0,
skeleton_attr.feet_b.1,
skeleton_attr.feet_b.2,
);
next.foot_bl.position = Vec3::new(-s_a.feet_b.0, s_a.feet_b.1, s_a.feet_b.2);
next.foot_bl.orientation = Quaternion::rotation_y(short * 0.12);
next.foot_bl.scale = Vec3::one();
next.foot_br.position = Vec3::new(
skeleton_attr.feet_b.0,
skeleton_attr.feet_b.1,
skeleton_attr.feet_b.2,
);
next.foot_br.position = Vec3::new(s_a.feet_b.0, s_a.feet_b.1, s_a.feet_b.2);
next.foot_br.orientation = Quaternion::rotation_y(short * 0.12);
next.foot_br.scale = Vec3::one();
} else {

View File

@ -19,7 +19,7 @@ impl Animation for IdleAnimation {
global_time: Self::Dependency,
anim_time: f64,
_rate: &mut f32,
skeleton_attr: &SkeletonAttr,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
@ -40,75 +40,49 @@ impl Animation for IdleAnimation {
* 0.1,
);
next.head_upper.position = Vec3::new(
0.0,
skeleton_attr.head_upper.0,
skeleton_attr.head_upper.1 + slower * 0.20,
);
next.head_upper.position =
Vec3::new(0.0, s_a.head_upper.0, s_a.head_upper.1 + slower * 0.20);
next.head_upper.orientation = Quaternion::rotation_z(0.8 * dragon_look.x)
* Quaternion::rotation_x(0.8 * dragon_look.y);
next.head_upper.scale = Vec3::one();
next.head_lower.position = Vec3::new(
0.0,
skeleton_attr.head_lower.0,
skeleton_attr.head_lower.1 + slower * 0.20,
);
next.head_lower.position =
Vec3::new(0.0, s_a.head_lower.0, s_a.head_lower.1 + slower * 0.20);
next.head_lower.orientation = Quaternion::rotation_z(0.8 * dragon_look.x)
* Quaternion::rotation_x(0.8 * dragon_look.y);
next.head_lower.scale = Vec3::one();
next.jaw.position = Vec3::new(0.0, skeleton_attr.jaw.0, skeleton_attr.jaw.1);
next.jaw.position = Vec3::new(0.0, s_a.jaw.0, s_a.jaw.1);
next.jaw.orientation = Quaternion::rotation_x(slow * 0.04);
next.jaw.scale = Vec3::one() * 0.98;
next.chest.position = Vec3::new(0.0, skeleton_attr.chest.0, skeleton_attr.chest.1)
* skeleton_attr.scaler
/ 11.0;
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1) * s_a.scaler / 11.0;
next.chest.orientation = Quaternion::rotation_y(slow * 0.03);
next.chest.scale = Vec3::one() * skeleton_attr.scaler / 11.0;
next.chest.scale = Vec3::one() * s_a.scaler / 11.0;
next.tail_front.position =
Vec3::new(0.0, skeleton_attr.tail_front.0, skeleton_attr.tail_front.1);
next.tail_front.position = Vec3::new(0.0, s_a.tail_front.0, s_a.tail_front.1);
next.tail_front.orientation =
Quaternion::rotation_x(0.15) * Quaternion::rotation_z(slowalt * 0.12);
next.tail_front.scale = Vec3::one() * 0.98;
next.tail_rear.position =
Vec3::new(0.0, skeleton_attr.tail_rear.0, skeleton_attr.tail_rear.1);
next.tail_rear.position = Vec3::new(0.0, s_a.tail_rear.0, s_a.tail_rear.1);
next.tail_rear.orientation =
Quaternion::rotation_z(slowalt * 0.12) * Quaternion::rotation_x(-0.12);
next.tail_rear.scale = Vec3::one() * 0.98;
next.foot_fl.position = Vec3::new(
-skeleton_attr.feet_f.0,
skeleton_attr.feet_f.1,
skeleton_attr.feet_f.2,
);
next.foot_fl.position = Vec3::new(-s_a.feet_f.0, s_a.feet_f.1, s_a.feet_f.2);
next.foot_fl.orientation = Quaternion::rotation_y(slow * -0.05);
next.foot_fl.scale = Vec3::one();
next.foot_fr.position = Vec3::new(
skeleton_attr.feet_f.0,
skeleton_attr.feet_f.1,
skeleton_attr.feet_f.2,
);
next.foot_fr.position = Vec3::new(s_a.feet_f.0, s_a.feet_f.1, s_a.feet_f.2);
next.foot_fr.orientation = Quaternion::rotation_y(slow * -0.05);
next.foot_fr.scale = Vec3::one();
next.foot_bl.position = Vec3::new(
-skeleton_attr.feet_b.0,
skeleton_attr.feet_b.1,
skeleton_attr.feet_b.2,
);
next.foot_bl.position = Vec3::new(-s_a.feet_b.0, s_a.feet_b.1, s_a.feet_b.2);
next.foot_bl.orientation = Quaternion::rotation_y(slow * -0.05);
next.foot_bl.scale = Vec3::one();
next.foot_br.position = Vec3::new(
skeleton_attr.feet_b.0,
skeleton_attr.feet_b.1,
skeleton_attr.feet_b.2,
);
next.foot_br.position = Vec3::new(s_a.feet_b.0, s_a.feet_b.1, s_a.feet_b.2);
next.foot_br.orientation = Quaternion::rotation_y(slow * -0.05);
next.foot_br.scale = Vec3::one();

View File

@ -18,69 +18,47 @@ impl Animation for JumpAnimation {
_global_time: Self::Dependency,
_anim_time: f64,
_rate: &mut f32,
skeleton_attr: &SkeletonAttr,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
next.head_upper.position =
Vec3::new(0.0, skeleton_attr.head_upper.0, skeleton_attr.head_upper.1);
next.head_upper.position = Vec3::new(0.0, s_a.head_upper.0, s_a.head_upper.1);
next.head_upper.orientation = Quaternion::rotation_z(0.4) * Quaternion::rotation_x(0.0);
next.head_upper.scale = Vec3::one();
next.head_lower.position =
Vec3::new(0.0, skeleton_attr.head_lower.0, skeleton_attr.head_lower.1);
next.head_lower.position = Vec3::new(0.0, s_a.head_lower.0, s_a.head_lower.1);
next.head_lower.orientation = Quaternion::rotation_z(0.2);
next.head_lower.scale = Vec3::one();
next.jaw.position = Vec3::new(0.0, skeleton_attr.jaw.0, skeleton_attr.jaw.1);
next.jaw.position = Vec3::new(0.0, s_a.jaw.0, s_a.jaw.1);
next.jaw.orientation = Quaternion::rotation_x(-0.3);
next.jaw.scale = Vec3::one() * 0.98;
next.chest.position = Vec3::new(0.0, skeleton_attr.chest.0, skeleton_attr.chest.1)
* skeleton_attr.scaler
/ 11.0;
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1) * s_a.scaler / 11.0;
next.chest.orientation = Quaternion::rotation_y(0.0);
next.chest.scale = Vec3::one() * skeleton_attr.scaler / 11.0;
next.chest.scale = Vec3::one() * s_a.scaler / 11.0;
next.tail_front.position =
Vec3::new(0.0, skeleton_attr.tail_front.0, skeleton_attr.tail_front.1);
next.tail_front.position = Vec3::new(0.0, s_a.tail_front.0, s_a.tail_front.1);
next.tail_front.orientation = Quaternion::rotation_x(0.15) * Quaternion::rotation_z(-0.2);
next.tail_front.scale = Vec3::one() * 0.98;
next.tail_rear.position =
Vec3::new(0.0, skeleton_attr.tail_rear.0, skeleton_attr.tail_rear.1);
next.tail_rear.position = Vec3::new(0.0, s_a.tail_rear.0, s_a.tail_rear.1);
next.tail_rear.orientation = Quaternion::rotation_z(-0.4) * Quaternion::rotation_x(-0.12);
next.tail_rear.scale = Vec3::one() * 0.98;
next.foot_fl.position = Vec3::new(
-skeleton_attr.feet_f.0,
skeleton_attr.feet_f.1,
skeleton_attr.feet_f.2,
);
next.foot_fl.position = Vec3::new(-s_a.feet_f.0, s_a.feet_f.1, s_a.feet_f.2);
next.foot_fl.orientation = Quaternion::rotation_z(0.3);
next.foot_fl.scale = Vec3::one();
next.foot_fr.position = Vec3::new(
skeleton_attr.feet_f.0,
skeleton_attr.feet_f.1,
skeleton_attr.feet_f.2,
);
next.foot_fr.position = Vec3::new(s_a.feet_f.0, s_a.feet_f.1, s_a.feet_f.2);
next.foot_fr.orientation = Quaternion::rotation_z(0.3);
next.foot_fr.scale = Vec3::one();
next.foot_bl.position = Vec3::new(
-skeleton_attr.feet_b.0,
skeleton_attr.feet_b.1,
skeleton_attr.feet_b.2,
);
next.foot_bl.position = Vec3::new(-s_a.feet_b.0, s_a.feet_b.1, s_a.feet_b.2);
next.foot_bl.orientation = Quaternion::rotation_y(0.0);
next.foot_bl.scale = Vec3::one();
next.foot_br.position = Vec3::new(
skeleton_attr.feet_b.0,
skeleton_attr.feet_b.1,
skeleton_attr.feet_b.2,
);
next.foot_br.position = Vec3::new(s_a.feet_b.0, s_a.feet_b.1, s_a.feet_b.2);
next.foot_br.orientation = Quaternion::rotation_y(0.0);
next.foot_br.scale = Vec3::one();

View File

@ -19,11 +19,11 @@ impl Animation for RunAnimation {
(_velocity, orientation, last_ori, _global_time, avg_vel): Self::Dependency,
anim_time: f64,
_rate: &mut f32,
skeleton_attr: &SkeletonAttr,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let lab = 0.7 * skeleton_attr.tempo;
let lab = 0.7 * s_a.tempo;
let x_tilt = avg_vel.z.atan2(avg_vel.xy().magnitude()).max(-0.7);
let short = (((1.0)
@ -85,96 +85,86 @@ impl Animation for RunAnimation {
} else {
0.0
} * 1.3;
next.head_upper.position =
Vec3::new(0.0, skeleton_attr.head_upper.0, skeleton_attr.head_upper.1);
next.head_upper.orientation = Quaternion::rotation_x(-skeleton_attr.lean.0 + x_tilt * -1.0)
next.head_upper.position = Vec3::new(0.0, s_a.head_upper.0, s_a.head_upper.1);
next.head_upper.orientation = Quaternion::rotation_x(-s_a.lean.0 + x_tilt * -1.0)
* Quaternion::rotation_y(tilt * 0.3)
* Quaternion::rotation_z(short * -0.06 + tilt * -1.5);
next.head_upper.scale = Vec3::one();
next.head_lower.position =
Vec3::new(0.0, skeleton_attr.head_lower.0, skeleton_attr.head_lower.1);
next.head_lower.position = Vec3::new(0.0, s_a.head_lower.0, s_a.head_lower.1);
next.head_lower.orientation = Quaternion::rotation_y(tilt * 1.0)
* Quaternion::rotation_z(short * -0.15 + tilt * -0.8)
* Quaternion::rotation_x(x_tilt * 0.4);
next.head_lower.scale = Vec3::one();
next.jaw.position = Vec3::new(0.0, skeleton_attr.jaw.0, skeleton_attr.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.scale = Vec3::one() * 0.98;
next.tail_front.position = Vec3::new(
0.0,
skeleton_attr.tail_front.0 + skeleton_attr.lean.0 * 2.0,
skeleton_attr.tail_front.1 + skeleton_attr.lean.0 * 2.0,
s_a.tail_front.0 + s_a.lean.0 * 2.0,
s_a.tail_front.1 + s_a.lean.0 * 2.0,
);
next.tail_front.orientation =
Quaternion::rotation_z(shortalt * 0.18 * skeleton_attr.lean.1 + tilt * 1.8)
Quaternion::rotation_z(shortalt * 0.18 * s_a.lean.1 + tilt * 1.8)
* Quaternion::rotation_y(shortalt * 0.1)
* Quaternion::rotation_x(0.06 - skeleton_attr.lean.0 * 1.2 + x_tilt * 0.2);
* Quaternion::rotation_x(0.06 - s_a.lean.0 * 1.2 + x_tilt * 0.2);
next.tail_front.scale = Vec3::one();
next.tail_rear.position = Vec3::new(
0.0,
skeleton_attr.tail_rear.0,
skeleton_attr.tail_rear.1 + shortalt * 0.6,
);
next.tail_rear.position = Vec3::new(0.0, s_a.tail_rear.0, s_a.tail_rear.1 + shortalt * 0.6);
next.tail_rear.orientation =
Quaternion::rotation_z(shortalt * 0.25 * skeleton_attr.lean.1 + tilt * 1.6)
Quaternion::rotation_z(shortalt * 0.25 * s_a.lean.1 + tilt * 1.6)
* Quaternion::rotation_y(shortalt * 0.1)
* Quaternion::rotation_x(-0.04 + x_tilt * 0.5);
next.tail_rear.scale = Vec3::one();
next.chest.position = Vec3::new(0.0, skeleton_attr.chest.0, skeleton_attr.chest.1)
* skeleton_attr.scaler
/ 11.0;
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1) * s_a.scaler / 11.0;
next.chest.orientation = Quaternion::rotation_z(short * 0.13 + tilt * -1.9)
* Quaternion::rotation_y(short * 0.12 + tilt * 0.7)
* Quaternion::rotation_x(x_tilt + skeleton_attr.lean.0);
next.chest.scale = Vec3::one() * skeleton_attr.scaler / 11.0;
* Quaternion::rotation_x(x_tilt + s_a.lean.0);
next.chest.scale = Vec3::one() * s_a.scaler / 11.0;
next.foot_fl.position = Vec3::new(
-skeleton_attr.feet_f.0,
skeleton_attr.feet_f.1 + foothoril * -2.0,
skeleton_attr.feet_f.2 + 1.0 + ((footvertl * -1.8).max(-0.0)),
-s_a.feet_f.0,
s_a.feet_f.1 + foothoril * -2.0,
s_a.feet_f.2 + 1.0 + ((footvertl * -1.8).max(-0.0)),
);
next.foot_fl.orientation = Quaternion::rotation_x(
-0.2 + footvertl * -0.45 * skeleton_attr.lean.1 - skeleton_attr.lean.0,
) * Quaternion::rotation_y(tilt * -1.0)
* Quaternion::rotation_z(foothoril * 0.4 * skeleton_attr.lean.1 + tilt * -2.0);
next.foot_fl.orientation =
Quaternion::rotation_x(-0.2 + footvertl * -0.45 * s_a.lean.1 - s_a.lean.0)
* Quaternion::rotation_y(tilt * -1.0)
* Quaternion::rotation_z(foothoril * 0.4 * s_a.lean.1 + tilt * -2.0);
next.foot_fl.scale = Vec3::one();
next.foot_fr.position = Vec3::new(
skeleton_attr.feet_f.0,
skeleton_attr.feet_f.1 + foothorir * -2.0,
skeleton_attr.feet_f.2 + 1.0 + ((footvertr * -1.8).max(-0.0)),
s_a.feet_f.0,
s_a.feet_f.1 + foothorir * -2.0,
s_a.feet_f.2 + 1.0 + ((footvertr * -1.8).max(-0.0)),
);
next.foot_fr.orientation = Quaternion::rotation_x(
-0.2 + footvertr * -0.45 * skeleton_attr.lean.1 - skeleton_attr.lean.0,
) * Quaternion::rotation_y(tilt * -1.0)
* Quaternion::rotation_z(foothorir * -0.4 * skeleton_attr.lean.1 + tilt * -2.0);
next.foot_fr.orientation =
Quaternion::rotation_x(-0.2 + footvertr * -0.45 * s_a.lean.1 - s_a.lean.0)
* Quaternion::rotation_y(tilt * -1.0)
* Quaternion::rotation_z(foothorir * -0.4 * s_a.lean.1 + tilt * -2.0);
next.foot_fr.scale = Vec3::one();
next.foot_bl.position = Vec3::new(
-skeleton_attr.feet_b.0,
skeleton_attr.feet_b.1 + foothorilb * -1.0,
skeleton_attr.feet_b.2 + ((footvertlb * -1.2).max(-0.0)),
-s_a.feet_b.0,
s_a.feet_b.1 + foothorilb * -1.0,
s_a.feet_b.2 + ((footvertlb * -1.2).max(-0.0)),
);
next.foot_bl.orientation =
Quaternion::rotation_x(-0.2 + footvertlb * -0.5 - skeleton_attr.lean.0)
* Quaternion::rotation_y(tilt * -1.0)
* Quaternion::rotation_z(foothorilb * 0.4 + tilt * -2.0);
next.foot_bl.orientation = Quaternion::rotation_x(-0.2 + footvertlb * -0.5 - s_a.lean.0)
* Quaternion::rotation_y(tilt * -1.0)
* Quaternion::rotation_z(foothorilb * 0.4 + tilt * -2.0);
next.foot_bl.scale = Vec3::one();
next.foot_br.position = Vec3::new(
skeleton_attr.feet_b.0,
skeleton_attr.feet_b.1 + foothorirb * -1.0,
skeleton_attr.feet_b.2 + ((footvertrb * -1.2).max(-0.0)),
s_a.feet_b.0,
s_a.feet_b.1 + foothorirb * -1.0,
s_a.feet_b.2 + ((footvertrb * -1.2).max(-0.0)),
);
next.foot_br.orientation =
Quaternion::rotation_x(-0.2 + footvertrb * -0.5 - skeleton_attr.lean.0)
* Quaternion::rotation_y(tilt * -1.0)
* Quaternion::rotation_z(foothorirb * -0.4 + tilt * -2.0);
next.foot_br.orientation = Quaternion::rotation_x(-0.2 + footvertrb * -0.5 - s_a.lean.0)
* Quaternion::rotation_y(tilt * -1.0)
* Quaternion::rotation_z(foothorirb * -0.4 + tilt * -2.0);
next.foot_br.scale = Vec3::one();
next

View File

@ -19,7 +19,7 @@ impl Animation for AlphaAnimation {
(velocity, _global_time): Self::Dependency,
anim_time: f64,
_rate: &mut f32,
skeleton_attr: &SkeletonAttr,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
@ -32,111 +32,80 @@ impl Animation for AlphaAnimation {
.sqrt())
* ((anim_time as f32 * 4.0 + PI * 0.5).sin());
next.head.position = Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1);
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
next.head.orientation =
Quaternion::rotation_y(short * -0.2) * Quaternion::rotation_x(0.1 + short * 0.2);
next.head.scale = Vec3::one();
next.neck.position = Vec3::new(0.0, skeleton_attr.neck.0, skeleton_attr.neck.1);
next.neck.position = Vec3::new(0.0, s_a.neck.0, s_a.neck.1);
next.neck.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.neck.scale = Vec3::one() * 1.02;
next.jaw.position = Vec3::new(0.0, skeleton_attr.jaw.0, skeleton_attr.jaw.1);
next.jaw.position = Vec3::new(0.0, s_a.jaw.0, s_a.jaw.1);
next.jaw.orientation = Quaternion::rotation_x(-0.3 + quick * 0.4);
next.jaw.scale = Vec3::one() * 1.02;
next.tail.position = Vec3::new(0.0, skeleton_attr.tail.0, skeleton_attr.tail.1);
next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1);
next.tail.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.tail.scale = Vec3::one();
next.torso_front.position = Vec3::new(
0.0,
skeleton_attr.torso_front.0 + short * 2.8,
skeleton_attr.torso_front.1 + short * 1.0,
) * skeleton_attr.scaler
s_a.torso_front.0 + short * 2.8,
s_a.torso_front.1 + short * 1.0,
) * s_a.scaler
/ 11.0;
next.torso_front.orientation = Quaternion::rotation_y(short * -0.1);
next.torso_front.scale = Vec3::one() * skeleton_attr.scaler / 11.0;
next.torso_front.scale = Vec3::one() * s_a.scaler / 11.0;
next.torso_back.position =
Vec3::new(0.0, skeleton_attr.torso_back.0, skeleton_attr.torso_back.1);
next.torso_back.position = Vec3::new(0.0, s_a.torso_back.0, s_a.torso_back.1);
next.torso_back.orientation = Quaternion::rotation_y(short * -0.1)
* Quaternion::rotation_z(0.0)
* Quaternion::rotation_x(0.0);
next.torso_back.scale = Vec3::one();
next.ears.position = Vec3::new(0.0, skeleton_attr.ears.0, skeleton_attr.ears.1);
next.ears.position = Vec3::new(0.0, s_a.ears.0, s_a.ears.1);
next.ears.orientation = Quaternion::rotation_x(0.0);
next.ears.scale = Vec3::one() * 1.02;
if velocity < 1.0 {
next.leg_fl.position = Vec3::new(
-skeleton_attr.leg_f.0,
skeleton_attr.leg_f.1,
skeleton_attr.leg_f.2,
);
next.leg_fl.position = Vec3::new(-s_a.leg_f.0, s_a.leg_f.1, s_a.leg_f.2);
next.leg_fl.orientation =
Quaternion::rotation_x(short * -0.1) * Quaternion::rotation_y(short * 0.15);
next.leg_fl.scale = Vec3::one();
next.leg_fr.position = Vec3::new(
skeleton_attr.leg_f.0,
skeleton_attr.leg_f.1,
skeleton_attr.leg_f.2,
);
next.leg_fr.position = Vec3::new(s_a.leg_f.0, s_a.leg_f.1, s_a.leg_f.2);
next.leg_fr.orientation =
Quaternion::rotation_x(short * 0.3) * Quaternion::rotation_y(short * -0.2);
next.leg_fr.scale = Vec3::one();
next.leg_bl.position = Vec3::new(
-skeleton_attr.leg_b.0,
skeleton_attr.leg_b.1,
skeleton_attr.leg_b.2 + 1.0,
);
next.leg_bl.position = Vec3::new(-s_a.leg_b.0, s_a.leg_b.1, s_a.leg_b.2 + 1.0);
next.leg_bl.orientation =
Quaternion::rotation_x(-0.1 + short * -0.2) * Quaternion::rotation_y(short * 0.2);
next.leg_bl.scale = Vec3::one();
next.leg_br.position = Vec3::new(
skeleton_attr.leg_b.0,
skeleton_attr.leg_b.1,
skeleton_attr.leg_b.2 + 1.0,
);
next.leg_br.position = Vec3::new(s_a.leg_b.0, s_a.leg_b.1, s_a.leg_b.2 + 1.0);
next.leg_br.orientation = Quaternion::rotation_x(-0.1 + short * -0.2)
* Quaternion::rotation_y(0.1 + short * 0.2);
next.leg_br.scale = Vec3::one();
next.foot_fl.position = Vec3::new(
-skeleton_attr.feet_f.0,
skeleton_attr.feet_f.1,
skeleton_attr.feet_f.2 + short * -0.2,
);
next.foot_fl.position =
Vec3::new(-s_a.feet_f.0, s_a.feet_f.1, s_a.feet_f.2 + short * -0.2);
next.foot_fl.orientation = Quaternion::rotation_x(short * -0.05);
next.foot_fl.scale = Vec3::one();
next.foot_fr.position = Vec3::new(
skeleton_attr.feet_f.0,
skeleton_attr.feet_f.1,
skeleton_attr.feet_f.2,
);
next.foot_fr.position = Vec3::new(s_a.feet_f.0, s_a.feet_f.1, s_a.feet_f.2);
next.foot_fr.orientation =
Quaternion::rotation_x(short * -0.4) * Quaternion::rotation_y(short * 0.15);
next.foot_fr.scale = Vec3::one();
next.foot_bl.position = Vec3::new(
-skeleton_attr.feet_b.0,
skeleton_attr.feet_b.1,
skeleton_attr.feet_b.2 + short * -0.8,
);
next.foot_bl.position =
Vec3::new(-s_a.feet_b.0, s_a.feet_b.1, s_a.feet_b.2 + short * -0.8);
next.foot_bl.orientation =
Quaternion::rotation_x(-0.2 + short * 0.2) * Quaternion::rotation_y(short * 0.15);
next.foot_bl.scale = Vec3::one();
next.foot_br.position = Vec3::new(
skeleton_attr.feet_b.0,
skeleton_attr.feet_b.1,
skeleton_attr.feet_b.2,
);
next.foot_br.position = Vec3::new(s_a.feet_b.0, s_a.feet_b.1, s_a.feet_b.2);
next.foot_br.orientation =
Quaternion::rotation_x(-0.2 + short * 0.2) * Quaternion::rotation_y(short * 0.15);
next.foot_br.scale = Vec3::one();

View File

@ -19,7 +19,7 @@ impl Animation for FeedAnimation {
global_time: Self::Dependency,
anim_time: f64,
_rate: &mut f32,
skeleton_attr: &SkeletonAttr,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
@ -55,150 +55,101 @@ impl Animation for FeedAnimation {
* 0.125,
);
if skeleton_attr.feed.0 {
next.head.position = Vec3::new(
0.0,
skeleton_attr.head.0,
skeleton_attr.head.1 + slower * 0.2,
);
if s_a.feed.0 {
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1 + slower * 0.2);
next.head.orientation = Quaternion::rotation_z(0.3 * look.x)
* Quaternion::rotation_x(
fast * 0.05 + faster * 0.08 + 0.8 * skeleton_attr.feed.1 * transition,
fast * 0.05 + faster * 0.08 + 0.8 * s_a.feed.1 * transition,
);
next.head.scale = Vec3::one();
next.neck.position = Vec3::new(
0.0,
skeleton_attr.neck.0,
skeleton_attr.neck.1 + slower * 0.1 - 4.0 * transition,
s_a.neck.0,
s_a.neck.1 + slower * 0.1 - 4.0 * transition,
);
next.neck.orientation =
Quaternion::rotation_x(-2.5 * skeleton_attr.feed.1 * transition);
next.neck.orientation = Quaternion::rotation_x(-2.5 * s_a.feed.1 * transition);
next.neck.scale = Vec3::one() * 1.02;
next.jaw.position = Vec3::new(
0.0,
skeleton_attr.jaw.0 - slower * 0.12,
skeleton_attr.jaw.1 + slow * 0.2,
);
next.jaw.position = Vec3::new(0.0, s_a.jaw.0 - slower * 0.12, s_a.jaw.1 + slow * 0.2);
next.jaw.orientation = Quaternion::rotation_x((fast * 0.18 + faster * 0.26).min(0.0));
next.jaw.scale = Vec3::one() * 1.02;
} else {
next.head.position = Vec3::new(
0.0,
skeleton_attr.head.0,
skeleton_attr.head.1 + slower * 0.2,
);
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1 + slower * 0.2);
next.head.orientation =
Quaternion::rotation_z(0.3 * look.x) * Quaternion::rotation_x(0.3 * look.y);
next.head.scale = Vec3::one();
next.neck.position = Vec3::new(
0.0,
skeleton_attr.neck.0,
skeleton_attr.neck.1 + slower * 0.1,
);
next.neck.position = Vec3::new(0.0, s_a.neck.0, s_a.neck.1 + slower * 0.1);
next.neck.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.neck.scale = Vec3::one() * 1.02;
next.jaw.position = Vec3::new(
0.0,
skeleton_attr.jaw.0 - slower * 0.12,
skeleton_attr.jaw.1 + slow * 0.2 + 0.5,
);
next.jaw.position =
Vec3::new(0.0, s_a.jaw.0 - slower * 0.12, s_a.jaw.1 + slow * 0.2 + 0.5);
next.jaw.orientation = Quaternion::rotation_x(slow * 0.05 - 0.08);
next.jaw.scale = Vec3::one() * 1.02;
}
next.tail.position = Vec3::new(0.0, skeleton_attr.tail.0, skeleton_attr.tail.1);
next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1);
next.tail.orientation =
Quaternion::rotation_z(0.0 + slow * 0.2 + tailmove.x) * Quaternion::rotation_x(0.0);
next.tail.scale = Vec3::one();
next.torso_front.position = Vec3::new(
0.0,
skeleton_attr.torso_front.0,
skeleton_attr.torso_front.1 + slower * 0.3,
) * skeleton_attr.scaler
/ 11.0;
next.torso_front.position =
Vec3::new(0.0, s_a.torso_front.0, s_a.torso_front.1 + slower * 0.3) * s_a.scaler / 11.0;
next.torso_front.orientation = Quaternion::rotation_y(slow * 0.02);
next.torso_front.scale = Vec3::one() * skeleton_attr.scaler / 11.0;
next.torso_front.scale = Vec3::one() * s_a.scaler / 11.0;
next.torso_back.position = Vec3::new(
0.0,
skeleton_attr.torso_back.0,
skeleton_attr.torso_back.1 + slower * 0.2,
);
next.torso_back.position =
Vec3::new(0.0, s_a.torso_back.0, s_a.torso_back.1 + slower * 0.2);
next.torso_back.orientation = Quaternion::rotation_y(-slow * 0.005)
* Quaternion::rotation_z(0.0)
* Quaternion::rotation_x(0.0);
next.torso_back.scale = Vec3::one() * 0.99;
next.ears.position = Vec3::new(0.0, skeleton_attr.ears.0, skeleton_attr.ears.1);
next.ears.position = Vec3::new(0.0, s_a.ears.0, s_a.ears.1);
next.ears.orientation = Quaternion::rotation_x(0.0 + slower * 0.03);
next.ears.scale = Vec3::one() * 1.02;
next.leg_fl.position = Vec3::new(
-skeleton_attr.leg_f.0,
skeleton_attr.leg_f.1,
skeleton_attr.leg_f.2 + slow * -0.15 + slower * -0.15,
-s_a.leg_f.0,
s_a.leg_f.1,
s_a.leg_f.2 + slow * -0.15 + slower * -0.15,
);
next.leg_fl.orientation = Quaternion::rotation_y(slow * -0.02);
next.leg_fl.scale = Vec3::one() * 1.02;
next.leg_fr.position = Vec3::new(
skeleton_attr.leg_f.0,
skeleton_attr.leg_f.1,
skeleton_attr.leg_f.2 + slow * 0.15 + slower * -0.15,
s_a.leg_f.0,
s_a.leg_f.1,
s_a.leg_f.2 + slow * 0.15 + slower * -0.15,
);
next.leg_fr.orientation = Quaternion::rotation_y(slow * -0.02);
next.leg_fr.scale = Vec3::one() * 1.02;
next.leg_bl.position = Vec3::new(
-skeleton_attr.leg_b.0,
skeleton_attr.leg_b.1,
skeleton_attr.leg_b.2 + slower * -0.3,
);
next.leg_bl.position = Vec3::new(-s_a.leg_b.0, s_a.leg_b.1, s_a.leg_b.2 + slower * -0.3);
next.leg_bl.orientation = Quaternion::rotation_y(slow * -0.02);
next.leg_bl.scale = Vec3::one() * 1.02;
next.leg_br.position = Vec3::new(
skeleton_attr.leg_b.0,
skeleton_attr.leg_b.1,
skeleton_attr.leg_b.2 + slower * -0.3,
);
next.leg_br.position = Vec3::new(s_a.leg_b.0, s_a.leg_b.1, s_a.leg_b.2 + slower * -0.3);
next.leg_br.orientation = Quaternion::rotation_y(slow * -0.02);
next.leg_br.scale = Vec3::one() * 1.02;
next.foot_fl.position = Vec3::new(
-skeleton_attr.feet_f.0,
skeleton_attr.feet_f.1,
skeleton_attr.feet_f.2 + slower * -0.2,
);
next.foot_fl.position =
Vec3::new(-s_a.feet_f.0, s_a.feet_f.1, s_a.feet_f.2 + slower * -0.2);
next.foot_fl.orientation = Quaternion::rotation_x(0.0);
next.foot_fl.scale = Vec3::one() * 0.94;
next.foot_fr.position = Vec3::new(
skeleton_attr.feet_f.0,
skeleton_attr.feet_f.1,
skeleton_attr.feet_f.2 + slower * -0.2,
);
next.foot_fr.position = Vec3::new(s_a.feet_f.0, s_a.feet_f.1, s_a.feet_f.2 + slower * -0.2);
next.foot_fr.orientation = Quaternion::rotation_x(0.0);
next.foot_fr.scale = Vec3::one() * 0.94;
next.foot_bl.position = Vec3::new(
-skeleton_attr.feet_b.0,
skeleton_attr.feet_b.1,
skeleton_attr.feet_b.2 + slower * -0.2,
);
next.foot_bl.position =
Vec3::new(-s_a.feet_b.0, s_a.feet_b.1, s_a.feet_b.2 + slower * -0.2);
next.foot_bl.orientation = Quaternion::rotation_x(0.0);
next.foot_bl.scale = Vec3::one() * 0.94;
next.foot_br.position = Vec3::new(
skeleton_attr.feet_b.0,
skeleton_attr.feet_b.1,
skeleton_attr.feet_b.2 + slower * -0.2,
);
next.foot_br.position = Vec3::new(s_a.feet_b.0, s_a.feet_b.1, s_a.feet_b.2 + slower * -0.2);
next.foot_br.orientation = Quaternion::rotation_x(0.0);
next.foot_br.scale = Vec3::one() * 0.94;

View File

@ -19,7 +19,7 @@ impl Animation for IdleAnimation {
global_time: Self::Dependency,
anim_time: f64,
_rate: &mut f32,
skeleton_attr: &SkeletonAttr,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
@ -51,120 +51,79 @@ impl Animation for IdleAnimation {
* 0.125,
);
next.head.position = Vec3::new(
0.0,
skeleton_attr.head.0,
skeleton_attr.head.1 + slower * 0.2,
);
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1 + slower * 0.2);
next.head.orientation =
Quaternion::rotation_z(0.3 * look.x) * Quaternion::rotation_x(0.3 * look.y);
next.head.scale = Vec3::one();
next.neck.position = Vec3::new(
0.0,
skeleton_attr.neck.0,
skeleton_attr.neck.1 + slower * 0.1,
);
next.neck.position = Vec3::new(0.0, s_a.neck.0, s_a.neck.1 + slower * 0.1);
next.neck.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.neck.scale = Vec3::one() * 1.02;
next.jaw.position = Vec3::new(
0.0,
skeleton_attr.jaw.0 - slower * 0.12,
skeleton_attr.jaw.1 + slow * 0.2,
);
next.jaw.position = Vec3::new(0.0, s_a.jaw.0 - slower * 0.12, s_a.jaw.1 + slow * 0.2);
next.jaw.orientation = Quaternion::rotation_x(slow * 0.05 - 0.08);
next.jaw.scale = Vec3::one() * 1.02;
next.tail.position = Vec3::new(0.0, skeleton_attr.tail.0, skeleton_attr.tail.1);
next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1);
next.tail.orientation =
Quaternion::rotation_z(0.0 + slow * 0.2 + tailmove.x) * Quaternion::rotation_x(0.0);
next.tail.scale = Vec3::one();
next.torso_front.position = Vec3::new(
0.0,
skeleton_attr.torso_front.0,
skeleton_attr.torso_front.1 + slower * 0.3,
) * skeleton_attr.scaler
/ 11.0;
next.torso_front.position =
Vec3::new(0.0, s_a.torso_front.0, s_a.torso_front.1 + slower * 0.3) * s_a.scaler / 11.0;
next.torso_front.orientation = Quaternion::rotation_y(slow * 0.02);
next.torso_front.scale = Vec3::one() * skeleton_attr.scaler / 11.0;
next.torso_front.scale = Vec3::one() * s_a.scaler / 11.0;
next.torso_back.position = Vec3::new(
0.0,
skeleton_attr.torso_back.0,
skeleton_attr.torso_back.1 + slower * 0.2,
);
next.torso_back.position =
Vec3::new(0.0, s_a.torso_back.0, s_a.torso_back.1 + slower * 0.2);
next.torso_back.orientation = Quaternion::rotation_y(-slow * 0.005)
* Quaternion::rotation_z(0.0)
* Quaternion::rotation_x(0.0);
next.torso_back.scale = Vec3::one() * 0.99;
next.ears.position = Vec3::new(0.0, skeleton_attr.ears.0, skeleton_attr.ears.1);
next.ears.position = Vec3::new(0.0, s_a.ears.0, s_a.ears.1);
next.ears.orientation = Quaternion::rotation_x(0.0 + slower * 0.03);
next.ears.scale = Vec3::one() * 1.02;
next.leg_fl.position = Vec3::new(
-skeleton_attr.leg_f.0,
skeleton_attr.leg_f.1,
skeleton_attr.leg_f.2 + slow * -0.15 + slower * -0.15,
-s_a.leg_f.0,
s_a.leg_f.1,
s_a.leg_f.2 + slow * -0.15 + slower * -0.15,
);
next.leg_fl.orientation = Quaternion::rotation_y(slow * -0.02);
next.leg_fl.scale = Vec3::one() * 1.02;
next.leg_fr.position = Vec3::new(
skeleton_attr.leg_f.0,
skeleton_attr.leg_f.1,
skeleton_attr.leg_f.2 + slow * 0.15 + slower * -0.15,
s_a.leg_f.0,
s_a.leg_f.1,
s_a.leg_f.2 + slow * 0.15 + slower * -0.15,
);
next.leg_fr.orientation = Quaternion::rotation_y(slow * -0.02);
next.leg_fr.scale = Vec3::one() * 1.02;
next.leg_bl.position = Vec3::new(
-skeleton_attr.leg_b.0,
skeleton_attr.leg_b.1,
skeleton_attr.leg_b.2 + slower * -0.3,
);
next.leg_bl.position = Vec3::new(-s_a.leg_b.0, s_a.leg_b.1, s_a.leg_b.2 + slower * -0.3);
next.leg_bl.orientation = Quaternion::rotation_y(slow * -0.02);
next.leg_bl.scale = Vec3::one() * 1.02;
next.leg_br.position = Vec3::new(
skeleton_attr.leg_b.0,
skeleton_attr.leg_b.1,
skeleton_attr.leg_b.2 + slower * -0.3,
);
next.leg_br.position = Vec3::new(s_a.leg_b.0, s_a.leg_b.1, s_a.leg_b.2 + slower * -0.3);
next.leg_br.orientation = Quaternion::rotation_y(slow * -0.02);
next.leg_br.scale = Vec3::one() * 1.02;
next.foot_fl.position = Vec3::new(
-skeleton_attr.feet_f.0,
skeleton_attr.feet_f.1,
skeleton_attr.feet_f.2 + slower * -0.2,
);
next.foot_fl.position =
Vec3::new(-s_a.feet_f.0, s_a.feet_f.1, s_a.feet_f.2 + slower * -0.2);
next.foot_fl.orientation = Quaternion::rotation_x(0.0);
next.foot_fl.scale = Vec3::one() * 0.94;
next.foot_fr.position = Vec3::new(
skeleton_attr.feet_f.0,
skeleton_attr.feet_f.1,
skeleton_attr.feet_f.2 + slower * -0.2,
);
next.foot_fr.position = Vec3::new(s_a.feet_f.0, s_a.feet_f.1, s_a.feet_f.2 + slower * -0.2);
next.foot_fr.orientation = Quaternion::rotation_x(0.0);
next.foot_fr.scale = Vec3::one() * 0.94;
next.foot_bl.position = Vec3::new(
-skeleton_attr.feet_b.0,
skeleton_attr.feet_b.1,
skeleton_attr.feet_b.2 + slower * -0.2,
);
next.foot_bl.position =
Vec3::new(-s_a.feet_b.0, s_a.feet_b.1, s_a.feet_b.2 + slower * -0.2);
next.foot_bl.orientation = Quaternion::rotation_x(0.0);
next.foot_bl.scale = Vec3::one() * 0.94;
next.foot_br.position = Vec3::new(
skeleton_attr.feet_b.0,
skeleton_attr.feet_b.1,
skeleton_attr.feet_b.2 + slower * -0.2,
);
next.foot_br.position = Vec3::new(s_a.feet_b.0, s_a.feet_b.1, s_a.feet_b.2 + slower * -0.2);
next.foot_br.orientation = Quaternion::rotation_x(0.0);
next.foot_br.scale = Vec3::one() * 0.94;

View File

@ -18,107 +18,70 @@ impl Animation for JumpAnimation {
_global_time: Self::Dependency,
_anim_time: f64,
_rate: &mut f32,
skeleton_attr: &SkeletonAttr,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
next.head.position = Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1);
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
next.head.orientation = Quaternion::rotation_z(0.4) * Quaternion::rotation_x(0.3);
next.head.scale = Vec3::one();
next.neck.position = Vec3::new(0.0, skeleton_attr.neck.0, skeleton_attr.neck.1);
next.neck.position = Vec3::new(0.0, s_a.neck.0, s_a.neck.1);
next.neck.orientation = Quaternion::rotation_z(0.2) * Quaternion::rotation_x(0.3);
next.neck.scale = Vec3::one() * 1.02;
next.jaw.position = Vec3::new(0.0, skeleton_attr.jaw.0, skeleton_attr.jaw.1);
next.jaw.position = Vec3::new(0.0, s_a.jaw.0, s_a.jaw.1);
next.jaw.orientation = Quaternion::rotation_x(-0.4);
next.jaw.scale = Vec3::one() * 1.02;
next.tail.position = Vec3::new(0.0, skeleton_attr.tail.0, skeleton_attr.tail.1);
next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1);
next.tail.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(-0.3);
next.tail.scale = Vec3::one();
next.torso_front.position = Vec3::new(
0.0,
skeleton_attr.torso_front.0,
skeleton_attr.torso_front.1,
) * skeleton_attr.scaler
/ 11.0;
next.torso_front.position =
Vec3::new(0.0, s_a.torso_front.0, s_a.torso_front.1) * s_a.scaler / 11.0;
next.torso_front.orientation = Quaternion::rotation_y(0.0);
next.torso_front.scale = Vec3::one() * skeleton_attr.scaler / 11.0;
next.torso_front.scale = Vec3::one() * s_a.scaler / 11.0;
next.torso_back.position =
Vec3::new(0.0, skeleton_attr.torso_back.0, skeleton_attr.torso_back.1);
next.torso_back.position = Vec3::new(0.0, s_a.torso_back.0, s_a.torso_back.1);
next.torso_back.orientation = Quaternion::rotation_z(-0.3)
* Quaternion::rotation_z(0.0)
* Quaternion::rotation_x(0.0);
next.torso_back.scale = Vec3::one();
next.ears.position = Vec3::new(0.0, skeleton_attr.ears.0, skeleton_attr.ears.1);
next.ears.position = Vec3::new(0.0, s_a.ears.0, s_a.ears.1);
next.ears.orientation = Quaternion::rotation_x(0.6);
next.ears.scale = Vec3::one() * 1.02;
next.leg_fl.position = Vec3::new(
-skeleton_attr.leg_f.0,
skeleton_attr.leg_f.1,
skeleton_attr.leg_f.2,
);
next.leg_fl.position = Vec3::new(-s_a.leg_f.0, s_a.leg_f.1, s_a.leg_f.2);
next.leg_fl.orientation = Quaternion::rotation_x(-0.4);
next.leg_fl.scale = Vec3::one();
next.leg_fr.position = Vec3::new(
skeleton_attr.leg_f.0,
skeleton_attr.leg_f.1,
skeleton_attr.leg_f.2,
);
next.leg_fr.position = Vec3::new(s_a.leg_f.0, s_a.leg_f.1, s_a.leg_f.2);
next.leg_fr.orientation = Quaternion::rotation_x(0.4);
next.leg_fr.scale = Vec3::one();
next.leg_bl.position = Vec3::new(
-skeleton_attr.leg_b.0,
skeleton_attr.leg_b.1,
skeleton_attr.leg_b.2,
);
next.leg_bl.position = Vec3::new(-s_a.leg_b.0, s_a.leg_b.1, s_a.leg_b.2);
next.leg_bl.orientation = Quaternion::rotation_y(0.0);
next.leg_bl.scale = Vec3::one();
next.leg_br.position = Vec3::new(
skeleton_attr.leg_b.0,
skeleton_attr.leg_b.1,
skeleton_attr.leg_b.2,
);
next.leg_br.position = Vec3::new(s_a.leg_b.0, s_a.leg_b.1, s_a.leg_b.2);
next.leg_br.orientation = Quaternion::rotation_y(0.0);
next.leg_br.scale = Vec3::one();
next.foot_fl.position = Vec3::new(
-skeleton_attr.feet_f.0,
skeleton_attr.feet_f.1,
skeleton_attr.feet_f.2,
);
next.foot_fl.position = Vec3::new(-s_a.feet_f.0, s_a.feet_f.1, s_a.feet_f.2);
next.foot_fl.orientation = Quaternion::rotation_x(-0.3);
next.foot_fl.scale = Vec3::one();
next.foot_fr.position = Vec3::new(
skeleton_attr.feet_f.0,
skeleton_attr.feet_f.1,
skeleton_attr.feet_f.2,
);
next.foot_fr.position = Vec3::new(s_a.feet_f.0, s_a.feet_f.1, s_a.feet_f.2);
next.foot_fr.orientation = Quaternion::rotation_x(0.2);
next.foot_fr.scale = Vec3::one();
next.foot_bl.position = Vec3::new(
-skeleton_attr.feet_b.0,
skeleton_attr.feet_b.1,
skeleton_attr.feet_b.2,
);
next.foot_bl.position = Vec3::new(-s_a.feet_b.0, s_a.feet_b.1, s_a.feet_b.2);
next.foot_bl.orientation = Quaternion::rotation_x(0.0);
next.foot_bl.scale = Vec3::one();
next.foot_br.position = Vec3::new(
skeleton_attr.feet_b.0,
skeleton_attr.feet_b.1,
skeleton_attr.feet_b.2,
);
next.foot_br.position = Vec3::new(s_a.feet_b.0, s_a.feet_b.1, s_a.feet_b.2);
next.foot_br.orientation = Quaternion::rotation_x(0.0);
next.foot_br.scale = Vec3::one();

View File

@ -19,7 +19,7 @@ impl Animation for RunAnimation {
(velocity, orientation, last_ori, global_time, avg_vel): Self::Dependency,
anim_time: f64,
rate: &mut f32,
skeleton_attr: &SkeletonAttr,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let speed = Vec2::<f32>::from(velocity).magnitude();
@ -29,7 +29,7 @@ impl Animation for RunAnimation {
let amplitude = (speed / 24.0).max(0.25);
let amplitude2 = (speed * 1.4 / 24.0).powf(0.5).max(0.6);
let amplitude3 = (speed / 24.0).powf(0.5).max(0.35);
let speedmult = skeleton_attr.tempo;
let speedmult = s_a.tempo;
let canceler = (speed / 24.0).powf(0.5);
let short = (((1.0)
/ (0.72
@ -99,7 +99,7 @@ impl Animation for RunAnimation {
let x_tilt = avg_vel.z.atan2(avg_vel.xy().magnitude());
//Gallop
next.head.position = Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1);
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
next.head.orientation = Quaternion::rotation_x(
look.y * 0.3 / ((canceler).max(0.5)) + amplitude * short * -0.03 - 0.1,
) * Quaternion::rotation_z(
@ -107,55 +107,55 @@ impl Animation for RunAnimation {
) * Quaternion::rotation_y(tilt * 0.8);
next.head.scale = Vec3::one();
next.neck.position = Vec3::new(0.0, skeleton_attr.neck.0, skeleton_attr.neck.1);
next.neck.position = Vec3::new(0.0, s_a.neck.0, s_a.neck.1);
next.neck.orientation = Quaternion::rotation_z(tilt * -0.8)
* Quaternion::rotation_x(amplitude * short * -0.05)
* Quaternion::rotation_y(tilt * 0.3);
next.neck.scale = Vec3::one() * 1.02;
next.jaw.position = Vec3::new(0.0, skeleton_attr.jaw.0, skeleton_attr.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.scale = Vec3::one() * 1.02;
next.tail.position = Vec3::new(0.0, skeleton_attr.tail.0, skeleton_attr.tail.1);
next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1);
next.tail.orientation =
Quaternion::rotation_x(amplitude * shortalt * 0.3) * Quaternion::rotation_z(tilt * 1.5);
next.tail.scale = Vec3::one();
next.torso_front.position = Vec3::new(
0.0,
skeleton_attr.torso_front.0,
skeleton_attr.torso_front.1
s_a.torso_front.0,
s_a.torso_front.1
+ canceler * 1.0
+ canceler * shortalt * 2.5 * skeleton_attr.spring
+ canceler * shortalt * 2.5 * s_a.spring
+ x_tilt * 10.0 * canceler,
) * skeleton_attr.scaler
) * s_a.scaler
/ 11.0;
next.torso_front.orientation = Quaternion::rotation_x(
(amplitude * (short * -0.13).max(-0.2)) * skeleton_attr.spring
(amplitude * (short * -0.13).max(-0.2)) * s_a.spring
+ x_tilt * (canceler * 6.0).min(1.0),
) * Quaternion::rotation_y(tilt * 0.8)
* Quaternion::rotation_z(tilt * -1.5);
next.torso_front.scale = Vec3::one() * skeleton_attr.scaler / 11.0;
next.torso_front.scale = Vec3::one() * s_a.scaler / 11.0;
next.torso_back.position = Vec3::new(
0.0,
skeleton_attr.torso_back.0,
skeleton_attr.torso_back.1 + amplitude * shortalt * 0.2 - 0.2,
s_a.torso_back.0,
s_a.torso_back.1 + amplitude * shortalt * 0.2 - 0.2,
);
next.torso_back.orientation = Quaternion::rotation_x(amplitude * short * -0.1)
* Quaternion::rotation_z(tilt * 1.8)
* Quaternion::rotation_y(tilt * 0.6);
next.torso_back.scale = Vec3::one();
next.ears.position = Vec3::new(0.0, skeleton_attr.ears.0, skeleton_attr.ears.1);
next.ears.position = Vec3::new(0.0, s_a.ears.0, s_a.ears.1);
next.ears.orientation = Quaternion::rotation_x(amplitude * shortalt * 0.2 + 0.2);
next.ears.scale = Vec3::one() * 1.02;
next.leg_fl.position = Vec3::new(
-skeleton_attr.leg_f.0,
skeleton_attr.leg_f.1 + amplitude3 * foot1b * -1.6,
skeleton_attr.leg_f.2 + amplitude3 * foot1a * 2.3,
-s_a.leg_f.0,
s_a.leg_f.1 + amplitude3 * foot1b * -1.6,
s_a.leg_f.2 + amplitude3 * foot1a * 2.3,
);
next.leg_fl.orientation =
Quaternion::rotation_x(0.2 * canceler + amplitude3 * foot1a * 0.85)
@ -164,9 +164,9 @@ impl Animation for RunAnimation {
next.leg_fl.scale = Vec3::one() * 1.02;
next.leg_fr.position = Vec3::new(
skeleton_attr.leg_f.0,
skeleton_attr.leg_f.1 + amplitude3 * foot2b * -1.6,
skeleton_attr.leg_f.2 + amplitude3 * foot2a * 2.3,
s_a.leg_f.0,
s_a.leg_f.1 + amplitude3 * foot2b * -1.6,
s_a.leg_f.2 + amplitude3 * foot2a * 2.3,
);
next.leg_fr.orientation =
Quaternion::rotation_x(0.2 * canceler + amplitude3 * foot2a * 0.85)
@ -175,9 +175,9 @@ impl Animation for RunAnimation {
next.leg_fr.scale = Vec3::one() * 1.02;
next.leg_bl.position = Vec3::new(
-skeleton_attr.leg_b.0,
skeleton_attr.leg_b.1 + amplitude3 * foot3b * -1.1,
skeleton_attr.leg_b.2 + amplitude3 * foot3a * 1.1,
-s_a.leg_b.0,
s_a.leg_b.1 + amplitude3 * foot3b * -1.1,
s_a.leg_b.2 + amplitude3 * foot3a * 1.1,
);
next.leg_bl.orientation =
Quaternion::rotation_x(canceler * -0.2 + amplitude3 * foot3b * -0.55)
@ -186,9 +186,9 @@ impl Animation for RunAnimation {
next.leg_bl.scale = Vec3::one() * 1.02;
next.leg_br.position = Vec3::new(
skeleton_attr.leg_b.0,
skeleton_attr.leg_b.1 + amplitude3 * foot4b * -1.1,
skeleton_attr.leg_b.2 + amplitude3 * foot4a * 1.1,
s_a.leg_b.0,
s_a.leg_b.1 + amplitude3 * foot4b * -1.1,
s_a.leg_b.2 + amplitude3 * foot4a * 1.1,
);
next.leg_br.orientation =
Quaternion::rotation_x(canceler * -0.2 + amplitude3 * foot4b * -0.55)
@ -197,29 +197,29 @@ impl Animation for RunAnimation {
next.leg_br.scale = Vec3::one() * 1.02;
next.foot_fl.position = Vec3::new(
-skeleton_attr.feet_f.0,
skeleton_attr.feet_f.1,
skeleton_attr.feet_f.2 + (foot1a * 2.0).max(-1.0) * amplitude2 + 1.0 * canceler,
-s_a.feet_f.0,
s_a.feet_f.1,
s_a.feet_f.2 + (foot1a * 2.0).max(-1.0) * amplitude2 + 1.0 * canceler,
);
next.foot_fl.orientation = Quaternion::rotation_x(
skeleton_attr.startangle * canceler + amplitude2 * foot1b * -0.7,
) * Quaternion::rotation_y(tilt * -1.0);
next.foot_fl.orientation =
Quaternion::rotation_x(s_a.startangle * canceler + amplitude2 * foot1b * -0.7)
* Quaternion::rotation_y(tilt * -1.0);
next.foot_fl.scale = Vec3::one() * 0.96;
next.foot_fr.position = Vec3::new(
skeleton_attr.feet_f.0,
skeleton_attr.feet_f.1,
skeleton_attr.feet_f.2 + (foot2a * 2.0).max(-1.0) * amplitude2 + 1.0 * canceler,
s_a.feet_f.0,
s_a.feet_f.1,
s_a.feet_f.2 + (foot2a * 2.0).max(-1.0) * amplitude2 + 1.0 * canceler,
);
next.foot_fr.orientation = Quaternion::rotation_x(
skeleton_attr.startangle * canceler + amplitude2 * foot2b * -0.7,
) * Quaternion::rotation_y(tilt * -1.0);
next.foot_fr.orientation =
Quaternion::rotation_x(s_a.startangle * canceler + amplitude2 * foot2b * -0.7)
* Quaternion::rotation_y(tilt * -1.0);
next.foot_fr.scale = Vec3::one() * 0.96;
next.foot_bl.position = Vec3::new(
-skeleton_attr.feet_b.0,
skeleton_attr.feet_b.1,
skeleton_attr.feet_b.2 + (foot3a * 0.8).max(0.0) * amplitude2 + 1.0 * canceler,
-s_a.feet_b.0,
s_a.feet_b.1,
s_a.feet_b.2 + (foot3a * 0.8).max(0.0) * amplitude2 + 1.0 * canceler,
);
next.foot_bl.orientation =
Quaternion::rotation_x(amplitude2 * foot3b * -0.7 - 0.2 * canceler)
@ -227,9 +227,9 @@ impl Animation for RunAnimation {
next.foot_bl.scale = Vec3::one() * 0.96;
next.foot_br.position = Vec3::new(
skeleton_attr.feet_b.0,
skeleton_attr.feet_b.1,
skeleton_attr.feet_b.2 + (foot4a * 0.8).max(0.0) * amplitude2 + 1.0 * canceler,
s_a.feet_b.0,
s_a.feet_b.1,
s_a.feet_b.2 + (foot4a * 0.8).max(0.0) * amplitude2 + 1.0 * canceler,
);
next.foot_br.orientation =
Quaternion::rotation_x(amplitude2 * foot4b * -0.7 - 0.2 * canceler)

View File

@ -18,7 +18,7 @@ impl Animation for IdleAnimation {
global_time: Self::Dependency,
anim_time: f64,
_rate: &mut f32,
skeleton_attr: &SkeletonAttr,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
@ -36,98 +36,57 @@ impl Animation for IdleAnimation {
* 0.25,
);
next.head.position = Vec3::new(
0.0,
skeleton_attr.head.0,
skeleton_attr.head.1 + breathe * 0.3,
);
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1 + breathe * 0.3);
next.head.orientation = Quaternion::rotation_x(head_look.y + breathe * 0.1 - 0.1)
* Quaternion::rotation_z(head_look.x);
next.head.scale = Vec3::one() * 1.02;
next.jaw.position = Vec3::new(0.0, skeleton_attr.jaw.0, skeleton_attr.jaw.1);
next.jaw.position = Vec3::new(0.0, s_a.jaw.0, s_a.jaw.1);
next.jaw.orientation = Quaternion::rotation_x(breathe * 0.05);
next.jaw.scale = Vec3::one() * 0.98;
next.neck.position = Vec3::new(
0.0,
skeleton_attr.neck.0,
skeleton_attr.neck.1 + breathe * 0.2,
);
next.neck.position = Vec3::new(0.0, s_a.neck.0, s_a.neck.1 + breathe * 0.2);
next.neck.orientation = Quaternion::rotation_x(-0.1);
next.neck.scale = Vec3::one() * 0.98;
next.chest_front.position = Vec3::new(
0.0,
skeleton_attr.chest_front.0,
skeleton_attr.chest_front.1 + breathe * 0.3,
) / skeleton_attr.scaler;
next.chest_front.position =
Vec3::new(0.0, s_a.chest_front.0, s_a.chest_front.1 + breathe * 0.3) / s_a.scaler;
next.chest_front.orientation = Quaternion::rotation_x(breathe * 0.04);
next.chest_front.scale = Vec3::one() / skeleton_attr.scaler;
next.chest_front.scale = Vec3::one() / s_a.scaler;
next.chest_back.position =
Vec3::new(0.0, skeleton_attr.chest_back.0, skeleton_attr.chest_back.1);
next.chest_back.position = Vec3::new(0.0, s_a.chest_back.0, s_a.chest_back.1);
next.chest_back.orientation = Quaternion::rotation_x(breathe * -0.04);
next.chest_back.scale = Vec3::one();
next.tail_front.position =
Vec3::new(0.0, skeleton_attr.tail_front.0, skeleton_attr.tail_front.1);
next.tail_front.position = Vec3::new(0.0, s_a.tail_front.0, s_a.tail_front.1);
next.tail_front.orientation = Quaternion::rotation_x(0.1);
next.tail_front.scale = Vec3::one();
next.tail_back.position = Vec3::new(
0.0,
skeleton_attr.tail_back.0,
skeleton_attr.tail_back.1 - 0.5,
);
next.tail_back.position = Vec3::new(0.0, s_a.tail_back.0, s_a.tail_back.1 - 0.5);
next.tail_back.orientation = Quaternion::rotation_x(0.1);
next.tail_back.scale = Vec3::one();
next.hand_l.position = Vec3::new(
-skeleton_attr.hand.0,
skeleton_attr.hand.1,
skeleton_attr.hand.2,
);
next.hand_l.position = Vec3::new(-s_a.hand.0, s_a.hand.1, s_a.hand.2);
next.hand_l.orientation = Quaternion::rotation_x(breathe * 0.2);
next.hand_l.scale = Vec3::one();
next.hand_r.position = Vec3::new(
skeleton_attr.hand.0,
skeleton_attr.hand.1,
skeleton_attr.hand.2,
);
next.hand_r.position = Vec3::new(s_a.hand.0, s_a.hand.1, s_a.hand.2);
next.hand_r.orientation = Quaternion::rotation_x(breathe * 0.2);
next.hand_r.scale = Vec3::one();
next.leg_l.position = Vec3::new(
-skeleton_attr.leg.0,
skeleton_attr.leg.1,
skeleton_attr.leg.2 + breathe * 0.05,
);
next.leg_l.position = Vec3::new(-s_a.leg.0, s_a.leg.1, s_a.leg.2 + breathe * 0.05);
next.leg_l.orientation = Quaternion::rotation_z(0.0);
next.leg_l.scale = Vec3::one();
next.leg_r.position = Vec3::new(
skeleton_attr.leg.0,
skeleton_attr.leg.1,
skeleton_attr.leg.2 + breathe * 0.05,
);
next.leg_r.position = Vec3::new(s_a.leg.0, s_a.leg.1, s_a.leg.2 + breathe * 0.05);
next.leg_r.orientation = Quaternion::rotation_z(0.0);
next.leg_r.scale = Vec3::one();
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1,
skeleton_attr.foot.2 + breathe * -0.15,
);
next.foot_l.position = Vec3::new(-s_a.foot.0, s_a.foot.1, s_a.foot.2 + breathe * -0.15);
next.foot_l.orientation = Quaternion::rotation_z(0.0);
next.foot_l.scale = Vec3::one() * 1.02;
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1,
skeleton_attr.foot.2 + breathe * -0.15,
);
next.foot_r.position = Vec3::new(s_a.foot.0, s_a.foot.1, s_a.foot.2 + breathe * -0.15);
next.foot_r.orientation = Quaternion::rotation_z(0.0);
next.foot_r.scale = Vec3::one() * 1.02;

View File

@ -17,100 +17,62 @@ impl Animation for JumpAnimation {
_global_time: Self::Dependency,
anim_time: f64,
_rate: &mut f32,
skeleton_attr: &SkeletonAttr,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let breathe = (anim_time as f32 * 0.8).sin();
next.head.position = Vec3::new(
0.0,
skeleton_attr.head.0,
skeleton_attr.head.1 + breathe * 0.3,
);
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1 + breathe * 0.3);
next.head.orientation = Quaternion::rotation_x(breathe * 0.1 - 0.1);
next.head.scale = Vec3::one() * 1.02;
next.jaw.position = Vec3::new(0.0, skeleton_attr.jaw.0, skeleton_attr.jaw.1);
next.jaw.position = Vec3::new(0.0, s_a.jaw.0, s_a.jaw.1);
next.jaw.orientation = Quaternion::rotation_x(breathe * 0.05);
next.jaw.scale = Vec3::one() * 0.98;
next.neck.position = Vec3::new(
0.0,
skeleton_attr.neck.0,
skeleton_attr.neck.1 + breathe * 0.2,
);
next.neck.position = Vec3::new(0.0, s_a.neck.0, s_a.neck.1 + breathe * 0.2);
next.neck.orientation = Quaternion::rotation_x(-0.1);
next.neck.scale = Vec3::one() * 0.98;
next.chest_front.position = Vec3::new(
0.0,
skeleton_attr.chest_front.0,
skeleton_attr.chest_front.1 + breathe * 0.3,
) / skeleton_attr.scaler;
next.chest_front.position =
Vec3::new(0.0, s_a.chest_front.0, s_a.chest_front.1 + breathe * 0.3) / s_a.scaler;
next.chest_front.orientation = Quaternion::rotation_x(breathe * 0.04);
next.chest_front.scale = Vec3::one() / skeleton_attr.scaler;
next.chest_front.scale = Vec3::one() / s_a.scaler;
next.chest_back.position =
Vec3::new(0.0, skeleton_attr.chest_back.0, skeleton_attr.chest_back.1);
next.chest_back.position = Vec3::new(0.0, s_a.chest_back.0, s_a.chest_back.1);
next.chest_back.orientation = Quaternion::rotation_x(breathe * -0.04);
next.chest_back.scale = Vec3::one();
next.tail_front.position =
Vec3::new(0.0, skeleton_attr.tail_front.0, skeleton_attr.tail_front.1);
next.tail_front.position = Vec3::new(0.0, s_a.tail_front.0, s_a.tail_front.1);
next.tail_front.orientation = Quaternion::rotation_x(0.1);
next.tail_front.scale = Vec3::one();
next.tail_back.position =
Vec3::new(0.0, skeleton_attr.tail_back.0, skeleton_attr.tail_back.1);
next.tail_back.position = Vec3::new(0.0, s_a.tail_back.0, s_a.tail_back.1);
next.tail_back.orientation = Quaternion::rotation_x(0.1);
next.tail_back.scale = Vec3::one();
next.hand_l.position = Vec3::new(
-skeleton_attr.hand.0,
skeleton_attr.hand.1,
skeleton_attr.hand.2,
);
next.hand_l.position = Vec3::new(-s_a.hand.0, s_a.hand.1, s_a.hand.2);
next.hand_l.orientation = Quaternion::rotation_x(breathe * 0.2);
next.hand_l.scale = Vec3::one();
next.hand_r.position = Vec3::new(
skeleton_attr.hand.0,
skeleton_attr.hand.1,
skeleton_attr.hand.2,
);
next.hand_r.position = Vec3::new(s_a.hand.0, s_a.hand.1, s_a.hand.2);
next.hand_r.orientation = Quaternion::rotation_x(breathe * 0.2);
next.hand_r.scale = Vec3::one();
next.leg_l.position = Vec3::new(
-skeleton_attr.leg.0,
skeleton_attr.leg.1,
skeleton_attr.leg.2 + breathe * 0.05,
);
next.leg_l.position = Vec3::new(-s_a.leg.0, s_a.leg.1, s_a.leg.2 + breathe * 0.05);
next.leg_l.orientation = Quaternion::rotation_z(0.0);
next.leg_l.scale = Vec3::one();
next.leg_r.position = Vec3::new(
skeleton_attr.leg.0,
skeleton_attr.leg.1,
skeleton_attr.leg.2 + breathe * 0.05,
);
next.leg_r.position = Vec3::new(s_a.leg.0, s_a.leg.1, s_a.leg.2 + breathe * 0.05);
next.leg_r.orientation = Quaternion::rotation_z(0.0);
next.leg_r.scale = Vec3::one();
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1,
skeleton_attr.foot.2 + breathe * -0.35,
);
next.foot_l.position = Vec3::new(-s_a.foot.0, s_a.foot.1, s_a.foot.2 + breathe * -0.35);
next.foot_l.orientation = Quaternion::rotation_z(0.0);
next.foot_l.scale = Vec3::one() * 1.02;
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1,
skeleton_attr.foot.2 + breathe * -0.45,
);
next.foot_r.position = Vec3::new(s_a.foot.0, s_a.foot.1, s_a.foot.2 + breathe * -0.45);
next.foot_r.orientation = Quaternion::rotation_z(0.0);
next.foot_r.scale = Vec3::one() * 1.02;

View File

@ -18,14 +18,11 @@ impl Animation for RunAnimation {
(velocity, _global_time): Self::Dependency,
anim_time: f64,
rate: &mut f32,
skeleton_attr: &SkeletonAttr,
s_a: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let speed = Vec2::<f32>::from(velocity).magnitude();
*rate = 1.0;
//let wave = (anim_time as f32 * 8.0).sin();
//let wavealt = (anim_time as f32 * 8.0 + PI / 2.0).sin();
//let wave_slow = (anim_time as f32 * 6.5 + PI).sin();
let breathe = (anim_time as f32 * 0.8).sin();
let topspeed = 18.0;
@ -62,71 +59,53 @@ impl Animation for RunAnimation {
//BL
//BR
next.head.position = Vec3::new(
0.0,
skeleton_attr.head.0,
skeleton_attr.head.1 + breathe * 0.3,
);
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1 + breathe * 0.3);
next.head.orientation =
Quaternion::rotation_x(-0.1 + short * -0.05) * Quaternion::rotation_z(shortalt * -0.2);
next.head.scale = Vec3::one() * 1.02;
next.jaw.position = Vec3::new(0.0, skeleton_attr.jaw.0, skeleton_attr.jaw.1);
next.jaw.position = Vec3::new(0.0, s_a.jaw.0, s_a.jaw.1);
next.jaw.orientation = Quaternion::rotation_x(short * -0.03);
next.jaw.scale = Vec3::one() * 0.98;
next.neck.position = Vec3::new(0.0, skeleton_attr.neck.0, skeleton_attr.neck.1);
next.neck.position = Vec3::new(0.0, s_a.neck.0, s_a.neck.1);
next.neck.orientation =
Quaternion::rotation_x(-0.1 + short * -0.04) * Quaternion::rotation_z(shortalt * -0.1);
next.neck.scale = Vec3::one() * 0.98;
next.chest_front.position = Vec3::new(
0.0,
skeleton_attr.chest_front.0,
skeleton_attr.chest_front.1 + short * 0.5,
) / skeleton_attr.scaler;
next.chest_front.position =
Vec3::new(0.0, s_a.chest_front.0, s_a.chest_front.1 + short * 0.5) / s_a.scaler;
next.chest_front.orientation =
Quaternion::rotation_x(short * 0.07) * Quaternion::rotation_z(shortalt * 0.15);
next.chest_front.scale = Vec3::one() / skeleton_attr.scaler;
next.chest_front.scale = Vec3::one() / s_a.scaler;
next.chest_back.position =
Vec3::new(0.0, skeleton_attr.chest_back.0, skeleton_attr.chest_back.1);
next.chest_back.position = Vec3::new(0.0, s_a.chest_back.0, s_a.chest_back.1);
next.chest_back.orientation =
Quaternion::rotation_x(short * -0.04) * Quaternion::rotation_z(shortalt * -0.15);
next.chest_back.scale = Vec3::one();
next.tail_front.position =
Vec3::new(0.0, skeleton_attr.tail_front.0, skeleton_attr.tail_front.1);
next.tail_front.position = Vec3::new(0.0, s_a.tail_front.0, s_a.tail_front.1);
next.tail_front.orientation =
Quaternion::rotation_x(0.1 + short * -0.02) * Quaternion::rotation_z(shortalt * -0.1);
next.tail_front.scale = Vec3::one();
next.tail_back.position =
Vec3::new(0.0, skeleton_attr.tail_back.0, skeleton_attr.tail_back.1);
next.tail_back.position = Vec3::new(0.0, s_a.tail_back.0, s_a.tail_back.1);
next.tail_back.orientation =
Quaternion::rotation_x(0.2 + short * -0.2) * Quaternion::rotation_z(shortalt * -0.2);
next.tail_back.scale = Vec3::one();
next.hand_l.position = Vec3::new(
-skeleton_attr.hand.0,
skeleton_attr.hand.1,
skeleton_attr.hand.2,
);
next.hand_l.position = Vec3::new(-s_a.hand.0, s_a.hand.1, s_a.hand.2);
next.hand_l.orientation = Quaternion::rotation_x(-0.2 + amplitude3 * foot2a * 0.3);
next.hand_l.scale = Vec3::one();
next.hand_r.position = Vec3::new(
skeleton_attr.hand.0,
skeleton_attr.hand.1,
skeleton_attr.hand.2,
);
next.hand_r.position = Vec3::new(s_a.hand.0, s_a.hand.1, s_a.hand.2);
next.hand_r.orientation = Quaternion::rotation_x(-0.2 + amplitude3 * foot1a * 0.3);
next.hand_r.scale = Vec3::one();
next.leg_l.position = Vec3::new(
-skeleton_attr.leg.0,
skeleton_attr.leg.1 + amplitude3 * foot1b * -1.3,
skeleton_attr.leg.2 + amplitude3 * foot1a * 1.4,
-s_a.leg.0,
s_a.leg.1 + amplitude3 * foot1b * -1.3,
s_a.leg.2 + amplitude3 * foot1a * 1.4,
);
next.leg_l.orientation = Quaternion::rotation_x(-0.2 + amplitude3 * foot1a * 0.2)
* Quaternion::rotation_z(foot1a * -0.3)
@ -134,9 +113,9 @@ impl Animation for RunAnimation {
next.leg_l.scale = Vec3::one() * 1.0;
next.leg_r.position = Vec3::new(
skeleton_attr.leg.0,
skeleton_attr.leg.1 + amplitude3 * foot2b * -1.3,
skeleton_attr.leg.2 + amplitude3 * foot2a * 1.4,
s_a.leg.0,
s_a.leg.1 + amplitude3 * foot2b * -1.3,
s_a.leg.2 + amplitude3 * foot2a * 1.4,
);
next.leg_r.orientation = Quaternion::rotation_x(-0.2 + amplitude3 * foot2a * 0.2)
* Quaternion::rotation_z(foot2a * 0.3)
@ -144,18 +123,18 @@ impl Animation for RunAnimation {
next.leg_r.scale = Vec3::one() * 1.0;
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1 + canceler * -2.0 + amplitude3 * foot1b * -2.0,
skeleton_attr.foot.2 + canceler * 2.0 + (foot1a * 2.0).max(0.0) * amplitude2,
-s_a.foot.0,
s_a.foot.1 + canceler * -2.0 + amplitude3 * foot1b * -2.0,
s_a.foot.2 + canceler * 2.0 + (foot1a * 2.0).max(0.0) * amplitude2,
);
next.foot_l.orientation = Quaternion::rotation_x(-0.3 + amplitude2 * foot1b * -0.35)
* Quaternion::rotation_y(0.0);
next.foot_l.scale = Vec3::one() * 0.96;
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1 + canceler * -2.0 + amplitude3 * foot2b * -2.0,
skeleton_attr.foot.2 + canceler * 2.0 + (foot2a * 2.0).max(0.0) * amplitude2,
s_a.foot.0,
s_a.foot.1 + canceler * -2.0 + amplitude3 * foot2b * -2.0,
s_a.foot.2 + canceler * 2.0 + (foot2a * 2.0).max(0.0) * amplitude2,
);
next.foot_r.orientation = Quaternion::rotation_x(-0.3 + amplitude2 * foot2b * -0.35)
* Quaternion::rotation_y(0.0);