This commit is contained in:
jshipsey 2021-04-05 17:43:40 -04:00
parent 529f8eb5a6
commit 97528b7954
5 changed files with 401 additions and 223 deletions

View File

@ -97,23 +97,23 @@ impl Animation for AlphaAnimation {
Some(ToolKind::Hammer) | Some(ToolKind::HammerSimple) | Some(ToolKind::Pick) => {
let (move1, move2, move3) = match stage_section {
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
Some(StageSection::Swing) => (1.0, anim_time, 0.0),
Some(StageSection::Swing) => (1.0, anim_time.powf(0.25), 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)),
_ => (0.0, 0.0, 0.0),
};
let pullback = (1.0 - move3);
let moveret1 = move1 * pullback;
let moveret2 = move2 * pullback;
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_x(0.0);
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
next.head.orientation =
Quaternion::rotation_x((move1 * 0.1 + move2 * 0.3) * (1.0 - move3))
* Quaternion::rotation_z((move1 * -0.2 + move2 * 0.2) * (1.0 - move3));
next.chest.position =
Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + move2 * -2.0 * (1.0 - move3));
next.chest.orientation =
Quaternion::rotation_x((move1 * 0.4 + move2 * -0.7) * (1.0 - move3))
* Quaternion::rotation_y((move1 * 0.3 + move2 * -0.4) * (1.0 - move3))
* Quaternion::rotation_z((move1 * 0.5 + move2 * -0.5) * (1.0 - move3));
next.head.orientation = Quaternion::rotation_x((moveret1 * 0.1 + moveret2 * 0.3))
* Quaternion::rotation_z((move1 * -0.2 + moveret2 * 0.2));
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + moveret2 * -2.0);
next.chest.orientation = Quaternion::rotation_x((moveret1 * 0.4 + moveret2 * -0.7))
* Quaternion::rotation_y((moveret1 * 0.3 + moveret2 * -0.4))
* Quaternion::rotation_z((moveret1 * 0.5 + moveret2 * -0.5));
},
Some(ToolKind::Debug) => {
next.hand_l.position = Vec3::new(-7.0, 4.0, 3.0);
@ -173,8 +173,11 @@ impl Animation for AlphaAnimation {
Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)),
_ => (0.0, 0.0, 0.0),
};
let pullback = (1.0 - move3);
let moveret1 = move1 * pullback;
let moveret2 = move2 * pullback;
next.hand_l.position =
Vec3::new(s_a.hhl.0, s_a.hhl.1, s_a.hhl.2 + move2 * -7.0);
Vec3::new(s_a.hhl.0, s_a.hhl.1, s_a.hhl.2 + moveret2 * -7.0);
next.hand_l.orientation =
Quaternion::rotation_x(s_a.hhl.3) * Quaternion::rotation_y(s_a.hhl.4);
next.hand_r.position = Vec3::new(s_a.hhr.0, s_a.hhr.1, s_a.hhr.2);
@ -182,16 +185,14 @@ impl Animation for AlphaAnimation {
Quaternion::rotation_x(s_a.hhr.3) * Quaternion::rotation_y(s_a.hhr.4);
next.control.position = Vec3::new(
s_a.hc.0 + (move1 * -13.0) * (1.0 - move3),
s_a.hc.1 + (move2 * 5.0) * (1.0 - move3),
s_a.hc.2,
s_a.hc.0 + moveret1 * -13.0 + moveret2 * 3.0,
s_a.hc.1 + (moveret2 * 5.0),
s_a.hc.2 + moveret1 * 5.0 + moveret2 * -8.0,
);
next.control.orientation =
Quaternion::rotation_x(s_a.hc.3 + (move1 * 1.5 + move2 * -2.5))
* (1.0 - move3)
* Quaternion::rotation_y(s_a.hc.4 + (move1 * 1.57))
* (1.0 - move3)
* Quaternion::rotation_z(s_a.hc.5 + (move2 * -0.5) * (1.0 - move3));
Quaternion::rotation_x(s_a.hc.3 + (moveret1 * 1.5 + moveret2 * -2.9))
* Quaternion::rotation_y(s_a.hc.4 + moveret1 * 1.57 + moveret2 * 0.5)
* Quaternion::rotation_z(s_a.hc.5 + (moveret2 * -0.5));
},
_ => {},
},
@ -230,7 +231,7 @@ impl Animation for AlphaAnimation {
2.0 + move1 * 16.0 + move2 * -19.0,
);
next.control_l.orientation =
Quaternion::rotation_x(-0.3 + move1 * 1.3 + move2 * -2.3)
Quaternion::rotation_x(-0.3 + move1 * 1.9 + move2 * -3.0)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.hand_l.position = Vec3::new(0.0, -0.5, 0.0);
@ -271,10 +272,10 @@ impl Animation for AlphaAnimation {
next.control_r.position = Vec3::new(
7.0,
8.0 + move1 * -4.0 + move2h * 4.0,
2.0 + move1 * 16.0 + move2h * -21.0,
2.0 + move1 * 12.0 + move2h * -16.0,
);
next.control_r.orientation =
Quaternion::rotation_x(-0.3 + move1 * 1.3 + move2h * -2.3)
Quaternion::rotation_x(-0.3 + move1 * 2.3 + move2h * -3.5)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.hand_r.position = Vec3::new(0.0, -0.5, 0.0);

View File

@ -81,7 +81,7 @@ impl Animation for ChargeswingAnimation {
next.chest.orientation =
Quaternion::rotation_z(short * 0.04 + (move1 * 2.0 + move2 * -3.5));
next.belt.orientation = Quaternion::rotation_z(short * 0.08 + (move1 * -1.0));
next.shorts.orientation = Quaternion::rotation_z(short * 0.15 + (move1 * -1.0));
next.shorts.orientation = Quaternion::rotation_z(short * 0.15 + (move1 * -1.5));
next.head.position = Vec3::new(
0.0 + (move1 * -1.0 + move2 * 2.0),
s_a.head.0 + (move1 * 1.0),
@ -128,14 +128,13 @@ impl Animation for ChargeswingAnimation {
next.control_l.position = Vec3::new(
-7.0 + move1 * 4.0,
8.0 + move1 * 2.0 + move2 * 4.0,
2.0 + move1 * -1.0 + slowrise * 8.0,
2.0 + move1 * -1.0 + slowrise * 20.0,
);
next.control_l.orientation =
Quaternion::rotation_x(-0.3 + move2 * 1.0 + slowrise * -1.5)
* Quaternion::rotation_y(
tension * 0.07 + move1 * -1.2 + slowrise * 0.5,
)
* Quaternion::rotation_z(move2 * 1.0);
next.control_l.orientation = Quaternion::rotation_x(-0.3 + move2 * -1.0)
* Quaternion::rotation_y(
tension * 0.07 + move1 * -1.2 + slowrise * 0.5,
)
* Quaternion::rotation_z(move2 * 1.0);
next.hand_l.position = Vec3::new(0.0, -0.5, 0.0);
next.hand_l.orientation = Quaternion::rotation_x(1.57)
},
@ -152,11 +151,11 @@ impl Animation for ChargeswingAnimation {
next.control_r.position = Vec3::new(
7.0 + move1 * 1.0 + move2 * -20.0,
8.0 + move1 * 1.0 + move2 * 4.0,
2.0 + move1 * -3.0 + slowrise * 8.0,
2.0 + move1 * -3.0 + slowrise * 20.0,
);
next.control_r.orientation = Quaternion::rotation_x(-0.3 + move2 * 1.0)
next.control_r.orientation = Quaternion::rotation_x(-0.3 + move2 * -1.0)
* Quaternion::rotation_y(
tension * -0.07 + move1 * -2.0 + slowrise * 0.5,
tension * -0.07 + move1 * -2.0 + slowrise * 1.5,
)
* Quaternion::rotation_z(move2 * 1.0);
next.hand_r.position = Vec3::new(0.0, -0.5, 0.0);

View File

@ -44,105 +44,209 @@ impl Animation for LeapAnimation {
*rate = 1.0;
let mut next = (*skeleton).clone();
let (move1, move2, move3, move4) = match stage_section {
let (movement1, movement2, movement3, move4) = match stage_section {
Some(StageSection::Buildup) => (anim_time, 0.0, 0.0, 0.0),
Some(StageSection::Movement) => (1.0, anim_time.powf(0.25), 0.0, 0.0),
Some(StageSection::Swing) => (1.0, 1.0, anim_time.powf(0.25), 0.0),
Some(StageSection::Recover) => (1.0, 1.0, 1.0, anim_time),
Some(StageSection::Movement) => (1.0, anim_time.powi(2), 0.0, 0.0),
Some(StageSection::Swing) => (1.0, 1.0, anim_time.powf(0.75), 0.0),
Some(StageSection::Recover) => (1.0, 1.0, 1.0, anim_time.powf(0.75)),
_ => (0.0, 0.0, 0.0, 0.0),
};
let pullback = (1.0 - move4);
let move1 = movement1 * pullback;
let move2 = movement2 * pullback;
let move3 = movement3 * pullback;
if let Some(ToolKind::Hammer) = active_tool_kind {
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(0.0) * Quaternion::rotation_z(0.0);
next.second.position = Vec3::new(0.0, 0.0, 0.0);
next.second.orientation = Quaternion::rotation_z(0.0);
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_z(0.0);
next.torso.position = Vec3::new(0.0, 0.0, 0.1) * s_a.scaler;
next.torso.orientation = Quaternion::rotation_z(0.0);
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
match ability_info.and_then(|a| a.tool) {
Some(ToolKind::Hammer) => {
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
next.control.position = Vec3::new(
s_a.hc.0 + move2 * -10.0 + move3 * 6.0,
s_a.hc.1 + move2 * 5.0 + move3 * 7.0,
s_a.hc.2 + move2 * 5.0 + move3 * -10.0,
);
next.control.orientation =
Quaternion::rotation_x(s_a.hc.3 + move2 * 1.57 + move3 * -2.3)
* Quaternion::rotation_y(s_a.hc.4 + move2 * 1.3)
* Quaternion::rotation_z(s_a.hc.5 + move2 * -1.0 + move3 * 0.5);
next.chest.orientation =
Quaternion::rotation_x(move1 * 0.3 + move2 * 0.3 + move3 * -0.9 + move4 * 0.3)
next.chest.orientation = Quaternion::rotation_x(move2 * 0.4 + move3 * -1.5)
* Quaternion::rotation_z(move1 * 0.5 + move2 * 0.2 + move3 * -0.7);
next.head.orientation = Quaternion::rotation_x(move3 * 0.2)
* Quaternion::rotation_y(0.0 + move2 * -0.1)
* Quaternion::rotation_z(move1 * -0.4 + move2 * -0.2 + move3 * 0.6);
next.head.orientation = Quaternion::rotation_x(move3 * 0.2)
* Quaternion::rotation_y(move2 * -0.1)
* Quaternion::rotation_z(move1 * -0.4 + move2 * -0.2 + move3 * 0.6);
next.foot_l.position = Vec3::new(
-s_a.foot.0,
s_a.foot.1 + move3 * 13.0,
s_a.foot.2 + move3 * -2.0,
);
next.foot_l.orientation = Quaternion::rotation_x(-0.8 + move3 * 1.7);
next.foot_l.position = Vec3::new(
-s_a.foot.0,
s_a.foot.1 + move3 * 13.0,
s_a.foot.2 + move3 * -2.0,
);
next.foot_l.orientation = Quaternion::rotation_x(-0.8 + move3 * 1.7);
next.foot_r.position = Vec3::new(
s_a.foot.0,
s_a.foot.1 + 8.0 + move3 * -13.0,
s_a.foot.2 + 5.0 + move3 * -5.0,
);
next.foot_r.orientation = Quaternion::rotation_x(0.9 + move3 * -1.7);
} else if let Some(ToolKind::Axe) = active_tool_kind {
next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2);
next.hand_l.orientation = Quaternion::rotation_x(s_a.ahl.3);
next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2);
next.hand_r.orientation = Quaternion::rotation_x(s_a.ahr.3);
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_y(0.0) * Quaternion::rotation_z(0.0);
next.foot_r.position = Vec3::new(
s_a.foot.0,
s_a.foot.1 + move2 * 8.0 + move3 * -13.0,
s_a.foot.2 + move2 * 5.0 + move3 * -5.0,
);
next.foot_r.orientation = Quaternion::rotation_x(0.9 + move3 * -1.7);
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + move3 * -5.0);
},
Some(ToolKind::Axe) => {
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
next.torso.orientation =
Quaternion::rotation_x(move1 * 0.4 + move2 * 0.6 + move3 * -1.0)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(move1 * 0.4 + move2 * 0.4);
next.control.position = Vec3::new(
s_a.ac.0 + move1 * 8.0,
s_a.ac.1 + move1 * 4.0 + move3 * 3.0,
s_a.ac.2 + move1 * 6.0 + move2 * 1.0 + move3 * -14.0,
);
next.control.orientation = Quaternion::rotation_x(
s_a.ac.3 + move1 * -2.0 + move2 * 0.7 + move3 * -2.3
) * Quaternion::rotation_y(s_a.ac.4)// + move1 * 0.5)
* Quaternion::rotation_z(s_a.ac.5+move1*PI); // - move1 * 0.2);
next.head.orientation = Quaternion::rotation_x(move2 * -0.6 + move3 * 0.8)
* Quaternion::rotation_z(move2 * -0.4);
next.torso.orientation = Quaternion::rotation_x(
-0.3 + move2 * -1.6 * PI + move2 * -0.3 + move3 * -0.2 * PI + move4 * -0.1 * PI,
) * Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.foot_l.position = Vec3::new(
-s_a.foot.0,
s_a.foot.1 + move2 * -4.0 + move3 * 4.0,
s_a.foot.2 + move2 * 5.0 + move3 * -5.0,
);
next.head.orientation =
Quaternion::rotation_x(0.0 + move1 * -0.4 + move2 * 0.4 + move3 * 0.2);
next.foot_r.position = Vec3::new(
s_a.foot.0,
s_a.foot.1 + move2 * 4.0,
s_a.foot.2 + move3 * -3.0,
);
next.foot_l.position = Vec3::new(
-s_a.foot.0,
s_a.foot.1 + move2 * 4.0 + move3 * -1.0,
s_a.foot.2,
);
next.foot_l.orientation =
Quaternion::rotation_x(move1 * 0.9 - move2 * 1.9 + move3 * 1.8);
next.foot_r.position = Vec3::new(
s_a.foot.0,
s_a.foot.1 + move2 * 4.0 + move3 * -8.0,
s_a.foot.2 + move3 * -3.0,
);
next.foot_r.orientation = Quaternion::rotation_x(move1 * 0.9 - move3 * 1.8);
next.foot_l.orientation =
Quaternion::rotation_x(move1 * 0.9 - move2 * 1.0 + move3 * 1.8);
next.belt.orientation = Quaternion::rotation_x(move1 * 0.22 + move2 * 0.1);
next.shorts.orientation = Quaternion::rotation_x(move1 * 0.3 + move2 * 0.1);
next.foot_r.orientation = Quaternion::rotation_x(move1 * 0.9 - move3 * 1.8);
next.belt.orientation = Quaternion::rotation_x(move1 * 0.22 + move2 * 0.1);
next.shorts.orientation = Quaternion::rotation_x(move1 * 0.3 + move2 * 0.1);
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1);
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1);
},
_ => {},
}
match hands {
(Some(Hands::Two), _) => match ability_info.and_then(|a| a.tool) {
Some(ToolKind::Hammer) => {
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(0.0) * Quaternion::rotation_z(0.0);
next.control.position = Vec3::new(
s_a.hc.0 + move2 * -10.0 + move3 * 10.0,
s_a.hc.1 + move2 * 5.0 + move3 * 7.0,
s_a.hc.2 + move2 * 5.0 + move3 * -10.0,
);
next.control.orientation =
Quaternion::rotation_x(s_a.hc.3 + move2 * 1.57 + move3 * -2.3)
* Quaternion::rotation_y(s_a.hc.4 + move2 * 1.3)
* Quaternion::rotation_z(s_a.hc.5 + move2 * -1.0 + move3 * 0.5);
},
Some(ToolKind::Axe) => {
next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2);
next.hand_l.orientation = Quaternion::rotation_x(s_a.ahl.3);
next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2);
next.hand_r.orientation = Quaternion::rotation_x(s_a.ahr.3);
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation =
Quaternion::rotation_y(0.0) * Quaternion::rotation_z(0.0);
next.control.position = Vec3::new(
s_a.ac.0 + move2 * 8.0 + move3 * 15.0,
s_a.ac.1 + move3 * -10.0,
s_a.ac.2 + move3 * 4.0,
);
next.control.orientation = Quaternion::rotation_x(
s_a.ac.3) * Quaternion::rotation_y(s_a.ac.4+move2*-0.8+move3*-4.0)// + move1 * 0.5)
* Quaternion::rotation_z(s_a.ac.5+move2*-0.6+move3*-1.6); // - move1 * 0.2);
},
_ => {},
},
(_, _) => {},
};
match hands {
(Some(Hands::One), Some(Hands::One)) | (Some(Hands::One), None) => {
match ability_info.and_then(|a| a.tool) {
Some(ToolKind::Axe) => {
next.control_l.position =
Vec3::new(-7.0 + move3 * 4.0, 8.0 + move3 * 8.0, 2.0 + move3 * -4.0);
next.control_l.orientation =
Quaternion::rotation_x(-0.3 + move2 * 1.0 + move3 * -2.0)
* Quaternion::rotation_y(move2 * -0.5 + move3 * 1.9);
next.hand_l.position = Vec3::new(0.0, -0.5, 0.0);
next.hand_l.orientation = Quaternion::rotation_x(1.57)
},
Some(ToolKind::Hammer)
| Some(ToolKind::HammerSimple)
| Some(ToolKind::Pick) => {
next.control_l.position = Vec3::new(
-7.0,
8.0 + move2 * -5.0 + move3 * 9.0,
2.0 + move2 * 8.0 + move3 * -12.0,
);
next.control_l.orientation =
Quaternion::rotation_x(-0.3 + move2 * 1.5 + move3 * -2.5);
next.hand_l.position = Vec3::new(0.0, -0.5, 0.0);
next.hand_l.orientation = Quaternion::rotation_x(1.57)
},
_ => {},
}
},
(_, _) => {},
};
match hands {
(Some(Hands::One), Some(Hands::One)) | (None, Some(Hands::One)) => {
match ability_info.and_then(|a| a.tool) {
Some(ToolKind::Axe) => {
next.control_r.position = Vec3::new(
7.0 + move2 * 2.0,
8.0 + move2 * -8.0 + move3 * 13.0,
2.0 + move2 * 7.0 + move3 * -10.0,
);
next.control_r.orientation = Quaternion::rotation_x(-0.3 + move3 * -2.2)
* Quaternion::rotation_y(move2 * -0.5 + move3 * 1.2);
next.hand_r.position = Vec3::new(0.0, -0.5, 0.0);
next.hand_r.orientation = Quaternion::rotation_x(1.57)
},
Some(ToolKind::Hammer)
| Some(ToolKind::HammerSimple)
| Some(ToolKind::Pick) => {
next.control_r.position = Vec3::new(
7.0 + move2 * 3.0 + move3 * -3.0,
8.0 + move2 * -9.0 + move3 * 15.0,
2.0 + move2 * 11.0 + move3 * -18.0,
);
next.control_r.orientation =
Quaternion::rotation_x(-0.3 + move2 * 1.5 + move3 * -2.5)
* Quaternion::rotation_y(move2 * -0.75 + move3 * 0.75);
next.hand_r.position = Vec3::new(0.0, -0.5, 0.0);
next.hand_r.orientation = Quaternion::rotation_x(1.57)
},
_ => {},
}
},
(_, _) => {},
};
match hands {
(None, None) | (None, Some(Hands::One)) => {
next.hand_l.position = Vec3::new(-4.5, 8.0, 5.0);
next.hand_l.orientation = Quaternion::rotation_x(1.9) * Quaternion::rotation_y(-0.5)
},
(_, _) => {},
};
match hands {
(None, None) | (Some(Hands::One), None) => {
next.hand_r.position = Vec3::new(4.5, 8.0, 5.0);
next.hand_r.orientation = Quaternion::rotation_x(1.9) * Quaternion::rotation_y(0.5)
},
(_, _) => {},
};
next
}
}

