Add missing biped_large anims

This commit is contained in:
Snowram 2020-10-18 21:57:10 +02:00 committed by Robin Gilh
parent 9c003cf572
commit d5e60d93b4
9 changed files with 880 additions and 11 deletions

View File

@ -85,13 +85,13 @@ impl Animation for AlphaAnimation {
let switch = if random > 0.5 { 1.0 } else { -1.0 };
if let Some(ToolKind::Sword(_)) = active_tool_kind {
next.hand_l.position = Vec3::new(-0.75, -1.0, 2.5);
next.hand_l.position = Vec3::new(-4.75, -1.0, 2.5);
next.hand_l.orientation = Quaternion::rotation_x(1.47) * Quaternion::rotation_y(-0.2);
next.hand_l.scale = Vec3::one() * 1.04;
next.hand_r.position = Vec3::new(0.75, -1.5, -0.5);
next.hand_r.orientation = Quaternion::rotation_x(1.47) * Quaternion::rotation_y(0.3);
next.hand_r.scale = Vec3::one() * 1.05;
next.main.position = Vec3::new(0.0, 5.0, 2.0);
next.main.position = Vec3::new(0.0, 5.0, -6.0);
next.main.orientation = Quaternion::rotation_x(-0.1)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);

View File

@ -0,0 +1,219 @@
use super::{
super::{vek::*, Animation},
BipedLargeSkeleton, SkeletonAttr,
};
use common::{
comp::item::{Hands, ToolKind},
states::utils::StageSection,
};
use std::f32::consts::PI;
pub struct Input {
pub attack: bool,
}
pub struct BeamAnimation;
impl Animation for BeamAnimation {
type Dependency = (
Option<ToolKind>,
Option<ToolKind>,
f64,
f32,
Option<StageSection>,
);
type Skeleton = BipedLargeSkeleton;
#[cfg(feature = "use-dyn-lib")]
const UPDATE_FN: &'static [u8] = b"biped_large_beam\0";
#[cfg_attr(feature = "be-dyn-lib", export_name = "biped_large_beam")]
#[allow(clippy::single_match)] // TODO: Pending review in #587
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(active_tool_kind, second_tool_kind, _global_time, velocity, stage_section): Self::Dependency,
anim_time: f64,
rate: &mut f32,
skeleton_attr: &SkeletonAttr,
) -> Self::Skeleton {
*rate = 1.0;
let mut next = (*skeleton).clone();
let movement = (anim_time as f32 * 1.0).min(1.0);
next.head.position = Vec3::new(0.0, -2.0 + skeleton_attr.head.0, skeleton_attr.head.1);
next.hand_l.position = Vec3::new(0.0, 0.0, -4.0);
next.hand_l.orientation = Quaternion::rotation_x(1.27) * Quaternion::rotation_y(0.0);
next.hand_l.scale = Vec3::one() * 1.05;
next.hand_r.position = Vec3::new(0.0, 0.0, 2.0);
next.hand_r.orientation = Quaternion::rotation_x(1.57) * Quaternion::rotation_y(0.2);
next.hand_r.scale = Vec3::one() * 1.05;
next.main.position = Vec3::new(0.0, 8.0, 13.2);
next.main.orientation = Quaternion::rotation_y(PI);
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);
next.control.scale = Vec3::one();
let slow = (anim_time as f32 * 8.0).sin();
let slowalt = (anim_time as f32 * 8.0 + PI / 2.0).sin();
let slowmid = (anim_time as f32 * 8.0 + PI / 4.0).sin();
let fast = (anim_time as f32 * 16.0).sin();
//println!("{:?}", anim_time);
match active_tool_kind {
//TODO: Inventory
Some(ToolKind::Staff(_)) | Some(ToolKind::Sceptre(_)) => {
if let Some(stage_section) = stage_section {
match stage_section {
StageSection::Buildup => {
next.control.position = Vec3::new(
-4.0 + movement * 16.0,
7.0 + movement,
4.0 + movement * 4.0,
);
next.control.orientation =
Quaternion::rotation_x(-0.3 + movement * -1.2)
* Quaternion::rotation_y(0.15 + movement * -1.4)
* Quaternion::rotation_z(0.0 + movement * -1.7);
next.head.orientation =
Quaternion::rotation_x(0.0) * Quaternion::rotation_z(0.0);
next.hand_l.position = Vec3::new(
0.0 + movement * -1.0,
0.0 + movement * -5.0,
-4.0 + movement * 19.0,
);
if velocity < 0.5 {
next.head.orientation = Quaternion::rotation_z(movement * -0.5);
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1 + movement * -3.0,
skeleton_attr.foot.2,
);
next.foot_l.orientation = Quaternion::rotation_x(movement * -0.5)
* Quaternion::rotation_z(movement * 0.5);
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1 + movement * 4.0,
skeleton_attr.foot.2,
);
next.foot_r.orientation = Quaternion::rotation_z(movement * 0.5);
next.upper_torso.orientation =
Quaternion::rotation_x(movement * -0.2)
* Quaternion::rotation_z(movement * 0.5);
next.lower_torso.orientation =
Quaternion::rotation_x(movement * 0.2)
* Quaternion::rotation_z(movement * -0.2);
} else {
};
},
StageSection::Cast => {
next.control.position = Vec3::new(12.0, 8.0 + slow * 2.0, 8.0);
next.control.orientation = Quaternion::rotation_x(-1.5)
* Quaternion::rotation_y(-1.25 + fast * 0.07)
* Quaternion::rotation_z(-1.7 + slowmid * 0.3);
next.hand_l.position = Vec3::new(
-1.0 + slow * 3.5,
-5.0 + slow * -2.0 + fast * -1.5,
15.0 + slowalt * 3.5,
);
next.hand_l.orientation = Quaternion::rotation_x(1.57)
* Quaternion::rotation_y(-1.1 + slowmid * -0.3)
* Quaternion::rotation_z(-2.8);
if velocity < 0.5 {
next.head.orientation = Quaternion::rotation_z(-0.5 + fast * 0.05);
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1 - 3.0,
skeleton_attr.foot.2,
);
next.foot_l.orientation =
Quaternion::rotation_x(-0.5) * Quaternion::rotation_z(0.5);
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1 + 4.0,
skeleton_attr.foot.2,
);
next.foot_r.orientation = Quaternion::rotation_z(0.5);
next.upper_torso.orientation =
Quaternion::rotation_x(-0.2 + slow * 0.05)
* Quaternion::rotation_z(0.5);
next.lower_torso.orientation =
Quaternion::rotation_x(0.2) * Quaternion::rotation_z(-0.2);
} else {
};
},
StageSection::Recover => {
next.control.position = Vec3::new(
12.0 + movement * -16.0,
8.0 + movement * -1.0,
8.0 + movement * -4.0,
);
next.control.orientation =
Quaternion::rotation_x(-1.5 + movement * 1.2)
* Quaternion::rotation_y(-1.25 + movement * 1.4)
* Quaternion::rotation_z(-1.7 + movement * 1.7);
next.hand_l.position = Vec3::new(
-1.0 + movement,
-5.0 + movement * 5.0,
15.0 + movement * -19.0,
);
next.hand_l.orientation =
Quaternion::rotation_x(1.57 + movement * -0.3)
* Quaternion::rotation_y(-1.1 + movement * 1.1)
* Quaternion::rotation_z(-2.8 + movement * 2.8);
if velocity < 0.5 {
next.head.orientation = Quaternion::rotation_z(movement * 0.5);
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1 - 3.0 + movement * 3.0,
skeleton_attr.foot.2,
);
next.foot_l.orientation =
Quaternion::rotation_x(-0.5 + movement * 0.5)
* Quaternion::rotation_z(0.5 + movement * -0.5);
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1 + 4.0 + movement * -4.0,
skeleton_attr.foot.2,
);
next.foot_r.orientation =
Quaternion::rotation_z(0.5 + movement * -0.5);
next.upper_torso.orientation =
Quaternion::rotation_x(-0.2 + movement * 0.2)
* Quaternion::rotation_z(0.5 + movement * -0.5);
next.lower_torso.orientation =
Quaternion::rotation_x(0.2 + movement * -0.2)
* Quaternion::rotation_z(-0.2 + movement * 0.2);
} else {
};
},
_ => {},
}
}
},
_ => {},
}
next.second.scale = match (
active_tool_kind.map(|tk| tk.hands()),
second_tool_kind.map(|tk| tk.hands()),
) {
(Some(Hands::OneHand), Some(Hands::OneHand)) => Vec3::one(),
(_, _) => Vec3::zero(),
};
next
}
}

