cleanup 3

This commit is contained in:
jshipsey 2020-10-21 00:59:11 -04:00 committed by Robin Gilh
parent f79181c01f
commit c878673a84
7 changed files with 41 additions and 290 deletions

View File

@ -42,11 +42,6 @@ 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 short(x: f32) -> f32 {
(((5.0) / (1.5 + 3.5 * ((x * 5.0).sin()).powf(2.0 as f32))).sqrt()) * ((x * 5.0).sin())
}
@ -68,18 +63,12 @@ impl Animation for DashAnimation {
fn shortalt(x: f32) -> f32 { (x * 5.0 + PI / 2.0).sin() }
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);
next.hand_l.scale = Vec3::one() * 1.02;
next.hand_r.position = Vec3::new(0.75, -1.5, -0.5);
next.hand_r.orientation = Quaternion::rotation_x(1.47) * Quaternion::rotation_y(0.3);
next.hand_r.scale = Vec3::one() * 1.02;
next.main.position = Vec3::new(0.0, 0.0, 2.0);
next.main.orientation = Quaternion::rotation_x(-0.1)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.main.orientation = Quaternion::rotation_x(-0.1);
match active_tool_kind {
//TODO: Inventory
@ -109,7 +98,6 @@ impl Animation for DashAnimation {
Quaternion::rotation_x(movement1 * -1.0 + movement3 * -0.5)
* Quaternion::rotation_y(movement1 * 1.5 + movement3 * -2.5)
* Quaternion::rotation_z(0.0);
next.control.scale = Vec3::one();
next.lower_torso.orientation =
Quaternion::rotation_z(short(movement2).min(1.0) * 0.25);
@ -130,91 +118,14 @@ impl Animation for DashAnimation {
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, 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();
next.upper_torso.position = Vec3::new(0.0, 0.0, 7.0 + slow(anim_time as f32) * 2.0);
next.upper_torso.orientation =
Quaternion::rotation_x(-0.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.hand_l.position = Vec3::new(-0.75, -1.0, -2.5);
next.hand_l.orientation = Quaternion::rotation_x(1.27);
next.hand_l.scale = Vec3::one() * 1.04;
next.hand_r.position = Vec3::new(0.75, -1.5, -5.5);
next.hand_r.orientation = Quaternion::rotation_x(1.27);
next.hand_r.scale = Vec3::one() * 1.05;
next.main.position = Vec3::new(0.0, 6.0, -1.0);
next.main.orientation = Quaternion::rotation_x(-0.3);
next.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.scale = Vec3::one();
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, s_a.foot.2);
next.foot_r.orientation = Quaternion::rotation_x(-0.8);
},
Some(ToolKind::Dagger(_)) => {},
_ => {},
}
match second_tool_kind {
//TODO: Inventory
Some(ToolKind::Dagger(_)) => {
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();
next.upper_torso.position = Vec3::new(0.0, 0.0, 7.0 + slow(anim_time as f32) * 2.0);
next.upper_torso.orientation = Quaternion::rotation_x(0.0);
next.lower_torso.position = Vec3::new(0.0, 3.0, -3.0);
next.lower_torso.orientation = Quaternion::rotation_x(0.0);
next.control.position = Vec3::new(0.0, 0.0, 0.0);
next.control.orientation = Quaternion::rotation_x(0.0);
next.control.scale = Vec3::one();
next.hand_l.position = Vec3::new(0.0, 0.0, 0.0);
next.hand_l.orientation = Quaternion::rotation_x(0.0);
next.hand_l.scale = Vec3::one() * 1.04;
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_x(0.0);
next.main.scale = Vec3::one();
next.hand_r.position = Vec3::new(0.0, 0.0, 0.0);
next.hand_r.orientation = Quaternion::rotation_x(0.0);
next.hand_r.scale = Vec3::one() * 1.05;
next.second.position = Vec3::new(0.0, 6.0, -1.0);
next.second.orientation = Quaternion::rotation_x(-0.3);
next.second.scale = Vec3::one();
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, s_a.foot.2);
next.foot_r.orientation = Quaternion::rotation_x(-0.8);
},
Some(ToolKind::Dagger(_)) => {},
_ => {},
}
next.hold.scale = Vec3::one() * 0.0;
next.torso.scale = Vec3::one() / 8.0;
next.second.scale = match (
active_tool_kind.map(|tk| tk.hands()),
second_tool_kind.map(|tk| tk.hands()),

View File

@ -41,18 +41,6 @@ impl Animation for IdleAnimation {
.sin()
* 0.25,
);
let tailmove = Vec2::new(
((global_time + anim_time) as f32 / 2.0)
.floor()
.mul(7331.0)
.sin()
* 0.25,
((global_time + anim_time) as f32 / 2.0)
.floor()
.mul(1337.0)
.sin()
* 0.125,
);
let breathe = if s_a.beast {
// Controls for the beast breathing
@ -76,8 +64,7 @@ impl Animation for IdleAnimation {
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.orientation = Quaternion::rotation_x(-breathe);
next.upper_torso.scale = Vec3::one() - breathe * 0.4;
next.lower_torso.position =
@ -96,69 +83,39 @@ impl Animation for IdleAnimation {
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.control.position = Vec3::new(0.0, 0.0, 0.0);
next.control.orientation = Quaternion::rotation_z(0.0);
next.control.scale = Vec3::one();
next.second.position = Vec3::new(0.0, 0.0, 0.0);
next.second.orientation =
Quaternion::rotation_x(PI) * Quaternion::rotation_y(0.0) * Quaternion::rotation_z(0.0);
next.second.scale = Vec3::one() * 0.0;
Quaternion::rotation_z(0.0 + slow * 0.2) * Quaternion::rotation_x(0.0);
next.main.position = Vec3::new(-5.0, -7.0, 7.0);
next.main.orientation =
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(-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.orientation = Quaternion::rotation_x(breathe);
next.shoulder_l.scale = Vec3::one() + breathe;
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.orientation = Quaternion::rotation_x(breathe);
next.shoulder_r.scale = Vec3::one() + breathe;
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(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;
next.arm_control_l.scale = Vec3::one() * 1.0;
next.arm_control_r.scale = Vec3::one() * 1.0;
next.leg_control_l.scale = Vec3::one() * 1.0;
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(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(-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(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();
next.torso.position = Vec3::new(0.0, 0.0, 0.0) / 8.0;
next.torso.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.torso.scale = Vec3::one() / 8.0;
next.leg_control_l.scale = Vec3::one() * 1.0;
next.leg_control_r.scale = Vec3::one() * 1.0;
next.arm_control_l.scale = Vec3::one() * 1.0;
next.arm_control_r.scale = Vec3::one() * 1.0;
next.hold.scale = Vec3::one() * 0.0;
next

View File

@ -28,9 +28,12 @@ impl Animation for JumpAnimation {
let wave_slow = (anim_time as f32 * 0.8).sin();
next.head.scale = Vec3::one() * 1.02;
next.hand_l.scale = Vec3::one() * 1.04;
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, s_a.upper_torso.0, s_a.upper_torso.1 + torso * 0.5);
@ -74,7 +77,6 @@ impl Animation for JumpAnimation {
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(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);

View File

@ -98,9 +98,7 @@ impl Animation for LeapAnimation {
* Quaternion::rotation_y(0.0);
next.hand_r.scale = Vec3::one() * 1.06;
next.main.position = Vec3::new(-0.0, -2.0, -1.0);
next.main.orientation = Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.main.orientation = Quaternion::rotation_x(0.0);
next.control.position = Vec3::new(-3.0, 11.0, 3.0);
next.control.orientation = Quaternion::rotation_x(1.8)

View File

@ -127,6 +127,8 @@ impl Animation for RunAnimation {
let x_tilt = avg_vel.z.atan2(avg_vel.xy().magnitude());
next.torso.scale = Vec3::one() / 8.0;
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(
@ -134,7 +136,6 @@ impl Animation for RunAnimation {
) * Quaternion::rotation_z(
look.x * 0.3 / ((canceler).max(0.5)) + tilt * -1.2,
) * Quaternion::rotation_y(tilt * 0.8);
next.head.scale = Vec3::one();
next.jaw.position = Vec3::new(0.0, s_a.jaw.0, s_a.jaw.1);
next.jaw.orientation = Quaternion::rotation_x(0.0);
@ -155,14 +156,12 @@ impl Animation for RunAnimation {
(amplitude * (short * -0.0).max(-0.2)) + 0.0 * (canceler * 6.0).min(1.0), //x_tilt
) * Quaternion::rotation_y(tilt * 0.8)
* Quaternion::rotation_z(tilt * -1.5);
next.upper_torso.scale = Vec3::one();
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)
* Quaternion::rotation_y(tilt * 0.6);
next.lower_torso.scale = Vec3::one();
next.arm_control_l.position = Vec3::new(
0.0,
@ -173,7 +172,6 @@ impl Animation for RunAnimation {
Quaternion::rotation_x(0.3 * canceler + amplitude3 * foot1a * 0.4)
* Quaternion::rotation_z(tilt * -0.5)
* Quaternion::rotation_y(tilt * 1.5);
next.arm_control_l.scale = Vec3::one() * 1.02;
next.arm_control_r.position = Vec3::new(
0.0,
@ -184,7 +182,6 @@ impl Animation for RunAnimation {
Quaternion::rotation_x(0.3 * canceler + amplitude3 * foot2a * 0.4)
* Quaternion::rotation_z(tilt * -0.5)
* Quaternion::rotation_y(tilt * 1.5);
next.arm_control_r.scale = Vec3::one() * 1.02;
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;
@ -235,10 +232,8 @@ impl Animation for RunAnimation {
next.leg_control_r.scale = Vec3::one() * 1.02;
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(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(
-s_a.foot.0,
@ -265,7 +260,6 @@ impl Animation for RunAnimation {
) / 8.0;
next.torso.orientation =
Quaternion::rotation_x(x_tilt + amplitude * short * 0.1 + speedavg * -0.045);
next.torso.scale = Vec3::one() / 8.0;
next.hold.scale = Vec3::one() * 0.0;
} else {
@ -277,12 +271,10 @@ impl Animation for RunAnimation {
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, 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, s_a.jaw.0, s_a.jaw.1);
next.jaw.orientation = Quaternion::rotation_x(0.0);
@ -300,13 +292,11 @@ impl Animation for RunAnimation {
next.control.position = Vec3::new(0.0, 0.0, 0.0);
next.control.orientation = Quaternion::rotation_z(0.0);
next.control.scale = Vec3::one();
next.main.position = Vec3::new(-5.0, -7.0, 7.0);
next.main.orientation = 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(
-s_a.shoulder.0,
@ -316,7 +306,6 @@ impl Animation for RunAnimation {
next.shoulder_l.orientation = Quaternion::rotation_x(footrotl * -0.36)
* Quaternion::rotation_y(0.1)
* Quaternion::rotation_z(footrotl * 0.3);
next.shoulder_l.scale = Vec3::one();
next.shoulder_r.position = Vec3::new(
s_a.shoulder.0,
@ -326,7 +315,6 @@ impl Animation for RunAnimation {
next.shoulder_r.orientation = Quaternion::rotation_x(footrotr * -0.36)
* Quaternion::rotation_y(-0.1)
* Quaternion::rotation_z(footrotr * -0.3);
next.shoulder_r.scale = Vec3::one();
next.hand_l.position = Vec3::new(
-1.0 + -s_a.hand.0,
@ -377,12 +365,6 @@ impl Animation for RunAnimation {
next.torso.position = Vec3::new(0.0, 0.0, 0.0) / 8.0;
next.torso.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(-0.25);
next.torso.scale = Vec3::one() / 8.0;
next.leg_control_l.scale = Vec3::one() * 1.0;
next.leg_control_r.scale = Vec3::one() * 1.0;
next.arm_control_l.scale = Vec3::one() * 1.0;
next.arm_control_r.scale = Vec3::one() * 1.0;
next.hold.scale = Vec3::one() * 0.0;
}

View File

@ -64,11 +64,9 @@ impl Animation for SpinMeleeAnimation {
next.hand_l.position = Vec3::new(-0.75, -1.0, 2.5);
next.hand_l.orientation =
Quaternion::rotation_x(1.47) * Quaternion::rotation_y(-0.2);
next.hand_l.scale = Vec3::one() * 1.02;
next.hand_r.position = Vec3::new(0.75, -1.5, -0.5);
next.hand_r.orientation =
Quaternion::rotation_x(1.47) * Quaternion::rotation_y(0.3);
next.hand_r.scale = Vec3::one() * 1.02;
next.main.position = Vec3::new(0.0, 5.0, 2.0);
next.main.orientation = Quaternion::rotation_x(-0.1)
* Quaternion::rotation_y(0.0)
@ -142,80 +140,54 @@ impl Animation for SpinMeleeAnimation {
},
Some(ToolKind::Axe(_)) => {
next.hand_l.position = Vec3::new(-0.5, 0.0, 4.0);
next.hand_l.orientation = Quaternion::rotation_x(PI / 2.0)
* Quaternion::rotation_z(0.0)
* Quaternion::rotation_y(PI);
next.hand_l.scale = Vec3::one() * 1.08;
next.hand_l.orientation =
Quaternion::rotation_x(PI / 2.0) * Quaternion::rotation_y(PI);
next.hand_r.position = Vec3::new(0.5, 0.0, -2.5);
next.hand_r.orientation = Quaternion::rotation_x(PI / 2.0)
* Quaternion::rotation_z(0.0)
* Quaternion::rotation_y(0.0);
next.hand_r.scale = Vec3::one() * 1.06;
next.hand_r.orientation = Quaternion::rotation_x(PI / 2.0);
next.main.position = Vec3::new(-0.0, -2.0, -1.0);
next.main.orientation = Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.main.orientation = Quaternion::rotation_x(0.0);
next.control.position = Vec3::new(0.0, 16.0, 3.0);
next.control.orientation = Quaternion::rotation_x(-1.4)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(1.4);
next.control.scale = Vec3::one();
next.control.orientation =
Quaternion::rotation_x(-1.4) * Quaternion::rotation_z(1.4);
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.head.orientation =
Quaternion::rotation_x(-0.15) * Quaternion::rotation_y(0.08);
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);
next.upper_torso.scale = Vec3::one();
next.upper_torso.orientation =
Quaternion::rotation_x(-0.1) * Quaternion::rotation_y(0.3);
next.lower_torso.position = Vec3::new(0.0, 3.0, -2.5);
next.lower_torso.orientation = Quaternion::rotation_z(0.0)
* Quaternion::rotation_x(0.7)
* Quaternion::rotation_y(0.0);
next.lower_torso.scale = Vec3::one();
next.lower_torso.orientation = Quaternion::rotation_x(0.7);
next.torso.position = Vec3::new(
-xshift * (anim_time as f32).min(0.6),
-yshift * (anim_time as f32).min(0.6),
0.0,
) * 1.01;
next.torso.orientation = Quaternion::rotation_z(spin * -16.0)
* Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(0.0);
next.torso.orientation = Quaternion::rotation_z(spin * -16.0);
next.torso.scale = Vec3::one() / 11.0 * 1.01;
if velocity.z.abs() > 0.1 {
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_l.orientation = Quaternion::rotation_x(1.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(-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_l.orientation = Quaternion::rotation_x(0.5 + slowersmooth * 0.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(-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_l.orientation = Quaternion::rotation_x(0.5 + slowersmooth * 0.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();
next.foot_r.orientation = Quaternion::rotation_x(0.5 - slowersmooth * 0.2);
};
},
_ => {},

View File

@ -1,8 +1,9 @@
use super::{super::Animation, CharacterSkeleton, SkeletonAttr};
use super::{
super::{vek::*, Animation},
CharacterSkeleton, SkeletonAttr,
};
use common::comp::item::{Hands, ToolKind};
use std::{f32::consts::PI, ops::Mul};
use super::super::vek::*;
use std::f32::consts::PI;
pub struct EquipAnimation;
@ -17,7 +18,7 @@ impl Animation for EquipAnimation {
#[allow(clippy::approx_constant)] // TODO: Pending review in #587
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(active_tool_kind, second_tool_kind, velocity, global_time): Self::Dependency,
(active_tool_kind, second_tool_kind, velocity, _global_time): Self::Dependency,
anim_time: f64,
rate: &mut f32,
s_a: &SkeletonAttr,
@ -34,48 +35,36 @@ impl Animation for EquipAnimation {
let equip_slow = 1.0 + (anim_time as f32 * 12.0 + PI).cos();
let equip_slowa = 1.0 + (anim_time as f32 * 12.0 + PI / 4.0).cos();
let wave_ultra_slow = (anim_time as f32 * 10.0 + PI).sin();
let wave_ultra_slow_cos = (anim_time as f32 * 30.0 + PI).cos();
let wave = (anim_time as f32 * 16.0).sin();
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.57) * Quaternion::rotation_y(-0.2);
next.hand_l.scale = Vec3::one() * 1.04;
next.hand_r.position = Vec3::new(0.75, -1.5, -5.5);
next.hand_r.orientation =
Quaternion::rotation_x(1.57) * Quaternion::rotation_y(0.3);
next.hand_r.scale = Vec3::one() * 1.05;
next.main.position = Vec3::new(0.0, 0.0, -6.0);
next.main.orientation = Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.main.scale = Vec3::one();
next.control.position =
Vec3::new(-3.0 + equip_slowa * -1.5, -5.0, 12.0 + equip_slow * 1.5);
next.control.orientation =
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
next.control.scale = Vec3::one();
},
Some(ToolKind::Axe(_)) => {
next.hand_l.position = Vec3::new(-4.0, 3.0, 6.0);
next.hand_l.orientation = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_z(3.14 - 0.3)
* Quaternion::rotation_y(-0.8);
next.hand_l.scale = Vec3::one() * 1.08;
next.hand_r.position = Vec3::new(-2.5, 9.0, 4.0);
next.hand_r.orientation = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_z(3.14 - 0.3)
* Quaternion::rotation_y(-0.8);
next.hand_r.scale = Vec3::one() * 1.06;
next.main.position = Vec3::new(-6.0, 10.0, -1.0);
next.main.orientation = Quaternion::rotation_x(1.27)
* Quaternion::rotation_y(-0.3)
* Quaternion::rotation_z(-0.8);
next.main.scale = Vec3::one();
next.control.position = Vec3::new(0.0, 0.0, 0.0);
next.control.orientation =
@ -86,31 +75,25 @@ impl Animation for EquipAnimation {
next.hand_l.position = Vec3::new(-7.0, 5.5, 3.5);
next.hand_l.orientation =
Quaternion::rotation_x(0.0) * Quaternion::rotation_y(0.32);
next.hand_l.scale = Vec3::one() * 1.08;
next.hand_r.position = Vec3::new(8.0, 7.75, 0.0);
next.hand_r.orientation =
Quaternion::rotation_x(0.0) * Quaternion::rotation_y(0.22);
next.hand_r.scale = Vec3::one() * 1.06;
next.main.position = Vec3::new(6.0, 7.0, 0.0);
next.main.orientation =
Quaternion::rotation_y(-1.35) * Quaternion::rotation_z(1.57);
next.main.scale = Vec3::one();
next.control.position =
Vec3::new(-3.0 + equip_slowa * -1.5, -12.0, 12.0 + equip_slow * 1.5);
next.control.orientation =
Quaternion::rotation_x(0.0) * Quaternion::rotation_y(1.35 + 2.5);
next.control.scale = Vec3::one();
},
Some(ToolKind::Staff(_)) | Some(ToolKind::Sceptre(_)) => {
next.hand_l.position = Vec3::new(0.0, 0.0, -4.0);
next.hand_l.orientation =
Quaternion::rotation_x(1.27) * Quaternion::rotation_y(0.0);
next.hand_l.scale = Vec3::one() * 1.05;
next.hand_r.position = Vec3::new(0.0, 0.0, 2.0);
next.hand_r.orientation =
Quaternion::rotation_x(1.57) * Quaternion::rotation_y(0.2);
next.hand_r.scale = Vec3::one() * 1.05;
next.main.position = Vec3::new(0.0, 0.0, 13.2);
next.main.orientation = Quaternion::rotation_y(3.14);
@ -118,18 +101,6 @@ impl Animation for EquipAnimation {
next.control.orientation = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(0.15)
* Quaternion::rotation_z(0.0);
next.control.scale = Vec3::one();
},
Some(ToolKind::Shield(_)) => {
next.hand_l.position = Vec3::new(-6.0, 3.5, 0.0);
next.hand_l.orientation = Quaternion::rotation_x(-0.3);
next.hand_l.scale = Vec3::one() * 1.01;
next.hand_r.position = Vec3::new(-6.0, 3.0, -2.0);
next.hand_r.orientation = Quaternion::rotation_x(-0.3);
next.hand_r.scale = Vec3::one() * 1.01;
next.main.position = Vec3::new(-6.0, 4.5, 0.0);
next.main.orientation = Quaternion::rotation_x(-0.3);
next.main.scale = Vec3::one();
},
Some(ToolKind::Bow(_)) => {
next.hand_l.position = Vec3::new(2.0, 1.5, 0.0);
@ -149,67 +120,25 @@ impl Animation for EquipAnimation {
next.main.scale = Vec3::one();
next.control.position = Vec3::new(-7.0, 6.0, 6.0);
next.control.orientation = Quaternion::rotation_x(wave_ultra_slow * 0.2)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(wave_ultra_slow_cos * 0.1);
next.control.scale = Vec3::one();
},
Some(ToolKind::Dagger(_)) => {
next.main.scale = Vec3::one();
},
Some(ToolKind::Debug(_)) => {
next.hand_l.position = Vec3::new(-7.0, 4.0, 3.0);
next.hand_l.orientation = Quaternion::rotation_x(1.27 + wave * 0.25)
next.control.orientation = Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.hand_l.scale = Vec3::one() * 1.01;
next.hand_r.position = Vec3::new(7.0, 2.5, -1.25);
next.hand_r.orientation =
Quaternion::rotation_x(1.27 + wave * 0.25) * Quaternion::rotation_z(-0.3);
next.hand_r.scale = Vec3::one() * 1.01;
next.main.position = Vec3::new(5.0, 8.75, -2.0);
next.main.orientation = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(-1.27)
* Quaternion::rotation_z(wave * -0.25);
next.main.scale = Vec3::one();
next.control.scale = Vec3::one();
},
_ => {},
}
let head_look = Vec2::new(
((global_time + anim_time) as f32 / 6.0)
.floor()
.mul(7331.0)
.sin()
* 0.2,
((global_time + anim_time) as f32 / 6.0)
.floor()
.mul(1337.0)
.sin()
* 0.1,
);
next.hold.scale = Vec3::one() * 0.0;
if velocity > 0.5 {
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 + 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.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1 + short * 0.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_l.orientation = Quaternion::rotation_x(0.0);
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, s_a.chest.0, s_a.chest.1);
next.belt.position = Vec3::new(0.0, s_a.belt.0, s_a.belt.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) * s_a.scaler;
next.foot_r.orientation = Quaternion::rotation_x(0.0);
}
next.second.scale = match (