mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Character animation restructuring
This commit is contained in:
parent
a168ea8dcd
commit
4ef1be08ec
@ -1,458 +0,0 @@
|
||||
use super::{
|
||||
super::{vek::*, Animation},
|
||||
dual_wield_start, hammer_start, twist_back, twist_forward, CharacterSkeleton, SkeletonAttr,
|
||||
};
|
||||
use common::{
|
||||
comp::item::{Hands, ToolKind},
|
||||
states::utils::{AbilityInfo, StageSection},
|
||||
};
|
||||
use core::f32::consts::PI;
|
||||
|
||||
pub struct AlphaAnimation;
|
||||
|
||||
type AlphaAnimationDependency<'a> = (
|
||||
Option<&'a str>,
|
||||
(Option<Hands>, Option<Hands>),
|
||||
Option<StageSection>,
|
||||
Option<AbilityInfo>,
|
||||
);
|
||||
impl Animation for AlphaAnimation {
|
||||
type Dependency<'a> = AlphaAnimationDependency<'a>;
|
||||
type Skeleton = CharacterSkeleton;
|
||||
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const UPDATE_FN: &'static [u8] = b"character_alpha\0";
|
||||
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_alpha")]
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
(ability_id, hands, stage_section, ability_info): Self::Dependency<'_>,
|
||||
anim_time: f32,
|
||||
rate: &mut f32,
|
||||
s_a: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
*rate = 1.0;
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
if matches!(stage_section, Some(StageSection::Action)) {
|
||||
next.main_weapon_trail = true;
|
||||
next.off_weapon_trail = true;
|
||||
}
|
||||
|
||||
match ability_id {
|
||||
Some("common.abilities.hammer.solid_smash") => {
|
||||
hammer_start(&mut next, s_a);
|
||||
let (move1, move2, move3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time, 0.0, 0.0),
|
||||
Some(StageSection::Action) => (1.0, anim_time, 0.0),
|
||||
Some(StageSection::Recover) => (1.0, 1.0, anim_time),
|
||||
_ => (0.0, 0.0, 0.0),
|
||||
};
|
||||
let pullback = 1.0 - move3;
|
||||
let move1 = move1 * pullback;
|
||||
let move2 = move2 * pullback;
|
||||
|
||||
next.control.orientation.rotate_x(move1 * 2.7);
|
||||
next.control.orientation.rotate_z(move1 * 1.4);
|
||||
next.control.position += Vec3::new(-12.0, 0.0, 0.0) * move1;
|
||||
next.control.orientation.rotate_x(move1 * -1.2);
|
||||
twist_back(&mut next, move1, 0.8, 0.3, 0.1, 0.5);
|
||||
|
||||
twist_forward(&mut next, move2, 1.4, 0.5, 0.3, 1.0);
|
||||
next.control.orientation.rotate_x(move2 * -1.9);
|
||||
next.control.orientation.rotate_z(move2 * 0.6);
|
||||
},
|
||||
Some("common.abilities.hammer.scornful_swipe") => {
|
||||
hammer_start(&mut next, s_a);
|
||||
let (move1, move2, move3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time, 0.0, 0.0),
|
||||
Some(StageSection::Action) => (1.0, anim_time, 0.0),
|
||||
Some(StageSection::Recover) => (1.0, 1.0, anim_time),
|
||||
_ => (0.0, 0.0, 0.0),
|
||||
};
|
||||
let pullback = 1.0 - move3;
|
||||
let move1 = move1 * pullback;
|
||||
let move2 = move2 * pullback;
|
||||
let move1_pre = move1.min(0.5) * 2.0;
|
||||
let move1_shake = ((move1.max(0.3) - 0.3) * 15.0).sin();
|
||||
let move1_late = move1.powi(4);
|
||||
|
||||
next.control.orientation.rotate_x(move1_pre * 2.3);
|
||||
next.control.position += Vec3::new(0.0, 2.0, 16.0) * move1_pre;
|
||||
next.control.position += Vec3::new(0.0, 0.0, 4.0) * move1_shake;
|
||||
next.control.orientation.rotate_y(move1_late * 1.6);
|
||||
next.control.position += Vec3::new(-8.0, 0.0, -8.0) * move1_late;
|
||||
twist_back(&mut next, move1_late, 1.0, 0.4, 0.2, 0.7);
|
||||
next.control.orientation.rotate_z(move1_late * 1.2);
|
||||
|
||||
twist_forward(&mut next, move2, 1.9, 0.9, 0.6, 1.1);
|
||||
next.control.orientation.rotate_y(move2 * -1.7);
|
||||
next.control.orientation.rotate_z(move2 * -2.7);
|
||||
},
|
||||
Some("common.abilities.hammer.heavy_whorl") => {
|
||||
hammer_start(&mut next, s_a);
|
||||
let (move1, move2, move3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time, 0.0, 0.0),
|
||||
Some(StageSection::Action) => (1.0, anim_time, 0.0),
|
||||
Some(StageSection::Recover) => (1.0, 1.0, anim_time),
|
||||
_ => (0.0, 0.0, 0.0),
|
||||
};
|
||||
let pullback = 1.0 - move3;
|
||||
let move1 = move1 * pullback;
|
||||
let move2base = move2;
|
||||
let move2 = move2 * pullback;
|
||||
|
||||
twist_back(&mut next, move1, 2.0, 0.8, 0.4, 1.4);
|
||||
next.control.orientation.rotate_x(move1 * 0.6);
|
||||
|
||||
next.torso.orientation.rotate_z(move2base * -2.0 * PI);
|
||||
twist_forward(&mut next, move2, 3.4, 1.2, 0.8, 1.8);
|
||||
next.control.orientation.rotate_z(move2 * -2.3);
|
||||
next.control.position += Vec3::new(6.0, 0.0, 6.0) * move2;
|
||||
},
|
||||
Some("common.abilities.hammer.dual_heavy_whorl") => {
|
||||
dual_wield_start(&mut next);
|
||||
let (move1, move2, move3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time, 0.0, 0.0),
|
||||
Some(StageSection::Action) => (1.0, anim_time, 0.0),
|
||||
Some(StageSection::Recover) => (1.0, 1.0, anim_time),
|
||||
_ => (0.0, 0.0, 0.0),
|
||||
};
|
||||
let pullback = 1.0 - move3;
|
||||
let move1 = move1 * pullback;
|
||||
let move2base = move2;
|
||||
let move2 = move2 * pullback;
|
||||
|
||||
twist_back(&mut next, move1, 2.0, 0.8, 0.4, 1.4);
|
||||
next.control_l.orientation.rotate_y(move1 * -PI / 2.0);
|
||||
next.control_r.orientation.rotate_y(move1 * -PI / 2.0);
|
||||
next.control.position += Vec3::new(0.0, 0.0, 4.0) * move1;
|
||||
|
||||
next.torso.orientation.rotate_z(move2base * -2.0 * PI);
|
||||
twist_forward(&mut next, move2, 3.4, 1.2, 0.8, 1.8);
|
||||
next.control_l.orientation.rotate_z(move2 * -2.3);
|
||||
next.control_r.orientation.rotate_z(move2 * -2.3);
|
||||
},
|
||||
Some("common.abilities.hammer.breach") => {
|
||||
hammer_start(&mut next, s_a);
|
||||
let (move1, move2, move3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time, 0.0, 0.0),
|
||||
Some(StageSection::Action) => (1.0, anim_time, 0.0),
|
||||
Some(StageSection::Recover) => (1.0, 1.0, anim_time),
|
||||
_ => (0.0, 0.0, 0.0),
|
||||
};
|
||||
let pullback = 1.0 - move3;
|
||||
let move1 = move1 * pullback;
|
||||
let move2 = move2 * pullback;
|
||||
|
||||
next.control.orientation.rotate_x(move1 * 2.5);
|
||||
next.control.orientation.rotate_z(move1 * -4.8);
|
||||
next.control.position += Vec3::new(-12.0, 0.0, 22.0) * move1;
|
||||
twist_back(&mut next, move1, 0.6, 0.2, 0.0, 0.3);
|
||||
|
||||
twist_forward(&mut next, move2, 1.6, 0.4, 0.2, 0.7);
|
||||
next.control.orientation.rotate_x(move2 * -4.5);
|
||||
next.control.position += Vec3::new(0.0, 0.0, -20.0) * move2;
|
||||
},
|
||||
Some("common.abilities.hammer.pile_driver") => {
|
||||
hammer_start(&mut next, s_a);
|
||||
let (move1, move2, move3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time, 0.0, 0.0),
|
||||
Some(StageSection::Action) => (1.0, anim_time, 0.0),
|
||||
Some(StageSection::Recover) => (1.0, 1.0, anim_time),
|
||||
_ => (0.0, 0.0, 0.0),
|
||||
};
|
||||
let pullback = 1.0 - move3;
|
||||
let shake = (move1 * 15.0).sin();
|
||||
let move1 = (move1 * 2.0).min(1.0) * pullback;
|
||||
let move2 = move2 * pullback;
|
||||
|
||||
twist_back(&mut next, move1, 0.9, 0.3, 0.1, 0.5);
|
||||
next.control.orientation.rotate_x(move1 * 2.4);
|
||||
next.control.position += Vec3::new(-14.0, 0.0, 14.0) * move1;
|
||||
next.control.orientation.rotate_z(move1 * 1.8);
|
||||
|
||||
next.control.orientation.rotate_x(shake * 0.15);
|
||||
|
||||
twist_forward(&mut next, move2, 1.6, 0.5, 0.2, 0.9);
|
||||
next.control.orientation.rotate_x(move2 * -4.0);
|
||||
next.control.orientation.rotate_z(move2 * 0.4);
|
||||
next.control.position += Vec3::new(0.0, 0.0, -12.0) * move2;
|
||||
},
|
||||
Some("common.abilities.hammer.upheaval") => {
|
||||
hammer_start(&mut next, s_a);
|
||||
let (move1, move2, move3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time, 0.0, 0.0),
|
||||
Some(StageSection::Action) => (1.0, anim_time, 0.0),
|
||||
Some(StageSection::Recover) => (1.0, 1.0, anim_time),
|
||||
_ => (0.0, 0.0, 0.0),
|
||||
};
|
||||
let pullback = 1.0 - move3;
|
||||
let move1base = move1;
|
||||
let move1 = move1 * pullback;
|
||||
let move2base = move2;
|
||||
let move2 = move2 * pullback;
|
||||
let move1_twist = move1 * (move1 * PI * 1.5).sin();
|
||||
|
||||
twist_forward(&mut next, move1_twist, 0.8, 0.3, 0.0, 0.4);
|
||||
let angle1 = 5.0;
|
||||
let angle2 = 4.0;
|
||||
next.control
|
||||
.orientation
|
||||
.rotate_x(move1base * (2.0 - angle1) + move2base * (2.0 - angle2));
|
||||
next.control.orientation.rotate_y(move1 * -0.8);
|
||||
next.control
|
||||
.orientation
|
||||
.rotate_x(move1base * angle1 + move2base * angle2);
|
||||
next.control.orientation.rotate_z(move1 * 1.0);
|
||||
next.control.orientation.rotate_x(move2 * 6.0);
|
||||
next.control.orientation.rotate_z(move2 * -0.6);
|
||||
next.control.position += Vec3::new(-16.0, 0.0, 0.0) * move1;
|
||||
next.control.position += Vec3::new(12.0, 0.0, 10.0) * move2;
|
||||
twist_forward(&mut next, move2, 1.0, 0.9, 0.4, 1.1);
|
||||
},
|
||||
Some("common.abilities.hammer.dual_upheaval") => {
|
||||
dual_wield_start(&mut next);
|
||||
let (move1, move2, move3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time, 0.0, 0.0),
|
||||
Some(StageSection::Action) => (1.0, anim_time, 0.0),
|
||||
Some(StageSection::Recover) => (1.0, 1.0, anim_time),
|
||||
_ => (0.0, 0.0, 0.0),
|
||||
};
|
||||
let pullback = 1.0 - move3;
|
||||
let move1base = move1;
|
||||
let move1_return = (3.0 * move1).sin();
|
||||
let move1 = move1 * pullback;
|
||||
let move2base = move2;
|
||||
let move2 = move2 * pullback;
|
||||
|
||||
next.control.orientation.rotate_x(4.0 * move1base);
|
||||
next.control_l.orientation.rotate_z(move1 * 0.6);
|
||||
next.control_r.orientation.rotate_z(move1 * -0.6);
|
||||
next.control.position += Vec3::new(0.0, 6.0, 8.0) * move1_return;
|
||||
next.control.orientation.rotate_x(3.5 * move2base);
|
||||
next.control_l.orientation.rotate_z(move2 * -1.4);
|
||||
next.control_r.orientation.rotate_z(move2 * 1.4);
|
||||
next.control.position += Vec3::new(0.0, 12.0, 10.0) * move2;
|
||||
},
|
||||
_ => {
|
||||
let (move1, move2, _move3, move2h) = 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),
|
||||
};
|
||||
|
||||
next.main.position = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.main.orientation = Quaternion::rotation_x(0.0);
|
||||
next.second.position = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.second.orientation = Quaternion::rotation_z(0.0);
|
||||
next.torso.position = Vec3::new(0.0, 0.0, 1.1);
|
||||
next.torso.orientation = Quaternion::rotation_z(0.0);
|
||||
|
||||
match ability_info.and_then(|a| a.tool) {
|
||||
Some(ToolKind::Dagger) => {
|
||||
next.main.position = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.main.orientation = Quaternion::rotation_x(0.0);
|
||||
|
||||
next.chest.orientation = Quaternion::rotation_z(move1 * 1.1 + move2 * -2.0);
|
||||
|
||||
next.head.position = Vec3::new(0.0 + move2 * 2.0, s_a.head.0, s_a.head.1);
|
||||
next.head.orientation = Quaternion::rotation_z(move1 * -0.9 + move2 * 1.8);
|
||||
},
|
||||
|
||||
Some(ToolKind::Pick | ToolKind::Shovel) => {
|
||||
let (move1, move2, move3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
|
||||
Some(StageSection::Action) => (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.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
|
||||
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);
|
||||
next.hand_l.orientation = Quaternion::rotation_x(1.27);
|
||||
next.main.position = Vec3::new(-5.0, 5.0, 23.0);
|
||||
next.main.orientation = Quaternion::rotation_x(PI);
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
|
||||
match hands {
|
||||
(Some(Hands::Two), _) | (None, Some(Hands::Two)) => {
|
||||
match ability_info.and_then(|a| a.tool) {
|
||||
Some(ToolKind::Pick) => {
|
||||
let (move1, move2, move3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
|
||||
Some(StageSection::Action) => (1.0, anim_time, 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.hand_l.position =
|
||||
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)
|
||||
* Quaternion::rotation_z(s_a.hhl.5);
|
||||
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)
|
||||
* Quaternion::rotation_y(s_a.hhr.4)
|
||||
* Quaternion::rotation_z(s_a.hhr.5);
|
||||
|
||||
next.control.position = Vec3::new(
|
||||
s_a.hc.0 + moveret1 * -13.0 + moveret2 * 3.0,
|
||||
s_a.hc.1 + (moveret2 * 5.0),
|
||||
s_a.hc.2 + moveret1 * 8.0 + moveret2 * -6.0,
|
||||
);
|
||||
next.control.orientation =
|
||||
Quaternion::rotation_x(
|
||||
s_a.hc.3 + (moveret1 * 1.5 + moveret2 * -2.55),
|
||||
) * Quaternion::rotation_y(
|
||||
s_a.hc.4 + moveret1 * PI / 2.0 + moveret2 * 0.5,
|
||||
) * Quaternion::rotation_z(s_a.hc.5 + (moveret2 * -0.5));
|
||||
},
|
||||
Some(ToolKind::Shovel) => {
|
||||
let (move1, move2, move3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
|
||||
Some(StageSection::Action) => (1.0, anim_time, 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.hand_l.position = Vec3::new(8.0, 6.0, 3.0);
|
||||
next.hand_l.orientation = Quaternion::rotation_x(PI / 2.0);
|
||||
next.hand_r.position = Vec3::new(8.0, 6.0, 15.0);
|
||||
next.hand_r.orientation = Quaternion::rotation_x(PI / 2.0);
|
||||
next.main.position = Vec3::new(7.5, 7.5, 13.2);
|
||||
next.main.orientation = Quaternion::rotation_y(PI);
|
||||
|
||||
next.control.position = Vec3::new(-11.0 + moveret1 * 8.0, 1.8, 4.0);
|
||||
next.control.orientation =
|
||||
Quaternion::rotation_x(moveret1 * 0.3 + moveret2 * 0.2)
|
||||
* Quaternion::rotation_y(
|
||||
0.8 - moveret1 * 0.7 + moveret2 * 0.7,
|
||||
)
|
||||
* Quaternion::rotation_z(moveret2 * 0.1 - moveret1 * 0.4);
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
},
|
||||
(_, _) => {},
|
||||
};
|
||||
|
||||
match hands {
|
||||
(Some(Hands::One), _) => match ability_info.and_then(|a| a.tool) {
|
||||
Some(ToolKind::Dagger) => {
|
||||
next.control_l.position = Vec3::new(-7.0, 8.0, 2.0);
|
||||
next.control_l.orientation = Quaternion::rotation_x(-0.3 + move2 * 2.0)
|
||||
* Quaternion::rotation_y(move1 * -1.2 + move2 * -1.5)
|
||||
* Quaternion::rotation_z(move2 * 1.5);
|
||||
next.hand_l.position = Vec3::new(0.0, -0.5, 0.0);
|
||||
next.hand_l.orientation = Quaternion::rotation_x(PI / 2.0)
|
||||
},
|
||||
Some(ToolKind::Pick | ToolKind::Shovel) => {
|
||||
next.control_l.position = Vec3::new(
|
||||
-7.0,
|
||||
8.0 + move1 * -4.0 + move2 * 4.0,
|
||||
2.0 + move1 * 16.0 + move2 * -19.0,
|
||||
);
|
||||
next.control_l.orientation =
|
||||
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);
|
||||
next.hand_l.orientation = Quaternion::rotation_x(PI / 2.0)
|
||||
},
|
||||
|
||||
_ => {},
|
||||
},
|
||||
(_, _) => {},
|
||||
};
|
||||
match hands {
|
||||
(None | Some(Hands::One), Some(Hands::One)) => {
|
||||
match ability_info.and_then(|a| a.tool) {
|
||||
Some(ToolKind::Dagger) => {
|
||||
next.control_r.position = Vec3::new(7.0 + move2 * 8.0, 8.0, 2.0);
|
||||
next.control_r.orientation =
|
||||
Quaternion::rotation_x(-0.3 + move2 * 2.0)
|
||||
* Quaternion::rotation_y(move1 * -1.8 + move2 * -1.5)
|
||||
* Quaternion::rotation_z(move2 * 1.5);
|
||||
next.hand_r.position = Vec3::new(0.0, -0.5, 0.0);
|
||||
next.hand_r.orientation = Quaternion::rotation_x(PI / 2.0)
|
||||
},
|
||||
Some(ToolKind::Pick | ToolKind::Shovel) => {
|
||||
next.control_r.position = Vec3::new(
|
||||
7.0,
|
||||
8.0 + move1 * -4.0 + move2h * 4.0,
|
||||
2.0 + move1 * 12.0 + move2h * -16.0,
|
||||
);
|
||||
next.control_r.orientation =
|
||||
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);
|
||||
next.hand_r.orientation = Quaternion::rotation_x(PI / 2.0)
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
},
|
||||
(_, _) => {},
|
||||
};
|
||||
|
||||
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)
|
||||
},
|
||||
(_, _) => {},
|
||||
};
|
||||
|
||||
if let (None, Some(Hands::Two)) = hands {
|
||||
next.second = next.main;
|
||||
}
|
||||
|
||||
if skeleton.holding_lantern {
|
||||
next.hand_r.position =
|
||||
Vec3::new(s_a.hand.0, s_a.hand.1 + 5.0, s_a.hand.2 + 12.0);
|
||||
next.hand_r.orientation =
|
||||
Quaternion::rotation_x(2.25) * Quaternion::rotation_z(0.9);
|
||||
|
||||
next.lantern.position = Vec3::new(-0.5, -0.5, -1.5);
|
||||
next.lantern.orientation = next.hand_r.orientation.inverse();
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
next
|
||||
}
|
||||
}
|
2066
voxygen/anim/src/character/basic.rs
Normal file
2066
voxygen/anim/src/character/basic.rs
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,119 +0,0 @@
|
||||
use super::{
|
||||
super::{vek::*, Animation},
|
||||
CharacterSkeleton, SkeletonAttr,
|
||||
};
|
||||
use common::{
|
||||
comp::item::{Hands, ToolKind},
|
||||
states::utils::{AbilityInfo, StageSection},
|
||||
};
|
||||
use std::f32::consts::PI;
|
||||
|
||||
pub struct BeamAnimation;
|
||||
|
||||
impl Animation for BeamAnimation {
|
||||
type Dependency<'a> = (
|
||||
Option<AbilityInfo>,
|
||||
(Option<Hands>, Option<Hands>),
|
||||
f32,
|
||||
f32,
|
||||
Option<StageSection>,
|
||||
);
|
||||
type Skeleton = CharacterSkeleton;
|
||||
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const UPDATE_FN: &'static [u8] = b"character_beam\0";
|
||||
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_beam")]
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
(ability_info, hands, _global_time, velocity, stage_section): Self::Dependency<'_>,
|
||||
anim_time: f32,
|
||||
rate: &mut f32,
|
||||
s_a: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
*rate = 1.0;
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
let (move1, move2, move3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time, 0.0, 0.0),
|
||||
Some(StageSection::Action) => (1.0, anim_time, 0.0),
|
||||
Some(StageSection::Recover) => (1.0, 1.0, anim_time),
|
||||
_ => (0.0, 0.0, 0.0),
|
||||
};
|
||||
|
||||
next.hand_l.position = Vec3::new(s_a.sthl.0, s_a.sthl.1, s_a.sthl.2);
|
||||
next.hand_l.orientation =
|
||||
Quaternion::rotation_x(s_a.sthl.3) * Quaternion::rotation_y(s_a.sthl.4);
|
||||
next.hand_r.position = Vec3::new(s_a.sthr.0, s_a.sthr.1, s_a.sthl.2);
|
||||
next.hand_r.orientation =
|
||||
Quaternion::rotation_x(s_a.sthr.3) * Quaternion::rotation_y(s_a.sthr.4);
|
||||
next.main.position = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.main.orientation = Quaternion::rotation_x(0.0);
|
||||
|
||||
next.control.position = Vec3::new(-4.0, 7.0, 4.0);
|
||||
next.control.orientation = Quaternion::rotation_x(-0.3)
|
||||
* Quaternion::rotation_y(0.15)
|
||||
* Quaternion::rotation_z(0.0);
|
||||
|
||||
match ability_info.and_then(|a| a.tool) {
|
||||
Some(ToolKind::Staff) | Some(ToolKind::Sceptre) => {
|
||||
next.control.position = Vec3::new(
|
||||
s_a.stc.0 + (move1 * 16.0) * (1.0 - move3),
|
||||
s_a.stc.1 + (move1 + (move2 * 8.0).sin() * 2.0) * (1.0 - move3),
|
||||
s_a.stc.2 + (move1 * 10.0) * (1.0 - move3),
|
||||
);
|
||||
next.control.orientation =
|
||||
Quaternion::rotation_x(s_a.stc.3 + (move1 * -1.2) * (1.0 - move3))
|
||||
* Quaternion::rotation_y(
|
||||
s_a.stc.4
|
||||
+ (move1 * -1.4 + (move2 * 16.0).sin() * 0.07) * (1.0 - move3),
|
||||
)
|
||||
* Quaternion::rotation_z(
|
||||
(move1 * -1.7 + (move2 * 8.0 + PI / 4.0).sin() * 0.3) * (1.0 - move3),
|
||||
);
|
||||
next.head.orientation = Quaternion::rotation_x(0.0);
|
||||
|
||||
next.hand_l.position = Vec3::new(
|
||||
0.0 + (move1 * -1.0 + (move2 * 8.0).sin() * 3.5) * (1.0 - move3),
|
||||
0.0 + (move1 * -5.0 + (move2 * 8.0).sin() * -2.0 + (move2 * 16.0).sin() * -1.5)
|
||||
* (1.0 - move3),
|
||||
-4.0 + (move1 * 19.0 + (move2 * 8.0 + PI / 2.0).sin() * 3.5) * (1.0 - move3),
|
||||
);
|
||||
next.hand_l.orientation =
|
||||
Quaternion::rotation_x(s_a.sthr.3 + (move1 * -0.3) * (1.0 - move3))
|
||||
* Quaternion::rotation_y(
|
||||
(move1 * -1.1 + (move2 * 8.0 + PI / 2.0).sin() * -0.3) * (1.0 - move3),
|
||||
)
|
||||
* Quaternion::rotation_z((move1 * -2.8) * (1.0 - move3));
|
||||
|
||||
if velocity < 0.5 {
|
||||
next.head.orientation =
|
||||
Quaternion::rotation_z(move1 * -0.5 + (move2 * 16.0).sin() * 0.05);
|
||||
|
||||
next.foot_l.position =
|
||||
Vec3::new(-s_a.foot.0, s_a.foot.1 + move1 * -3.0, s_a.foot.2);
|
||||
next.foot_l.orientation =
|
||||
Quaternion::rotation_x(move1 * -0.5) * Quaternion::rotation_z(move1 * 0.5);
|
||||
|
||||
next.foot_r.position =
|
||||
Vec3::new(s_a.foot.0, s_a.foot.1 + move1 * 4.0, s_a.foot.2);
|
||||
next.foot_r.orientation = Quaternion::rotation_z(move1 * 0.5);
|
||||
next.chest.orientation =
|
||||
Quaternion::rotation_x(move1 * -0.2 + (move2 * 8.0).sin() * 0.05)
|
||||
* Quaternion::rotation_z(move1 * 0.5);
|
||||
next.belt.orientation =
|
||||
Quaternion::rotation_x(move1 * 0.1) * Quaternion::rotation_z(move1 * -0.1);
|
||||
next.shorts.orientation =
|
||||
Quaternion::rotation_x(move1 * 0.2) * Quaternion::rotation_z(move1 * -0.2);
|
||||
};
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
|
||||
if let (None, Some(Hands::Two)) = hands {
|
||||
next.second = next.main;
|
||||
}
|
||||
|
||||
next
|
||||
}
|
||||
}
|
@ -1,148 +0,0 @@
|
||||
use super::{
|
||||
super::{vek::*, Animation},
|
||||
CharacterSkeleton, SkeletonAttr,
|
||||
};
|
||||
use common::{
|
||||
comp::item::{Hands, ToolKind},
|
||||
states::utils::{AbilityInfo, StageSection},
|
||||
};
|
||||
use core::f32::consts::PI;
|
||||
|
||||
pub struct BetaAnimation;
|
||||
impl Animation for BetaAnimation {
|
||||
type Dependency<'a> = (
|
||||
(Option<Hands>, Option<Hands>),
|
||||
Option<&'a str>,
|
||||
f32,
|
||||
f32,
|
||||
Option<StageSection>,
|
||||
Option<AbilityInfo>,
|
||||
);
|
||||
type Skeleton = CharacterSkeleton;
|
||||
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const UPDATE_FN: &'static [u8] = b"character_beta\0";
|
||||
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_beta")]
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
(hands, _ability_id, _velocity, _global_time, stage_section, ability_info): Self::Dependency<
|
||||
'_,
|
||||
>,
|
||||
anim_time: f32,
|
||||
rate: &mut f32,
|
||||
s_a: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
*rate = 1.0;
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
let (move1, move2, move3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
|
||||
Some(StageSection::Action) => (1.0, anim_time, 0.0),
|
||||
Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)),
|
||||
_ => (0.0, 0.0, 0.0),
|
||||
};
|
||||
if matches!(
|
||||
stage_section,
|
||||
Some(StageSection::Action | StageSection::Recover)
|
||||
) {
|
||||
next.main_weapon_trail = true;
|
||||
next.off_weapon_trail = true;
|
||||
}
|
||||
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_x(0.0);
|
||||
let pullback = 1.0 - move3;
|
||||
if let Some(ToolKind::Sword) = ability_info.and_then(|a| a.tool) {
|
||||
next.chest.orientation = Quaternion::rotation_x(0.15)
|
||||
* Quaternion::rotation_y((-0.1) * pullback)
|
||||
* Quaternion::rotation_z((0.4 + move1 * 1.5 + move2 * -2.5) * pullback);
|
||||
next.head.orientation = Quaternion::rotation_z(-0.4 + move1 * -1.0 + move2 * 1.5);
|
||||
}
|
||||
#[allow(clippy::single_match)]
|
||||
match hands {
|
||||
(Some(Hands::Two), _) | (None, Some(Hands::Two)) => match ability_info
|
||||
.and_then(|a| a.tool)
|
||||
{
|
||||
Some(ToolKind::Sword) => {
|
||||
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 + (-1.4 + move1 * -3.0 + move2 * -2.0) * pullback,
|
||||
s_a.sc.1 + (-1.4 + move1 * 3.0 + move2 * 3.0) * pullback,
|
||||
s_a.sc.2 + (-1.9 + move1 * 2.5 * pullback),
|
||||
);
|
||||
next.control.orientation = Quaternion::rotation_x(s_a.sc.3 + (-1.7) * pullback)
|
||||
* Quaternion::rotation_y(
|
||||
s_a.sc.4 + (0.4 + move1 * 1.5 + move2 * -2.5) * pullback,
|
||||
)
|
||||
* Quaternion::rotation_z(s_a.sc.5 + (1.67 + move2 * PI / 2.0) * pullback);
|
||||
},
|
||||
_ => {},
|
||||
},
|
||||
(_, _) => {},
|
||||
};
|
||||
|
||||
match hands {
|
||||
#[allow(clippy::single_match)]
|
||||
(Some(Hands::One), _) => match ability_info.and_then(|a| a.tool) {
|
||||
Some(ToolKind::Sword) => {
|
||||
next.control_l.position = Vec3::new(-12.0, 8.0, 2.0);
|
||||
next.control_l.orientation = Quaternion::rotation_x(1.7)
|
||||
* Quaternion::rotation_y(-3.7 + move1 * -0.75 + move2 * 1.0)
|
||||
* Quaternion::rotation_z(3.69);
|
||||
next.hand_l.position = Vec3::new(0.0, -0.5, 0.0);
|
||||
next.hand_l.orientation = Quaternion::rotation_x(PI / 2.0)
|
||||
},
|
||||
|
||||
_ => {},
|
||||
},
|
||||
(_, _) => {},
|
||||
};
|
||||
match hands {
|
||||
#[allow(clippy::single_match)]
|
||||
(None | Some(Hands::One), Some(Hands::One)) => {
|
||||
match ability_info.and_then(|a| a.tool) {
|
||||
Some(ToolKind::Sword) => {
|
||||
next.control_r.position = Vec3::new(0.0 + move1 * -8.0, 13.0, 2.0);
|
||||
next.control_r.orientation = Quaternion::rotation_x(1.7)
|
||||
* Quaternion::rotation_y(-2.3 + move1 * -2.3 + move2 * 1.0)
|
||||
* Quaternion::rotation_z(3.69);
|
||||
next.hand_r.position = Vec3::new(0.0, -0.5, 0.0);
|
||||
next.hand_r.orientation = Quaternion::rotation_x(PI / 2.0)
|
||||
},
|
||||
|
||||
_ => {},
|
||||
}
|
||||
},
|
||||
(_, _) => {},
|
||||
};
|
||||
|
||||
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)
|
||||
},
|
||||
(_, _) => {},
|
||||
};
|
||||
|
||||
if let (None, Some(Hands::Two)) = hands {
|
||||
next.second = next.main;
|
||||
}
|
||||
|
||||
next
|
||||
}
|
||||
}
|
@ -1,351 +0,0 @@
|
||||
use super::{
|
||||
super::{vek::*, Animation},
|
||||
CharacterSkeleton, SkeletonAttr,
|
||||
};
|
||||
use common::{
|
||||
comp::item::{Hands, ToolKind},
|
||||
states::utils::{AbilityInfo, StageSection},
|
||||
};
|
||||
use core::f32::consts::PI;
|
||||
|
||||
pub struct BlockAnimation;
|
||||
|
||||
type BlockAnimationDependency<'a> = (
|
||||
(Option<Hands>, Option<Hands>),
|
||||
Option<ToolKind>,
|
||||
Option<ToolKind>,
|
||||
Vec3<f32>,
|
||||
Option<&'a str>,
|
||||
Option<StageSection>,
|
||||
Option<AbilityInfo>,
|
||||
);
|
||||
impl Animation for BlockAnimation {
|
||||
type Dependency<'a> = BlockAnimationDependency<'a>;
|
||||
type Skeleton = CharacterSkeleton;
|
||||
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const UPDATE_FN: &'static [u8] = b"character_block\0";
|
||||
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_block")]
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
(
|
||||
hands,
|
||||
active_tool_kind,
|
||||
second_tool_kind,
|
||||
velocity,
|
||||
ability_id,
|
||||
stage_section,
|
||||
_ability_info,
|
||||
): Self::Dependency<'_>,
|
||||
anim_time: f32,
|
||||
rate: &mut f32,
|
||||
s_a: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
*rate = 1.0;
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
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_id {
|
||||
None
|
||||
| Some("common.abilities.sword.basic_guard")
|
||||
| Some("common.abilities.axe.basic_guard")
|
||||
| Some("common.abilities.hammer.basic_guard")
|
||||
| Some("common.abilities.sword.defensive_guard")
|
||||
| Some("common.abilities.shield.basic_guard")
|
||||
| Some("common.abilities.shield.power_guard") => {
|
||||
let speed = Vec2::<f32>::from(velocity).magnitude();
|
||||
|
||||
let (movement1base, move2, movement3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
|
||||
Some(StageSection::Action) => (1.0, (anim_time * 10.0).sin(), 0.0),
|
||||
|
||||
Some(StageSection::Recover) => (1.0, 1.0, anim_time.powf(4.0)),
|
||||
_ => (0.0, 0.0, 0.0),
|
||||
};
|
||||
let pullback = 1.0 - movement3;
|
||||
let move1 = movement1base * pullback;
|
||||
|
||||
if speed > 0.5 {
|
||||
} else {
|
||||
next.chest.position =
|
||||
Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + move1 * -1.0 + move2 * 0.2);
|
||||
next.chest.orientation = Quaternion::rotation_x(move1 * -0.15);
|
||||
next.head.orientation = Quaternion::rotation_x(move1 * 0.25);
|
||||
|
||||
next.belt.position =
|
||||
Vec3::new(0.0, s_a.belt.0 + move1 * 0.5, s_a.belt.1 + move1 * 0.5);
|
||||
next.shorts.position =
|
||||
Vec3::new(0.0, s_a.shorts.0 + move1 * 1.3, s_a.shorts.1 + move1 * 1.0);
|
||||
|
||||
next.belt.orientation = Quaternion::rotation_x(move1 * 0.15);
|
||||
next.shorts.orientation = Quaternion::rotation_x(move1 * 0.25);
|
||||
|
||||
next.foot_l.position =
|
||||
Vec3::new(-s_a.foot.0, s_a.foot.1 + move1 * 2.0, s_a.foot.2);
|
||||
next.foot_l.orientation = Quaternion::rotation_z(move1 * -0.5);
|
||||
|
||||
next.foot_r.position =
|
||||
Vec3::new(s_a.foot.0, s_a.foot.1 + move1 * -2.0, s_a.foot.2);
|
||||
next.foot_r.orientation = Quaternion::rotation_x(move1 * -0.5);
|
||||
};
|
||||
|
||||
match (hands, active_tool_kind, second_tool_kind) {
|
||||
((Some(Hands::Two), _), tool, _) | ((None, Some(Hands::Two)), _, tool) => {
|
||||
match tool {
|
||||
Some(ToolKind::Sword) => {
|
||||
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 + move1 * -2.0,
|
||||
s_a.shr.1,
|
||||
s_a.shr.2 + move1 * 20.0,
|
||||
);
|
||||
next.hand_r.orientation = Quaternion::rotation_x(s_a.shr.3)
|
||||
* Quaternion::rotation_y(s_a.shr.4)
|
||||
* Quaternion::rotation_z(move1 * 1.5);
|
||||
|
||||
next.control.position = Vec3::new(
|
||||
s_a.sc.0 + move1 * -3.0,
|
||||
s_a.sc.1,
|
||||
s_a.sc.2 + move1 * 4.0,
|
||||
);
|
||||
next.control.orientation = Quaternion::rotation_x(s_a.sc.3)
|
||||
* Quaternion::rotation_y(move1 * 1.1)
|
||||
* Quaternion::rotation_z(move1 * 1.7);
|
||||
},
|
||||
|
||||
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 * 13.0,
|
||||
s_a.ac.1 + move1 * -3.0,
|
||||
s_a.ac.2 + move1 * 8.0,
|
||||
);
|
||||
next.control.orientation =
|
||||
Quaternion::rotation_x(s_a.ac.3 + move1 * -2.0)
|
||||
* Quaternion::rotation_y(s_a.ac.4 + move1 * -1.8)
|
||||
* Quaternion::rotation_z(s_a.ac.5 + move1 * 4.0);
|
||||
},
|
||||
Some(ToolKind::Hammer | ToolKind::Pick | ToolKind::Shovel) => {
|
||||
next.hand_l.position = Vec3::new(
|
||||
s_a.hhl.0,
|
||||
s_a.hhl.1 + move1 * 6.0,
|
||||
s_a.hhl.2 + move1 * 6.0,
|
||||
);
|
||||
next.hand_l.orientation =
|
||||
Quaternion::rotation_x(s_a.hhl.3 + move1 * -0.5)
|
||||
* Quaternion::rotation_y(s_a.hhl.4 + move1 * 1.5)
|
||||
* Quaternion::rotation_z(s_a.hhl.5 + move1 * PI);
|
||||
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)
|
||||
* Quaternion::rotation_y(s_a.hhr.4)
|
||||
* Quaternion::rotation_z(s_a.hhr.5);
|
||||
|
||||
next.control.position = Vec3::new(
|
||||
s_a.hc.0 + move1 * 3.0,
|
||||
s_a.hc.1 + move1 * 3.0,
|
||||
s_a.hc.2 + move1 * 10.0,
|
||||
);
|
||||
next.control.orientation = Quaternion::rotation_x(s_a.hc.3)
|
||||
* Quaternion::rotation_y(s_a.hc.4)
|
||||
* Quaternion::rotation_z(s_a.hc.5 + move1 * -1.0);
|
||||
},
|
||||
Some(ToolKind::Staff) | Some(ToolKind::Sceptre) => {
|
||||
next.hand_r.position =
|
||||
Vec3::new(s_a.sthr.0, s_a.sthr.1, s_a.sthr.2);
|
||||
next.hand_r.orientation = Quaternion::rotation_x(s_a.sthr.3)
|
||||
* Quaternion::rotation_y(s_a.sthr.4);
|
||||
|
||||
next.control.position = Vec3::new(s_a.stc.0, s_a.stc.1, s_a.stc.2);
|
||||
|
||||
next.hand_l.position =
|
||||
Vec3::new(s_a.sthl.0, s_a.sthl.1, s_a.sthl.2);
|
||||
next.hand_l.orientation = Quaternion::rotation_x(s_a.sthl.3);
|
||||
|
||||
next.control.orientation = Quaternion::rotation_x(s_a.stc.3)
|
||||
* Quaternion::rotation_y(s_a.stc.4)
|
||||
* Quaternion::rotation_z(s_a.stc.5);
|
||||
},
|
||||
Some(ToolKind::Bow) => {
|
||||
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.bhl.0, s_a.bhl.1, s_a.bhl.2);
|
||||
next.hand_l.orientation = Quaternion::rotation_x(s_a.bhl.3);
|
||||
next.hand_r.position = Vec3::new(s_a.bhr.0, s_a.bhr.1, s_a.bhr.2);
|
||||
next.hand_r.orientation = Quaternion::rotation_x(s_a.bhr.3);
|
||||
|
||||
next.hold.position = Vec3::new(0.0, -1.0, -5.2);
|
||||
next.hold.orientation = Quaternion::rotation_x(-PI / 2.0);
|
||||
next.hold.scale = Vec3::one() * 1.0;
|
||||
|
||||
next.control.position = Vec3::new(s_a.bc.0, s_a.bc.1, s_a.bc.2);
|
||||
next.control.orientation = Quaternion::rotation_x(0.0)
|
||||
* Quaternion::rotation_y(s_a.bc.4)
|
||||
* Quaternion::rotation_z(s_a.bc.5);
|
||||
},
|
||||
Some(ToolKind::Debug) => {
|
||||
next.hand_l.position = Vec3::new(-7.0, 4.0, 3.0);
|
||||
next.hand_l.orientation = Quaternion::rotation_x(1.27);
|
||||
next.main.position = Vec3::new(-5.0, 5.0, 23.0);
|
||||
next.main.orientation = Quaternion::rotation_x(PI);
|
||||
},
|
||||
Some(ToolKind::Farming) => {
|
||||
next.hand_l.position = Vec3::new(9.0, 1.0, 1.0);
|
||||
next.hand_l.orientation = Quaternion::rotation_x(PI / 2.0);
|
||||
next.hand_r.position = Vec3::new(9.0, 1.0, 11.0);
|
||||
next.hand_r.orientation = Quaternion::rotation_x(PI / 2.0);
|
||||
next.main.position = Vec3::new(7.5, 7.5, 13.2);
|
||||
next.main.orientation = Quaternion::rotation_y(PI);
|
||||
|
||||
next.control.position = Vec3::new(-11.0, 1.8, 4.0);
|
||||
next.control.orientation = Quaternion::rotation_x(0.0)
|
||||
* Quaternion::rotation_y(0.6)
|
||||
* Quaternion::rotation_z(0.0);
|
||||
},
|
||||
Some(ToolKind::Shield) => {
|
||||
next.control.position = Vec3::new(2.0, 9.0, 8.0);
|
||||
next.control.orientation =
|
||||
Quaternion::rotation_x(0.25) * Quaternion::rotation_z(-1.5);
|
||||
|
||||
next.hand_l.position = Vec3::new(0.0, -2.0, 0.0);
|
||||
next.hand_l.orientation = Quaternion::rotation_x(PI / 2.0);
|
||||
|
||||
next.hand_r.position = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.hand_r.orientation = Quaternion::rotation_x(PI / 2.0)
|
||||
* Quaternion::rotation_y(PI / 2.0);
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
},
|
||||
((Some(Hands::One), Some(Hands::One)), _, Some(ToolKind::Shield)) => {
|
||||
next.control_r.position = Vec3::new(-1.5, 8.0, 4.0 + move1 * 3.0);
|
||||
next.control_r.orientation = Quaternion::rotation_x(0.25)
|
||||
* Quaternion::rotation_y(0.0)
|
||||
* Quaternion::rotation_z(1.5);
|
||||
next.hand_r.position = Vec3::new(0.0, -2.0, 0.0);
|
||||
next.hand_r.orientation = Quaternion::rotation_x(PI / 2.0);
|
||||
|
||||
next.control_l.position = Vec3::new(-9.0, -5.0, 0.0);
|
||||
next.control_l.orientation =
|
||||
Quaternion::rotation_x(-1.75) * Quaternion::rotation_y(-0.3);
|
||||
next.hand_l.position = Vec3::new(0.0, -0.5, 0.0);
|
||||
next.hand_l.orientation = Quaternion::rotation_x(PI / 2.0);
|
||||
},
|
||||
((Some(Hands::One), _), Some(ToolKind::Shield), _) => {
|
||||
next.control_l.position = Vec3::new(1.5, 8.0, 4.0 + move1 * 3.0);
|
||||
next.control_l.orientation = Quaternion::rotation_x(0.25)
|
||||
* Quaternion::rotation_y(0.0)
|
||||
* Quaternion::rotation_z(-1.5);
|
||||
next.hand_l.position = Vec3::new(0.0, -2.0, 0.0);
|
||||
next.hand_l.orientation = Quaternion::rotation_x(PI / 2.0);
|
||||
|
||||
next.control_r.position = Vec3::new(9.0, -5.0, 0.0);
|
||||
next.control_r.orientation =
|
||||
Quaternion::rotation_x(-1.75) * Quaternion::rotation_y(0.3);
|
||||
next.hand_r.position = Vec3::new(0.0, -0.5, 0.0);
|
||||
next.hand_r.orientation = Quaternion::rotation_x(PI / 2.0);
|
||||
},
|
||||
((Some(Hands::One), _), _, _) => {
|
||||
match hands {
|
||||
(Some(Hands::One), _) => {
|
||||
next.control_l.position =
|
||||
Vec3::new(-7.0, 8.0 + move1 * 3.0, 2.0 + move1 * 3.0);
|
||||
next.control_l.orientation = Quaternion::rotation_x(-0.3)
|
||||
* Quaternion::rotation_y(move1 * 1.0);
|
||||
next.hand_l.position = Vec3::new(0.0, -0.5, 0.0);
|
||||
next.hand_l.orientation = Quaternion::rotation_x(PI / 2.0)
|
||||
},
|
||||
(_, _) => {},
|
||||
};
|
||||
match hands {
|
||||
(None | Some(Hands::One), Some(Hands::One)) => {
|
||||
next.control_r.position =
|
||||
Vec3::new(7.0, 8.0 + move1 * 3.0, 2.0 + move1 * 3.0);
|
||||
next.control_r.orientation = Quaternion::rotation_x(-0.3)
|
||||
* Quaternion::rotation_y(move1 * -1.0);
|
||||
next.hand_r.position = Vec3::new(0.0, -0.5, 0.0);
|
||||
next.hand_r.orientation = Quaternion::rotation_x(PI / 2.0)
|
||||
},
|
||||
(_, _) => {},
|
||||
};
|
||||
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)
|
||||
},
|
||||
(_, _) => {},
|
||||
};
|
||||
|
||||
if let (None, Some(Hands::Two)) = hands {
|
||||
next.second = next.main;
|
||||
}
|
||||
},
|
||||
((_, _), _, _) => {},
|
||||
};
|
||||
},
|
||||
Some("common.abilities.sword.defensive_deflect") => {
|
||||
let (move1, move2, move3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time.powi(2), 0.0, 0.0),
|
||||
Some(StageSection::Action) => (1.0, (anim_time * 20.0).sin(), 0.0),
|
||||
Some(StageSection::Recover) => (1.0, 1.0, anim_time.powf(0.5)),
|
||||
_ => (0.0, 0.0, 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.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, s_a.sc.1, s_a.sc.2);
|
||||
next.control.orientation =
|
||||
Quaternion::rotation_x(s_a.sc.3) * Quaternion::rotation_z(move1 * -0.9);
|
||||
|
||||
next.chest.orientation = Quaternion::rotation_z(move1 * -0.6);
|
||||
next.head.orientation = Quaternion::rotation_z(move1 * 0.2);
|
||||
next.belt.orientation = Quaternion::rotation_z(move1 * -0.1);
|
||||
next.shorts.orientation = Quaternion::rotation_z(move1 * 0.1);
|
||||
next.control.orientation.rotate_y(move1 * -1.7);
|
||||
next.control.orientation.rotate_z(move1 * 0.6);
|
||||
next.control.position += Vec3::new(move1 * 11.0, move1 * 2.0, move1 * 5.0);
|
||||
|
||||
next.control.orientation.rotate_y(move2 / 50.0);
|
||||
|
||||
next.chest.orientation.rotate_z(move3 * -0.6);
|
||||
next.head.orientation.rotate_z(move3 * 0.4);
|
||||
next.belt.orientation.rotate_z(move3 * 0.2);
|
||||
next.shorts.orientation.rotate_z(move3 * 0.6);
|
||||
next.control.position += Vec3::new(move3 * 6.0, 0.0, move3 * 9.0);
|
||||
next.control.orientation.rotate_z(move3 * -0.5);
|
||||
next.control.orientation.rotate_y(move3 * 0.6);
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
|
||||
next
|
||||
}
|
||||
}
|
@ -1,291 +0,0 @@
|
||||
use super::{
|
||||
super::{vek::*, Animation},
|
||||
hammer_start, twist_back, twist_forward, CharacterSkeleton, SkeletonAttr,
|
||||
};
|
||||
use common::states::utils::StageSection;
|
||||
use core::f32::consts::{PI, TAU};
|
||||
|
||||
pub struct ChargeswingAnimation;
|
||||
|
||||
type ChargeswingAnimationDependency<'a> = (Option<&'a str>, StageSection);
|
||||
|
||||
impl Animation for ChargeswingAnimation {
|
||||
type Dependency<'a> = ChargeswingAnimationDependency<'a>;
|
||||
type Skeleton = CharacterSkeleton;
|
||||
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const UPDATE_FN: &'static [u8] = b"character_chargeswing\0";
|
||||
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_chargeswing")]
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
(ability_id, stage_section): Self::Dependency<'_>,
|
||||
anim_time: f32,
|
||||
rate: &mut f32,
|
||||
s_a: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
*rate = 1.0;
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
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);
|
||||
if matches!(stage_section, StageSection::Action) {
|
||||
next.main_weapon_trail = true;
|
||||
next.off_weapon_trail = true;
|
||||
}
|
||||
|
||||
match ability_id {
|
||||
Some(
|
||||
"common.abilities.sword.basic_thrust"
|
||||
| "common.abilities.sword.defensive_vital_jab",
|
||||
) => {
|
||||
let (move1, move2, move3, tension) = match stage_section {
|
||||
StageSection::Charge => (
|
||||
anim_time.powf(0.25).min(1.0),
|
||||
0.0,
|
||||
0.0,
|
||||
(anim_time * 20.0).sin() - 0.5,
|
||||
),
|
||||
StageSection::Action => (1.0, anim_time.powi(2), 0.0, 0.0),
|
||||
StageSection::Recover => (1.0, 1.0, anim_time.powi(4), 0.0),
|
||||
_ => (0.0, 0.0, 0.0, 0.0),
|
||||
};
|
||||
let pullback = 1.0 - move3;
|
||||
let move1 = move1 * pullback;
|
||||
let move2 = move2 * pullback;
|
||||
|
||||
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(PI * 0.5);
|
||||
next.control.position = Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2 + move2 * 5.0);
|
||||
next.control.orientation = Quaternion::rotation_x(s_a.sc.3 + move1 * -0.9)
|
||||
* Quaternion::rotation_y(move1 * 1.0 + move2 * -1.0)
|
||||
* Quaternion::rotation_z(move1 * 1.3 + move2 * -1.3);
|
||||
|
||||
next.chest.orientation =
|
||||
Quaternion::rotation_z(move1 * 1.0 + tension * 0.02 + move2 * -1.2);
|
||||
next.head.orientation = Quaternion::rotation_z(move1 * -0.4 + move2 * 0.3);
|
||||
next.belt.orientation = Quaternion::rotation_z(move1 * -0.25 + move2 * 0.2);
|
||||
next.shorts.orientation = Quaternion::rotation_z(move1 * -0.5 + move2 * 0.4);
|
||||
},
|
||||
Some("common.abilities.sword.heavy_slam") => {
|
||||
let (move1, move2, move3, tension) = match stage_section {
|
||||
StageSection::Charge => (
|
||||
anim_time.powf(0.25).min(1.0),
|
||||
0.0,
|
||||
0.0,
|
||||
(anim_time * 20.0).sin(),
|
||||
),
|
||||
StageSection::Action => (1.0, anim_time.powi(2), 0.0, 0.0),
|
||||
StageSection::Recover => (1.0, 1.0, anim_time.powi(4), 0.0),
|
||||
_ => (0.0, 0.0, 0.0, 0.0),
|
||||
};
|
||||
let pullback = 1.0 - move3;
|
||||
let move1 = move1 * pullback;
|
||||
let move2 = move2 * pullback;
|
||||
|
||||
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.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)
|
||||
* Quaternion::rotation_z(move1 * 0.3 + move2 * -0.7);
|
||||
|
||||
next.control
|
||||
.orientation
|
||||
.rotate_x(move1 * 1.4 + tension / 50.0);
|
||||
next.control.position +=
|
||||
Vec3::new(move1 * -1.0, move1 * 2.0, move1 * 8.0) + Vec3::one() * tension / 4.0;
|
||||
next.chest.orientation = Quaternion::rotation_z(move1 * 0.4 + tension / 50.0);
|
||||
|
||||
if move2 < f32::EPSILON {
|
||||
next.main_weapon_trail = false;
|
||||
next.off_weapon_trail = false;
|
||||
}
|
||||
next.control.orientation.rotate_x(move2 * -3.0);
|
||||
next.control.orientation.rotate_z(move2 * -0.4);
|
||||
next.control.position += Vec3::new(move2 * 10.0, 0.0, move2 * -10.0);
|
||||
next.chest.orientation.rotate_z(move2 * -0.6);
|
||||
},
|
||||
Some("common.abilities.sword.crippling_deep_rend") => {
|
||||
let (move1, move2, tension, move3, move4) = match stage_section {
|
||||
StageSection::Buildup => (anim_time, 0.0, 0.0, 0.0, 0.0),
|
||||
StageSection::Charge => {
|
||||
(1.0, anim_time.min(1.0), (anim_time * 20.0).sin(), 0.0, 0.0)
|
||||
},
|
||||
StageSection::Action => (1.0, 1.0, 0.0, anim_time, 0.0),
|
||||
StageSection::Recover => (1.0, 1.0, 0.0, 1.0, anim_time),
|
||||
_ => (0.0, 0.0, 0.0, 0.0, 0.0),
|
||||
};
|
||||
let move1pre = move1.min(0.5) * 2.0;
|
||||
let move1post = move1.max(0.5) * 2.0 - 1.0;
|
||||
let pullback = 1.0 - move4;
|
||||
let move1pre = move1pre * pullback;
|
||||
let move1post = move1post * pullback;
|
||||
let move2 = move2 * pullback;
|
||||
let move3 = move3 * pullback;
|
||||
|
||||
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 + move1pre * 0.5);
|
||||
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) * Quaternion::rotation_z(move1pre * PI / 2.0);
|
||||
|
||||
next.foot_r.position += Vec3::new(0.0, move1pre * -3.0, 0.0);
|
||||
next.foot_r.orientation.rotate_z(move1pre * -1.2);
|
||||
next.chest.orientation = Quaternion::rotation_z(move1pre * -1.3);
|
||||
next.head.orientation = Quaternion::rotation_z(move1pre * 0.7);
|
||||
next.belt.orientation = Quaternion::rotation_z(move1pre * 0.4);
|
||||
next.shorts.orientation = Quaternion::rotation_z(move1pre * 0.8);
|
||||
next.control.orientation.rotate_y(move1pre * -1.5);
|
||||
next.control.orientation.rotate_z(move1pre * 0.0);
|
||||
next.control.position += Vec3::new(move1pre * 12.0, 0.0, 0.0);
|
||||
|
||||
next.chest.orientation.rotate_z(move1post * 1.2);
|
||||
next.head.orientation.rotate_z(move1post * -0.7);
|
||||
next.belt.orientation.rotate_z(move1post * -0.3);
|
||||
next.shorts.orientation.rotate_z(move1post * -0.8);
|
||||
next.foot_r.orientation.rotate_z(move1post * 1.2);
|
||||
next.foot_r.orientation.rotate_x(move1post * -0.6);
|
||||
next.control.orientation.rotate_z(move1post * -1.2);
|
||||
next.control.position += Vec3::new(0.0, move1post * 4.0, move1post * 3.0);
|
||||
|
||||
next.control
|
||||
.orientation
|
||||
.rotate_y(move2 * -2.0 + tension / 10.0);
|
||||
next.chest.orientation.rotate_z(move2 * -0.4 + move3 * -1.4);
|
||||
next.control
|
||||
.orientation
|
||||
.rotate_z(move2 * 0.3 + move3 * -1.2);
|
||||
next.head.orientation.rotate_z(move2 * 0.2 + move3 * 0.7);
|
||||
next.belt.orientation.rotate_z(move3 * 0.3);
|
||||
next.shorts.orientation.rotate_z(move2 * 0.2 + move3 * 0.7);
|
||||
next.chest
|
||||
.orientation
|
||||
.rotate_y(move2 * -0.3 - tension / 100.0);
|
||||
next.foot_r.orientation.rotate_z(move3 * -1.5);
|
||||
},
|
||||
Some(
|
||||
"common.abilities.sword.cleaving_spiral_slash"
|
||||
| "common.abilities.sword.cleaving_dual_spiral_slash",
|
||||
) => {
|
||||
let (move1, tension, move2, move3) = match stage_section {
|
||||
StageSection::Charge => (
|
||||
anim_time.powf(0.25).min(1.0),
|
||||
(anim_time * 15.0).sin(),
|
||||
0.0,
|
||||
0.0,
|
||||
),
|
||||
StageSection::Action => (1.0, 0.0, anim_time, 0.0),
|
||||
StageSection::Recover => (1.0, 0.0, 1.0, anim_time),
|
||||
_ => (0.0, 0.0, 0.0, 0.0),
|
||||
};
|
||||
let pullback = 1.0 - move3;
|
||||
|
||||
let move2_no_pullback = move2;
|
||||
let move2_pre = move2.min(0.3) * 10.0 / 3.0;
|
||||
let move1 = move1 * pullback;
|
||||
let move2 = move2 * pullback;
|
||||
let move2_pre = move2_pre * pullback;
|
||||
|
||||
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, s_a.sc.1, s_a.sc.2);
|
||||
next.control.orientation = Quaternion::rotation_x(s_a.sc.3);
|
||||
|
||||
next.chest.orientation = Quaternion::rotation_z(move1 * 1.2 + tension / 50.0);
|
||||
next.head.orientation = Quaternion::rotation_z(move1 * -0.7);
|
||||
next.belt.orientation = Quaternion::rotation_z(move1 * -0.3);
|
||||
next.shorts.orientation = Quaternion::rotation_z(move1 * -0.8);
|
||||
next.control.orientation.rotate_x(move1 * 0.2);
|
||||
next.foot_r
|
||||
.orientation
|
||||
.rotate_x(move1 * -0.4 + move2_pre * 0.4);
|
||||
next.foot_r.orientation.rotate_z(move1 * 1.4);
|
||||
|
||||
next.control.orientation.rotate_y(move2_pre * -1.6);
|
||||
next.control.position += Vec3::new(0.0, 0.0, move2_pre * 4.0);
|
||||
next.torso.orientation.rotate_z(move2_no_pullback * -TAU);
|
||||
next.chest.orientation.rotate_z(move2 * -2.0);
|
||||
next.head.orientation.rotate_z(move2 * 1.3);
|
||||
next.belt.orientation.rotate_z(move2 * 0.6);
|
||||
next.shorts.orientation.rotate_z(move2 * 1.5);
|
||||
next.foot_r.orientation.rotate_z(move2_pre * -1.7);
|
||||
next.control.orientation.rotate_z(move2 * -1.8);
|
||||
next.control.position += Vec3::new(move2 * 14.0, 0.0, 0.0);
|
||||
},
|
||||
Some("common.abilities.axe.cleave") => {
|
||||
let (move1, move2, move3, tension) = match stage_section {
|
||||
StageSection::Charge => {
|
||||
(anim_time.min(1.0), 0.0, 0.0, (anim_time * 20.0).sin())
|
||||
},
|
||||
StageSection::Action => (1.0, anim_time.powi(2), 0.0, 0.0),
|
||||
StageSection::Recover => (1.0, 1.0, anim_time, 0.0),
|
||||
_ => (0.0, 0.0, 0.0, 0.0),
|
||||
};
|
||||
let pullback = 1.0 - move3;
|
||||
let move1 = move1 * pullback;
|
||||
let move2 = move2 * pullback;
|
||||
|
||||
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 * 7.0,
|
||||
s_a.ac.1 + move1 * -4.0,
|
||||
s_a.ac.2 + move1 * 18.0 + tension / 5.0,
|
||||
);
|
||||
next.control.orientation =
|
||||
Quaternion::rotation_x(s_a.ac.3 + move1 * -1.0 + tension / 30.0)
|
||||
* Quaternion::rotation_y(s_a.ac.4)
|
||||
* Quaternion::rotation_z(s_a.ac.5 - move1 * PI);
|
||||
|
||||
next.control.orientation.rotate_x(move2 * -3.0);
|
||||
next.control.position += Vec3::new(0.0, move2 * 8.0, move2 * -30.0);
|
||||
},
|
||||
Some("common.abilities.hammer.wide_wallop") => {
|
||||
hammer_start(&mut next, s_a);
|
||||
let (move1, move2, move3, tension) = match stage_section {
|
||||
StageSection::Charge => (anim_time.min(1.0), 0.0, 0.0, (anim_time * 7.0).sin()),
|
||||
StageSection::Action => (1.0, anim_time, 0.0, 0.0),
|
||||
StageSection::Recover => (1.0, 1.0, anim_time, 0.0),
|
||||
_ => (0.0, 0.0, 0.0, 0.0),
|
||||
};
|
||||
let pullback = 1.0 - move3;
|
||||
let move1 = move1 * pullback;
|
||||
let move2 = move2 * pullback;
|
||||
|
||||
next.control.orientation.rotate_x(move1 * 1.1 + move2 * 0.6);
|
||||
twist_back(&mut next, move1 + tension / 25.0, 1.7, 0.7, 0.3, 1.1);
|
||||
next.control.orientation.rotate_y(move1 * -0.8);
|
||||
next.control.position += Vec3::new(0.0, 0.0, 6.0) * move1;
|
||||
|
||||
twist_forward(&mut next, move2, 4.8, 1.7, 0.7, 3.2);
|
||||
next.control.orientation.rotate_y(move2 * 2.0);
|
||||
next.control.orientation.rotate_z(move2 * -1.8);
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
|
||||
next
|
||||
}
|
||||
}
|
@ -1,86 +0,0 @@
|
||||
use super::{
|
||||
super::{vek::*, Animation},
|
||||
dual_wield_start, hammer_start, twist_back, twist_forward, CharacterSkeleton, SkeletonAttr,
|
||||
};
|
||||
use common::states::utils::StageSection;
|
||||
|
||||
pub struct DashAnimation;
|
||||
|
||||
type DashAnimationDependency<'a> = (Option<&'a str>, StageSection);
|
||||
impl Animation for DashAnimation {
|
||||
type Dependency<'a> = DashAnimationDependency<'a>;
|
||||
type Skeleton = CharacterSkeleton;
|
||||
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const UPDATE_FN: &'static [u8] = b"character_dash\0";
|
||||
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_dash")]
|
||||
#[allow(clippy::single_match)] // TODO: Pending review in #587
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
(ability_id, stage_section): Self::Dependency<'_>,
|
||||
anim_time: f32,
|
||||
rate: &mut f32,
|
||||
s_a: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
*rate = 1.0;
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
if matches!(stage_section, StageSection::Action | StageSection::Charge) {
|
||||
next.main_weapon_trail = true;
|
||||
next.off_weapon_trail = true;
|
||||
}
|
||||
|
||||
match ability_id {
|
||||
Some("common.abilities.hammer.intercept") => {
|
||||
hammer_start(&mut next, s_a);
|
||||
let (move1, _move2, move3, move4) = match stage_section {
|
||||
StageSection::Buildup => (anim_time, 0.0, 0.0, 0.0),
|
||||
StageSection::Charge => (1.0, anim_time, 0.0, 0.0),
|
||||
StageSection::Action => (1.0, 0.0, anim_time, 0.0),
|
||||
StageSection::Recover => (1.0, 0.0, 1.0, anim_time),
|
||||
_ => (0.0, 0.0, 0.0, 0.0),
|
||||
};
|
||||
let pullback = 1.0 - move4;
|
||||
let move1 = move1 * pullback;
|
||||
let move3 = move3 * pullback;
|
||||
|
||||
twist_back(&mut next, move1, 1.6, 0.7, 0.3, 1.1);
|
||||
next.control.orientation.rotate_x(move1 * 1.8);
|
||||
|
||||
twist_forward(&mut next, move3, 2.4, 0.9, 0.5, 1.4);
|
||||
next.control.orientation.rotate_z(move3 * -2.7);
|
||||
next.control.orientation.rotate_x(move3 * 2.0);
|
||||
next.control.position += Vec3::new(5.0, 0.0, 11.0) * move3;
|
||||
},
|
||||
Some("common.abilities.hammer.dual_intercept") => {
|
||||
dual_wield_start(&mut next);
|
||||
let (move1, _move2, move3, move4) = match stage_section {
|
||||
StageSection::Buildup => (anim_time, 0.0, 0.0, 0.0),
|
||||
StageSection::Charge => (1.0, anim_time, 0.0, 0.0),
|
||||
StageSection::Action => (1.0, 0.0, anim_time, 0.0),
|
||||
StageSection::Recover => (1.0, 0.0, 1.0, anim_time),
|
||||
_ => (0.0, 0.0, 0.0, 0.0),
|
||||
};
|
||||
let pullback = 1.0 - move4;
|
||||
let move1 = move1 * pullback;
|
||||
let move3 = move3 * pullback;
|
||||
|
||||
next.control_l.orientation.rotate_x(move1 * -1.4);
|
||||
next.control_l.orientation.rotate_z(move1 * 0.8);
|
||||
next.control_r.orientation.rotate_x(move1 * -1.4);
|
||||
next.control_r.orientation.rotate_z(move1 * -0.8);
|
||||
next.control.position += Vec3::new(0.0, 0.0, -6.0) * move1;
|
||||
|
||||
next.control_l.orientation.rotate_z(move3 * -2.6);
|
||||
next.control_l.orientation.rotate_x(move3 * 4.0);
|
||||
next.control_r.orientation.rotate_z(move3 * 2.6);
|
||||
next.control_r.orientation.rotate_x(move3 * 4.0);
|
||||
next.control.position += Vec3::new(0.0, 0.0, 20.0) * move3;
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
|
||||
next
|
||||
}
|
||||
}
|
@ -1,140 +0,0 @@
|
||||
use super::{
|
||||
super::{vek::*, Animation},
|
||||
CharacterSkeleton, SkeletonAttr,
|
||||
};
|
||||
use common::states::utils::{AbilityInfo, StageSection};
|
||||
use core::f32::consts::{PI, TAU};
|
||||
|
||||
pub struct DiveMeleeAnimation;
|
||||
impl Animation for DiveMeleeAnimation {
|
||||
type Dependency<'a> = (
|
||||
Option<&'a str>,
|
||||
Option<StageSection>,
|
||||
f32,
|
||||
Option<AbilityInfo>,
|
||||
);
|
||||
type Skeleton = CharacterSkeleton;
|
||||
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const UPDATE_FN: &'static [u8] = b"character_dive_melee\0";
|
||||
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_dive_melee")]
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
(ability_id, stage_section, ground_dist, _ability_info): Self::Dependency<'_>,
|
||||
anim_time: f32,
|
||||
rate: &mut f32,
|
||||
s_a: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
*rate = 1.0;
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
next.main.position = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.main.orientation = Quaternion::rotation_z(0.0);
|
||||
next.main_weapon_trail = true;
|
||||
next.second.position = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.second.orientation = Quaternion::rotation_z(0.0);
|
||||
next.off_weapon_trail = true;
|
||||
|
||||
let ground_dist = ground_dist.clamp(0.0, 0.5) * 2.0;
|
||||
let ground_dist = if ground_dist.is_nan() {
|
||||
0.0
|
||||
} else {
|
||||
ground_dist
|
||||
};
|
||||
|
||||
match ability_id {
|
||||
Some("common.abilities.sword.cleaving_earth_splitter") => {
|
||||
let (move1, move1alt, move2, move3, move4) = match stage_section {
|
||||
Some(StageSection::Movement) => (
|
||||
anim_time.min(1.0).powi(2),
|
||||
(anim_time.min(1.5) / 1.5).powf(1.5),
|
||||
(1.0 - ground_dist).powi(2),
|
||||
0.0,
|
||||
0.0,
|
||||
),
|
||||
Some(StageSection::Action) => (1.0, 1.0, 1.0, anim_time.powf(0.25), 0.0),
|
||||
Some(StageSection::Recover) => (1.0, 1.0, 1.0, 1.0, anim_time.powi(4)),
|
||||
_ => (0.0, 0.0, 0.0, 0.0, 0.0),
|
||||
};
|
||||
let pullback = 1.0 - move4;
|
||||
let move1 = move1 * pullback;
|
||||
let move2 = move2 * pullback;
|
||||
let move3 = move3 * pullback;
|
||||
|
||||
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, s_a.sc.1, s_a.sc.2);
|
||||
next.control.orientation = Quaternion::rotation_x(s_a.sc.3);
|
||||
next.torso.orientation.rotate_x(move1alt * -TAU);
|
||||
|
||||
next.torso.orientation.rotate_x(move1 * -0.8);
|
||||
next.control.orientation.rotate_x(move1 * 1.5);
|
||||
next.control.position += Vec3::new(move1 * 7.0, move1.powi(4) * -6.0, move1 * 20.0);
|
||||
|
||||
next.torso.orientation.rotate_x(move2 * 0.8);
|
||||
next.chest.orientation = Quaternion::rotation_x(move2 * -0.4);
|
||||
next.control.orientation.rotate_x(move2 * -1.2);
|
||||
next.control.position += Vec3::new(0.0, move2 * 12.0, move2 * -8.0);
|
||||
|
||||
next.control.orientation.rotate_x(move3 * -1.2);
|
||||
next.control.position += Vec3::new(0.0, move3 * 4.0, move3 * -8.0);
|
||||
},
|
||||
Some("common.abilities.sword.heavy_pillar_thrust") => {
|
||||
let (move1, move2, move3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time.powf(0.5), 0.0, 0.0),
|
||||
Some(StageSection::Movement) => (anim_time.min(1.0).powf(0.5), 0.0, 0.0),
|
||||
Some(StageSection::Action) => (1.0, anim_time.powi(2), 0.0),
|
||||
Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)),
|
||||
_ => (0.0, 0.0, 0.0),
|
||||
};
|
||||
|
||||
let move1alt1 = move1.min(0.5) * 2.0;
|
||||
let move1alt2 = (move1.max(0.5) - 0.5) * 2.0;
|
||||
|
||||
let pullback = 1.0 - move3;
|
||||
let move1 = move1 * pullback;
|
||||
let move1alt1 = move1alt1 * pullback;
|
||||
let move1alt2 = move1alt2 * pullback;
|
||||
let move2 = move2 * pullback;
|
||||
|
||||
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 + move1alt2 * PI)
|
||||
* Quaternion::rotation_y(s_a.shl.4);
|
||||
next.hand_r.position = Vec3::new(
|
||||
-s_a.sc.0 + 6.0 + move1alt1 * -12.0,
|
||||
-4.0 + move1alt1 * 3.0,
|
||||
-2.0,
|
||||
);
|
||||
next.hand_r.orientation =
|
||||
Quaternion::rotation_x(0.9 + move1 * 0.5 + move1alt1 * PI);
|
||||
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);
|
||||
|
||||
next.control.position += Vec3::new(
|
||||
move1 * 6.0,
|
||||
(1.0 - (move1 - 0.5).abs() * 2.0) * 3.0,
|
||||
move1 * 22.0,
|
||||
);
|
||||
next.control.orientation.rotate_x(move1 * -1.5);
|
||||
|
||||
next.chest.orientation = Quaternion::rotation_x(move2 * -0.4);
|
||||
next.head.orientation = Quaternion::rotation_x(move2 * 0.2);
|
||||
next.belt.orientation = Quaternion::rotation_x(move2 * 0.4);
|
||||
next.shorts.orientation = Quaternion::rotation_x(move2 * 0.8);
|
||||
next.control.orientation.rotate_x(move2 * -0.4);
|
||||
next.control.position += Vec3::new(0.0, 0.0, move2 * -10.0);
|
||||
next.belt.position += Vec3::new(0.0, move2 * 2.0, move2 * 0.0);
|
||||
next.shorts.position += Vec3::new(0.0, move2 * 4.0, move2 * 1.0);
|
||||
next.chest.position += Vec3::new(0.0, move2 * -2.5, 0.0);
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
|
||||
next
|
||||
}
|
||||
}
|
@ -1,590 +0,0 @@
|
||||
use super::{
|
||||
super::{vek::*, Animation},
|
||||
hammer_start, twist_back, twist_forward, CharacterSkeleton, SkeletonAttr,
|
||||
};
|
||||
use common::states::utils::{AbilityInfo, StageSection};
|
||||
use core::f32::consts::{PI, TAU};
|
||||
|
||||
pub struct FinisherMeleeAnimation;
|
||||
impl Animation for FinisherMeleeAnimation {
|
||||
type Dependency<'a> = (Option<&'a str>, Option<StageSection>, Option<AbilityInfo>);
|
||||
type Skeleton = CharacterSkeleton;
|
||||
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const UPDATE_FN: &'static [u8] = b"character_finisher_melee\0";
|
||||
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_finisher_melee")]
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
(ability_id, stage_section, _ability_info): Self::Dependency<'_>,
|
||||
anim_time: f32,
|
||||
rate: &mut f32,
|
||||
s_a: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
*rate = 1.0;
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
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);
|
||||
if matches!(stage_section, Some(StageSection::Action)) {
|
||||
next.main_weapon_trail = true;
|
||||
next.off_weapon_trail = true;
|
||||
}
|
||||
|
||||
match ability_id {
|
||||
Some("common.abilities.sword.basic_mighty_strike") => {
|
||||
let (move1, move2, move3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
|
||||
Some(StageSection::Action) => (1.0, anim_time.powf(0.1), 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 move1 = move1 * pullback;
|
||||
let move2 = move2 * pullback;
|
||||
|
||||
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 + move2 * 12.0,
|
||||
s_a.sc.1,
|
||||
s_a.sc.2 + move1 * 6.0 - move2 * 8.0,
|
||||
);
|
||||
next.control.orientation =
|
||||
Quaternion::rotation_x(s_a.sc.3 + move1 * 1.6 + move2 * -2.6)
|
||||
* Quaternion::rotation_y(move1 * -0.4 + move2 * 0.6)
|
||||
* Quaternion::rotation_z(move1 * -0.2 + move2 * -0.2);
|
||||
|
||||
next.chest.orientation = Quaternion::rotation_z(move1 * 1.0 + move2 * -1.2);
|
||||
next.head.orientation = Quaternion::rotation_z(move1 * -0.4 + move2 * 0.3);
|
||||
next.belt.orientation = Quaternion::rotation_z(move1 * -0.25 + move2 * 0.2);
|
||||
next.shorts.orientation = Quaternion::rotation_z(move1 * -0.5 + move2 * 0.4);
|
||||
},
|
||||
Some("common.abilities.sword.heavy_guillotine") => {
|
||||
let (move1, move2, move3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
|
||||
Some(StageSection::Action) => (1.0, anim_time.powi(2), 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 move1 = move1 * pullback;
|
||||
let move2 = move2 * pullback;
|
||||
|
||||
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.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)
|
||||
* Quaternion::rotation_z(move1 * 0.3 + move2 * -0.7);
|
||||
|
||||
next.control.orientation.rotate_x(move1 * 1.4);
|
||||
next.control.position += Vec3::new(move1 * -1.0, move1 * 2.0, move1 * 8.0);
|
||||
next.chest.orientation = Quaternion::rotation_z(move1 * 0.4);
|
||||
|
||||
next.control.orientation.rotate_x(move2 * -3.0);
|
||||
next.control.orientation.rotate_z(move2 * -0.4);
|
||||
next.control.position += Vec3::new(move2 * 10.0, 0.0, move2 * -10.0);
|
||||
next.chest.orientation.rotate_z(move2 * -0.6);
|
||||
},
|
||||
Some("common.abilities.sword.defensive_counter") => {
|
||||
let (move1, move2, move3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time.powf(0.5), 0.0, 0.0),
|
||||
Some(StageSection::Action) => {
|
||||
(1.0, (anim_time.min(2.0 / 3.0) * 1.5).powi(2), 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 move1 = move1 * pullback;
|
||||
let move2 = move2 * pullback;
|
||||
|
||||
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, s_a.sc.1, s_a.sc.2);
|
||||
next.control.orientation =
|
||||
Quaternion::rotation_x(s_a.sc.3) * Quaternion::rotation_z(move2 * -PI / 4.0);
|
||||
|
||||
next.foot_l.position = Vec3::new(-s_a.foot.0, s_a.foot.1, s_a.foot.2);
|
||||
next.foot_r.position = Vec3::new(s_a.foot.0, s_a.foot.1, s_a.foot.2);
|
||||
next.foot_l.orientation = Quaternion::identity();
|
||||
next.foot_r.orientation = Quaternion::identity();
|
||||
|
||||
next.foot_r.position +=
|
||||
Vec3::new(0.0, move1 * 4.0, (1.0 - (move1 - 0.5) * 2.0) * 2.0);
|
||||
next.torso.position += Vec3::new(0.0, move1 * -2.0, 0.0);
|
||||
next.chest.position += Vec3::new(0.0, move1 * 2.0, move1 * -3.0);
|
||||
next.shorts.orientation = Quaternion::rotation_x(move1 * 0.5);
|
||||
next.shorts.position += Vec3::new(0.0, move1 * 1.5, 0.0);
|
||||
next.control.orientation.rotate_y(move1 * -1.5);
|
||||
next.control.orientation.rotate_z(move1 * 0.8);
|
||||
|
||||
next.chest.orientation = Quaternion::rotation_z(move2 * -0.7);
|
||||
next.head.orientation = Quaternion::rotation_z(move2 * 0.4);
|
||||
next.shorts.orientation.rotate_z(move2 * 0.5);
|
||||
next.belt.orientation = Quaternion::rotation_z(move2 * 0.1);
|
||||
next.control.orientation.rotate_z(move2 * -1.4);
|
||||
next.control.orientation.rotate_x(move2 * 0.5);
|
||||
next.control.position += Vec3::new(move2 * 7.0, 0.0, move2 * 6.0);
|
||||
},
|
||||
Some("common.abilities.axe.execute") => {
|
||||
let (move1, move2, move3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time, 0.0, 0.0),
|
||||
Some(StageSection::Action) => (1.0, anim_time, 0.0),
|
||||
Some(StageSection::Recover) => (1.0, 1.0, anim_time),
|
||||
_ => (0.0, 0.0, 0.0),
|
||||
};
|
||||
let pullback = 1.0 - move3;
|
||||
let move1 = move1 * pullback;
|
||||
let move2 = move2 * pullback;
|
||||
|
||||
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, s_a.ac.1, s_a.ac.2);
|
||||
next.control.orientation = Quaternion::rotation_x(s_a.ac.3)
|
||||
* Quaternion::rotation_y(s_a.ac.4)
|
||||
* Quaternion::rotation_z(s_a.ac.5 - move1 * PI);
|
||||
|
||||
next.control.orientation.rotate_x(move1 * 0.9);
|
||||
next.chest.orientation.rotate_z(move1 * 1.2);
|
||||
next.head.orientation.rotate_z(move1 * -0.5);
|
||||
next.belt.orientation.rotate_z(move1 * -0.3);
|
||||
next.shorts.orientation.rotate_z(move1 * -0.7);
|
||||
next.control.position += Vec3::new(move1 * 4.0, move1 * -12.0, move1 * 11.0);
|
||||
|
||||
next.chest.orientation.rotate_z(move2 * -2.0);
|
||||
next.head.orientation.rotate_z(move2 * 0.9);
|
||||
next.belt.orientation.rotate_z(move2 * 0.4);
|
||||
next.shorts.orientation.rotate_z(move2 * 1.1);
|
||||
next.control.orientation.rotate_x(move2 * -5.0);
|
||||
next.control.position += Vec3::new(move2 * -3.0, move2 * 12.0, move2 * -17.0);
|
||||
next.control.orientation.rotate_z(move2 * 0.7);
|
||||
},
|
||||
Some("common.abilities.axe.maelstrom") => {
|
||||
let (move1, move2_raw, move3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time, 0.0, 0.0),
|
||||
Some(StageSection::Action) => (1.0, anim_time, 0.0),
|
||||
Some(StageSection::Recover) => (1.0, 1.0, anim_time),
|
||||
_ => (0.0, 0.0, 0.0),
|
||||
};
|
||||
let pullback = 1.0 - move3;
|
||||
let move1 = move1 * pullback;
|
||||
let move2 = move2_raw * pullback;
|
||||
|
||||
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, s_a.ac.1, s_a.ac.2);
|
||||
next.control.orientation = Quaternion::rotation_x(s_a.ac.3)
|
||||
* Quaternion::rotation_y(s_a.ac.4)
|
||||
* Quaternion::rotation_z(s_a.ac.5 - move1 * PI);
|
||||
|
||||
next.control.orientation.rotate_x(move1 * 0.9);
|
||||
next.chest.orientation.rotate_z(move1 * 1.2);
|
||||
next.head.orientation.rotate_z(move1 * -0.5);
|
||||
next.belt.orientation.rotate_z(move1 * -0.3);
|
||||
next.shorts.orientation.rotate_z(move1 * -0.7);
|
||||
next.control.position += Vec3::new(move1 * 4.0, move1 * -12.0, move1 * 11.0);
|
||||
|
||||
next.chest.orientation.rotate_z(move2 * -2.0);
|
||||
next.head.orientation.rotate_z(move2 * 0.9);
|
||||
next.belt.orientation.rotate_z(move2 * 0.4);
|
||||
next.shorts.orientation.rotate_z(move2 * 1.1);
|
||||
next.control.orientation.rotate_x(move2 * -5.0);
|
||||
next.control.position += Vec3::new(move2 * 5.0, move2 * 12.0, move2 * -17.0);
|
||||
next.control.orientation.rotate_y(move2 * -2.0);
|
||||
next.control.orientation.rotate_z(move2 * -1.0);
|
||||
next.torso.orientation.rotate_z(move2_raw * -4.0 * PI);
|
||||
},
|
||||
Some("common.abilities.axe.lacerate") => {
|
||||
let (move1, move2, move3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time, 0.0, 0.0),
|
||||
Some(StageSection::Action) => (1.0, anim_time, 0.0),
|
||||
Some(StageSection::Recover) => (1.0, 1.0, anim_time),
|
||||
_ => (0.0, 0.0, 0.0),
|
||||
};
|
||||
let pullback = 1.0 - move3;
|
||||
let move1 = move1 * pullback;
|
||||
let move2_reset = ((move2 - 0.5).abs() - 0.5).abs() * 2.0;
|
||||
let move2 = move2 * pullback;
|
||||
|
||||
next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2 + 10.0);
|
||||
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, s_a.ac.1, s_a.ac.2);
|
||||
next.control.orientation = Quaternion::rotation_x(s_a.ac.3)
|
||||
* Quaternion::rotation_y(s_a.ac.4)
|
||||
* Quaternion::rotation_z(s_a.ac.5 - move1 * PI * 0.75);
|
||||
|
||||
next.chest.orientation.rotate_z(move1 * 1.2);
|
||||
next.head.orientation.rotate_z(move1 * -0.7);
|
||||
next.shorts.orientation.rotate_z(move1 * -0.9);
|
||||
next.belt.orientation.rotate_z(move1 * -0.3);
|
||||
|
||||
next.chest.orientation.rotate_z(move2 * -2.9);
|
||||
next.head.orientation.rotate_z(move2 * 1.2);
|
||||
next.shorts.orientation.rotate_z(move2 * 2.0);
|
||||
next.belt.orientation.rotate_z(move2 * 0.7);
|
||||
next.control.orientation.rotate_x(move2_reset * -1.0);
|
||||
next.control.orientation.rotate_z(move2 * -5.0);
|
||||
next.control.position += Vec3::new(move2 * 17.0, move2 * 3.0, 0.0);
|
||||
},
|
||||
Some("common.abilities.axe.riptide") => {
|
||||
let (move1, move2_raw, move3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time, 0.0, 0.0),
|
||||
Some(StageSection::Action) => (1.0, anim_time, 0.0),
|
||||
Some(StageSection::Recover) => (1.0, 1.0, anim_time),
|
||||
_ => (0.0, 0.0, 0.0),
|
||||
};
|
||||
let pullback = 1.0 - move3;
|
||||
let move1 = move1 * pullback;
|
||||
let move2_reset = ((move2_raw - 0.5).abs() - 0.5).abs() * 2.0;
|
||||
let move2 = move2_raw * pullback;
|
||||
|
||||
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, s_a.ac.1, s_a.ac.2);
|
||||
next.control.orientation = Quaternion::rotation_x(s_a.ac.3)
|
||||
* Quaternion::rotation_y(s_a.ac.4)
|
||||
* Quaternion::rotation_z(s_a.ac.5 - move1 * PI * 0.75);
|
||||
|
||||
next.chest.orientation.rotate_z(move1 * 1.2);
|
||||
next.head.orientation.rotate_z(move1 * -0.7);
|
||||
next.shorts.orientation.rotate_z(move1 * -0.9);
|
||||
next.belt.orientation.rotate_z(move1 * -0.3);
|
||||
|
||||
next.chest.orientation.rotate_z(move2 * -2.9);
|
||||
next.head.orientation.rotate_z(move2 * 1.2);
|
||||
next.shorts.orientation.rotate_z(move2 * 2.0);
|
||||
next.belt.orientation.rotate_z(move2 * 0.7);
|
||||
next.control.orientation.rotate_x(move2_reset * -1.0);
|
||||
next.control.orientation.rotate_z(move2 * -5.0);
|
||||
next.control.position += Vec3::new(move2 * 17.0, move2 * 3.0, 0.0);
|
||||
next.torso.orientation.rotate_z(move2_raw * -TAU)
|
||||
},
|
||||
Some("common.abilities.axe.keelhaul") => {
|
||||
let (move1, move2, move3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time, 0.0, 0.0),
|
||||
Some(StageSection::Action) => (1.0, anim_time, 0.0),
|
||||
Some(StageSection::Recover) => (1.0, 1.0, anim_time),
|
||||
_ => (0.0, 0.0, 0.0),
|
||||
};
|
||||
let pullback = 1.0 - move3;
|
||||
let move1 = move1 * pullback;
|
||||
let move2 = move2 * pullback;
|
||||
|
||||
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, s_a.ac.1, s_a.ac.2);
|
||||
next.control.orientation = Quaternion::rotation_x(s_a.ac.3)
|
||||
* Quaternion::rotation_y(s_a.ac.4)
|
||||
* Quaternion::rotation_z(s_a.ac.5);
|
||||
|
||||
next.control.orientation.rotate_z(move1 * -3.3);
|
||||
next.control.orientation.rotate_x(move1 * 0.8);
|
||||
next.control.position +=
|
||||
Vec3::new(move1 * 4.0, move1 * 4.0 - move2 * 6.0, move1 * 10.0);
|
||||
|
||||
next.chest.orientation.rotate_z(move2 * 1.2);
|
||||
next.head.orientation.rotate_z(move2 * -0.5);
|
||||
next.belt.orientation.rotate_z(move2 * -0.3);
|
||||
next.shorts.orientation.rotate_z(move2 * -0.9);
|
||||
next.control.orientation.rotate_z(move2 * -1.2);
|
||||
},
|
||||
Some("common.abilities.axe.bulkhead") => {
|
||||
let (move1, move2, move3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time, 0.0, 0.0),
|
||||
Some(StageSection::Action) => (1.0, anim_time, 0.0),
|
||||
Some(StageSection::Recover) => (1.0, 1.0, anim_time),
|
||||
_ => (0.0, 0.0, 0.0),
|
||||
};
|
||||
let pullback = 1.0 - move3;
|
||||
let move1 = move1 * pullback;
|
||||
let move2 = move2 * pullback;
|
||||
|
||||
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, s_a.ac.1, s_a.ac.2);
|
||||
next.control.orientation = Quaternion::rotation_x(s_a.ac.3)
|
||||
* Quaternion::rotation_y(s_a.ac.4)
|
||||
* Quaternion::rotation_z(s_a.ac.5 + move1 * -PI * 0.75 + move2 * PI * 0.25);
|
||||
|
||||
next.chest.orientation.rotate_z(move1 * 1.8);
|
||||
next.head.orientation.rotate_z(move1 * -0.6);
|
||||
next.belt.orientation.rotate_z(move1 * -0.4);
|
||||
next.shorts.orientation.rotate_z(move1 * -1.3);
|
||||
next.control.orientation.rotate_x(move1 * -0.8);
|
||||
|
||||
next.chest.orientation.rotate_z(move2 * -3.8);
|
||||
next.head.orientation.rotate_z(move2 * 1.2);
|
||||
next.belt.orientation.rotate_z(move2 * 0.8);
|
||||
next.shorts.orientation.rotate_z(move2 * 2.1);
|
||||
next.control.orientation.rotate_x(move2 * 0.6);
|
||||
next.control.orientation.rotate_z(move2 * -4.0);
|
||||
next.control.position += Vec3::new(move2 * 12.0, move2 * -6.0, 0.0);
|
||||
},
|
||||
Some("common.abilities.axe.capsize") => {
|
||||
let (move1, move2_raw, move3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time, 0.0, 0.0),
|
||||
Some(StageSection::Action) => (1.0, anim_time, 0.0),
|
||||
Some(StageSection::Recover) => (1.0, 1.0, anim_time),
|
||||
_ => (0.0, 0.0, 0.0),
|
||||
};
|
||||
let pullback = 1.0 - move3;
|
||||
let move1 = move1 * pullback;
|
||||
let move2 = move2_raw * pullback;
|
||||
|
||||
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, s_a.ac.1, s_a.ac.2);
|
||||
next.control.orientation = Quaternion::rotation_x(s_a.ac.3)
|
||||
* Quaternion::rotation_y(s_a.ac.4)
|
||||
* Quaternion::rotation_z(s_a.ac.5 + move1 * -PI * 0.75 + move2 * PI * 0.25);
|
||||
|
||||
next.chest.orientation.rotate_z(move1 * 1.8);
|
||||
next.head.orientation.rotate_z(move1 * -0.6);
|
||||
next.belt.orientation.rotate_z(move1 * -0.4);
|
||||
next.shorts.orientation.rotate_z(move1 * -1.3);
|
||||
next.control.orientation.rotate_x(move1 * -0.8);
|
||||
|
||||
next.chest.orientation.rotate_z(move2 * -3.8);
|
||||
next.head.orientation.rotate_z(move2 * 1.2);
|
||||
next.belt.orientation.rotate_z(move2 * 0.8);
|
||||
next.shorts.orientation.rotate_z(move2 * 2.1);
|
||||
next.control.orientation.rotate_x(move2 * 0.6);
|
||||
next.control.orientation.rotate_z(move2 * -4.0);
|
||||
next.control.position += Vec3::new(move2 * 12.0, move2 * -6.0, 0.0);
|
||||
next.torso.orientation.rotate_z(move2_raw * -TAU);
|
||||
},
|
||||
Some("common.abilities.axe.fracture") => {
|
||||
let (move1, move2, move3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time, 0.0, 0.0),
|
||||
Some(StageSection::Action) => (1.0, anim_time, 0.0),
|
||||
Some(StageSection::Recover) => (1.0, 1.0, anim_time),
|
||||
_ => (0.0, 0.0, 0.0),
|
||||
};
|
||||
let pullback = 1.0 - move3;
|
||||
let move1 = move1 * pullback;
|
||||
let move2 = move2 * pullback;
|
||||
|
||||
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, s_a.ac.1, s_a.ac.2);
|
||||
next.control.orientation = Quaternion::rotation_x(s_a.ac.3)
|
||||
* Quaternion::rotation_y(s_a.ac.4)
|
||||
* Quaternion::rotation_z(s_a.ac.5 + move1 * -PI / 2.0 + move2 * -0.5);
|
||||
|
||||
next.control.orientation.rotate_x(move1 * 0.0);
|
||||
next.chest.orientation.rotate_x(move1 * -0.5);
|
||||
next.chest.orientation.rotate_z(move1 * 0.7);
|
||||
next.head.orientation.rotate_z(move1 * -0.3);
|
||||
next.belt.orientation.rotate_z(move1 * -0.1);
|
||||
next.shorts.orientation.rotate_z(move1 * -0.4);
|
||||
|
||||
next.chest.orientation.rotate_z(move2 * -1.8);
|
||||
next.head.orientation.rotate_z(move2 * 0.9);
|
||||
next.shorts.orientation.rotate_z(move2 * 1.3);
|
||||
next.belt.orientation.rotate_z(move2 * 0.6);
|
||||
next.control.orientation.rotate_x(move2 * -0.9);
|
||||
next.control.orientation.rotate_z(move2 * -3.5);
|
||||
next.control.position += Vec3::new(move2 * 14.0, move2 * 6.0, 0.0);
|
||||
},
|
||||
Some("common.abilities.hammer.spine_cracker") => {
|
||||
hammer_start(&mut next, s_a);
|
||||
let (move1, move2, move3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time, 0.0, 0.0),
|
||||
Some(StageSection::Action) => (1.0, anim_time, 0.0),
|
||||
Some(StageSection::Recover) => (1.0, 1.0, anim_time),
|
||||
_ => (0.0, 0.0, 0.0),
|
||||
};
|
||||
let pullback = 1.0 - move3;
|
||||
let move1 = move1 * pullback;
|
||||
let move2 = move2 * pullback;
|
||||
|
||||
twist_back(&mut next, move1, 1.9, 1.5, 0.5, 1.2);
|
||||
next.head.position += Vec3::new(-2.0, 2.0, 0.0) * move1;
|
||||
next.control.orientation.rotate_x(move1 * 1.8);
|
||||
next.control.position += Vec3::new(0.0, 0.0, 8.0) * move1;
|
||||
next.control.orientation.rotate_y(move1 * 0.4);
|
||||
|
||||
twist_forward(&mut next, move2, 2.1, 1.6, 0.4, 1.3);
|
||||
next.control.orientation.rotate_z(move2 * 1.6);
|
||||
next.control.position += Vec3::new(-16.0, 12.0, -8.0) * move2;
|
||||
},
|
||||
Some("common.abilities.hammer.lung_pummel") => {
|
||||
hammer_start(&mut next, s_a);
|
||||
let (move1, move2, move3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time, 0.0, 0.0),
|
||||
Some(StageSection::Action) => (1.0, anim_time, 0.0),
|
||||
Some(StageSection::Recover) => (1.0, 1.0, anim_time),
|
||||
_ => (0.0, 0.0, 0.0),
|
||||
};
|
||||
let pullback = 1.0 - move3;
|
||||
let move1 = move1 * pullback;
|
||||
let move2 = move2 * pullback;
|
||||
|
||||
twist_back(&mut next, move1, 1.9, 0.7, 0.3, 1.2);
|
||||
next.control.orientation.rotate_x(move1 * 1.2);
|
||||
next.control.orientation.rotate_z(move1 * 1.0);
|
||||
next.control.position += Vec3::new(-12.0, 0.0, 0.0) * move1;
|
||||
|
||||
twist_forward(&mut next, move2, 3.4, 1.4, 0.9, 2.1);
|
||||
next.control.orientation.rotate_z(move2 * -4.0);
|
||||
next.control.position += Vec3::new(12.0, 0.0, 14.0) * move2;
|
||||
},
|
||||
Some("common.abilities.hammer.helm_crusher") => {
|
||||
hammer_start(&mut next, s_a);
|
||||
let (move1, move2, move3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time, 0.0, 0.0),
|
||||
Some(StageSection::Action) => (1.0, anim_time, 0.0),
|
||||
Some(StageSection::Recover) => (1.0, 1.0, anim_time),
|
||||
_ => (0.0, 0.0, 0.0),
|
||||
};
|
||||
let pullback = 1.0 - move3;
|
||||
let move1 = move1 * pullback;
|
||||
let move2 = move2 * pullback;
|
||||
|
||||
twist_back(&mut next, move1, 0.8, 0.3, 0.1, 0.5);
|
||||
next.control.orientation.rotate_x(move1 * -0.8);
|
||||
next.control.orientation.rotate_z(move1 * -1.6);
|
||||
next.control.orientation.rotate_x(move1 * 2.8);
|
||||
next.control.position += Vec3::new(-9.0, 0.0, 8.0) * move1;
|
||||
next.control.orientation.rotate_z(move1 * -0.4);
|
||||
|
||||
twist_forward(&mut next, move2, 1.8, 0.7, 0.4, 1.1);
|
||||
next.control.orientation.rotate_x(move2 * -5.0);
|
||||
next.control.orientation.rotate_z(move2 * -1.0);
|
||||
next.control.position += Vec3::new(-12.0, 0.0, -8.0) * move2;
|
||||
},
|
||||
Some("common.abilities.hammer.thunderclap") => {
|
||||
hammer_start(&mut next, s_a);
|
||||
let (move1, move2, move3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time, 0.0, 0.0),
|
||||
Some(StageSection::Action) => (1.0, anim_time, 0.0),
|
||||
Some(StageSection::Recover) => (1.0, 1.0, anim_time),
|
||||
_ => (0.0, 0.0, 0.0),
|
||||
};
|
||||
let pullback = 1.0 - move3;
|
||||
let move1 = move1 * pullback;
|
||||
let move2 = move2 * pullback;
|
||||
|
||||
twist_back(&mut next, move1, 1.8, 0.9, 0.5, 1.1);
|
||||
next.control.orientation.rotate_x(move1 * 2.4);
|
||||
next.control.position += Vec3::new(-16.0, -8.0, 12.0) * move1;
|
||||
next.control.orientation.rotate_z(move1 * PI / 2.0);
|
||||
next.control.orientation.rotate_x(move1 * 0.6);
|
||||
|
||||
twist_forward(&mut next, move2, 2.4, 1.1, 0.6, 1.4);
|
||||
next.control.orientation.rotate_x(move2 * -5.0);
|
||||
next.control.position += Vec3::new(4.0, 12.0, -12.0) * move2;
|
||||
next.control.orientation.rotate_z(move2 * 0.6);
|
||||
},
|
||||
Some("common.abilities.hammer.earthshaker") => {
|
||||
hammer_start(&mut next, s_a);
|
||||
let (move1, move2, move3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time, 0.0, 0.0),
|
||||
Some(StageSection::Action) => (1.0, anim_time, 0.0),
|
||||
Some(StageSection::Recover) => (1.0, 1.0, anim_time),
|
||||
_ => (0.0, 0.0, 0.0),
|
||||
};
|
||||
let pullback = 1.0 - move3;
|
||||
let move1 = move1 * pullback;
|
||||
let move2 = move2 * pullback;
|
||||
|
||||
next.hand_l.orientation.rotate_y(move1 * -PI);
|
||||
next.hand_r.orientation.rotate_y(move1 * -PI);
|
||||
next.control.orientation.rotate_x(2.4 * move1);
|
||||
next.control.orientation.rotate_z(move1 * -PI / 2.0);
|
||||
next.control.orientation.rotate_x(-0.6 * move1);
|
||||
next.control.position += Vec3::new(-8.0, 0.0, 24.0) * move1;
|
||||
next.chest.orientation.rotate_x(move1 * 0.5);
|
||||
next.torso.position += Vec3::new(0.0, 0.0, 8.0) * move1;
|
||||
|
||||
next.torso.position += Vec3::new(0.0, 0.0, -8.0) * move2;
|
||||
next.control.orientation.rotate_x(move2 * -0.8);
|
||||
next.control.position += Vec3::new(0.0, 0.0, -10.0) * move2;
|
||||
next.chest.orientation.rotate_x(move2 * -0.8);
|
||||
},
|
||||
Some("common.abilities.hammer.judgement") => {
|
||||
hammer_start(&mut next, s_a);
|
||||
let (move1, move2, move3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time, 0.0, 0.0),
|
||||
Some(StageSection::Action) => (1.0, anim_time, 0.0),
|
||||
Some(StageSection::Recover) => (1.0, 1.0, anim_time),
|
||||
_ => (0.0, 0.0, 0.0),
|
||||
};
|
||||
let pullback = 1.0 - move3;
|
||||
let move1 = move1 * pullback;
|
||||
let move2 = move2 * pullback;
|
||||
|
||||
next.control.orientation.rotate_x(2.4 * move1);
|
||||
next.control.orientation.rotate_z(move1 * PI / 2.0);
|
||||
next.control.orientation.rotate_x(-0.6 * move1);
|
||||
next.control.position += Vec3::new(-8.0, 6.0, 24.0) * move1;
|
||||
next.chest.orientation.rotate_x(move1 * 0.5);
|
||||
next.torso.position += Vec3::new(0.0, 0.0, 8.0) * move1;
|
||||
|
||||
next.torso.position += Vec3::new(0.0, 0.0, -8.0) * move2;
|
||||
next.chest.orientation.rotate_x(-1.5 * move2);
|
||||
next.belt.orientation.rotate_x(0.3 * move2);
|
||||
next.shorts.orientation.rotate_x(0.6 * move2);
|
||||
next.control.orientation.rotate_x(-3.0 * move2);
|
||||
next.control.position += Vec3::new(0.0, 0.0, -16.0) * move2;
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
|
||||
next
|
||||
}
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
use super::{super::Animation, CharacterSkeleton, SkeletonAttr};
|
||||
use common::states::utils::StageSection;
|
||||
|
||||
pub struct LeapAnimation;
|
||||
|
||||
type LeapAnimationDependency = (StageSection,);
|
||||
impl Animation for LeapAnimation {
|
||||
type Dependency<'a> = LeapAnimationDependency;
|
||||
type Skeleton = CharacterSkeleton;
|
||||
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const UPDATE_FN: &'static [u8] = b"character_leapmelee\0";
|
||||
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_leapmelee")]
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
_stage_section: Self::Dependency<'_>,
|
||||
_anim_time: f32,
|
||||
rate: &mut f32,
|
||||
_s_a: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
*rate = 1.0;
|
||||
/* let mut next = */
|
||||
(*skeleton).clone()
|
||||
// next
|
||||
}
|
||||
}
|
@ -1,34 +1,20 @@
|
||||
pub mod alpha;
|
||||
pub mod beam;
|
||||
pub mod beta;
|
||||
pub mod block;
|
||||
pub mod basic;
|
||||
pub mod boost;
|
||||
pub mod chargeswing;
|
||||
pub mod climb;
|
||||
pub mod collect;
|
||||
pub mod combomelee;
|
||||
pub mod consume;
|
||||
pub mod dance;
|
||||
pub mod dash;
|
||||
pub mod divemelee;
|
||||
pub mod equip;
|
||||
pub mod finishermelee;
|
||||
pub mod glidewield;
|
||||
pub mod gliding;
|
||||
pub mod idle;
|
||||
pub mod jump;
|
||||
pub mod leapmelee;
|
||||
pub mod mount;
|
||||
pub mod multi;
|
||||
pub mod music;
|
||||
pub mod pet;
|
||||
pub mod rapidmelee;
|
||||
pub mod repeater;
|
||||
pub mod ripostemelee;
|
||||
pub mod roll;
|
||||
pub mod run;
|
||||
pub mod selfbuff;
|
||||
pub mod shockwave;
|
||||
pub mod shoot;
|
||||
pub mod sit;
|
||||
pub mod sleep;
|
||||
pub mod sneak;
|
||||
@ -46,21 +32,37 @@ pub mod wield;
|
||||
|
||||
// Reexports
|
||||
pub use self::{
|
||||
alpha::AlphaAnimation, beam::BeamAnimation, beta::BetaAnimation, block::BlockAnimation,
|
||||
boost::BoostAnimation, chargeswing::ChargeswingAnimation, climb::ClimbAnimation,
|
||||
collect::CollectAnimation, combomelee::ComboAnimation, consume::ConsumeAnimation,
|
||||
dance::DanceAnimation, dash::DashAnimation, divemelee::DiveMeleeAnimation,
|
||||
equip::EquipAnimation, finishermelee::FinisherMeleeAnimation, glidewield::GlideWieldAnimation,
|
||||
gliding::GlidingAnimation, idle::IdleAnimation, jump::JumpAnimation, leapmelee::LeapAnimation,
|
||||
mount::MountAnimation, music::MusicAnimation, pet::PetAnimation,
|
||||
rapidmelee::RapidMeleeAnimation, repeater::RepeaterAnimation,
|
||||
ripostemelee::RiposteMeleeAnimation, roll::RollAnimation, run::RunAnimation,
|
||||
selfbuff::SelfBuffAnimation, shockwave::ShockwaveAnimation, shoot::ShootAnimation,
|
||||
sit::SitAnimation, sleep::SleepAnimation, sneak::SneakAnimation,
|
||||
sneakequip::SneakEquipAnimation, sneakwield::SneakWieldAnimation,
|
||||
staggered::StaggeredAnimation, stand::StandAnimation, steer::SteerAnimation,
|
||||
stunned::StunnedAnimation, swim::SwimAnimation, swimwield::SwimWieldAnimation,
|
||||
talk::TalkAnimation, wallrun::WallrunAnimation, wield::WieldAnimation,
|
||||
basic::{BasicAction, BasicActionDependency},
|
||||
boost::BoostAnimation,
|
||||
climb::ClimbAnimation,
|
||||
collect::CollectAnimation,
|
||||
consume::ConsumeAnimation,
|
||||
dance::DanceAnimation,
|
||||
equip::EquipAnimation,
|
||||
glidewield::GlideWieldAnimation,
|
||||
gliding::GlidingAnimation,
|
||||
idle::IdleAnimation,
|
||||
jump::JumpAnimation,
|
||||
mount::MountAnimation,
|
||||
multi::{MultiAction, MultiActionDependency},
|
||||
music::MusicAnimation,
|
||||
pet::PetAnimation,
|
||||
roll::RollAnimation,
|
||||
run::RunAnimation,
|
||||
sit::SitAnimation,
|
||||
sleep::SleepAnimation,
|
||||
sneak::SneakAnimation,
|
||||
sneakequip::SneakEquipAnimation,
|
||||
sneakwield::SneakWieldAnimation,
|
||||
staggered::StaggeredAnimation,
|
||||
stand::StandAnimation,
|
||||
steer::SteerAnimation,
|
||||
stunned::StunnedAnimation,
|
||||
swim::SwimAnimation,
|
||||
swimwield::SwimWieldAnimation,
|
||||
talk::TalkAnimation,
|
||||
wallrun::WallrunAnimation,
|
||||
wield::WieldAnimation,
|
||||
};
|
||||
use super::{make_bone, vek::*, FigureBoneData, Offsets, Skeleton, TrailSource};
|
||||
use common::comp::{
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,438 +0,0 @@
|
||||
use super::{
|
||||
super::{vek::*, Animation},
|
||||
dual_wield_start, hammer_start, twist_back, twist_forward, CharacterSkeleton, SkeletonAttr,
|
||||
};
|
||||
use common::states::utils::{AbilityInfo, StageSection};
|
||||
use core::f32::consts::{PI, TAU};
|
||||
use std::ops::{Mul, Sub};
|
||||
|
||||
pub struct RapidMeleeAnimation;
|
||||
impl Animation for RapidMeleeAnimation {
|
||||
type Dependency<'a> = (
|
||||
Option<&'a str>,
|
||||
Option<StageSection>,
|
||||
(u32, Option<u32>),
|
||||
Option<AbilityInfo>,
|
||||
);
|
||||
type Skeleton = CharacterSkeleton;
|
||||
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const UPDATE_FN: &'static [u8] = b"character_rapid_melee\0";
|
||||
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_rapid_melee")]
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
(ability_id, stage_section, (current_strike, max_strikes), _ability_info): Self::Dependency<
|
||||
'_,
|
||||
>,
|
||||
anim_time: f32,
|
||||
rate: &mut f32,
|
||||
s_a: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
*rate = 1.0;
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
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);
|
||||
if matches!(stage_section, Some(StageSection::Action)) {
|
||||
next.main_weapon_trail = true;
|
||||
next.off_weapon_trail = true;
|
||||
}
|
||||
|
||||
match ability_id {
|
||||
Some(
|
||||
"common.abilities.sword.cleaving_whirlwind_slice"
|
||||
| "common.abilities.sword.cleaving_bladestorm"
|
||||
| "common.abilities.sword.cleaving_dual_whirlwind_slice"
|
||||
| "common.abilities.sword.cleaving_dual_bladestorm",
|
||||
) => {
|
||||
let (move1, move2, move3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time, 0.0, 0.0),
|
||||
Some(StageSection::Action) => (1.0, anim_time, 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 move2_no_pullback = move2 + current_strike as f32;
|
||||
let move2 = if current_strike == 0 { move2 } else { 1.0 };
|
||||
let move2_pre = move2.min(0.3) * 10.0 / 3.0;
|
||||
let move1 = move1 * pullback;
|
||||
let move2 = move2 * pullback;
|
||||
let move2_pre = move2_pre * pullback;
|
||||
|
||||
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, -1.0, -2.0);
|
||||
next.hand_r.orientation = Quaternion::rotation_x(1.4);
|
||||
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) * Quaternion::rotation_z(move1 * PI);
|
||||
|
||||
if move2 < f32::EPSILON {
|
||||
next.main_weapon_trail = false;
|
||||
next.off_weapon_trail = false;
|
||||
}
|
||||
next.chest.orientation = Quaternion::rotation_z(move1 * 1.2);
|
||||
next.head.orientation = Quaternion::rotation_z(move1 * -0.7);
|
||||
next.belt.orientation = Quaternion::rotation_z(move1 * -0.3);
|
||||
next.shorts.orientation = Quaternion::rotation_z(move1 * -0.8);
|
||||
next.control.orientation.rotate_x(move1 * 0.2);
|
||||
next.foot_r
|
||||
.orientation
|
||||
.rotate_x(move1 * -0.4 + move2_pre * 0.4);
|
||||
next.foot_r.orientation.rotate_z(move1 * 1.4);
|
||||
|
||||
next.control.orientation.rotate_y(move2_pre * -1.6);
|
||||
next.control.position += Vec3::new(0.0, 0.0, move2_pre * 4.0);
|
||||
next.torso.orientation.rotate_z(move2_no_pullback * TAU);
|
||||
next.chest.orientation.rotate_z(move2 * -2.0);
|
||||
next.head.orientation.rotate_z(move2 * 1.3);
|
||||
next.belt.orientation.rotate_z(move2 * 0.6);
|
||||
next.shorts.orientation.rotate_z(move2 * 1.5);
|
||||
next.foot_r.orientation.rotate_z(move2_pre * -1.7);
|
||||
next.control.orientation.rotate_z(move2 * -1.8);
|
||||
next.control.position += Vec3::new(move2 * 14.0, 0.0, 0.0);
|
||||
},
|
||||
Some(
|
||||
"common.abilities.sword.agile_perforate" | "common.abilities.sword.agile_flurry",
|
||||
) => {
|
||||
let (move1, move2, move3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
|
||||
Some(StageSection::Action) => (
|
||||
1.0,
|
||||
anim_time.min(0.5).mul(2.0).powi(2) - anim_time.max(0.5).sub(0.5).mul(2.0),
|
||||
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 move1 = move1 * pullback;
|
||||
let move2 = move2 * pullback;
|
||||
|
||||
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, s_a.sc.1, s_a.sc.2);
|
||||
next.control.orientation = Quaternion::rotation_x(s_a.sc.3);
|
||||
|
||||
next.chest.orientation = Quaternion::rotation_z(move1 * 0.7);
|
||||
next.head.orientation = Quaternion::rotation_z(move1 * -0.4);
|
||||
next.shorts.orientation = Quaternion::rotation_z(move1 * -0.5);
|
||||
next.belt.orientation = Quaternion::rotation_z(move1 * -0.2);
|
||||
next.control.orientation.rotate_x(move1 * -1.1);
|
||||
next.control.orientation.rotate_z(move1 * -0.7);
|
||||
next.control.position += Vec3::new(move1 * 1.0, move1 * -1.0, move1 * 4.0);
|
||||
|
||||
next.chest.orientation.rotate_z(move2 * -1.2);
|
||||
next.head.orientation.rotate_z(move2 * 0.6);
|
||||
next.belt.orientation.rotate_z(move2 * 0.3);
|
||||
next.shorts.orientation.rotate_z(move2 * 0.7);
|
||||
next.control.orientation.rotate_z(move2 * 1.2);
|
||||
next.control.position += Vec3::new(0.0, move2 * 12.0, 0.0);
|
||||
},
|
||||
Some(
|
||||
"common.abilities.sword.agile_dual_perforate"
|
||||
| "common.abilities.sword.agile_dual_flurry",
|
||||
) => {
|
||||
let (move1, move2, move3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
|
||||
Some(StageSection::Action) => (
|
||||
1.0,
|
||||
anim_time.min(0.5).mul(2.0).powi(2) - anim_time.max(0.5).sub(0.5).mul(2.0),
|
||||
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 move1 = move1 * pullback;
|
||||
let move2 = move2 * pullback;
|
||||
let dir = if current_strike % 2 == 1 { 1.0 } else { -1.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.shl.0, s_a.shl.1, s_a.shl.2);
|
||||
next.hand_r.orientation = Quaternion::rotation_x(s_a.shl.3);
|
||||
next.control_l.position = Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2);
|
||||
next.control_l.orientation = Quaternion::rotation_x(s_a.sc.3);
|
||||
next.control_r.position = Vec3::new(-s_a.sc.0, s_a.sc.1, s_a.sc.2);
|
||||
next.control_r.orientation = Quaternion::rotation_x(s_a.sc.3);
|
||||
|
||||
next.control_l.orientation.rotate_x(move1 * -1.1);
|
||||
next.control_l.orientation.rotate_z(move1 * 0.7);
|
||||
next.control_l.position += Vec3::new(move1 * 1.0, move1 * -1.0, move1 * 4.0);
|
||||
next.control_r.orientation.rotate_x(move1 * -1.1);
|
||||
next.control_r.orientation.rotate_z(move1 * -0.7);
|
||||
next.control_r.position += Vec3::new(move1 * -1.0, move1 * -1.0, move1 * 4.0);
|
||||
|
||||
next.chest.orientation.rotate_z(move2 * -1.2 * dir);
|
||||
next.head.orientation.rotate_z(move2 * 0.6 * dir);
|
||||
next.belt.orientation.rotate_z(move2 * 0.3 * dir);
|
||||
next.shorts.orientation.rotate_z(move2 * 0.7 * dir);
|
||||
next.control_l
|
||||
.orientation
|
||||
.rotate_z(move2 * 1.2 * dir.max(0.0));
|
||||
next.control_l.position += Vec3::new(0.0, move2 * 18.0 * dir.max(0.0), 0.0);
|
||||
next.control_r
|
||||
.orientation
|
||||
.rotate_z(move2 * 1.2 * dir.min(0.0));
|
||||
next.control_r.position += Vec3::new(0.0, move2 * 18.0 * -(dir.min(0.0)), 0.0);
|
||||
next.control_l.orientation.rotate_z(move1 * -0.7);
|
||||
next.control_r.orientation.rotate_z(move1 * 0.7);
|
||||
},
|
||||
Some("common.abilities.sword.agile_hundred_cuts") => {
|
||||
let (move1, move2, move3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
|
||||
Some(StageSection::Action) => (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 move1 = move1 * pullback;
|
||||
let move2 = move2 * pullback;
|
||||
let (move2a, move2b, move2c, move2d) = match current_strike % 4 {
|
||||
0 => (move2, 0.0, 0.0, 0.0),
|
||||
1 => (1.0, move2, 0.0, 0.0),
|
||||
2 => (1.0, 1.0, move2, 0.0),
|
||||
3 => (1.0, 1.0, 1.0, move2),
|
||||
_ => (0.0, 0.0, 0.0, 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.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, s_a.sc.1, s_a.sc.2);
|
||||
next.control.orientation = Quaternion::rotation_x(s_a.sc.3);
|
||||
|
||||
next.chest.orientation = Quaternion::rotation_z(move1 * 0.4);
|
||||
next.head.orientation = Quaternion::rotation_z(move1 * -0.2);
|
||||
next.shorts.orientation = Quaternion::rotation_z(move1 * -0.2);
|
||||
next.belt.orientation = Quaternion::rotation_z(move1 * -0.1);
|
||||
next.control.orientation.rotate_y(move1 * -1.2);
|
||||
next.control.position += Vec3::new(0.0, 0.0, move1 * 10.0);
|
||||
|
||||
next.chest.orientation.rotate_z(move2a * -0.2);
|
||||
next.control.orientation.rotate_z(move2a * -2.0);
|
||||
next.control.position += Vec3::new(move2a * 12.0, 0.0, move2a * -6.0);
|
||||
|
||||
next.chest.orientation.rotate_z(move2b * 0.2);
|
||||
next.control.orientation.rotate_z(move2b * 2.9);
|
||||
next.control.position += Vec3::new(move2b * -12.0, 0.0, 0.0);
|
||||
|
||||
next.chest.orientation.rotate_z(move2c * -0.2);
|
||||
next.control.orientation.rotate_z(move2c * -2.3);
|
||||
next.control.position += Vec3::new(move2c * 12.0, 0.0, move2c * 12.0);
|
||||
|
||||
next.chest.orientation.rotate_z(move2d * -0.2);
|
||||
next.control.orientation.rotate_z(move2d * -2.7);
|
||||
next.control.position += Vec3::new(move2d * 12.0, 0.0, move2a * -6.0);
|
||||
},
|
||||
Some("common.abilities.sword.crippling_mutilate") => {
|
||||
let (move1, move2, move3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
|
||||
Some(StageSection::Action) => (
|
||||
1.0,
|
||||
if current_strike % 2 == 0 {
|
||||
anim_time
|
||||
} else {
|
||||
1.0 - anim_time
|
||||
},
|
||||
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 move1 = move1 * pullback;
|
||||
let move2 = move2 * pullback;
|
||||
|
||||
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, s_a.sc.1, s_a.sc.2);
|
||||
next.control.orientation = Quaternion::rotation_x(s_a.sc.3);
|
||||
|
||||
next.chest.orientation = Quaternion::rotation_z(move1 * 0.7);
|
||||
next.head.orientation = Quaternion::rotation_z(move1 * -0.4);
|
||||
next.shorts.orientation = Quaternion::rotation_z(move1 * -0.5);
|
||||
next.belt.orientation = Quaternion::rotation_z(move1 * -0.2);
|
||||
next.control.orientation.rotate_x(move1 * -0.6);
|
||||
next.control.orientation.rotate_z(move1 * -0.7);
|
||||
next.control.position += Vec3::new(move1 * 1.0, move1 * -4.0, move1 * 4.0);
|
||||
|
||||
next.chest.orientation.rotate_z(move2 * -1.2);
|
||||
next.head.orientation.rotate_z(move2 * 0.6);
|
||||
next.belt.orientation.rotate_z(move2 * 0.3);
|
||||
next.shorts.orientation.rotate_z(move2 * 0.7);
|
||||
next.control.orientation.rotate_z(move2 * 1.2);
|
||||
next.control.position += Vec3::new(0.0, move2 * 14.0, move2 * 12.0);
|
||||
},
|
||||
Some("common.abilities.axe.fierce_raze") => {
|
||||
let (move1, move2, move3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time, 0.0, 0.0),
|
||||
Some(StageSection::Action) => (
|
||||
1.0,
|
||||
anim_time.min(0.5).mul(2.0) - anim_time.max(0.5).sub(0.5).mul(2.0),
|
||||
0.0,
|
||||
),
|
||||
Some(StageSection::Recover) => (1.0, 1.0, anim_time),
|
||||
_ => (0.0, 0.0, 0.0),
|
||||
};
|
||||
let pullback = 1.0 - move3;
|
||||
let move1 = move1 * pullback;
|
||||
let move2 = move2 * pullback;
|
||||
if anim_time > 0.5 {
|
||||
next.main_weapon_trail = false;
|
||||
next.off_weapon_trail = false;
|
||||
}
|
||||
|
||||
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, s_a.ac.1, s_a.ac.2);
|
||||
next.control.orientation = Quaternion::rotation_x(s_a.ac.3)
|
||||
* Quaternion::rotation_y(s_a.ac.4)
|
||||
* Quaternion::rotation_z(s_a.ac.5 + move1 * -PI);
|
||||
|
||||
next.chest.orientation.rotate_z(move1 * 0.7);
|
||||
next.head.orientation.rotate_z(move1 * -0.3);
|
||||
next.belt.orientation.rotate_z(move1 * -0.2);
|
||||
next.shorts.orientation.rotate_z(move1 * -0.4);
|
||||
next.control.orientation.rotate_x(move1 * -2.1);
|
||||
next.control.orientation.rotate_z(move1 * -0.5);
|
||||
next.control.position += Vec3::new(move1 * 6.0, move1 * -3.0, 0.0);
|
||||
next.control.orientation.rotate_y(move1 * -0.3);
|
||||
|
||||
next.chest.orientation.rotate_z(move2 * -1.8);
|
||||
next.head.orientation.rotate_z(move2 * 0.8);
|
||||
next.belt.orientation.rotate_z(move2 * 0.4);
|
||||
next.shorts.orientation.rotate_z(move2 * 1.1);
|
||||
next.control.orientation.rotate_x(move2 * -2.7);
|
||||
next.control.position += Vec3::new(move2 * 4.0, 0.0, move2 * -7.0);
|
||||
},
|
||||
Some("common.abilities.axe.dual_fierce_raze") => {
|
||||
let (move1, move2, move3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time, 0.0, 0.0),
|
||||
Some(StageSection::Action) => (
|
||||
1.0,
|
||||
anim_time.min(0.5).mul(2.0) - anim_time.max(0.5).sub(0.5).mul(2.0),
|
||||
0.0,
|
||||
),
|
||||
Some(StageSection::Recover) => (1.0, 1.0, anim_time),
|
||||
_ => (0.0, 0.0, 0.0),
|
||||
};
|
||||
let pullback = 1.0 - move3;
|
||||
let move1 = move1 * pullback;
|
||||
let move2 = move2 * pullback;
|
||||
if anim_time > 0.5 {
|
||||
next.main_weapon_trail = false;
|
||||
next.off_weapon_trail = false;
|
||||
}
|
||||
|
||||
next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2 + -4.0);
|
||||
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, s_a.ac.1, s_a.ac.2);
|
||||
next.control.orientation = Quaternion::rotation_x(s_a.ac.3)
|
||||
* Quaternion::rotation_y(s_a.ac.4)
|
||||
* Quaternion::rotation_z(s_a.ac.5);
|
||||
next.control_r.position += Vec3::new(8.0, 0.0, 0.0);
|
||||
|
||||
next.chest.orientation.rotate_z(move1 * 0.7);
|
||||
next.head.orientation.rotate_z(move1 * -0.3);
|
||||
next.belt.orientation.rotate_z(move1 * -0.2);
|
||||
next.shorts.orientation.rotate_z(move1 * -0.4);
|
||||
next.control.orientation.rotate_x(move1 * -2.1);
|
||||
next.control.orientation.rotate_z(move1 * -0.5);
|
||||
next.control.position += Vec3::new(move1 * 6.0, move1 * -3.0, 0.0);
|
||||
next.control.orientation.rotate_y(move1 * -0.3);
|
||||
|
||||
next.chest.orientation.rotate_z(move2 * -1.8);
|
||||
next.head.orientation.rotate_z(move2 * 0.8);
|
||||
next.belt.orientation.rotate_z(move2 * 0.4);
|
||||
next.shorts.orientation.rotate_z(move2 * 1.1);
|
||||
next.control.orientation.rotate_x(move2 * -2.7);
|
||||
next.control.position += Vec3::new(move2 * 4.0, 0.0, move2 * -7.0);
|
||||
},
|
||||
Some("common.abilities.hammer.iron_tempest") => {
|
||||
hammer_start(&mut next, s_a);
|
||||
let (move1, move2, move3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time, 0.0, 0.0),
|
||||
Some(StageSection::Action) => (1.0, anim_time, 0.0),
|
||||
Some(StageSection::Recover) => (1.0, 1.0, anim_time),
|
||||
_ => (0.0, 0.0, 0.0),
|
||||
};
|
||||
let pullback = 1.0 - move3;
|
||||
let move1 = move1 * pullback;
|
||||
let move2_tot = current_strike as f32 + move2;
|
||||
let move2 = move2_tot / max_strikes.map_or(1.0, |x| x as f32);
|
||||
let move2 = move2 * pullback;
|
||||
|
||||
twist_back(&mut next, move1, 2.0, 0.8, 0.3, 1.4);
|
||||
next.control.orientation.rotate_x(move1 * 0.8);
|
||||
next.control.position += Vec3::new(-15.0, 0.0, 6.0) * move1;
|
||||
next.control.orientation.rotate_z(move1 * 1.2);
|
||||
|
||||
next.torso.orientation.rotate_z(-TAU * move2_tot);
|
||||
twist_forward(&mut next, move2, 3.0, 1.2, 0.5, 1.8);
|
||||
next.control.orientation.rotate_z(move2 * -5.0);
|
||||
next.control.position += Vec3::new(20.0, 0.0, 0.0) * move2;
|
||||
},
|
||||
Some("common.abilities.hammer.dual_iron_tempest") => {
|
||||
dual_wield_start(&mut next);
|
||||
let (move1, move2, move3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time, 0.0, 0.0),
|
||||
Some(StageSection::Action) => (1.0, anim_time, 0.0),
|
||||
Some(StageSection::Recover) => (1.0, 1.0, anim_time),
|
||||
_ => (0.0, 0.0, 0.0),
|
||||
};
|
||||
let pullback = 1.0 - move3;
|
||||
let move1 = move1 * pullback;
|
||||
let move2_tot = current_strike as f32 + move2;
|
||||
let move2 = move2_tot / max_strikes.map_or(1.0, |x| x as f32);
|
||||
let move2 = move2 * pullback;
|
||||
|
||||
twist_back(&mut next, move1, 2.0, 0.8, 0.3, 1.4);
|
||||
next.control_l.orientation.rotate_y(move1 * -PI / 2.0);
|
||||
next.control_r.orientation.rotate_y(move1 * -PI / 2.0);
|
||||
next.control.orientation.rotate_z(move1 * 1.2);
|
||||
next.control.position += Vec3::new(-10.0, 10.0, 6.0) * move1;
|
||||
next.control_r.position += Vec3::new(0.0, -10.0, 0.0) * move1;
|
||||
|
||||
next.torso.orientation.rotate_z(-TAU * move2_tot);
|
||||
twist_forward(&mut next, move2, 3.0, 1.2, 0.5, 1.8);
|
||||
next.control.orientation.rotate_z(move2 * -3.0);
|
||||
next.control.position += Vec3::new(20.0, -10.0, 0.0) * move2;
|
||||
next.control_r.position += Vec3::new(0.0, 10.0, 0.0) * move2;
|
||||
next.control_l.position += Vec3::new(0.0, -10.0, 0.0) * move2;
|
||||
// next.control.position += Vec3::new(20.0, 0.0, 0.0) * move2;
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
|
||||
next
|
||||
}
|
||||
}
|
@ -1,116 +0,0 @@
|
||||
use super::{
|
||||
super::{vek::*, Animation},
|
||||
CharacterSkeleton, SkeletonAttr,
|
||||
};
|
||||
use common::{
|
||||
comp::item::{Hands, ToolKind},
|
||||
states::utils::{AbilityInfo, StageSection},
|
||||
util::Dir,
|
||||
};
|
||||
use core::f32::consts::PI;
|
||||
|
||||
pub struct RepeaterAnimation;
|
||||
|
||||
impl Animation for RepeaterAnimation {
|
||||
type Dependency<'a> = (
|
||||
Option<AbilityInfo>,
|
||||
(Option<Hands>, Option<Hands>),
|
||||
Vec3<f32>,
|
||||
Dir,
|
||||
Vec3<f32>,
|
||||
f32,
|
||||
Option<StageSection>,
|
||||
);
|
||||
type Skeleton = CharacterSkeleton;
|
||||
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const UPDATE_FN: &'static [u8] = b"character_repeater\0";
|
||||
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_repeater")]
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
(ability_info, hands, orientation,look_dir, velocity, _global_time, stage_section): Self::Dependency<'_>,
|
||||
anim_time: f32,
|
||||
rate: &mut f32,
|
||||
s_a: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
*rate = 1.0;
|
||||
let mut next = (*skeleton).clone();
|
||||
let speed = Vec2::<f32>::from(velocity).magnitude();
|
||||
let ori_angle = orientation.y.atan2(orientation.x);
|
||||
let lookdir_angle = look_dir.y.atan2(look_dir.x);
|
||||
let swivel = lookdir_angle - ori_angle;
|
||||
let (move1base, move2base, move3base, move4) = match stage_section {
|
||||
Some(StageSection::Movement) => (anim_time, 0.0, 0.0, 0.0),
|
||||
Some(StageSection::Buildup) => (1.0, anim_time, 0.0, 0.0),
|
||||
Some(StageSection::Action) => (1.0, 1.0, anim_time, 0.0),
|
||||
Some(StageSection::Recover) => (1.1, 1.0, 1.0, anim_time),
|
||||
_ => (0.0, 0.0, 0.0, 0.0),
|
||||
};
|
||||
let pullback = 1.0 - move4;
|
||||
let move1 = move1base * pullback;
|
||||
let move2 = move2base * pullback;
|
||||
let move3 = move3base * pullback;
|
||||
// end spin stuff
|
||||
|
||||
if let Some(ToolKind::Bow) = ability_info.and_then(|a| a.tool) {
|
||||
next.hand_l.position = Vec3::new(s_a.bhl.0, s_a.bhl.1, s_a.bhl.2);
|
||||
next.hand_l.orientation = Quaternion::rotation_x(s_a.bhl.3);
|
||||
next.hand_r.position = Vec3::new(s_a.bhr.0, s_a.bhr.1, s_a.bhr.2);
|
||||
next.hand_r.orientation = Quaternion::rotation_x(s_a.bhr.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.hold.position = Vec3::new(0.0, -1.0 + move3 * 2.0, -5.2);
|
||||
next.hold.orientation = Quaternion::rotation_x(-PI / 2.0) * Quaternion::rotation_z(0.0);
|
||||
next.hold.scale = Vec3::one() * (1.0);
|
||||
|
||||
next.chest.orientation = Quaternion::rotation_z(swivel * 0.8);
|
||||
next.torso.orientation = Quaternion::rotation_z(swivel * 0.2);
|
||||
|
||||
if speed < 0.5 {
|
||||
next.foot_l.position = Vec3::new(
|
||||
-s_a.foot.0 + move1 * -0.75,
|
||||
s_a.foot.1 + move1 * 4.0,
|
||||
s_a.foot.2,
|
||||
);
|
||||
next.foot_l.orientation =
|
||||
Quaternion::rotation_x(move1 * 0.2 + move2 * -0.1 + move3 * -0.2)
|
||||
* Quaternion::rotation_z(move3 * 0.1);
|
||||
|
||||
next.foot_r.position = Vec3::new(s_a.foot.0 + move1 * 0.75, s_a.foot.1, s_a.foot.2);
|
||||
next.foot_r.orientation =
|
||||
Quaternion::rotation_x(move1 * 0.06 + move2 * -0.2 + move3 * -0.5)
|
||||
* Quaternion::rotation_z(move1 * -0.6 + move3 * 0.8);
|
||||
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1);
|
||||
next.chest.orientation = Quaternion::rotation_x(0.0);
|
||||
};
|
||||
next.shorts.position = Vec3::new(0.0, s_a.shorts.0 + move1 * 2.0, s_a.shorts.1);
|
||||
next.shorts.orientation = Quaternion::rotation_x(move1 * 0.2 + move3 * 0.2);
|
||||
next.belt.position = Vec3::new(0.0, s_a.belt.0 + move1 * 1.0, s_a.belt.1);
|
||||
next.belt.orientation = Quaternion::rotation_x(move1 * 0.1 + move3 * 0.1);
|
||||
next.control.position = Vec3::new(
|
||||
s_a.bc.0 + move1 * 5.0,
|
||||
s_a.bc.1 + move1 * 3.0,
|
||||
s_a.bc.2 + move1 * 5.0,
|
||||
);
|
||||
next.control.orientation = Quaternion::rotation_x(s_a.bc.3 + move1 * 0.4)
|
||||
* Quaternion::rotation_y(s_a.bc.4 + move1 * 0.8)
|
||||
* Quaternion::rotation_z(s_a.bc.5);
|
||||
next.head.orientation = Quaternion::rotation_x(move1 * 0.15)
|
||||
* Quaternion::rotation_y(move1 * 0.15 + move2 * 0.05);
|
||||
next.torso.orientation = Quaternion::rotation_x(move1 * 0.25 + move3 * -0.2);
|
||||
|
||||
next.hand_l.position = Vec3::new(0.0, -2.5 + move3 * -6.0, 0.0);
|
||||
next.hand_l.orientation = Quaternion::rotation_x(1.5)
|
||||
* Quaternion::rotation_y(-0.0)
|
||||
* Quaternion::rotation_z(-0.3);
|
||||
}
|
||||
|
||||
if let (None, Some(Hands::Two)) = hands {
|
||||
next.second = next.main;
|
||||
}
|
||||
|
||||
next
|
||||
}
|
||||
}
|
@ -1,110 +0,0 @@
|
||||
use super::{
|
||||
super::{vek::*, Animation},
|
||||
hammer_start, twist_back, twist_forward, CharacterSkeleton, SkeletonAttr,
|
||||
};
|
||||
use common::states::utils::{AbilityInfo, StageSection};
|
||||
|
||||
pub struct RiposteMeleeAnimation;
|
||||
impl Animation for RiposteMeleeAnimation {
|
||||
type Dependency<'a> = (Option<&'a str>, Option<StageSection>, Option<AbilityInfo>);
|
||||
type Skeleton = CharacterSkeleton;
|
||||
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const UPDATE_FN: &'static [u8] = b"character_riposte_melee\0";
|
||||
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_riposte_melee")]
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
(ability_id, stage_section, _ability_info): Self::Dependency<'_>,
|
||||
anim_time: f32,
|
||||
rate: &mut f32,
|
||||
s_a: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
*rate = 1.0;
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
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);
|
||||
|
||||
if matches!(stage_section, Some(StageSection::Action)) {
|
||||
next.main_weapon_trail = true;
|
||||
next.off_weapon_trail = true;
|
||||
}
|
||||
|
||||
match ability_id {
|
||||
Some("common.abilities.sword.defensive_riposte") => {
|
||||
let (move1, move2, move3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
|
||||
Some(StageSection::Action) => (1.0, anim_time.powi(2), 0.0),
|
||||
Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)),
|
||||
_ => (0.0, 0.0, 0.0),
|
||||
};
|
||||
|
||||
let move2_slow = move2.powi(4);
|
||||
|
||||
let pullback = 1.0 - move3;
|
||||
let move1 = move1 * pullback;
|
||||
let move2 = move2 * pullback;
|
||||
let move2_slow = move2_slow * pullback;
|
||||
|
||||
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, s_a.sc.1, s_a.sc.2);
|
||||
next.control.orientation = Quaternion::rotation_x(s_a.sc.3)
|
||||
* Quaternion::rotation_z(move1 * 1.3 + move2 * -0.7);
|
||||
|
||||
next.chest.orientation = Quaternion::rotation_z(move1 * 0.8);
|
||||
next.head.orientation = Quaternion::rotation_z(move1 * -0.4);
|
||||
next.belt.orientation = Quaternion::rotation_z(move1 * -0.2);
|
||||
next.shorts.orientation = Quaternion::rotation_z(move1 * -0.5);
|
||||
next.control.orientation.rotate_x(move1 * 0.5);
|
||||
next.control.orientation.rotate_y(move1 * 2.1);
|
||||
next.control.orientation.rotate_z(move1 * -0.5);
|
||||
next.control.position += Vec3::new(0.0, move1 * 5.0, move1 * 8.0);
|
||||
|
||||
next.chest.orientation.rotate_z(move2 * -1.4);
|
||||
next.head.orientation.rotate_z(move2 * 0.9);
|
||||
next.belt.orientation.rotate_z(move2 * -0.3);
|
||||
next.shorts.orientation.rotate_z(move2 * 0.6);
|
||||
next.control.orientation.rotate_y(move2 * -4.0);
|
||||
next.control
|
||||
.orientation
|
||||
.rotate_z(move2_slow * -3.0 + move2 * 1.0);
|
||||
next.control.position +=
|
||||
Vec3::new(move2_slow * 11.0, move2_slow * -4.0, move2_slow * -6.0);
|
||||
},
|
||||
Some("common.abilities.hammer.retaliate") => {
|
||||
hammer_start(&mut next, s_a);
|
||||
let (move1, move2, move3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time, 0.0, 0.0),
|
||||
Some(StageSection::Action) => (1.0, anim_time, 0.0),
|
||||
Some(StageSection::Recover) => (1.0, 1.0, anim_time),
|
||||
_ => (0.0, 0.0, 0.0),
|
||||
};
|
||||
let pullback = 1.0 - move3;
|
||||
let move1 = move1 * pullback;
|
||||
let move2 = move2 * pullback;
|
||||
|
||||
twist_back(&mut next, move1, 0.6, 0.2, 0.0, 0.3);
|
||||
next.control.orientation.rotate_x(move1 * 1.5);
|
||||
next.control.orientation.rotate_y(move1 * 0.4);
|
||||
next.control.position += Vec3::new(0.0, 0.0, 16.0) * move1;
|
||||
|
||||
twist_forward(&mut next, move2, 2.1, 0.6, 0.4, 0.9);
|
||||
next.control.orientation.rotate_y(move2 * 2.0);
|
||||
next.control.orientation.rotate_x(move2 * -2.5);
|
||||
next.control.orientation.rotate_z(move2 * -0.6);
|
||||
next.control.position += Vec3::new(6.0, -10.0, -14.0) * move2;
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
|
||||
next
|
||||
}
|
||||
}
|
@ -1,424 +0,0 @@
|
||||
use super::{
|
||||
super::{vek::*, Animation},
|
||||
hammer_start, CharacterSkeleton, SkeletonAttr,
|
||||
};
|
||||
use common::states::utils::{AbilityInfo, StageSection};
|
||||
use core::f32::consts::{PI, TAU};
|
||||
|
||||
pub struct SelfBuffAnimation;
|
||||
impl Animation for SelfBuffAnimation {
|
||||
type Dependency<'a> = (Option<&'a str>, Option<StageSection>, Option<AbilityInfo>);
|
||||
type Skeleton = CharacterSkeleton;
|
||||
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const UPDATE_FN: &'static [u8] = b"character_self_buff\0";
|
||||
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_self_buff")]
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
(ability_id, stage_section, _ability_info): Self::Dependency<'_>,
|
||||
anim_time: f32,
|
||||
rate: &mut f32,
|
||||
s_a: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
*rate = 1.0;
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
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_id {
|
||||
Some("common.abilities.sword.heavy_fortitude") => {
|
||||
let (move1, move2, move3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
|
||||
Some(StageSection::Action) => (1.0, anim_time.powi(2), 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 move1 = move1 * pullback;
|
||||
let move2 = move2 * pullback;
|
||||
|
||||
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, s_a.sc.1, s_a.sc.2);
|
||||
next.control.orientation = Quaternion::rotation_x(s_a.sc.3);
|
||||
|
||||
next.foot_l.position += Vec3::new(move1 * 1.0, move1 * 2.0, 0.0);
|
||||
next.chest.orientation = Quaternion::rotation_z(move1 * -0.4);
|
||||
next.head.orientation = Quaternion::rotation_z(move1 * 0.2);
|
||||
next.shorts.orientation = Quaternion::rotation_z(move1 * 0.3);
|
||||
next.belt.orientation = Quaternion::rotation_z(move1 * 0.1);
|
||||
next.control.orientation.rotate_x(move1 * 0.4 + move2 * 0.6);
|
||||
next.control.orientation.rotate_z(move1 * 0.4);
|
||||
|
||||
next.foot_r.position += Vec3::new(move2 * -1.0, move2 * -2.0, 0.0);
|
||||
next.control.position += Vec3::new(move2 * 5.0, move2 * 7.0, move2 * 5.0);
|
||||
next.chest.position += Vec3::new(0.0, 0.0, move2 * -1.0);
|
||||
next.shorts.orientation.rotate_x(move2 * 0.2);
|
||||
next.shorts.position += Vec3::new(0.0, move2 * 1.0, 0.0);
|
||||
},
|
||||
Some("common.abilities.sword.defensive_stalwart_sword") => {
|
||||
let (move1, move2, move3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
|
||||
Some(StageSection::Action) => (1.0, anim_time.powi(2), 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 move1 = move1 * pullback;
|
||||
let move2 = move2 * pullback;
|
||||
|
||||
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, s_a.sc.1, s_a.sc.2);
|
||||
next.control.orientation =
|
||||
Quaternion::rotation_x(s_a.sc.3) * Quaternion::rotation_z(move2 * -0.5);
|
||||
|
||||
next.foot_r.position += Vec3::new(move1 * 1.0, move1 * -2.0, 0.0);
|
||||
next.foot_r.orientation.rotate_z(move1 * -0.9);
|
||||
next.chest.orientation = Quaternion::rotation_z(move1 * -0.5);
|
||||
next.head.orientation = Quaternion::rotation_z(move1 * 0.3);
|
||||
next.shorts.orientation = Quaternion::rotation_z(move1 * 0.1);
|
||||
next.control.orientation.rotate_x(move1 * 0.4);
|
||||
next.control.orientation.rotate_z(move1 * 0.5);
|
||||
next.control.position += Vec3::new(0.0, 0.0, move1 * 4.0);
|
||||
|
||||
next.control.position += Vec3::new(move2 * 8.0, 0.0, move2 * -1.0);
|
||||
next.control.orientation.rotate_x(move2 * -0.6);
|
||||
next.chest.position += Vec3::new(0.0, 0.0, move2 * -2.0);
|
||||
next.belt.position += Vec3::new(0.0, 0.0, move2 * 1.0);
|
||||
next.shorts.position += Vec3::new(0.0, 0.0, move2 * 1.0);
|
||||
next.shorts.orientation.rotate_x(move2 * 0.2);
|
||||
next.control.orientation.rotate_z(move2 * 0.4);
|
||||
},
|
||||
Some("common.abilities.sword.agile_dancing_edge") => {
|
||||
let (move1, move2, move3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
|
||||
Some(StageSection::Action) => (1.0, anim_time.powi(2), 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 move1 = move1 * pullback;
|
||||
let move2 = move2 * pullback;
|
||||
|
||||
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, s_a.sc.1, s_a.sc.2);
|
||||
next.control.orientation = Quaternion::rotation_x(s_a.sc.3);
|
||||
|
||||
next.head.orientation = Quaternion::rotation_x(move1 * 0.3);
|
||||
next.head.position += Vec3::new(0.0, 0.0, move1 * -1.0);
|
||||
next.control.position += Vec3::new(move1 * 8.0, move1 * 5.0, 0.0);
|
||||
|
||||
next.head.orientation.rotate_x(move2 * 0.2);
|
||||
next.head.position += Vec3::new(0.0, 0.0, move2 * -1.0);
|
||||
next.control.position += Vec3::new(0.0, move2 * -2.0, move2 * 12.0);
|
||||
next.control.orientation.rotate_x(move2 * 1.1);
|
||||
},
|
||||
Some("common.abilities.sword.cleaving_blade_fever") => {
|
||||
let (move1, move2, move3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
|
||||
Some(StageSection::Action) => (1.0, anim_time.powi(2), 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 move1 = move1 * pullback;
|
||||
let move2 = move2 * pullback;
|
||||
|
||||
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, s_a.sc.1, s_a.sc.2);
|
||||
next.control.orientation = Quaternion::rotation_x(s_a.sc.3);
|
||||
|
||||
next.foot_l.position += Vec3::new(move1 * 1.0, move1 * 2.0, 0.0);
|
||||
next.chest.orientation = Quaternion::rotation_z(move1 * -0.4);
|
||||
next.head.orientation = Quaternion::rotation_z(move1 * 0.2);
|
||||
next.shorts.orientation = Quaternion::rotation_z(move1 * 0.3);
|
||||
next.belt.orientation = Quaternion::rotation_z(move1 * 0.1);
|
||||
next.control.orientation.rotate_x(move1 * 0.4 + move2 * 0.6);
|
||||
next.control.orientation.rotate_z(move1 * 0.4);
|
||||
|
||||
next.foot_r.position += Vec3::new(move2 * -1.0, move2 * -2.0, 0.0);
|
||||
next.control.position += Vec3::new(move2 * 5.0, move2 * 7.0, move2 * 5.0);
|
||||
next.chest.position += Vec3::new(0.0, 0.0, move2 * -1.0);
|
||||
next.shorts.orientation.rotate_x(move2 * 0.2);
|
||||
next.shorts.position += Vec3::new(0.0, move2 * 1.0, 0.0);
|
||||
},
|
||||
Some("common.abilities.axe.berserk") => {
|
||||
let (move1, move2, move3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time, 0.0, 0.0),
|
||||
Some(StageSection::Action) => (1.0, anim_time, 0.0),
|
||||
Some(StageSection::Recover) => (1.0, 1.0, anim_time),
|
||||
_ => (0.0, 0.0, 0.0),
|
||||
};
|
||||
let pullback = 1.0 - move3;
|
||||
let move1 = move1 * pullback;
|
||||
let move2 = move2 * pullback;
|
||||
|
||||
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, s_a.ac.1, s_a.ac.2);
|
||||
next.control.orientation = Quaternion::rotation_x(s_a.ac.3)
|
||||
* Quaternion::rotation_y(s_a.ac.4)
|
||||
* Quaternion::rotation_z(s_a.ac.5);
|
||||
|
||||
next.control.orientation.rotate_z(move1 * -2.0);
|
||||
next.control.orientation.rotate_x(move1 * 3.5);
|
||||
next.control.position += Vec3::new(move1 * 14.0, move1 * -6.0, move1 * 15.0);
|
||||
|
||||
next.head.orientation.rotate_x(move2 * 0.6);
|
||||
next.chest.orientation.rotate_x(move2 * 0.4);
|
||||
},
|
||||
Some("common.abilities.axe.savage_sense") => {
|
||||
let (move1, move2, move3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time, 0.0, 0.0),
|
||||
Some(StageSection::Action) => (1.0, anim_time, 0.0),
|
||||
Some(StageSection::Recover) => (1.0, 1.0, anim_time),
|
||||
_ => (0.0, 0.0, 0.0),
|
||||
};
|
||||
let pullback = 1.0 - move3;
|
||||
let move1 = move1 * pullback;
|
||||
let move2 = move2 * pullback;
|
||||
|
||||
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, s_a.ac.1, s_a.ac.2);
|
||||
next.control.orientation = Quaternion::rotation_x(s_a.ac.3)
|
||||
* Quaternion::rotation_y(s_a.ac.4)
|
||||
* Quaternion::rotation_z(s_a.ac.5);
|
||||
|
||||
next.chest.orientation = Quaternion::rotation_z(move1 * 0.6);
|
||||
next.head.orientation = Quaternion::rotation_z(move1 * -0.2);
|
||||
next.belt.orientation = Quaternion::rotation_z(move1 * -0.3);
|
||||
next.shorts.orientation = Quaternion::rotation_z(move1 * -0.1);
|
||||
next.foot_r.position += Vec3::new(0.0, move1 * 4.0, move1 * 4.0);
|
||||
next.foot_r.orientation.rotate_x(move1 * 1.2);
|
||||
|
||||
next.foot_r.position += Vec3::new(0.0, move2 * 4.0, move2 * -4.0);
|
||||
next.foot_r.orientation.rotate_x(move2 * -1.2);
|
||||
},
|
||||
Some("common.abilities.axe.adrenaline_rush") => {
|
||||
let (move1, move2, move3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time, 0.0, 0.0),
|
||||
Some(StageSection::Action) => (1.0, anim_time, 0.0),
|
||||
Some(StageSection::Recover) => (1.0, 1.0, anim_time),
|
||||
_ => (0.0, 0.0, 0.0),
|
||||
};
|
||||
let pullback = 1.0 - move3;
|
||||
let move1 = move1 * pullback;
|
||||
let move2 = move2 * pullback;
|
||||
|
||||
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, s_a.ac.1, s_a.ac.2);
|
||||
next.control.orientation = Quaternion::rotation_x(s_a.ac.3)
|
||||
* Quaternion::rotation_y(s_a.ac.4)
|
||||
* Quaternion::rotation_z(s_a.ac.5 - move1 * PI);
|
||||
|
||||
next.control.orientation.rotate_z(move1 * -1.8);
|
||||
next.control.orientation.rotate_y(move1 * 1.5);
|
||||
next.control.position += Vec3::new(move1 * 11.0, 0.0, 0.0);
|
||||
|
||||
next.control.orientation.rotate_y(move2 * 0.7);
|
||||
next.control.orientation.rotate_z(move2 * 1.6);
|
||||
next.control.position += Vec3::new(move2 * -8.0, 0.0, move2 * -3.0);
|
||||
},
|
||||
Some("common.abilities.axe.bloodfeast") => {
|
||||
let (move1, move2, move3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time, 0.0, 0.0),
|
||||
Some(StageSection::Action) => (1.0, anim_time, 0.0),
|
||||
Some(StageSection::Recover) => (1.0, 1.0, anim_time),
|
||||
_ => (0.0, 0.0, 0.0),
|
||||
};
|
||||
let pullback = 1.0 - move3;
|
||||
let move1 = move1 * pullback;
|
||||
let move2 = move2 * pullback;
|
||||
|
||||
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, s_a.ac.1, s_a.ac.2);
|
||||
next.control.orientation = Quaternion::rotation_x(s_a.ac.3)
|
||||
* Quaternion::rotation_y(s_a.ac.4)
|
||||
* Quaternion::rotation_z(s_a.ac.5);
|
||||
|
||||
next.control.orientation.rotate_z(move1 * -3.4);
|
||||
next.control.orientation.rotate_x(move1 * 1.1);
|
||||
next.control.position += Vec3::new(move1 * 14.0, move1 * -3.0, 0.0);
|
||||
|
||||
next.control.orientation.rotate_x(move2 * 1.7);
|
||||
next.control.orientation.rotate_z(move2 * -1.3);
|
||||
next.control.orientation.rotate_y(move2 * 0.8);
|
||||
},
|
||||
Some("common.abilities.axe.furor") => {
|
||||
let (move1, move2, move3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time, 0.0, 0.0),
|
||||
Some(StageSection::Action) => (1.0, anim_time, 0.0),
|
||||
Some(StageSection::Recover) => (1.0, 1.0, anim_time),
|
||||
_ => (0.0, 0.0, 0.0),
|
||||
};
|
||||
let pullback = 1.0 - move3;
|
||||
let move1 = move1 * pullback;
|
||||
let move2 = move2 * pullback;
|
||||
|
||||
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, s_a.ac.1, s_a.ac.2);
|
||||
next.control.orientation = Quaternion::rotation_x(s_a.ac.3)
|
||||
* Quaternion::rotation_y(s_a.ac.4)
|
||||
* Quaternion::rotation_z(s_a.ac.5 - move1 * PI);
|
||||
|
||||
next.control.orientation.rotate_x(move1 * -1.0);
|
||||
next.control.position += Vec3::new(move1 * 3.0, move1 * -2.0, move1 * 14.0);
|
||||
next.control.orientation.rotate_z(move1 * 1.5);
|
||||
|
||||
next.control.orientation.rotate_y(move2 * -1.0);
|
||||
next.control.orientation.rotate_z(move2 * -1.6);
|
||||
next.control.orientation.rotate_y(move2 * 0.7);
|
||||
next.control.orientation.rotate_x(move2 * -0.5);
|
||||
next.control.position += Vec3::new(move2 * 9.0, move2 * -3.0, move2 * -14.0);
|
||||
},
|
||||
Some("common.abilities.axe.sunder") => {
|
||||
let (move1_raw, move2_raw, move3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time, 0.0, 0.0),
|
||||
Some(StageSection::Action) => (1.0, anim_time, 0.0),
|
||||
Some(StageSection::Recover) => (1.0, 1.0, anim_time),
|
||||
_ => (0.0, 0.0, 0.0),
|
||||
};
|
||||
let pullback = 1.0 - move3;
|
||||
let move1 = move1_raw * pullback;
|
||||
let move2 = move2_raw * pullback;
|
||||
|
||||
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, s_a.ac.1, s_a.ac.2);
|
||||
next.control.orientation = Quaternion::rotation_x(s_a.ac.3)
|
||||
* Quaternion::rotation_y(s_a.ac.4)
|
||||
* Quaternion::rotation_z(s_a.ac.5);
|
||||
|
||||
next.control.orientation.rotate_z(move1 * -1.5);
|
||||
next.control.position += Vec3::new(move1 * 12.0, 0.0, move1 * 5.0);
|
||||
next.control.orientation.rotate_y(move1 * 0.5);
|
||||
next.main.position += Vec3::new(0.0, move1 * 10.0, 0.0);
|
||||
next.main.orientation.rotate_z(move1_raw * TAU);
|
||||
next.second.position += Vec3::new(0.0, move1 * 10.0, 0.0);
|
||||
next.second.orientation.rotate_z(move1_raw * -TAU);
|
||||
|
||||
next.main.orientation.rotate_z(move2_raw * TAU);
|
||||
next.main.position += Vec3::new(0.0, move2 * -10.0, 0.0);
|
||||
next.second.orientation.rotate_z(move2_raw * -TAU);
|
||||
next.second.position += Vec3::new(0.0, move2 * -10.0, 0.0);
|
||||
next.control.position += Vec3::new(0.0, 0.0, move2 * -5.0);
|
||||
},
|
||||
Some("common.abilities.axe.defiance") => {
|
||||
let (move1, tension, move3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time, 0.0, 0.0),
|
||||
Some(StageSection::Action) => (1.0, (anim_time * 20.0).sin(), 0.0),
|
||||
Some(StageSection::Recover) => (1.0, 1.0, anim_time),
|
||||
_ => (0.0, 0.0, 0.0),
|
||||
};
|
||||
let pullback = 1.0 - move3;
|
||||
let move1 = move1 * pullback;
|
||||
|
||||
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, s_a.ac.1, s_a.ac.2);
|
||||
next.control.orientation = Quaternion::rotation_x(s_a.ac.3)
|
||||
* Quaternion::rotation_y(s_a.ac.4)
|
||||
* Quaternion::rotation_z(s_a.ac.5);
|
||||
|
||||
next.control.orientation.rotate_z(move1 * -1.6);
|
||||
next.control.orientation.rotate_x(move1 * 1.7);
|
||||
next.control.position += Vec3::new(move1 * 12.0, move1 * -10.0, move1 * 18.0);
|
||||
next.head.orientation.rotate_x(move1 * 0.6);
|
||||
next.head.position += Vec3::new(0.0, 0.0, move1 * -3.0);
|
||||
next.control.orientation.rotate_z(move1 * 0.4);
|
||||
|
||||
next.head.orientation.rotate_x(tension * 0.3);
|
||||
next.control.position += Vec3::new(0.0, 0.0, tension * 2.0);
|
||||
},
|
||||
Some("common.abilities.hammer.tenacity") => {
|
||||
hammer_start(&mut next, s_a);
|
||||
let (move1, move2, move3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time, 0.0, 0.0),
|
||||
Some(StageSection::Action) => (1.0, anim_time, 0.0),
|
||||
Some(StageSection::Recover) => (1.0, 1.0, anim_time),
|
||||
_ => (0.0, 0.0, 0.0),
|
||||
};
|
||||
let pullback = 1.0 - move3;
|
||||
let move1 = move1 * pullback;
|
||||
let move2 = move2 * pullback;
|
||||
|
||||
next.control.orientation.rotate_x(move1 * 0.6);
|
||||
next.control.orientation.rotate_y(move1 * 0.9);
|
||||
next.control.orientation.rotate_x(move1 * -0.6);
|
||||
next.chest.orientation.rotate_x(move1 * 0.4);
|
||||
next.control.position += Vec3::new(0.0, 4.0, 3.0) * move1;
|
||||
|
||||
next.control.position += Vec3::new(
|
||||
(move2 * 50.0).sin(),
|
||||
(move2 * 67.0).sin(),
|
||||
(move2 * 83.0).sin(),
|
||||
);
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
|
||||
next
|
||||
}
|
||||
}
|
@ -1,194 +0,0 @@
|
||||
use super::{
|
||||
super::{vek::*, Animation},
|
||||
hammer_start, twist_back, twist_forward, CharacterSkeleton, SkeletonAttr,
|
||||
};
|
||||
use common::states::utils::StageSection;
|
||||
use std::f32::consts::PI;
|
||||
|
||||
pub struct Input {
|
||||
pub attack: bool,
|
||||
}
|
||||
pub struct ShockwaveAnimation;
|
||||
|
||||
impl Animation for ShockwaveAnimation {
|
||||
type Dependency<'a> = (Option<&'a str>, f32, f32, Option<StageSection>);
|
||||
type Skeleton = CharacterSkeleton;
|
||||
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const UPDATE_FN: &'static [u8] = b"character_shockwave\0";
|
||||
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_shockwave")]
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
(ability_id, _global_time, velocity, stage_section): Self::Dependency<'_>,
|
||||
anim_time: f32,
|
||||
rate: &mut f32,
|
||||
s_a: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
*rate = 1.0;
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
if matches!(stage_section, Some(StageSection::Action)) {
|
||||
next.main_weapon_trail = true;
|
||||
next.off_weapon_trail = true;
|
||||
}
|
||||
|
||||
let (move1, move2, move3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time, 0.0, 0.0),
|
||||
Some(StageSection::Action) => (1.0, anim_time, 0.0),
|
||||
Some(StageSection::Recover) => (1.0, 1.0, anim_time),
|
||||
_ => (0.0, 0.0, 0.0),
|
||||
};
|
||||
|
||||
match ability_id {
|
||||
Some(
|
||||
"common.abilities.staff.fireshockwave"
|
||||
| "common.abilities.sceptre.healingaura"
|
||||
| "common.abilities.sceptre.wardingaura",
|
||||
) => {
|
||||
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
|
||||
|
||||
next.hand_l.position = Vec3::new(s_a.sthl.0, s_a.sthl.1, s_a.sthl.2);
|
||||
next.hand_l.orientation =
|
||||
Quaternion::rotation_x(s_a.sthl.3) * Quaternion::rotation_y(s_a.sthl.4);
|
||||
next.hand_r.position = Vec3::new(s_a.sthr.0, s_a.sthr.1, s_a.sthr.2);
|
||||
next.hand_r.orientation =
|
||||
Quaternion::rotation_x(s_a.sthr.3) * Quaternion::rotation_y(s_a.sthr.4);
|
||||
next.main.position = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.main.orientation = Quaternion::rotation_x(0.0);
|
||||
|
||||
next.control.position = Vec3::new(s_a.stc.0, s_a.stc.1, s_a.stc.2);
|
||||
next.control.orientation =
|
||||
Quaternion::rotation_x(s_a.stc.3) * Quaternion::rotation_y(s_a.stc.4);
|
||||
|
||||
let twist = move1 * 0.8;
|
||||
|
||||
next.control.position = Vec3::new(
|
||||
s_a.stc.0 + (move1 * 5.0) * (1.0 - move3),
|
||||
s_a.stc.1 + (move1 * 5.0) * (1.0 - move3),
|
||||
s_a.stc.2 + (move1 * 10.0 + move2 * -10.0) * (1.0 - move3),
|
||||
);
|
||||
next.control.orientation =
|
||||
Quaternion::rotation_x(s_a.stc.3 + (move1 * 0.8) * (1.0 - move3))
|
||||
* Quaternion::rotation_y(
|
||||
s_a.stc.4 + (move1 * -0.15 + move2 * -0.15) * (1.0 - move3),
|
||||
)
|
||||
* Quaternion::rotation_z((move1 * 0.8 + move2 * -0.8) * (1.0 - move3));
|
||||
|
||||
next.head.orientation = Quaternion::rotation_x((move1 * 0.4) * (1.0 - move3))
|
||||
* Quaternion::rotation_z((twist * 0.2 + move2 * -0.8) * (1.0 - move3));
|
||||
|
||||
next.chest.position = Vec3::new(
|
||||
0.0,
|
||||
s_a.chest.0,
|
||||
s_a.chest.1 + (move1 * 2.0 + move2 * -4.0) * (1.0 - move3),
|
||||
);
|
||||
next.chest.orientation = Quaternion::rotation_x((move2 * -0.8) * (1.0 - move3))
|
||||
* Quaternion::rotation_z(twist * -0.2 + move2 * -0.1 + (1.0 - move3));
|
||||
|
||||
next.belt.orientation = Quaternion::rotation_x((move2 * 0.2) * (1.0 - move3))
|
||||
* Quaternion::rotation_z((twist * 0.6 + move2 * -0.48) * (1.0 - move3));
|
||||
|
||||
next.shorts.orientation = Quaternion::rotation_x((move2 * 0.3) * (1.0 - move3))
|
||||
* Quaternion::rotation_z((twist + move2 * -0.8) * (1.0 - move3));
|
||||
|
||||
if velocity < 0.5 {
|
||||
next.foot_l.position = Vec3::new(
|
||||
-s_a.foot.0,
|
||||
s_a.foot.1 + move1 * -7.0 + move2 * 7.0,
|
||||
s_a.foot.2,
|
||||
);
|
||||
next.foot_l.orientation = Quaternion::rotation_x(move1 * -0.8 + move2 * 0.8)
|
||||
* Quaternion::rotation_z(move1 * 0.3 + move2 * -0.3);
|
||||
|
||||
next.foot_r.position = Vec3::new(
|
||||
s_a.foot.0,
|
||||
s_a.foot.1 + move1 * 5.0 + move2 * -5.0,
|
||||
s_a.foot.2,
|
||||
);
|
||||
next.foot_r.orientation = Quaternion::rotation_y(move1 * -0.3 + move2 * 0.3)
|
||||
* Quaternion::rotation_z(move1 * 0.4 + move2 * -0.4);
|
||||
}
|
||||
},
|
||||
Some("common.abilities.hammer.tremor") => {
|
||||
hammer_start(&mut next, s_a);
|
||||
let (move1, move2, move3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time, 0.0, 0.0),
|
||||
Some(StageSection::Action) => (1.0, anim_time, 0.0),
|
||||
Some(StageSection::Recover) => (1.0, 1.0, anim_time),
|
||||
_ => (0.0, 0.0, 0.0),
|
||||
};
|
||||
let pullback = 1.0 - move3;
|
||||
let move1 = move1 * pullback;
|
||||
let move2 = move2 * pullback;
|
||||
|
||||
twist_back(&mut next, move1, 1.4, 0.7, 0.5, 0.9);
|
||||
next.foot_l.orientation.rotate_z(move1 * 1.4);
|
||||
next.foot_l.position += Vec3::new(-1.0, -3.0, 0.0) * move1;
|
||||
next.control.orientation.rotate_x(move1 * 2.6);
|
||||
next.control.orientation.rotate_y(move1 * 0.8);
|
||||
|
||||
twist_forward(&mut next, move2, 2.1, 1.2, 0.9, 1.6);
|
||||
next.foot_l.orientation.rotate_z(move2 * -1.4);
|
||||
next.foot_l.position += Vec3::new(2.0, 7.0, 0.0) * move2;
|
||||
next.control.orientation.rotate_z(move2 * 2.1);
|
||||
next.control.orientation.rotate_x(move2 * -2.0);
|
||||
next.control.orientation.rotate_z(move2 * 1.2);
|
||||
next.control.position += Vec3::new(-16.0, 0.0, 0.0) * move2;
|
||||
next.chest.orientation.rotate_x(-0.8 * move2);
|
||||
},
|
||||
Some("common.abilities.hammer.rampart") => {
|
||||
hammer_start(&mut next, s_a);
|
||||
let (move1, move2, move3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time, 0.0, 0.0),
|
||||
Some(StageSection::Action) => (1.0, anim_time, 0.0),
|
||||
Some(StageSection::Recover) => (1.0, 1.0, anim_time),
|
||||
_ => (0.0, 0.0, 0.0),
|
||||
};
|
||||
let pullback = 1.0 - move3;
|
||||
let move1 = move1 * pullback;
|
||||
let move2 = move2 * pullback;
|
||||
|
||||
next.control.orientation.rotate_x(move1 * 0.6);
|
||||
next.control.orientation.rotate_y(move1 * -PI / 2.0);
|
||||
next.hand_l.orientation.rotate_y(move1 * -PI);
|
||||
next.hand_r.orientation.rotate_y(move1 * -PI);
|
||||
next.control.position += Vec3::new(-5.0, 0.0, 30.0) * move1;
|
||||
|
||||
next.control.position += Vec3::new(0.0, 0.0, -10.0) * move2;
|
||||
next.torso.orientation.rotate_x(move2 * -0.6);
|
||||
next.control.orientation.rotate_x(move2 * 0.6);
|
||||
},
|
||||
Some("common.abilities.hammer.seismic_shock") => {
|
||||
hammer_start(&mut next, s_a);
|
||||
let (move1, move2, move3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time, 0.0, 0.0),
|
||||
Some(StageSection::Action) => (1.0, anim_time, 0.0),
|
||||
Some(StageSection::Recover) => (1.0, 1.0, anim_time),
|
||||
_ => (0.0, 0.0, 0.0),
|
||||
};
|
||||
let pullback = 1.0 - move3;
|
||||
let move1 = move1 * pullback;
|
||||
let move2 = move2 * pullback;
|
||||
|
||||
next.control.orientation.rotate_x(move1 * 2.5);
|
||||
next.control.position += Vec3::new(0.0, 0.0, 28.0) * move1;
|
||||
next.head.orientation.rotate_x(move1 * 0.3);
|
||||
next.chest.orientation.rotate_x(move1 * 0.3);
|
||||
next.belt.orientation.rotate_x(move1 * -0.2);
|
||||
next.shorts.orientation.rotate_x(move1 * -0.3);
|
||||
|
||||
next.control.orientation.rotate_z(move2 * 2.0);
|
||||
next.control.orientation.rotate_x(move2 * -4.0);
|
||||
next.control.position += Vec3::new(-6.0, 0.0, -30.0) * move2;
|
||||
next.head.orientation.rotate_x(move2 * -0.9);
|
||||
next.chest.orientation.rotate_x(move2 * -0.5);
|
||||
next.belt.orientation.rotate_x(move2 * 0.2);
|
||||
next.shorts.orientation.rotate_x(move2 * 0.4);
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
|
||||
next
|
||||
}
|
||||
}
|
@ -1,164 +0,0 @@
|
||||
use super::{
|
||||
super::{vek::*, Animation},
|
||||
CharacterSkeleton, SkeletonAttr,
|
||||
};
|
||||
use common::{
|
||||
comp::item::{Hands, ToolKind},
|
||||
states::utils::{AbilityInfo, StageSection},
|
||||
util::Dir,
|
||||
};
|
||||
use core::f32::consts::PI;
|
||||
|
||||
pub struct ShootAnimation;
|
||||
|
||||
type ShootAnimationDependency = (
|
||||
Option<AbilityInfo>,
|
||||
(Option<Hands>, Option<Hands>),
|
||||
f32,
|
||||
Vec3<f32>,
|
||||
Vec3<f32>,
|
||||
Dir,
|
||||
f32,
|
||||
Option<StageSection>,
|
||||
);
|
||||
impl Animation for ShootAnimation {
|
||||
type Dependency<'a> = ShootAnimationDependency;
|
||||
type Skeleton = CharacterSkeleton;
|
||||
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const UPDATE_FN: &'static [u8] = b"character_shoot\0";
|
||||
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_shoot")]
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
(
|
||||
ability_info,
|
||||
hands,
|
||||
velocity,
|
||||
orientation,
|
||||
last_ori,
|
||||
look_dir,
|
||||
_global_time,
|
||||
stage_section,
|
||||
): Self::Dependency<'_>,
|
||||
anim_time: f32,
|
||||
rate: &mut f32,
|
||||
s_a: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
*rate = 1.0;
|
||||
let _speed = Vec2::<f32>::from(velocity).magnitude();
|
||||
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
let lab: f32 = 1.0;
|
||||
let ori: Vec2<f32> = Vec2::from(orientation);
|
||||
let last_ori = Vec2::from(last_ori);
|
||||
let tilt = if vek::Vec2::new(ori, last_ori)
|
||||
.map(|o| o.magnitude_squared())
|
||||
.map(|m| m > 0.001 && m.is_finite())
|
||||
.reduce_and()
|
||||
&& ori.angle_between(last_ori).is_finite()
|
||||
{
|
||||
ori.angle_between(last_ori).min(0.2)
|
||||
* last_ori.determine_side(Vec2::zero(), ori).signum()
|
||||
} else {
|
||||
0.0
|
||||
} * 1.3;
|
||||
let ori_angle = orientation.y.atan2(orientation.x);
|
||||
let lookdir_angle = look_dir.y.atan2(look_dir.x);
|
||||
let swivel = lookdir_angle - ori_angle;
|
||||
match ability_info.and_then(|a| a.tool) {
|
||||
Some(ToolKind::Staff) | Some(ToolKind::Sceptre) => {
|
||||
let (move1, move2, move3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time, 0.0, 0.0),
|
||||
Some(StageSection::Action) => (1.0, anim_time.powf(0.25), 0.0),
|
||||
Some(StageSection::Recover) => (1.0, 1.0, anim_time),
|
||||
_ => (0.0, 0.0, 0.0),
|
||||
};
|
||||
let xmove = (move1 * 6.0 * lab + PI).sin();
|
||||
let ymove = (move1 * 6.0 * lab + PI * (0.5)).sin();
|
||||
next.hand_l.position = Vec3::new(s_a.sthl.0, s_a.sthl.1, s_a.sthl.2);
|
||||
next.hand_l.orientation = Quaternion::rotation_x(s_a.sthl.3);
|
||||
|
||||
next.hand_r.position = Vec3::new(s_a.sthr.0, s_a.sthr.1, s_a.sthr.2);
|
||||
next.hand_r.orientation =
|
||||
Quaternion::rotation_x(s_a.sthr.3) * Quaternion::rotation_y(s_a.sthr.4);
|
||||
|
||||
next.main.position = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.main.orientation = Quaternion::rotation_y(0.0);
|
||||
|
||||
next.control.position = Vec3::new(
|
||||
s_a.stc.0 + (xmove * 3.0 + move1 * -4.0) * (1.0 - move3),
|
||||
s_a.stc.1 + (2.0 + ymove * 3.0 + move2 * 3.0) * (1.0 - move3),
|
||||
s_a.stc.2 + look_dir.z * 4.0,
|
||||
);
|
||||
next.control.orientation =
|
||||
Quaternion::rotation_x(look_dir.z + s_a.stc.3 + (move2 * 0.6) * (1.0 - move3))
|
||||
* Quaternion::rotation_y(s_a.stc.4 + (move1 * 0.5 + move2 * -0.5))
|
||||
* Quaternion::rotation_z(
|
||||
s_a.stc.5 - (0.2 + move1 * -0.5 + move2 * 0.8) * (1.0 - move3),
|
||||
);
|
||||
|
||||
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
|
||||
next.head.orientation = Quaternion::rotation_x(look_dir.z * 0.7)
|
||||
* Quaternion::rotation_z(
|
||||
tilt * -2.5 + (move1 * -0.2 + move2 * -0.4) * (1.0 - move3),
|
||||
);
|
||||
next.chest.orientation = Quaternion::rotation_z(swivel * 0.8);
|
||||
next.torso.orientation = Quaternion::rotation_z(swivel * 0.2);
|
||||
},
|
||||
Some(ToolKind::Bow) => {
|
||||
let (_move1, move2, _move3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
|
||||
Some(StageSection::Action) => (1.0, anim_time, 0.0),
|
||||
Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)),
|
||||
_ => (0.0, 0.0, 0.0),
|
||||
};
|
||||
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.bhl.0 + move2 * -8.0,
|
||||
s_a.bhl.1 + move2 * -10.0,
|
||||
s_a.bhl.2,
|
||||
);
|
||||
next.hand_l.orientation =
|
||||
Quaternion::rotation_x(s_a.bhl.3) * Quaternion::rotation_y(move2 * 0.7);
|
||||
next.hand_r.position = Vec3::new(s_a.bhr.0, s_a.bhr.1, s_a.bhr.2);
|
||||
next.hand_r.orientation = Quaternion::rotation_x(s_a.bhr.3);
|
||||
|
||||
next.hold.position = Vec3::new(0.0, -1.0 + move2 * 2.0, -5.2 + move2 * 7.0);
|
||||
next.hold.orientation = Quaternion::rotation_x(-PI / 2.0);
|
||||
next.hold.scale = Vec3::one() * 1.0 * (1.0 - move2);
|
||||
|
||||
next.control.position = Vec3::new(
|
||||
s_a.bc.0 + 11.0 + move2 * 2.0,
|
||||
s_a.bc.1 + 2.0 + (look_dir.z * -5.0).min(-2.0) + move2 * -1.0,
|
||||
s_a.bc.2 + 8.0 + (look_dir.z * 15.0).max(-8.0),
|
||||
);
|
||||
next.control.orientation = Quaternion::rotation_x(look_dir.z)
|
||||
* Quaternion::rotation_y(-look_dir.z + s_a.bc.4 - 1.25)
|
||||
* Quaternion::rotation_z(s_a.bc.5 - 0.2 + move2 * -0.1);
|
||||
|
||||
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
|
||||
|
||||
next.head.orientation =
|
||||
Quaternion::rotation_x(look_dir.z * 0.7) * Quaternion::rotation_z(tilt * -0.0);
|
||||
next.chest.orientation = Quaternion::rotation_z(swivel * 0.8 + 0.8 + move2 * 0.5);
|
||||
next.torso.orientation = Quaternion::rotation_z(swivel * 0.2);
|
||||
|
||||
next.shoulder_l.orientation = Quaternion::rotation_x(move2 * 0.5);
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
|
||||
next.back.orientation = Quaternion::rotation_x(-0.3);
|
||||
|
||||
next.lantern.orientation = Quaternion::rotation_x(0.0) * Quaternion::rotation_y(0.0);
|
||||
|
||||
if let (None, Some(Hands::Two)) = hands {
|
||||
next.second = next.main;
|
||||
}
|
||||
|
||||
next
|
||||
}
|
||||
}
|
@ -1160,6 +1160,9 @@ impl FigureMgr {
|
||||
// Average velocity relative to the current ground
|
||||
let rel_avg_vel = (state.avg_vel - physics.ground_vel) / scale;
|
||||
|
||||
let orientation = ori * anim::vek::Vec3::<f32>::unit_y();
|
||||
let last_ori = state.last_ori * anim::vek::Vec3::<f32>::unit_y();
|
||||
|
||||
let (character, last_character) = match (character, last_character) {
|
||||
(Some(c), Some(l)) => (c, l),
|
||||
_ => continue,
|
||||
@ -1322,14 +1325,19 @@ impl FigureMgr {
|
||||
},
|
||||
_ => 0.0,
|
||||
};
|
||||
anim::character::AlphaAnimation::update_skeleton(
|
||||
anim::character::BasicAction::update_skeleton(
|
||||
&target_base,
|
||||
(
|
||||
anim::character::BasicActionDependency {
|
||||
ability_id,
|
||||
hands,
|
||||
Some(s.stage_section),
|
||||
Some(s.static_data.ability_info),
|
||||
),
|
||||
stage_section: Some(s.stage_section),
|
||||
ability_info: Some(s.static_data.ability_info),
|
||||
velocity: rel_vel,
|
||||
ground_dist: None,
|
||||
last_ori,
|
||||
orientation,
|
||||
look_dir,
|
||||
},
|
||||
stage_progress,
|
||||
&mut state_animation_rate,
|
||||
skeleton_attr,
|
||||
@ -1349,13 +1357,19 @@ impl FigureMgr {
|
||||
},
|
||||
_ => 0.0,
|
||||
};
|
||||
anim::character::FinisherMeleeAnimation::update_skeleton(
|
||||
anim::character::BasicAction::update_skeleton(
|
||||
&target_base,
|
||||
(
|
||||
anim::character::BasicActionDependency {
|
||||
ability_id,
|
||||
Some(s.stage_section),
|
||||
Some(s.static_data.ability_info),
|
||||
),
|
||||
hands,
|
||||
stage_section: Some(s.stage_section),
|
||||
ability_info: Some(s.static_data.ability_info),
|
||||
velocity: rel_vel,
|
||||
ground_dist: None,
|
||||
last_ori,
|
||||
orientation,
|
||||
look_dir,
|
||||
},
|
||||
stage_progress,
|
||||
&mut state_animation_rate,
|
||||
skeleton_attr,
|
||||
@ -1382,14 +1396,19 @@ impl FigureMgr {
|
||||
.0
|
||||
.powi(2)
|
||||
/ vel.0.magnitude_squared();
|
||||
anim::character::DiveMeleeAnimation::update_skeleton(
|
||||
anim::character::BasicAction::update_skeleton(
|
||||
&target_base,
|
||||
(
|
||||
anim::character::BasicActionDependency {
|
||||
ability_id,
|
||||
Some(s.stage_section),
|
||||
ground_dist,
|
||||
Some(s.static_data.ability_info),
|
||||
),
|
||||
hands,
|
||||
stage_section: Some(s.stage_section),
|
||||
ability_info: Some(s.static_data.ability_info),
|
||||
velocity: rel_vel,
|
||||
ground_dist: Some(ground_dist),
|
||||
last_ori,
|
||||
orientation,
|
||||
look_dir,
|
||||
},
|
||||
stage_progress,
|
||||
&mut state_animation_rate,
|
||||
skeleton_attr,
|
||||
@ -1409,13 +1428,19 @@ impl FigureMgr {
|
||||
},
|
||||
_ => 0.0,
|
||||
};
|
||||
anim::character::SelfBuffAnimation::update_skeleton(
|
||||
anim::character::BasicAction::update_skeleton(
|
||||
&target_base,
|
||||
(
|
||||
anim::character::BasicActionDependency {
|
||||
ability_id,
|
||||
Some(s.stage_section),
|
||||
Some(s.static_data.ability_info),
|
||||
),
|
||||
hands,
|
||||
stage_section: Some(s.stage_section),
|
||||
ability_info: Some(s.static_data.ability_info),
|
||||
velocity: rel_vel,
|
||||
ground_dist: None,
|
||||
last_ori,
|
||||
orientation,
|
||||
look_dir,
|
||||
},
|
||||
stage_progress,
|
||||
&mut state_animation_rate,
|
||||
skeleton_attr,
|
||||
@ -1435,19 +1460,19 @@ impl FigureMgr {
|
||||
_ => 0.0,
|
||||
};
|
||||
|
||||
anim::character::ShootAnimation::update_skeleton(
|
||||
anim::character::BasicAction::update_skeleton(
|
||||
&target_base,
|
||||
(
|
||||
Some(s.static_data.ability_info),
|
||||
anim::character::BasicActionDependency {
|
||||
ability_id,
|
||||
hands,
|
||||
rel_vel.magnitude(),
|
||||
// TODO: Update to use the quaternion.
|
||||
ori * anim::vek::Vec3::<f32>::unit_y(),
|
||||
state.last_ori * anim::vek::Vec3::<f32>::unit_y(),
|
||||
stage_section: Some(s.stage_section),
|
||||
ability_info: Some(s.static_data.ability_info),
|
||||
velocity: rel_vel,
|
||||
ground_dist: None,
|
||||
last_ori,
|
||||
orientation,
|
||||
look_dir,
|
||||
time,
|
||||
Some(s.stage_section),
|
||||
),
|
||||
},
|
||||
stage_progress,
|
||||
&mut state_animation_rate,
|
||||
skeleton_attr,
|
||||
@ -1467,19 +1492,19 @@ impl FigureMgr {
|
||||
_ => 0.0,
|
||||
};
|
||||
|
||||
anim::character::ShootAnimation::update_skeleton(
|
||||
anim::character::BasicAction::update_skeleton(
|
||||
&target_base,
|
||||
(
|
||||
Some(s.static_data.ability_info),
|
||||
anim::character::BasicActionDependency {
|
||||
ability_id,
|
||||
hands,
|
||||
rel_vel.magnitude(),
|
||||
// TODO: Update to use the quaternion.
|
||||
ori * anim::vek::Vec3::<f32>::unit_y(),
|
||||
state.last_ori * anim::vek::Vec3::<f32>::unit_y(),
|
||||
stage_section: Some(s.stage_section),
|
||||
ability_info: Some(s.static_data.ability_info),
|
||||
velocity: rel_vel,
|
||||
ground_dist: None,
|
||||
last_ori,
|
||||
orientation,
|
||||
look_dir,
|
||||
time,
|
||||
Some(s.stage_section),
|
||||
),
|
||||
},
|
||||
stage_progress,
|
||||
&mut state_animation_rate,
|
||||
skeleton_attr,
|
||||
@ -1507,10 +1532,19 @@ impl FigureMgr {
|
||||
},
|
||||
_ => 0.0,
|
||||
};
|
||||
|
||||
anim::character::ChargeswingAnimation::update_skeleton(
|
||||
anim::character::BasicAction::update_skeleton(
|
||||
&target_base,
|
||||
(ability_id, s.stage_section),
|
||||
anim::character::BasicActionDependency {
|
||||
ability_id,
|
||||
hands,
|
||||
stage_section: Some(s.stage_section),
|
||||
ability_info: Some(s.static_data.ability_info),
|
||||
velocity: rel_vel,
|
||||
ground_dist: None,
|
||||
last_ori,
|
||||
orientation,
|
||||
look_dir,
|
||||
},
|
||||
stage_progress,
|
||||
&mut state_animation_rate,
|
||||
skeleton_attr,
|
||||
@ -1519,7 +1553,7 @@ impl FigureMgr {
|
||||
CharacterState::RepeaterRanged(s) => {
|
||||
let stage_time = s.timer.as_secs_f32();
|
||||
|
||||
let stage_progress = match s.stage_section {
|
||||
let progress = match s.stage_section {
|
||||
StageSection::Buildup => {
|
||||
stage_time / s.static_data.buildup_duration.as_secs_f32()
|
||||
},
|
||||
@ -1532,18 +1566,20 @@ impl FigureMgr {
|
||||
_ => 0.0,
|
||||
};
|
||||
|
||||
anim::character::RepeaterAnimation::update_skeleton(
|
||||
anim::character::MultiAction::update_skeleton(
|
||||
&target_base,
|
||||
(
|
||||
Some(s.static_data.ability_info),
|
||||
hands,
|
||||
ori * anim::vek::Vec3::<f32>::unit_y(),
|
||||
anim::character::MultiActionDependency {
|
||||
ability_id,
|
||||
stage_section: Some(s.stage_section),
|
||||
ability_info: Some(s.static_data.ability_info),
|
||||
current_action: s.projectiles_fired,
|
||||
max_actions: None,
|
||||
move_dir,
|
||||
orientation,
|
||||
look_dir,
|
||||
rel_vel,
|
||||
time,
|
||||
Some(s.stage_section),
|
||||
),
|
||||
stage_progress,
|
||||
velocity: rel_vel,
|
||||
},
|
||||
progress,
|
||||
&mut state_animation_rate,
|
||||
skeleton_attr,
|
||||
)
|
||||
@ -1616,9 +1652,19 @@ impl FigureMgr {
|
||||
},
|
||||
_ => 0.0,
|
||||
};
|
||||
anim::character::DashAnimation::update_skeleton(
|
||||
anim::character::BasicAction::update_skeleton(
|
||||
&target_base,
|
||||
(ability_id, s.stage_section),
|
||||
anim::character::BasicActionDependency {
|
||||
ability_id,
|
||||
hands,
|
||||
stage_section: Some(s.stage_section),
|
||||
ability_info: Some(s.static_data.ability_info),
|
||||
velocity: rel_vel,
|
||||
ground_dist: None,
|
||||
last_ori,
|
||||
orientation,
|
||||
look_dir,
|
||||
},
|
||||
stage_progress,
|
||||
&mut state_animation_rate,
|
||||
skeleton_attr,
|
||||
@ -1638,9 +1684,19 @@ impl FigureMgr {
|
||||
},
|
||||
_ => 0.0,
|
||||
};
|
||||
anim::character::ShockwaveAnimation::update_skeleton(
|
||||
anim::character::BasicAction::update_skeleton(
|
||||
&target_base,
|
||||
(ability_id, time, rel_vel.magnitude(), Some(s.stage_section)),
|
||||
anim::character::BasicActionDependency {
|
||||
ability_id,
|
||||
hands,
|
||||
stage_section: Some(s.stage_section),
|
||||
ability_info: Some(s.static_data.ability_info),
|
||||
velocity: rel_vel,
|
||||
ground_dist: None,
|
||||
last_ori,
|
||||
orientation,
|
||||
look_dir,
|
||||
},
|
||||
stage_progress,
|
||||
&mut state_animation_rate,
|
||||
skeleton_attr,
|
||||
@ -1660,11 +1716,19 @@ impl FigureMgr {
|
||||
},
|
||||
_ => 0.0,
|
||||
};
|
||||
|
||||
// ? Aura confirmed just shockwave
|
||||
anim::character::ShockwaveAnimation::update_skeleton(
|
||||
anim::character::BasicAction::update_skeleton(
|
||||
&target_base,
|
||||
(ability_id, time, rel_vel.magnitude(), Some(s.stage_section)),
|
||||
anim::character::BasicActionDependency {
|
||||
ability_id,
|
||||
hands,
|
||||
stage_section: Some(s.stage_section),
|
||||
ability_info: Some(s.static_data.ability_info),
|
||||
velocity: rel_vel,
|
||||
ground_dist: None,
|
||||
last_ori,
|
||||
orientation,
|
||||
look_dir,
|
||||
},
|
||||
stage_progress,
|
||||
&mut state_animation_rate,
|
||||
skeleton_attr,
|
||||
@ -1684,36 +1748,19 @@ impl FigureMgr {
|
||||
},
|
||||
_ => 0.0,
|
||||
};
|
||||
|
||||
anim::character::ShockwaveAnimation::update_skeleton(
|
||||
anim::character::BasicAction::update_skeleton(
|
||||
&target_base,
|
||||
(ability_id, time, rel_vel.magnitude(), Some(s.stage_section)),
|
||||
stage_progress,
|
||||
&mut state_animation_rate,
|
||||
skeleton_attr,
|
||||
)
|
||||
},
|
||||
CharacterState::LeapMelee(s) => {
|
||||
let stage_time = s.timer.as_secs_f32();
|
||||
let stage_progress = match s.stage_section {
|
||||
StageSection::Buildup => {
|
||||
stage_time / s.static_data.buildup_duration.as_secs_f32()
|
||||
anim::character::BasicActionDependency {
|
||||
ability_id,
|
||||
hands,
|
||||
stage_section: Some(s.stage_section),
|
||||
ability_info: Some(s.static_data.ability_info),
|
||||
velocity: rel_vel,
|
||||
ground_dist: None,
|
||||
last_ori,
|
||||
orientation,
|
||||
look_dir,
|
||||
},
|
||||
StageSection::Movement => {
|
||||
stage_time / s.static_data.movement_duration.as_secs_f32()
|
||||
},
|
||||
StageSection::Action => {
|
||||
stage_time / s.static_data.swing_duration.as_secs_f32()
|
||||
},
|
||||
StageSection::Recover => {
|
||||
stage_time / s.static_data.recover_duration.as_secs_f32()
|
||||
},
|
||||
_ => 0.0,
|
||||
};
|
||||
|
||||
anim::character::LeapAnimation::update_skeleton(
|
||||
&target_base,
|
||||
(s.stage_section,),
|
||||
stage_progress,
|
||||
&mut state_animation_rate,
|
||||
skeleton_attr,
|
||||
@ -1721,7 +1768,7 @@ impl FigureMgr {
|
||||
},
|
||||
CharacterState::RapidMelee(s) => {
|
||||
let stage_time = s.timer.as_secs_f32();
|
||||
let stage_progress = match s.stage_section {
|
||||
let progress = match s.stage_section {
|
||||
StageSection::Buildup => {
|
||||
stage_time / s.static_data.buildup_duration.as_secs_f32()
|
||||
},
|
||||
@ -1734,15 +1781,20 @@ impl FigureMgr {
|
||||
_ => 0.0,
|
||||
};
|
||||
|
||||
anim::character::RapidMeleeAnimation::update_skeleton(
|
||||
anim::character::MultiAction::update_skeleton(
|
||||
&target_base,
|
||||
(
|
||||
anim::character::MultiActionDependency {
|
||||
ability_id,
|
||||
Some(s.stage_section),
|
||||
(s.current_strike, s.static_data.max_strikes),
|
||||
Some(s.static_data.ability_info),
|
||||
),
|
||||
stage_progress,
|
||||
stage_section: Some(s.stage_section),
|
||||
ability_info: Some(s.static_data.ability_info),
|
||||
current_action: s.current_strike,
|
||||
max_actions: s.static_data.max_strikes,
|
||||
move_dir,
|
||||
orientation,
|
||||
look_dir,
|
||||
velocity: rel_vel,
|
||||
},
|
||||
progress,
|
||||
&mut state_animation_rate,
|
||||
skeleton_attr,
|
||||
)
|
||||
@ -1812,15 +1864,19 @@ impl FigureMgr {
|
||||
},
|
||||
_ => 0.0,
|
||||
};
|
||||
anim::character::BeamAnimation::update_skeleton(
|
||||
anim::character::BasicAction::update_skeleton(
|
||||
&target_base,
|
||||
(
|
||||
Some(s.static_data.ability_info),
|
||||
anim::character::BasicActionDependency {
|
||||
ability_id,
|
||||
hands,
|
||||
time,
|
||||
rel_vel.magnitude(),
|
||||
Some(s.stage_section),
|
||||
),
|
||||
stage_section: Some(s.stage_section),
|
||||
ability_info: Some(s.static_data.ability_info),
|
||||
velocity: rel_vel,
|
||||
ground_dist: None,
|
||||
last_ori,
|
||||
orientation,
|
||||
look_dir,
|
||||
},
|
||||
stage_progress,
|
||||
&mut state_animation_rate,
|
||||
skeleton_attr,
|
||||
@ -1843,15 +1899,19 @@ impl FigureMgr {
|
||||
_ => 0.0,
|
||||
};
|
||||
|
||||
anim::character::ComboAnimation::update_skeleton(
|
||||
anim::character::MultiAction::update_skeleton(
|
||||
&target_base,
|
||||
(
|
||||
anim::character::MultiActionDependency {
|
||||
ability_id,
|
||||
Some(s.stage_section),
|
||||
Some(s.static_data.ability_info),
|
||||
current_strike,
|
||||
stage_section: Some(s.stage_section),
|
||||
ability_info: Some(s.static_data.ability_info),
|
||||
current_action: current_strike as u32,
|
||||
max_actions: Some(s.static_data.strikes.len() as u32),
|
||||
move_dir,
|
||||
),
|
||||
orientation,
|
||||
look_dir,
|
||||
velocity: rel_vel,
|
||||
},
|
||||
progress,
|
||||
&mut state_animation_rate,
|
||||
skeleton_attr,
|
||||
@ -1869,17 +1929,19 @@ impl FigureMgr {
|
||||
},
|
||||
_ => 0.0,
|
||||
};
|
||||
anim::character::BlockAnimation::update_skeleton(
|
||||
anim::character::BasicAction::update_skeleton(
|
||||
&target_base,
|
||||
(
|
||||
hands,
|
||||
active_tool_kind,
|
||||
second_tool_kind,
|
||||
rel_vel,
|
||||
anim::character::BasicActionDependency {
|
||||
ability_id,
|
||||
Some(s.stage_section),
|
||||
Some(s.static_data.ability_info),
|
||||
),
|
||||
hands,
|
||||
stage_section: Some(s.stage_section),
|
||||
ability_info: Some(s.static_data.ability_info),
|
||||
velocity: rel_vel,
|
||||
ground_dist: None,
|
||||
last_ori,
|
||||
orientation,
|
||||
look_dir,
|
||||
},
|
||||
stage_progress,
|
||||
&mut state_animation_rate,
|
||||
skeleton_attr,
|
||||
@ -2115,14 +2177,19 @@ impl FigureMgr {
|
||||
},
|
||||
_ => 0.0,
|
||||
};
|
||||
|
||||
anim::character::RiposteMeleeAnimation::update_skeleton(
|
||||
anim::character::BasicAction::update_skeleton(
|
||||
&target_base,
|
||||
(
|
||||
anim::character::BasicActionDependency {
|
||||
ability_id,
|
||||
Some(s.stage_section),
|
||||
Some(s.static_data.ability_info),
|
||||
),
|
||||
hands,
|
||||
stage_section: Some(s.stage_section),
|
||||
ability_info: Some(s.static_data.ability_info),
|
||||
velocity: rel_vel,
|
||||
ground_dist: None,
|
||||
last_ori,
|
||||
orientation,
|
||||
look_dir,
|
||||
},
|
||||
stage_progress,
|
||||
&mut state_animation_rate,
|
||||
skeleton_attr,
|
||||
|
Loading…
Reference in New Issue
Block a user