View File

@ -58,13 +58,13 @@ impl Animation for BetaAnimation {
let stab = (anim_time as f32 * 2.5).sin();
if let Some(ToolKind::Sword(_)) = active_tool_kind {
next.hand_l.position = Vec3::new(-0.75, -1.0, 2.5);
next.hand_l.position = Vec3::new(-4.75, -1.0, 2.5);
next.hand_l.orientation = Quaternion::rotation_x(1.47) * Quaternion::rotation_y(-0.2);
next.hand_l.scale = Vec3::one() * 1.04;
next.hand_r.position = Vec3::new(0.75, -1.5, -0.5);
next.hand_r.orientation = Quaternion::rotation_x(1.47) * Quaternion::rotation_y(0.3);
next.hand_r.scale = Vec3::one() * 1.05;
next.main.position = Vec3::new(0.0, 5.0, 2.0);
next.main.position = Vec3::new(0.0, 5.0, -6.0);
next.main.orientation = Quaternion::rotation_x(-0.1)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);

View File

@ -0,0 +1,364 @@
use super::{
super::{vek::*, Animation},
BipedLargeSkeleton, SkeletonAttr,
};
use common::{
comp::item::{Hands, ToolKind},
states::utils::StageSection,
};
use std::f32::consts::PI;
pub struct LeapAnimation;
impl Animation for LeapAnimation {
type Dependency = (
Option<ToolKind>,
Option<ToolKind>,
Vec3<f32>,
f64,
Option<StageSection>,
);
type Skeleton = BipedLargeSkeleton;
#[cfg(feature = "use-dyn-lib")]
const UPDATE_FN: &'static [u8] = b"biped_large_leapmelee\0";
#[cfg_attr(feature = "be-dyn-lib", export_name = "biped_large_leapmelee")]
#[allow(clippy::approx_constant)] // TODO: Pending review in #587
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(active_tool_kind, second_tool_kind, _velocity, _global_time, stage_section): Self::Dependency,
anim_time: f64,
rate: &mut f32,
skeleton_attr: &SkeletonAttr,
) -> Self::Skeleton {
*rate = 1.0;
let mut next = (*skeleton).clone();
let movement = (anim_time as f32 * 1.0).min(1.0);
if let Some(ToolKind::Hammer(_)) = active_tool_kind {
next.hand_l.position = Vec3::new(-12.0, 0.0, 0.0);
next.hand_l.orientation = Quaternion::rotation_x(PI) * Quaternion::rotation_y(0.0);
next.hand_l.scale = Vec3::one() * 1.08;
next.hand_r.position = Vec3::new(2.0, 0.0, 0.0);
next.hand_r.orientation = Quaternion::rotation_x(PI) * Quaternion::rotation_y(0.0);
next.hand_r.scale = Vec3::one() * 1.06;
next.main.position = Vec3::new(0.0, 0.0, 12.0);
next.main.orientation = Quaternion::rotation_y(-1.57) * Quaternion::rotation_z(1.57);
next.control.position = Vec3::new(6.0, 7.0, 1.0);
next.control.orientation = Quaternion::rotation_x(0.3)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.control.scale = Vec3::one();
next.head.position = Vec3::new(0.0, -2.0 + skeleton_attr.head.0, skeleton_attr.head.1);
if let Some(stage_section) = stage_section {
match stage_section {
StageSection::Buildup => {
next.control.position = Vec3::new(6.0, 7.0, 1.0);
next.control.orientation = Quaternion::rotation_x(0.3)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(movement * 0.5);
next.upper_torso.orientation = Quaternion::rotation_x(movement * 0.3)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(movement * 0.5);
next.head.orientation = Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(movement * -0.4);
},
StageSection::Movement => {
next.control.position = Vec3::new(
6.0 + movement * -10.0,
7.0 + movement * 5.0,
1.0 + movement * 5.0,
);
next.control.orientation = Quaternion::rotation_x(0.3)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.5 + movement * 0.5);
next.upper_torso.orientation = Quaternion::rotation_x(0.3 + movement * 0.3)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.5 + movement * 0.2);
next.head.orientation = Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(movement * -0.1)
* Quaternion::rotation_z(-0.4 + movement * -0.2);
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1 - 5.0,
skeleton_attr.foot.2,
);
next.foot_l.orientation = Quaternion::rotation_x(-0.8);
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1 + 8.0,
skeleton_attr.foot.2 + 5.0,
);
next.foot_r.orientation = Quaternion::rotation_x(0.9);
},
StageSection::Swing => {
next.control.position =
Vec3::new(-4.0, 12.0 + movement * 5.0, 6.0 + movement * -7.0);
next.control.orientation = Quaternion::rotation_x(0.3 + movement * -3.0)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(1.0 + movement * 0.5);
next.upper_torso.orientation =
Quaternion::rotation_x(0.6 + movement * -0.9)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.7 + movement * -0.7);
next.head.orientation = Quaternion::rotation_x(movement * 0.2)
* Quaternion::rotation_y(-0.1)
* Quaternion::rotation_z(-0.6 + movement * 0.6);
next.hand_l.position = Vec3::new(-12.0 + movement * 10.0, 0.0, 0.0);
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1 + 8.0,
skeleton_attr.foot.2 - 5.0,
);
next.foot_l.orientation = Quaternion::rotation_x(0.9);
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1 - 5.0,
skeleton_attr.foot.2,
);
next.foot_r.orientation = Quaternion::rotation_x(-0.8);
},
StageSection::Recover => {
next.control.position = Vec3::new(-4.0, 17.0, -1.0);
next.control.orientation = Quaternion::rotation_x(-2.7)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(1.5);
next.upper_torso.orientation =
Quaternion::rotation_x(-0.3 + movement * 0.3)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.head.orientation = Quaternion::rotation_x(0.2)
* Quaternion::rotation_y(-0.1)
* Quaternion::rotation_z(0.0);
next.hand_l.position = Vec3::new(-2.0, 0.0, 0.0);
},
_ => {},
}
}
} else if let Some(ToolKind::Axe(_)) = active_tool_kind {
next.hand_l.position = Vec3::new(-0.5, 0.0, 4.0);
next.hand_l.orientation = Quaternion::rotation_x(PI / 2.0)
* Quaternion::rotation_z(0.0)
* Quaternion::rotation_y(0.0);
next.hand_l.scale = Vec3::one() * 1.08;
next.hand_r.position = Vec3::new(0.5, 0.0, -2.5);
next.hand_r.orientation = Quaternion::rotation_x(PI / 2.0)
* Quaternion::rotation_z(0.0)
* Quaternion::rotation_y(0.0);
next.hand_r.scale = Vec3::one() * 1.06;
next.main.position = Vec3::new(-0.0, -2.0, -1.0);
next.main.orientation = Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.control.position = Vec3::new(-3.0, 11.0, 3.0);
next.control.orientation = Quaternion::rotation_x(1.8)
* Quaternion::rotation_y(-0.5)
* Quaternion::rotation_z(PI - 0.2);
next.control.scale = Vec3::one();
next.head.position = Vec3::new(0.0, -2.0 + skeleton_attr.head.0, skeleton_attr.head.1);
if let Some(stage_section) = stage_section {
match stage_section {
StageSection::Buildup => {
next.control.position = Vec3::new(
-3.0 + movement * 3.0,
11.0 + movement * 1.0,
3.0 + movement * 12.0,
);
next.control.orientation = Quaternion::rotation_x(1.8 + movement * -1.0)
* Quaternion::rotation_y(-0.5 + movement * 0.5)
* Quaternion::rotation_z(PI + 0.2 - movement * 0.2);
next.upper_torso.orientation = Quaternion::rotation_x(movement * -0.3)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(movement * 0.5);
next.head.orientation = Quaternion::rotation_x(0.0 + movement * -0.4);
next.foot_l.position = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1,
skeleton_attr.foot.2 - 8.0,
);
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1,
skeleton_attr.foot.2 - 8.0,
);
next.foot_l.orientation = Quaternion::rotation_x(movement * 0.9);
next.foot_r.orientation = Quaternion::rotation_x(movement * 0.9);
next.lower_torso.orientation = Quaternion::rotation_x(movement * 0.3);
next.upper_torso.position = Vec3::new(
0.0,
skeleton_attr.upper_torso.0,
skeleton_attr.upper_torso.1 - 8.0,
);
next.torso.position = Vec3::new(0.0, 0.0, 0.0 + 8.0);
},
StageSection::Movement => {
next.control.position = Vec3::new(
0.0, 12.0, //11
15.0,
);
next.upper_torso.position = Vec3::new(
0.0,
skeleton_attr.upper_torso.0,
skeleton_attr.upper_torso.1 - 8.0,
);
next.torso.position = Vec3::new(0.0, 0.0, 0.0 + 8.0);
next.control.orientation = Quaternion::rotation_x(0.8 + movement * -0.5)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(PI);
next.torso.orientation = Quaternion::rotation_x(-0.3 + movement * 6.0)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.head.orientation = Quaternion::rotation_x(-0.4 + movement * 0.4);
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1 + movement * 4.0,
skeleton_attr.foot.2 - 8.0 + movement * 3.0,
);
next.foot_l.orientation = Quaternion::rotation_x(0.9);
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1 + movement * 4.0,
skeleton_attr.foot.2 - 8.0 + movement * 3.0,
);
next.foot_r.orientation = Quaternion::rotation_x(0.9);
next.upper_torso.position = Vec3::new(
0.0,
skeleton_attr.upper_torso.0,
skeleton_attr.upper_torso.1 - 8.0,
);
next.torso.position = Vec3::new(0.0, 0.0, 0.0 + 8.0);
next.torso.orientation = Quaternion::rotation_x(movement * -1.8 * PI);
next.torso.scale = Vec3::one() / 11.0;
next.lower_torso.orientation = Quaternion::rotation_x(0.3 + movement * 0.1);
next.upper_torso.position = Vec3::new(
0.0,
skeleton_attr.upper_torso.0,
skeleton_attr.upper_torso.1 - 8.0,
);
next.torso.position = Vec3::new(0.0, 0.0, 0.0 + 8.0);
},
StageSection::Swing => {
next.control.position =
Vec3::new(0.0, 12.0 + movement * 3.0, 15.0 + movement * -15.0);
next.control.orientation = Quaternion::rotation_x(0.3 + movement * -1.0)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(PI);
next.head.orientation = Quaternion::rotation_x(movement * 0.2);
next.hand_l.position = Vec3::new(-0.5, 0.0, 4.0);
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1 + 4.0 + movement * -8.0,
skeleton_attr.foot.2 - 5.0 + movement * -3.0,
);
next.foot_l.orientation = Quaternion::rotation_x(0.9 - movement * 1.8);
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1 + 4.0 + movement * -8.0,
skeleton_attr.foot.2 - 5.0 + movement * -3.0,
);
next.foot_r.orientation = Quaternion::rotation_x(0.9 - movement * 1.8);
next.torso.orientation =
Quaternion::rotation_x(-1.9 * PI - movement * 0.2 * PI);
next.upper_torso.position = Vec3::new(
0.0,
skeleton_attr.upper_torso.0,
skeleton_attr.upper_torso.1 - 8.0,
);
next.torso.position = Vec3::new(0.0, 0.0, 0.0 + 8.0);
},
StageSection::Recover => {
next.control.position = Vec3::new(0.0, 15.0, 0.0);
next.control.orientation = Quaternion::rotation_x(-0.7)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(PI);
next.head.orientation = Quaternion::rotation_x(0.2);
next.hand_l.position = Vec3::new(-0.5, 0.0, 4.0);
next.upper_torso.position = Vec3::new(
0.0,
skeleton_attr.upper_torso.0,
skeleton_attr.upper_torso.1 - 8.0,
);
next.torso.position = Vec3::new(0.0, 0.0, 0.0 + 8.0);
next.torso.orientation =
Quaternion::rotation_x(-6.7 + movement * -0.1 * PI);
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1 - 4.0,
skeleton_attr.foot.2 - 8.0,
);
next.foot_l.orientation = Quaternion::rotation_x(-0.9);
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1 - 4.0,
skeleton_attr.foot.2 - 8.0,
);
next.foot_r.orientation = Quaternion::rotation_x(-0.9);
},
_ => {},
}
}
}
//next.lantern.position = Vec3::new(
// skeleton_attr.lantern.0,
// skeleton_attr.lantern.1,
// skeleton_attr.lantern.2,
//);
//next.glider.position = Vec3::new(0.0, 0.0, 10.0);
//next.glider.scale = Vec3::one() * 0.0;
//next.l_control.scale = Vec3::one();
//next.r_control.scale = Vec3::one();
next.second.scale = match (
active_tool_kind.map(|tk| tk.hands()),
second_tool_kind.map(|tk| tk.hands()),
) {
(Some(Hands::OneHand), Some(Hands::OneHand)) => Vec3::one(),
(_, _) => Vec3::zero(),
};
//next.torso.position = Vec3::new(0.0, 0.0, 0.0) * skeleton_attr.scaler;
//next.torso.orientation = Quaternion::rotation_z(0.0);
//next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
next
}
}

