anim testing

This commit is contained in:
jshipsey 2022-05-18 01:10:07 -04:00 committed by Sam
parent 4f2b1d37f8
commit 1ae230c194
3 changed files with 64 additions and 13 deletions

View File

@ -32,9 +32,10 @@ impl Animation for ComboAnimation {
) -> Self::Skeleton {
*rate = 1.0;
let mut next = (*skeleton).clone();
next.main_weapon_trail = true;
next.off_weapon_trail = true;
for strike in 0..=current_strike {
let (move1, move2, move3, _move2h) = if strike == current_strike {
let (move1, move2, move3, move2alt) = if strike == current_strike {
match stage_section {
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0, 0.0),
Some(StageSection::Action) => {
@ -48,10 +49,36 @@ impl Animation for ComboAnimation {
};
let pullback = 1.0 - move3;
let move2 = move2 * pullback;
let move2alt = move2alt * pullback;
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_z(0.0);
match ability_id {
Some("common.abilities.sword.balanced_combo") => match strike {
0 => {
next.head.orientation = Quaternion::rotation_x(move1);
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.chest.orientation =
Quaternion::rotation_z(move1 * 0.3 + move2alt * -1.0);
next.head.orientation =
Quaternion::rotation_z(move1 * -0.15 + move2alt * 0.5);
next.belt.orientation =
Quaternion::rotation_z(move1 * -0.2 + move2alt * 0.5);
next.shorts.orientation =
Quaternion::rotation_z(move1 * -0.25 + move2alt * 0.7);
next.hand_r.position =
Vec3::new(-s_a.sc.0 + 6.0 + move1 * -12.0, -4.0 + move1 * 3.0, -2.0);
next.hand_r.orientation = Quaternion::rotation_x(0.9 + move1 * 0.5);
next.control.position = Vec3::new(
s_a.sc.0 + move1 * -3.0 + move2 * 20.0,
s_a.sc.1,
s_a.sc.2 + move1 * 10.0 + move2alt * -10.0,
);
next.control.orientation =
Quaternion::rotation_x(s_a.sc.3 + move2alt * -1.2)
* Quaternion::rotation_y(move1 * -0.9 + move2 * 2.3)
* Quaternion::rotation_z(move2alt * -1.5);
},
1 => {
next.head.orientation.rotate_z(move1);

View File

@ -300,7 +300,7 @@ impl<'a> From<&'a Body> for SkeletonAttr {
lantern: (5.0, 2.5, 5.5),
shl: (-0.75, -1.0, 0.5, 1.47, -0.2, 0.0),
shr: (0.75, -1.5, -2.5, 1.47, 0.3, 0.0),
sc: (-7.0, 7.0, 2.0, -0.1, 0.0, 0.0),
sc: (-6.0, 6.0, 0.0, -0.5, 0.0, 0.0),
hhl: (0.1, 0.0, 11.0, 4.71, 0.0, PI),
hhr: (0.0, 0.0, 0.0, 4.71, 0.0, PI),
hc: (6.0, 7.0, 1.0, -0.3, -PI / 2.0, 3.64),

View File

@ -65,11 +65,11 @@ impl Animation for WieldAnimation {
let shortalt = (anim_time * lab * 16.0 + PI / 2.0).sin();
let slowalt = (anim_time * 6.0 + PI).cos();
let u_slow = (anim_time * 2.5 + PI).sin();
let slow = (anim_time * 5.0 + PI).sin();
let slowalt = (anim_time * 9.0 + PI).cos();
let u_slow = (anim_time * 4.5 + PI).sin();
let slow = (anim_time * 7.0 + PI).sin();
let u_slowalt = (anim_time * 3.0 + PI).cos();
let u_slowalt = (anim_time * 5.0 + PI).cos();
let short = ((5.0 / (1.5 + 3.5 * ((anim_time * lab * 16.0).sin()).powi(2))).sqrt())
* ((anim_time * lab * 16.0).sin());
let direction = velocity.y * -0.098 * orientation.y + velocity.x * -0.098 * orientation.x;
@ -103,11 +103,11 @@ impl Animation for WieldAnimation {
if speed > 0.2 && velocity.z == 0.0 {
next.chest.orientation = Quaternion::rotation_z(short * 0.1 + strafe * 0.7 * speednorm)
* Quaternion::rotation_y(strafe * 0.2)
* Quaternion::rotation_x(((direction * 0.8).min(0.3)) * (1.0 - tilt.abs()));
* Quaternion::rotation_x(((direction * 0.4).min(0.3)) * (1.0 - tilt.abs()));
next.head.orientation =
Quaternion::rotation_z(tilt * -0.5 + strafe * 0.4 * direction + strafe * -0.7)
* Quaternion::rotation_x(
(0.3 - direction * 0.4) * (1.0 - tilt.abs()) + look_dir.z * 0.7,
(0.3 - direction * 0.1) * (1.0 - tilt.abs()) + look_dir.z * 0.7,
);
next.chest.position =
@ -156,14 +156,38 @@ impl Animation for WieldAnimation {
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.hand_r.position = Vec3::new(
foothoril * 1.3 * speednorm - s_a.sc.0 + 6.0,
speednorm + foothoril * -3.0 * speednorm - 4.0,
-1.0 * speednorm - foothoril * 5.5 * speednorm - 2.0,
);
next.hand_r.orientation =
Quaternion::rotation_x(
0.6 * speednorm + (footrotl * -1.2) * speednorm + 0.9,
) * Quaternion::rotation_y(footrotl * -0.4 * speednorm);
next.control.position =
Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2 + direction * -5.0);
next.control.orientation = Quaternion::rotation_x(s_a.sc.3 + u_slow * 0.15)
* Quaternion::rotation_z(u_slowalt * 0.08);
//carried position
/*
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.sc.0+6.0,
-4.0,
-2.0,
);
next.hand_r.orientation =
Quaternion::rotation_x(0.9);
next.control.position =
Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2);
next.control.orientation = Quaternion::rotation_x(s_a.sc.3 )
;
*/
},
Some(ToolKind::Axe) => {
next.main.position = Vec3::new(0.0, 0.0, 0.0);