start cleanup

This commit is contained in:
jshipsey 2020-10-19 23:12:49 -04:00 committed by Robin Gilh
parent a8dd44325f
commit e928dbe4db
29 changed files with 211 additions and 1748 deletions

View File

@ -39,15 +39,9 @@ impl Animation for BeamAnimation {
let mut next = (*skeleton).clone();
let (movement1, movement2, movement3) = match stage_section {
Some(StageSection::Buildup) => {
(anim_time as f32, 0.0, 0.0)
},
Some(StageSection::Cast) => {
(1.0, anim_time as f32, 0.0)
},
Some(StageSection::Recover) => {
(1.0, 1.0, anim_time as f32)
},
Some(StageSection::Buildup) => (anim_time as f32, 0.0, 0.0),
Some(StageSection::Cast) => (1.0, anim_time as f32, 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time as f32),
_ => (0.0, 0.0, 0.0),
};
@ -77,31 +71,46 @@ impl Animation for BeamAnimation {
);
next.control.orientation =
Quaternion::rotation_x(-0.3 + movement1 * -1.2 + movement3 * 1.2)
* Quaternion::rotation_y(0.15 + movement1 * -1.4 + (movement2 * 16.0).sin() * 0.07 + movement3 * 1.4)
* Quaternion::rotation_z(movement1 * -1.7 + (movement2 * 8.0 + PI / 4.0).sin() * 0.3 + movement3 * 1.7);
next.head.orientation =
Quaternion::rotation_x(0.0) * Quaternion::rotation_z(0.0);
* Quaternion::rotation_y(
0.15 + movement1 * -1.4
+ (movement2 * 16.0).sin() * 0.07
+ movement3 * 1.4,
)
* Quaternion::rotation_z(
movement1 * -1.7
+ (movement2 * 8.0 + PI / 4.0).sin() * 0.3
+ movement3 * 1.7,
);
next.head.orientation = Quaternion::rotation_x(0.0) * Quaternion::rotation_z(0.0);
next.hand_l.position = Vec3::new(
0.0 + movement1 * -1.0 + (movement2 * 8.0).sin() * 3.5 + movement3,
0.0 + movement1 * -5.0 + (movement2 * 8.0).sin() * -2.0 + (movement2 * 16.0).sin() * -1.5 + movement3 * 5.0,
-4.0 + movement1 * 19.0 + (movement2 * 8.0 + PI / 2.0).sin() * 3.5 + movement3 * -19.0,
0.0 + movement1 * -5.0
+ (movement2 * 8.0).sin() * -2.0
+ (movement2 * 16.0).sin() * -1.5
+ movement3 * 5.0,
-4.0 + movement1 * 19.0
+ (movement2 * 8.0 + PI / 2.0).sin() * 3.5
+ movement3 * -19.0,
);
next.hand_l.orientation =
Quaternion::rotation_x(1.57 + movement3 * -0.3)
* Quaternion::rotation_y(movement1 *-1.1 + (movement2 * 8.0 + PI / 2.0).sin() * -0.3 + movement3 * 1.1)
next.hand_l.orientation = Quaternion::rotation_x(1.57 + movement3 * -0.3)
* Quaternion::rotation_y(
movement1 * -1.1
+ (movement2 * 8.0 + PI / 2.0).sin() * -0.3
+ movement3 * 1.1,
)
* Quaternion::rotation_z(movement1 * -2.8 + movement3 * 2.8);
if velocity < 0.5 {
next.head.orientation = Quaternion::rotation_z(movement1 * -0.5 + (movement2 * 16.0).sin() * 0.05);
next.head.orientation =
Quaternion::rotation_z(movement1 * -0.5 + (movement2 * 16.0).sin() * 0.05);
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1 + movement1 * -3.0,
skeleton_attr.foot.2,
);
next.foot_l.orientation =
Quaternion::rotation_x(movement1 * -0.5)
next.foot_l.orientation = Quaternion::rotation_x(movement1 * -0.5)
* Quaternion::rotation_z(movement1 * 0.5);
next.foot_r.position = Vec3::new(
@ -112,9 +121,8 @@ impl Animation for BeamAnimation {
next.foot_r.orientation = Quaternion::rotation_z(movement1 * 0.5);
next.upper_torso.orientation =
Quaternion::rotation_x(movement1 * -0.2 + (movement2 * 8.0).sin() * 0.05)
* Quaternion::rotation_z(movement1 * 0.5);
next.lower_torso.orientation =
Quaternion::rotation_x(movement1 * 0.2)
* Quaternion::rotation_z(movement1 * 0.5);
next.lower_torso.orientation = Quaternion::rotation_x(movement1 * 0.2)
* Quaternion::rotation_z(movement1 * -0.2);
} else {
};
@ -131,4 +139,4 @@ impl Animation for BeamAnimation {
next
}
}
}

View File