View File

@ -1,10 +1,13 @@
pub mod alpha;
pub mod beam;
pub mod beta;
pub mod charge;
pub mod dash;
pub mod idle;
pub mod jump;
pub mod leapmelee;
pub mod run;
pub mod shockwave;
pub mod shoot;
pub mod spin;
pub mod spinmelee;
@ -12,9 +15,10 @@ pub mod wield;
// Reexports
pub use self::{
alpha::AlphaAnimation, beta::BetaAnimation, charge::ChargeAnimation, dash::DashAnimation,
idle::IdleAnimation, jump::JumpAnimation, run::RunAnimation, shoot::ShootAnimation,
spin::SpinAnimation, spinmelee::SpinMeleeAnimation, wield::WieldAnimation,
alpha::AlphaAnimation, beam::BeamAnimation, beta::BetaAnimation, charge::ChargeAnimation,
dash::DashAnimation, idle::IdleAnimation, jump::JumpAnimation, leapmelee::LeapAnimation,
run::RunAnimation, shockwave::ShockwaveAnimation, shoot::ShootAnimation, spin::SpinAnimation,
spinmelee::SpinMeleeAnimation, wield::WieldAnimation,
};
use super::{make_bone, vek::*, FigureBoneData, Skeleton};

View File

@ -0,0 +1,188 @@
use super::{
super::{vek::*, Animation},
BipedLargeSkeleton, SkeletonAttr,
};
use common::{
comp::item::{Hands, ToolKind},
states::utils::StageSection,
};
use std::f32::consts::PI;
pub struct Input {
pub attack: bool,
}
pub struct ShockwaveAnimation;
impl Animation for ShockwaveAnimation {
type Dependency = (
Option<ToolKind>,
Option<ToolKind>,
f64,
f32,
Option<StageSection>,
);
type Skeleton = BipedLargeSkeleton;
#[cfg(feature = "use-dyn-lib")]
const UPDATE_FN: &'static [u8] = b"biped_large_shockwave\0";
#[cfg_attr(feature = "be-dyn-lib", export_name = "biped_large_shockwave")]
#[allow(clippy::single_match)] // TODO: Pending review in #587
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(active_tool_kind, second_tool_kind, _global_time, velocity, stage_section): Self::Dependency,
anim_time: f64,
rate: &mut f32,
skeleton_attr: &SkeletonAttr,
) -> Self::Skeleton {
*rate = 1.0;
let mut next = (*skeleton).clone();
let movement = (anim_time as f32 * 1.0).min(1.0);
next.head.position = Vec3::new(0.0, -2.0 + skeleton_attr.head.0, skeleton_attr.head.1);
next.hand_l.position = Vec3::new(0.0, 0.0, -4.0);
next.hand_l.orientation = Quaternion::rotation_x(1.27) * Quaternion::rotation_y(0.0);
next.hand_l.scale = Vec3::one() * 1.05;
next.hand_r.position = Vec3::new(0.0, 0.0, 2.0);
next.hand_r.orientation = Quaternion::rotation_x(1.57) * Quaternion::rotation_y(0.2);
next.hand_r.scale = Vec3::one() * 1.05;
next.main.position = Vec3::new(0.0, 8.0, 13.2);
next.main.orientation = Quaternion::rotation_y(PI);
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);
next.control.scale = Vec3::one();
let twist = movement * 0.8;
match active_tool_kind {
//TODO: Inventory
Some(ToolKind::Staff(_)) => {
if let Some(stage_section) = stage_section {
match stage_section {
StageSection::Buildup => {
next.control.position = Vec3::new(
-4.0 + movement * 5.0,
7.0 + movement * 3.0,
4.0 + movement * 10.0,
);
next.control.orientation =
Quaternion::rotation_x(-0.3 + movement * 0.8)
* Quaternion::rotation_y(0.15 + movement * -0.15)
* Quaternion::rotation_z(movement * 0.8);
next.head.orientation = Quaternion::rotation_x(movement * 0.4)
* Quaternion::rotation_z(twist * 0.2);
next.upper_torso.position = Vec3::new(
0.0,
skeleton_attr.upper_torso.0,
skeleton_attr.upper_torso.1 + movement * 2.0,
);
next.upper_torso.orientation = Quaternion::rotation_z(twist * -0.2);
next.lower_torso.orientation = Quaternion::rotation_z(twist);
if velocity < 0.5 {
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1 + movement * -7.0,
skeleton_attr.foot.2,
);
next.foot_l.orientation = Quaternion::rotation_x(movement * -0.8)
* Quaternion::rotation_z(movement * 0.3);
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1 + movement * 5.0,
skeleton_attr.foot.2,
);
next.foot_r.orientation = Quaternion::rotation_y(movement * -0.3)
* Quaternion::rotation_z(movement * 0.4);
} else {
};
},
StageSection::Swing => {
next.control.position = Vec3::new(1.0, 10.0, 14.0 + movement * -2.0);
next.control.orientation = Quaternion::rotation_x(0.5 + movement * 0.3)
* Quaternion::rotation_y(movement * 0.3)
* Quaternion::rotation_z(0.8 + movement * -0.8);
next.head.orientation = Quaternion::rotation_x(0.4)
* Quaternion::rotation_z(0.2 + movement * -0.8);
next.upper_torso.position = Vec3::new(
0.0,
skeleton_attr.upper_torso.0,
skeleton_attr.upper_torso.1 + 2.0 + movement * -4.0,
);
next.upper_torso.orientation = Quaternion::rotation_x(movement * -0.8)
* Quaternion::rotation_z(movement * -0.3);
next.lower_torso.orientation = Quaternion::rotation_x(movement * 0.3)
* Quaternion::rotation_z(0.8 + movement * -0.8);
if velocity < 0.5 {
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1 - 7.0 + movement * 7.0,
skeleton_attr.foot.2,
);
next.foot_l.orientation =
Quaternion::rotation_x(-0.8 + movement * 0.8)
* Quaternion::rotation_z(0.3 + movement * -0.3);
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1 + 5.0 + movement * -5.0,
skeleton_attr.foot.2,
);
next.foot_r.orientation =
Quaternion::rotation_y(-0.3 + movement * 0.3)
* Quaternion::rotation_z(0.4 + movement * -0.4);
} else {
};
},
StageSection::Recover => {
next.control.position = Vec3::new(
1.0 + movement * -5.0,
10.0 + movement * -3.0,
12.0 + movement * -8.0,
);
next.control.orientation =
Quaternion::rotation_x(0.8 + movement * -1.1)
* Quaternion::rotation_y(movement * -0.15)
* Quaternion::rotation_z(0.0);
next.head.orientation = Quaternion::rotation_x(0.4 + movement * -0.4)
* Quaternion::rotation_z(-0.6 + movement * 0.6);
next.lower_torso.orientation =
Quaternion::rotation_x(0.3 + movement * -0.3);
next.upper_torso.position = Vec3::new(
0.0,
skeleton_attr.upper_torso.0,
skeleton_attr.upper_torso.1 - 2.0 + movement * 2.0,
);
next.upper_torso.orientation =
Quaternion::rotation_x(-0.8 + movement * 0.8)
* Quaternion::rotation_z(-0.3 + movement * 0.3);
},
_ => {},
}
}
},
_ => {},
}
next.second.scale = match (
active_tool_kind.map(|tk| tk.hands()),
second_tool_kind.map(|tk| tk.hands()),
) {
(Some(Hands::OneHand), Some(Hands::OneHand)) => Vec3::one(),
(_, _) => Vec3::zero(),
};
next
}
}

