mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
animation housekeeping
This commit is contained in:
parent
6b6adb86d7
commit
5438514343
@ -33,7 +33,7 @@ impl Animation for IdleAnimation {
|
||||
* 0.25,
|
||||
);
|
||||
|
||||
next.head.offset = Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1) / 11.0;
|
||||
next.head.offset = Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1);
|
||||
next.head.ori = Quaternion::rotation_z(duck_head_look.x)
|
||||
* Quaternion::rotation_x(-duck_head_look.y.abs() + wave_slow_cos * 0.03);
|
||||
next.head.scale = Vec3::one();
|
||||
@ -46,7 +46,7 @@ impl Animation for IdleAnimation {
|
||||
next.torso.ori = Quaternion::rotation_y(wave_slow * 0.03);
|
||||
next.torso.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.tail.offset = Vec3::new(0.0, skeleton_attr.tail.0, skeleton_attr.tail.1) / 11.0;
|
||||
next.tail.offset = Vec3::new(0.0, skeleton_attr.tail.0, skeleton_attr.tail.1);
|
||||
next.tail.ori = Quaternion::rotation_x(wave_slow_cos * 0.03);
|
||||
next.tail.scale = Vec3::one();
|
||||
|
||||
@ -54,7 +54,7 @@ impl Animation for IdleAnimation {
|
||||
-skeleton_attr.wing.0,
|
||||
skeleton_attr.wing.1,
|
||||
skeleton_attr.wing.2,
|
||||
) / 11.0;
|
||||
);
|
||||
next.wing_l.ori = Quaternion::rotation_z(0.0);
|
||||
next.wing_l.scale = Vec3::one() * 1.05;
|
||||
|
||||
@ -62,7 +62,7 @@ impl Animation for IdleAnimation {
|
||||
skeleton_attr.wing.0,
|
||||
skeleton_attr.wing.1,
|
||||
skeleton_attr.wing.2,
|
||||
) / 11.0;
|
||||
);
|
||||
next.wing_r.ori = Quaternion::rotation_y(0.0);
|
||||
next.wing_r.scale = Vec3::one() * 1.05;
|
||||
|
||||
|
@ -31,11 +31,11 @@ impl Skeleton for BirdMediumSkeleton {
|
||||
let torso_mat = self.torso.compute_base_matrix();
|
||||
|
||||
[
|
||||
FigureBoneData::new(self.head.compute_base_matrix() * torso_mat),
|
||||
FigureBoneData::new(torso_mat * self.head.compute_base_matrix()),
|
||||
FigureBoneData::new(torso_mat),
|
||||
FigureBoneData::new(self.tail.compute_base_matrix() * torso_mat),
|
||||
FigureBoneData::new(self.wing_l.compute_base_matrix() * torso_mat),
|
||||
FigureBoneData::new(self.wing_r.compute_base_matrix() * torso_mat),
|
||||
FigureBoneData::new(torso_mat * self.tail.compute_base_matrix()),
|
||||
FigureBoneData::new(torso_mat * self.wing_l.compute_base_matrix()),
|
||||
FigureBoneData::new(torso_mat * self.wing_r.compute_base_matrix()),
|
||||
FigureBoneData::new(self.leg_l.compute_base_matrix()),
|
||||
FigureBoneData::new(self.leg_r.compute_base_matrix()),
|
||||
FigureBoneData::default(),
|
||||
|
@ -28,7 +28,7 @@ impl Animation for RunAnimation {
|
||||
0.0,
|
||||
skeleton_attr.head.0,
|
||||
skeleton_attr.head.1 + center * 0.5,
|
||||
) / 11.0;
|
||||
);
|
||||
next.head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0 + center * 0.03);
|
||||
next.head.scale = Vec3::one();
|
||||
|
||||
@ -44,7 +44,7 @@ impl Animation for RunAnimation {
|
||||
0.0,
|
||||
skeleton_attr.tail.0,
|
||||
skeleton_attr.tail.1 + centeroffset * 0.6,
|
||||
) / 11.0;
|
||||
);
|
||||
next.tail.ori = Quaternion::rotation_x(center * 0.03);
|
||||
next.tail.scale = Vec3::one();
|
||||
|
||||
@ -52,16 +52,16 @@ impl Animation for RunAnimation {
|
||||
-skeleton_attr.wing.0,
|
||||
skeleton_attr.wing.1,
|
||||
skeleton_attr.wing.2,
|
||||
) / 11.0;
|
||||
next.wing_l.ori = Quaternion::rotation_y(footl * 0.3);
|
||||
);
|
||||
next.wing_l.ori = Quaternion::rotation_y(footl * 0.1);
|
||||
next.wing_l.scale = Vec3::one() * 1.05;
|
||||
|
||||
next.wing_r.offset = Vec3::new(
|
||||
skeleton_attr.wing.0,
|
||||
skeleton_attr.wing.1,
|
||||
skeleton_attr.wing.2,
|
||||
) / 11.0;
|
||||
next.wing_r.ori = Quaternion::rotation_y(footr * 0.3);
|
||||
);
|
||||
next.wing_r.ori = Quaternion::rotation_y(footr * 0.1);
|
||||
next.wing_r.scale = Vec3::one() * 1.05;
|
||||
|
||||
next.leg_l.offset = Vec3::new(
|
||||
|
@ -21,22 +21,18 @@ impl Animation for RunAnimation {
|
||||
let speed = Vec2::<f32>::from(velocity).magnitude();
|
||||
*rate = speed;
|
||||
|
||||
let constant = 1.0;
|
||||
let wave = (((5.0)
|
||||
/ (1.1 + 3.9 * ((anim_time as f32 * constant as f32 * 1.2).sin()).powf(2.0 as f32)))
|
||||
let lab = 1.0;
|
||||
let long = (((5.0)
|
||||
/ (1.1 + 3.9 * ((anim_time as f32 * lab as f32 * 1.2).sin()).powf(2.0 as f32)))
|
||||
.sqrt())
|
||||
* ((anim_time as f32 * constant as f32 * 1.2).sin());
|
||||
let wave_cos = (((5.0)
|
||||
/ (1.1 + 3.9 * ((anim_time as f32 * constant as f32 * 2.4).sin()).powf(2.0 as f32)))
|
||||
* ((anim_time as f32 * lab as f32 * 1.2).sin());
|
||||
let short = (((5.0)
|
||||
/ (1.1 + 3.9 * ((anim_time as f32 * lab as f32 * 2.4).sin()).powf(2.0 as f32)))
|
||||
.sqrt())
|
||||
* ((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());
|
||||
* ((anim_time as f32 * lab as f32 * 1.5).sin());
|
||||
|
||||
let wave_diff = (anim_time as f32 * 0.6).sin();
|
||||
let wave_stop = (anim_time as f32 * 2.6).min(PI / 2.0).sin();
|
||||
|
||||
let head_look = Vec2::new(
|
||||
((global_time + anim_time) as f32 / 4.0)
|
||||
.floor()
|
||||
@ -67,48 +63,48 @@ impl Animation for RunAnimation {
|
||||
next.head.offset = Vec3::new(
|
||||
0.0,
|
||||
-3.0 + skeleton_attr.neck_forward,
|
||||
skeleton_attr.neck_height + 20.0 + wave_cos * 1.3,
|
||||
skeleton_attr.neck_height + 20.0 + short * 1.3,
|
||||
);
|
||||
next.head.ori = Quaternion::rotation_z(head_look.x + wave * 0.1)
|
||||
next.head.ori = Quaternion::rotation_z(head_look.x + long * 0.1)
|
||||
* 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, 7.0 + wave_cos * 1.1);
|
||||
next.chest.ori = Quaternion::rotation_z(wave * 0.2);
|
||||
next.chest.offset = Vec3::new(0.0, 0.0, 7.0 + short * 1.1);
|
||||
next.chest.ori = Quaternion::rotation_z(long * 0.2);
|
||||
next.chest.scale = Vec3::one();
|
||||
|
||||
next.belt.offset = Vec3::new(0.0, 0.0, 5.0 + wave_cos * 1.1);
|
||||
next.belt.ori = Quaternion::rotation_z(wave * 0.35);
|
||||
next.belt.offset = Vec3::new(0.0, 0.0, 5.0 + short * 1.1);
|
||||
next.belt.ori = Quaternion::rotation_z(long * 0.35);
|
||||
next.belt.scale = Vec3::one();
|
||||
|
||||
next.shorts.offset = Vec3::new(0.0, 0.0, 2.0 + wave_cos * 1.1);
|
||||
next.shorts.ori = Quaternion::rotation_z(wave * 0.6);
|
||||
next.shorts.offset = Vec3::new(0.0, 0.0, 2.0 + short * 1.1);
|
||||
next.shorts.ori = Quaternion::rotation_z(long * 0.6);
|
||||
next.shorts.scale = Vec3::one();
|
||||
|
||||
next.l_hand.offset = Vec3::new(
|
||||
-6.0 + wave_stop * -1.0,
|
||||
-0.25 + wave_cos * 2.0,
|
||||
5.0 - wave * 1.5,
|
||||
-0.25 + short * 2.0,
|
||||
5.0 - long * 1.5,
|
||||
);
|
||||
next.l_hand.ori =
|
||||
Quaternion::rotation_x(0.8 + wave_cos * 1.2) * Quaternion::rotation_y(wave_stop * 0.1);
|
||||
Quaternion::rotation_x(0.8 + short * 1.2) * Quaternion::rotation_y(wave_stop * 0.1);
|
||||
next.l_hand.scale = Vec3::one();
|
||||
|
||||
next.r_hand.offset = Vec3::new(
|
||||
6.0 + wave_stop * 1.0,
|
||||
-0.25 - wave_cos * 2.0,
|
||||
5.0 + wave * 1.5,
|
||||
-0.25 + short * -2.0,
|
||||
5.0 + long * 1.5,
|
||||
);
|
||||
next.r_hand.ori = Quaternion::rotation_x(0.8 + wave_cos * -1.2)
|
||||
* Quaternion::rotation_y(wave_stop * -0.1);
|
||||
next.r_hand.ori =
|
||||
Quaternion::rotation_x(0.8 + short * -1.2) * Quaternion::rotation_y(wave_stop * -0.1);
|
||||
next.r_hand.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.l_foot.ori = Quaternion::rotation_x(-0.0 - wave_cos * 1.2);
|
||||
next.l_foot.offset = Vec3::new(-3.4, 0.0 + short * 1.0, 6.0);
|
||||
next.l_foot.ori = Quaternion::rotation_x(-0.0 - short * 1.2);
|
||||
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.ori = Quaternion::rotation_x(-0.0 + wave_cos * 1.2);
|
||||
next.r_foot.offset = Vec3::new(3.4, short * -1.0, 6.0);
|
||||
next.r_foot.ori = Quaternion::rotation_x(short * 1.2);
|
||||
next.r_foot.scale = Vec3::one();
|
||||
|
||||
next.main.offset = Vec3::new(
|
||||
@ -116,16 +112,15 @@ impl Animation for RunAnimation {
|
||||
-5.0 + skeleton_attr.weapon_y,
|
||||
15.0,
|
||||
);
|
||||
next.main.ori =
|
||||
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57 + wave_cos * 0.25);
|
||||
next.main.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57 + short * 0.25);
|
||||
next.main.scale = Vec3::one();
|
||||
|
||||
next.l_shoulder.offset = Vec3::new(-5.0, 0.0, 4.7);
|
||||
next.l_shoulder.ori = Quaternion::rotation_x(wave_cos * 0.15);
|
||||
next.l_shoulder.offset = Vec3::new(-5.0, -0.5, 4.7);
|
||||
next.l_shoulder.ori = Quaternion::rotation_x(short * 0.15);
|
||||
next.l_shoulder.scale = Vec3::one() * 1.1;
|
||||
|
||||
next.r_shoulder.offset = Vec3::new(5.0, 0.0, 4.7);
|
||||
next.r_shoulder.ori = Quaternion::rotation_x(wave * 0.15);
|
||||
next.r_shoulder.offset = Vec3::new(5.0, -0.5, 4.7);
|
||||
next.r_shoulder.ori = Quaternion::rotation_x(long * 0.15);
|
||||
next.r_shoulder.scale = Vec3::one() * 1.1;
|
||||
|
||||
next.glider.offset = Vec3::new(0.0, 5.0, 0.0);
|
||||
@ -136,9 +131,9 @@ impl Animation for RunAnimation {
|
||||
next.lantern.ori = Quaternion::rotation_y(0.0);
|
||||
next.lantern.scale = Vec3::one() * 0.0;
|
||||
|
||||
next.torso.offset = Vec3::new(0.0, -0.3 + wave * -0.08, 0.4) * skeleton_attr.scaler;
|
||||
next.torso.offset = Vec3::new(0.0, -0.3 + long * -0.08, 0.4) * skeleton_attr.scaler;
|
||||
next.torso.ori =
|
||||
Quaternion::rotation_x(wave_stop * speed * -0.06 + wave_diff * speed * -0.005)
|
||||
Quaternion::rotation_x(wave_stop * speed * -0.06 + wave_stop * speed * -0.005)
|
||||
* Quaternion::rotation_y(tilt);
|
||||
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
use super::{super::Animation, CharacterSkeleton, SkeletonAttr};
|
||||
use common::comp::item::Tool;
|
||||
use std::{f32::consts::PI, ops::Mul};
|
||||
use std::ops::Mul;
|
||||
use vek::*;
|
||||
|
||||
pub struct StandAnimation;
|
||||
@ -18,9 +18,8 @@ impl Animation for StandAnimation {
|
||||
) -> Self::Skeleton {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
let wave_ultra_slow = (anim_time as f32 * 1.0 + PI).sin();
|
||||
let wave_ultra_slow_cos = (anim_time as f32 * 1.0 + PI).cos();
|
||||
let wave_ultra_slow_abs = ((anim_time as f32 * 0.5 + PI).sin()) + 1.0;
|
||||
let slow = (anim_time as f32 * 1.0).sin();
|
||||
let breathe = ((anim_time as f32 * 0.5).sin()).abs();
|
||||
|
||||
let head_look = Vec2::new(
|
||||
((global_time + anim_time) as f32 / 12.0)
|
||||
@ -37,40 +36,33 @@ impl Animation for StandAnimation {
|
||||
next.head.offset = Vec3::new(
|
||||
0.0 + skeleton_attr.neck_right,
|
||||
-3.0 + skeleton_attr.neck_forward,
|
||||
skeleton_attr.neck_height + 21.0 + wave_ultra_slow * 0.3,
|
||||
skeleton_attr.neck_height + 21.0 + slow * 0.3,
|
||||
);
|
||||
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, 0.0, 7.0 + wave_ultra_slow * 0.3);
|
||||
next.chest.offset = Vec3::new(0.0, 0.0, 7.0 + slow * 0.3);
|
||||
next.chest.ori = Quaternion::rotation_x(0.0);
|
||||
next.chest.scale = Vec3::one() * 1.01 + wave_ultra_slow_abs * 0.05;
|
||||
next.chest.scale = Vec3::one() * 1.01 + breathe * 0.05;
|
||||
|
||||
next.belt.offset = Vec3::new(0.0, 0.0, 5.0 + wave_ultra_slow * 0.3);
|
||||
next.belt.offset = Vec3::new(0.0, 0.0, 5.0 + slow * 0.3);
|
||||
next.belt.ori = Quaternion::rotation_x(0.0);
|
||||
next.belt.scale = Vec3::one() + wave_ultra_slow_abs * 0.05;
|
||||
next.belt.scale = Vec3::one() + breathe * 0.05;
|
||||
|
||||
next.shorts.offset = Vec3::new(0.0, 0.0, 2.0 + wave_ultra_slow * 0.3);
|
||||
next.shorts.offset = Vec3::new(0.0, 0.0, 2.0 + slow * 0.3);
|
||||
next.shorts.ori = Quaternion::rotation_x(0.0);
|
||||
next.shorts.scale = Vec3::one();
|
||||
|
||||
next.l_hand.offset = Vec3::new(
|
||||
-6.0,
|
||||
-0.25 + wave_ultra_slow_cos * 0.15,
|
||||
5.0 + wave_ultra_slow * 0.5,
|
||||
);
|
||||
next.l_hand.offset = Vec3::new(-6.0, -0.25 + slow * 0.15, 5.0 + slow * 0.5);
|
||||
|
||||
next.l_hand.ori = Quaternion::rotation_x(0.0 + wave_ultra_slow * -0.06);
|
||||
next.l_hand.ori = Quaternion::rotation_x(0.0 + slow * -0.06);
|
||||
next.l_hand.scale = Vec3::one();
|
||||
|
||||
next.r_hand.offset = Vec3::new(
|
||||
6.0,
|
||||
-0.25 + wave_ultra_slow_cos * 0.15,
|
||||
5.0 + wave_ultra_slow * 0.5 + wave_ultra_slow_abs * -0.05,
|
||||
);
|
||||
next.r_hand.ori = Quaternion::rotation_x(0.0 + wave_ultra_slow * -0.06);
|
||||
next.r_hand.scale = Vec3::one() + wave_ultra_slow_abs * -0.05;
|
||||
next.r_hand.offset =
|
||||
Vec3::new(6.0, -0.25 + slow * 0.15, 5.0 + slow * 0.5 + breathe * -0.05);
|
||||
next.r_hand.ori = Quaternion::rotation_x(0.0 + slow * -0.06);
|
||||
next.r_hand.scale = Vec3::one() + breathe * -0.05;
|
||||
|
||||
next.l_foot.offset = Vec3::new(-3.4, -0.1, 8.0);
|
||||
next.l_foot.ori = Quaternion::identity();
|
||||
@ -86,15 +78,15 @@ impl Animation for StandAnimation {
|
||||
15.0,
|
||||
);
|
||||
next.main.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
|
||||
next.main.scale = Vec3::one() + wave_ultra_slow_abs * -0.05;
|
||||
next.main.scale = Vec3::one() + breathe * -0.05;
|
||||
|
||||
next.l_shoulder.offset = Vec3::new(-5.0, 0.0, 5.0);
|
||||
next.l_shoulder.ori = Quaternion::rotation_x(0.0);
|
||||
next.l_shoulder.scale = (Vec3::one() + wave_ultra_slow_abs * -0.05) * 1.15;
|
||||
next.l_shoulder.scale = (Vec3::one() + breathe * -0.05) * 1.15;
|
||||
|
||||
next.r_shoulder.offset = Vec3::new(5.0, 0.0, 5.0);
|
||||
next.r_shoulder.ori = Quaternion::rotation_x(0.0);
|
||||
next.r_shoulder.scale = (Vec3::one() + wave_ultra_slow_abs * -0.05) * 1.15;
|
||||
next.r_shoulder.scale = (Vec3::one() + breathe * -0.05) * 1.15;
|
||||
|
||||
next.glider.offset = Vec3::new(0.0, 5.0, 0.0);
|
||||
next.glider.ori = Quaternion::rotation_y(0.0);
|
||||
|
@ -17,11 +17,10 @@ impl Animation for IdleAnimation {
|
||||
) -> Self::Skeleton {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
let wave = (anim_time as f32 * 14.0).sin();
|
||||
let wave_slow = (anim_time as f32 * 3.5 + PI).sin();
|
||||
let wave_slow_cos = (anim_time as f32 * 3.5 + PI).cos();
|
||||
let slow = (anim_time as f32 * 3.5).sin();
|
||||
let slow_alt = (anim_time as f32 * 3.5 + PI).sin();
|
||||
|
||||
let pig_head_look = Vec2::new(
|
||||
let head_look = Vec2::new(
|
||||
((global_time + anim_time) as f32 / 8.0)
|
||||
.floor()
|
||||
.mul(7331.0)
|
||||
@ -35,17 +34,17 @@ impl Animation for IdleAnimation {
|
||||
);
|
||||
|
||||
next.head.offset =
|
||||
Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1 + wave * 0.2) / 11.0;
|
||||
next.head.ori = Quaternion::rotation_z(pig_head_look.x)
|
||||
* Quaternion::rotation_x(pig_head_look.y + wave_slow_cos * 0.03);
|
||||
Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1 + slow * 0.2) / 11.0;
|
||||
next.head.ori = Quaternion::rotation_z(head_look.x)
|
||||
* Quaternion::rotation_x(head_look.y + slow_alt * 0.03);
|
||||
next.head.scale = Vec3::one() / 10.5;
|
||||
|
||||
next.chest.offset = Vec3::new(
|
||||
wave_slow * 0.05,
|
||||
slow * 0.05,
|
||||
skeleton_attr.chest.0,
|
||||
skeleton_attr.chest.1 + wave_slow_cos * 0.2,
|
||||
skeleton_attr.chest.1 + slow_alt * 0.2,
|
||||
) / 11.0;
|
||||
next.chest.ori = Quaternion::rotation_y(wave_slow * 0.05);
|
||||
next.chest.ori = Quaternion::rotation_y(slow * 0.05);
|
||||
next.chest.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.leg_lf.offset = Vec3::new(
|
||||
@ -53,7 +52,7 @@ impl Animation for IdleAnimation {
|
||||
skeleton_attr.feet_f.1,
|
||||
skeleton_attr.feet_f.2,
|
||||
) / 11.0;
|
||||
next.leg_lf.ori = Quaternion::rotation_x(wave_slow * 0.08);
|
||||
next.leg_lf.ori = Quaternion::rotation_x(slow * 0.08);
|
||||
next.leg_lf.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.leg_rf.offset = Vec3::new(
|
||||
@ -61,7 +60,7 @@ impl Animation for IdleAnimation {
|
||||
skeleton_attr.feet_f.1,
|
||||
skeleton_attr.feet_f.2,
|
||||
) / 11.0;
|
||||
next.leg_rf.ori = Quaternion::rotation_x(wave_slow_cos * 0.08);
|
||||
next.leg_rf.ori = Quaternion::rotation_x(slow_alt * 0.08);
|
||||
next.leg_rf.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.leg_lb.offset = Vec3::new(
|
||||
@ -69,7 +68,7 @@ impl Animation for IdleAnimation {
|
||||
skeleton_attr.feet_b.1,
|
||||
skeleton_attr.feet_b.2,
|
||||
) / 11.0;
|
||||
next.leg_lb.ori = Quaternion::rotation_x(wave_slow_cos * 0.08);
|
||||
next.leg_lb.ori = Quaternion::rotation_x(slow_alt * 0.08);
|
||||
next.leg_lb.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.leg_rb.offset = Vec3::new(
|
||||
@ -77,7 +76,7 @@ impl Animation for IdleAnimation {
|
||||
skeleton_attr.feet_b.1,
|
||||
skeleton_attr.feet_b.2,
|
||||
) / 11.0;
|
||||
next.leg_rb.ori = Quaternion::rotation_x(wave_slow * 0.08);
|
||||
next.leg_rb.ori = Quaternion::rotation_x(slow * 0.08);
|
||||
next.leg_rb.scale = Vec3::one() / 11.0;
|
||||
|
||||
next
|
||||
|
@ -1,4 +1,5 @@
|
||||
use super::{super::Animation, QuadrupedSmallSkeleton, SkeletonAttr};
|
||||
use std::f32::consts::PI;
|
||||
use vek::*;
|
||||
|
||||
pub struct RunAnimation;
|
||||
@ -16,55 +17,55 @@ impl Animation for RunAnimation {
|
||||
) -> Self::Skeleton {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
let wave = (anim_time as f32 * 14.0).sin();
|
||||
let wave_quick = (anim_time as f32 * 20.0).sin();
|
||||
let wave_quick_cos = (anim_time as f32 * 20.0).cos();
|
||||
let wave_cos = (anim_time as f32 * 14.0).cos();
|
||||
let slow = (anim_time as f32 * 14.0).sin();
|
||||
let fast = (anim_time as f32 * 20.0).sin();
|
||||
let fast_alt = (anim_time as f32 * 20.0 + PI / 2.0).sin();
|
||||
let slow_alt = (anim_time as f32 * 14.0 + PI / 2.0).sin();
|
||||
|
||||
next.head.offset =
|
||||
Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1 + wave * 1.5) / 11.0;
|
||||
Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1 + slow * 1.5) / 11.0;
|
||||
next.head.ori =
|
||||
Quaternion::rotation_x(0.2 + wave * 0.05) * Quaternion::rotation_y(wave_cos * 0.03);
|
||||
Quaternion::rotation_x(0.2 + slow * 0.05) * Quaternion::rotation_y(slow_alt * 0.03);
|
||||
next.head.scale = Vec3::one() / 10.5;
|
||||
|
||||
next.chest.offset = Vec3::new(
|
||||
0.0,
|
||||
skeleton_attr.chest.0,
|
||||
skeleton_attr.chest.1 + wave_cos * 1.2,
|
||||
skeleton_attr.chest.1 + slow_alt * 1.2,
|
||||
) / 11.0;
|
||||
next.chest.ori = Quaternion::rotation_x(wave * 0.1);
|
||||
next.chest.ori = Quaternion::rotation_x(slow * 0.1);
|
||||
next.chest.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.leg_lf.offset = Vec3::new(
|
||||
-skeleton_attr.feet_f.0,
|
||||
skeleton_attr.feet_f.1 + wave_quick * 0.8,
|
||||
skeleton_attr.feet_f.2 + wave_quick_cos * 1.5,
|
||||
skeleton_attr.feet_f.1 + fast * 0.8,
|
||||
skeleton_attr.feet_f.2 + fast_alt * 1.5,
|
||||
) / 11.0;
|
||||
next.leg_lf.ori = Quaternion::rotation_x(wave_quick * 0.3);
|
||||
next.leg_lf.ori = Quaternion::rotation_x(fast * 0.3);
|
||||
next.leg_lf.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.leg_rf.offset = Vec3::new(
|
||||
skeleton_attr.feet_f.0,
|
||||
skeleton_attr.feet_f.1 - wave_quick_cos * 0.8,
|
||||
skeleton_attr.feet_f.2 + wave_quick * 1.5,
|
||||
skeleton_attr.feet_f.1 + fast_alt * -0.8,
|
||||
skeleton_attr.feet_f.2 + fast * 1.5,
|
||||
) / 11.0;
|
||||
next.leg_rf.ori = Quaternion::rotation_x(wave_quick_cos * -0.3);
|
||||
next.leg_rf.ori = Quaternion::rotation_x(fast_alt * -0.3);
|
||||
next.leg_rf.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.leg_lb.offset = Vec3::new(
|
||||
-skeleton_attr.feet_b.0,
|
||||
skeleton_attr.feet_b.1 - wave_quick_cos * 0.8,
|
||||
skeleton_attr.feet_b.2 + wave_quick * 1.5,
|
||||
skeleton_attr.feet_b.1 + fast_alt * -0.8,
|
||||
skeleton_attr.feet_b.2 + fast * 1.5,
|
||||
) / 11.0;
|
||||
next.leg_lb.ori = Quaternion::rotation_x(wave_quick_cos * -0.3);
|
||||
next.leg_lb.ori = Quaternion::rotation_x(fast_alt * -0.3);
|
||||
next.leg_lb.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.leg_rb.offset = Vec3::new(
|
||||
skeleton_attr.feet_b.0,
|
||||
skeleton_attr.feet_b.1 + wave_quick * 0.8,
|
||||
skeleton_attr.feet_b.2 + wave_quick_cos * 1.5,
|
||||
skeleton_attr.feet_b.1 + fast * 0.8,
|
||||
skeleton_attr.feet_b.2 + fast_alt * 1.5,
|
||||
) / 11.0;
|
||||
next.leg_rb.ori = Quaternion::rotation_x(wave_quick * 0.3);
|
||||
next.leg_rb.ori = Quaternion::rotation_x(fast * 0.3);
|
||||
next.leg_rb.scale = Vec3::one() / 11.0;
|
||||
|
||||
next
|
||||
|
Loading…
Reference in New Issue
Block a user