swing animation changes

Former-commit-id: 1bc70090e938c12d6e133683932b470be102aecd
This commit is contained in:
jshipsey 2019-05-27 19:03:52 -04:00
parent 5f22c4e26f
commit f9e2828de5
2 changed files with 46 additions and 19 deletions

View File

@ -115,14 +115,13 @@ impl<'a> System<'a> for Sys {
let animation = if on_ground {
if control.move_dir.magnitude() > 0.01 {
Animation::Run
} else if attackings.get(entity).is_some(){
Animation::Attack
} else if attackings.get(entity).is_some() {
Animation::Attack
} else {
Animation::Idle
}
} else if glidings.get(entity).is_some() {
Animation::Gliding
} else {
Animation::Jump
};

View File

@ -27,7 +27,7 @@ impl Animation for AttackAnimation {
let wave_quicken = (1.0 - (anim_time as f32 * 8.0).cos());
let wave_quicken_slow = (1.0 - (anim_time as f32 * 6.0).cos());
let wave_quicken_double = (1.0 - (anim_time as f32 * 12.0).cos());
let wave_quick =(anim_time as f32 * 0.5).sin();
let wave_quick = (anim_time as f32 * 0.5).sin();
let wave_cos = (anim_time as f32 * 12.0).cos();
let wave_slow = (anim_time as f32 * 5.0 + PI).cos();
let wave_slow_cos = (anim_time as f32 * 6.0 + PI).cos();
@ -51,7 +51,9 @@ impl Animation for AttackAnimation {
* 0.25,
);
next.head.offset = Vec3::new(0.0, 2.0, 11.0);
next.head.ori = Quaternion::rotation_z(wave_stop_quick * -0.25) * Quaternion::rotation_x(0.0 + wave_stop_quick * -0.1) * Quaternion::rotation_y(wave_stop_quick * 0.1);
next.head.ori = Quaternion::rotation_z(wave_stop_quick * -0.25)
* Quaternion::rotation_x(0.0 + wave_stop_quick * -0.1)
* Quaternion::rotation_y(wave_stop_quick * 0.1);
next.head.scale = Vec3::one();
next.chest.offset = Vec3::new(0.0, 0.0, 7.0);
@ -66,21 +68,34 @@ impl Animation for AttackAnimation {
next.shorts.ori = Quaternion::rotation_x(0.0);
next.shorts.scale = Vec3::one();
next.l_hand.offset = Vec3::new(-8.0 + wave_quicken_slow * 10.0, 4.0 + wave_quicken_double * 3.0, 9.0) / 11.0;
next.l_hand.ori =
Quaternion::rotation_z(-0.8) * Quaternion::rotation_x(0.0 + wave_quicken * -0.8) * Quaternion::rotation_y(0.0 + wave_quicken * -0.4);
next.l_hand.offset = Vec3::new(
-8.0 + wave_quicken_slow * 10.0,
4.0 + wave_quicken_double * 3.0,
9.0,
) / 11.0;
next.l_hand.ori = Quaternion::rotation_z(-0.8)
* Quaternion::rotation_x(0.0 + wave_quicken * -0.8)
* Quaternion::rotation_y(0.0 + wave_quicken * -0.4);
next.l_hand.scale = Vec3::one() / 11.0;
next.r_hand.offset = Vec3::new(0.0, -2.0, 6.5) / 11.0;
next.r_hand.ori = Quaternion::rotation_x(0.0);
next.r_hand.scale = Vec3::one() *0.0;
next.r_hand.scale = Vec3::one() * 0.0;
next.l_foot.offset = Vec3::new(-3.4, -0.1, 8.0 + wave_quicken * -2.0);
next.l_foot.ori = Quaternion::rotation_x(wave_quicken * -0.6);
next.l_foot.offset = Vec3::new(
-3.4,
-0.1 + wave_stop_quick * 2.0,
8.0 + wave_stop_quick * -4.0,
);
next.l_foot.ori = Quaternion::rotation_x(wave_stop_quick * -1.2);
next.l_foot.scale = Vec3::one();
next.r_foot.offset = Vec3::new(3.4, -0.1, 8.0 + wave_quick * -2.0);
next.r_foot.ori = Quaternion::rotation_x(wave_quicken * 0.6);
next.r_foot.offset = Vec3::new(
3.4,
-0.1 - wave_stop_quick * -2.0,
8.0 + wave_stop_quick * -2.0,
);
next.r_foot.ori = Quaternion::rotation_x(wave_stop_quick * 1.2);
next.r_foot.scale = Vec3::one();
next.weapon.offset = Vec3::new(-7.0, -2.0, 5.0);
@ -99,17 +114,30 @@ impl Animation for AttackAnimation {
next.draw.ori = Quaternion::rotation_y(0.0);
next.draw.scale = Vec3::one() * 0.0;
next.left_equip.offset = Vec3::new(-8.0 + wave_quicken_slow * 10.0, 4.0 + wave_quicken_double * 3.0, 9.0) / 11.0;
next.left_equip.ori =
Quaternion::rotation_z(-0.8) * Quaternion::rotation_x(0.0 + wave_quicken * -0.8) * Quaternion::rotation_y(0.0 + wave_quicken * -0.4);
next.left_equip.offset = Vec3::new(
-8.0 + wave_quicken_slow * 10.0,
4.0 + wave_quicken_double * 3.0,
9.0,
) / 11.0;
next.left_equip.ori = Quaternion::rotation_z(-0.8)
* Quaternion::rotation_x(0.0 + wave_quicken * -0.8)
* Quaternion::rotation_y(0.0 + wave_quicken * -0.4);
next.left_equip.scale = Vec3::one() / 11.0;
next.right_equip.offset =Vec3::new(-8.0 + wave_quicken_slow * 10.0, 4.0 + wave_quicken_double * 3.0, 9.0) / 11.0;
next.right_equip.ori = Quaternion::rotation_z(-0.8) * Quaternion::rotation_x(0.0 + wave_quicken * -0.8) * Quaternion::rotation_y(0.0 + wave_quicken * -0.4);
next.right_equip.offset = Vec3::new(
-8.0 + wave_quicken_slow * 10.0,
4.0 + wave_quicken_double * 3.0,
9.0,
) / 11.0;
next.right_equip.ori = Quaternion::rotation_z(-0.8)
* Quaternion::rotation_x(0.0 + wave_quicken * -0.8)
* Quaternion::rotation_y(0.0 + wave_quicken * -0.4);
next.right_equip.scale = Vec3::one() / 11.0;
next.torso.offset = Vec3::new(0.0, -0.2, 0.1);
next.torso.ori = Quaternion::rotation_z(wave_stop_quick * -0.2) * Quaternion::rotation_x(0.0 + wave_stop_quick * -0.2) * Quaternion::rotation_y(wave_stop_quick * 0.2);
next.torso.ori = Quaternion::rotation_z(wave_stop_quick * -0.2)
* Quaternion::rotation_x(0.0 + wave_stop_quick * -0.2)
* Quaternion::rotation_y(wave_stop_quick * 0.2);
next.torso.scale = Vec3::one() / 11.0;
next
}