fixed wield feet while jumping, tweaked charge anim

This commit is contained in:
jshipsey 2020-03-26 18:26:23 -04:00
parent 2b68adff51
commit 7692f1d354
5 changed files with 36 additions and 117 deletions

View File

@ -52,7 +52,7 @@ impl Animation for ChargeAnimation {
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
next.chest.offset = Vec3::new(0.0, 0.0, 7.0 + wave_cos * 2.0);
next.chest.ori = Quaternion::rotation_x(-0.7) * Quaternion::rotation_z(-0.9);
next.chest.ori = Quaternion::rotation_x(-0.5) * Quaternion::rotation_z(-0.7);
next.chest.scale = Vec3::one();
next.belt.offset = Vec3::new(0.0, 1.0, -1.0);
@ -76,9 +76,9 @@ impl Animation for ChargeAnimation {
next.main.scale = Vec3::one();
next.control.offset = Vec3::new(-8.0 - slow * 0.5, 3.0 - foot * 0.6, 3.0);
next.control.ori = Quaternion::rotation_x(0.0)
next.control.ori = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(1.4 + slow * 0.2);
* Quaternion::rotation_z(1.1 + slow * 0.2);
next.control.scale = Vec3::one();
next.l_foot.offset = Vec3::new(-1.4, foot * 3.0, 8.0);
next.l_foot.ori = Quaternion::rotation_x(foot * -0.4 - 0.8);

View File

@ -21,10 +21,7 @@ impl Animation for EquipAnimation {
let mut next = (*skeleton).clone();
let lab = 1.0;
let foot = (((5.0)
/ (1.1 + 3.9 * ((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).sin());
let short = (((5.0)
/ (1.5 + 3.5 * ((anim_time as f32 * lab as f32 * 16.0).sin()).powf(2.0 as f32)))
.sqrt())
@ -217,33 +214,6 @@ impl Animation for EquipAnimation {
);
if velocity > 0.5 {
next.head.offset = Vec3::new(
0.0,
-3.0 + skeleton_attr.neck_forward,
skeleton_attr.neck_height + 13.0 + short * 0.2,
);
next.head.ori = Quaternion::rotation_z(head_look.x - short * 0.2)
* Quaternion::rotation_x(head_look.y + 0.35);
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
next.l_foot.offset = Vec3::new(-3.4, foot * 1.0, 9.0);
next.l_foot.ori = Quaternion::rotation_x(foot * -1.2);
next.l_foot.scale = Vec3::one();
next.r_foot.offset = Vec3::new(3.4, foot * -1.0, 9.0);
next.r_foot.ori = Quaternion::rotation_x(foot * 1.2);
next.r_foot.scale = Vec3::one();
next.chest.offset = Vec3::new(0.0, 0.0, 9.0 + short * 1.1);
next.chest.ori = Quaternion::rotation_z(short * 0.2);
next.chest.scale = Vec3::one();
next.belt.offset = Vec3::new(0.0, 0.0, -2.0);
next.belt.ori = Quaternion::rotation_z(short * 0.15);
next.belt.scale = Vec3::one();
next.shorts.offset = Vec3::new(0.0, 0.0, -5.0);
next.shorts.ori = Quaternion::rotation_z(short * 0.4);
next.shorts.scale = Vec3::one();
next.torso.offset = Vec3::new(0.0, 0.0, 0.0) * skeleton_attr.scaler;
next.torso.ori = Quaternion::rotation_x(-0.2);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;

View File

@ -25,7 +25,7 @@ impl Animation for JumpAnimation {
next.head.offset = Vec3::new(
0.0 + skeleton_attr.neck_right,
-3.0 + skeleton_attr.neck_forward,
skeleton_attr.neck_height + 14.0,
skeleton_attr.neck_height + 13.0,
);
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;
@ -34,11 +34,11 @@ impl Animation for JumpAnimation {
next.chest.ori = Quaternion::rotation_z(0.0);
next.chest.scale = Vec3::one() * 1.01;
next.belt.offset = Vec3::new(0.0, 0.0, -1.0);
next.belt.offset = Vec3::new(0.0, 0.0, -2.0);
next.belt.ori = Quaternion::rotation_z(0.0);
next.belt.scale = Vec3::one();
next.shorts.offset = Vec3::new(0.0, 0.0, -4.0);
next.shorts.offset = Vec3::new(0.0, 0.0, -5.0);
next.shorts.ori = Quaternion::rotation_z(0.0);
next.shorts.scale = Vec3::one();

View File

@ -19,32 +19,32 @@ impl Animation for RunAnimation {
let mut next = (*skeleton).clone();
let speed = Vec2::<f32>::from(velocity).magnitude();
*rate = speed;
*rate = 1.0;
let lab = 1.0;
let long = (((5.0)
/ (1.5 + 3.5 * ((anim_time as f32 * lab as f32 * 0.8).sin()).powf(2.0 as f32)))
/ (1.5 + 3.5 * ((anim_time as f32 * lab as f32 * 8.0).sin()).powf(2.0 as f32)))
.sqrt())
* ((anim_time as f32 * lab as f32 * 0.8).sin());
* ((anim_time as f32 * lab as f32 * 8.0).sin());
let short = (((5.0)
/ (1.5 + 3.5 * ((anim_time as f32 * lab as f32 * 1.6).sin()).powf(2.0 as f32)))
/ (1.5 + 3.5 * ((anim_time as f32 * lab as f32 * 16.0).sin()).powf(2.0 as f32)))
.sqrt())
* ((anim_time as f32 * lab as f32 * 1.6).sin());
* ((anim_time as f32 * lab as f32 * 16.0).sin());
let shortalt = (((5.0)
/ (1.5
+ 3.5
* ((anim_time as f32 * lab as f32 * 1.6 + PI / 2.0).sin()).powf(2.0 as f32)))
* ((anim_time as f32 * lab as f32 * 16.0 + PI / 2.0).sin()).powf(2.0 as f32)))
.sqrt())
* ((anim_time as f32 * lab as f32 * 1.6 + PI / 2.0).sin());
* ((anim_time as f32 * lab as f32 * 16.0 + PI / 2.0).sin());
let foot = (((5.0)
/ (1.1 + 3.9 * ((anim_time as f32 * lab as f32 * 1.6).sin()).powf(2.0 as f32)))
/ (1.1 + 3.9 * ((anim_time as f32 * lab as f32 * 16.0).sin()).powf(2.0 as f32)))
.sqrt())
* ((anim_time as f32 * lab as f32 * 1.6).sin());
* ((anim_time as f32 * lab as f32 * 16.0).sin());
let wave_stop = (anim_time as f32 * 2.6).min(PI / 2.0 / 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)

View File

@ -19,18 +19,9 @@ impl Animation for WieldAnimation {
) -> Self::Skeleton {
*rate = 1.0;
let mut next = (*skeleton).clone();
let lab = 1.0;
let wave_slow_cos = (anim_time as f32 * 6.0 + PI).cos();
let wave_ultra_slow = (anim_time as f32 * 1.0 + PI).sin();
let wave_ultra_slow_cos = (anim_time as f32 * 3.0 + PI).cos();
let foot = (((5.0)
/ (1.1 + 3.9 * ((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).sin());
let short = (((5.0)
/ (1.5 + 3.5 * ((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).sin());
let slow_cos = (anim_time as f32 * 6.0 + PI).cos();
let ultra_slow = (anim_time as f32 * 1.0 + PI).sin();
let ultra_slow_cos = (anim_time as f32 * 3.0 + PI).cos();
let wave = (anim_time as f32 * 16.0).sin();
match active_tool_kind {
@ -49,9 +40,9 @@ impl Animation for WieldAnimation {
next.main.scale = Vec3::one();
next.control.offset = Vec3::new(-7.0, 6.0, 6.0);
next.control.ori = Quaternion::rotation_x(wave_ultra_slow * 0.15)
next.control.ori = Quaternion::rotation_x(ultra_slow * 0.15)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(wave_ultra_slow_cos * 0.08);
* Quaternion::rotation_z(ultra_slow_cos * 0.08);
next.control.scale = Vec3::one();
},
Some(ToolKind::Axe(_)) => {
@ -72,9 +63,9 @@ impl Animation for WieldAnimation {
next.main.scale = Vec3::one();
next.control.offset = Vec3::new(0.0, 0.0, 0.0);
next.control.ori = Quaternion::rotation_x(wave_ultra_slow_cos * 0.1 + 0.2)
next.control.ori = Quaternion::rotation_x(ultra_slow_cos * 0.1 + 0.2)
* Quaternion::rotation_y(-0.3)
* Quaternion::rotation_z(wave_ultra_slow * 0.1 + 0.0);
* Quaternion::rotation_z(ultra_slow * 0.1 + 0.0);
next.control.scale = Vec3::one();
},
Some(ToolKind::Hammer(_)) => {
@ -91,9 +82,9 @@ impl Animation for WieldAnimation {
next.main.scale = Vec3::one();
next.control.offset = Vec3::new(0.0, 0.0, 0.0);
next.control.ori = Quaternion::rotation_x(wave_ultra_slow * 0.15)
next.control.ori = Quaternion::rotation_x(ultra_slow * 0.15)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(wave_ultra_slow_cos * 0.08);
* Quaternion::rotation_z(ultra_slow_cos * 0.08);
next.control.scale = Vec3::one();
},
Some(ToolKind::Staff(_)) => {
@ -112,9 +103,9 @@ impl Animation for WieldAnimation {
next.main.scale = Vec3::one();
next.control.offset = Vec3::new(-7.0, 6.0, 6.0);
next.control.ori = Quaternion::rotation_x(wave_ultra_slow * 0.2)
next.control.ori = Quaternion::rotation_x(ultra_slow * 0.2)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(wave_ultra_slow_cos * 0.1);
* Quaternion::rotation_z(ultra_slow_cos * 0.1);
next.control.scale = Vec3::one();
},
Some(ToolKind::Shield(_)) => {
@ -152,9 +143,9 @@ impl Animation for WieldAnimation {
next.main.scale = Vec3::one();
next.control.offset = Vec3::new(-7.0, 6.0, 6.0);
next.control.ori = Quaternion::rotation_x(wave_ultra_slow * 0.2)
next.control.ori = Quaternion::rotation_x(ultra_slow * 0.2)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(wave_ultra_slow_cos * 0.1);
* Quaternion::rotation_z(ultra_slow_cos * 0.1);
next.control.scale = Vec3::one();
},
Some(ToolKind::Dagger(_)) => {
@ -199,47 +190,6 @@ impl Animation for WieldAnimation {
}
if velocity > 0.5 {
let head_look = Vec2::new(
((global_time + anim_time) as f32 / 6.0)
.floor()
.mul(7331.0)
.sin()
* 0.2,
((global_time + anim_time) as f32 / 6.0)
.floor()
.mul(1337.0)
.sin()
* 0.1,
);
next.head.offset = Vec3::new(
0.0,
-3.0 + skeleton_attr.neck_forward,
skeleton_attr.neck_height + 13.0 + short * 0.2,
);
next.head.ori = Quaternion::rotation_z(head_look.x - short * 0.2)
* Quaternion::rotation_x(head_look.y + 0.35);
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
next.chest.offset = Vec3::new(0.0, 0.0, 9.0 + short * 1.1);
next.chest.ori = Quaternion::rotation_z(short * 0.2);
next.chest.scale = Vec3::one();
next.belt.offset = Vec3::new(0.0, 0.0, -2.0);
next.belt.ori = Quaternion::rotation_z(short * 0.15);
next.belt.scale = Vec3::one();
next.shorts.offset = Vec3::new(0.0, 0.0, -5.0);
next.shorts.ori = Quaternion::rotation_z(short * 0.4);
next.shorts.scale = Vec3::one();
next.l_foot.offset = Vec3::new(-3.4, foot * 1.0, 9.0);
next.l_foot.ori = Quaternion::rotation_x(foot * -1.2);
next.l_foot.scale = Vec3::one();
next.r_foot.offset = Vec3::new(3.4, foot * -1.0, 9.0);
next.r_foot.ori = Quaternion::rotation_x(foot * 1.2);
next.r_foot.scale = Vec3::one();
next.torso.offset = Vec3::new(0.0, 0.0, 0.0) * skeleton_attr.scaler;
next.torso.ori = Quaternion::rotation_x(-0.2);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
@ -267,21 +217,20 @@ impl Animation for WieldAnimation {
next.head.offset = Vec3::new(
0.0 + skeleton_attr.neck_right,
-2.0 + skeleton_attr.neck_forward,
skeleton_attr.neck_height + 14.0 + wave_ultra_slow * 0.1,
skeleton_attr.neck_height + 14.0 + ultra_slow * 0.1,
);
next.head.ori =
Quaternion::rotation_z(head_look.x) * Quaternion::rotation_x(head_look.y.abs());
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
next.chest.offset =
Vec3::new(0.0 + wave_slow_cos * 0.5, 0.0, 7.0 + wave_ultra_slow * 0.5);
next.chest.offset = Vec3::new(0.0 + slow_cos * 0.5, 0.0, 7.0 + ultra_slow * 0.5);
next.chest.ori =
Quaternion::rotation_y(wave_ultra_slow_cos * 0.04) * Quaternion::rotation_z(0.15);
Quaternion::rotation_y(ultra_slow_cos * 0.04) * Quaternion::rotation_z(0.15);
next.chest.scale = Vec3::one();
next.belt.offset = Vec3::new(0.0, 0.0, -2.0);
next.belt.ori =
Quaternion::rotation_y(wave_ultra_slow_cos * 0.03) * Quaternion::rotation_z(0.22);
Quaternion::rotation_y(ultra_slow_cos * 0.03) * Quaternion::rotation_z(0.22);
next.belt.scale = Vec3::one() * 1.02;
next.shorts.offset = Vec3::new(0.0, 0.0, -5.0);
@ -289,11 +238,11 @@ impl Animation for WieldAnimation {
next.shorts.scale = Vec3::one();
next.l_foot.offset = Vec3::new(-3.4, -2.5, 8.0);
next.l_foot.ori = Quaternion::rotation_x(wave_ultra_slow_cos * 0.035 - 0.2);
next.l_foot.ori = Quaternion::rotation_x(ultra_slow_cos * 0.035 - 0.2);
next.l_foot.scale = Vec3::one();
next.r_foot.offset = Vec3::new(3.4, 3.5, 8.0);
next.r_foot.ori = Quaternion::rotation_x(wave_ultra_slow * 0.035);
next.r_foot.ori = Quaternion::rotation_x(ultra_slow * 0.035);
next.r_foot.scale = Vec3::one();
next.torso.offset = Vec3::new(0.0, 0.0, 0.1) * skeleton_attr.scaler;