View File

@ -58,13 +58,13 @@ impl Animation for SpinAnimation {
next.head.position = Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1);
if let Some(ToolKind::Sword(_)) = active_tool_kind {
next.hand_l.position = Vec3::new(-0.75, -1.0, 2.5);
next.hand_l.position = Vec3::new(-4.75, -1.0, 2.5);
next.hand_l.orientation = Quaternion::rotation_x(1.47) * Quaternion::rotation_y(-0.2);
next.hand_l.scale = Vec3::one() * 1.02;
next.hand_r.position = Vec3::new(0.75, -1.5, -0.5);
next.hand_r.orientation = Quaternion::rotation_x(1.47) * Quaternion::rotation_y(0.3);
next.hand_r.scale = Vec3::one() * 1.02;
next.main.position = Vec3::new(0.0, 5.0, 2.0);
next.main.position = Vec3::new(0.0, 5.0, -6.0);
next.main.orientation = Quaternion::rotation_x(-0.1)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);

View File

@ -308,7 +308,7 @@ impl Animation for WieldAnimation {
}
match active_tool_kind {
Some(ToolKind::Sword(_)) => {
next.hand_l.position = Vec3::new(-0.75, -1.0, 2.5);
next.hand_l.position = Vec3::new(-4.75, -1.0, 2.5);
next.hand_l.orientation =
Quaternion::rotation_x(1.47) * Quaternion::rotation_y(-0.2);
next.hand_l.scale = Vec3::one() * 1.02;
@ -316,7 +316,7 @@ impl Animation for WieldAnimation {
next.hand_r.orientation =
Quaternion::rotation_x(1.47) * Quaternion::rotation_y(0.3);
next.hand_r.scale = Vec3::one() * 1.02;
next.main.position = Vec3::new(1.0, 6.0, 1.0);
next.main.position = Vec3::new(3.0, 6.0, -5.0);
next.main.orientation = Quaternion::rotation_x(-0.1);
next.control.position = Vec3::new(-7.0, 7.0, -10.0);

View File

@ -2454,6 +2454,100 @@ impl FigureMgr {
skeleton_attr,
)
},
CharacterState::LeapMelee(s) => {
let stage_progress = match active_tool_kind {
Some(ToolKind::Axe(_) | ToolKind::Hammer(_)) => {
let stage_time = s.timer.as_secs_f64();
match s.stage_section {
StageSection::Buildup => {
stage_time
/ s.static_data.buildup_duration.as_secs_f64()
},
StageSection::Movement => {
stage_time
/ s.static_data.movement_duration.as_secs_f64()
},
StageSection::Swing => {
stage_time / s.static_data.swing_duration.as_secs_f64()
},
StageSection::Recover => {
stage_time
/ s.static_data.recover_duration.as_secs_f64()
},
_ => 0.0,
}
},
_ => state.state_time,
};
anim::biped_large::LeapAnimation::update_skeleton(
&target_base,
(
active_tool_kind,
second_tool_kind,
vel.0,
time,
Some(s.stage_section),
),
stage_progress,
&mut state_animation_rate,
skeleton_attr,
)
},
CharacterState::Shockwave(s) => {
let stage_time = s.timer.as_secs_f64();
let stage_progress = match s.stage_section {
StageSection::Buildup => {
stage_time / s.static_data.buildup_duration.as_secs_f64()
},
StageSection::Swing => {
stage_time / s.static_data.swing_duration.as_secs_f64()
},
StageSection::Recover => {
stage_time / s.static_data.recover_duration.as_secs_f64()
},
_ => 0.0,
};
anim::biped_large::ShockwaveAnimation::update_skeleton(
&target_base,
(
active_tool_kind,
second_tool_kind,
time,
vel.0.magnitude(),
Some(s.stage_section),
),
stage_progress,
&mut state_animation_rate,
skeleton_attr,
)
},
CharacterState::BasicBeam(s) => {
let stage_time = s.timer.as_secs_f64();
let stage_progress = match s.stage_section {
StageSection::Buildup => {
stage_time / s.static_data.buildup_duration.as_secs_f64()
},
StageSection::Cast => s.timer.as_secs_f64(),
StageSection::Recover => {
stage_time / s.static_data.recover_duration.as_secs_f64()
},
_ => 0.0,
};
anim::biped_large::BeamAnimation::update_skeleton(
&target_base,
(
active_tool_kind,
second_tool_kind,
time,
vel.0.magnitude(),
Some(s.stage_section),
),
stage_progress,
&mut state_animation_rate,
skeleton_attr,
)
},
// TODO!
_ => target_base,
};