Fix animations regressions for biped_large

This commit is contained in:
Snowram 2020-11-04 01:13:46 +01:00 committed by Robin Gilh
parent fb1aae22dd
commit a6d5d87bbc
10 changed files with 63 additions and 111 deletions

Binary file not shown.

View File

@ -88,14 +88,15 @@ impl Animation for AlphaAnimation {
);
},
Some(ToolKind::Hammer(_)) => {
next.hand_l.position = Vec3::new(-12.0, 0.0, 0.0);
next.hand_l.position = Vec3::new(-12.0, 0.0, 10.0);
next.hand_l.orientation =
Quaternion::rotation_x(-0.0) * Quaternion::rotation_y(0.0);
next.hand_r.position = Vec3::new(3.0, 0.0, 0.0);
next.hand_r.orientation = Quaternion::rotation_x(0.0) * Quaternion::rotation_y(0.0);
Quaternion::rotation_x(0.0) * Quaternion::rotation_z(-2.0);
next.hand_r.position = Vec3::new(3.0, 0.0, 10.0);
next.hand_r.orientation =
Quaternion::rotation_x(0.0) * Quaternion::rotation_z(-2.0);
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation =
Quaternion::rotation_y(-1.57) * Quaternion::rotation_z(1.57);
Quaternion::rotation_y(-1.57) * Quaternion::rotation_z(-1.87);
next.head.orientation = Quaternion::rotation_z(slower * 0.03)
* Quaternion::rotation_x(slowersmooth * 0.1)

View File

@ -39,12 +39,14 @@ impl Animation for BeamAnimation {
_ => (0.0, 0.0, 0.0),
};
next.hand_l.position = Vec3::new(0.0, 0.0, -4.0);
next.hand_l.orientation = Quaternion::rotation_x(1.27) * Quaternion::rotation_y(0.0);
next.hand_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_l.position = Vec3::new(s_a.sthl.0, s_a.sthl.1, s_a.sthl.2);
next.hand_l.orientation =
Quaternion::rotation_x(s_a.sthl.3) * Quaternion::rotation_y(s_a.sthl.4);
next.hand_r.position = Vec3::new(s_a.sthr.0, s_a.sthr.1, s_a.sthl.2);
next.hand_r.orientation =
Quaternion::rotation_x(s_a.sthr.3) * Quaternion::rotation_y(s_a.sthr.4);
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_y(0.0);
next.main.orientation = Quaternion::rotation_x(0.0);
next.control.position = Vec3::new(-4.0, 7.0, 4.0);
next.control.orientation = Quaternion::rotation_x(-0.3)
@ -54,9 +56,9 @@ impl Animation for BeamAnimation {
match active_tool_kind {
Some(ToolKind::Staff(_)) | Some(ToolKind::Sceptre(_)) => {
next.control.position = Vec3::new(
s_a.stc.0 + (movement1 * 16.0) * (1.0 - movement3),
s_a.stc.0 + (movement1 * 26.0) * (1.0 - movement3),
s_a.stc.1 + (movement1 + (movement2 * 8.0).sin() * 2.0) * (1.0 - movement3),
s_a.stc.2 + (movement1 * 10.0) * (1.0 - movement3),
s_a.stc.2 + (movement1 * 16.0) * (1.0 - movement3),
);
next.control.orientation =
Quaternion::rotation_x(s_a.stc.3 + (movement1 * -1.2) * (1.0 - movement3))
@ -77,7 +79,7 @@ impl Animation for BeamAnimation {
+ (movement2 * 8.0).sin() * -2.0
+ (movement2 * 16.0).sin() * -1.5)
* (1.0 - movement3),
-4.0 + (movement1 * 19.0 + (movement2 * 8.0 + PI / 2.0).sin() * 3.5)
0.0 + (movement1 * 19.0 + (movement2 * 8.0 + PI / 2.0).sin() * 3.5)
* (1.0 - movement3),
);
next.hand_l.orientation =
@ -101,9 +103,9 @@ impl Animation for BeamAnimation {
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)
* Quaternion::rotation_z(movement1 * 0.5);
next.lower_torso.orientation = Quaternion::rotation_x(movement1 * 0.2)
Quaternion::rotation_x(movement1 * -0.2 + (movement2 * 8.0).sin() * 0.01)
* Quaternion::rotation_z(movement1 * 0.1);
next.lower_torso.orientation = Quaternion::rotation_x(movement1 * 0.05)
* Quaternion::rotation_z(movement1 * -0.2);
} else {
};

View File

@ -50,7 +50,7 @@ impl Animation for BetaAnimation {
next.control.position = Vec3::new(
s_a.sc.0 + (-1.4 + movement1 * -3.0 + movement2 * -2.0) * (1.0 - movement3),
s_a.sc.1 + (-1.4 + movement1 * 3.0 + movement2 * 3.0) * (1.0 - movement3),
s_a.sc.2 + (-1.9 + movement1 * 2.5 * (1.0 - movement3)),
s_a.sc.2 + (10.9 + movement1 * 2.5 * (1.0 - movement3)),
);
next.control.orientation = Quaternion::rotation_x(s_a.sc.3 + (-1.7) * (1.0 - movement3))
* Quaternion::rotation_y(

View File

@ -82,9 +82,9 @@ impl Animation for DashAnimation {
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_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);
next.control.position = Vec3::new(
-7.0 + movement1 * -5.0 + movement3 * -2.0,

View File

@ -34,20 +34,24 @@ impl Animation for EquipAnimation {
match active_tool_kind {
Some(ToolKind::Sword(_)) => {
next.hand_l.position = Vec3::new(-8.0, -5.0, 17.0);
next.hand_r.position = Vec3::new(-6.0, -4.5, 14.0);
next.hand_l.position = Vec3::new(-18.0, -8.0, -1.0);
next.hand_r.position = Vec3::new(-16.0, -7.5, -4.0);
},
Some(ToolKind::Axe(_)) => {
next.hand_l.position = Vec3::new(-7.0, -5.0, 17.0);
next.hand_r.position = Vec3::new(-5.0, -4.5, 14.0);
},
Some(ToolKind::Hammer(_)) => {
next.hand_l.position = Vec3::new(-5.0 - 10.0, -5.0, 3.0);
next.hand_r.position = Vec3::new(-3.0 - 10.0, -4.5, 0.0);
next.hand_l.position = Vec3::new(-15.0, -7.0, 3.0);
next.hand_r.position = Vec3::new(-13.0, -6.5, 0.0);
},
Some(ToolKind::Staff(_)) | Some(ToolKind::Sceptre(_)) => {
next.hand_l.position = Vec3::new(-3.0, -5.0, 8.0);
next.hand_r.position = Vec3::new(-1.75, -4.5, 5.0);
next.hand_l.position = Vec3::new(4.0, -6.0, 0.0);
next.hand_r.position = Vec3::new(6.0, -6.0, 6.0);
next.hand_l.orientation =
Quaternion::rotation_y(2.2) * Quaternion::rotation_z(1.57);
next.hand_r.orientation =
Quaternion::rotation_y(2.2) * Quaternion::rotation_z(-1.57);
},
Some(ToolKind::Bow(_)) => {
next.hand_l.position = Vec3::new(-3.0, -5.0, 9.0);

View File

@ -3,7 +3,6 @@ use super::{
BipedLargeSkeleton, SkeletonAttr,
};
use common::{comp::item::ToolKind, states::utils::StageSection};
use std::f32::consts::PI;
pub struct LeapAnimation;
impl Animation for LeapAnimation {
@ -33,47 +32,46 @@ impl Animation for LeapAnimation {
let (movement1, movement2, movement3, movement4) = match stage_section {
Some(StageSection::Buildup) => (anim_time as f32, 0.0, 0.0, 0.0),
Some(StageSection::Movement) => (1.0, anim_time as f32, 0.0, 0.0),
Some(StageSection::Swing) => (1.0, 1.0, anim_time as f32, 0.0),
Some(StageSection::Movement) => (1.0, (anim_time as f32).powf(0.25), 0.0, 0.0),
Some(StageSection::Swing) => (1.0, 1.0, (anim_time as f32).powf(0.25), 0.0),
Some(StageSection::Recover) => (1.0, 1.0, 1.0, anim_time as f32),
_ => (0.0, 0.0, 0.0, 0.0),
};
if let Some(ToolKind::Hammer(_)) = active_tool_kind {
next.hand_l.position = Vec3::new(-12.0, 0.0, 0.0);
next.hand_l.orientation = Quaternion::rotation_x(PI) * Quaternion::rotation_y(0.0);
next.hand_l.scale = Vec3::one() * 1.04;
next.hand_r.position = Vec3::new(2.0, 0.0, 0.0);
next.hand_r.orientation = Quaternion::rotation_x(PI) * Quaternion::rotation_y(0.0);
next.hand_r.scale = Vec3::one() * 1.04;
next.hand_l.position = Vec3::new(s_a.hhl.0, s_a.hhl.1, s_a.hhl.2);
next.hand_l.orientation = Quaternion::rotation_x(s_a.hhl.3);
next.hand_r.position = Vec3::new(s_a.hhr.0, s_a.hhr.1, s_a.hhr.2);
next.hand_r.orientation = Quaternion::rotation_x(s_a.hhr.3);
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_y(-1.57) * Quaternion::rotation_z(1.57);
next.main.orientation = Quaternion::rotation_y(0.0) * Quaternion::rotation_z(0.0);
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,
7.0 + movement2 * 5.0 + movement3 * 5.0,
1.0 + movement2 * 5.0 + movement3 * -7.0,
s_a.hc.0 + movement2 * -10.0 + movement3 * 6.0,
s_a.hc.1 + movement2 * 5.0 + movement3 * 7.0,
s_a.hc.2 + movement2 * 5.0 + movement3 * -10.0,
);
next.control.orientation = Quaternion::rotation_x(0.3 + movement3 * -3.0)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(movement1 * 0.5 + movement2 * 0.5 + movement3 * 0.5);
next.upper_torso.orientation = Quaternion::rotation_x(
movement1 * 0.3 + movement2 * 0.3 + movement3 * -0.9 + movement4 * 0.3,
) * Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(movement1 * 0.5 + movement2 * 0.2 + movement3 * -0.7);
next.control.orientation =
Quaternion::rotation_x(s_a.hc.3 + movement2 * 1.57 + movement3 * -2.3)
* Quaternion::rotation_y(s_a.hc.4 + movement2 * 1.3)
* Quaternion::rotation_z(s_a.hc.5 + movement2 * -1.0 + movement3 * 0.5);
next.upper_torso.orientation =
Quaternion::rotation_x(
movement1 * 0.3 + movement2 * 0.3 + movement3 * -0.9 + movement4 * 0.3,
) * Quaternion::rotation_z(movement1 * 0.5 + movement2 * 0.2 + movement3 * -0.7);
next.head.orientation = Quaternion::rotation_x(movement3 * 0.2)
* Quaternion::rotation_y(0.0 + movement2 * -0.1)
* Quaternion::rotation_z(movement1 * -0.4 + movement2 * -0.2 + movement3 * 0.6);
next.hand_l.position = Vec3::new(-12.0 + movement3 * 10.0, 0.0, 0.0);
//next.hand_l.position = Vec3::new(-12.0 + movement3 * 10.0, 0.0, 0.0);
next.foot_l.position = Vec3::new(
-s_a.foot.0,
s_a.foot.1 - 5.0 + movement3 * 13.0,
s_a.foot.2 + movement3 * -5.0,
s_a.foot.1 + movement3 * 13.0,
s_a.foot.2 + movement3 * -2.0,
);
next.foot_l.orientation = Quaternion::rotation_x(-0.8 + movement3 * 1.7);
@ -83,59 +81,6 @@ impl Animation for LeapAnimation {
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 {
next.hand_l.position = Vec3::new(-0.5, 0.0, 4.0);
next.hand_l.orientation = Quaternion::rotation_x(PI / 2.0);
next.hand_r.position = Vec3::new(0.5, 0.0, -2.5);
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);
next.control.position = Vec3::new(-3.0, 11.0, 3.0);
next.control.orientation = Quaternion::rotation_x(1.8)
* Quaternion::rotation_y(-0.5)
* Quaternion::rotation_z(PI - 0.2);
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,
11.0 + movement1 * 1.0 + movement3 * 3.0,
3.0 + movement1 * 12.0 + movement3 * -15.0,
);
next.control.orientation = Quaternion::rotation_x(
1.8 + movement1 * -1.0 + movement2 * -0.5 + movement3 * -1.0,
) * Quaternion::rotation_y(-0.5 + movement1 * 0.5)
* Quaternion::rotation_z(PI + 0.2 - movement1 * 0.2);
next.torso.orientation = Quaternion::rotation_x(
-0.3 + movement2 * -1.8 * PI + movement3 * -0.2 * PI + movement4 * -0.1 * PI,
) * Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.head.orientation =
Quaternion::rotation_x(0.0 + movement1 * -0.4 + movement2 * 0.4 + movement3 * 0.2);
next.foot_l.position = Vec3::new(
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(
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.upper_torso.position = Vec3::new(0.0, s_a.upper_torso.0, s_a.upper_torso.1 - 8.0);
}
next

View File

@ -302,19 +302,19 @@ impl<'a> From<&'a Body> for SkeletonAttr {
(_, _) => (-7.0, 7.0, -10.0, -0.1, 0.0, 0.0),
},
hhl: match (body.species, body.body_type) {
(Ogre, Male) => (-6.0, -10.0, 17.0, 1.57, -0.57, 0.0),
(Ogre, Male) => (-9.0, -10.0, 23.0, 1.57, -0.57, 0.0),
(Cyclops, _) => (-6.0, -10.0, 17.0, 1.57, -0.57, 0.0),
(Troll, _) => (-6.0, -10.0, 17.0, 1.57, -0.57, 0.0),
(_, _) => (-6.0, -10.0, 17.0, 1.57, -0.57, 0.0),
},
hhr: match (body.species, body.body_type) {
(Ogre, Male) => (-6.0, -10.0, 0.0, 1.57, -0.57, 0.0),
(Ogre, Male) => (-5.0, -13.0, 0.0, 1.57, -0.57, 0.0),
(Cyclops, _) => (-6.0, -10.0, 0.0, 1.57, -0.57, 0.0),
(Troll, _) => (-6.0, -10.0, 0.0, 1.57, -0.57, 0.0),
(_, _) => (-6.0, -10.0, 0.0, 1.57, -0.57, 0.0),
},
hc: match (body.species, body.body_type) {
(Ogre, Male) => (8.5, 6.0, -12.0, -0.57, -1.57, 1.0),
(Ogre, Male) => (11.5, 9.0, -13.0, -0.57, -1.57, 1.0),
(Cyclops, _) => (8.5, 6.0, -12.0, -0.57, -1.57, 1.0),
(Troll, _) => (8.5, 6.0, -12.0, -0.57, -1.57, 1.0),
(_, _) => (8.5, 6.0, -12.0, -0.57, -1.57, 1.0),
@ -330,7 +330,7 @@ impl<'a> From<&'a Body> for SkeletonAttr {
(_, _) => (17.0, 7.5, 2.0, 1.57, 0.8, 0.0),
},
stc: match (body.species, body.body_type) {
(Ogre, Female) => (-10.0, 1.0, -18.0, -0.3, 0.15, 0.0),
(Ogre, Female) => (-10.0, 7.0, -23.0, -0.3, 0.15, 0.0),
(Occultsaurok, _) => (-10.0, 7.0, -22.0, -0.3, 0.15, 0.0),
(_, _) => (-18.0, 1.0, -2.0, -0.3, 0.15, 0.0),
},

View File

@ -57,7 +57,7 @@ impl Animation for ShockwaveAnimation {
next.control.position = Vec3::new(
s_a.stc.0 + movement1 * 5.0 + movement3 * -5.0,
s_a.stc.1 + movement1 * 3.0 + movement3 * -3.0,
s_a.stc.1 + movement1 * 13.0 + movement3 * -3.0,
s_a.stc.2 + movement1 * 10.0 + movement2 * -2.0 + movement3 * -8.0,
);
next.control.orientation = Quaternion::rotation_x(

View File

@ -64,8 +64,8 @@ impl Animation for SpinAnimation {
next.control.position = Vec3::new(
s_a.sc.0 + movement1 * 2.0 + movement2 * -4.0 + movement3 * -7.0,
s_a.sc.1 + 8.0 + movement1 * 0.6 + movement3 * -10.0,
s_a.sc.2 + 1.0 + movement1 * 0.6 + movement2 * 1.5 + movement3 * -4.0,
s_a.sc.1 + 0.0 + movement1 * 0.6 + movement3 * -10.0,
s_a.sc.2 + 5.0 + movement1 * 0.6 + movement2 * 1.5 + movement3 * -4.0,
);
next.control.orientation = Quaternion::rotation_x(-0.5 + s_a.sc.3 + movement1 * -1.2)
* Quaternion::rotation_y(s_a.sc.4 - 0.6 + movement1 * 1.0)