Axe MeleeLeap character animation

This commit is contained in:
Snowram 2020-10-03 16:33:09 +02:00 committed by jiminycrick
parent 521ffd64ba
commit 697ea80665

View File

@ -34,21 +34,6 @@ impl Animation for LeapAnimation {
*rate = 1.0;
let mut next = (*skeleton).clone();
let lab = 1.0;
// Spin stuff here
let foot = (((5.0)
/ (1.1 + 3.9 * ((anim_time as f32 * lab as f32 * 10.32).sin()).powf(2.0 as f32)))
.sqrt())
* ((anim_time as f32 * lab as f32 * 10.32).sin());
let decel = (anim_time as f32 * 16.0 * lab as f32).min(PI / 2.0).sin();
let spin = (anim_time as f32 * 2.8 * lab as f32).sin();
let spinhalf = (anim_time as f32 * 1.4 * lab as f32).sin();
// end spin stuff
let movement = (anim_time as f32 * 1.0).min(1.0);
if let Some(ToolKind::Hammer(_)) = active_tool_kind {
@ -162,93 +147,144 @@ impl Animation for LeapAnimation {
}
}
} else if let Some(ToolKind::Axe(_)) = active_tool_kind {
//INTENTION: SWORD
next.l_hand.position = Vec3::new(-0.75, -1.0, -2.5);
next.l_hand.orientation = Quaternion::rotation_x(1.27);
next.l_hand.scale = Vec3::one() * 1.04;
next.r_hand.position = Vec3::new(0.75, -1.5, -5.5);
next.r_hand.orientation = Quaternion::rotation_x(1.27);
next.r_hand.scale = Vec3::one() * 1.05;
//next.main.position = Vec3::new(0.0, 0.0, 10.0);
next.main.position = Vec3::new(0.0, 0.0, -5.0);
next.main.orientation = Quaternion::rotation_x(1.6)
next.l_hand.position = Vec3::new(-0.5, 0.0, 4.0);
next.l_hand.orientation = Quaternion::rotation_x(PI / 2.0)
* Quaternion::rotation_z(0.0)
* Quaternion::rotation_y(0.0);
next.l_hand.scale = Vec3::one() * 1.08;
next.r_hand.position = Vec3::new(0.5, 0.0, -2.5);
next.r_hand.orientation = Quaternion::rotation_x(PI / 2.0)
* Quaternion::rotation_z(0.0)
* Quaternion::rotation_y(0.0);
next.r_hand.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.4);
next.main.scale = Vec3::one();
* Quaternion::rotation_z(0.0);
next.control.position = Vec3::new(-4.5 + spinhalf * 4.0, 11.0, 8.0);
next.control.orientation = Quaternion::rotation_x(0.6 + spinhalf * -3.3)
* Quaternion::rotation_y(0.2 + spin * -2.0)
* Quaternion::rotation_z(1.4 + spin * 0.1);
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.control.scale = Vec3::one();
next.head.position = Vec3::new(
0.0,
-2.0 + skeleton_attr.head.0 + spin * -0.8,
skeleton_attr.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.orientation = Quaternion::rotation_z(spin * 0.1)
* Quaternion::rotation_x(0.0 + spin * 0.1)
* Quaternion::rotation_y(decel * -0.2);
next.chest.scale = Vec3::one();
next.belt.position = Vec3::new(0.0, 0.0, -2.0);
next.belt.orientation = next.chest.orientation * -0.1;
next.belt.scale = Vec3::one();
next.head.position = Vec3::new(0.0, -2.0 + skeleton_attr.head.0, skeleton_attr.head.1);
next.shorts.position = Vec3::new(0.0, 0.0, -5.0);
next.belt.orientation = next.chest.orientation * -0.08;
next.shorts.scale = Vec3::one();
next.torso.position = Vec3::new(0.0, 0.0, 0.1) * skeleton_attr.scaler;
next.torso.orientation = Quaternion::rotation_z((spin * 7.0).max(0.3))
* Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(0.3);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
if let Some(stage_section) = stage_section {
match stage_section {
StageSection::Buildup => {
next.control.position = Vec3::new(
- 10.0 + movement * 5.0,
11.0 + movement * - 26.0,
3.0 + movement * 6.0
);
next.control.orientation = Quaternion::rotation_x(1.8 + movement * -1.4)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(PI);
next.chest.orientation = Quaternion::rotation_x(movement * -0.3)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(movement * 0.5);
// Stuff after the branch in the spin animation file
next.head.orientation = Quaternion::rotation_x(0.0 + movement * -0.4)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(movement * -0.4);
next.l_foot.position =
Vec3::new(-skeleton_attr.foot.0, foot * 1.0, skeleton_attr.foot.2);
next.l_foot.orientation = Quaternion::rotation_x(foot * -1.2);
next.l_foot.scale = Vec3::one();
next.r_foot.position = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1 + 8.0 - movement * 6.0,
skeleton_attr.foot.2 + 6.0 - movement * 6.0,
);
next.r_foot.orientation = Quaternion::rotation_x(0.6 + movement * -0.4);
next.r_foot.position =
Vec3::new(skeleton_attr.foot.0, foot * -1.0, skeleton_attr.foot.2);
next.r_foot.orientation = Quaternion::rotation_x(foot * 1.2);
next.r_foot.scale = Vec3::one();
next.belt.orientation = Quaternion::rotation_x(movement * 0.22);
next.shorts.orientation = Quaternion::rotation_x(movement * 0.3);
},
next.l_shoulder.position = Vec3::new(-5.0, 0.0, 4.7);
next.l_shoulder.orientation = Quaternion::rotation_x(0.0);
next.l_shoulder.scale = Vec3::one() * 1.1;
StageSection::Movement => {
next.control.position = Vec3::new(
0.0,
-15.0 + movement * 5.0, //11
9.0 - movement * 5.0,
);
next.control.orientation = Quaternion::rotation_x(0.4)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(PI);
next.chest.orientation = Quaternion::rotation_x((-0.3 + movement * 6.0).min(0.3))
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.head.orientation = Quaternion::rotation_x(-0.4 + movement * 0.4)
* Quaternion::rotation_y(movement * -0.1)
* Quaternion::rotation_z(movement * 0.4);
next.r_shoulder.position = Vec3::new(5.0, 0.0, 4.7);
next.r_shoulder.orientation = Quaternion::rotation_x(0.0);
next.r_shoulder.scale = Vec3::one() * 1.1;
next.l_foot.position = Vec3::new(
- skeleton_attr.foot.0,
skeleton_attr.foot.1 + 8.0,
skeleton_attr.foot.2 + 5.0,
);
next.l_foot.orientation = Quaternion::rotation_x(0.9);
next.glider.position = Vec3::new(0.0, 5.0, 0.0);
next.glider.orientation = Quaternion::rotation_y(0.0);
next.glider.scale = Vec3::one() * 0.0;
next.r_foot.position = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1 + 8.0,
skeleton_attr.foot.2 + 5.0,
);
next.r_foot.orientation = Quaternion::rotation_x(0.9);
next.lantern.position = Vec3::new(
skeleton_attr.lantern.0,
skeleton_attr.lantern.1,
skeleton_attr.lantern.2,
);
next.lantern.orientation =
Quaternion::rotation_x(spin * -0.7 + 0.4) * Quaternion::rotation_y(spin * 0.4);
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.orientation = Quaternion::rotation_x(movement * - 1.8 * PI);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
next.l_control.position = Vec3::new(0.0, 0.0, 0.0);
next.l_control.orientation = Quaternion::rotation_x(0.0);
next.l_control.scale = Vec3::one();
next.belt.orientation = Quaternion::rotation_x(0.22 + movement * 0.1);
next.shorts.orientation = Quaternion::rotation_x(0.3 + movement * 0.1);
},
StageSection::Swing => {
next.control.position =
Vec3::new(0.0, 12.0 + movement * 8.0, 6.0 + movement * -6.0);
next.control.orientation = Quaternion::rotation_x(0.3 + movement * -3.0)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(PI);
next.chest.orientation = Quaternion::rotation_x(0.6 + movement * -0.9)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.7 + movement * -0.7);
next.head.orientation = Quaternion::rotation_x(movement * 0.2)
* Quaternion::rotation_y(-0.1)
* Quaternion::rotation_z(-0.6 + movement * 0.6);
next.r_control.position = Vec3::new(0.0, 0.0, 0.0);
next.r_control.orientation = Quaternion::rotation_x(0.0);
next.r_control.scale = Vec3::one();
next.l_hand.position = Vec3::new(-12.0 + movement * 8.0, 0.0, 0.0);
next.l_foot.position = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1 + 8.0,
skeleton_attr.foot.2 - 5.0,
);
next.l_foot.orientation = Quaternion::rotation_x(0.9);
next.r_foot.position = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1 - 5.0,
skeleton_attr.foot.2,
);
next.r_foot.orientation = Quaternion::rotation_x(-0.8);
next.torso.orientation = Quaternion::rotation_x(-1.9 * PI - movement * 0.3 * PI);
},
StageSection::Recover => {
next.control.position = Vec3::new(-4.0, 20.0, 0.0);
next.control.orientation = Quaternion::rotation_x(-2.7)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(PI);
next.chest.orientation = Quaternion::rotation_x(-0.3 + movement * 0.3)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.head.orientation = Quaternion::rotation_x(0.2)
* Quaternion::rotation_y(-0.1)
* Quaternion::rotation_z(0.0);
next.l_hand.position = Vec3::new(-2.0, 0.0, 0.0);
},
_ => {},
}
}
}
//next.lantern.position = Vec3::new(