rewrote the whole stupid skeleton to work much smarter

This commit is contained in:
jshipsey 2020-03-22 16:06:53 -04:00
parent 68e3e36c6a
commit 9cbbe0311f
17 changed files with 528 additions and 156 deletions

View File

@ -52,31 +52,28 @@ impl Animation for AttackAnimation {
Some(ToolKind::Sword(_)) => { Some(ToolKind::Sword(_)) => {
next.head.offset = Vec3::new( next.head.offset = Vec3::new(
0.0 + skeleton_attr.neck_right, 0.0 + skeleton_attr.neck_right,
-2.0 + skeleton_attr.neck_forward + decel * 0.8, -2.0 + skeleton_attr.neck_forward,
skeleton_attr.neck_height + 21.0, skeleton_attr.neck_height + 14.0,
); );
next.head.ori = Quaternion::rotation_z(decel * 0.25) next.head.ori = Quaternion::rotation_z(slow * 0.08)
* Quaternion::rotation_x(0.0 + decel * 0.1) * Quaternion::rotation_x(0.0 + slow * 0.08)
* Quaternion::rotation_y(decel * -0.1); * Quaternion::rotation_y(slow * -0.08);
next.head.scale = Vec3::one() * skeleton_attr.head_scale; next.head.scale = Vec3::one() * skeleton_attr.head_scale;
next.chest.offset = Vec3::new(0.0, 0.0, 7.0); next.chest.offset = Vec3::new(0.0, 0.0, 7.0);
next.chest.ori = Quaternion::rotation_z(decel * -0.2) next.chest.ori = Quaternion::rotation_z(slow * -0.2)
* Quaternion::rotation_x(0.0 + decel * -0.2) * Quaternion::rotation_x(0.0 + slow * -0.2)
* Quaternion::rotation_y(decel * 0.2); * Quaternion::rotation_y(slow * 0.2);
next.chest.scale = Vec3::one(); next.chest.scale = Vec3::one();
next.belt.offset = Vec3::new(0.0, 0.0, 5.0); next.belt.offset = Vec3::new(0.0, 0.0, -2.0);
next.belt.ori = Quaternion::rotation_z(decel * -0.1) next.belt.ori = next.chest.ori * -0.2;
* Quaternion::rotation_x(0.0 + decel * -0.1)
* Quaternion::rotation_y(decel * 0.1);
next.belt.scale = Vec3::one(); next.belt.scale = Vec3::one();
next.shorts.offset = Vec3::new(0.0, 0.0, 2.0); next.shorts.offset = Vec3::new(0.0, 0.0, -5.0);
next.belt.ori = Quaternion::rotation_z(decel * -0.08) next.shorts.ori = next.chest.ori * -0.15;
* Quaternion::rotation_x(0.0 + decel * -0.08)
* Quaternion::rotation_y(decel * 0.08);
next.shorts.scale = Vec3::one(); next.shorts.scale = Vec3::one();
next.l_hand.offset = Vec3::new(0.0, 1.0, 0.0); next.l_hand.offset = Vec3::new(0.0, 1.0, 0.0);
next.l_hand.ori = Quaternion::rotation_x(1.27); next.l_hand.ori = Quaternion::rotation_x(1.27);
next.l_hand.scale = Vec3::one() * 1.04; next.l_hand.scale = Vec3::one() * 1.04;
@ -106,7 +103,7 @@ impl Animation for AttackAnimation {
next.head.offset = Vec3::new( next.head.offset = Vec3::new(
0.0 + skeleton_attr.neck_right + slowax * 2.0, 0.0 + skeleton_attr.neck_right + slowax * 2.0,
-2.0 + skeleton_attr.neck_forward + slowax * -2.0, -2.0 + skeleton_attr.neck_forward + slowax * -2.0,
skeleton_attr.neck_height + 20.0, skeleton_attr.neck_height + 13.0,
); );
next.head.ori = Quaternion::rotation_z(slowax * 0.25) next.head.ori = Quaternion::rotation_z(slowax * 0.25)
* Quaternion::rotation_x(0.0 + slowax * 0.2) * Quaternion::rotation_x(0.0 + slowax * 0.2)
@ -119,16 +116,12 @@ impl Animation for AttackAnimation {
* Quaternion::rotation_y(slowax * 0.2); * Quaternion::rotation_y(slowax * 0.2);
next.chest.scale = Vec3::one(); next.chest.scale = Vec3::one();
next.belt.offset = Vec3::new(0.0, 0.0, 5.0); next.belt.offset = Vec3::new(0.0, 0.0, -2.0);
next.belt.ori = Quaternion::rotation_z(slowax * 0.1) next.belt.ori = next.chest.ori * -0.2;
* Quaternion::rotation_x(0.0 + slowax * 0.1)
* Quaternion::rotation_y(slowax * 0.1);
next.belt.scale = Vec3::one(); next.belt.scale = Vec3::one();
next.shorts.offset = Vec3::new(0.0, 0.0, 2.0); next.shorts.offset = Vec3::new(0.0, 0.0, -5.0);
next.belt.ori = Quaternion::rotation_z(slowax * 0.08) next.shorts.ori = next.chest.ori * -0.15;
* Quaternion::rotation_x(0.0 + slowax * 0.08)
* Quaternion::rotation_y(slowax * 0.08);
next.shorts.scale = Vec3::one(); next.shorts.scale = Vec3::one();
next.l_hand.offset = Vec3::new(-4.0, 3.0, 2.0); next.l_hand.offset = Vec3::new(-4.0, 3.0, 2.0);
@ -155,8 +148,6 @@ impl Animation for AttackAnimation {
}, },
Some(ToolKind::Hammer(_)) => { Some(ToolKind::Hammer(_)) => {
next.l_hand.offset = Vec3::new(0.0, 3.0, 8.0); next.l_hand.offset = Vec3::new(0.0, 3.0, 8.0);
//0,1,5
next.l_hand.ori = Quaternion::rotation_x(1.27); next.l_hand.ori = Quaternion::rotation_x(1.27);
next.l_hand.scale = Vec3::one() * 1.05; next.l_hand.scale = Vec3::one() * 1.05;
next.r_hand.offset = Vec3::new(0.0, 0.0, -3.0); next.r_hand.offset = Vec3::new(0.0, 0.0, -3.0);
@ -170,7 +161,7 @@ impl Animation for AttackAnimation {
next.head.offset = Vec3::new( next.head.offset = Vec3::new(
0.0 + skeleton_attr.neck_right + slower * 3.0, 0.0 + skeleton_attr.neck_right + slower * 3.0,
-2.0 + skeleton_attr.neck_forward + slower * -3.0, -2.0 + skeleton_attr.neck_forward + slower * -3.0,
skeleton_attr.neck_height + 19.0, skeleton_attr.neck_height + 12.0,
); );
next.head.ori = Quaternion::rotation_z(slower * 0.25) next.head.ori = Quaternion::rotation_z(slower * 0.25)
* Quaternion::rotation_x(0.0 + slower * 0.2) * Quaternion::rotation_x(0.0 + slower * 0.2)
@ -183,16 +174,12 @@ impl Animation for AttackAnimation {
* Quaternion::rotation_y(slower * 0.2); * Quaternion::rotation_y(slower * 0.2);
next.chest.scale = Vec3::one(); next.chest.scale = Vec3::one();
next.belt.offset = Vec3::new(0.0, 0.0, 5.0); next.belt.offset = Vec3::new(0.0, 0.0, -2.0);
next.belt.ori = Quaternion::rotation_z(slower * 0.1) next.belt.ori = next.chest.ori * -0.2;
* Quaternion::rotation_x(0.0 + slower * 0.1)
* Quaternion::rotation_y(slower * 0.1);
next.belt.scale = Vec3::one(); next.belt.scale = Vec3::one();
next.shorts.offset = Vec3::new(0.0, 0.0, 2.0); next.shorts.offset = Vec3::new(0.0, 0.0, -5.0);
next.belt.ori = Quaternion::rotation_z(slower * 0.08) next.shorts.ori = next.chest.ori * -0.15;
* Quaternion::rotation_x(0.0 + slower * 0.08)
* Quaternion::rotation_y(slower * 0.08);
next.shorts.scale = Vec3::one(); next.shorts.scale = Vec3::one();
next.control.offset = Vec3::new(-6.0, 3.0, 8.0 + slower * 5.0); next.control.offset = Vec3::new(-6.0, 3.0, 8.0 + slower * 5.0);
@ -205,7 +192,7 @@ impl Animation for AttackAnimation {
next.head.offset = Vec3::new( next.head.offset = Vec3::new(
0.0 + skeleton_attr.neck_right, 0.0 + skeleton_attr.neck_right,
-2.0 + skeleton_attr.neck_forward + decel * 0.8, -2.0 + skeleton_attr.neck_forward + decel * 0.8,
skeleton_attr.neck_height + 21.0, skeleton_attr.neck_height + 14.0,
); );
next.head.ori = Quaternion::rotation_z(decel * 0.25) next.head.ori = Quaternion::rotation_z(decel * 0.25)
* Quaternion::rotation_x(0.0 + decel * 0.1) * Quaternion::rotation_x(0.0 + decel * 0.1)
@ -218,13 +205,13 @@ impl Animation for AttackAnimation {
* Quaternion::rotation_y(decel * 0.2); * Quaternion::rotation_y(decel * 0.2);
next.chest.scale = Vec3::one(); next.chest.scale = Vec3::one();
next.belt.offset = Vec3::new(0.0, 0.0, 5.0); next.belt.offset = Vec3::new(0.0, 0.0, -2.0);
next.belt.ori = Quaternion::rotation_z(decel * -0.1) next.belt.ori = Quaternion::rotation_z(decel * -0.1)
* Quaternion::rotation_x(0.0 + decel * -0.1) * Quaternion::rotation_x(0.0 + decel * -0.1)
* Quaternion::rotation_y(decel * 0.1); * Quaternion::rotation_y(decel * 0.1);
next.belt.scale = Vec3::one(); next.belt.scale = Vec3::one();
next.shorts.offset = Vec3::new(0.0, 0.0, 2.0); next.shorts.offset = Vec3::new(0.0, 0.0, -5.0);
next.belt.ori = Quaternion::rotation_z(decel * -0.08) next.belt.ori = Quaternion::rotation_z(decel * -0.08)
* Quaternion::rotation_x(0.0 + decel * -0.08) * Quaternion::rotation_x(0.0 + decel * -0.08)
* Quaternion::rotation_y(decel * 0.08); * Quaternion::rotation_y(decel * 0.08);
@ -305,8 +292,8 @@ impl Animation for AttackAnimation {
-2.0 + skeleton_attr.neck_forward + decel * 0.8, -2.0 + skeleton_attr.neck_forward + decel * 0.8,
skeleton_attr.neck_height + 21.0, skeleton_attr.neck_height + 21.0,
); );
next.head.ori = Quaternion::rotation_z(decel * 0.25) next.head.ori = Quaternion::rotation_z(decel * -0.25)
* Quaternion::rotation_x(0.0 + decel * 0.1) * Quaternion::rotation_x(0.0 + decel * -0.1)
* Quaternion::rotation_y(decel * -0.1); * Quaternion::rotation_y(decel * -0.1);
next.head.scale = Vec3::one() * skeleton_attr.head_scale; next.head.scale = Vec3::one() * skeleton_attr.head_scale;

View File

@ -14,75 +14,455 @@ impl Animation for ChargeAnimation {
fn update_skeleton( fn update_skeleton(
skeleton: &Self::Skeleton, skeleton: &Self::Skeleton,
(_active_tool_kind, _global_time): Self::Dependency, (active_tool_kind, _global_time): Self::Dependency,
anim_time: f64, anim_time: f64,
_rate: &mut f32, rate: &mut f32,
skeleton_attr: &SkeletonAttr, skeleton_attr: &SkeletonAttr,
) -> Self::Skeleton { ) -> Self::Skeleton {
*rate = 1.0;
let mut next = (*skeleton).clone(); let mut next = (*skeleton).clone();
let wave_stop_quick = (anim_time as f32 * 8.0).min(PI / 2.0).sin(); let lab = 1.0;
let foot = (((5.0)
/ (1.1 + 3.9 * ((anim_time as f32 * lab as f32 * 15.0).sin()).powf(2.0 as f32)))
.sqrt())
* ((anim_time as f32 * lab as f32 * 15.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 slow = (((5.0)
/ (1.1 + 3.9 * ((anim_time as f32 * lab as f32 * 12.4).sin()).powf(2.0 as f32)))
.sqrt())
* ((anim_time as f32 * lab as f32 * 12.4).sin());
let slower = (((5.0)
/ (0.1 + 4.9 * ((anim_time as f32 * lab as f32 * 4.0).sin()).powf(2.0 as f32)))
.sqrt())
* ((anim_time as f32 * lab as f32 * 4.0).sin());
let slowax = (((5.0)
/ (0.1 + 4.9 * ((anim_time as f32 * lab as f32 * 4.0 + 1.9).cos()).powf(2.0 as f32)))
.sqrt())
* ((anim_time as f32 * lab as f32 * 4.0 + 1.9).cos());
let constant = 8.0; let constant = 8.0;
let wave_cos = (((5.0) let wave_cos = (((5.0)
/ (1.1 + 3.9 * ((anim_time as f32 * constant as f32 * 2.4).sin()).powf(2.0 as f32))) / (1.1 + 3.9 * ((anim_time as f32 * constant as f32 * 2.4).sin()).powf(2.0 as f32)))
.sqrt()) .sqrt())
* ((anim_time as f32 * constant as f32 * 1.5).sin()); * ((anim_time as f32 * constant as f32 * 1.5).sin());
let wave_cos_dub = (((5.0)
/ (1.1 + 3.9 * ((anim_time as f32 * constant as f32 * 4.8).sin()).powf(2.0 as f32)))
.sqrt())
* ((anim_time as f32 * constant as f32 * 1.5).sin());
next.head.offset = Vec3::new( next.head.offset = Vec3::new(
0.0 + skeleton_attr.neck_right, 0.0 + skeleton_attr.neck_right,
5.0 + skeleton_attr.neck_forward, 5.0 + skeleton_attr.neck_forward,
skeleton_attr.neck_height + 19.0 + wave_cos * 2.0, skeleton_attr.neck_height + 19.0 + wave_cos * 2.0,
); );
next.head.ori =
Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0) * Quaternion::rotation_y(0.0);
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
next.chest.offset = Vec3::new(0.0, 0.0, 7.0 + wave_cos * 2.0); match active_tool_kind {
next.chest.ori = Quaternion::rotation_x(-0.7) * Quaternion::rotation_z(-0.9); //TODO: Inventory
next.chest.scale = Vec3::one(); Some(ToolKind::Sword(_)) => {
next.head.offset = Vec3::new(
0.0 + skeleton_attr.neck_right,
-2.0 + skeleton_attr.neck_forward,
skeleton_attr.neck_height + 12.0,
);
next.head.ori = Quaternion::rotation_z(0.0)
* Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(0.0);
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
next.belt.offset = Vec3::new(0.0, 0.0, 5.0 + wave_cos * 2.0); next.chest.offset = Vec3::new(0.0, 0.0, 7.0 + wave_cos * 2.0);
next.belt.ori = Quaternion::rotation_x(-0.6) * Quaternion::rotation_z(-0.9); next.chest.ori = Quaternion::rotation_x(-0.7) * Quaternion::rotation_z(-0.9);
next.belt.scale = Vec3::one(); next.chest.scale = Vec3::one();
next.shorts.offset = Vec3::new(0.0, 0.0, 2.0 + wave_cos * 2.0); next.belt.offset = Vec3::new(0.0, 0.0, -2.0);
next.shorts.ori = Quaternion::rotation_x(-0.5) * Quaternion::rotation_z(-0.9); next.belt.ori = Quaternion::rotation_x(0.1) * Quaternion::rotation_z(0.0);
next.shorts.scale = Vec3::one(); next.belt.scale = Vec3::one();
next.l_hand.offset = Vec3::new(-8.0, -7.5, 5.0); next.shorts.offset = Vec3::new(0.0, 0.0, -5.0);
next.l_hand.ori = Quaternion::rotation_z(0.5) next.shorts.ori = Quaternion::rotation_x(0.2) * Quaternion::rotation_z(0.0);
* Quaternion::rotation_x(wave_stop_quick * -1.5 + 0.5 + 1.57) next.shorts.scale = Vec3::one();
* Quaternion::rotation_y(-0.6);
next.l_hand.scale = Vec3::one() * 1.01;
next.r_hand.offset = Vec3::new(-8.0, -8.0, 3.0); next.l_hand.offset = Vec3::new(0.0, 1.0, 0.0);
next.r_hand.ori = Quaternion::rotation_z(0.5) next.l_hand.ori = Quaternion::rotation_x(1.27);
* Quaternion::rotation_x(wave_stop_quick * -1.5 + 0.5 + 1.57) next.l_hand.scale = Vec3::one() * 1.04;
* Quaternion::rotation_y(-0.6); next.r_hand.offset = Vec3::new(0.0, 0.0, -3.0);
next.r_hand.scale = Vec3::one() * 1.01; next.r_hand.ori = Quaternion::rotation_x(1.27);
next.r_hand.scale = Vec3::one() * 1.05;
next.main.offset = Vec3::new(0.0, 6.0, -1.0);
next.main.ori = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.main.scale = Vec3::one();
next.l_foot.offset = Vec3::new(-3.4, 0.0 + wave_cos * 1.0, 6.0 - wave_cos_dub * 0.7); next.control.offset = Vec3::new(-8.0 - slow * 1.0, 3.0 - slow * 5.0, 3.0);
next.l_foot.ori = Quaternion::rotation_x(-0.0 - wave_cos * 0.8); next.control.ori = Quaternion::rotation_x(-1.2)
next.l_foot.scale = Vec3::one(); * Quaternion::rotation_y(slow * 1.5)
* Quaternion::rotation_z(1.4 + slow * 0.5);
next.control.scale = Vec3::one();
next.l_foot.offset = Vec3::new(-3.4, foot * 3.0, 8.0);
next.l_foot.ori = Quaternion::rotation_x(foot * -0.6);
next.l_foot.scale = Vec3::one();
next.r_foot.offset = Vec3::new(3.4, 0.0 - wave_cos * 1.0, 6.0 - wave_cos_dub * 0.7); next.r_foot.offset = Vec3::new(3.4, foot * -3.0, 8.0);
next.r_foot.ori = Quaternion::rotation_x(-0.0 + wave_cos * 0.8); next.r_foot.ori = Quaternion::rotation_x(foot * 0.6);
next.r_foot.scale = Vec3::one(); next.r_foot.scale = Vec3::one();
},
Some(ToolKind::Axe(_)) => {
next.head.offset = Vec3::new(
0.0 + skeleton_attr.neck_right + slowax * 2.0,
-2.0 + skeleton_attr.neck_forward + slowax * -2.0,
skeleton_attr.neck_height + 20.0,
);
next.head.ori = Quaternion::rotation_z(slowax * 0.25)
* Quaternion::rotation_x(0.0 + slowax * 0.2)
* Quaternion::rotation_y(slowax * 0.2);
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
next.main.offset = Vec3::new( next.chest.offset = Vec3::new(0.0, 0.0, 7.0);
-8.0 + skeleton_attr.weapon_x, next.chest.ori = Quaternion::rotation_z(slowax * 0.2)
0.0 + skeleton_attr.weapon_y, * Quaternion::rotation_x(0.0 + slowax * 0.2)
5.0, * Quaternion::rotation_y(slowax * 0.2);
); next.chest.scale = Vec3::one();
next.main.ori = Quaternion::rotation_z(-0.0)
* Quaternion::rotation_x(wave_stop_quick * -1.5 + 0.7)
* Quaternion::rotation_y(-0.5);
next.main.scale = Vec3::one();
next.belt.offset = Vec3::new(0.0, 0.0, 5.0);
next.belt.ori = Quaternion::rotation_z(slowax * 0.1)
* Quaternion::rotation_x(0.0 + slowax * 0.1)
* Quaternion::rotation_y(slowax * 0.1);
next.belt.scale = Vec3::one();
next.shorts.offset = Vec3::new(0.0, 0.0, 2.0);
next.belt.ori = Quaternion::rotation_z(slowax * 0.08)
* Quaternion::rotation_x(0.0 + slowax * 0.08)
* Quaternion::rotation_y(slowax * 0.08);
next.shorts.scale = Vec3::one();
next.l_hand.offset = Vec3::new(-4.0, 3.0, 2.0);
next.l_hand.ori = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_z(3.14 - 0.3)
* Quaternion::rotation_y(-0.8);
next.l_hand.scale = Vec3::one() * 1.08;
next.r_hand.offset = Vec3::new(-2.5, 9.0, 0.0);
next.r_hand.ori = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_z(3.14 - 0.3)
* Quaternion::rotation_y(-0.8);
next.r_hand.scale = Vec3::one() * 1.06;
next.main.offset = Vec3::new(-6.0, 10.0, -5.0);
next.main.ori = Quaternion::rotation_x(1.27)
* Quaternion::rotation_y(-0.3)
* Quaternion::rotation_z(-0.8);
next.main.scale = Vec3::one();
next.control.offset = Vec3::new(0.0, 0.0 + slowax * 8.2, 6.0);
next.control.ori = Quaternion::rotation_x(0.8)
* Quaternion::rotation_y(-0.3)
* Quaternion::rotation_z(-0.7 + slowax * -1.9);
next.control.scale = Vec3::one();
},
Some(ToolKind::Hammer(_)) => {
next.l_hand.offset = Vec3::new(0.0, 3.0, 8.0);
//0,1,5
next.l_hand.ori = Quaternion::rotation_x(1.27);
next.l_hand.scale = Vec3::one() * 1.05;
next.r_hand.offset = Vec3::new(0.0, 0.0, -3.0);
next.r_hand.ori = Quaternion::rotation_x(1.27);
next.r_hand.scale = Vec3::one() * 1.05;
next.main.offset = Vec3::new(0.0, 6.0, -1.0);
next.main.ori = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.main.scale = Vec3::one();
next.head.offset = Vec3::new(
0.0 + skeleton_attr.neck_right + slower * 3.0,
-2.0 + skeleton_attr.neck_forward + slower * -3.0,
skeleton_attr.neck_height + 19.0,
);
next.head.ori = Quaternion::rotation_z(slower * 0.25)
* Quaternion::rotation_x(0.0 + slower * 0.2)
* Quaternion::rotation_y(slower * 0.2);
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
next.chest.offset = Vec3::new(0.0, 0.0, 7.0);
next.chest.ori = Quaternion::rotation_z(slower * 0.2)
* Quaternion::rotation_x(0.0 + slower * 0.2)
* Quaternion::rotation_y(slower * 0.2);
next.chest.scale = Vec3::one();
next.belt.offset = Vec3::new(0.0, 0.0, 5.0);
next.belt.ori = Quaternion::rotation_z(slower * 0.1)
* Quaternion::rotation_x(0.0 + slower * 0.1)
* Quaternion::rotation_y(slower * 0.1);
next.belt.scale = Vec3::one();
next.shorts.offset = Vec3::new(0.0, 0.0, 2.0);
next.belt.ori = Quaternion::rotation_z(slower * 0.08)
* Quaternion::rotation_x(0.0 + slower * 0.08)
* Quaternion::rotation_y(slower * 0.08);
next.shorts.scale = Vec3::one();
next.control.offset = Vec3::new(-6.0, 3.0, 8.0 + slower * 5.0);
next.control.ori = Quaternion::rotation_x(-0.2 + slower * 2.0)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(1.4 + 1.57);
next.control.scale = Vec3::one();
},
Some(ToolKind::Staff(_)) => {
next.head.offset = Vec3::new(
0.0 + skeleton_attr.neck_right,
-2.0 + skeleton_attr.neck_forward + decel * 0.8,
skeleton_attr.neck_height + 21.0,
);
next.head.ori = 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.offset = Vec3::new(0.0, 0.0, 7.0);
next.chest.ori = Quaternion::rotation_z(decel * -0.2)
* Quaternion::rotation_x(0.0 + decel * -0.2)
* Quaternion::rotation_y(decel * 0.2);
next.chest.scale = Vec3::one();
next.belt.offset = Vec3::new(0.0, 0.0, 5.0);
next.belt.ori = Quaternion::rotation_z(decel * -0.1)
* Quaternion::rotation_x(0.0 + decel * -0.1)
* Quaternion::rotation_y(decel * 0.1);
next.belt.scale = Vec3::one();
next.shorts.offset = Vec3::new(0.0, 0.0, 2.0);
next.belt.ori = Quaternion::rotation_z(decel * -0.08)
* Quaternion::rotation_x(0.0 + decel * -0.08)
* Quaternion::rotation_y(decel * 0.08);
next.shorts.scale = Vec3::one();
next.l_hand.offset = Vec3::new(0.0, 1.0, 0.0);
next.l_hand.ori = Quaternion::rotation_x(1.27);
next.l_hand.scale = Vec3::one() * 1.05;
next.r_hand.offset = Vec3::new(0.0, 0.0, 10.0);
next.r_hand.ori = Quaternion::rotation_x(1.27);
next.r_hand.scale = Vec3::one() * 1.05;
next.main.offset = Vec3::new(0.0, 6.0, -4.0);
next.main.ori = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.main.scale = Vec3::one();
next.control.offset = Vec3::new(-8.0 - slow * 1.0, 3.0 - slow * 5.0, 0.0);
next.control.ori = Quaternion::rotation_x(-1.2)
* Quaternion::rotation_y(slow * 1.5)
* Quaternion::rotation_z(1.4 + slow * 0.5);
next.control.scale = Vec3::one();
},
Some(ToolKind::Shield(_)) => {
next.head.offset = Vec3::new(
0.0 + skeleton_attr.neck_right,
-2.0 + skeleton_attr.neck_forward + decel * 0.8,
skeleton_attr.neck_height + 21.0,
);
next.head.ori = 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.offset = Vec3::new(0.0, 0.0, 7.0);
next.chest.ori = Quaternion::rotation_z(decel * -0.2)
* Quaternion::rotation_x(0.0 + decel * -0.2)
* Quaternion::rotation_y(decel * 0.2);
next.chest.scale = Vec3::one();
next.belt.offset = Vec3::new(0.0, 0.0, 5.0);
next.belt.ori = Quaternion::rotation_z(decel * -0.1)
* Quaternion::rotation_x(0.0 + decel * -0.1)
* Quaternion::rotation_y(decel * 0.1);
next.belt.scale = Vec3::one();
next.shorts.offset = Vec3::new(0.0, 0.0, 2.0);
next.belt.ori = Quaternion::rotation_z(decel * -0.08)
* Quaternion::rotation_x(0.0 + decel * -0.08)
* Quaternion::rotation_y(decel * 0.08);
next.shorts.scale = Vec3::one();
next.l_hand.offset =
Vec3::new(-8.0 + accel_slow * 10.0, 8.0 + accel_fast * 3.0, 0.0);
next.l_hand.ori = Quaternion::rotation_z(-0.8)
* Quaternion::rotation_x(0.0 + accel_med * -0.8)
* Quaternion::rotation_y(0.0 + accel_med * -0.4);
next.l_hand.scale = Vec3::one() * 1.01;
next.r_hand.offset =
Vec3::new(-8.0 + accel_slow * 10.0, 8.0 + accel_fast * 3.0, -2.0);
next.r_hand.ori = Quaternion::rotation_z(-0.8)
* Quaternion::rotation_x(0.0 + accel_med * -0.8)
* Quaternion::rotation_y(0.0 + accel_med * -0.4);
next.r_hand.scale = Vec3::one() * 1.01;
next.main.offset = Vec3::new(
-8.0 + accel_slow * 10.0 + skeleton_attr.weapon_x,
8.0 + accel_fast * 3.0,
0.0,
);
next.main.ori = Quaternion::rotation_z(-0.8)
* Quaternion::rotation_x(0.0 + accel_med * -0.8)
* Quaternion::rotation_y(0.0 + accel_med * -0.4);
next.main.scale = Vec3::one();
},
Some(ToolKind::Bow(_)) => {
next.head.offset = Vec3::new(
0.0 + skeleton_attr.neck_right,
-2.0 + skeleton_attr.neck_forward + decel * 0.8,
skeleton_attr.neck_height + 21.0,
);
next.head.ori = 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.offset = Vec3::new(0.0, 0.0, 7.0);
next.chest.ori = Quaternion::rotation_z(decel * -0.2)
* Quaternion::rotation_x(0.0 + decel * -0.2)
* Quaternion::rotation_y(decel * 0.2);
next.chest.scale = Vec3::one();
next.belt.offset = Vec3::new(0.0, 0.0, 5.0);
next.belt.ori = Quaternion::rotation_z(decel * -0.1)
* Quaternion::rotation_x(0.0 + decel * -0.1)
* Quaternion::rotation_y(decel * 0.1);
next.belt.scale = Vec3::one();
next.shorts.offset = Vec3::new(0.0, 0.0, 2.0);
next.belt.ori = Quaternion::rotation_z(decel * -0.08)
* Quaternion::rotation_x(0.0 + decel * -0.08)
* Quaternion::rotation_y(decel * 0.08);
next.shorts.scale = Vec3::one();
next.l_hand.offset = Vec3::new(1.0, -4.0, -1.0);
next.l_hand.ori = Quaternion::rotation_x(1.27)
* Quaternion::rotation_y(-0.6)
* Quaternion::rotation_z(-0.3);
next.l_hand.scale = Vec3::one() * 1.05;
next.r_hand.offset = Vec3::new(3.0, -1.0, -6.0);
next.r_hand.ori = Quaternion::rotation_x(1.27)
* Quaternion::rotation_y(-0.6)
* Quaternion::rotation_z(-0.3);
next.r_hand.scale = Vec3::one() * 1.05;
next.main.offset = Vec3::new(3.0, 2.0, -13.0);
next.main.ori = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(0.3)
* Quaternion::rotation_z(-0.6);
next.main.scale = Vec3::one();
next.control.offset = Vec3::new(-7.0, 6.0, 6.0);
next.control.ori = Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.control.scale = Vec3::one();
},
Some(ToolKind::Dagger(_)) => {
next.head.offset = Vec3::new(
0.0 + skeleton_attr.neck_right,
-2.0 + skeleton_attr.neck_forward + decel * 0.8,
skeleton_attr.neck_height + 21.0,
);
next.head.ori = 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.offset = Vec3::new(0.0, 0.0, 7.0);
next.chest.ori = Quaternion::rotation_z(decel * -0.2)
* Quaternion::rotation_x(0.0 + decel * -0.2)
* Quaternion::rotation_y(decel * 0.2);
next.chest.scale = Vec3::one();
next.belt.offset = Vec3::new(0.0, 0.0, 5.0);
next.belt.ori = Quaternion::rotation_z(decel * -0.1)
* Quaternion::rotation_x(0.0 + decel * -0.1)
* Quaternion::rotation_y(decel * 0.1);
next.belt.scale = Vec3::one();
next.shorts.offset = Vec3::new(0.0, 0.0, 2.0);
next.belt.ori = Quaternion::rotation_z(decel * -0.08)
* Quaternion::rotation_x(0.0 + decel * -0.08)
* Quaternion::rotation_y(decel * 0.08);
next.shorts.scale = Vec3::one();
next.l_hand.offset =
Vec3::new(-8.0 + accel_slow * 10.0, 8.0 + accel_fast * 3.0, 0.0);
next.l_hand.ori = Quaternion::rotation_z(-0.8)
* Quaternion::rotation_x(0.0 + accel_med * -0.8)
* Quaternion::rotation_y(0.0 + accel_med * -0.4);
next.l_hand.scale = Vec3::one() * 1.01;
next.r_hand.offset =
Vec3::new(-8.0 + accel_slow * 10.0, 8.0 + accel_fast * 3.0, -2.0);
next.r_hand.ori = Quaternion::rotation_z(-0.8)
* Quaternion::rotation_x(0.0 + accel_med * -0.8)
* Quaternion::rotation_y(0.0 + accel_med * -0.4);
next.r_hand.scale = Vec3::one() * 1.01;
next.main.offset = Vec3::new(
-8.0 + accel_slow * 10.0 + skeleton_attr.weapon_x,
8.0 + accel_fast * 3.0,
0.0,
);
next.main.ori = Quaternion::rotation_z(-0.8)
* Quaternion::rotation_x(0.0 + accel_med * -0.8)
* Quaternion::rotation_y(0.0 + accel_med * -0.4);
next.main.scale = Vec3::one();
},
Some(ToolKind::Debug(_)) => {
next.head.offset = Vec3::new(
0.0 + skeleton_attr.neck_right,
-2.0 + skeleton_attr.neck_forward + decel * 0.8,
skeleton_attr.neck_height + 21.0,
);
next.head.ori = 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.offset = Vec3::new(0.0, 0.0, 7.0);
next.chest.ori = Quaternion::rotation_z(decel * -0.2)
* Quaternion::rotation_x(0.0 + decel * -0.2)
* Quaternion::rotation_y(decel * 0.2);
next.chest.scale = Vec3::one();
next.belt.offset = Vec3::new(0.0, 0.0, 5.0);
next.belt.ori = Quaternion::rotation_z(decel * -0.1)
* Quaternion::rotation_x(0.0 + decel * -0.1)
* Quaternion::rotation_y(decel * 0.1);
next.belt.scale = Vec3::one();
next.shorts.offset = Vec3::new(0.0, 0.0, 2.0);
next.belt.ori = Quaternion::rotation_z(decel * -0.08)
* Quaternion::rotation_x(0.0 + decel * -0.08)
* Quaternion::rotation_y(decel * 0.08);
next.shorts.scale = Vec3::one();
next.l_hand.offset =
Vec3::new(-8.0 + accel_slow * 10.0, 8.0 + accel_fast * 3.0, 0.0);
next.l_hand.ori = Quaternion::rotation_z(-0.8)
* Quaternion::rotation_x(0.0 + accel_med * -0.8)
* Quaternion::rotation_y(0.0 + accel_med * -0.4);
next.l_hand.scale = Vec3::one() * 1.01;
next.r_hand.offset =
Vec3::new(-8.0 + accel_slow * 10.0, 8.0 + accel_fast * 3.0, -2.0);
next.r_hand.ori = Quaternion::rotation_z(-0.8)
* Quaternion::rotation_x(0.0 + accel_med * -0.8)
* Quaternion::rotation_y(0.0 + accel_med * -0.4);
next.r_hand.scale = Vec3::one() * 1.01;
next.main.offset = Vec3::new(
-8.0 + accel_slow * 10.0 + skeleton_attr.weapon_x,
8.0 + accel_fast * 3.0,
0.0,
);
next.main.ori = Quaternion::rotation_z(-0.8)
* Quaternion::rotation_x(0.0 + accel_med * -0.8)
* Quaternion::rotation_y(0.0 + accel_med * -0.4);
next.main.scale = Vec3::one();
},
_ => {},
}
next.l_shoulder.offset = Vec3::new(-5.0, 0.0, 4.7); next.l_shoulder.offset = Vec3::new(-5.0, 0.0, 4.7);
next.l_shoulder.ori = Quaternion::rotation_x(0.0); next.l_shoulder.ori = Quaternion::rotation_x(0.0);
next.l_shoulder.scale = Vec3::one() * 1.1; next.l_shoulder.scale = Vec3::one() * 1.1;
@ -104,10 +484,13 @@ impl Animation for ChargeAnimation {
Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0) * Quaternion::rotation_y(0.0); Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0) * Quaternion::rotation_y(0.0);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler; next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
next.control.offset = Vec3::new(0.0, 0.0, 0.0); next.l_control.offset = Vec3::new(0.0, 0.0, 0.0);
next.control.ori = Quaternion::rotation_x(0.0); next.l_control.ori = Quaternion::rotation_x(0.0);
next.control.scale = Vec3::one(); next.l_control.scale = Vec3::one();
next.r_control.offset = Vec3::new(0.0, 0.0, 0.0);
next.r_control.ori = Quaternion::rotation_x(0.0);
next.r_control.scale = Vec3::one();
next next
} }
} }

View File

@ -36,7 +36,7 @@ impl Animation for ClimbAnimation {
next.head.offset = Vec3::new( next.head.offset = Vec3::new(
0.0, 0.0,
-1.0 + skeleton_attr.neck_forward, -1.0 + skeleton_attr.neck_forward,
skeleton_attr.neck_height + 18.5 + wave_cos * 1.3, skeleton_attr.neck_height + 11.5 + wave_cos * 1.3,
); );
next.head.ori = Quaternion::rotation_z(wave * 0.1) next.head.ori = Quaternion::rotation_z(wave * 0.1)
* Quaternion::rotation_x(0.6) * Quaternion::rotation_x(0.6)
@ -49,11 +49,11 @@ impl Animation for ClimbAnimation {
* Quaternion::rotation_y(wave_test * -0.12); * Quaternion::rotation_y(wave_test * -0.12);
next.chest.scale = Vec3::one(); next.chest.scale = Vec3::one();
next.belt.offset = Vec3::new(0.0, 1.0, 3.5 + wave_cos * 1.1); next.belt.offset = Vec3::new(0.0, 1.0, -3.5 + wave_cos * 1.1);
next.belt.ori = Quaternion::rotation_z(wave_test * 0.25) * Quaternion::rotation_x(0.0); next.belt.ori = Quaternion::rotation_z(wave_test * 0.25) * Quaternion::rotation_x(0.0);
next.belt.scale = Vec3::one(); next.belt.scale = Vec3::one();
next.shorts.offset = Vec3::new(0.0, 1.0, 1.0 + wave_cos * 1.1); next.shorts.offset = Vec3::new(0.0, 1.0, -6.0 + wave_cos * 1.1);
next.shorts.ori = Quaternion::rotation_z(wave_test * 0.25) next.shorts.ori = Quaternion::rotation_z(wave_test * 0.25)
* Quaternion::rotation_x(0.1) * Quaternion::rotation_x(0.1)
* Quaternion::rotation_y(wave_test * 0.10); * Quaternion::rotation_y(wave_test * 0.10);

View File

@ -68,12 +68,12 @@ impl Animation for GlidingAnimation {
next.chest.ori = Quaternion::rotation_z(wave_very_slow_cos * 0.2); next.chest.ori = Quaternion::rotation_z(wave_very_slow_cos * 0.2);
next.chest.scale = Vec3::one(); next.chest.scale = Vec3::one();
next.belt.offset = Vec3::new(0.0, 0.0, -4.0); next.belt.offset = Vec3::new(0.0, 0.0, -2.0);
next.belt.ori = Quaternion::rotation_z(wave_very_slow_cos * 0.25); next.belt.ori = Quaternion::rotation_z(wave_very_slow_cos * 0.25);
next.belt.scale = Vec3::one(); next.belt.scale = Vec3::one();
next.shorts.offset = Vec3::new(0.0, 0.0, -7.0); next.shorts.offset = Vec3::new(0.0, 0.0, -5.0);
next.shorts.ori = Quaternion::rotation_z(wave_very_slow_cos * 0.25); next.shorts.ori = Quaternion::rotation_z(wave_very_slow_cos * 0.35);
next.shorts.scale = Vec3::one(); next.shorts.scale = Vec3::one();
next.l_hand.offset = Vec3::new( next.l_hand.offset = Vec3::new(

View File

@ -36,7 +36,7 @@ impl Animation for IdleAnimation {
next.head.offset = Vec3::new( next.head.offset = Vec3::new(
0.0 + skeleton_attr.neck_right, 0.0 + skeleton_attr.neck_right,
-2.0 + skeleton_attr.neck_forward, -2.0 + skeleton_attr.neck_forward,
skeleton_attr.neck_height + 21.0 + wave_ultra_slow * 0.1, skeleton_attr.neck_height + 14.0 + wave_ultra_slow * 0.1,
); );
/*next.head.ori = /*next.head.ori =
Quaternion::rotation_z(head_look.x) * Quaternion::rotation_x(head_look.y.abs());*/ Quaternion::rotation_z(head_look.x) * Quaternion::rotation_x(head_look.y.abs());*/
@ -47,11 +47,11 @@ impl Animation for IdleAnimation {
next.chest.ori = Quaternion::rotation_x(0.0); next.chest.ori = Quaternion::rotation_x(0.0);
next.chest.scale = Vec3::one() + wave_ultra_slow_abs * 0.05; next.chest.scale = Vec3::one() + wave_ultra_slow_abs * 0.05;
next.belt.offset = Vec3::new(0.0, 0.0, 5.0 + wave_ultra_slow * 0.1); next.belt.offset = Vec3::new(0.0, 0.0, -2.0 + wave_ultra_slow * 0.1);
next.belt.ori = Quaternion::rotation_x(0.0); next.belt.ori = Quaternion::rotation_x(0.0);
next.belt.scale = Vec3::one() + wave_ultra_slow_abs * 0.05; next.belt.scale = Vec3::one() + wave_ultra_slow_abs * 0.05;
next.shorts.offset = Vec3::new(0.0, 0.0, 2.0 + wave_ultra_slow * 0.1); next.shorts.offset = Vec3::new(0.0, 0.0, -5.0 + wave_ultra_slow * 0.1);
next.shorts.ori = Quaternion::rotation_x(0.0); next.shorts.ori = Quaternion::rotation_x(0.0);
next.shorts.scale = Vec3::one(); next.shorts.scale = Vec3::one();

View File

@ -201,9 +201,9 @@ impl Animation for IdleWieldAnimation {
* 0.1, * 0.1,
); );
next.head.offset = Vec3::new( next.head.offset = Vec3::new(
0.0 + skeleton_attr.neck_right + wave_slow_cos * 0.5, 0.0 + skeleton_attr.neck_right,
-2.0 + skeleton_attr.neck_forward, -2.0 + skeleton_attr.neck_forward,
skeleton_attr.neck_height + 21.0 + wave_ultra_slow * 0.6, skeleton_attr.neck_height + 14.0 + wave_ultra_slow * 0.1,
); );
next.head.ori = next.head.ori =
Quaternion::rotation_z(head_look.x) * Quaternion::rotation_x(head_look.y.abs()); Quaternion::rotation_z(head_look.x) * Quaternion::rotation_x(head_look.y.abs());
@ -214,12 +214,12 @@ impl Animation for IdleWieldAnimation {
Quaternion::rotation_y(wave_ultra_slow_cos * 0.04) * Quaternion::rotation_z(0.15); Quaternion::rotation_y(wave_ultra_slow_cos * 0.04) * Quaternion::rotation_z(0.15);
next.chest.scale = Vec3::one(); next.chest.scale = Vec3::one();
next.belt.offset = Vec3::new(0.0 + wave_slow_cos * 0.5, 0.0, 5.0 + wave_ultra_slow * 0.5); next.belt.offset = Vec3::new(0.0, 0.0, -2.0);
next.belt.ori = next.belt.ori =
Quaternion::rotation_y(wave_ultra_slow_cos * 0.03) * Quaternion::rotation_z(0.22); Quaternion::rotation_y(wave_ultra_slow_cos * 0.03) * Quaternion::rotation_z(0.22);
next.belt.scale = Vec3::one() * 1.02; next.belt.scale = Vec3::one() * 1.02;
next.shorts.offset = Vec3::new(0.0 + wave_slow_cos * 0.5, 0.0, 2.0 + wave_ultra_slow * 0.5); next.shorts.offset = Vec3::new(0.0, 0.0, -5.0);
next.shorts.ori = Quaternion::rotation_z(0.3); next.shorts.ori = Quaternion::rotation_z(0.3);
next.shorts.scale = Vec3::one(); next.shorts.scale = Vec3::one();

View File

@ -25,7 +25,7 @@ impl Animation for JumpAnimation {
next.head.offset = Vec3::new( next.head.offset = Vec3::new(
0.0 + skeleton_attr.neck_right, 0.0 + skeleton_attr.neck_right,
-3.0 + skeleton_attr.neck_forward, -3.0 + skeleton_attr.neck_forward,
skeleton_attr.neck_height + 21.0, skeleton_attr.neck_height + 14.0,
); );
next.head.ori = Quaternion::rotation_x(0.25 + wave_stop * 0.1 + wave_slow * 0.04); next.head.ori = Quaternion::rotation_x(0.25 + wave_stop * 0.1 + wave_slow * 0.04);
next.head.scale = Vec3::one() * skeleton_attr.head_scale; next.head.scale = Vec3::one() * skeleton_attr.head_scale;
@ -34,11 +34,11 @@ impl Animation for JumpAnimation {
next.chest.ori = Quaternion::rotation_z(0.0); next.chest.ori = Quaternion::rotation_z(0.0);
next.chest.scale = Vec3::one() * 1.01; next.chest.scale = Vec3::one() * 1.01;
next.belt.offset = Vec3::new(0.0, 0.0, 6.0); next.belt.offset = Vec3::new(0.0, 0.0, -1.0);
next.belt.ori = Quaternion::rotation_z(0.0); next.belt.ori = Quaternion::rotation_z(0.0);
next.belt.scale = Vec3::one(); next.belt.scale = Vec3::one();
next.shorts.offset = Vec3::new(0.0, 0.0, 3.0); next.shorts.offset = Vec3::new(0.0, 0.0, -4.0);
next.shorts.ori = Quaternion::rotation_z(0.0); next.shorts.ori = Quaternion::rotation_z(0.0);
next.shorts.scale = Vec3::one(); next.shorts.scale = Vec3::one();

View File

@ -73,10 +73,10 @@ impl Skeleton for CharacterSkeleton {
let head_mat = self.head.compute_base_matrix(); let head_mat = self.head.compute_base_matrix();
[ [
FigureBoneData::new(torso_mat * head_mat), FigureBoneData::new(torso_mat * chest_mat * head_mat),
FigureBoneData::new(torso_mat * chest_mat), FigureBoneData::new(torso_mat * chest_mat),
FigureBoneData::new(torso_mat * self.belt.compute_base_matrix()), FigureBoneData::new(torso_mat * chest_mat * self.belt.compute_base_matrix()),
FigureBoneData::new(torso_mat * self.shorts.compute_base_matrix()), FigureBoneData::new(torso_mat * chest_mat * self.shorts.compute_base_matrix()),
FigureBoneData::new(torso_mat * chest_mat * control_mat * l_control_mat * l_hand_mat), FigureBoneData::new(torso_mat * chest_mat * control_mat * l_control_mat * l_hand_mat),
FigureBoneData::new(torso_mat * chest_mat * control_mat * r_control_mat * r_hand_mat), FigureBoneData::new(torso_mat * chest_mat * control_mat * r_control_mat * r_hand_mat),
FigureBoneData::new(torso_mat * self.l_foot.compute_base_matrix()), FigureBoneData::new(torso_mat * self.l_foot.compute_base_matrix()),

View File

@ -42,7 +42,7 @@ impl Animation for RollAnimation {
next.head.offset = Vec3::new( next.head.offset = Vec3::new(
0.0 + skeleton_attr.neck_right, 0.0 + skeleton_attr.neck_right,
-2.0 + skeleton_attr.neck_forward, -2.0 + skeleton_attr.neck_forward,
skeleton_attr.neck_height + 17.0 + wave_dub * -8.0, skeleton_attr.neck_height + 12.0 + wave_dub * -8.0,
); );
next.head.ori = Quaternion::rotation_x(wave_dub * 0.4); next.head.ori = Quaternion::rotation_x(wave_dub * 0.4);
next.head.scale = Vec3::one(); next.head.scale = Vec3::one();
@ -51,11 +51,11 @@ impl Animation for RollAnimation {
next.chest.ori = Quaternion::rotation_x(wave_dub * 0.4); next.chest.ori = Quaternion::rotation_x(wave_dub * 0.4);
next.chest.scale = Vec3::one() * 1.01; next.chest.scale = Vec3::one() * 1.01;
next.belt.offset = Vec3::new(0.0, 0.0, 5.0 + wave_dub * -3.0); next.belt.offset = Vec3::new(0.0, 0.0, -2.0 + wave_dub * -3.0);
next.belt.ori = Quaternion::rotation_x(0.0 + wave_dub * 0.4); next.belt.ori = Quaternion::rotation_x(0.0 + wave_dub * 0.4);
next.belt.scale = Vec3::one(); next.belt.scale = Vec3::one();
next.shorts.offset = Vec3::new(0.0, 0.0, 2.0 + wave_dub * -2.0); next.shorts.offset = Vec3::new(0.0, 0.0, -5.0 + wave_dub * -2.0);
next.shorts.ori = Quaternion::rotation_x(0.0 + wave_dub * 0.4); next.shorts.ori = Quaternion::rotation_x(0.0 + wave_dub * 0.4);
next.shorts.scale = Vec3::one(); next.shorts.scale = Vec3::one();

View File

@ -76,7 +76,7 @@ impl Animation for RunAnimation {
next.head.offset = Vec3::new( next.head.offset = Vec3::new(
0.0, 0.0,
-3.0 + skeleton_attr.neck_forward, -3.0 + skeleton_attr.neck_forward,
skeleton_attr.neck_height + 20.0 + short * 1.3, skeleton_attr.neck_height + 13.0 + short * 0.3,
); );
next.head.ori = Quaternion::rotation_z(head_look.x + long * 0.1) next.head.ori = Quaternion::rotation_z(head_look.x + long * 0.1)
* Quaternion::rotation_x(head_look.y + 0.35); * Quaternion::rotation_x(head_look.y + 0.35);
@ -86,11 +86,11 @@ impl Animation for RunAnimation {
next.chest.ori = Quaternion::rotation_z(short * 0.2); next.chest.ori = Quaternion::rotation_z(short * 0.2);
next.chest.scale = Vec3::one(); next.chest.scale = Vec3::one();
next.belt.offset = Vec3::new(0.0, 0.0, 5.0 + short * 1.1); next.belt.offset = Vec3::new(0.0, 0.0, -2.0);
next.belt.ori = Quaternion::rotation_z(short * 0.35); next.belt.ori = Quaternion::rotation_z(short * 0.35);
next.belt.scale = Vec3::one(); next.belt.scale = Vec3::one();
next.shorts.offset = Vec3::new(0.0, 0.0, 2.0 + short * 1.1); next.shorts.offset = Vec3::new(0.0, 0.0, -5.0);
next.shorts.ori = Quaternion::rotation_z(short * 0.6); next.shorts.ori = Quaternion::rotation_z(short * 0.6);
next.shorts.scale = Vec3::one(); next.shorts.scale = Vec3::one();

View File

@ -46,8 +46,8 @@ impl Animation for ShootAnimation {
next.head.offset = Vec3::new( next.head.offset = Vec3::new(
0.0 + skeleton_attr.neck_right, 0.0 + skeleton_attr.neck_right,
-2.0 + skeleton_attr.neck_forward - quick * 3.5, -2.0 + skeleton_attr.neck_forward - quick * 1.5,
skeleton_attr.neck_height + 21.0, skeleton_attr.neck_height + 14.0,
); );
next.head.ori = Quaternion::rotation_z(quick * 0.15) next.head.ori = Quaternion::rotation_z(quick * 0.15)
* Quaternion::rotation_x(quick * 0.09) * Quaternion::rotation_x(quick * 0.09)
@ -55,21 +55,17 @@ impl Animation for ShootAnimation {
next.head.scale = Vec3::one() * skeleton_attr.head_scale; next.head.scale = Vec3::one() * skeleton_attr.head_scale;
next.chest.offset = Vec3::new(0.0, 0.0 - quick * 1.5, 7.0); next.chest.offset = Vec3::new(0.0, 0.0 - quick * 1.5, 7.0);
next.chest.ori = Quaternion::rotation_z(quick * 0.15) next.chest.ori = Quaternion::rotation_z(quick * 0.35)
* Quaternion::rotation_x(quick * 0.09) * Quaternion::rotation_x(quick * 0.09)
* Quaternion::rotation_y(0.0); * Quaternion::rotation_y(0.0);
next.chest.scale = Vec3::one(); next.chest.scale = Vec3::one();
next.belt.offset = Vec3::new(0.0, 0.0 - quick * 1.0, 5.0); next.belt.offset = Vec3::new(0.0, 0.0 + quick * 1.0, -2.0);
next.belt.ori = Quaternion::rotation_z(quick * 0.2) next.belt.ori = next.chest.ori;
* Quaternion::rotation_x(quick * 0.12)
* Quaternion::rotation_y(0.0);
next.belt.scale = Vec3::one(); next.belt.scale = Vec3::one();
next.shorts.offset = Vec3::new(0.0, -quick * 0.5, 2.0); next.shorts.offset = Vec3::new(0.0, quick * 1.0, -5.0);
next.shorts.ori = Quaternion::rotation_z(quick * 0.08) next.shorts.ori = next.chest.ori;
* Quaternion::rotation_x(quick * 0.05)
* Quaternion::rotation_y(0.0);
next.shorts.scale = Vec3::one(); next.shorts.scale = Vec3::one();
match active_tool_kind { match active_tool_kind {

View File

@ -40,7 +40,7 @@ impl Animation for SitAnimation {
next.head.offset = Vec3::new( next.head.offset = Vec3::new(
0.0 + skeleton_attr.neck_right, 0.0 + skeleton_attr.neck_right,
wave_stop * -3.6 + skeleton_attr.neck_forward, wave_stop * -3.6 + skeleton_attr.neck_forward,
skeleton_attr.neck_height + 21.0 + wave_slow * 0.1 + wave_stop * -0.8, skeleton_attr.neck_height + 14.0 + wave_slow * 0.1 + wave_stop * -0.8,
); );
next.head.ori = next.head.ori =
Quaternion::rotation_z(head_look.x + wave_ultra_slow * 0.2 - wave_slow * 0.1) Quaternion::rotation_z(head_look.x + wave_ultra_slow * 0.2 - wave_slow * 0.1)
@ -57,11 +57,11 @@ impl Animation for SitAnimation {
next.chest.ori = Quaternion::rotation_x(wave_stop * 0.15); next.chest.ori = Quaternion::rotation_x(wave_stop * 0.15);
next.chest.scale = Vec3::one() + wave_slow_abs * 0.05; next.chest.scale = Vec3::one() + wave_slow_abs * 0.05;
next.belt.offset = Vec3::new(0.0, wave_stop * 1.2, 5.0); next.belt.offset = Vec3::new(0.0, wave_stop * 1.2, -2.0);
next.belt.ori = Quaternion::rotation_x(wave_stop * 0.3); next.belt.ori = Quaternion::rotation_x(wave_stop * 0.3);
next.belt.scale = (Vec3::one() + wave_slow_abs * 0.05) * 1.02; next.belt.scale = (Vec3::one() + wave_slow_abs * 0.05) * 1.02;
next.shorts.offset = Vec3::new(0.0, wave_stop * 2.5, 2.0 + wave_stop * 0.6); next.shorts.offset = Vec3::new(0.0, wave_stop * 2.5, -5.0 + wave_stop * 0.6);
next.shorts.ori = Quaternion::rotation_x(wave_stop * 0.6); next.shorts.ori = Quaternion::rotation_x(wave_stop * 0.6);
next.shorts.scale = Vec3::one(); next.shorts.scale = Vec3::one();

View File

@ -69,7 +69,7 @@ impl Animation for SpinAnimation {
next.head.offset = Vec3::new( next.head.offset = Vec3::new(
0.0 + skeleton_attr.neck_right, 0.0 + skeleton_attr.neck_right,
-2.0 + skeleton_attr.neck_forward + decel * -0.8, -2.0 + skeleton_attr.neck_forward + decel * -0.8,
skeleton_attr.neck_height + 21.0, skeleton_attr.neck_height + 14.0,
); );
next.head.ori = Quaternion::rotation_z(decel * -0.25) next.head.ori = Quaternion::rotation_z(decel * -0.25)
* Quaternion::rotation_x(0.0 + decel * -0.1) * Quaternion::rotation_x(0.0 + decel * -0.1)
@ -81,16 +81,12 @@ impl Animation for SpinAnimation {
* Quaternion::rotation_y(decel * -0.2); * Quaternion::rotation_y(decel * -0.2);
next.chest.scale = Vec3::one(); next.chest.scale = Vec3::one();
next.belt.offset = Vec3::new(0.0, 0.0, 5.0); next.belt.offset = Vec3::new(0.0, 0.0, -2.0);
next.belt.ori = Quaternion::rotation_z(decel * 0.1) next.belt.ori = next.chest.ori * -0.1;
* Quaternion::rotation_x(0.0 + decel * 0.1)
* Quaternion::rotation_y(decel * -0.1);
next.belt.scale = Vec3::one(); next.belt.scale = Vec3::one();
next.shorts.offset = Vec3::new(0.0, 0.0, 2.0); next.shorts.offset = Vec3::new(0.0, 0.0, -5.0);
next.belt.ori = Quaternion::rotation_z(decel * 0.08) next.belt.ori = next.chest.ori * -0.08;
* Quaternion::rotation_x(0.0 + decel * 0.08)
* Quaternion::rotation_y(decel * -0.08);
next.shorts.scale = Vec3::one(); next.shorts.scale = Vec3::one();
next.torso.offset = Vec3::new(0.0, 0.0, 0.1) * skeleton_attr.scaler; next.torso.offset = Vec3::new(0.0, 0.0, 0.1) * skeleton_attr.scaler;
next.torso.ori = Quaternion::rotation_z((spin * 7.0).max(0.3)) next.torso.ori = Quaternion::rotation_z((spin * 7.0).max(0.3))

View File

@ -36,7 +36,7 @@ impl Animation for StandAnimation {
next.head.offset = Vec3::new( next.head.offset = Vec3::new(
0.0 + skeleton_attr.neck_right, 0.0 + skeleton_attr.neck_right,
-3.0 + skeleton_attr.neck_forward, -3.0 + skeleton_attr.neck_forward,
skeleton_attr.neck_height + 21.0 + slow * 0.3, skeleton_attr.neck_height + 14.0 + slow * 0.3, //21
); );
next.head.ori = next.head.ori =
Quaternion::rotation_z(head_look.x) * Quaternion::rotation_x(head_look.y.abs()); Quaternion::rotation_z(head_look.x) * Quaternion::rotation_x(head_look.y.abs());
@ -46,11 +46,11 @@ impl Animation for StandAnimation {
next.chest.ori = Quaternion::rotation_z(head_look.x * 0.6); next.chest.ori = Quaternion::rotation_z(head_look.x * 0.6);
next.chest.scale = Vec3::one() * 1.01; next.chest.scale = Vec3::one() * 1.01;
next.belt.offset = Vec3::new(0.0, 0.0, 5.0 + slow * 0.3); next.belt.offset = Vec3::new(0.0, 0.0, -2.0 + slow * 0.3); //5
next.belt.ori = Quaternion::rotation_z(head_look.x * 0.4); next.belt.ori = Quaternion::rotation_z(head_look.x * 0.4);
next.belt.scale = Vec3::one() + breathe * 0.05; next.belt.scale = Vec3::one() + breathe * 0.05;
next.shorts.offset = Vec3::new(0.0, 0.0, 2.0 + slow * 0.3); next.shorts.offset = Vec3::new(0.0, 0.0, -5.0 + slow * 0.3); //2
next.shorts.ori = Quaternion::rotation_x(0.0); next.shorts.ori = Quaternion::rotation_x(0.0);
next.shorts.scale = Vec3::one(); next.shorts.scale = Vec3::one();

View File

@ -53,7 +53,7 @@ impl Animation for SwimAnimation {
next.head.offset = Vec3::new( next.head.offset = Vec3::new(
0.0, 0.0,
-3.0 + skeleton_attr.neck_forward, -3.0 + skeleton_attr.neck_forward,
skeleton_attr.neck_height + 21.0 + wave_cos * 1.3, skeleton_attr.neck_height + 14.0 + wave_cos * 1.3,
); );
next.head.ori = Quaternion::rotation_z(head_look.x + wave * 0.1) next.head.ori = Quaternion::rotation_z(head_look.x + wave * 0.1)
* Quaternion::rotation_x(head_look.y + 0.35); * Quaternion::rotation_x(head_look.y + 0.35);
@ -63,11 +63,11 @@ impl Animation for SwimAnimation {
next.chest.ori = Quaternion::rotation_z(wave * 0.2); next.chest.ori = Quaternion::rotation_z(wave * 0.2);
next.chest.scale = Vec3::one(); next.chest.scale = Vec3::one();
next.belt.offset = Vec3::new(0.0, 0.0, 5.0 + wave_cos * 1.1); next.belt.offset = Vec3::new(0.0, 0.0, -2.0 + wave_cos * 1.1);
next.belt.ori = Quaternion::rotation_z(wave * 0.35); next.belt.ori = Quaternion::rotation_z(wave * 0.35);
next.belt.scale = Vec3::one(); next.belt.scale = Vec3::one();
next.shorts.offset = Vec3::new(0.0, 0.0, 2.0 + wave_cos * 1.1); next.shorts.offset = Vec3::new(0.0, 0.0, -5.0 + wave_cos * 1.1);
next.shorts.ori = Quaternion::rotation_z(wave * 0.6); next.shorts.ori = Quaternion::rotation_z(wave * 0.6);
next.shorts.scale = Vec3::one(); next.shorts.scale = Vec3::one();

View File

@ -214,7 +214,7 @@ impl Animation for WieldAnimation {
next.head.offset = Vec3::new( next.head.offset = Vec3::new(
0.0, 0.0,
-3.0 + skeleton_attr.neck_forward, -3.0 + skeleton_attr.neck_forward,
skeleton_attr.neck_height + 22.0 + short * 1.3, skeleton_attr.neck_height + 13.0 + short * 0.2,
); );
next.head.ori = Quaternion::rotation_z(head_look.x + long * 0.1) next.head.ori = Quaternion::rotation_z(head_look.x + long * 0.1)
* Quaternion::rotation_x(head_look.y + 0.35); * Quaternion::rotation_x(head_look.y + 0.35);
@ -224,12 +224,12 @@ impl Animation for WieldAnimation {
next.chest.ori = Quaternion::rotation_z(short * 0.2); next.chest.ori = Quaternion::rotation_z(short * 0.2);
next.chest.scale = Vec3::one(); next.chest.scale = Vec3::one();
next.belt.offset = Vec3::new(0.0, 0.0, 7.0 + short * 1.1); next.belt.offset = Vec3::new(0.0, 0.0, -2.0);
next.belt.ori = Quaternion::rotation_z(short * 0.35); next.belt.ori = Quaternion::rotation_z(short * 0.15);
next.belt.scale = Vec3::one(); next.belt.scale = Vec3::one();
next.shorts.offset = Vec3::new(0.0, 0.0, 4.0 + short * 1.1); next.shorts.offset = Vec3::new(0.0, 0.0, -5.0);
next.shorts.ori = Quaternion::rotation_z(short * 0.6); next.shorts.ori = Quaternion::rotation_z(short * 0.4);
next.shorts.scale = Vec3::one(); next.shorts.scale = Vec3::one();
next.l_foot.offset = Vec3::new(-3.4, foot * 1.0, 9.0); next.l_foot.offset = Vec3::new(-3.4, foot * 1.0, 9.0);

View File

@ -498,7 +498,7 @@ impl FigureMgr {
) )
}, },
CharacterState::DashMelee(_) => { CharacterState::DashMelee(_) => {
anim::character::AttackAnimation::update_skeleton( anim::character::ChargeAnimation::update_skeleton(
&target_base, &target_base,
(active_tool_kind, time), (active_tool_kind, time),
state.state_time, state.state_time,
@ -507,7 +507,7 @@ impl FigureMgr {
) )
}, },
CharacterState::TripleStrike(s) => match s.stage { CharacterState::TripleStrike(s) => match s.stage {
0 => anim::character::ChargeAnimation::update_skeleton( 0 => anim::character::AttackAnimation::update_skeleton(
&target_base, &target_base,
(active_tool_kind, time), (active_tool_kind, time),
state.state_time, state.state_time,
@ -565,13 +565,23 @@ impl FigureMgr {
) )
}*/ }*/
CharacterState::Equipping { .. } => { CharacterState::Equipping { .. } => {
anim::character::WieldAnimation::update_skeleton( if vel.0.magnitude_squared() > 0.5 {
&target_base, anim::character::WieldAnimation::update_skeleton(
(active_tool_kind, vel.0.magnitude(), time), &target_base,
state.state_time, (active_tool_kind, vel.0.magnitude(), time),
&mut state_animation_rate, state.state_time,
skeleton_attr, &mut state_animation_rate,
) skeleton_attr,
)
} else {
anim::character::IdleWieldAnimation::update_skeleton(
&target_base,
(active_tool_kind, vel.0.magnitude(), time),
state.state_time,
&mut state_animation_rate,
skeleton_attr,
)
}
}, },
CharacterState::Wielding { .. } => { CharacterState::Wielding { .. } => {
if vel.0.magnitude_squared() > 0.5 { if vel.0.magnitude_squared() > 0.5 {