@ -38,15 +38,9 @@ impl Animation for AlphaAnimation {
let lab = 1.0;
let (movement1, movement2, movement3) = match stage_section {
Some(StageSection::Buildup) => {
(anim_time as f32, 0.0, 0.0)
},
Some(StageSection::Swing) => {
(1.0, anim_time as f32, 0.0)
},
Some(StageSection::Recover) => {
(1.0, 1.0, anim_time as f32)
},
Some(StageSection::Buildup) => (anim_time as f32, 0.0, 0.0),
Some(StageSection::Swing) => (1.0, anim_time as f32, 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time as f32),
_ => (0.0, 0.0, 0.0),
};
@ -57,10 +51,6 @@ impl Animation for AlphaAnimation {
.sqrt())
* ((anim_time as f32 * lab as f32 * 2.0 * velocity).sin());
let slowersmooth = (anim_time as f32 * lab as f32 * 4.0).sin();
let accel_med = 1.0 - (anim_time as f32 * 16.0 * lab as f32).cos();
let accel_slow = 1.0 - (anim_time as f32 * 12.0 * lab as f32).cos();
let accel_fast = 1.0 - (anim_time as f32 * 24.0 * lab as f32).cos();
let decel = (anim_time as f32 * 16.0 * lab as f32).min(PI / 2.0).sin();
let push = anim_time as f32 * lab as f32 * 4.0;
let slow = (((5.0)
/ (0.4 + 4.6 * ((anim_time as f32 * lab as f32 * 9.0).sin()).powf(2.0 as f32)))
@ -86,7 +76,7 @@ impl Animation for AlphaAnimation {
if let Some(ToolKind::Sword(_)) = active_tool_kind {
next.hand_l.position = Vec3::new(-0.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_l.scale = Vec3::one() * 1.05;
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;
@ -95,21 +85,23 @@ impl Animation for AlphaAnimation {
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.control.position =
Vec3::new(
next.control.position = Vec3::new(
-7.0,
7.0 + movement1 * -4.0 + movement2 * 16.0 + movement3 * -4.0,
2.0 + movement1 * 1.0
2.0 + movement1 * 1.0,
);
next.control.orientation =
Quaternion::rotation_x(movement1 * -0.5)
next.control.orientation = Quaternion::rotation_x(movement1 * -0.5)
* Quaternion::rotation_y(movement1 * -1.0 + movement2 * -0.6 + movement3 * 1.0)
* Quaternion::rotation_z(movement1 * -1.2 + movement2 * 1.3);
next.chest.orientation = Quaternion::rotation_z(movement1 * 1.5 + (movement2 * 1.75).sin() * -3.0 + movement3 * 0.5);
next.chest.orientation = Quaternion::rotation_z(
movement1 * 1.5 + (movement2 * 1.75).sin() * -3.0 + movement3 * 0.5,
);
next.head.position = Vec3::new(0.0, skeleton_attr.head.0 + 0.0, skeleton_attr.head.1);
next.head.orientation = Quaternion::rotation_z(movement1 * -0.9 + (movement2 * 1.75).sin() * 2.5 + movement3 * -0.5);
next.head.orientation = Quaternion::rotation_z(
movement1 * -0.9 + (movement2 * 1.75).sin() * 2.5 + movement3 * -0.5,
);
}
match active_tool_kind {
//TODO: Inventory
@ -119,13 +111,11 @@ impl Animation for AlphaAnimation {
next.head.orientation = Quaternion::rotation_z(slow * -0.25)
* Quaternion::rotation_x(0.0 + slow * 0.15)
* Quaternion::rotation_y(slow * -0.15);
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
next.chest.position = Vec3::new(0.0, skeleton_attr.chest.0, skeleton_attr.chest.1);
next.chest.orientation = Quaternion::rotation_z(slow * 0.4)
* Quaternion::rotation_x(0.0 + slow * -0.2)
* Quaternion::rotation_y(slow * 0.2);
next.chest.scale = Vec3::one();
next.belt.position = Vec3::new(0.0, skeleton_attr.belt.0, skeleton_attr.belt.1);
next.belt.orientation = next.chest.orientation * -0.3;
@ -134,10 +124,8 @@ impl Animation for AlphaAnimation {
Vec3::new(0.0, skeleton_attr.shorts.0, skeleton_attr.shorts.1);
next.shorts.orientation = next.chest.orientation * -0.45;
// TODO: Fix animation
next.hand_l.position = Vec3::new(0.0, 0.0, 0.0);
next.hand_l.orientation = Quaternion::rotation_x(0.0);
next.hand_l.scale = Vec3::one() * 1.12;
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_x(0.0);
@ -370,58 +358,6 @@ impl Animation for AlphaAnimation {
* Quaternion::rotation_z(0.0);
next.control.scale = Vec3::one();
},
Some(ToolKind::Shield(_)) => {
next.head.position = Vec3::new(
0.0,
0.0 + skeleton_attr.head.0 + decel * 0.8,
skeleton_attr.head.1,
);
next.head.orientation = Quaternion::rotation_z(decel * 0.25)
* Quaternion::rotation_x(0.0 + decel * 0.1)
* Quaternion::rotation_y(decel * -0.1);
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
next.chest.position = Vec3::new(0.0, 0.0, 7.0);
next.chest.orientation = Quaternion::rotation_z(decel * -0.2)
* Quaternion::rotation_x(0.0 + decel * -0.2)
* Quaternion::rotation_y(decel * 0.2);
next.torso.position = Vec3::new(0.0, 0.0, 0.1) * skeleton_attr.scaler;
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
next.belt.position = Vec3::new(0.0, 0.0, 0.0);
next.belt.orientation = Quaternion::rotation_z(decel * -0.1)
* Quaternion::rotation_x(0.0 + decel * -0.1)
* Quaternion::rotation_y(decel * 0.1);
next.shorts.position = Vec3::new(0.0, 0.0, 0.0);
next.belt.orientation = Quaternion::rotation_z(decel * -0.08)
* Quaternion::rotation_x(0.0 + decel * -0.08)
* Quaternion::rotation_y(decel * 0.08);
next.control_l.position =
Vec3::new(-8.0 + accel_slow * 10.0, 8.0 + accel_fast * 3.0, 0.0);
next.control_l.orientation = Quaternion::rotation_z(-0.8)
* Quaternion::rotation_x(0.0 + accel_med * -0.8)
* Quaternion::rotation_y(0.0 + accel_med * -0.4);
next.hand_l.position = Vec3::new(0.0, 0.0, 0.0);
next.hand_l.orientation = Quaternion::rotation_x(0.0);
next.hand_l.scale = Vec3::one() * 1.01;
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_z(0.0);
next.control_r.position = Vec3::new(8.0, 0.0, 0.0);
next.control_r.orientation = Quaternion::rotation_x(0.0);
next.hand_r.position = Vec3::new(0.0, 0.0, 0.0);
next.hand_r.orientation = Quaternion::rotation_x(0.0);
next.hand_r.scale = Vec3::one() * 1.01;
next.second.position = Vec3::new(0.0, 0.0, 0.0);
next.second.orientation = Quaternion::rotation_x(0.0);
},
Some(ToolKind::Debug(_)) => {
next.hand_l.position = Vec3::new(-7.0, 4.0, 3.0);
next.hand_l.orientation = Quaternion::rotation_x(1.27)
@ -439,11 +375,7 @@ impl Animation for AlphaAnimation {
},
_ => {},
}
next.lantern.position = Vec3::new(
skeleton_attr.lantern.0,
skeleton_attr.lantern.1,
skeleton_attr.lantern.2,
);
next.lantern.scale = Vec3::one() * 0.65;
next.shoulder_l.scale = Vec3::one() * 1.1;
next.shoulder_r.scale = Vec3::one() * 1.1;

View File

@ -8,9 +8,6 @@ use common::{
};
use std::f32::consts::PI;
pub struct Input {
pub attack: bool,
}
pub struct BeamAnimation;
impl Animation for BeamAnimation {
@ -39,24 +36,16 @@ impl Animation for BeamAnimation {
let mut next = (*skeleton).clone();
let (movement1, movement2, movement3) = match stage_section {
Some(StageSection::Buildup) => {
(anim_time as f32, 0.0, 0.0)
},
Some(StageSection::Cast) => {
(1.0, anim_time as f32, 0.0)
},
Some(StageSection::Recover) => {
(1.0, 1.0, anim_time as f32)
},
Some(StageSection::Buildup) => (anim_time as f32, 0.0, 0.0),
Some(StageSection::Cast) => (1.0, anim_time as f32, 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time as f32),
_ => (0.0, 0.0, 0.0),
};
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, 0.0, 13.2);
next.main.orientation = Quaternion::rotation_y(PI);
@ -64,11 +53,8 @@ impl Animation for BeamAnimation {
next.control.orientation = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(0.15)
* Quaternion::rotation_z(0.0);
next.control.scale = Vec3::one();
//println!("{:?}", anim_time);
match active_tool_kind {
//TODO: Inventory
Some(ToolKind::Staff(_)) | Some(ToolKind::Sceptre(_)) => {
next.control.position = Vec3::new(
-4.0 + movement1 * 16.0 + movement3 * -16.0,
@ -77,31 +63,46 @@ impl Animation for BeamAnimation {
);
next.control.orientation =
Quaternion::rotation_x(-0.3 + movement1 * -1.2 + movement3 * 1.2)
* Quaternion::rotation_y(0.15 + movement1 * -1.4 + (movement2 * 16.0).sin() * 0.07 + movement3 * 1.4)
* Quaternion::rotation_z(movement1 * -1.7 + (movement2 * 8.0 + PI / 4.0).sin() * 0.3 + movement3 * 1.7);
next.head.orientation =
Quaternion::rotation_x(0.0) * Quaternion::rotation_z(0.0);
* Quaternion::rotation_y(
0.15 + movement1 * -1.4
+ (movement2 * 16.0).sin() * 0.07
+ movement3 * 1.4,
)
* Quaternion::rotation_z(
movement1 * -1.7
+ (movement2 * 8.0 + PI / 4.0).sin() * 0.3
+ movement3 * 1.7,
);
next.head.orientation = Quaternion::rotation_x(0.0) * Quaternion::rotation_z(0.0);
next.hand_l.position = Vec3::new(
0.0 + movement1 * -1.0 + (movement2 * 8.0).sin() * 3.5 + movement3,
0.0 + movement1 * -5.0 + (movement2 * 8.0).sin() * -2.0 + (movement2 * 16.0).sin() * -1.5 + movement3 * 5.0,
-4.0 + movement1 * 19.0 + (movement2 * 8.0 + PI / 2.0).sin() * 3.5 + movement3 * -19.0,
0.0 + movement1 * -5.0
+ (movement2 * 8.0).sin() * -2.0
+ (movement2 * 16.0).sin() * -1.5
+ movement3 * 5.0,
-4.0 + movement1 * 19.0
+ (movement2 * 8.0 + PI / 2.0).sin() * 3.5
+ movement3 * -19.0,
);
next.hand_l.orientation =
Quaternion::rotation_x(1.57 + movement3 * -0.3)
* Quaternion::rotation_y(movement1 *-1.1 + (movement2 * 8.0 + PI / 2.0).sin() * -0.3 + movement3 * 1.1)
next.hand_l.orientation = Quaternion::rotation_x(1.57 + movement3 * -0.3)
* Quaternion::rotation_y(
movement1 * -1.1
+ (movement2 * 8.0 + PI / 2.0).sin() * -0.3
+ movement3 * 1.1,
)
* Quaternion::rotation_z(movement1 * -2.8 + movement3 * 2.8);
if velocity < 0.5 {
next.head.orientation = Quaternion::rotation_z(movement1 * -0.5 + (movement2 * 16.0).sin() * 0.05);
next.head.orientation =
Quaternion::rotation_z(movement1 * -0.5 + (movement2 * 16.0).sin() * 0.05);
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1 + movement1 * -3.0,
skeleton_attr.foot.2,
);
next.foot_l.orientation =
Quaternion::rotation_x(movement1 * -0.5)
next.foot_l.orientation = Quaternion::rotation_x(movement1 * -0.5)
* Quaternion::rotation_z(movement1 * 0.5);
next.foot_r.position = Vec3::new(
@ -112,12 +113,10 @@ impl Animation for BeamAnimation {
next.foot_r.orientation = Quaternion::rotation_z(movement1 * 0.5);
next.chest.orientation =
Quaternion::rotation_x(movement1 * -0.2 + (movement2 * 8.0).sin() * 0.05)
* Quaternion::rotation_z(movement1 * 0.5);
next.belt.orientation =
Quaternion::rotation_x(movement1 * 0.1)
* Quaternion::rotation_z(movement1 * 0.5);
next.belt.orientation = Quaternion::rotation_x(movement1 * 0.1)
* Quaternion::rotation_z(movement1 * -0.1);
next.shorts.orientation =
Quaternion::rotation_x(movement1 * 0.2)
next.shorts.orientation = Quaternion::rotation_x(movement1 * 0.2)
* Quaternion::rotation_z(movement1 * -0.2);
} else {
};

View File

@ -33,207 +33,53 @@ impl Animation for BetaAnimation {
*rate = 1.0;
let mut next = (*skeleton).clone();
let lab = 1.0;
let (movement1, movement2, movement3) = match stage_section {
Some(StageSection::Buildup) => {
(anim_time as f32, 0.0, 0.0)
},
Some(StageSection::Cast) => {
(1.0, anim_time as f32, 0.0)
},
Some(StageSection::Recover) => {
(1.0, 1.0, anim_time as f32)
},
Some(StageSection::Buildup) => (anim_time as f32, 0.0, 0.0),
Some(StageSection::Cast) => (1.0, anim_time as f32, 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time as f32),
_ => (0.0, 0.0, 0.0),
};
let fast = (((5.0)
/ (1.1 + 3.9 * ((anim_time as f32 * lab as f32 * 28.0).sin()).powf(2.0 as f32)))
.sqrt())
* ((anim_time as f32 * lab as f32 * 28.0).sin());
let footquick = (((5.0)
/ (0.4 + 4.6 * ((anim_time as f32 * lab as f32 * 14.0).sin()).powf(2.0 as f32)))
.sqrt())
* ((anim_time as f32 * lab as f32 * 14.0).sin());
let foot = (((5.0)
/ (1.1 + 3.9 * ((anim_time as f32 * lab as f32 * 14.0).sin()).powf(2.0 as f32)))
.sqrt())
* ((anim_time as f32 * lab as f32 * 14.0).sin());
let slow = (((5.0)
/ (0.6 + 4.4 * ((anim_time as f32 * lab as f32 * 14.0).sin()).powf(2.0 as f32)))
.sqrt())
* ((anim_time as f32 * lab as f32 * 14.0).sin());
if let Some(ToolKind::Sword(_)) = active_tool_kind {
next.hand_l.position = Vec3::new(-0.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, 0.0, 2.0);
next.main.orientation = Quaternion::rotation_x(-0.1)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.main.orientation = Quaternion::rotation_x(-0.1);
next.head.position = Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1);
next.control.position = Vec3::new(
-8.0 + movement1 * -5.0 + (movement2 as f32 * 2.5).sin() * 30.0 + movement3 * -5.0,
1.0 - (movement1 as f32 * 8.0).sin() * 0.8 + movement1 * 2.0 + movement3 * 2.0,
1.0 - (movement1 as f32 * 8.0).sin() * 0.8 + movement1 * 2.0 + movement3 * 2.0,
2.0 - (movement1 as f32 * 8.0).sin() * 0.4,
);
next.control.orientation = Quaternion::rotation_x(-1.57)
* Quaternion::rotation_y(0.0 + movement1 * 1.5 + (movement2 as f32 * 2.5).sin() * 0.5)
* Quaternion::rotation_y(
0.0 + movement1 * 1.5 + (movement2 as f32 * 2.5).sin() * 0.5,
)
* Quaternion::rotation_z(1.0 + (movement2 as f32 * 2.5).sin() * 1.0);
next.chest.orientation = Quaternion::rotation_y(-0.1)
* Quaternion::rotation_z(0.4 + movement1 * 1.5 + (movement2 as f32 * 2.5).sin() * -0.5 + movement3 * 1.0);
* Quaternion::rotation_z(
0.4 + movement1 * 1.5 + (movement2 as f32 * 2.5).sin() * -0.5 + movement3 * 1.0,
);
next.head.orientation = Quaternion::rotation_y(0.1)
* Quaternion::rotation_z(-0.1 + movement1 * -1.1 + (movement2 as f32 * 2.5).sin() * -0.5);
* Quaternion::rotation_z(
-0.1 + movement1 * -1.1 + (movement2 as f32 * 2.5).sin() * -0.5,
);
}
match active_tool_kind {
Some(ToolKind::Hammer(_)) => {
next.head.position =
Vec3::new(0.0, -2.0 + skeleton_attr.head.0, skeleton_attr.head.1);
next.head.orientation = Quaternion::rotation_z(slow * -0.18)
* Quaternion::rotation_x(-0.1 + slow * -0.28)
* Quaternion::rotation_y(0.2 + slow * 0.18);
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
next.chest.position = Vec3::new(0.0 + foot * 2.0, 0.0, 7.0);
next.chest.orientation = Quaternion::rotation_z(slow * 0.2)
* Quaternion::rotation_x(slow * 0.2)
* Quaternion::rotation_y(slow * -0.1);
next.belt.position = Vec3::new(0.0, 0.0, -2.0);
next.belt.orientation = Quaternion::rotation_z(slow * 0.1)
* Quaternion::rotation_x(slow * 0.1)
* Quaternion::rotation_y(slow * -0.04);
next.shorts.position = Vec3::new(0.0, 0.0, -5.0);
next.shorts.orientation = Quaternion::rotation_z(slow * 0.1)
* Quaternion::rotation_x(slow * 0.1)
* Quaternion::rotation_y(slow * -0.05);
next.hand_l.position = Vec3::new(-0.75, -1.0, -2.5);
next.hand_l.orientation = Quaternion::rotation_x(1.27);
next.hand_l.scale = Vec3::one() * 1.04;
next.hand_r.position = Vec3::new(0.75, -1.5, -5.5);
next.hand_r.orientation = Quaternion::rotation_x(1.27);
next.hand_r.scale = Vec3::one() * 1.05;
next.main.position = Vec3::new(0.0, 6.0, -1.0);
next.main.orientation = Quaternion::rotation_x(-0.3);
next.control.position = Vec3::new(-8.0 + slow * 1.5, 1.5 + slow * 1.0, 0.0);
next.control.orientation = Quaternion::rotation_x(-1.4)
* Quaternion::rotation_y(slow * 2.0 + 0.7)
* Quaternion::rotation_z(1.7 - slow * 0.4 + fast * 0.6);
next.control.scale = Vec3::one();
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
footquick * -9.5,
skeleton_attr.foot.2,
);
next.foot_l.orientation = Quaternion::rotation_x(footquick * 0.3)
* Quaternion::rotation_y(footquick * -0.6);
next.foot_r.position =
Vec3::new(skeleton_attr.foot.0, footquick * 9.5, skeleton_attr.foot.2);
next.foot_r.orientation = Quaternion::rotation_x(footquick * -0.3)
* Quaternion::rotation_y(footquick * 0.2);
next.torso.position = Vec3::new(0.0, 0.0, 0.1) * skeleton_attr.scaler;
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
},
Some(ToolKind::Axe(_)) => {
next.head.position =
Vec3::new(0.0, -2.0 + skeleton_attr.head.0, skeleton_attr.head.1);
next.head.orientation = Quaternion::rotation_z(slow * -0.18)
* Quaternion::rotation_x(-0.1 + slow * -0.28)
* Quaternion::rotation_y(0.2 + slow * 0.18);
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
next.chest.position = Vec3::new(0.0 + foot * 2.0, 0.0, 7.0);
next.chest.orientation = Quaternion::rotation_z(slow * 0.2)
* Quaternion::rotation_x(slow * 0.2)
* Quaternion::rotation_y(slow * -0.1);
next.belt.position = Vec3::new(0.0, 0.0, -2.0);
next.belt.orientation = Quaternion::rotation_z(slow * 0.1)
* Quaternion::rotation_x(slow * 0.1)
* Quaternion::rotation_y(slow * -0.04);
next.shorts.position = Vec3::new(0.0, 0.0, -5.0);
next.shorts.orientation = Quaternion::rotation_z(slow * 0.1)
* Quaternion::rotation_x(slow * 0.1)
* Quaternion::rotation_y(slow * -0.05);
next.hand_l.position = Vec3::new(-0.75, -1.0, -2.5);
next.hand_l.orientation = Quaternion::rotation_x(1.27);
next.hand_l.scale = Vec3::one() * 1.04;
next.hand_r.position = Vec3::new(0.75, -1.5, -5.5);
next.hand_r.orientation = Quaternion::rotation_x(1.27);
next.hand_r.scale = Vec3::one() * 1.05;
next.main.position = Vec3::new(0.0, 6.0, -1.0);
next.main.orientation = Quaternion::rotation_x(-0.3);
next.control.position = Vec3::new(-8.0 + slow * 1.5, 1.5 + slow * 1.0, 0.0);
next.control.orientation = Quaternion::rotation_x(-1.4)
* Quaternion::rotation_y(slow * 2.0 + 0.7)
* Quaternion::rotation_z(1.7 - slow * 0.4 + fast * 0.6);
next.control.scale = Vec3::one();
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
footquick * -9.5,
skeleton_attr.foot.2,
);
next.foot_l.orientation = Quaternion::rotation_x(footquick * 0.3)
* Quaternion::rotation_y(footquick * -0.6);
next.foot_r.position =
Vec3::new(skeleton_attr.foot.0, footquick * 9.5, skeleton_attr.foot.2);
next.foot_r.orientation = Quaternion::rotation_x(footquick * -0.3)
* Quaternion::rotation_y(footquick * 0.2);
next.torso.position = Vec3::new(0.0, 0.0, 0.1) * skeleton_attr.scaler;
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
},
_ => {},
}
next.shoulder_l.position = Vec3::new(
-skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1,
skeleton_attr.shoulder.2,
);
next.shoulder_l.orientation = Quaternion::rotation_x(0.0);
next.shoulder_l.scale = Vec3::one() * 1.1;
next.shoulder_r.position = Vec3::new(
skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1,
skeleton_attr.shoulder.2,
);
next.shoulder_r.orientation = Quaternion::rotation_x(0.0);
next.shoulder_r.scale = Vec3::one() * 1.1;
next.glider.position = Vec3::new(0.0, 0.0, 10.0);
next.glider.scale = Vec3::one() * 0.0;
next.lantern.position = Vec3::new(
skeleton_attr.lantern.0,
skeleton_attr.lantern.1,
skeleton_attr.lantern.2,
);
next.lantern.orientation =
Quaternion::rotation_x(slow * -0.7 + 0.4) * Quaternion::rotation_y(slow * 0.4);
next.lantern.orientation = Quaternion::rotation_x(0.4);
next.lantern.scale = Vec3::one() * 0.65;
next.hold.scale = Vec3::one() * 0.0;
next.control_l.scale = Vec3::one();
next.control_r.scale = Vec3::one();
next.second.scale = match (
active_tool_kind.map(|tk| tk.hands()),
second_tool_kind.map(|tk| tk.hands()),

View File

@ -3,11 +3,8 @@ use super::{
CharacterSkeleton, SkeletonAttr,
};
use common::comp::item::{Hands, ToolKind};
use std::{f32::consts::PI, ops::Mul};
use std::ops::Mul;
pub struct Input {
pub attack: bool,
}
pub struct BlockAnimation;
impl Animation for BlockAnimation {
@ -27,11 +24,6 @@ impl Animation for BlockAnimation {
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let wave_ultra_slow = (anim_time as f32 * 3.0 + PI).sin();
let wave_ultra_slow_cos = (anim_time as f32 * 3.0 + PI).cos();
let wave_slow_cos = (anim_time as f32 * 6.0 + PI).cos();
let _wave_slow = (anim_time as f32 * 6.0 + PI).sin();
let _head_look = Vec2::new(
((global_time + anim_time) as f32 / 1.5)
.floor()
@ -45,157 +37,40 @@ impl Animation for BlockAnimation {
* 0.15,
);
next.head.position = Vec3::new(
0.0 + wave_slow_cos * 0.2,
0.0,
-1.0 + skeleton_attr.head.0,
skeleton_attr.head.1 + 19.5 + wave_ultra_slow * 0.2,
skeleton_attr.head.1 + 19.5,
);
next.head.orientation = Quaternion::rotation_x(-0.25);
next.head.scale = Vec3::one() * 1.01 * skeleton_attr.head_scale;
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
next.chest.position =
Vec3::new(0.0 + wave_slow_cos * 0.2, 0.0, 5.0 + wave_ultra_slow * 0.2);
next.chest.orientation =
Quaternion::rotation_x(-0.15) * Quaternion::rotation_y(wave_ultra_slow_cos * 0.01);
next.chest.scale = Vec3::one();
next.chest.position = Vec3::new(0.0, skeleton_attr.chest.0, skeleton_attr.chest.1);
next.belt.position = Vec3::new(0.0 + wave_slow_cos * 0.2, 0.0, 3.0 + wave_ultra_slow * 0.2);
next.belt.orientation =
Quaternion::rotation_x(0.0) * Quaternion::rotation_y(wave_ultra_slow_cos * 0.008);
next.belt.scale = Vec3::one() * 1.01;
next.belt.position = Vec3::new(0.0, skeleton_attr.belt.0, skeleton_attr.belt.1);
next.shorts.position =
Vec3::new(0.0 + wave_slow_cos * 0.2, 0.0, 1.0 + wave_ultra_slow * 0.2);
next.shorts.orientation = Quaternion::rotation_x(0.1);
next.shorts.scale = Vec3::one();
next.shorts.position = Vec3::new(0.0, skeleton_attr.shorts.0, skeleton_attr.shorts.1);
match active_tool_kind {
//TODO: Inventory
Some(ToolKind::Sword(_)) => {
next.hand_l.position = Vec3::new(0.0, -5.0, -5.0);
next.hand_l.orientation = Quaternion::rotation_x(1.27);
next.hand_l.scale = Vec3::one() * 1.04;
next.hand_r.position = Vec3::new(0.0, -6.0, -8.0);
next.hand_r.orientation = Quaternion::rotation_x(1.27);
next.hand_r.scale = Vec3::one() * 1.05;
next.main.position = Vec3::new(0.0, 0.0, -6.0);
next.main.orientation = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.main.scale = Vec3::one();
next.control.position = Vec3::new(-8.0, 13.0, 8.0);
next.control.orientation = Quaternion::rotation_x(0.2)
* Quaternion::rotation_y(0.4)
* Quaternion::rotation_z(-1.57);
next.control.scale = Vec3::one();
},
Some(ToolKind::Axe(_)) => {
next.hand_l.position = Vec3::new(
-6.0 + wave_ultra_slow_cos * 1.0,
3.5 + wave_ultra_slow_cos * 0.5,
0.0 + wave_ultra_slow * 1.0,
);
next.hand_l.orientation = Quaternion::rotation_x(-0.3);
next.hand_l.scale = Vec3::one() * 1.01;
next.hand_r.position = Vec3::new(
-6.0 + wave_ultra_slow_cos * 1.0,
3.0 + wave_ultra_slow_cos * 0.5,
-2.0 + wave_ultra_slow * 1.0,
);
next.hand_r.orientation = Quaternion::rotation_x(-0.3);
next.hand_r.scale = Vec3::one() * 1.01;
next.main.position = Vec3::new(-6.0, 4.5, 0.0 + wave_ultra_slow * 1.0);
next.main.orientation = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.main.scale = Vec3::one();
},
Some(ToolKind::Hammer(_)) => {
next.hand_l.position = Vec3::new(-7.0, 3.5, 6.5);
next.hand_l.orientation = Quaternion::rotation_x(2.07)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(-0.2);
next.hand_l.scale = Vec3::one() * 1.01;
next.hand_r.position = Vec3::new(7.0, 2.5, 3.75);
next.hand_r.orientation = Quaternion::rotation_x(2.07)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(-0.2);
next.hand_r.scale = Vec3::one() * 1.01;
next.main.position = Vec3::new(5.0, 8.75, 5.5);
next.main.orientation = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(-1.35)
* Quaternion::rotation_z(-0.85);
next.main.scale = Vec3::one();
},
Some(ToolKind::Staff(_)) | Some(ToolKind::Sceptre(_)) => {
next.hand_l.position = Vec3::new(
-6.0 + wave_ultra_slow_cos * 1.0,
3.5 + wave_ultra_slow_cos * 0.5,
0.0 + wave_ultra_slow * 1.0,
);
next.hand_l.orientation = Quaternion::rotation_x(-0.3);
next.hand_l.scale = Vec3::one() * 1.01;
next.hand_r.position = Vec3::new(
-6.0 + wave_ultra_slow_cos * 1.0,
3.0 + wave_ultra_slow_cos * 0.5,
-2.0 + wave_ultra_slow * 1.0,
);
next.hand_r.orientation = Quaternion::rotation_x(-0.3);
next.hand_r.scale = Vec3::one() * 1.01;
next.main.position = Vec3::new(
-6.0 + wave_ultra_slow_cos * 1.0,
4.5 + wave_ultra_slow_cos * 0.5,
0.0 + wave_ultra_slow * 1.0,
);
next.main.orientation = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.main.scale = Vec3::one();
},
Some(ToolKind::Shield(_)) => {
next.hand_l.position = Vec3::new(
-6.0 + wave_ultra_slow_cos * 1.0,
3.5 + wave_ultra_slow_cos * 0.5,
0.0 + wave_ultra_slow * 1.0,
skeleton_attr.hand.0 - 6.0,
skeleton_attr.hand.1 + 3.5,
skeleton_attr.hand.2 + 0.0,
);
next.hand_l.orientation = Quaternion::rotation_x(-0.3);
next.hand_l.scale = Vec3::one() * 1.01;
next.hand_r.position = Vec3::new(
-6.0 + wave_ultra_slow_cos * 1.0,
3.0 + wave_ultra_slow_cos * 0.5,
-2.0 + wave_ultra_slow * 1.0,
skeleton_attr.hand.0 - 6.0,
skeleton_attr.hand.1 + 3.0,
skeleton_attr.hand.2 - 2.0,
);
next.hand_r.orientation = Quaternion::rotation_x(-0.3);
next.hand_r.scale = Vec3::one() * 1.01;
next.main.position = Vec3::new(
-6.0 + wave_ultra_slow_cos * 1.0,
4.5 + wave_ultra_slow_cos * 0.5,
0.0 + wave_ultra_slow * 1.0,
);
next.main.orientation = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.main.scale = Vec3::one();
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_x(-0.3);
},
_ => {},
}
next.shoulder_l.position = Vec3::new(
-skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1,
skeleton_attr.shoulder.2,
);
next.shoulder_l.scale = Vec3::one() * 1.1;
next.shoulder_r.position = Vec3::new(
skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1,
skeleton_attr.shoulder.2,
);
next.shoulder_r.scale = Vec3::one() * 1.1;
next.glider.position = Vec3::new(0.0, 5.0, 0.0);
next.glider.orientation = Quaternion::rotation_y(0.0);
next.glider.position = Vec3::new(0.0, 0.0, 10.0);
next.glider.scale = Vec3::one() * 0.0;
next.lantern.position = Vec3::new(
@ -203,17 +78,10 @@ impl Animation for BlockAnimation {
skeleton_attr.lantern.1,
skeleton_attr.lantern.2,
);
next.lantern.orientation = Quaternion::rotation_x(0.0);
next.lantern.scale = Vec3::one() * 0.0;
next.lantern.scale = Vec3::one() * 0.65;
next.hold.scale = Vec3::one() * 0.0;
next.torso.position = Vec3::new(0.0, -0.2, 0.1) * skeleton_attr.scaler;
next.torso.orientation = Quaternion::rotation_x(0.0);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
next.control_l.scale = Vec3::one();
next.control_r.scale = Vec3::one();
next.second.scale = match (
active_tool_kind.map(|tk| tk.hands()),

View File

@ -1,320 +0,0 @@
use super::{
super::{vek::*, Animation},
CharacterSkeleton, SkeletonAttr,
};
use common::comp::item::{Hands, ToolKind};
use std::{f32::consts::PI, ops::Mul};
pub struct Input {
pub attack: bool,
}
pub struct BlockIdleAnimation;
impl Animation for BlockIdleAnimation {
type Dependency = (Option<ToolKind>, Option<ToolKind>, f64);
type Skeleton = CharacterSkeleton;
#[cfg(feature = "use-dyn-lib")]
const UPDATE_FN: &'static [u8] = b"character_blockidle\0";
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_blockidle")]
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(active_tool_kind, second_tool_kind, global_time): Self::Dependency,
anim_time: f64,
_rate: &mut f32,
skeleton_attr: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let wave_ultra_slow = (anim_time as f32 * 3.0 + PI).sin();
let wave_ultra_slow_cos = (anim_time as f32 * 3.0 + PI).cos();
let wave_slow_cos = (anim_time as f32 * 6.0 + PI).cos();
let _head_look = Vec2::new(
((global_time + anim_time) as f32 / 1.5)
.floor()
.mul(7331.0)
.sin()
* 0.3,
((global_time + anim_time) as f32 / 1.5)
.floor()
.mul(1337.0)
.sin()
* 0.15,
);
next.head.position = Vec3::new(
0.0 + wave_slow_cos * 0.2,
-1.0 + skeleton_attr.head.0,
skeleton_attr.head.1 + wave_ultra_slow * 0.2,
);
next.head.orientation = Quaternion::rotation_x(0.0);
next.head.scale = Vec3::one() * 1.01 * skeleton_attr.head_scale;
next.chest.position = Vec3::new(
0.0 + wave_slow_cos * 0.2,
0.0,
skeleton_attr.chest.1 + wave_ultra_slow * 0.2,
);
next.chest.orientation = Quaternion::rotation_y(wave_ultra_slow_cos * 0.01);
next.chest.scale = Vec3::one();
next.belt.position = Vec3::new(
0.0 + wave_slow_cos * 0.2,
0.0,
skeleton_attr.belt.1 + wave_ultra_slow * 0.2,
);
next.belt.orientation =
Quaternion::rotation_x(0.0) * Quaternion::rotation_y(wave_ultra_slow_cos * 0.008);
next.belt.scale = Vec3::one() * 1.01;
next.shorts.position = Vec3::new(
0.0 + wave_slow_cos * 0.2,
0.0,
skeleton_attr.shorts.1 + wave_ultra_slow * 0.2,
);
next.shorts.orientation = Quaternion::rotation_x(0.1);
next.shorts.scale = Vec3::one();
match active_tool_kind {
Some(ToolKind::Sword(_)) => {
next.hand_l.position = Vec3::new(0.0, -5.0, -5.0);
next.hand_l.orientation = Quaternion::rotation_x(1.27);
next.hand_l.scale = Vec3::one() * 1.04;
next.hand_r.position = Vec3::new(0.0, -6.0, -8.0);
next.hand_r.orientation = Quaternion::rotation_x(1.27);
next.hand_r.scale = Vec3::one() * 1.05;
next.main.position = Vec3::new(0.0, 0.0, -6.0);
next.main.orientation = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.main.scale = Vec3::one();
next.control.position = Vec3::new(-8.0, 13.0, 8.0);
next.control.orientation = Quaternion::rotation_x(0.2)
* Quaternion::rotation_y(0.4)
* Quaternion::rotation_z(-1.57);
next.control.scale = Vec3::one();
},
Some(ToolKind::Axe(_)) => {
next.hand_l.position = Vec3::new(
-6.0 + wave_ultra_slow_cos * 1.0,
3.5 + wave_ultra_slow_cos * 0.5,
0.0 + wave_ultra_slow * 1.0,
);
next.hand_l.orientation = Quaternion::rotation_x(-0.3);
next.hand_l.scale = Vec3::one() * 1.01;
next.hand_r.position = Vec3::new(
-6.0 + wave_ultra_slow_cos * 1.0,
3.0 + wave_ultra_slow_cos * 0.5,
-2.0 + wave_ultra_slow * 1.0,
);
next.hand_r.orientation = Quaternion::rotation_x(-0.3);
next.hand_r.scale = Vec3::one() * 1.01;
next.main.position = Vec3::new(-6.0, 4.5, 0.0 + wave_ultra_slow * 1.0);
next.main.orientation = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.main.scale = Vec3::one();
},
Some(ToolKind::Hammer(_)) => {
next.hand_l.position = Vec3::new(-7.0, 3.5 + wave_ultra_slow * 2.0, 6.5);
next.hand_l.orientation = Quaternion::rotation_x(2.07)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(-0.2);
next.hand_l.scale = Vec3::one() * 1.01;
next.hand_r.position = Vec3::new(7.0, 2.5 + wave_ultra_slow * 2.0, 3.75);
next.hand_r.orientation = Quaternion::rotation_x(2.07)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(-0.2);
next.hand_r.scale = Vec3::one() * 1.01;
next.main.position = Vec3::new(5.0, 8.75 + wave_ultra_slow * 2.0, 5.5);
next.main.orientation = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(-1.35)
* Quaternion::rotation_z(-0.85);
next.main.scale = Vec3::one();
},
Some(ToolKind::Dagger(_)) => {
let hand_scale = 1.12;
next.control.position = Vec3::new(0.0, 0.0, 0.0);
next.hand_l.position = Vec3::new(0.0, 0.0, 0.0);
next.hand_l.orientation = Quaternion::rotation_x(0.0 * PI)
* Quaternion::rotation_y(0.0 * PI)
* Quaternion::rotation_z(0.0 * PI);
next.hand_l.scale = Vec3::one() * hand_scale;
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_x(0.0 * PI)
* Quaternion::rotation_y(0.0 * PI)
* Quaternion::rotation_z(0.0 * PI);
next.main.scale = Vec3::one();
next.control_l.position = Vec3::new(-7.0, 0.0, 0.0);
// next.control_l.orientation = Quaternion::rotation_x(u_slow * 0.15 + 1.0)
// * Quaternion::rotation_y(0.0)
// * Quaternion::rotation_z(u_slowalt * 0.08);
// next.control_l.scale = Vec3::one();
next.hand_r.position = Vec3::new(0.0, 0.0, 0.0);
next.hand_r.orientation = Quaternion::rotation_x(0.0 * PI)
* Quaternion::rotation_y(0.0 * PI)
* Quaternion::rotation_z(0.0 * PI);
next.hand_r.scale = Vec3::one() * hand_scale;
next.second.position = Vec3::new(0.0, 0.0, 0.0);
next.second.orientation = Quaternion::rotation_x(0.0 * PI)
* Quaternion::rotation_y(0.0 * PI)
* Quaternion::rotation_z(0.0 * PI);
next.second.scale = Vec3::one();
next.control_r.position = Vec3::new(7.0, 0.0, 0.0);
},
Some(ToolKind::Shield(_)) => {
let hand_scale = 1.12;
next.control.position = Vec3::new(0.0, 0.0, 0.0);
next.hand_l.position = Vec3::new(0.0, 0.0, 0.0);
next.hand_l.orientation = Quaternion::rotation_x(0.0 * PI)
* Quaternion::rotation_y(0.0 * PI)
* Quaternion::rotation_z(0.0 * PI);
next.hand_l.scale = Vec3::one() * hand_scale;
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_x(0.0 * PI)
* Quaternion::rotation_y(0.0 * PI)
* Quaternion::rotation_z(0.0 * PI);
next.control_l.position = Vec3::new(-7.0, 0.0, 0.0);
next.hand_r.position = Vec3::new(0.0, 0.0, 0.0);
next.hand_r.orientation = Quaternion::rotation_x(0.0 * PI)
* Quaternion::rotation_y(0.0 * PI)
* Quaternion::rotation_z(0.0 * PI);
next.hand_r.scale = Vec3::one() * hand_scale;
next.second.position = Vec3::new(0.0, 0.0, 0.0);
next.second.orientation = Quaternion::rotation_x(0.0 * PI)
* Quaternion::rotation_y(0.0 * PI)
* Quaternion::rotation_z(0.0 * PI);
next.second.scale = Vec3::one();
next.control_r.position = Vec3::new(7.0, 0.0, 0.0);
},
Some(ToolKind::Debug(_)) => {
next.hand_l.position = Vec3::new(-7.0, 3.5 + wave_ultra_slow * 2.0, 6.5);
next.hand_l.orientation = Quaternion::rotation_x(2.07)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(-0.2);
next.hand_l.scale = Vec3::one() * 1.01;
next.hand_r.position = Vec3::new(7.0, 2.5 + wave_ultra_slow * 2.0, 3.75);
next.hand_r.orientation = Quaternion::rotation_x(2.07)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(-0.2);
next.hand_r.scale = Vec3::one() * 1.01;
next.main.position = Vec3::new(5.0, 8.75 + wave_ultra_slow * 2.0, 5.5);
next.main.orientation = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(-1.35)
* Quaternion::rotation_z(-0.85);
next.main.scale = Vec3::one();
},
_ => {},
}
match second_tool_kind {
Some(ToolKind::Shield(_)) => {
let hand_scale = 1.12;
next.control.position = Vec3::new(0.0, 0.0, 0.0);
next.hand_l.position = Vec3::new(0.0, 0.0, 0.0);
next.hand_l.orientation = Quaternion::rotation_x(0.0 * PI)
* Quaternion::rotation_y(0.0 * PI)
* Quaternion::rotation_z(0.0 * PI);
next.hand_l.scale = Vec3::one() * hand_scale;
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_x(0.0 * PI)
* Quaternion::rotation_y(0.0 * PI)
* Quaternion::rotation_z(0.0 * PI);
next.main.scale = Vec3::one();
next.control_l.position = Vec3::new(-7.0, 0.0, 0.0);
next.hand_r.position = Vec3::new(0.0, 0.0, 0.0);
next.hand_r.orientation = Quaternion::rotation_x(0.0 * PI)
* Quaternion::rotation_y(0.0 * PI)
* Quaternion::rotation_z(0.0 * PI);
next.hand_r.scale = Vec3::one() * hand_scale;
next.second.position = Vec3::new(0.0, 0.0, 0.0);
next.second.orientation = Quaternion::rotation_x(0.0 * PI)
* Quaternion::rotation_y(0.0 * PI)
* Quaternion::rotation_z(0.0 * PI);
next.second.scale = Vec3::one();
next.control_r.position = Vec3::new(3.0, 7.0, 5.0);
next.control_r.orientation = Quaternion::rotation_x(0.5 * PI)
* Quaternion::rotation_y(0.5 * PI)
* Quaternion::rotation_z(0.0 * PI);
},
Some(ToolKind::Dagger(_)) => {},
_ => {},
}
next.foot_l.position =
Vec3::new(-3.4, 0.3, skeleton_attr.foot.1 + wave_ultra_slow_cos * 0.1);
next.foot_l.orientation = Quaternion::rotation_x(-0.3);
next.foot_l.scale = Vec3::one();
next.foot_r.position = Vec3::new(3.4, 1.2, skeleton_attr.foot.1 + wave_ultra_slow * 0.1);
next.foot_r.orientation = Quaternion::rotation_x(0.3);
next.foot_r.scale = Vec3::one();
next.shoulder_l.position = Vec3::new(
-skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1,
skeleton_attr.shoulder.2,
);
next.shoulder_l.scale = Vec3::one() * 1.1;
next.shoulder_r.position = Vec3::new(
skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1,
skeleton_attr.shoulder.2,
);
next.shoulder_r.scale = Vec3::one() * 1.1;
next.glider.position = Vec3::new(0.0, 0.0, 10.0);
next.glider.scale = Vec3::one() * 0.0;
next.lantern.position = Vec3::new(
skeleton_attr.lantern.0,
skeleton_attr.lantern.1,
skeleton_attr.lantern.2,
);
next.lantern.orientation = Quaternion::rotation_x(0.0);
next.lantern.scale = Vec3::one();
next.hold.scale = Vec3::one() * 0.0;
next.torso.position = Vec3::new(0.0, -0.2, 0.1) * skeleton_attr.scaler;
next.torso.orientation = Quaternion::rotation_x(0.0);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
next.control.scale = Vec3::one();
next.control_l.scale = Vec3::one();
next.control_r.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
}
}

View File

@ -78,7 +78,7 @@ impl Animation for ChargeAnimation {
next.head.position = Vec3::new(
stop * -2.0,
-3.5 + stop * 2.5 + skeleton_attr.head.0,
-1.5 + stop * 2.5 + skeleton_attr.head.0,
skeleton_attr.head.1,
);
next.head.orientation =
@ -100,11 +100,9 @@ impl Animation for ChargeAnimation {
Some(ToolKind::Staff(_)) | Some(ToolKind::Sceptre(_)) => {
next.hand_l.position = Vec3::new(11.0, 5.0, -4.0);
next.hand_l.orientation = Quaternion::rotation_x(1.27);
next.hand_l.scale = Vec3::one() * 1.05;
next.hand_r.position = Vec3::new(12.0, 5.5, 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(12.0, 8.5, 13.2);
next.main.orientation = Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(3.14)
@ -117,19 +115,16 @@ impl Animation for ChargeAnimation {
);
next.control.orientation =
Quaternion::rotation_x(stop * -0.2) * Quaternion::rotation_z(stop * 0.2);
next.control.scale = Vec3::one();
},
Some(ToolKind::Bow(_)) => {
next.hand_l.position = Vec3::new(1.0, -2.0 + stop * -1.0, 0.0);
next.hand_l.orientation = Quaternion::rotation_x(1.20)
* Quaternion::rotation_y(-0.6)
* Quaternion::rotation_z(-0.3);
next.hand_l.scale = Vec3::one() * 1.05;
next.hand_r.position = Vec3::new(4.9, 1.0, -5.0);
next.hand_r.orientation = Quaternion::rotation_x(1.20)
* Quaternion::rotation_y(-0.6)
* Quaternion::rotation_z(-0.3);
next.hand_r.scale = Vec3::one() * 1.05;
next.main.position = Vec3::new(3.0, -1.0, -14.0);
next.main.orientation = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(0.3)
@ -145,19 +140,16 @@ impl Animation for ChargeAnimation {
next.control.orientation = Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(stop * -0.4)
* Quaternion::rotation_z(stop * -0.6);
next.control.scale = Vec3::one();
},
Some(ToolKind::Hammer(_)) => {
next.hand_l.position = Vec3::new(-8.0, -2.0 + stop * -1.0, 13.0);
next.hand_l.orientation = Quaternion::rotation_x(2.1)
* Quaternion::rotation_y(0.7)
* Quaternion::rotation_z(-0.3);
next.hand_l.scale = Vec3::one() * 1.05;
next.hand_r.position = Vec3::new(-11.0, 2.0, 6.0);
next.hand_r.orientation = Quaternion::rotation_x(1.8)
* Quaternion::rotation_y(2.3)
* Quaternion::rotation_z(0.3);
next.hand_r.scale = Vec3::one() * 1.05;
next.main.position = Vec3::new(-12.0, 1.0, 4.0);
next.main.orientation = Quaternion::rotation_x(0.3)
* Quaternion::rotation_y(0.3)
@ -184,10 +176,6 @@ impl Animation for ChargeAnimation {
next.foot_r.orientation = Quaternion::rotation_x(0.0)
* Quaternion::rotation_z(0.4)
* Quaternion::rotation_y(0.0);
next.torso.position = Vec3::new(0.0, 0.0, 0.1) * skeleton_attr.scaler;
next.torso.orientation = Quaternion::rotation_z(0.0);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
} else {
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
@ -206,44 +194,15 @@ impl Animation for ChargeAnimation {
);
next.foot_r.orientation =
Quaternion::rotation_x(stop * 0.1) * Quaternion::rotation_z(stop * 0.1);
next.torso.position = Vec3::new(0.0, 0.0, 0.1) * skeleton_attr.scaler;
next.torso.orientation = Quaternion::rotation_z(0.0);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
}
next.back.position = Vec3::new(0.0, skeleton_attr.back.0, skeleton_attr.back.1);
next.back.orientation = Quaternion::rotation_x(-0.3);
next.back.scale = Vec3::one() * 1.02;
next.shoulder_l.position = Vec3::new(
-skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1,
skeleton_attr.shoulder.2,
);
next.shoulder_l.scale = Vec3::one() * 1.1;
next.shoulder_r.position = Vec3::new(
skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1,
skeleton_attr.shoulder.2,
);
next.shoulder_r.scale = Vec3::one() * 1.1;
next.glider.position = Vec3::new(0.0, 0.0, 10.0);
next.glider.scale = Vec3::one() * 0.0;
next.lantern.position = Vec3::new(
skeleton_attr.lantern.0,
skeleton_attr.lantern.1,
skeleton_attr.lantern.2,
);
next.lantern.orientation = Quaternion::rotation_x(0.1) * Quaternion::rotation_y(0.1);
next.lantern.scale = Vec3::one() * 0.65;
next.control_l.scale = Vec3::one();
next.control_r.scale = Vec3::one();
next.second.scale = match (
active_tool_kind.map(|tk| tk.hands()),
second_tool_kind.map(|tk| tk.hands()),

View File

@ -67,10 +67,8 @@ impl Animation for ChargeswingAnimation {
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(-0.0) * 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(0.0) * Quaternion::rotation_y(0.0);
next.hand_r.scale = Vec3::one() * 1.06;
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_y(-1.57) * Quaternion::rotation_z(1.57);
@ -78,7 +76,6 @@ impl Animation for ChargeswingAnimation {
next.control.orientation = Quaternion::rotation_x(0.3)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.control.scale = Vec3::one();
if let Some(stage_section) = stage_section {
match stage_section {
StageSection::Charge => {
@ -130,7 +127,6 @@ impl Animation for ChargeswingAnimation {
next.foot_l.orientation =
Quaternion::rotation_x(-0.4 + footrotl * -0.2)
* Quaternion::rotation_z((movement * 0.5).min(0.5));
next.foot_l.scale = Vec3::one();
next.foot_r.orientation =
Quaternion::rotation_x(-0.4 + footrotr * -0.2)
@ -186,10 +182,6 @@ impl Animation for ChargeswingAnimation {
(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

@ -63,8 +63,6 @@ impl Animation for ClimbAnimation {
);
let stagnant = if speed > -0.7 { 1.0 } else { 0.0 }; //sets static position when there is no movement
next.hold.scale = Vec3::one() * 0.0;
if speed > 0.7 || lateral > 0.1 {
next.head.position = Vec3::new(
0.0,
@ -74,7 +72,6 @@ impl Animation for ClimbAnimation {
next.head.orientation = Quaternion::rotation_z(smooth * 0.1)
* Quaternion::rotation_x(0.6)
* Quaternion::rotation_y(quick * 0.1);
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
next.chest.position = Vec3::new(
0.0,
@ -84,23 +81,16 @@ impl Animation for ClimbAnimation {
next.chest.orientation = Quaternion::rotation_z(quick * 0.25)
* Quaternion::rotation_x(-0.15)
* Quaternion::rotation_y(quick * -0.12);
next.chest.scale = Vec3::one();
next.belt.position = Vec3::new(0.0, skeleton_attr.belt.0 + 1.0, skeleton_attr.belt.1);
next.belt.orientation =
Quaternion::rotation_z(quick * 0.0) * Quaternion::rotation_x(0.0);
next.belt.scale = Vec3::one();
next.back.position = Vec3::new(0.0, skeleton_attr.back.0, skeleton_attr.back.1);
next.back.orientation = Quaternion::rotation_x(-0.2);
next.back.scale = Vec3::one() * 1.02;
next.shorts.position =
Vec3::new(0.0, skeleton_attr.shorts.0 + 1.0, skeleton_attr.shorts.1);
next.shorts.orientation = Quaternion::rotation_z(quick * 0.0)
* Quaternion::rotation_x(0.1)
* Quaternion::rotation_y(quick * 0.10);
next.shorts.scale = Vec3::one();
next.hand_l.position = Vec3::new(
-skeleton_attr.hand.0,
@ -108,7 +98,6 @@ impl Animation for ClimbAnimation {
5.0 + skeleton_attr.hand.2 - quick * 4.0,
);
next.hand_l.orientation = Quaternion::rotation_x(2.2 + quicka * 0.5);
next.hand_l.scale = Vec3::one();
next.hand_r.position = Vec3::new(
skeleton_attr.hand.0,
@ -116,7 +105,6 @@ impl Animation for ClimbAnimation {
5.0 + skeleton_attr.hand.2 + quick * 4.0,
);
next.hand_r.orientation = Quaternion::rotation_x(2.2 - quicka * 0.5);
next.hand_r.scale = Vec3::one();
match active_tool_kind {
Some(ToolKind::Dagger(_)) => {
@ -135,8 +123,6 @@ impl Animation for ClimbAnimation {
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
},
}
next.main.scale = Vec3::one();
match second_tool_kind {
Some(ToolKind::Dagger(_)) => {
next.second.position = Vec3::new(4.0, -6.0, 7.0);
@ -154,14 +140,12 @@ impl Animation for ClimbAnimation {
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
},
}
next.second.scale = Vec3::one();
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
5.0 + skeleton_attr.foot.1,
skeleton_attr.foot.2 + quick * 2.5,
);
next.foot_l.orientation = Quaternion::rotation_x(0.2 - quicka * 0.5);
next.foot_l.scale = Vec3::one();
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
@ -169,23 +153,10 @@ impl Animation for ClimbAnimation {
skeleton_attr.foot.2 - quick * 2.5,
);
next.foot_r.orientation = Quaternion::rotation_x(0.2 + quicka * 0.5);
next.foot_r.scale = Vec3::one();
next.shoulder_l.position = Vec3::new(
-skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1,
skeleton_attr.shoulder.2,
);
next.shoulder_l.orientation = Quaternion::rotation_x(smootha * 0.15);
next.shoulder_l.scale = Vec3::one() * 1.1;
next.shoulder_r.position = Vec3::new(
skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1,
skeleton_attr.shoulder.2,
);
next.shoulder_r.orientation = Quaternion::rotation_x(smooth * 0.15);
next.shoulder_r.scale = Vec3::one() * 1.1;
next.glider.position = Vec3::new(0.0, 0.0, 10.0);
next.glider.scale = Vec3::one() * 0.0;
@ -193,24 +164,14 @@ impl Animation for ClimbAnimation {
next.main.position = Vec3::new(-7.0, -5.0, 18.0);
next.main.orientation =
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57 + smootha * 0.25);
next.main.scale = Vec3::one();
next.second.position = Vec3::new(0.0, 0.0, 0.0);
next.second.orientation = Quaternion::rotation_y(0.0);
next.second.scale = Vec3::one() * 0.0;
next.lantern.position = Vec3::new(
skeleton_attr.lantern.0,
skeleton_attr.lantern.1,
skeleton_attr.lantern.2,
);
next.lantern.orientation =
Quaternion::rotation_x(smooth * -0.3) * Quaternion::rotation_y(smooth * -0.3);
next.lantern.scale = Vec3::one() * 0.65;
next.torso.position = Vec3::new(0.0, -0.2 + smooth * -0.08, 0.4) * skeleton_attr.scaler;
next.torso.orientation = Quaternion::rotation_x(0.0) * Quaternion::rotation_y(0.0);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
} else {
next.head.position = Vec3::new(
0.0,
@ -220,28 +181,22 @@ impl Animation for ClimbAnimation {
next.head.orientation = Quaternion::rotation_x(
-0.25 * (1.0 - stagnant) + stagnant * 2.0 * head_look.x.abs(),
) * Quaternion::rotation_z(stagnant * 3.5 * head_look.x.abs());
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
next.chest.position =
Vec3::new(0.0, 1.0 + skeleton_attr.chest.0, skeleton_attr.chest.1);
next.chest.orientation = Quaternion::rotation_z(0.6 * stagnant)
* Quaternion::rotation_x((0.2 + drop * 0.05) * (1.0 - stagnant));
next.chest.scale = Vec3::one();
next.belt.position = Vec3::new(0.0, skeleton_attr.belt.0 + 0.5, skeleton_attr.belt.1);
next.belt.orientation = Quaternion::rotation_x(0.1 + dropa * 0.1);
next.belt.scale = Vec3::one();
next.back.position = Vec3::new(0.0, skeleton_attr.back.0, skeleton_attr.back.1);
next.back.orientation = Quaternion::rotation_x(
-0.2 + dropa * 0.1 - 0.15 * (1.0 - stagnant) + stagnant * 0.1,
);
next.back.scale = Vec3::one() * 1.02;
next.shorts.position =
Vec3::new(0.0, skeleton_attr.shorts.0 + 1.0, skeleton_attr.shorts.1);
next.shorts.orientation = Quaternion::rotation_x(0.1 + dropa * 0.12 * (1.0 - stagnant));
next.shorts.scale = Vec3::one();
next.hand_l.position = Vec3::new(
-skeleton_attr.hand.0,
@ -250,7 +205,6 @@ impl Animation for ClimbAnimation {
);
next.hand_l.orientation = Quaternion::rotation_x(2.2 + stagnant * -1.4)
* Quaternion::rotation_y((0.3 + dropa * 0.1) * (1.0 - stagnant));
next.hand_l.scale = Vec3::one();
next.hand_r.position = Vec3::new(
skeleton_attr.hand.0,
@ -259,7 +213,6 @@ impl Animation for ClimbAnimation {
);
next.hand_r.orientation = Quaternion::rotation_x(2.2)
* Quaternion::rotation_y(-0.3 + drop * 0.1 * (1.0 - stagnant));
next.hand_r.scale = Vec3::one();
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
@ -267,7 +220,6 @@ impl Animation for ClimbAnimation {
1.0 + skeleton_attr.foot.2 + drop * -2.0 * (1.0 - stagnant),
);
next.foot_l.orientation = Quaternion::rotation_x(0.55 + drop * 0.1 * (1.0 - stagnant));
next.foot_l.scale = Vec3::one();
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
@ -276,50 +228,15 @@ impl Animation for ClimbAnimation {
);
next.foot_r.orientation =
Quaternion::rotation_x(0.2 + smooth * 0.15 * (1.0 - stagnant));
next.foot_r.scale = Vec3::one();
next.shoulder_l.position = Vec3::new(
-skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1,
skeleton_attr.shoulder.2,
);
next.shoulder_l.orientation = Quaternion::rotation_x(0.0);
next.shoulder_l.scale = Vec3::one() * 1.1;
next.shoulder_r.position = Vec3::new(
skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1,
skeleton_attr.shoulder.2,
);
next.shoulder_r.orientation = Quaternion::rotation_x(0.0);
next.shoulder_r.scale = Vec3::one() * 1.1;
next.glider.position = Vec3::new(0.0, 0.0, 10.0);
next.glider.scale = Vec3::one() * 0.0;
next.main.position = Vec3::new(-7.0, -5.0, 18.0);
next.main.orientation = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
next.main.scale = Vec3::one();
next.second.position = Vec3::new(0.0, 0.0, 0.0);
next.second.orientation = Quaternion::rotation_y(0.0);
next.second.scale = Vec3::one() * 0.0;
next.lantern.position = Vec3::new(
skeleton_attr.lantern.0,
skeleton_attr.lantern.1,
skeleton_attr.lantern.2,
);
next.lantern.orientation = Quaternion::rotation_x(0.0);
next.lantern.scale = Vec3::one() * 0.65;
next.torso.position = Vec3::new(0.0, -0.2, 0.4) * skeleton_attr.scaler;
next.torso.orientation = Quaternion::rotation_x(0.0);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
};
next.control.scale = Vec3::one();
next.control_r.scale = Vec3::one();
next.control_l.scale = Vec3::one();
next.second.scale = match (
active_tool_kind.map(|tk| tk.hands()),

View File

@ -3,7 +3,7 @@ use super::{
CharacterSkeleton, SkeletonAttr,
};
use common::comp::item::{Hands, ToolKind};
use std::{f32::consts::PI, ops::Mul};
use std::f32::consts::PI;
pub struct GlideWieldAnimation;
@ -27,7 +27,7 @@ impl Animation for GlideWieldAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(active_tool_kind, second_tool_kind, velocity, orientation, last_ori, global_time): Self::Dependency,
(active_tool_kind, second_tool_kind, velocity, _orientation, _last_ori, _global_time): Self::Dependency,
anim_time: f64,
rate: &mut f32,
skeleton_attr: &SkeletonAttr,
@ -35,80 +35,13 @@ impl Animation for GlideWieldAnimation {
let mut next = (*skeleton).clone();
let speed = Vec2::<f32>::from(velocity).magnitude();
*rate = 1.0;
let slow = (anim_time as f32 * 1.0).sin();
let breathe = ((anim_time as f32 * 0.5).sin()).abs();
let walkintensity = if speed > 5.0 { 1.0 } else { 0.45 };
let walk = if speed > 5.0 { 1.0 } else { 0.5 };
let lower = if speed > 5.0 { 0.0 } else { 1.0 };
let _snapfoot = if speed > 5.0 { 1.1 } else { 2.0 };
let lab = 1.0;
let foothoril = (anim_time as f32 * 16.0 * walk * lab as f32 + PI * 1.45).sin();
let foothorir = (anim_time as f32 * 16.0 * walk * lab as f32 + PI * (0.45)).sin();
let footvertl = (anim_time as f32 * 16.0 * walk * lab as f32).sin();
let footvertr = (anim_time as f32 * 16.0 * walk * lab as f32 + PI).sin();
let footrotl = (((5.0)
/ (2.5
+ (2.5)
* ((anim_time as f32 * 16.0 * walk * lab as f32 + PI * 1.4).sin())
.powf(2.0 as f32)))
.sqrt())
* ((anim_time as f32 * 16.0 * walk * lab as f32 + PI * 1.4).sin());
let footrotr = (((5.0)
/ (1.0
+ (4.0)
* ((anim_time as f32 * 16.0 * walk * lab as f32 + PI * 0.4).sin())
.powf(2.0 as f32)))
.sqrt())
* ((anim_time as f32 * 16.0 * walk * lab as f32 + PI * 0.4).sin());
let short = (((5.0)
/ (1.5
+ 3.5 * ((anim_time as f32 * lab as f32 * 16.0 * walk).sin()).powf(2.0 as f32)))
.sqrt())
* ((anim_time as f32 * lab as f32 * 16.0 * walk).sin());
let noisea = (anim_time as f32 * 11.0 + PI / 6.0).sin();
let noiseb = (anim_time as f32 * 19.0 + PI / 4.0).sin();
let shorte = (((5.0)
/ (4.0
+ 1.0 * ((anim_time as f32 * lab as f32 * 16.0 * walk).sin()).powf(2.0 as f32)))
/ (4.0 + 1.0 * ((anim_time as f32 * lab as f32 * 16.0).sin()).powf(2.0 as f32)))
.sqrt())
* ((anim_time as f32 * lab as f32 * 16.0 * walk).sin());
let shortalt = (anim_time as f32 * lab as f32 * 16.0 * walk + PI / 2.0).sin();
let shortalter = (anim_time as f32 * lab as f32 * 16.0 * walk + PI / -2.0).sin();
let wave_stop = (anim_time as f32 * 26.0).min(PI / 2.0 / 2.0).sin();
let head_look = Vec2::new(
((global_time + anim_time) as f32 / 18.0)
.floor()
.mul(7331.0)
.sin()
* 0.2,
((global_time + anim_time) as f32 / 18.0)
.floor()
.mul(1337.0)
.sin()
* 0.1,
);
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;
* ((anim_time as f32 * lab as f32 * 16.0).sin());
next.hand_l.position = Vec3::new(
-2.0 - skeleton_attr.hand.0,
@ -127,103 +60,10 @@ impl Animation for GlideWieldAnimation {
next.hand_r.scale = Vec3::one();
if speed > 0.5 {
next.head.position = Vec3::new(
0.0,
-3.0 + skeleton_attr.head.0,
skeleton_attr.head.1 + short * 0.1,
);
next.head.orientation =
Quaternion::rotation_z(tilt * -2.5 + head_look.x * 0.2 - short * 0.1)
* Quaternion::rotation_x(head_look.y + 0.45 - lower * 0.35);
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
next.chest.position = Vec3::new(
0.0,
skeleton_attr.chest.0,
skeleton_attr.chest.1 + 2.0 + shortalt * -1.5 - lower,
);
next.chest.orientation =
Quaternion::rotation_z(short * 0.10 * walkintensity + tilt * -1.0)
* Quaternion::rotation_y(tilt * 2.2)
* Quaternion::rotation_x(
shortalter * 0.035 + wave_stop * speed * -0.1 + (tilt.abs()),
);
next.chest.scale = Vec3::one();
next.belt.position = Vec3::new(0.0, skeleton_attr.belt.0, skeleton_attr.belt.1);
next.belt.orientation = Quaternion::rotation_z(short * 0.1 + tilt * -1.1)
* Quaternion::rotation_y(tilt * 0.5);
next.belt.scale = Vec3::one();
next.glider.orientation = Quaternion::rotation_x(0.8);
next.glider.position = Vec3::new(0.0, -10.0, 15.0);
next.glider.scale = Vec3::one() * 1.0;
next.back.position = Vec3::new(0.0, skeleton_attr.back.0, skeleton_attr.back.1);
next.back.orientation =
Quaternion::rotation_x(-0.25 + short * 0.1 + noisea * 0.1 + noiseb * 0.1);
next.back.scale = Vec3::one() * 1.02;
next.shorts.position = Vec3::new(0.0, skeleton_attr.shorts.0, skeleton_attr.shorts.1);
next.shorts.orientation = Quaternion::rotation_z(short * 0.25 + tilt * -1.5)
* Quaternion::rotation_y(tilt * 0.7);
next.shorts.scale = Vec3::one();
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
-1.5 + skeleton_attr.foot.1 + foothoril * -8.5 * walkintensity - lower * 1.0,
2.0 + skeleton_attr.foot.2 + ((footvertl * -2.7).max(-1.0)) * walkintensity,
);
next.foot_l.orientation =
Quaternion::rotation_x(-0.2 + footrotl * -1.2 * walkintensity)
* Quaternion::rotation_y(tilt * 1.8);
next.foot_l.scale = Vec3::one();
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
-1.5 + skeleton_attr.foot.1 + foothorir * -8.5 * walkintensity - lower * 1.0,
2.0 + skeleton_attr.foot.2 + ((footvertr * -2.7).max(-1.0)) * walkintensity,
);
next.foot_r.orientation =
Quaternion::rotation_x(-0.2 + footrotr * -1.2 * walkintensity)
* Quaternion::rotation_y(tilt * 1.8);
next.foot_r.scale = Vec3::one();
next.shoulder_l.position = Vec3::new(
-skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1,
skeleton_attr.shoulder.2,
);
next.shoulder_l.orientation = Quaternion::rotation_x(short * 0.15 * walkintensity);
next.shoulder_l.scale = Vec3::one() * 1.1;
next.shoulder_r.position = Vec3::new(
skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1,
skeleton_attr.shoulder.2,
);
next.shoulder_r.orientation = Quaternion::rotation_x(short * -0.15 * walkintensity);
next.shoulder_r.scale = Vec3::one() * 1.1;
match active_tool_kind {
Some(ToolKind::Dagger(_)) => {
next.main.position = Vec3::new(-4.0, -5.0, 7.0);
next.main.orientation =
Quaternion::rotation_y(0.25 * PI) * Quaternion::rotation_z(1.5 * PI);
},
Some(ToolKind::Shield(_)) => {
next.main.position = Vec3::new(-0.0, -5.0, 3.0);
next.main.orientation =
Quaternion::rotation_y(0.25 * PI) * Quaternion::rotation_z(-1.5 * PI);
},
_ => {
next.main.position = Vec3::new(-7.0, -5.0, 15.0);
next.main.orientation =
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
},
}
next.main.scale = Vec3::one();
match second_tool_kind {
Some(ToolKind::Dagger(_)) => {
next.second.position = Vec3::new(4.0, -6.0, 7.0);
@ -241,90 +81,13 @@ impl Animation for GlideWieldAnimation {
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
},
}
next.second.scale = Vec3::one();
next.lantern.position = Vec3::new(
skeleton_attr.lantern.0,
skeleton_attr.lantern.1,
skeleton_attr.lantern.2,
);
next.lantern.orientation =
Quaternion::rotation_x(shorte * 0.7 + 0.4) * Quaternion::rotation_y(shorte * 0.4);
next.lantern.scale = Vec3::one() * 0.65;
next.hold.scale = Vec3::one() * 0.0;
next.torso.position = Vec3::new(0.0, 0.0, 0.0) * skeleton_attr.scaler;
next.torso.orientation = Quaternion::rotation_y(0.0);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
next.control.position = Vec3::new(0.0, 0.0, 0.0);
next.control.orientation = Quaternion::rotation_x(0.0);
next.control.scale = Vec3::one();
next.control_l.scale = Vec3::one();
next.control_r.scale = Vec3::one();
} else {
next.head.position = Vec3::new(
0.0,
-3.0 + skeleton_attr.head.0,
skeleton_attr.head.1 + slow * 0.3 + breathe * -0.05,
);
next.head.orientation =
Quaternion::rotation_z(head_look.x) * Quaternion::rotation_x(head_look.y.abs());
next.head.scale = Vec3::one() * skeleton_attr.head_scale + breathe * -0.05;
next.chest.position = Vec3::new(
0.0,
skeleton_attr.chest.0,
skeleton_attr.chest.1 + slow * 0.3,
);
next.chest.orientation = Quaternion::rotation_z(head_look.x * 0.6);
next.chest.scale = Vec3::one() * 1.01 + breathe * 0.03;
next.belt.position = Vec3::new(0.0, skeleton_attr.belt.0, skeleton_attr.belt.1);
next.belt.orientation = Quaternion::rotation_z(head_look.x * -0.1);
next.belt.scale = Vec3::one() + breathe * -0.03;
next.glider.orientation = Quaternion::rotation_x(0.35);
next.glider.position = Vec3::new(0.0, -9.0, 17.0);
next.glider.scale = Vec3::one() * 1.0;
next.back.position = Vec3::new(0.0, skeleton_attr.back.0, skeleton_attr.back.1);
next.back.scale = Vec3::one() * 1.02;
next.shorts.position = Vec3::new(0.0, skeleton_attr.shorts.0, skeleton_attr.shorts.1);
next.shorts.orientation = Quaternion::rotation_z(head_look.x * -0.2);
next.shorts.scale = Vec3::one() + breathe * -0.03;
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1,
skeleton_attr.foot.2,
);
next.foot_l.scale = Vec3::one();
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1,
skeleton_attr.foot.2,
);
next.foot_r.scale = Vec3::one();
next.shoulder_l.position = Vec3::new(
-skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1,
skeleton_attr.shoulder.2,
);
next.shoulder_l.scale = (Vec3::one() + breathe * -0.05) * 1.15;
next.shoulder_r.position = Vec3::new(
skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1,
skeleton_attr.shoulder.2,
);
next.shoulder_r.scale = (Vec3::one() + breathe * -0.05) * 1.15;
match active_tool_kind {
Some(ToolKind::Dagger(_)) => {
next.main.position = Vec3::new(-4.0, -5.0, 7.0);
@ -342,7 +105,6 @@ impl Animation for GlideWieldAnimation {
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
},
}
next.main.scale = Vec3::one();
match second_tool_kind {
Some(ToolKind::Dagger(_)) => {
@ -361,26 +123,6 @@ impl Animation for GlideWieldAnimation {
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
},
}
next.second.scale = Vec3::one();
next.lantern.position = Vec3::new(
skeleton_attr.lantern.0,
skeleton_attr.lantern.1,
skeleton_attr.lantern.2,
);
next.lantern.orientation = Quaternion::rotation_x(0.1) * Quaternion::rotation_y(0.1);
next.lantern.scale = Vec3::one() * 0.65;
next.hold.scale = Vec3::one() * 0.0;
next.torso.position = Vec3::new(0.0, 0.0, 0.0) * skeleton_attr.scaler;
next.torso.orientation = Quaternion::rotation_x(0.0);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
next.control.scale = Vec3::one();
next.control_l.scale = Vec3::one();
next.control_r.scale = Vec3::one();
}
next.second.scale = match (

View File

@ -76,7 +76,7 @@ impl Animation for GlidingAnimation {
anim_time as f32
};
next.head.position = Vec3::new(0.0, -2.0 + skeleton_attr.head.0, skeleton_attr.head.1);
next.head.position = Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1);
next.head.orientation = Quaternion::rotation_x(0.35 - slow * 0.10 + head_look.y)
* Quaternion::rotation_z(head_look.x + slowa * 0.15);
@ -103,7 +103,6 @@ impl Animation for GlidingAnimation {
next.foot_l.orientation = Quaternion::rotation_x(
(wave_stop * -0.7 - quicka * -0.21 + slow * 0.19) * speed * 0.04,
) * Quaternion::rotation_z(tilt * tiltcancel * 20.0);
next.foot_l.scale = Vec3::one();
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
@ -113,21 +112,6 @@ impl Animation for GlidingAnimation {
next.foot_r.orientation = Quaternion::rotation_x(
(wave_stop * -0.8 + quick * -0.25 + slowb * 0.13) * speed * 0.04,
) * Quaternion::rotation_z(tilt * tiltcancel * 20.0);
next.foot_r.scale = Vec3::one();
next.shoulder_l.position = Vec3::new(
-skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1,
skeleton_attr.shoulder.2,
);
next.shoulder_l.scale = Vec3::one() * 1.1;
next.shoulder_r.position = Vec3::new(
skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1,
skeleton_attr.shoulder.2,
);
next.shoulder_r.scale = Vec3::one() * 1.1;
next.glider.position = Vec3::new(0.0, -13.0 + slow * 0.10, 8.0);
next.glider.orientation =
@ -151,28 +135,9 @@ impl Animation for GlidingAnimation {
},
}
next.main.scale = Vec3::one();
next.second.scale = Vec3::one();
next.lantern.position = Vec3::new(
skeleton_attr.lantern.0,
skeleton_attr.lantern.1,
skeleton_attr.lantern.2,
);
next.lantern.scale = Vec3::one() * 0.65;
next.hold.scale = Vec3::one() * 0.0;
next.torso.position = Vec3::new(0.0, -4.0, 10.0) / 11.0 * skeleton_attr.scaler;
next.torso.orientation = Quaternion::rotation_x(-0.06 * speed.max(12.0) + slow * 0.04)
* Quaternion::rotation_y(tilt * tiltcancel * 32.0);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
next.control.scale = Vec3::one();
next.control_l.scale = Vec3::one();
next.control_r.scale = Vec3::one();
next.second.scale = match (
active_tool_kind.map(|tk| tk.hands()),

View File

@ -30,7 +30,7 @@ impl Animation for IdleAnimation {
next.head.position = Vec3::new(
0.0,
-2.0 + skeleton_attr.head.0,
skeleton_attr.head.0,
skeleton_attr.head.1 + wave_ultra_slow * 0.1 + head_abs * -0.5,
);
@ -57,7 +57,6 @@ impl Animation for IdleAnimation {
skeleton_attr.shorts.1 + wave_ultra_slow * 0.1,
);
next.shorts.orientation = Quaternion::rotation_x(0.0);
next.shorts.scale = Vec3::one();
next.back.position = Vec3::new(0.0, skeleton_attr.back.0, skeleton_attr.back.1);
next.back.scale = Vec3::one() * 1.02;
@ -69,7 +68,6 @@ impl Animation for IdleAnimation {
);
next.hand_l.orientation = Quaternion::rotation_x(0.0 + wave_ultra_slow * -0.06);
next.hand_l.scale = Vec3::one();
next.hand_r.position = Vec3::new(
skeleton_attr.hand.0,
@ -77,7 +75,6 @@ impl Animation for IdleAnimation {
skeleton_attr.hand.2 + wave_ultra_slow * 0.5 + head_abs * -0.05,
);
next.hand_r.orientation = Quaternion::rotation_x(0.0 + wave_ultra_slow * -0.06);
next.hand_r.scale = Vec3::one() + head_abs * -0.05;
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
@ -158,21 +155,7 @@ impl Animation for IdleAnimation {
next.hold.scale = Vec3::one() * 0.0;
next.torso.position = Vec3::new(0.0, -0.2, 0.1) * skeleton_attr.scaler;
next.torso.orientation = Quaternion::rotation_x(0.0);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
next.control.position = Vec3::new(0.0, 0.0, 0.0);
next.control.orientation = Quaternion::rotation_x(0.0);
next.control.scale = Vec3::one();
next.control_l.position = Vec3::new(0.0, 0.0, 0.0);
next.control_l.orientation = Quaternion::rotation_x(0.0);
next.control_l.scale = Vec3::one();
next.control_r.position = Vec3::new(0.0, 0.0, 0.0);
next.control_r.orientation = Quaternion::rotation_x(0.0);
next.control_r.scale = Vec3::one();
next.second.scale = match (
active_tool_kind.map(|tk| tk.hands()),
second_tool_kind.map(|tk| tk.hands()),

View File

@ -57,7 +57,7 @@ impl Animation for JumpAnimation {
next.head.position = Vec3::new(
0.0,
-3.0 + skeleton_attr.head.0,
-1.0 + skeleton_attr.head.0,
-1.0 + skeleton_attr.head.1,
);
next.head.orientation =
@ -66,11 +66,9 @@ impl Animation for JumpAnimation {
next.chest.position = Vec3::new(0.0, skeleton_attr.chest.0, skeleton_attr.chest.1 + 1.0);
next.chest.orientation = Quaternion::rotation_z(tilt * -2.0);
next.chest.scale = Vec3::one() * 1.01;
next.belt.position = Vec3::new(0.0, skeleton_attr.belt.0, skeleton_attr.belt.1);
next.belt.orientation = Quaternion::rotation_z(tilt * 2.0);
next.belt.scale = Vec3::one();
next.back.position = Vec3::new(0.0, skeleton_attr.back.0, skeleton_attr.back.1);
next.back.orientation = Quaternion::rotation_z(0.0);
@ -78,7 +76,6 @@ impl Animation for JumpAnimation {
next.shorts.position = Vec3::new(0.0, skeleton_attr.shorts.0, skeleton_attr.shorts.1);
next.shorts.orientation = Quaternion::rotation_z(tilt * 3.0);
next.shorts.scale = Vec3::one();
if random > 0.5 {
next.hand_l.position = Vec3::new(
@ -106,7 +103,6 @@ impl Animation for JumpAnimation {
);
next.hand_l.orientation =
Quaternion::rotation_x(-0.5 + slow * -0.4) * Quaternion::rotation_y(0.2);
next.hand_l.scale = Vec3::one();
next.hand_r.position = Vec3::new(
skeleton_attr.hand.0,
@ -115,7 +111,6 @@ impl Animation for JumpAnimation {
);
next.hand_r.orientation =
Quaternion::rotation_x(1.9 + slow * 0.4) * Quaternion::rotation_y(-0.2);
next.hand_r.scale = Vec3::one();
};
next.foot_l.position = Vec3::new(
@ -124,7 +119,6 @@ impl Animation for JumpAnimation {
1.0 + skeleton_attr.foot.2 + slow * 1.5,
);
next.foot_l.orientation = Quaternion::rotation_x(-1.2 * switch + slow * -0.2 * switch);
next.foot_l.scale = Vec3::one();
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
@ -132,7 +126,6 @@ impl Animation for JumpAnimation {
1.0 + skeleton_attr.foot.2 + slow * 1.5,
);
next.foot_r.orientation = Quaternion::rotation_x(1.2 * switch + slow * 0.2 * switch);
next.foot_r.scale = Vec3::one();
next.shoulder_l.position = Vec3::new(
-skeleton_attr.shoulder.0,
@ -204,18 +197,6 @@ impl Animation for JumpAnimation {
next.torso.orientation = Quaternion::rotation_x(-0.2);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
next.control.position = Vec3::new(0.0, 0.0, 0.0);
next.control.orientation = Quaternion::rotation_x(0.0);
next.control.scale = Vec3::one();
next.control_l.position = Vec3::new(0.0, 0.0, 0.0);
next.control_l.orientation = Quaternion::rotation_x(0.0);
next.control_l.scale = Vec3::one();
next.control_r.position = Vec3::new(0.0, 0.0, 0.0);
next.control_r.orientation = Quaternion::rotation_x(0.0);
next.control_r.scale = Vec3::one();
next.second.scale = match (
active_tool_kind.map(|tk| tk.hands()),
second_tool_kind.map(|tk| tk.hands()),

View File

@ -35,18 +35,10 @@ impl Animation for LeapAnimation {
let mut next = (*skeleton).clone();
let (movement1, movement2, movement3, movement4) = match stage_section {
Some(StageSection::Buildup) => {
(anim_time as f32, 0.0, 0.0, 0.0)
},
Some(StageSection::Movement) => {
(1.0, anim_time as f32, 0.0, 0.0)
},
Some(StageSection::Swing) => {
(1.0, 1.0, anim_time as f32, 0.0)
},
Some(StageSection::Recover) => {
(1.0, 1.0, 1.0, anim_time as f32)
},
Some(StageSection::Buildup) => (anim_time as f32, 0.0, 0.0, 0.0),
Some(StageSection::Movement) => (1.0, anim_time as f32, 0.0, 0.0),
Some(StageSection::Swing) => (1.0, 1.0, anim_time as f32, 0.0),
Some(StageSection::Recover) => (1.0, 1.0, 1.0, anim_time as f32),
_ => (0.0, 0.0, 0.0, 0.0),
};
@ -65,19 +57,17 @@ impl Animation for LeapAnimation {
next.control.position = Vec3::new(
6.0 + movement1 * -10.0,
7.0 + movement2 * 5.0 + movement3 * 5.0,
1.0 + movement2 * 5.0 + movement3 * -7.0
1.0 + movement2 * 5.0 + movement3 * -7.0,
);
next.control.orientation =
Quaternion::rotation_x(0.3 + movement3 * -3.0)
next.control.orientation = Quaternion::rotation_x(0.3 + movement3 * -3.0)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(movement1 * 0.5 + movement2 * 0.5 + movement3 * 0.5);
next.chest.orientation =
Quaternion::rotation_x(movement1 * 0.3 + movement2 * 0.3 + movement3 * -0.9 + movement4 * 0.3)
* Quaternion::rotation_y(0.0)
next.chest.orientation = Quaternion::rotation_x(
movement1 * 0.3 + movement2 * 0.3 + movement3 * -0.9 + movement4 * 0.3,
) * Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(movement1 * 0.5 + movement2 * 0.2 + movement3 * -0.7);
next.head.orientation =
Quaternion::rotation_x(movement3 * 0.2)
next.head.orientation = Quaternion::rotation_x(movement3 * 0.2)
* Quaternion::rotation_y(0.0 + movement2 * -0.1)
* Quaternion::rotation_z(movement1 * -0.4 + movement2 * -0.2 + movement3 * 0.6);
@ -101,12 +91,10 @@ impl Animation for LeapAnimation {
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)
@ -125,17 +113,18 @@ impl Animation for LeapAnimation {
11.0 + movement1 * 1.0 + movement3 * 3.0,
3.0 + movement1 * 12.0 + movement3 * -15.0,
);
next.control.orientation =
Quaternion::rotation_x(1.8 + movement1 * -1.0 + movement2 * -0.5 + movement3 * -1.0)
* Quaternion::rotation_y(-0.5 + movement1 * 0.5)
next.control.orientation = Quaternion::rotation_x(
1.8 + movement1 * -1.0 + movement2 * -0.5 + movement3 * -1.0,
) * Quaternion::rotation_y(-0.5 + movement1 * 0.5)
* Quaternion::rotation_z(PI + 0.2 - movement1 * 0.2);
next.torso.orientation =
Quaternion::rotation_x(-0.3 + movement2 * -1.8 * PI + movement3 * -0.2 * PI + movement4 * -0.1 * PI)
* Quaternion::rotation_y(0.0)
next.torso.orientation = Quaternion::rotation_x(
-0.3 + movement2 * -1.8 * PI + movement3 * -0.2 * PI + movement4 * -0.1 * PI,
) * Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.head.orientation = Quaternion::rotation_x(0.0 + movement1 * -0.4 + movement2 * 0.4 + movement3 * 0.2);
next.head.orientation =
Quaternion::rotation_x(0.0 + movement1 * -0.4 + movement2 * 0.4 + movement3 * 0.2);
next.foot_l.position = Vec3::new(
skeleton_attr.foot.0,
@ -158,18 +147,7 @@ impl Animation for LeapAnimation {
next.chest.position =
Vec3::new(0.0, skeleton_attr.chest.0, skeleton_attr.chest.1 - 8.0);
next.torso.position =
Vec3::new(0.0, 0.0, 0.0 + 8.0) * skeleton_attr.scaler / 11.0;
//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.control_l.scale = Vec3::one();
//next.control_r.scale = Vec3::one();
next.torso.position = Vec3::new(0.0, 0.0, 0.0 + 8.0) * skeleton_attr.scaler / 11.0;
}
next.second.scale = match (
@ -180,9 +158,6 @@ impl Animation for LeapAnimation {
(_, _) => 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

@ -2,7 +2,6 @@ pub mod alpha;
pub mod beam;
pub mod beta;
pub mod block;
pub mod blockidle;
pub mod charge;
pub mod chargeswing;
pub mod climb;
@ -31,8 +30,8 @@ pub mod wield;
// Reexports
pub use self::{
alpha::AlphaAnimation, beam::BeamAnimation, beta::BetaAnimation, block::BlockAnimation,
blockidle::BlockIdleAnimation, charge::ChargeAnimation, chargeswing::ChargeswingAnimation,
climb::ClimbAnimation, dance::DanceAnimation, dash::DashAnimation, equip::EquipAnimation,
charge::ChargeAnimation, chargeswing::ChargeswingAnimation, climb::ClimbAnimation,
dance::DanceAnimation, dash::DashAnimation, equip::EquipAnimation,
glidewield::GlideWieldAnimation, gliding::GlidingAnimation, idle::IdleAnimation,
jump::JumpAnimation, leapmelee::LeapAnimation, repeater::RepeaterAnimation,
roll::RollAnimation, run::RunAnimation, shockwave::ShockwaveAnimation, shoot::ShootAnimation,
@ -184,18 +183,18 @@ impl<'a> From<&'a Body> for SkeletonAttr {
(Danari, Female) => 1.15,
},
head: match (body.species, body.body_type) {
(Orc, Male) => (0.0, 13.5),
(Orc, Female) => (0.0, 13.0),
(Human, Male) => (0.3, 13.0),
(Human, Female) => (0.0, 13.0),
(Elf, Male) => (0.5, 13.0),
(Elf, Female) => (1.0, 13.0),
(Dwarf, Male) => (0.0, 14.0),
(Dwarf, Female) => (0.0, 13.5),
(Undead, Male) => (0.5, 13.0),
(Undead, Female) => (0.5, 14.0),
(Danari, Male) => (0.5, 12.5),
(Danari, Female) => (0.5, 13.5),
(Orc, Male) => (-2.0, 13.5),
(Orc, Female) => (-2.0, 13.0),
(Human, Male) => (-2.3, 13.0),
(Human, Female) => (-2.0, 13.0),
(Elf, Male) => (-2.5, 13.0),
(Elf, Female) => (-1.0, 13.0),
(Dwarf, Male) => (-2.0, 14.0),
(Dwarf, Female) => (-2.0, 13.5),
(Undead, Male) => (-1.5, 13.0),
(Undead, Female) => (-1.5, 14.0),
(Danari, Male) => (-1.5, 12.5),
(Danari, Female) => (-1.5, 13.5),
},
chest: match (body.species, body.body_type) {
(_, _) => (0.0, 8.0),

View File

@ -45,12 +45,10 @@ impl Animation for RepeaterAnimation {
next.hand_l.orientation = Quaternion::rotation_x(1.20)
* Quaternion::rotation_y(-0.6)
* Quaternion::rotation_z(-0.3);
next.hand_l.scale = Vec3::one() * 1.05;
next.hand_r.position = Vec3::new(5.9, 4.5, -5.0);
next.hand_r.orientation = Quaternion::rotation_x(1.20)
* Quaternion::rotation_y(-0.6)
* Quaternion::rotation_z(-0.3);
next.hand_r.scale = Vec3::one() * 1.05;
next.main.position = Vec3::new(3.0, 2.0, -13.0);
next.main.orientation = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(0.3)
@ -64,7 +62,6 @@ impl Animation for RepeaterAnimation {
next.control.position = Vec3::new(-7.0, 6.0, 6.0);
next.control.orientation = Quaternion::rotation_x(0.0) * Quaternion::rotation_z(0.0);
next.control.scale = Vec3::one();
if let Some(stage_section) = stage_section {
match stage_section {
StageSection::Movement => {
@ -174,7 +171,6 @@ impl Animation for RepeaterAnimation {
next.hand_l.orientation = Quaternion::rotation_x(1.20)
* Quaternion::rotation_y(-0.6)
* Quaternion::rotation_z(-0.3);
next.hold.scale = Vec3::one() * 0.0;
},
StageSection::Recover => {},
_ => {},
@ -190,9 +186,6 @@ impl Animation for RepeaterAnimation {
(_, _) => 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

@ -47,23 +47,17 @@ impl Animation for RollAnimation {
0.0
};
next.head.position = Vec3::new(
0.0,
-2.0 + skeleton_attr.head.0 + 3.0,
skeleton_attr.head.1 - 1.0,
);
next.head.position = Vec3::new(0.0, skeleton_attr.head.0 + 3.0, skeleton_attr.head.1 - 1.0);
next.head.orientation = Quaternion::rotation_x(-0.75);
next.head.scale = Vec3::one();
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
next.chest.position = Vec3::new(0.0, skeleton_attr.chest.0, -9.5 + skeleton_attr.chest.1);
next.chest.orientation = Quaternion::rotation_x(-0.2);
next.chest.scale = Vec3::one() * 1.01;
next.belt.position = Vec3::new(0.0, skeleton_attr.belt.0 + 1.0, skeleton_attr.belt.1 + 1.0);
next.belt.orientation = Quaternion::rotation_x(0.55);
next.back.position = Vec3::new(0.0, skeleton_attr.back.0, skeleton_attr.back.1);
next.back.scale = Vec3::one() * 1.02;
next.shorts.position = Vec3::new(
0.0,
@ -79,16 +73,13 @@ impl Animation for RollAnimation {
);
next.hand_l.orientation = Quaternion::rotation_x(0.6);
next.hand_l.scale = Vec3::one();
next.hand_r.position = Vec3::new(
-1.0 + skeleton_attr.hand.0,
skeleton_attr.hand.1 + 1.0,
skeleton_attr.hand.2 + 2.0,
);
next.hand_r.orientation = Quaternion::rotation_x(0.6);
next.hand_r.scale = Vec3::one();
next.foot_l.position = Vec3::new(
1.0 - skeleton_attr.foot.0,
@ -104,24 +95,7 @@ impl Animation for RollAnimation {
);
next.foot_r.orientation = Quaternion::rotation_x(0.9);
next.shoulder_l.position = Vec3::new(
-skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1 + 2.0,
skeleton_attr.shoulder.2 + 1.0,
);
next.shoulder_l.orientation = Quaternion::rotation_x(0.0);
next.shoulder_l.scale = Vec3::one() * 1.1;
next.shoulder_r.position = Vec3::new(
skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1,
skeleton_attr.shoulder.2,
);
next.shoulder_r.orientation = Quaternion::rotation_x(0.0);
next.shoulder_r.scale = Vec3::one() * 1.1;
next.glider.position = Vec3::new(0.0, 0.0, 10.0);
next.glider.scale = Vec3::one() * 0.0;
match active_tool_kind {
Some(ToolKind::Dagger(_)) => {
@ -139,7 +113,6 @@ impl Animation for RollAnimation {
next.main.orientation = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
},
}
next.main.scale = Vec3::one();
match second_tool_kind {
Some(ToolKind::Dagger(_)) => {
@ -158,13 +131,7 @@ impl Animation for RollAnimation {
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
},
}
next.second.scale = Vec3::one();
next.lantern.position = Vec3::new(
skeleton_attr.lantern.0,
skeleton_attr.lantern.1,
skeleton_attr.lantern.2,
);
next.lantern.orientation = Quaternion::rotation_x(0.1) * Quaternion::rotation_y(0.1);
next.lantern.scale = Vec3::one() * 0.65;
next.hold.scale = Vec3::one() * 0.0;
@ -174,18 +141,6 @@ impl Animation for RollAnimation {
Quaternion::rotation_x(spin * -10.0) * Quaternion::rotation_z(tilt * -10.0);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
next.control.position = Vec3::new(0.0, 0.0, 0.0);
next.control.orientation = Quaternion::rotation_x(0.0);
next.control.scale = Vec3::one();
next.control_l.position = Vec3::new(0.0, 0.0, 0.0);
next.control_l.orientation = Quaternion::rotation_x(0.0);
next.control_l.scale = Vec3::one();
next.control_r.position = Vec3::new(0.0, 0.0, 0.0);
next.control_r.orientation = Quaternion::rotation_x(0.0);
next.control_r.scale = Vec3::one();
next.second.scale = match (
active_tool_kind.map(|tk| tk.hands()),
second_tool_kind.map(|tk| tk.hands()),

View File

@ -114,7 +114,7 @@ impl Animation for RunAnimation {
next.head.position = Vec3::new(
0.0,
-3.0 + skeleton_attr.head.0,
-1.0 + skeleton_attr.head.0,
skeleton_attr.head.1 + short * 0.1,
);
next.head.orientation =
@ -132,7 +132,6 @@ impl Animation for RunAnimation {
* Quaternion::rotation_x(
impact * 0.06 + shortalter * 0.035 + wave_stop * speed * -0.09 + (tilt.abs()),
);
next.chest.scale = Vec3::one();
next.belt.position = Vec3::new(
0.0,
@ -142,12 +141,10 @@ impl Animation for RunAnimation {
next.belt.orientation = Quaternion::rotation_x(0.1)
* Quaternion::rotation_z(short * 0.1 + tilt * -1.1)
* Quaternion::rotation_y(tilt * 0.5);
next.belt.scale = Vec3::one();
next.back.position = Vec3::new(0.0, skeleton_attr.back.0, skeleton_attr.back.1);
next.back.orientation =
Quaternion::rotation_x(-0.25 + short * 0.1 + noisea * 0.1 + noiseb * 0.1);
next.back.scale = Vec3::one() * 1.02;
next.shorts.position = Vec3::new(
0.0,
@ -157,7 +154,6 @@ impl Animation for RunAnimation {
next.shorts.orientation = Quaternion::rotation_x(0.2)
* Quaternion::rotation_z(short * 0.25 + tilt * -1.5)
* Quaternion::rotation_y(tilt * 0.7);
next.shorts.scale = Vec3::one();
next.hand_l.position = Vec3::new(
-skeleton_attr.hand.0 + foothorir * -1.3,
@ -166,7 +162,6 @@ impl Animation for RunAnimation {
);
next.hand_l.orientation = Quaternion::rotation_x(0.6 + footrotr * -1.2 * walkintensity)
* Quaternion::rotation_y(footrotr * 0.4 * walkintensity);
next.hand_l.scale = Vec3::one();
next.hand_r.position = Vec3::new(
skeleton_attr.hand.0 + foothoril * 1.3,
@ -175,7 +170,6 @@ impl Animation for RunAnimation {
);
next.hand_r.orientation = Quaternion::rotation_x(0.6 + footrotl * -1.2 * walkintensity)
* Quaternion::rotation_y(footrotl * -0.4 * walkintensity);
next.hand_r.scale = Vec3::one();
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
@ -184,7 +178,6 @@ impl Animation for RunAnimation {
);
next.foot_l.orientation = Quaternion::rotation_x(-0.2 + footrotl * -1.2 * walkintensity)
* Quaternion::rotation_y(tilt * 1.8);
next.foot_l.scale = Vec3::one();
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
@ -193,7 +186,6 @@ impl Animation for RunAnimation {
);
next.foot_r.orientation = Quaternion::rotation_x(-0.2 + footrotr * -1.2 * walkintensity)
* Quaternion::rotation_y(tilt * 1.8);
next.foot_r.scale = Vec3::one();
next.shoulder_l.position = Vec3::new(
-skeleton_attr.shoulder.0,
@ -230,7 +222,6 @@ impl Animation for RunAnimation {
next.main.orientation = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
},
}
next.main.scale = Vec3::one();
match second_tool_kind {
Some(ToolKind::Dagger(_)) => {
@ -249,7 +240,6 @@ impl Animation for RunAnimation {
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
},
}
next.second.scale = Vec3::one();
next.lantern.position = Vec3::new(
skeleton_attr.lantern.0,
@ -262,17 +252,8 @@ impl Animation for RunAnimation {
next.hold.scale = Vec3::one() * 0.0;
next.torso.position = Vec3::new(0.0, -0.3, 0.0) * skeleton_attr.scaler;
next.torso.orientation = Quaternion::rotation_y(0.0);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
next.control.position = Vec3::new(0.0, 0.0, 0.0);
next.control.orientation = Quaternion::rotation_x(0.0);
next.control.scale = Vec3::one();
next.control_l.scale = Vec3::one();
next.control_r.scale = Vec3::one();
next.second.scale = match (
active_tool_kind.map(|tk| tk.hands()),
second_tool_kind.map(|tk| tk.hands()),

View File

@ -44,10 +44,8 @@ impl Animation for ShockwaveAnimation {
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, 0.0, 13.2);
next.main.orientation = Quaternion::rotation_y(PI);
@ -55,7 +53,6 @@ impl Animation for ShockwaveAnimation {
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 {

View File

@ -69,21 +69,15 @@ impl Animation for ShootAnimation {
next.hand_l.position = Vec3::new(11.0, 5.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(12.0, 5.5, 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(12.0, 8.5, 13.2);
next.main.orientation = Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(3.14)
* Quaternion::rotation_z(0.0);
next.main.orientation = Quaternion::rotation_y(3.14);
next.control.position = Vec3::new(-7.0, 6.0, 6.0 - exp * 5.0);
next.control.orientation = Quaternion::rotation_x(exp * 1.3)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(exp * 1.5);
next.control.scale = Vec3::one();
next.control.orientation =
Quaternion::rotation_x(exp * 1.3) * Quaternion::rotation_z(exp * 1.5);
},
Some(ToolKind::Bow(_)) => {
next.hand_l.position =
@ -91,22 +85,17 @@ impl Animation for ShootAnimation {
next.hand_l.orientation = Quaternion::rotation_x(1.20)
* Quaternion::rotation_y(-0.6 + exp * 0.8)
* Quaternion::rotation_z(-0.3 + exp * 0.9);
next.hand_l.scale = Vec3::one() * 1.05;
next.hand_r.position = Vec3::new(4.9, 3.0, -4.0);
next.hand_r.orientation = Quaternion::rotation_x(1.20)
* Quaternion::rotation_y(-0.6)
* Quaternion::rotation_z(-0.3);
next.hand_r.scale = Vec3::one() * 1.05;
next.main.position = Vec3::new(3.0, 2.0, -13.0);
next.main.orientation = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(0.3)
* Quaternion::rotation_z(-0.6);
next.control.position = Vec3::new(-9.0, 6.0, 8.0);
next.control.orientation = Quaternion::rotation_x(exp * 0.4)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.control.scale = Vec3::one();
next.control.orientation = Quaternion::rotation_x(exp * 0.4);
},
_ => {},
}
@ -119,7 +108,6 @@ impl Animation for ShootAnimation {
next.foot_l.orientation = Quaternion::rotation_x(exp * 0.5)
* Quaternion::rotation_z(exp * 0.4)
* Quaternion::rotation_y(0.15);
next.foot_l.scale = Vec3::one();
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0 + foot * 1.0 + exp * 1.0,
@ -129,10 +117,7 @@ impl Animation for ShootAnimation {
next.foot_r.orientation = Quaternion::rotation_x(exp * -0.5)
* Quaternion::rotation_z(exp * 0.4)
* Quaternion::rotation_y(0.0);
next.foot_r.scale = Vec3::one();
next.torso.position = Vec3::new(0.0, 0.0, 0.1) * skeleton_attr.scaler;
next.torso.orientation = Quaternion::rotation_x(-0.15);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
} else {
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
@ -150,44 +135,15 @@ impl Animation for ShootAnimation {
next.torso.orientation = Quaternion::rotation_z(0.0);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
}
next.back.position = Vec3::new(0.0, -2.8, 7.25);
next.back.orientation = Quaternion::rotation_x(-0.3);
next.back.scale = Vec3::one() * 1.02;
next.shoulder_l.position = Vec3::new(-5.0, 0.0, 4.7);
next.shoulder_l.orientation = Quaternion::rotation_x(0.0);
next.shoulder_l.scale = Vec3::one() * 1.1;
next.shoulder_r.position = Vec3::new(5.0, 0.0, 4.7);
next.shoulder_r.orientation = Quaternion::rotation_x(0.0);
next.shoulder_r.scale = Vec3::one() * 1.1;
next.glider.position = Vec3::new(0.0, 5.0, 0.0);
next.glider.orientation = Quaternion::rotation_y(0.0);
next.glider.scale = Vec3::one() * 0.0;
next.lantern.position = Vec3::new(
skeleton_attr.lantern.0,
skeleton_attr.lantern.1,
skeleton_attr.lantern.2,
);
next.lantern.orientation =
Quaternion::rotation_x(exp * -0.7 + 0.4) * Quaternion::rotation_y(exp * 0.4);
next.lantern.scale = Vec3::one() * 0.65;
next.hold.position = Vec3::new(17.5, -25.0, -10.5);
next.hold.orientation = Quaternion::rotation_x(-1.6)
* Quaternion::rotation_y(-0.1)
* Quaternion::rotation_z(0.0);
next.hold.scale = Vec3::one() * 0.0;
next.control_l.position = Vec3::new(0.0, 0.0, 0.0);
next.control_l.orientation = Quaternion::rotation_x(0.0);
next.control_l.scale = Vec3::one();
next.control_r.position = Vec3::new(0.0, 0.0, 0.0);
next.control_r.orientation = Quaternion::rotation_x(0.0);
next.control_r.scale = Vec3::one();
next.second.scale = match (
active_tool_kind.map(|tk| tk.hands()),

View File

@ -43,7 +43,7 @@ impl Animation for SitAnimation {
);
next.head.position = Vec3::new(
0.0,
-3.0 + skeleton_attr.head.0,
skeleton_attr.head.0,
skeleton_attr.head.1 + slow * 0.1 + stop * -0.8,
);
next.head.orientation = Quaternion::rotation_z(head_look.x + slow * 0.2 - slow * 0.1)
@ -64,7 +64,6 @@ impl Animation for SitAnimation {
next.belt.scale = (Vec3::one() + slow_abs * 0.05) * 1.02;
next.back.position = Vec3::new(0.0, skeleton_attr.back.0, skeleton_attr.back.1);
next.back.scale = Vec3::one() * 1.02;
next.shorts.position = Vec3::new(
0.0,
@ -72,7 +71,6 @@ impl Animation for SitAnimation {
skeleton_attr.shorts.1 + stop * 0.6,
);
next.shorts.orientation = Quaternion::rotation_x(stop * 0.6);
next.shorts.scale = Vec3::one();
next.hand_l.position = Vec3::new(
-skeleton_attr.hand.0,
@ -96,7 +94,6 @@ impl Animation for SitAnimation {
3.0 + skeleton_attr.foot.2,
);
next.foot_l.orientation = Quaternion::rotation_x(slow * 0.1 + stop * 1.2 + slow * 0.1);
next.foot_l.scale = Vec3::one();
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
@ -104,7 +101,6 @@ impl Animation for SitAnimation {
3.0 + skeleton_attr.foot.2,
);
next.foot_r.orientation = Quaternion::rotation_x(slowa * 0.1 + stop * 1.2 + slowa * 0.1);
next.foot_r.scale = Vec3::one();
next.shoulder_l.position = Vec3::new(
-skeleton_attr.shoulder.0,
@ -122,9 +118,6 @@ impl Animation for SitAnimation {
next.shoulder_r.orientation = Quaternion::rotation_x(0.0);
next.shoulder_r.scale = (Vec3::one() + slow_abs * -0.05) * 1.15;
next.glider.position = Vec3::new(0.0, 0.0, 10.0);
next.glider.scale = Vec3::one() * 0.0;
match active_tool_kind {
Some(ToolKind::Dagger(_)) => {
next.main.position = Vec3::new(-4.0, -5.0, 7.0);
@ -160,24 +153,8 @@ impl Animation for SitAnimation {
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
},
}
next.second.scale = Vec3::one();
next.lantern.position = Vec3::new(
skeleton_attr.lantern.0,
skeleton_attr.lantern.1,
skeleton_attr.lantern.2,
);
next.lantern.scale = Vec3::one() * 0.65;
next.hold.scale = Vec3::one() * 0.0;
next.torso.position = Vec3::new(0.0, -0.2, stop * -0.16) * skeleton_attr.scaler;
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
next.control.scale = Vec3::one();
next.control_l.scale = Vec3::one();
next.control_r.scale = Vec3::one();
next.second.scale = match (
active_tool_kind.map(|tk| tk.hands()),

View File

@ -99,7 +99,6 @@ impl Animation for SneakAnimation {
1.0 + skeleton_attr.hand.2,
);
next.hand_l.orientation = Quaternion::rotation_x(1.0);
next.hand_l.scale = Vec3::one();
next.hand_r.position = Vec3::new(
-1.0 + skeleton_attr.hand.0,
@ -107,16 +106,14 @@ impl Animation for SneakAnimation {
skeleton_attr.hand.2,
);
next.hand_r.orientation = Quaternion::rotation_x(0.4);
next.hand_r.scale = Vec3::one();
next.head.position = Vec3::new(
0.0,
-4.0 + skeleton_attr.head.0,
-1.0 + skeleton_attr.head.0,
-1.0 + skeleton_attr.head.1 + short * 0.06,
);
next.head.orientation =
Quaternion::rotation_z(tilt * -2.5 + head_look.x * 0.2 - short * 0.06)
* Quaternion::rotation_x(head_look.y + 0.45);
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
next.chest.position = Vec3::new(
0.0,
@ -126,23 +123,18 @@ impl Animation for SneakAnimation {
next.chest.orientation = Quaternion::rotation_z(0.3 + short * 0.08 + tilt * -0.2)
* Quaternion::rotation_y(tilt * 0.8)
* Quaternion::rotation_x(-0.5);
next.chest.scale = Vec3::one();
next.belt.position =
Vec3::new(0.0, 0.5 + skeleton_attr.belt.0, 0.7 + skeleton_attr.belt.1);
next.belt.orientation = Quaternion::rotation_z(short * 0.1 + tilt * -1.1)
* Quaternion::rotation_y(tilt * 0.5)
* Quaternion::rotation_x(0.2);
next.belt.scale = Vec3::one();
next.glider.orientation = Quaternion::rotation_x(0.0);
next.glider.position = Vec3::new(0.0, 0.0, 10.0);
next.glider.scale = Vec3::one() * 0.0;
next.back.position = Vec3::new(0.0, skeleton_attr.back.0, skeleton_attr.back.1);
next.back.orientation =
Quaternion::rotation_x(-0.25 + short * 0.1 + noisea * 0.1 + noiseb * 0.1);
next.back.scale = Vec3::one() * 1.02;
next.shorts.position = Vec3::new(
0.0,
@ -162,7 +154,6 @@ impl Animation for SneakAnimation {
next.foot_l.orientation =
Quaternion::rotation_x(-0.2 + footrotl * -0.8 * walkintensity)
* Quaternion::rotation_y(tilt * 1.8);
next.foot_l.scale = Vec3::one();
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
@ -172,59 +163,21 @@ impl Animation for SneakAnimation {
next.foot_r.orientation =
Quaternion::rotation_x(-0.2 + footrotr * -0.8 * walkintensity)
* Quaternion::rotation_y(tilt * 1.8);
next.foot_r.scale = Vec3::one();
next.shoulder_l.position = Vec3::new(
-skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1,
skeleton_attr.shoulder.2,
);
next.shoulder_l.orientation = Quaternion::rotation_x(short * 0.15 * walkintensity);
next.shoulder_l.scale = Vec3::one() * 1.1;
next.shoulder_r.position = Vec3::new(
skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1,
skeleton_attr.shoulder.2,
);
next.shoulder_r.orientation = Quaternion::rotation_x(short * -0.15 * walkintensity);
next.shoulder_r.scale = Vec3::one() * 1.1;
next.main.position = Vec3::new(-7.0, -6.5, 15.0);
next.main.orientation = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
next.main.scale = Vec3::one();
next.second.scale = Vec3::one() * 0.0;
next.lantern.position = Vec3::new(
skeleton_attr.lantern.0,
skeleton_attr.lantern.1,
skeleton_attr.lantern.2,
);
next.lantern.orientation =
Quaternion::rotation_x(shorte * 0.2 + 0.4) * Quaternion::rotation_y(shorte * 0.1);
next.lantern.scale = Vec3::one() * 0.65;
next.torso.position = Vec3::new(0.0, 0.0, 0.0) * skeleton_attr.scaler;
next.torso.orientation = Quaternion::rotation_y(0.0);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
next.control.position = Vec3::new(0.0, 0.0, 0.0);
next.control.orientation = Quaternion::rotation_x(0.0);
next.control.scale = Vec3::one();
next.control_l.scale = Vec3::one();
next.control_r.scale = Vec3::one();
} else {
next.head.position = Vec3::new(
0.0,
-4.0 + skeleton_attr.head.0,
-1.0 + skeleton_attr.head.0,
-2.0 + skeleton_attr.head.1 + slow * 0.1 + breathe * -0.05,
);
next.head.orientation = Quaternion::rotation_z(head_look.x)
* Quaternion::rotation_x(0.6 + head_look.y.abs());
next.head.scale = Vec3::one() * skeleton_attr.head_scale + breathe * -0.05;
next.chest.position = Vec3::new(
0.0,
@ -232,11 +185,9 @@ impl Animation for SneakAnimation {
-3.0 + skeleton_attr.chest.1 + slow * 0.1,
);
next.chest.orientation = Quaternion::rotation_x(-0.7);
next.chest.scale = Vec3::one() * 1.01 + breathe * 0.03;
next.belt.position = Vec3::new(0.0, skeleton_attr.belt.0, skeleton_attr.belt.1);
next.belt.orientation = Quaternion::rotation_z(0.3 + head_look.x * -0.1);
next.belt.scale = Vec3::one() + breathe * -0.03;
next.hand_l.position = Vec3::new(
1.0 - skeleton_attr.hand.0,
@ -244,7 +195,6 @@ impl Animation for SneakAnimation {
0.0 + skeleton_attr.hand.2,
);
next.hand_l.orientation = Quaternion::rotation_x(1.35);
next.hand_l.scale = Vec3::one();
next.hand_r.position = Vec3::new(
-1.0 + skeleton_attr.hand.0,
@ -252,18 +202,12 @@ impl Animation for SneakAnimation {
skeleton_attr.hand.2,
);
next.hand_r.orientation = Quaternion::rotation_x(0.4);
next.hand_r.scale = Vec3::one();
next.glider.orientation = Quaternion::rotation_x(0.35);
next.glider.position = Vec3::new(0.0, 0.0, 10.0);
next.glider.scale = Vec3::one() * 0.0;
next.back.position = Vec3::new(0.0, skeleton_attr.back.0, skeleton_attr.back.1);
next.back.scale = Vec3::one() * 1.02;
next.shorts.position = Vec3::new(0.0, skeleton_attr.shorts.0, skeleton_attr.shorts.1);
next.shorts.orientation = Quaternion::rotation_z(0.6 + head_look.x * -0.2);
next.shorts.scale = Vec3::one() + breathe * -0.03;
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
@ -271,54 +215,19 @@ impl Animation for SneakAnimation {
1.0 + skeleton_attr.foot.2,
);
next.foot_l.orientation = Quaternion::rotation_x(-0.5);
next.foot_l.scale = Vec3::one();
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
4.0 + skeleton_attr.foot.1,
skeleton_attr.foot.2,
);
next.foot_r.orientation = Quaternion::rotation_x(0.0);
next.foot_r.scale = Vec3::one();
next.shoulder_l.position = Vec3::new(
-skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1,
skeleton_attr.shoulder.2,
);
next.shoulder_l.scale = (Vec3::one() + breathe * -0.05) * 1.15;
next.shoulder_r.position = Vec3::new(
skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1,
skeleton_attr.shoulder.2,
);
next.shoulder_r.scale = (Vec3::one() + breathe * -0.05) * 1.15;
next.main.position = Vec3::new(-7.0, -5.0, 15.0);
next.main.orientation = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
next.main.scale = Vec3::one();
next.second.position = Vec3::new(0.0, 0.0, 0.0);
next.second.scale = Vec3::one() * 0.0;
next.lantern.position = Vec3::new(
skeleton_attr.lantern.0,
skeleton_attr.lantern.1,
skeleton_attr.lantern.2,
);
next.lantern.orientation = Quaternion::rotation_x(0.1) * Quaternion::rotation_y(0.1);
next.lantern.scale = Vec3::one() * 0.65;
next.torso.position = Vec3::new(0.0, 0.0, 0.0) * skeleton_attr.scaler;
next.torso.orientation = Quaternion::rotation_x(0.0);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
next.control.scale = Vec3::one();
next.control_l.scale = Vec3::one();
next.control_r.scale = Vec3::one();
}
next
}

View File

@ -39,15 +39,9 @@ impl Animation for SpinAnimation {
let lab = 1.0;
let (movement1, movement2, movement3) = match stage_section {
Some(StageSection::Buildup) => {
(anim_time as f32, 0.0, 0.0)
},
Some(StageSection::Swing) => {
(1.0, anim_time as f32, 0.0)
},
Some(StageSection::Recover) => {
(1.0, 1.0, anim_time as f32)
},
Some(StageSection::Buildup) => (anim_time as f32, 0.0, 0.0),
Some(StageSection::Swing) => (1.0, anim_time as f32, 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time as f32),
_ => (0.0, 0.0, 0.0),
};
@ -61,80 +55,76 @@ impl Animation for SpinAnimation {
let spin = (anim_time as f32 * 2.8 * lab as f32).sin();
let spinhalf = (anim_time as f32 * 1.4 * lab as f32).sin();
fn slow(x: f32) -> f32 {(x * 8.0).sin()}
fn slow(x: f32) -> f32 { (x * 8.0).sin() }
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.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, 0.0, 2.0);
next.main.orientation = Quaternion::rotation_x(-0.1)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.control.position =
Vec3::new(
5.0 + movement1 * 2.0 + movement2 * -8.0 + movement3 * -7.0,
11.0 + slow(movement1) * 0.6 + slow(movement2) * 3.0 + slow(movement3) * -0.8 + movement3 * -10.0,
2.0 + slow(movement1) * 0.6 + slow(movement2) * 3.5 + movement2 * 3.0 + slow(movement3) * -0.4 + movement3 * -4.0
);
next.control.orientation =
Quaternion::rotation_x(movement1 * -1.57 + movement2 * -0.6 + slow(movement2) * -0.25)
* Quaternion::rotation_y(-0.57 + movement1 * 2.0 + movement2 * -2.0)
* Quaternion::rotation_z(movement1 + movement2);
next.control.position = Vec3::new(
5.0 + movement1 * 2.0 + movement2 * -8.0 + movement3 * -7.0,
11.0 + slow(movement1) * 0.6
+ slow(movement2) * 3.0
+ slow(movement3) * -0.8
+ movement3 * -10.0,
2.0 + slow(movement1) * 0.6
+ slow(movement2) * 3.5
+ movement2 * 3.0
+ slow(movement3) * -0.4
+ movement3 * -4.0,
);
next.control.orientation = Quaternion::rotation_x(
movement1 * -1.57 + movement2 * -0.6 + slow(movement2) * -0.25,
) * Quaternion::rotation_y(
-0.57 + movement1 * 2.0 + movement2 * -2.0,
) * Quaternion::rotation_z(movement1 + movement2);
next.head.orientation = Quaternion::rotation_z(slow(movement2) * -0.8);
next.chest.orientation =
Quaternion::rotation_x(slow(movement2) * 0.15)
next.chest.orientation = Quaternion::rotation_x(slow(movement2) * 0.15)
* Quaternion::rotation_y(movement1 * -0.1 + movement2 * 0.3 + movement3 * -0.1)
* Quaternion::rotation_z(-1.0 + movement1 * -0.6 + movement2 * 1.5 + movement3 * 0.5);
* Quaternion::rotation_z(
-1.0 + movement1 * -0.6 + movement2 * 1.5 + movement3 * 0.5,
);
next.belt.orientation =
Quaternion::rotation_x(movement1 * 0.1)
next.belt.orientation = Quaternion::rotation_x(movement1 * 0.1)
* Quaternion::rotation_z(movement2.sin() * 0.5);
next.shorts.orientation =
Quaternion::rotation_x(movement1 * 0.1)
next.shorts.orientation = Quaternion::rotation_x(movement1 * 0.1)
* Quaternion::rotation_z(movement2.sin() * 1.5);
next.head.orientation =
Quaternion::rotation_y(movement1 * 0.1 - movement2 * -0.1)
next.head.orientation = Quaternion::rotation_y(movement1 * 0.1 - movement2 * -0.1)
* Quaternion::rotation_z(1.07 + movement1 * 0.4 + movement2 * -1.5);
next.torso.orientation = Quaternion::rotation_z((movement2).sin() * 7.2);
}
// println!("{:?}", stage_progress),
if let Some(ToolKind::Axe(_) | ToolKind::Hammer(_) | ToolKind::Dagger(_)) = active_tool_kind
{
//INTENTION: SWORD
next.hand_l.position = Vec3::new(-0.75, -1.0, -2.5);
next.hand_l.orientation = Quaternion::rotation_x(1.27);
next.hand_l.scale = Vec3::one() * 1.04;
next.hand_r.position = Vec3::new(0.75, -1.5, -5.5);
next.hand_r.orientation = Quaternion::rotation_x(1.27);
next.hand_r.scale = Vec3::one() * 1.05;
next.main.position = Vec3::new(0.0, 6.0, -1.0);
next.main.orientation = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.main.scale = Vec3::one();
next.control.position = Vec3::new(-4.5 + spinhalf * 4.0, 11.0, 8.0);
next.control.orientation = Quaternion::rotation_x(-1.7)
* Quaternion::rotation_y(0.2 + spin * -2.0)
* Quaternion::rotation_z(1.4 + spin * 0.1);
next.control.scale = Vec3::one();
next.head.position = Vec3::new(
0.0,
-2.0 + skeleton_attr.head.0 + spin * -0.8,
-1.0 + skeleton_attr.head.0 + spin * -0.8,
skeleton_attr.head.1,
);
next.head.orientation = Quaternion::rotation_z(spin * -0.25)
@ -144,20 +134,13 @@ impl Animation for SpinAnimation {
next.chest.orientation = Quaternion::rotation_z(spin * 0.1)
* Quaternion::rotation_x(0.0 + spin * 0.1)
* Quaternion::rotation_y(decel * -0.2);
next.chest.scale = Vec3::one();
next.belt.position = Vec3::new(0.0, 0.0, -2.0);
next.belt.orientation = next.chest.orientation * -0.1;
next.belt.scale = Vec3::one();
next.shorts.position = Vec3::new(0.0, 0.0, -5.0);
next.belt.orientation = next.chest.orientation * -0.08;
next.shorts.scale = Vec3::one();
next.torso.position = Vec3::new(0.0, 0.0, 0.1) * skeleton_attr.scaler;
next.torso.orientation = Quaternion::rotation_z((spin * 7.0).max(0.3))
* Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(0.0);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
next.torso.orientation = Quaternion::rotation_z((spin * 7.0).max(0.3));
next.foot_l.position =
Vec3::new(-skeleton_attr.foot.0, foot * 1.0, skeleton_attr.foot.2);
@ -167,37 +150,9 @@ impl Animation for SpinAnimation {
next.foot_r.position =
Vec3::new(skeleton_attr.foot.0, foot * -1.0, skeleton_attr.foot.2);
next.foot_r.orientation = Quaternion::rotation_x(foot * 1.2);
next.foot_r.scale = Vec3::one();
next.shoulder_l.position = Vec3::new(-5.0, 0.0, 4.7);
next.shoulder_l.orientation = Quaternion::rotation_x(0.0);
next.shoulder_l.scale = Vec3::one() * 1.1;
next.shoulder_r.position = Vec3::new(5.0, 0.0, 4.7);
next.shoulder_r.orientation = Quaternion::rotation_x(0.0);
next.shoulder_r.scale = Vec3::one() * 1.1;
next.glider.position = Vec3::new(0.0, 5.0, 0.0);
next.glider.orientation = Quaternion::rotation_y(0.0);
next.glider.scale = Vec3::one() * 0.0;
next.lantern.position = Vec3::new(
skeleton_attr.lantern.0,
skeleton_attr.lantern.1,
skeleton_attr.lantern.2,
);
next.lantern.orientation =
Quaternion::rotation_x(spin * -0.7 + 0.4) * Quaternion::rotation_y(spin * 0.4);
next.lantern.scale = Vec3::one() * 0.65;
next.hold.scale = Vec3::one() * 0.0;
next.control_l.position = Vec3::new(0.0, 0.0, 0.0);
next.control_l.orientation = Quaternion::rotation_x(0.0);
next.control_l.scale = Vec3::one();
next.control_r.position = Vec3::new(0.0, 0.0, 0.0);
next.control_r.orientation = Quaternion::rotation_x(0.0);
next.control_r.scale = Vec3::one();
}
next.second.scale = match (
active_tool_kind.map(|tk| tk.hands()),

View File

@ -64,11 +64,9 @@ impl Animation for SpinMeleeAnimation {
next.hand_l.position = Vec3::new(-0.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, 0.0, 2.0);
next.main.orientation = Quaternion::rotation_x(-0.1)
* Quaternion::rotation_y(0.0)
@ -153,12 +151,10 @@ impl Animation for SpinMeleeAnimation {
next.hand_l.orientation = Quaternion::rotation_x(PI / 2.0)
* Quaternion::rotation_z(0.0)
* Quaternion::rotation_y(PI);
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)
@ -168,9 +164,7 @@ impl Animation for SpinMeleeAnimation {
next.control.orientation = Quaternion::rotation_x(-1.4)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(1.4);
next.control.scale = Vec3::one();
next.head.position = Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1);
next.head.orientation = Quaternion::rotation_z(0.0)
* Quaternion::rotation_x(-0.15)
* Quaternion::rotation_y(0.08);
@ -182,18 +176,15 @@ impl Animation for SpinMeleeAnimation {
next.chest.orientation = Quaternion::rotation_z(0.0)
* Quaternion::rotation_x(-0.1)
* Quaternion::rotation_y(0.3);
next.chest.scale = Vec3::one();
next.belt.position = Vec3::new(0.0, 1.0, -1.0);
next.belt.orientation = Quaternion::rotation_z(0.0)
* Quaternion::rotation_x(0.4)
* Quaternion::rotation_y(0.0);
next.belt.scale = Vec3::one() * 0.98;
next.shorts.position = Vec3::new(0.0, 3.0, -2.5);
next.shorts.orientation = Quaternion::rotation_z(0.0)
* Quaternion::rotation_x(0.7)
* Quaternion::rotation_y(0.0);
next.shorts.scale = Vec3::one();
next.torso.position = Vec3::new(
-xshift * (anim_time as f32).min(0.6),
-yshift * (anim_time as f32).min(0.6),
@ -202,18 +193,15 @@ impl Animation for SpinMeleeAnimation {
next.torso.orientation = Quaternion::rotation_z(spin * -16.0)
* Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(0.0);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
if velocity.z.abs() > 0.1 {
next.foot_l.position =
Vec3::new(-skeleton_attr.foot.0, 8.0, skeleton_attr.foot.2 + 2.0);
next.foot_l.orientation =
Quaternion::rotation_x(1.0) * Quaternion::rotation_z(0.0);
next.foot_l.scale = Vec3::one();
next.foot_r.position =
Vec3::new(skeleton_attr.foot.0, 8.0, skeleton_attr.foot.2 + 2.0);
next.foot_r.orientation = Quaternion::rotation_x(1.0);
next.foot_r.scale = Vec3::one();
} else if speed < 0.5 {
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
@ -222,49 +210,33 @@ impl Animation for SpinMeleeAnimation {
);
next.foot_l.orientation = Quaternion::rotation_x(0.5 + slowersmooth * 0.2)
* Quaternion::rotation_z(0.0);
next.foot_l.scale = Vec3::one();
next.foot_r.position =
Vec3::new(skeleton_attr.foot.0, 4.0, skeleton_attr.foot.2);
next.foot_r.orientation = Quaternion::rotation_x(0.5 - slowersmooth * 0.2)
* Quaternion::rotation_y(-0.4);
next.foot_r.scale = Vec3::one();
} else {
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
2.0 + quick * -6.0,
skeleton_attr.foot.2,
);
next.foot_l.orientation = Quaternion::rotation_x(0.5 + slowersmooth * 0.2)
* Quaternion::rotation_z(0.0);
next.foot_l.scale = Vec3::one();
next.foot_l.orientation = Quaternion::rotation_x(0.5 + slowersmooth * 0.2);
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
2.0 + quick * 6.0,
skeleton_attr.foot.2,
);
next.foot_r.orientation = Quaternion::rotation_x(0.5 - slowersmooth * 0.2)
* Quaternion::rotation_z(0.0);
next.foot_r.scale = Vec3::one();
next.foot_r.orientation = Quaternion::rotation_x(0.5 - slowersmooth * 0.2);
};
},
_ => {},
}
next.lantern.position = Vec3::new(
skeleton_attr.lantern.0,
skeleton_attr.lantern.1,
skeleton_attr.lantern.2,
);
next.lantern.orientation = Quaternion::rotation_z(0.0)
* Quaternion::rotation_x(0.7)
* Quaternion::rotation_y(-0.8);
next.hold.scale = Vec3::one() * 0.0;
next.glider.position = Vec3::new(0.0, 0.0, 10.0);
next.glider.scale = Vec3::one() * 0.0;
next.control_l.scale = Vec3::one();
next.control_r.scale = Vec3::one();
next.second.scale = match (
active_tool_kind.map(|tk| tk.hands()),

View File

@ -41,7 +41,7 @@ impl Animation for StandAnimation {
);
next.head.position = Vec3::new(
0.0,
-2.0 + skeleton_attr.head.0,
skeleton_attr.head.0,
skeleton_attr.head.1 + slow * 0.3 + breathe * -0.05,
);
next.head.orientation = Quaternion::rotation_z(head_look.x)
@ -85,7 +85,7 @@ impl Animation for StandAnimation {
);
next.hand_l.orientation = Quaternion::rotation_x(slow * -0.06 + impact * -0.1);
next.hand_l.scale = Vec3::one();
next.hand_l.scale = Vec3::one() * 1.04;
next.hand_r.position = Vec3::new(
skeleton_attr.hand.0,
@ -93,7 +93,7 @@ impl Animation for StandAnimation {
skeleton_attr.hand.2 + slow * 0.5 + impact * -0.1,
);
next.hand_r.orientation = Quaternion::rotation_x(slow * -0.06 + impact * -0.1);
next.hand_r.scale = Vec3::one();
next.hand_r.scale = Vec3::one() * 1.04;
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
@ -178,12 +178,6 @@ impl Animation for StandAnimation {
next.torso.orientation = Quaternion::rotation_x(0.0);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
next.control.scale = Vec3::one();
next.control_l.scale = Vec3::one();
next.control_r.scale = Vec3::one();
next.second.scale = match (
active_tool_kind.map(|tk| tk.hands()),
second_tool_kind.map(|tk| tk.hands()),

View File

@ -114,7 +114,6 @@ impl Animation for SwimAnimation {
-10.0 + skeleton_attr.chest.1 + short * 0.3 * intensity,
);
next.chest.orientation = Quaternion::rotation_z(short * 0.1 * intensity);
next.chest.scale = Vec3::one();
next.belt.position = Vec3::new(0.0, skeleton_attr.belt.0, skeleton_attr.belt.1);
next.belt.orientation = Quaternion::rotation_x(velocity.z.abs() * -0.005 + abstilt * 1.0)
@ -136,7 +135,7 @@ impl Animation for SwimAnimation {
);
next.hand_l.orientation = Quaternion::rotation_x(1.5 + foot * -1.2 * intensity * squash)
* Quaternion::rotation_y(0.4 + foot * -0.35);
next.hand_l.scale = Vec3::one();
next.hand_l.scale = Vec3::one() * 1.04;
next.hand_r.position = Vec3::new(
1.0 + skeleton_attr.hand.0,
@ -145,7 +144,7 @@ impl Animation for SwimAnimation {
);
next.hand_r.orientation = Quaternion::rotation_x(1.5 + foot * 1.2 * intensity * squash)
* Quaternion::rotation_y(-0.4 + foot * -0.35);
next.hand_r.scale = Vec3::one();
next.hand_r.scale = Vec3::one() * 1.04;
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
@ -154,7 +153,6 @@ impl Animation for SwimAnimation {
);
next.foot_l.orientation =
Quaternion::rotation_x(-0.8 * squash + footrotl * 0.4 * intensity * squash);
next.foot_l.scale = Vec3::one();
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
@ -163,7 +161,6 @@ impl Animation for SwimAnimation {
);
next.foot_r.orientation =
Quaternion::rotation_x(-0.8 * squash + footrotr * 0.4 * intensity * squash);
next.foot_r.scale = Vec3::one();
next.shoulder_l.position = Vec3::new(
-skeleton_attr.shoulder.0,
@ -200,7 +197,6 @@ impl Animation for SwimAnimation {
next.main.orientation = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
},
}
next.main.scale = Vec3::one();
match second_tool_kind {
Some(ToolKind::Dagger(_)) => {
@ -226,7 +222,6 @@ impl Animation for SwimAnimation {
skeleton_attr.lantern.1,
skeleton_attr.lantern.2,
);
next.lantern.orientation = Quaternion::rotation_x(0.0) * Quaternion::rotation_y(0.0);
next.lantern.scale = Vec3::one() * 0.65;
next.hold.scale = Vec3::one() * 0.0;
@ -243,12 +238,6 @@ impl Animation for SwimAnimation {
* Quaternion::rotation_z(tilt * 8.0);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
next.control.scale = Vec3::one(); //avgspeed*-0.14*reverse +
next.control_l.scale = Vec3::one();
next.control_r.scale = Vec3::one();
next.second.scale = match (
active_tool_kind.map(|tk| tk.hands()),
second_tool_kind.map(|tk| tk.hands()),

View File

@ -75,7 +75,6 @@ impl Animation for SwimWieldAnimation {
-10.0 + skeleton_attr.foot.2 + footrotl * 3.0 * intensity,
);
next.foot_l.orientation = Quaternion::rotation_x(-0.8 + footrotl * 0.4 * intensity);
next.foot_l.scale = Vec3::one();
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
@ -83,7 +82,6 @@ impl Animation for SwimWieldAnimation {
-10.0 + skeleton_attr.foot.2 + footrotr * 3.0 * intensity,
);
next.foot_r.orientation = Quaternion::rotation_x(-0.8 + footrotr * 0.4 * intensity);
next.foot_r.scale = Vec3::one();
next.hold.scale = Vec3::one() * 0.0;

View File

@ -62,15 +62,11 @@ impl Animation for WieldAnimation {
let noiseb = (anim_time as f32 * 19.0 + PI / 4.0).sin();
if speed > 0.5 {
next.torso.position = Vec3::new(0.0, 0.0, 0.0) * skeleton_attr.scaler;
next.torso.orientation = Quaternion::rotation_x(-0.2);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
next.back.position = Vec3::new(0.0, skeleton_attr.back.0, skeleton_attr.back.1);
next.back.orientation = Quaternion::rotation_x(
(-0.5 + short * 0.3 + noisea * 0.3 + noiseb * 0.3).min(-0.1),
);
next.back.scale = Vec3::one() * 1.02;
} else {
next.head.position = Vec3::new(
0.0,
@ -79,15 +75,12 @@ impl Animation for WieldAnimation {
);
next.head.orientation =
Quaternion::rotation_z(head_look.x) * Quaternion::rotation_x(head_look.y.abs());
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
next.chest.position = Vec3::new(
0.0 + slowalt * 0.5,
skeleton_attr.chest.0,
skeleton_attr.chest.1 + u_slow * 0.5,
);
next.torso.position = Vec3::new(0.0, 0.0, 0.0) * skeleton_attr.scaler;
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
@ -107,39 +100,29 @@ impl Animation for WieldAnimation {
Quaternion::rotation_y(u_slowalt * 0.04) * Quaternion::rotation_z(0.15);
next.belt.position = Vec3::new(0.0, skeleton_attr.belt.0, skeleton_attr.belt.1);
next.belt.orientation =
Quaternion::rotation_y(u_slowalt * 0.03) * Quaternion::rotation_z(0.22);
next.belt.scale = Vec3::one() * 1.02;
next.back.position = Vec3::new(0.0, skeleton_attr.back.0, skeleton_attr.back.1);
next.back.orientation = Quaternion::rotation_x(-0.2);
next.back.scale = Vec3::one() * 1.02;
next.shorts.position = Vec3::new(0.0, skeleton_attr.shorts.0, skeleton_attr.shorts.1);
next.shorts.orientation = Quaternion::rotation_z(0.3);
}
match active_tool_kind {
//TODO: Inventory
Some(ToolKind::Sword(_)) => {
next.hand_l.position = Vec3::new(-0.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, 0.0, 2.0);
next.main.orientation = Quaternion::rotation_x(-0.1);
next.control.position = Vec3::new(-7.0, 7.0, 2.0);
next.control.orientation = Quaternion::rotation_x(u_slow * 0.15)
* Quaternion::rotation_z(u_slowalt * 0.08);
next.control.scale = Vec3::one();
},
Some(ToolKind::Dagger(_)) => {
// hands should be larger when holding a dagger grip,
// also reduce flicker with overlapping polygons
let hand_scale = 1.12;
next.control.position = Vec3::new(0.0, 0.0, 0.0);
@ -147,7 +130,6 @@ impl Animation for WieldAnimation {
next.hand_l.orientation = Quaternion::rotation_x(0.0 * PI)
* Quaternion::rotation_y(0.0 * PI)
* Quaternion::rotation_z(0.0 * PI);
next.hand_l.scale = Vec3::one() * hand_scale;
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_x(0.0 * PI)
@ -160,13 +142,11 @@ impl Animation for WieldAnimation {
next.hand_r.orientation = Quaternion::rotation_x(0.0 * PI)
* Quaternion::rotation_y(0.0 * PI)
* Quaternion::rotation_z(0.0 * PI);
next.hand_r.scale = Vec3::one() * hand_scale;
next.second.position = Vec3::new(0.0, 0.0, 0.0);
next.second.orientation = Quaternion::rotation_x(0.0 * PI)
* Quaternion::rotation_y(0.0 * PI)
* Quaternion::rotation_z(0.0 * PI);
next.second.scale = Vec3::one();
next.control_r.position = Vec3::new(7.0, 0.0, 0.0);
},
@ -174,12 +154,11 @@ impl Animation for WieldAnimation {
if speed < 0.5 {
next.head.position = Vec3::new(
0.0,
-3.5 + skeleton_attr.head.0,
-1.5 + skeleton_attr.head.0,
skeleton_attr.head.1 + u_slow * 0.1,
);
next.head.orientation = Quaternion::rotation_z(head_look.x)
* Quaternion::rotation_x(0.35 + head_look.y.abs());
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
next.chest.orientation = Quaternion::rotation_x(-0.35)
* Quaternion::rotation_y(u_slowalt * 0.04)
* Quaternion::rotation_z(0.15);
@ -195,23 +174,19 @@ impl Animation for WieldAnimation {
next.control.orientation = Quaternion::rotation_x(1.8)
* Quaternion::rotation_y(-0.5)
* Quaternion::rotation_z(PI - 0.2);
next.control.scale = Vec3::one();
} else {
next.control.orientation = Quaternion::rotation_x(2.1)
* Quaternion::rotation_y(-0.4)
* Quaternion::rotation_z(PI - 0.2);
next.control.scale = Vec3::one();
}
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)
@ -223,10 +198,8 @@ impl Animation for WieldAnimation {
next.hand_l.position = Vec3::new(-12.0, 0.0, 0.0);
next.hand_l.orientation =
Quaternion::rotation_x(-0.0) * 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(0.0) * Quaternion::rotation_y(0.0);
next.hand_r.scale = Vec3::one() * 1.06;
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation =
Quaternion::rotation_y(-1.57) * Quaternion::rotation_z(1.57);
@ -235,7 +208,6 @@ impl Animation for WieldAnimation {
next.control.orientation = Quaternion::rotation_x(0.3 + u_slow * 0.15)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(u_slowalt * 0.08);
next.control.scale = Vec3::one();
},
Some(ToolKind::Staff(_)) | Some(ToolKind::Sceptre(_)) => {
if speed > 0.5 && velocity.z == 0.0 {
@ -256,27 +228,19 @@ impl Animation for WieldAnimation {
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.scale = Vec3::one() * 1.05;
next.main.position = Vec3::new(0.0, 0.0, 13.2);
next.main.orientation = Quaternion::rotation_y(3.14);
next.control.orientation = Quaternion::rotation_x(-0.3 + u_slow * 0.1)
* Quaternion::rotation_y(0.15)
* Quaternion::rotation_z(u_slowalt * 0.1);
next.control.scale = Vec3::one();
},
Some(ToolKind::Shield(_)) => {
// hands should be larger when holding a dagger grip,
// also reduce flicker with overlapping polygons
let hand_scale = 1.12;
next.control.position = Vec3::new(0.0, 0.0, 0.0);
next.hand_l.position = Vec3::new(0.0, 0.0, 0.0);
next.hand_l.orientation = Quaternion::rotation_x(0.0 * PI);
next.hand_l.scale = Vec3::one() * hand_scale;
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_x(0.0 * PI);
@ -287,11 +251,9 @@ impl Animation for WieldAnimation {
next.hand_r.orientation = Quaternion::rotation_x(0.0 * PI)
* Quaternion::rotation_y(0.0 * PI)
* Quaternion::rotation_z(0.0 * PI);
next.hand_r.scale = Vec3::one() * hand_scale;
next.second.position = Vec3::new(0.0, 0.0, 0.0);
next.second.orientation = Quaternion::rotation_x(0.0 * PI);
next.second.scale = Vec3::one();
next.control_r.position = Vec3::new(7.0, 0.0, 0.0);
},
@ -300,12 +262,10 @@ impl Animation for WieldAnimation {
next.hand_l.orientation = Quaternion::rotation_x(1.20)
* Quaternion::rotation_y(-0.6)
* Quaternion::rotation_z(-0.3);
next.hand_l.scale = Vec3::one() * 1.05;
next.hand_r.position = Vec3::new(5.9, 4.5, -5.0);
next.hand_r.orientation = Quaternion::rotation_x(1.20)
* Quaternion::rotation_y(-0.6)
* Quaternion::rotation_z(-0.3);
next.hand_r.scale = Vec3::one() * 1.05;
next.main.position = Vec3::new(3.0, 2.0, -13.0);
next.main.orientation = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(0.3)
@ -320,36 +280,22 @@ impl Animation for WieldAnimation {
next.control.position = Vec3::new(-7.0, 6.0, 6.0);
next.control.orientation =
Quaternion::rotation_x(u_slow * 0.2) * Quaternion::rotation_z(u_slowalt * 0.1);
next.control.scale = Vec3::one();
},
Some(ToolKind::Debug(_)) => {
next.hand_l.position = Vec3::new(-7.0, 4.0, 3.0);
next.hand_l.orientation = Quaternion::rotation_x(1.27)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.hand_l.scale = Vec3::one() * 1.01;
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_z(0.0)
* Quaternion::rotation_x(PI)
* Quaternion::rotation_y(0.0);
next.main.scale = Vec3::one();
next.torso.position = Vec3::new(0.0, 0.0, 0.1) * skeleton_attr.scaler;
next.torso.orientation = Quaternion::rotation_x(0.0);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
next.main.orientation = Quaternion::rotation_x(PI);
},
Some(ToolKind::Farming(_)) => {
if speed < 0.5 {
next.head.orientation = Quaternion::rotation_z(head_look.x)
* Quaternion::rotation_x(-0.2 + head_look.y.abs());
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
}
next.hand_l.position = Vec3::new(9.0, 1.0, 1.0);
next.hand_l.orientation =
Quaternion::rotation_x(1.57) * Quaternion::rotation_y(0.0);
next.hand_l.scale = Vec3::one() * 1.05;
next.hand_l.orientation = Quaternion::rotation_x(1.57);
next.hand_r.position = Vec3::new(9.0, 1.0, 11.0);
next.hand_r.orientation = Quaternion::rotation_x(1.57);
next.hand_r.scale = Vec3::one() * 1.05;
next.main.position = Vec3::new(7.5, 7.5, 13.2);
next.main.orientation = Quaternion::rotation_y(3.14);
@ -357,15 +303,10 @@ impl Animation for WieldAnimation {
next.control.orientation = Quaternion::rotation_x(u_slow * 0.1)
* Quaternion::rotation_y(0.6 + u_slow * 0.1)
* Quaternion::rotation_z(u_slowalt * 0.1);
next.control.scale = Vec3::one();
},
_ => {},
}
next.control_l.scale = Vec3::one();
next.control_r.scale = Vec3::one();
next.second.scale = match (
active_tool_kind.map(|tk| tk.hands()),
second_tool_kind.map(|tk| tk.hands()),

View File

@ -942,7 +942,7 @@ impl FigureMgr {
},
CharacterState::Sneak { .. } => {
anim::character::SneakAnimation::update_skeleton(
&CharacterSkeleton::default(),
&target_base,
(active_tool_kind, vel.0, ori, state.last_ori, time),
state.state_time,
&mut state_animation_rate,
@ -1190,7 +1190,7 @@ impl FigureMgr {
}
},
CharacterState::BasicBlock { .. } => {
anim::character::BlockIdleAnimation::update_skeleton(
anim::character::BlockAnimation::update_skeleton(
&CharacterSkeleton::default(),
(active_tool_kind, second_tool_kind, time),
state.state_time,
@ -1254,7 +1254,7 @@ impl FigureMgr {
},
CharacterState::Climb { .. } => {
anim::character::ClimbAnimation::update_skeleton(
&CharacterSkeleton::default(),
&target_base,
(active_tool_kind, second_tool_kind, vel.0, ori, time),
state.state_time,
&mut state_animation_rate,
@ -1263,7 +1263,7 @@ impl FigureMgr {
},
CharacterState::Sit { .. } => {
anim::character::SitAnimation::update_skeleton(
&CharacterSkeleton::default(),
&target_base,
(active_tool_kind, second_tool_kind, time),
state.state_time,
&mut state_animation_rate,
@ -1272,7 +1272,7 @@ impl FigureMgr {
},
CharacterState::GlideWield { .. } => {
anim::character::GlideWieldAnimation::update_skeleton(
&CharacterSkeleton::default(),
&target_base,
(
active_tool_kind,
second_tool_kind,
@ -1288,7 +1288,7 @@ impl FigureMgr {
},
CharacterState::Dance { .. } => {
anim::character::DanceAnimation::update_skeleton(
&CharacterSkeleton::default(),
&target_base,
(active_tool_kind, second_tool_kind, time),
state.state_time,
&mut state_animation_rate,