Animation for offensive combo

This commit is contained in:
Sam 2022-08-07 21:19:29 -04:00
parent a64895d8c5
commit 1e959706a5
2 changed files with 173 additions and 68 deletions

View File

@ -12,7 +12,7 @@ ComboMelee2(
angle: 45.0,
),
buildup_duration: 0.3,
swing_duration: 0.1,
swing_duration: 0.2,
hit_timing: 0.5,
recover_duration: 0.5,
ori_modifier: 0.6,
@ -29,7 +29,7 @@ ComboMelee2(
angle: 45.0,
),
buildup_duration: 0.3,
swing_duration: 0.1,
swing_duration: 0.2,
hit_timing: 0.5,
recover_duration: 0.3,
ori_modifier: 0.6,
@ -45,15 +45,15 @@ ComboMelee2(
range: 3.0,
angle: 45.0,
),
buildup_duration: 0.2,
swing_duration: 0.05,
buildup_duration: 0.25,
swing_duration: 0.3,
hit_timing: 0.5,
recover_duration: 0.1,
ori_modifier: 0.6,
),
],
is_stance: true,
energy_cost_per_strike: 5,
energy_cost_per_strike: 0,
meta: (
kind: Some(Sword(Offensive)),
),

View File

@ -32,73 +32,178 @@ 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, 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) => {
(1.0, anim_time.powi(2), 0.0, anim_time.powf(0.25))
},
Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4), 1.0),
_ => (0.0, 0.0, 0.0, 0.0),
}
} else {
(1.0, 1.0, 0.0, 1.0)
};
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.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.chest
.orientation
.rotate_z(move1 * -0.2 + move2alt * 1.4);
next.head
.orientation
.rotate_z(move1 * 0.1 + move2alt * -0.4);
next.belt
.orientation
.rotate_z(move1 * 0.1 + move2alt * -0.4);
next.shorts
.orientation
.rotate_z(move1 * 0.2 + move2alt * -0.8);
next.control.position += Vec3::new(move2 * -25.0, 0.0, move2 * 10.0);
next.control.orientation.rotate_x(move2alt * 0.4);
next.control.orientation.rotate_y(move2 * -0.6);
next.control.orientation.rotate_z(move2alt * 3.0);
},
_ => {},
Some("common.abilities.sword.balanced_combo") => {
next.main_weapon_trail = true;
next.off_weapon_trail = true;
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) => {
(1.0, anim_time.powi(2), 0.0, anim_time.powf(0.25))
},
Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4), 1.0),
_ => (0.0, 0.0, 0.0, 0.0),
}
} else {
(1.0, 1.0, 0.0, 1.0)
};
let pullback = 1.0 - move3;
let move2 = move2 * pullback;
let move2alt = move2alt * pullback;
match strike {
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.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.chest
.orientation
.rotate_z(move1 * -0.2 + move2alt * 1.4);
next.head
.orientation
.rotate_z(move1 * 0.1 + move2alt * -0.4);
next.belt
.orientation
.rotate_z(move1 * 0.1 + move2alt * -0.4);
next.shorts
.orientation
.rotate_z(move1 * 0.2 + move2alt * -0.8);
next.control.position += Vec3::new(move2 * -25.0, 0.0, move2 * 10.0);
next.control.orientation.rotate_x(move2alt * 0.4);
next.control.orientation.rotate_y(move2 * -0.6);
next.control.orientation.rotate_z(move2alt * 3.0);
},
_ => {},
}
},
Some("common.abilities.sword.offensive_combo") => {
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) => {
(1.0, anim_time.powi(2), 0.0, anim_time.powf(0.25))
},
Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4), 1.0),
_ => (0.0, 0.0, 0.0, 0.0),
}
} else {
(1.0, 1.0, 0.0, 1.0)
};
if move2 > 0.0 {
next.main_weapon_trail = true;
} else {
next.main_weapon_trail = false;
}
match strike {
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.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 * 13.0,
s_a.sc.1 - move1 * 3.0,
s_a.sc.2 + move1 * 9.0,
);
next.control.orientation =
Quaternion::rotation_x(s_a.sc.3 + move1 * 0.5)
* Quaternion::rotation_y(move1 * 1.4)
* Quaternion::rotation_z(0.0);
next.chest.orientation = Quaternion::rotation_z(move1 * -0.6);
next.head.orientation = Quaternion::rotation_z(move1 * 0.35);
next.belt.orientation = Quaternion::rotation_z(move1 * 0.25);
next.shorts.orientation = Quaternion::rotation_z(move1 * 0.4);
next.chest.orientation.rotate_z(move2 * 1.1);
next.head.orientation.rotate_z(move2 * -0.75);
next.belt.orientation.rotate_z(move2 * -0.6);
next.shorts.orientation.rotate_z(move2 * -0.8);
next.control.orientation.rotate_z(move2 * 2.9);
next.control.position += Vec3::new(
move2 * -16.0,
(1.0 - (move2 - 0.6)).abs() * 6.0,
move2 * -6.0,
);
},
1 => {
next.chest.orientation.rotate_z(move1 * -0.15);
next.head.orientation.rotate_z(move1 * 0.12);
next.belt.orientation.rotate_z(move1 * 0.08);
next.shorts.orientation.rotate_z(move1 * 0.12);
next.control.orientation.rotate_z(move1 * 0.2);
next.control.orientation.rotate_x(move1 * PI);
next.control.orientation.rotate_y(move1 * 0.05);
next.chest.orientation.rotate_z(move2 * -0.9);
next.head.orientation.rotate_z(move2 * 0.65);
next.belt.orientation.rotate_z(move2 * 0.45);
next.shorts.orientation.rotate_z(move2 * 0.7);
next.control.orientation.rotate_z(move2 * -3.0);
next.control.orientation.rotate_y(move2 * -0.4);
next.control.position += Vec3::new(move2 * 17.0, 0.0, move2 * 6.0);
},
2 => {
next.chest.orientation.rotate_z(move1 * 0.5);
next.chest.orientation.rotate_x(move1 * 0.2);
next.head.orientation.rotate_z(move1 * -0.4);
next.belt.orientation.rotate_z(move1 * -0.1);
next.shorts.orientation.rotate_z(move1 * -0.45);
next.control.orientation.rotate_z(move1 * -0.2);
next.control.orientation.rotate_y(move1 * -1.4);
next.control.orientation.rotate_z(move1 * 0.15);
next.control.orientation.rotate_x(move1 * 0.5);
next.control.position += Vec3::new(
move1 * -8.0,
(move1 - 0.5).max(0.0) * -10.0,
move1.powi(3) * 16.0,
);
next.foot_l.position += Vec3::new(0.0, move1 * 3.0, move1 * 3.0);
next.foot_l.orientation.rotate_x(move1 * 0.2);
next.foot_l.orientation.rotate_x(move2 * -0.2);
next.foot_l.position += Vec3::new(0.0, 0.0, move2 * -3.0);
next.chest.orientation.rotate_x(move2 * -0.5);
next.control.orientation.rotate_x(move2 * -2.3);
next.control.position += Vec3::new(0.0, move2 * 16.0, move2 * -25.0);
},
_ => {},
}
},
_ => {},
}