View File

@ -43,104 +43,171 @@ impl Animation for SpinMeleeAnimation {
s_a: &SkeletonAttr,
) -> Self::Skeleton {
*rate = 1.0;
let (move1, move2, move3) = match stage_section {
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
let (movement1, movement2, movement3) = match stage_section {
Some(StageSection::Buildup) => (anim_time, 0.0, 0.0),
Some(StageSection::Swing) => (1.0, anim_time, 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time.powf(4.0)),
Some(StageSection::Recover) => (1.0, 1.0, anim_time.powf(2.0)),
_ => (0.0, 0.0, 0.0),
};
let pullback = (1.0 - movement3);
let move1 = movement1 * pullback;
let move2 = movement2 * pullback;
let mut next = (*skeleton).clone();
match active_tool_kind {
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_z(0.0);
next.second.position = Vec3::new(0.0, 0.0, 0.0);
next.second.orientation = Quaternion::rotation_z(0.0);
match ability_info.and_then(|a| a.tool) {
Some(ToolKind::Sword) => {
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_x(0.0);
next.torso.orientation = Quaternion::rotation_z(movement2 * PI * 2.0);
next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2);
next.hand_l.orientation =
Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4);
next.hand_r.position = Vec3::new(s_a.shr.0, s_a.shr.1, s_a.shr.2);
next.hand_r.orientation =
Quaternion::rotation_x(s_a.shr.3) * Quaternion::rotation_y(s_a.shr.4);
next.control.position = Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2 + move1 * 2.0);
next.control.orientation =
Quaternion::rotation_x(s_a.sc.3 + move1 * -PI / 2.5 + move3 * PI / 2.0)
* Quaternion::rotation_z(s_a.sc.5 + move1 * -PI / 2.0 + move3 * PI / 2.0);
next.torso.orientation = Quaternion::rotation_z(move2 * PI * 2.0);
next.chest.position =
Vec3::new(0.0, s_a.chest.0 + move1 * -2.0, s_a.chest.1 + move1 * -3.0);
next.chest.orientation = Quaternion::rotation_x(move1 * -0.3)
* Quaternion::rotation_y(move1 * 0.15 + move3 * -0.15);
next.chest.position = Vec3::new(
0.0,
s_a.chest.0 + move1 * -2.0,
s_a.chest.1 + move1 * -2.0 + move2 * 2.0,
);
next.chest.orientation = Quaternion::rotation_x(move1 * -0.3);
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
next.head.orientation = Quaternion::rotation_x(move1 * 0.2 + move3 * 0.15)
* Quaternion::rotation_z(move2 * 0.8 + move3 * -0.6);
next.belt.orientation = Quaternion::rotation_x(0.1);
next.shorts.orientation = Quaternion::rotation_x(0.2);
next.head.orientation =
Quaternion::rotation_x(move1 * 0.2) * Quaternion::rotation_z(move2 * 0.8);
next.belt.orientation = Quaternion::rotation_x(move1 * 0.5);
next.shorts.orientation = Quaternion::rotation_x(move1 * 0.4);
next.belt.position = Vec3::new(0.0, s_a.belt.0, s_a.belt.1 + move1 * 0.0);
next.belt.orientation = Quaternion::rotation_x(0.15);
next.shorts.position =
Vec3::new(0.0, s_a.shorts.0 + move1 * 2.0, s_a.shorts.1 + move1 * 1.0);
next.foot_r.position = Vec3::new(s_a.foot.0, s_a.foot.1 + move1 * -6.0, s_a.foot.2);
next.foot_r.orientation = Quaternion::rotation_x(move1 * -1.0);
},
Some(ToolKind::Axe) => {
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_x(0.0);
next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2);
next.hand_l.orientation =
Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4);
next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2);
next.hand_r.orientation =
Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5);
next.control.position =
Vec3::new(s_a.ac.0 + move1 * 8.0, s_a.ac.1, s_a.ac.2 + move1 * -4.0);
next.control.orientation =
Quaternion::rotation_x(s_a.ac.3 + move1 * -0.8 * (1.0 - move3))
* Quaternion::rotation_y(s_a.ac.4 + move1 * -PI * (1.0 - move3))
* Quaternion::rotation_z(s_a.ac.5 + move1 * 1.2 * (1.0 - move3));
next.head.orientation = Quaternion::rotation_x(move1 * -0.2 * (1.0 - move3))
* Quaternion::rotation_z(move1 * 0.4 * (1.0 - move3));
next.head.orientation =
Quaternion::rotation_x(move1 * -0.2) * Quaternion::rotation_z(move1 * 0.4);
next.head.position = Vec3::new(0.0, s_a.head.0 + move1 * 2.0, s_a.head.1);
next.chest.position =
Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + move1 * -1.0 * (1.0 - move3));
next.chest.orientation = Quaternion::rotation_x(move1 * 0.3 * (1.0 - move3))
* Quaternion::rotation_y(move1 * 0.3 * (1.0 - move3));
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + move1 * -1.0);
next.chest.orientation =
Quaternion::rotation_x(move1 * 0.3) * Quaternion::rotation_y(move1 * 0.3);
next.belt.position = Vec3::new(
0.0,
1.0 + s_a.belt.0,
s_a.belt.1 + move1 * 0.5 * (1.0 - move3),
);
next.belt.position = Vec3::new(0.0, 1.0 + s_a.belt.0, s_a.belt.1 + move1 * 0.5);
next.belt.orientation = Quaternion::rotation_x(0.15);
next.shorts.position = Vec3::new(
0.0,
1.0 + s_a.shorts.0 + move1 * 1.0 * (1.0 - move3),
s_a.shorts.1 + move1 * 1.0 * (1.0 - move3),
1.0 + s_a.shorts.0 + move1 * 1.0,
s_a.shorts.1 + move1 * 1.0,
);
next.shorts.orientation =
Quaternion::rotation_x(0.15 + 0.15 * move1 * (1.0 - move3));
next.shorts.orientation = Quaternion::rotation_x(0.15 + 0.15 * move1);
next.torso.orientation =
Quaternion::rotation_z(move1 * 1.0 * (1.0 - move3) + move2 * -2.0 * PI);
Quaternion::rotation_z(movement1 * -0.5 + movement2 * -6.78);
next.foot_l.position = Vec3::new(
-s_a.foot.0,
s_a.foot.1 + move1 * 7.0 * (1.0 - move3),
s_a.foot.2,
);
next.foot_l.orientation = Quaternion::rotation_x(move1 * 0.8 * (1.0 - move3));
next.foot_l.position = Vec3::new(-s_a.foot.0, s_a.foot.1 + move1 * 7.0, s_a.foot.2);
next.foot_l.orientation = Quaternion::rotation_x(move1 * 0.8);
next.foot_r.position = Vec3::new(
s_a.foot.0,
s_a.foot.1 + move1 * -3.0 * (1.0 - move3),
s_a.foot.2,
);
next.foot_r.orientation = Quaternion::rotation_x(move1 * -0.5 * (1.0 - move3));
next.foot_r.position = Vec3::new(s_a.foot.0, s_a.foot.1 + move1 * -3.0, s_a.foot.2);
next.foot_r.orientation = Quaternion::rotation_x(move1 * -0.5);
},
_ => {},
}
match hands {
(Some(Hands::Two), _) => match ability_info.and_then(|a| a.tool) {
Some(ToolKind::Sword) => {
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_x(0.0);
next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2);
next.hand_l.orientation =
Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4);
next.hand_r.position = Vec3::new(s_a.shr.0, s_a.shr.1, s_a.shr.2);
next.hand_r.orientation =
Quaternion::rotation_x(s_a.shr.3) * Quaternion::rotation_y(s_a.shr.4);
next.control.position = Vec3::new(
s_a.sc.0,
s_a.sc.1 + move1 * 4.0,
s_a.sc.2 + move1 * 2.0 + move2 * 10.0,
);
next.control.orientation = Quaternion::rotation_x(s_a.sc.3 + move1 * -PI / 2.5)
* Quaternion::rotation_z(s_a.sc.5 + move1 * -PI / 2.0);
},
Some(ToolKind::Axe) => {
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_x(0.0);
next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2);
next.hand_l.orientation =
Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4);
next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2);
next.hand_r.orientation =
Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5);
next.control.position =
Vec3::new(s_a.ac.0 + move1 * 8.0, s_a.ac.1, s_a.ac.2 + move1 * -4.0);
next.control.orientation =
Quaternion::rotation_x(s_a.ac.3 + move1 * -1.0 + move2 * 0.4)
* Quaternion::rotation_y(s_a.ac.4 + move1 * -PI)
* Quaternion::rotation_z(s_a.ac.5 + move1 * 1.4);
},
_ => {},
},
(_, _) => {},
};
match hands {
(Some(Hands::One), Some(Hands::One)) | (Some(Hands::One), None) => {
match ability_info.and_then(|a| a.tool) {
Some(ToolKind::Sword) => {
next.control_l.position = Vec3::new(-7.0, 8.0, 2.0);
next.control_l.orientation = Quaternion::rotation_x(-0.3 + move1 * -1.2);
next.hand_l.position = Vec3::new(0.0, -0.5, 0.0);
next.hand_l.orientation = Quaternion::rotation_x(1.57)
},
Some(ToolKind::Axe) => {
next.control_l.position = Vec3::new(-7.0, 8.0, 2.0);
next.control_l.orientation = Quaternion::rotation_x(-0.3 + move1 * -1.2);
next.hand_l.position = Vec3::new(0.0, -0.5, 0.0);
next.hand_l.orientation = Quaternion::rotation_x(1.57)
},
_ => {},
}
},
(_, _) => {},
};
match hands {
(Some(Hands::One), Some(Hands::One)) | (None, Some(Hands::One)) => {
match ability_info.and_then(|a| a.tool) {
Some(ToolKind::Sword) => {
next.control_r.position = Vec3::new(7.0, 8.0, 2.0);
next.control_r.orientation = Quaternion::rotation_x(-0.3 + move1 * -1.2);
next.hand_r.position = Vec3::new(0.0, -0.5, 0.0);
next.hand_r.orientation = Quaternion::rotation_x(1.57)
},
Some(ToolKind::Axe) => {
next.control_r.position = Vec3::new(7.0, 8.0, 2.0);
next.control_r.orientation = Quaternion::rotation_x(-0.3 + move1 * -1.2);
next.hand_r.position = Vec3::new(0.0, -0.5, 0.0);
next.hand_r.orientation = Quaternion::rotation_x(1.57)
},
_ => {},
}
},
(_, _) => {},
};
match hands {
(None, None) | (None, Some(Hands::One)) => {
next.hand_l.position = Vec3::new(-4.5, 8.0, 5.0);
next.hand_l.orientation = Quaternion::rotation_x(1.9) * Quaternion::rotation_y(-0.5)
},
(_, _) => {},
};
match hands {
(None, None) | (Some(Hands::One), None) => {
next.hand_r.position = Vec3::new(4.5, 8.0, 5.0);
next.hand_r.orientation = Quaternion::rotation_x(1.9) * Quaternion::rotation_y(0.5)
},
(_, _) => {},
};
next
}
}

View File

@ -94,48 +94,55 @@ impl Animation for StandAnimation {
next.glider.position = Vec3::new(0.0, 0.0, 10.0);
next.glider.scale = Vec3::one() * 0.0;
next.hold.position = Vec3::new(0.4, -0.3, -5.8);
match active_tool_kind {
Some(ToolKind::Dagger) => {
next.main.position = Vec3::new(-4.0, -5.0, 7.0);
next.main.orientation =
Quaternion::rotation_y(0.25 * PI) * Quaternion::rotation_z(1.5 * PI);
match hands {
(Some(Hands::Two), _) => match active_tool_kind {
Some(ToolKind::Bow) => {
next.main.position = Vec3::new(0.0, -5.0, 6.0);
next.main.orientation =
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
},
Some(ToolKind::Staff) | Some(ToolKind::Sceptre) => {
next.main.position = Vec3::new(2.0, -5.0, -1.0);
next.main.orientation =
Quaternion::rotation_y(-0.5) * Quaternion::rotation_z(1.57);
},
_ => {
next.main.position = Vec3::new(-7.0, -5.0, 15.0);
next.main.orientation =
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
},
_ => {},
},
Some(ToolKind::Shield) => {
next.main.position = Vec3::new(-0.0, -5.0, 3.0);
next.main.orientation =
Quaternion::rotation_y(0.25 * PI) * Quaternion::rotation_z(-1.5 * PI);
},
Some(ToolKind::Bow) => {
next.main.position = Vec3::new(0.0, -5.0, 6.0);
next.main.orientation = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
},
Some(ToolKind::Staff) | Some(ToolKind::Sceptre) => {
next.main.position = Vec3::new(2.0, -5.0, -1.0);
next.main.orientation = Quaternion::rotation_y(-0.5) * Quaternion::rotation_z(1.57);
},
_ => {
next.main.position = Vec3::new(-7.0, -5.0, 15.0);
next.main.orientation = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
},
}
(_, _) => {},
};
match second_tool_kind {
Some(ToolKind::Dagger) => {
next.second.position = Vec3::new(4.0, -6.0, 7.0);
next.second.orientation =
Quaternion::rotation_y(-0.25 * PI) * Quaternion::rotation_z(-1.5 * PI);
match hands {
(Some(Hands::One), Some(Hands::One)) | (Some(Hands::One), None) => {
match active_tool_kind {
Some(ToolKind::Axe) | Some(ToolKind::Hammer) | Some(ToolKind::Sword) => {
next.main.position = Vec3::new(-4.0, -5.0, 10.0);
next.main.orientation =
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
},
_ => {},
}
},
Some(ToolKind::Shield) => {
next.second.position = Vec3::new(0.0, -4.0, 3.0);
next.second.orientation =
Quaternion::rotation_y(-0.25 * PI) * Quaternion::rotation_z(1.5 * PI);
(_, _) => {},
};
match hands {
(Some(Hands::One), Some(Hands::One)) | (None, Some(Hands::One)) => {
match second_tool_kind {
Some(ToolKind::Axe) | Some(ToolKind::Hammer) | Some(ToolKind::Sword) => {
next.second.position = Vec3::new(4.0, -5.5, 10.0);
next.second.orientation =
Quaternion::rotation_y(-2.5) * Quaternion::rotation_z(1.57);
},
_ => {},
}
},
_ => {
next.second.position = Vec3::new(-7.0, -5.0, 15.0);
next.second.orientation =
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
},
}
(_, _) => {},
};
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);