better everything

This commit is contained in:
jshipsey 2020-07-03 05:00:35 -04:00
parent 86b2272176
commit e689de3c8a
21 changed files with 439 additions and 446 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -9,7 +9,7 @@
central: ("npc.crocodile.male.head_lower"),
),
jaw: (
offset: (-4.0, -7.0, -1.5),
offset: (-4.0, 0.0, -1.5),
central: ("npc.crocodile.male.jaw"),
),
chest: (
@ -35,7 +35,7 @@
central: ("npc.crocodile.female.head_lower"),
),
jaw: (
offset: (-4.0, -7.0, -1.5),
offset: (-4.0, 0.0, -1.5),
central: ("npc.crocodile.female.jaw"),
),
chest: (
@ -61,7 +61,7 @@
central: ("npc.alligator.male.head_lower"),
),
jaw: (
offset: (-4.0, -7.5, -2.5),
offset: (-4.0, 0.0, -2.5),
central: ("npc.alligator.male.jaw"),
),
chest: (
@ -87,7 +87,7 @@
central: ("npc.alligator.female.head_lower"),
),
jaw: (
offset: (-4.0, -7.5, -2.5),
offset: (-4.0, 0.0, -2.5),
central: ("npc.alligator.female.jaw"),
),
chest: (
@ -113,7 +113,7 @@
central: ("npc.salamander.male.head_lower"),
),
jaw: (
offset: (-6.5, -6.0, -3.0),
offset: (-6.5, 0.0, -3.0),
central: ("npc.salamander.male.jaw"),
),
chest: (
@ -139,7 +139,7 @@
central: ("npc.salamander.female.head_lower"),
),
jaw: (
offset: (-6.5, -6.0, -3.0),
offset: (-6.5, 0.0, -3.0),
central: ("npc.salamander.female.jaw"),
),
chest: (
@ -165,7 +165,7 @@
central: ("npc.monitor.male.head_lower"),
),
jaw: (
offset: (-3.0, -3.5, -1.0),
offset: (-3.0, 0.0, -1.0),
central: ("npc.monitor.male.jaw"),
),
chest: (
@ -192,7 +192,7 @@
central: ("npc.monitor.female.head_lower"),
),
jaw: (
offset: (-3.0, -3.5, -1.0),
offset: (-3.0, 0.0, -1.0),
central: ("npc.monitor.female.jaw"),
),
chest: (
@ -218,7 +218,7 @@
central: ("npc.asp.male.head_lower"),
),
jaw: (
offset: (-2.0, -4.0, -1.0),
offset: (-2.0, 0.0, -1.0),
central: ("npc.asp.male.jaw"),
),
chest: (
@ -244,7 +244,7 @@
central: ("npc.asp.female.head_lower"),
),
jaw: (
offset: (-2.0, -4.0, -1.0),
offset: (-2.0, 0.0, -1.0),
central: ("npc.asp.female.jaw"),
),
chest: (
@ -270,7 +270,7 @@
central: ("npc.tortoise.male.head_lower"),
),
jaw: (
offset: (-1.5, -3.5, -1.0),
offset: (-1.5, 0.0, -1.0),
central: ("npc.tortoise.male.jaw"),
),
chest: (
@ -296,7 +296,7 @@
central: ("npc.tortoise.female.head_lower"),
),
jaw: (
offset: (-1.5, -3.5, -1.0),
offset: (-1.5, 0.0, -1.0),
central: ("npc.tortoise.female.jaw"),
),
chest: (
@ -322,7 +322,7 @@
central: ("npc.rocksnapper.male.head_lower"),
),
jaw: (
offset: (-6.5, -6.0, -2.5),
offset: (-6.5, 0.0, -2.5),
central: ("npc.rocksnapper.male.jaw"),
),
chest: (
@ -348,7 +348,7 @@
central: ("npc.rocksnapper.female.head_lower"),
),
jaw: (
offset: (-6.5, -6.0, -2.5),
offset: (-6.5, 0.0, -2.5),
central: ("npc.rocksnapper.female.jaw"),
),
chest: (

View File

@ -5,7 +5,7 @@
central: ("npc.grolgar.male.head_upper"),
),
lower: (
offset: (-6.0, -4.5, -4.0),
offset: (-6.0, -2.0, -8.0),
central: ("npc.grolgar.male.head_lower"),
),
jaw: (
@ -13,7 +13,7 @@
central: ("npc.grolgar.male.jaw"),
),
torso_front: (
offset: (-7.0, -14.0, -8.0),//value in y dimension is full length of model
offset: (-7.0, -11.0, -8.0),//value in y dimension is full length of model
central: ("npc.grolgar.male.torso_front"),
),
torso_back: (
@ -35,7 +35,7 @@
central: ("npc.grolgar.female.head_upper"),
),
lower: (
offset: (-6.0, -4.5, -4.0),
offset: (-6.0, -2.0, -8.0),
central: ("npc.grolgar.female.head_lower"),
),
jaw: (
@ -43,7 +43,7 @@
central: ("npc.grolgar.female.jaw"),
),
torso_front: (
offset: (-7.0, -14.0, -8.0),
offset: (-7.0, -11.0, -8.0),
central: ("npc.grolgar.female.torso_front"),
),
torso_back: (

View File

@ -1,11 +1,11 @@
({
(Grolgar, Male): (
leg_fl: (
offset: (-2.5, -6.0, -3.0),
offset: (-2.5, -12.0, -7.5),//these are done very case by case
lateral: ("npc.grolgar.male.leg_fl"),
),
leg_fr: (
offset: (-2.5, -6.0, -3.0),
offset: (-2.5, -12.0, -7.5),
lateral: ("npc.grolgar.male.leg_fr"),
),
leg_bl: (
@ -35,11 +35,11 @@
),
(Grolgar, Female): (
leg_fl: (
offset: (-2.5, -6.0, -3.0),
offset: (-2.5, -12.0, -7.5),
lateral: ("npc.grolgar.female.leg_fl"),
),
leg_fr: (
offset: (-2.5, -6.0, -3.0),
offset: (-2.5, -12.0, -7.5),
lateral: ("npc.grolgar.female.leg_fr"),
),
leg_bl: (
@ -69,11 +69,11 @@
),
(Saber, Male): (
leg_fl: (
offset: (-2.0, -3.5, -4.5),
offset: (-2.0, -6.0, -4.5),
lateral: ("npc.saber.male.leg_fl"),
),
leg_fr: (
offset: (-2.0, -3.5, -4.5),
offset: (-2.0, -6.0, -4.5),
lateral: ("npc.saber.male.leg_fr"),
),
leg_bl: (
@ -103,11 +103,11 @@
),
(Saber, Female): (
leg_fl: (
offset: (-2.0, -3.5, -4.5),
offset: (-2.0, -6.0, -4.5),
lateral: ("npc.saber.female.leg_fl"),
),
leg_fr: (
offset: (-2.0, -3.5, -4.5),
offset: (-2.0, -6.0, -4.5),
lateral: ("npc.saber.female.leg_fr"),
),
leg_bl: (
@ -137,11 +137,11 @@
),
(Tuskram, Male): (
leg_fl: (
offset: (-2.0, -2.5, -5.0),
offset: (-2.0, -2.5, -10.0),
lateral: ("npc.tuskram.male.leg_fl"),
),
leg_fr: (
offset: (-2.0, -2.5, -5.0),
offset: (-2.0, -2.5, -10.0),
lateral: ("npc.tuskram.male.leg_fr"),
),
leg_bl: (
@ -171,11 +171,11 @@
),
(Tuskram, Female): (
leg_fl: (
offset: (-2.0, -2.5, -5.0),
offset: (-2.0, -2.5, -10.0),
lateral: ("npc.tuskram.female.leg_fl"),
),
leg_fr: (
offset: (-2.0, -2.5, -5.0),
offset: (-2.0, -2.5, -10.0),
lateral: ("npc.tuskram.female.leg_fr"),
),
leg_bl: (
@ -205,19 +205,19 @@
),
(Lion, Male): (
leg_fl: (
offset: (-2.0, -2.5, -2.5),
offset: (-2.0, -2.5, -7.5),
lateral: ("npc.lion.male.leg_fl"),
),
leg_fr: (
offset: (-2.0, -2.5, -2.5),
offset: (-2.0, -2.5, -7.5),
lateral: ("npc.lion.male.leg_fr"),
),
leg_bl: (
offset: (-2.0, -3.0, -4.0),
offset: (-2.0, -3.0, -6.0),
lateral: ("npc.lion.male.leg_bl"),
),
leg_br: (
offset: (-2.0, -3.0, -4.0),
offset: (-2.0, -3.0, -6.0),
lateral: ("npc.lion.male.leg_br"),
),
foot_fl: (
@ -239,19 +239,19 @@
),
(Lion, Female): (
leg_fl: (
offset: (-2.0, -2.5, -2.5),
offset: (-2.0, -2.5, -7.5),
lateral: ("npc.lion.female.leg_fl"),
),
leg_fr: (
offset: (-2.0, -2.5, -2.5),
offset: (-2.0, -2.5, -7.5),
lateral: ("npc.lion.female.leg_fr"),
),
leg_bl: (
offset: (-2.0, -3.0, -4.0),
offset: (-2.0, -3.0, -6.0),
lateral: ("npc.lion.female.leg_bl"),
),
leg_br: (
offset: (-2.0, -3.0, -4.0),
offset: (-2.0, -3.0, -6.0),
lateral: ("npc.lion.female.leg_br"),
),
foot_fl: (

View File

@ -21,8 +21,8 @@ impl Animation for IdleAnimation {
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let ultra_slow = 0.0 * (anim_time as f32 * 1.0).sin();
let slow = 0.0 * (anim_time as f32 * 2.5).sin();
let slower = (anim_time as f32 * 1.25).sin();
let slow = (anim_time as f32 * 2.5).sin();
let slowalt = (anim_time as f32 * 2.5 + PI / 2.0).sin();
let dragon_look = Vec2::new(
@ -41,7 +41,7 @@ impl Animation for IdleAnimation {
next.head_upper.offset = Vec3::new(
0.0,
skeleton_attr.head_upper.0,
skeleton_attr.head_upper.1 + ultra_slow * 0.20,
skeleton_attr.head_upper.1 + slower * 0.20,
);
next.head_upper.ori = Quaternion::rotation_z(0.8 * dragon_look.x)
* Quaternion::rotation_x(0.8 * dragon_look.y);
@ -50,7 +50,7 @@ impl Animation for IdleAnimation {
next.head_lower.offset = Vec3::new(
0.0,
skeleton_attr.head_lower.0,
skeleton_attr.head_lower.1 + ultra_slow * 0.20,
skeleton_attr.head_lower.1 + slower * 0.20,
);
next.head_lower.ori = Quaternion::rotation_z(0.8 * dragon_look.x)
* Quaternion::rotation_x(0.8 * dragon_look.y);
@ -63,7 +63,7 @@ impl Animation for IdleAnimation {
next.chest.offset = Vec3::new(0.0, skeleton_attr.chest.0, skeleton_attr.chest.1)
* skeleton_attr.scaler
/ 11.0;
next.chest.ori = Quaternion::rotation_y(slow * 0.01);
next.chest.ori = Quaternion::rotation_y(slow * 0.03);
next.chest.scale = Vec3::one() * skeleton_attr.scaler / 11.0;
next.tail_front.offset =
@ -81,7 +81,7 @@ impl Animation for IdleAnimation {
skeleton_attr.feet_f.1,
skeleton_attr.feet_f.2,
);
next.foot_fl.ori = Quaternion::rotation_z(0.0);
next.foot_fl.ori = Quaternion::rotation_y(slow * -0.05);
next.foot_fl.scale = Vec3::one();
next.foot_fr.offset = Vec3::new(
@ -89,7 +89,7 @@ impl Animation for IdleAnimation {
skeleton_attr.feet_f.1,
skeleton_attr.feet_f.2,
);
next.foot_fr.ori = Quaternion::rotation_x(0.0);
next.foot_fr.ori = Quaternion::rotation_y(slow * -0.05);
next.foot_fr.scale = Vec3::one();
next.foot_bl.offset = Vec3::new(
@ -97,7 +97,7 @@ impl Animation for IdleAnimation {
skeleton_attr.feet_b.1,
skeleton_attr.feet_b.2,
);
next.foot_bl.ori = Quaternion::rotation_x(0.0);
next.foot_bl.ori = Quaternion::rotation_y(slow * -0.05);
next.foot_bl.scale = Vec3::one();
next.foot_br.offset = Vec3::new(
@ -105,7 +105,7 @@ impl Animation for IdleAnimation {
skeleton_attr.feet_b.1,
skeleton_attr.feet_b.2,
);
next.foot_br.ori = Quaternion::rotation_x(0.0);
next.foot_br.ori = Quaternion::rotation_y(slow * -0.05);
next.foot_br.scale = Vec3::one();
next

View File

@ -15,76 +15,48 @@ impl Animation for JumpAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
_global_time: Self::Dependency,
anim_time: f64,
_anim_time: f64,
_rate: &mut f32,
skeleton_attr: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let lab = 12.0;
next.head_upper.offset =
Vec3::new(0.0, skeleton_attr.head_upper.0, skeleton_attr.head_upper.1);
next.head_upper.ori = Quaternion::rotation_z(0.4) * Quaternion::rotation_x(0.0);
next.head_upper.scale = Vec3::one();
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 wave_slow = (anim_time as f32 * 3.5 + PI).sin();
next.head_lower.offset =
Vec3::new(0.0, skeleton_attr.head_lower.0, skeleton_attr.head_lower.1);
next.head_lower.ori = Quaternion::rotation_z(0.2);
next.head_lower.scale = Vec3::one();
let footl = (anim_time as f32 * lab as f32 + PI).sin();
let footr = (anim_time as f32 * lab as f32).sin();
next.jaw.offset = Vec3::new(0.0, skeleton_attr.jaw.0, skeleton_attr.jaw.1);
next.jaw.ori = Quaternion::rotation_x(-0.3);
next.jaw.scale = Vec3::one() * 0.98;
let center = (anim_time as f32 * lab as f32 + PI / 2.0).sin();
let centeroffset = (anim_time as f32 * lab as f32 + PI * 1.5).sin();
next.chest.offset = Vec3::new(0.0, skeleton_attr.chest.0, skeleton_attr.chest.1)
* skeleton_attr.scaler
/ 11.0;
next.chest.ori = Quaternion::rotation_y(0.0);
next.chest.scale = Vec3::one() * skeleton_attr.scaler / 11.0;
next.head_upper.offset = Vec3::new(
0.0,
skeleton_attr.head_upper.0,
skeleton_attr.head_upper.1 + wave_ultra_slow * 0.20,
);
next.head_upper.ori =
Quaternion::rotation_z(0.0) * Quaternion::rotation_x(wave_ultra_slow * -0.10);
next.head_upper.scale = Vec3::one() * 1.05;
next.head_lower.offset = Vec3::new(
0.0,
skeleton_attr.head_lower.0,
skeleton_attr.head_lower.1 + wave_ultra_slow * 0.20,
);
next.head_lower.ori =
Quaternion::rotation_z(0.0) * Quaternion::rotation_x(wave_ultra_slow * -0.10);
next.head_lower.scale = Vec3::one() * 1.05;
next.jaw.offset = Vec3::new(
0.0,
skeleton_attr.jaw.0 - wave_ultra_slow_cos * 0.12,
skeleton_attr.jaw.1 + wave_slow * 0.2,
);
next.jaw.ori = Quaternion::rotation_x(wave_slow * 0.03);
next.jaw.scale = Vec3::one() * 1.05;
next.tail_front.offset = Vec3::new(
0.0,
skeleton_attr.tail_front.0,
skeleton_attr.tail_front.1 + centeroffset * 0.6,
);
next.tail_front.ori = Quaternion::rotation_x(center * 0.03);
next.tail_front.offset =
Vec3::new(0.0, skeleton_attr.tail_front.0, skeleton_attr.tail_front.1);
next.tail_front.ori = Quaternion::rotation_x(0.15) * Quaternion::rotation_z(-0.2);
next.tail_front.scale = Vec3::one() * 0.98;
next.tail_rear.offset = Vec3::new(
0.0,
skeleton_attr.tail_rear.0,
skeleton_attr.tail_rear.1 + centeroffset * 0.6,
);
next.tail_rear.ori = Quaternion::rotation_x(center * 0.03);
next.tail_rear.offset =
Vec3::new(0.0, skeleton_attr.tail_rear.0, skeleton_attr.tail_rear.1);
next.tail_rear.ori = Quaternion::rotation_z(-0.4) * Quaternion::rotation_x(-0.12);
next.tail_rear.scale = Vec3::one() * 0.98;
next.chest.offset = Vec3::new(0.0, skeleton_attr.chest.0, skeleton_attr.chest.1);
next.chest.ori = Quaternion::rotation_y(center * 0.05);
next.chest.scale = Vec3::one();
next.foot_fl.offset = Vec3::new(
-skeleton_attr.feet_f.0,
skeleton_attr.feet_f.1,
skeleton_attr.feet_f.2,
);
next.foot_fl.ori = Quaternion::rotation_x(-1.3 + footl * 0.06);
next.foot_fl.ori = Quaternion::rotation_z(0.3);
next.foot_fl.scale = Vec3::one();
next.foot_fr.offset = Vec3::new(
@ -92,7 +64,7 @@ impl Animation for JumpAnimation {
skeleton_attr.feet_f.1,
skeleton_attr.feet_f.2,
);
next.foot_fr.ori = Quaternion::rotation_x(-1.3 + footr * 0.06);
next.foot_fr.ori = Quaternion::rotation_z(0.3);
next.foot_fr.scale = Vec3::one();
next.foot_bl.offset = Vec3::new(
@ -100,7 +72,7 @@ impl Animation for JumpAnimation {
skeleton_attr.feet_b.1,
skeleton_attr.feet_b.2,
);
next.foot_bl.ori = Quaternion::rotation_x(-1.3 + footl * 0.06);
next.foot_bl.ori = Quaternion::rotation_y(0.0);
next.foot_bl.scale = Vec3::one();
next.foot_br.offset = Vec3::new(
@ -108,7 +80,7 @@ impl Animation for JumpAnimation {
skeleton_attr.feet_b.1,
skeleton_attr.feet_b.2,
);
next.foot_br.ori = Quaternion::rotation_x(-1.3 + footr * 0.06);
next.foot_br.ori = Quaternion::rotation_y(0.0);
next.foot_br.scale = Vec3::one();
next

View File

@ -94,6 +94,7 @@ pub struct SkeletonAttr {
feet_b: (f32, f32, f32),
lean: (f32, f32),
scaler: f32,
tempo: f32,
}
impl<'a> std::convert::TryFrom<&'a comp::Body> for SkeletonAttr {
@ -120,6 +121,7 @@ impl Default for SkeletonAttr {
feet_b: (0.0, 0.0, 0.0),
lean: (0.0, 0.0),
scaler: 0.0,
tempo: 0.0,
}
}
}
@ -149,14 +151,14 @@ impl<'a> From<&'a comp::quadruped_low::Body> for SkeletonAttr {
(Pangolin, _) => (8.0, -9.0),
},
jaw: match (body.species, body.body_type) {
(Crocodile, _) => (0.0, -3.0),
(Alligator, _) => (8.5, -2.0),
(Salamander, _) => (0.0, -2.0),
(Monitor, _) => (0.0, -1.0),
(Asp, _) => (1.0, -2.0),
(Tortoise, _) => (0.5, -2.0),
(Rocksnapper, _) => (0.5, -1.5),
(Pangolin, _) => (0.5, -1.5),
(Crocodile, _) => (-6.0, -3.0),
(Alligator, _) => (2.5, -2.0),
(Salamander, _) => (-6.0, -2.0),
(Monitor, _) => (-2.0, -1.0),
(Asp, _) => (-3.0, -2.0),
(Tortoise, _) => (-3.5, -2.0),
(Rocksnapper, _) => (-5.0, -1.5),
(Pangolin, _) => (0.0, 0.0),
},
chest: match (body.species, body.body_type) {
(Crocodile, _) => (0.0, 5.0),
@ -174,7 +176,7 @@ impl<'a> From<&'a comp::quadruped_low::Body> for SkeletonAttr {
(Salamander, _) => (-9.0, 0.0),
(Monitor, _) => (-12.0, 0.0),
(Asp, _) => (-14.0, -2.0),
(Tortoise, _) => (-7.0, -1.5),
(Tortoise, _) => (-10.0, -1.5),
(Rocksnapper, _) => (-14.5, -2.0),
(Pangolin, _) => (-7.0, -3.0),
},
@ -184,7 +186,7 @@ impl<'a> From<&'a comp::quadruped_low::Body> for SkeletonAttr {
(Salamander, _) => (-7.5, 0.0),
(Monitor, _) => (-6.5, 0.0),
(Asp, _) => (-6.0, -2.0),
(Tortoise, _) => (-10.0, -3.5),
(Tortoise, _) => (-13.0, -3.5),
(Rocksnapper, _) => (-13.5, -6.5),
(Pangolin, _) => (-7.5, -0.5),
},
@ -202,9 +204,9 @@ impl<'a> From<&'a comp::quadruped_low::Body> for SkeletonAttr {
(Crocodile, _) => (3.5, -6.0, -1.0),
(Alligator, _) => (4.5, -5.5, -1.0),
(Salamander, _) => (4.0, -6.0, -2.0),
(Monitor, _) => (3.0, -6.0, 0.0),
(Monitor, _) => (2.5, -6.5, 0.0),
(Asp, _) => (2.5, -5.5, -1.0),
(Tortoise, _) => (7.0, -11.5, -3.0),
(Tortoise, _) => (6.0, -11.5, -3.0),
(Rocksnapper, _) => (8.0, -16.0, -9.5),
(Pangolin, _) => (6.0, -4.0, -1.0),
},
@ -217,11 +219,21 @@ impl<'a> From<&'a comp::quadruped_low::Body> for SkeletonAttr {
(Alligator, _) => (1.5),
(Salamander, _) => (1.4),
(Monitor, _) => (1.1),
(Asp, _) => (1.2),
(Asp, _) => (1.4),
(Tortoise, _) => (1.0),
(Rocksnapper, _) => (1.2),
(Rocksnapper, _) => (1.4),
(Pangolin, _) => (1.3),
},
tempo: match (body.species, body.body_type) {
(Crocodile, _) => (0.8),
(Alligator, _) => (0.8),
(Salamander, _) => (1.0),
(Monitor, _) => (1.3),
(Asp, _) => (1.0),
(Tortoise, _) => (0.7),
(Rocksnapper, _) => (0.9),
(Pangolin, _) => (1.15),
},
}
}
}

View File

@ -21,10 +21,7 @@ impl Animation for RunAnimation {
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let lab = 0.7 * (skeleton_attr.lean.0 + 1.0) * (1.0 / skeleton_attr.scaler);
let center = (anim_time as f32 * lab as f32 + PI / 2.0).sin();
let centeroffset = (anim_time as f32 * lab as f32 + PI * 1.5).sin();
let lab = 0.7 * skeleton_attr.tempo;
let short = (((1.0)
/ (0.72
@ -42,6 +39,8 @@ impl Animation for RunAnimation {
.powf(2.0 as f32)))
.sqrt())
* ((anim_time as f32 * 16.0 * lab as f32 + PI * 1.45).sin());
let footvertl = (anim_time as f32 * 16.0 * lab as f32 + PI * 0.0).sin();
let foothorir = (((1.0)
/ (0.4
+ (0.6)
@ -49,53 +48,27 @@ impl Animation for RunAnimation {
.powf(2.0 as f32)))
.sqrt())
* ((anim_time as f32 * 16.0 * lab as f32 + PI * 0.45).sin());
let footvertl = (anim_time as f32 * 16.0 * lab as f32 + PI * 0.0).sin();
let footvertr = (anim_time as f32 * 16.0 * lab as f32 + PI).sin();
let footrotl = (((1.0)
/ (0.4
+ (0.6)
* ((anim_time as f32 * 16.0 * lab as f32 + PI * 1.4).sin()).powf(2.0 as f32)))
.sqrt())
* ((anim_time as f32 * 16.0 * lab as f32 + PI * 1.4).sin());
let footrotr = (((1.0)
/ (0.4
+ (0.6)
* ((anim_time as f32 * 16.0 * lab as f32 + PI * 0.4).sin()).powf(2.0 as f32)))
.sqrt())
* ((anim_time as f32 * 16.0 * lab as f32 + PI * 0.4).sin());
//
let foothorilb = (((1.0)
/ (0.4
+ (0.6)
* ((anim_time as f32 * 16.0 * lab as f32 + PI * 1.25).sin())
* ((anim_time as f32 * 16.0 * lab as f32 + PI * 1.05).sin())
.powf(2.0 as f32)))
.sqrt())
* ((anim_time as f32 * 16.0 * lab as f32 + PI * 1.25).sin());
* ((anim_time as f32 * 16.0 * lab as f32 + PI * 1.05).sin());
let footvertlb = (anim_time as f32 * 16.0 * lab as f32 + PI * (-0.4)).sin();
let foothorirb = (((1.0)
/ (0.4
+ (0.6)
* ((anim_time as f32 * 16.0 * lab as f32 + PI * 0.25).sin())
* ((anim_time as f32 * 16.0 * lab as f32 + PI * 0.05).sin())
.powf(2.0 as f32)))
.sqrt())
* ((anim_time as f32 * 16.0 * lab as f32 + PI * 0.25).sin());
let footvertlb = (anim_time as f32 * 16.0 * lab as f32 + PI * (-0.2)).sin();
let footvertrb = (anim_time as f32 * 16.0 * lab as f32 + PI * 0.8).sin();
* ((anim_time as f32 * 16.0 * lab as f32 + PI * 0.05).sin());
let footvertrb = (anim_time as f32 * 16.0 * lab as f32 + PI * 0.6).sin();
let footrotlb = (((1.0)
/ (0.4
+ (0.6)
* ((anim_time as f32 * 16.0 * lab as f32 + PI * 1.2).sin()).powf(2.0 as f32)))
.sqrt())
* ((anim_time as f32 * 16.0 * lab as f32 + PI * 1.2).sin());
let footrotrb = (((1.0)
/ (0.4
+ (0.6)
* ((anim_time as f32 * 16.0 * lab as f32 + PI * 0.2).sin()).powf(2.0 as f32)))
.sqrt())
* ((anim_time as f32 * 16.0 * lab as f32 + PI * 0.2).sin());
let ori = Vec2::from(orientation);
let last_ori = Vec2::from(last_ori);
let tilt = if Vec2::new(ori, last_ori)
@ -139,7 +112,7 @@ impl Animation for RunAnimation {
next.tail_rear.offset = Vec3::new(
0.0,
skeleton_attr.tail_rear.0,
skeleton_attr.tail_rear.1 + centeroffset * 0.6,
skeleton_attr.tail_rear.1 + shortalt * 0.6,
);
next.tail_rear.ori = Quaternion::rotation_z(shortalt * 0.25 + tilt * 1.6)
* Quaternion::rotation_y(shortalt * 0.1)
@ -150,7 +123,7 @@ impl Animation for RunAnimation {
* skeleton_attr.scaler
/ 11.0;
next.chest.ori = Quaternion::rotation_z(short * 0.13 + tilt * -1.9)
* Quaternion::rotation_y(shortalt * 0.12)
* Quaternion::rotation_y(short * 0.12)
* Quaternion::rotation_x(skeleton_attr.lean.0);
next.chest.scale = Vec3::one() * skeleton_attr.scaler / 11.0;
@ -159,9 +132,9 @@ impl Animation for RunAnimation {
skeleton_attr.feet_f.1 + foothoril * -1.0,
skeleton_attr.feet_f.2 + 1.0 + ((footvertl * -0.8).max(-0.0)),
);
next.foot_fl.ori =
Quaternion::rotation_x(footrotl * -0.25 * skeleton_attr.lean.1 - skeleton_attr.lean.0)
* Quaternion::rotation_z(footrotl * 0.4 * skeleton_attr.lean.1);
next.foot_fl.ori = Quaternion::rotation_x(
-0.2 + footvertl * -0.35 * skeleton_attr.lean.1 - skeleton_attr.lean.0,
) * Quaternion::rotation_z(footvertl * 0.4 * skeleton_attr.lean.1);
next.foot_fl.scale = Vec3::one();
next.foot_fr.offset = Vec3::new(
@ -170,8 +143,9 @@ impl Animation for RunAnimation {
skeleton_attr.feet_f.2 + 1.0 + ((footvertr * -0.8).max(-0.0)),
);
next.foot_fr.ori =
Quaternion::rotation_x(footrotr * -0.25 * skeleton_attr.lean.1 - skeleton_attr.lean.0)
* Quaternion::rotation_z(footrotr * -0.4 * skeleton_attr.lean.1 + tilt * 3.5);
Quaternion::rotation_x(
-0.2 + footvertr * -0.25 * skeleton_attr.lean.1 - skeleton_attr.lean.0,
) * Quaternion::rotation_z(footvertr * -0.4 * skeleton_attr.lean.1 + tilt * 3.5);
next.foot_fr.scale = Vec3::one();
next.foot_bl.offset = Vec3::new(
@ -179,8 +153,8 @@ impl Animation for RunAnimation {
skeleton_attr.feet_b.1 + foothorilb * -1.0,
skeleton_attr.feet_b.2 + 1.0 + ((footvertlb * -0.6).max(-0.0)),
);
next.foot_bl.ori = Quaternion::rotation_x(footrotlb * -0.25 - skeleton_attr.lean.0)
* Quaternion::rotation_z(footrotlb * 0.4);
next.foot_bl.ori = Quaternion::rotation_x(-0.2 + footvertlb * -0.3 - skeleton_attr.lean.0)
* Quaternion::rotation_z(footvertlb * 0.4);
next.foot_bl.scale = Vec3::one();
next.foot_br.offset = Vec3::new(
@ -188,8 +162,8 @@ impl Animation for RunAnimation {
skeleton_attr.feet_b.1 + foothorirb * -1.0,
skeleton_attr.feet_b.2 + 1.0 + ((footvertrb * -0.6).max(-0.0)),
);
next.foot_br.ori = Quaternion::rotation_x(footrotrb * -0.25 - skeleton_attr.lean.0)
* Quaternion::rotation_z(footrotrb * -0.4);
next.foot_br.ori = Quaternion::rotation_x(-0.2 + footvertrb * -0.3 - skeleton_attr.lean.0)
* Quaternion::rotation_z(footvertrb * -0.4);
next.foot_br.scale = Vec3::one();
next

View File

@ -1,5 +1,5 @@
use super::{super::Animation, QuadrupedMediumSkeleton, SkeletonAttr};
use std::{f32::consts::PI, ops::Mul};
use std::f32::consts::PI;
use vek::*;
pub struct AlphaAnimation;
@ -21,40 +21,11 @@ impl Animation for AlphaAnimation {
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let slower = (anim_time as f32 * 1.0 + PI).sin();
let wave_ultra_slow_cos = (anim_time as f32 * 1.0 + PI).cos();
let slow = (anim_time as f32 * 3.5 + PI).sin();
let wave_slow_cos = (anim_time as f32 * 3.5 + PI).cos();
let short = (((1.0)
/ (0.5 + 0.5 * ((anim_time as f32 * 2.0 + PI * 1.0).sin()).powf(2.0 as f32)))
.sqrt())
* ((anim_time as f32 * 2.0 + PI * 1.0).sin());
let look = Vec2::new(
((global_time + anim_time) as f32 / 8.0)
.floor()
.mul(7331.0)
.sin()
* 0.5,
((global_time + anim_time) as f32 / 8.0)
.floor()
.mul(1337.0)
.sin()
* 0.25,
);
let tailmove = Vec2::new(
((global_time + anim_time) as f32 / 2.0)
.floor()
.mul(7331.0)
.sin()
* 0.25,
((global_time + anim_time) as f32 / 2.0)
.floor()
.mul(1337.0)
.sin()
* 0.125,
);
let random = ((((2.0
* ((global_time as f32 - anim_time as f32)
- ((global_time as f32 - anim_time as f32).round())))

View File

@ -22,9 +22,7 @@ impl Animation for IdleAnimation {
let mut next = (*skeleton).clone();
let slower = (anim_time as f32 * 1.0 + PI).sin();
let wave_ultra_slow_cos = (anim_time as f32 * 1.0 + PI).cos();
let slow = (anim_time as f32 * 3.5 + PI).sin();
let wave_slow_cos = (anim_time as f32 * 3.5 + PI).cos();
let look = Vec2::new(
((global_time + anim_time) as f32 / 8.0)
@ -70,7 +68,7 @@ impl Animation for IdleAnimation {
next.jaw.offset = Vec3::new(
0.0,
skeleton_attr.jaw.0 - wave_ultra_slow_cos * 0.12,
skeleton_attr.jaw.0 - slower * 0.12,
skeleton_attr.jaw.1 + slow * 0.2,
);
next.jaw.ori = Quaternion::rotation_x(slow * 0.05);
@ -110,7 +108,7 @@ impl Animation for IdleAnimation {
skeleton_attr.leg_f.2 + slow * -0.15 + slower * -0.15,
);
next.leg_fl.ori = Quaternion::rotation_y(slow * -0.02);
next.leg_fl.scale = Vec3::one();
next.leg_fl.scale = Vec3::one() * 1.02;
next.leg_fr.offset = Vec3::new(
skeleton_attr.leg_f.0,
@ -118,7 +116,7 @@ impl Animation for IdleAnimation {
skeleton_attr.leg_f.2 + slow * 0.15 + slower * -0.15,
);
next.leg_fr.ori = Quaternion::rotation_y(slow * -0.02);
next.leg_fr.scale = Vec3::one();
next.leg_fr.scale = Vec3::one() * 1.02;
next.leg_bl.offset = Vec3::new(
-skeleton_attr.leg_b.0,
@ -126,15 +124,15 @@ impl Animation for IdleAnimation {
skeleton_attr.leg_b.2 + slower * -0.3,
);
next.leg_bl.ori = Quaternion::rotation_y(slow * -0.02);
next.leg_bl.scale = Vec3::one();
next.leg_bl.scale = Vec3::one() * 1.02;
next.leg_br.offset = Vec3::new(
skeleton_attr.leg_b.0,
skeleton_attr.leg_b.1,
skeleton_attr.leg_b.2 + slower * -0.5,
skeleton_attr.leg_b.2 + slower * -0.3,
);
next.leg_br.ori = Quaternion::rotation_y(slow * -0.02);
next.leg_br.scale = Vec3::one();
next.leg_br.scale = Vec3::one() * 1.02;
next.foot_fl.offset = Vec3::new(
-skeleton_attr.feet_f.0,
@ -142,7 +140,7 @@ impl Animation for IdleAnimation {
skeleton_attr.feet_f.2 + slower * -0.2,
);
next.foot_fl.ori = Quaternion::rotation_x(0.0);
next.foot_fl.scale = Vec3::one();
next.foot_fl.scale = Vec3::one() * 0.96;
next.foot_fr.offset = Vec3::new(
skeleton_attr.feet_f.0,
@ -158,7 +156,7 @@ impl Animation for IdleAnimation {
skeleton_attr.feet_b.2 + slower * -0.2,
);
next.foot_bl.ori = Quaternion::rotation_x(0.0);
next.foot_bl.scale = Vec3::one();
next.foot_bl.scale = Vec3::one() * 0.96;
next.foot_br.offset = Vec3::new(
skeleton_attr.feet_b.0,
@ -166,7 +164,7 @@ impl Animation for IdleAnimation {
skeleton_attr.feet_b.2 + slower * -0.2,
);
next.foot_br.ori = Quaternion::rotation_x(0.0);
next.foot_br.scale = Vec3::one();
next.foot_br.scale = Vec3::one() * 0.96;
next
}

View File

@ -4,7 +4,7 @@ use vek::*;
pub struct JumpAnimation;
impl Animation for JumpAnimation {
type Dependency = (f32, f64);
type Dependency = f64;
type Skeleton = QuadrupedMediumSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -20,80 +20,107 @@ impl Animation for JumpAnimation {
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
next.head_upper.offset = Vec3::new(
0.0,
skeleton_attr.head_upper.0,
skeleton_attr.head_upper.1 + 3.0,
) / 11.0;
next.head_upper.ori = Quaternion::rotation_z(0.8) * Quaternion::rotation_x(0.5);
next.head_upper.scale = Vec3::one() / 10.98;
next.head_upper.offset =
Vec3::new(0.0, skeleton_attr.head_upper.0, skeleton_attr.head_upper.1);
next.head_upper.ori = Quaternion::rotation_z(0.4) * Quaternion::rotation_x(0.3);
next.head_upper.scale = Vec3::one();
next.head_lower.offset =
Vec3::new(0.0, skeleton_attr.head_lower.0, skeleton_attr.head_lower.1);
next.head_lower.ori = Quaternion::rotation_x(-0.4);
next.head_lower.ori = Quaternion::rotation_z(0.2) * Quaternion::rotation_x(0.3);
next.head_lower.scale = Vec3::one() * 1.02;
next.jaw.offset = Vec3::new(0.0, skeleton_attr.jaw.0, skeleton_attr.jaw.1);
next.jaw.ori = Quaternion::rotation_x(0.0);
next.jaw.scale = Vec3::one() * 0.98;
next.jaw.ori = Quaternion::rotation_x(-0.4);
next.jaw.scale = Vec3::one() * 1.02;
next.tail.offset = Vec3::new(0.0, skeleton_attr.tail.0, skeleton_attr.tail.1);
next.tail.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.tail.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(-0.3);
next.tail.scale = Vec3::one();
next.torso_back.offset = Vec3::new(
0.0,
skeleton_attr.torso_back.0,
skeleton_attr.torso_back.1 + 2.0,
) / 11.0;
next.torso_back.ori = Quaternion::rotation_z(-0.8)
* Quaternion::rotation_z(0.0)
* Quaternion::rotation_x(0.2);
next.torso_back.scale = Vec3::one() / 11.0;
next.torso_front.offset = Vec3::new(
0.0,
skeleton_attr.torso_front.0,
skeleton_attr.torso_front.1,
) / 11.0;
next.torso_front.ori = Quaternion::rotation_x(-0.4);
next.torso_front.scale = Vec3::one() / 10.98;
) * skeleton_attr.scaler
/ 11.0;
next.torso_front.ori = Quaternion::rotation_y(0.0);
next.torso_front.scale = Vec3::one() * skeleton_attr.scaler / 11.0;
next.torso_back.offset =
Vec3::new(0.0, skeleton_attr.torso_back.0, skeleton_attr.torso_back.1);
next.torso_back.ori = Quaternion::rotation_z(-0.3)
* Quaternion::rotation_z(0.0)
* Quaternion::rotation_x(0.0);
next.torso_back.scale = Vec3::one();
next.ears.offset = Vec3::new(0.0, skeleton_attr.ears.0, skeleton_attr.ears.1);
next.ears.ori = Quaternion::rotation_x(0.0);
next.ears.scale = Vec3::one() / 1.02;
next.ears.ori = Quaternion::rotation_x(0.6);
next.ears.scale = Vec3::one() * 1.02;
next.leg_fl.offset = Vec3::new(
-skeleton_attr.leg_f.0,
skeleton_attr.leg_f.1,
skeleton_attr.leg_f.2,
);
next.leg_fl.ori = Quaternion::rotation_x(-0.4);
next.leg_fl.scale = Vec3::one();
next.leg_fr.offset = Vec3::new(
skeleton_attr.leg_f.0,
skeleton_attr.leg_f.1,
skeleton_attr.leg_f.2,
);
next.leg_fr.ori = Quaternion::rotation_x(0.4);
next.leg_fr.scale = Vec3::one();
next.leg_bl.offset = Vec3::new(
-skeleton_attr.leg_b.0,
skeleton_attr.leg_b.1,
skeleton_attr.leg_b.2,
);
next.leg_bl.ori = Quaternion::rotation_y(0.0);
next.leg_bl.scale = Vec3::one();
next.leg_br.offset = Vec3::new(
skeleton_attr.leg_b.0,
skeleton_attr.leg_b.1,
skeleton_attr.leg_b.2,
);
next.leg_br.ori = Quaternion::rotation_y(0.0);
next.leg_br.scale = Vec3::one();
next.foot_fl.offset = Vec3::new(
-skeleton_attr.feet_f.0,
skeleton_attr.feet_f.1,
skeleton_attr.feet_f.2,
) / 11.0;
next.foot_fl.ori = Quaternion::rotation_x(0.0);
next.foot_fl.scale = Vec3::one() / 11.0;
);
next.foot_fl.ori = Quaternion::rotation_x(-0.3);
next.foot_fl.scale = Vec3::one();
next.foot_fr.offset = Vec3::new(
skeleton_attr.feet_f.0,
skeleton_attr.feet_f.1,
skeleton_attr.feet_f.2,
) / 11.0;
next.foot_fr.ori = Quaternion::rotation_x(0.0);
next.foot_fr.scale = Vec3::one() / 11.0;
);
next.foot_fr.ori = Quaternion::rotation_x(0.2);
next.foot_fr.scale = Vec3::one();
next.foot_bl.offset = Vec3::new(
-skeleton_attr.feet_b.0,
skeleton_attr.feet_b.1,
skeleton_attr.feet_b.2,
) / 11.0;
);
next.foot_bl.ori = Quaternion::rotation_x(0.0);
next.foot_bl.scale = Vec3::one() / 11.0;
next.foot_bl.scale = Vec3::one();
next.foot_br.offset = Vec3::new(
skeleton_attr.feet_b.0,
skeleton_attr.feet_b.1,
skeleton_attr.feet_b.2,
) / 11.0;
);
next.foot_br.ori = Quaternion::rotation_x(0.0);
next.foot_br.scale = Vec3::one() / 11.0;
next.foot_br.scale = Vec3::one();
next
}

View File

@ -132,6 +132,8 @@ pub struct SkeletonAttr {
feet_b: (f32, f32, f32),
scaler: f32,
dampen: f32,
maximize: f32,
tempo: f32,
}
impl<'a> std::convert::TryFrom<&'a comp::Body> for SkeletonAttr {
@ -161,6 +163,8 @@ impl Default for SkeletonAttr {
feet_b: (0.0, 0.0, 0.0),
scaler: 0.0,
dampen: 0.0,
maximize: 0.0,
tempo: 0.0,
}
}
}
@ -170,7 +174,7 @@ impl<'a> From<&'a comp::quadruped_medium::Body> for SkeletonAttr {
use comp::quadruped_medium::Species::*;
Self {
head_upper: match (body.species, body.body_type) {
(Grolgar, _) => (-8.0, 1.5),
(Grolgar, _) => (0.0, -1.0),
(Saber, _) => (0.0, -3.0),
(Tuskram, _) => (0.0, 1.0),
(Lion, _) => (2.5, 2.0),
@ -181,7 +185,7 @@ impl<'a> From<&'a comp::quadruped_medium::Body> for SkeletonAttr {
(Mouflon, _) => (-2.5, 6.0),
},
head_lower: match (body.species, body.body_type) {
(Grolgar, _) => (3.5, -3.0),
(Grolgar, _) => (1.0, -1.0),
(Saber, _) => (1.0, 0.0),
(Tuskram, _) => (1.0, 1.0),
(Lion, _) => (0.5, 1.0),
@ -192,7 +196,7 @@ impl<'a> From<&'a comp::quadruped_medium::Body> for SkeletonAttr {
(Mouflon, _) => (-1.0, 0.5),
},
jaw: match (body.species, body.body_type) {
(Grolgar, _) => (8.5, 4.5),
(Grolgar, _) => (8.5, 1.5),
(Saber, _) => (3.5, -2.0),
(Tuskram, _) => (5.5, -4.0),
(Lion, _) => (3.5, -4.5),
@ -214,10 +218,10 @@ impl<'a> From<&'a comp::quadruped_medium::Body> for SkeletonAttr {
(Mouflon, _) => (-10.5, 3.0),
},
torso_front: match (body.species, body.body_type) {
(Grolgar, _) => (10.0, 11.0),
(Saber, _) => (14.0, 13.0),
(Grolgar, _) => (10.0, 13.0),
(Saber, _) => (14.0, 14.0),
(Tuskram, _) => (10.0, 14.5),
(Lion, _) => (10.0, 13.0),
(Lion, _) => (10.0, 14.0),
(Tarasque, _) => (11.5, 18.5),
(Tiger, _) => (10.0, 14.0),
(Wolf, _) => (12.0, 13.0),
@ -225,7 +229,7 @@ impl<'a> From<&'a comp::quadruped_medium::Body> for SkeletonAttr {
(Mouflon, _) => (11.0, 13.5),
},
torso_back: match (body.species, body.body_type) {
(Grolgar, _) => (-14.0, 1.5),
(Grolgar, _) => (-10.0, 1.5),
(Saber, _) => (-13.5, 0.0),
(Tuskram, _) => (-13.0, -2.0),
(Lion, _) => (-13.0, -0.5),
@ -247,32 +251,32 @@ impl<'a> From<&'a comp::quadruped_medium::Body> for SkeletonAttr {
(Mouflon, _) => (2.5, 5.0),
},
leg_f: match (body.species, body.body_type) {
(Grolgar, _) => (-7.0, -5.0, -2.0),
(Saber, _) => (7.0, -7.5, -3.5),
(Tuskram, _) => (6.0, -6.5, -5.5),
(Lion, _) => (6.5, -9.0, -6.0),
(Grolgar, _) => (-7.0, 4.0, 0.0),
(Saber, _) => (7.0, -4.0, -3.5),
(Tuskram, _) => (6.0, -6.5, -0.5),
(Lion, _) => (6.5, -8.0, -2.0),
(Tarasque, _) => (7.0, -8.0, -6.0),
(Tiger, _) => (7.0, -5.0, -3.0),
(Wolf, _) => (4.5, -6.5, -1.0),
(Frostfang, _) => (5.5, -5.5, -2.0),
(Mouflon, _) => (5.0, -5.5, -5.0),
(Mouflon, _) => (5.0, -5.0, -5.0),
},
leg_b: match (body.species, body.body_type) {
(Grolgar, _) => (6.0, -6.5, -3.5),
(Saber, _) => (6.0, -7.0, -4.0),
(Grolgar, _) => (6.0, -6.5, -5.5),
(Saber, _) => (6.0, -7.0, -3.5),
(Tuskram, _) => (5.0, -5.5, -3.5),
(Lion, _) => (6.0, -6.0, -2.5),
(Lion, _) => (6.0, -6.0, -2.0),
(Tarasque, _) => (6.0, -6.5, -6.5),
(Tiger, _) => (7.0, -8.0, -3.0),
(Wolf, _) => (5.0, -6.5, -2.5),
(Frostfang, _) => (3.5, -4.5, -2.0),
(Mouflon, _) => (3.5, -5.0, -4.5),
(Mouflon, _) => (3.5, -6.0, -4.5),
},
feet_f: match (body.species, body.body_type) {
(Grolgar, _) => (0.0, -3.0, -3.0),
(Saber, _) => (1.0, 0.0, -1.0),
(Tuskram, _) => (0.5, 0.5, -4.0),
(Lion, _) => (0.0, 0.0, -1.5),
(Grolgar, _) => (0.0, -9.0, -7.0),
(Saber, _) => (1.0, -3.5, -2.5),
(Tuskram, _) => (0.5, 0.5, -9.0),
(Lion, _) => (0.0, 0.0, -7.0),
(Tarasque, _) => (1.0, 0.0, -3.0),
(Tiger, _) => (0.5, 0.0, -5.0),
(Wolf, _) => (0.5, 0.0, -2.0),
@ -281,9 +285,9 @@ impl<'a> From<&'a comp::quadruped_medium::Body> for SkeletonAttr {
},
feet_b: match (body.species, body.body_type) {
(Grolgar, _) => (0.0, 0.0, -5.0),
(Saber, _) => (1.0, -2.0, 0.0),
(Saber, _) => (1.0, -1.0, -1.0),
(Tuskram, _) => (0.5, 0.0, -3.0),
(Lion, _) => (0.5, 0.5, -4.0),
(Lion, _) => (0.5, 0.5, -5.5),
(Tarasque, _) => (1.5, -1.0, -2.5),
(Tiger, _) => (1.0, 0.5, -4.0),
(Wolf, _) => (0.0, -1.0, -1.5),
@ -292,7 +296,7 @@ impl<'a> From<&'a comp::quadruped_medium::Body> for SkeletonAttr {
},
scaler: match (body.species, body.body_type) {
(Grolgar, _) => (1.3),
(Saber, _) => (1.1),
(Saber, _) => (0.9),
(Tuskram, _) => (1.2),
(Lion, _) => (1.3),
(Tarasque, _) => (1.3),
@ -303,15 +307,37 @@ impl<'a> From<&'a comp::quadruped_medium::Body> for SkeletonAttr {
},
dampen: match (body.species, body.body_type) {
(Grolgar, _) => (0.5),
(Saber, _) => (0.7),
(Tuskram, _) => (0.9),
(Lion, _) => (0.7),
(Tarasque, _) => (0.7),
(Saber, _) => (0.5),
(Tuskram, _) => (0.6),
(Lion, _) => (0.8),
(Tarasque, _) => (0.6),
(Tiger, _) => (0.6),
(Wolf, _) => (1.0),
(Frostfang, _) => (1.0),
(Mouflon, _) => (1.0),
},
maximize: match (body.species, body.body_type) {
(Grolgar, _) => (2.0),
(Saber, _) => (1.5),
(Tuskram, _) => (1.0),
(Lion, _) => (1.1),
(Tarasque, _) => (1.8),
(Tiger, _) => (1.8),
(Wolf, _) => (1.0),
(Frostfang, _) => (1.2),
(Mouflon, _) => (1.1),
},
tempo: match (body.species, body.body_type) {
(Grolgar, _) => (0.95),
(Saber, _) => (1.1),
(Tuskram, _) => (0.9),
(Lion, _) => (0.85),
(Tarasque, _) => (0.95),
(Tiger, _) => (0.9),
(Wolf, _) => (1.0),
(Frostfang, _) => (1.0),
(Mouflon, _) => (0.85),
},
}
}
}

View File

@ -1,5 +1,5 @@
use super::{super::Animation, QuadrupedMediumSkeleton, SkeletonAttr};
use std::{f32::consts::PI, ops::Mul};
use std::f32::consts::PI;
use vek::*;
pub struct RunAnimation;
@ -25,9 +25,9 @@ impl Animation for RunAnimation {
let lab = 0.6; //6
let speedmult = if speed > 8.0 {
1.2 * (1.0 / skeleton_attr.scaler)
1.2 * (1.0 * skeleton_attr.tempo)
} else {
1.0 * (1.0 / skeleton_attr.scaler)
0.9 * (1.0 * skeleton_attr.tempo)
};
let short = (((1.0)
@ -41,12 +41,25 @@ impl Animation for RunAnimation {
//
let shortalt = (anim_time as f32 * 16.0 * lab as f32 * speedmult + PI * 0.5).sin();
let footvert = (anim_time as f32 * 16.0 * lab as f32 * speedmult + PI * 0.0).sin();
let footvertt = (anim_time as f32 * 16.0 * lab as f32 * speedmult + PI * 0.4).sin();
let footvertalt = (anim_time as f32 * 16.0 * lab as f32 * speedmult + PI * 1.2).sin();
let footverttalt = (anim_time as f32 * 16.0 * lab as f32 * speedmult + PI * 1.6).sin();
let vertchest = (anim_time as f32 * lab as f32 * speedmult + PI * 0.3)
.sin()
.max(0.2);
let horichest = (anim_time as f32 * lab as f32 * speedmult + PI * 0.8).sin();
let footvertf = (anim_time as f32 * 16.0 * lab as f32 * speedmult + PI * 0.3).sin();
let footverttf = (anim_time as f32 * 16.0 * lab as f32 * speedmult + PI * 0.7).sin();
let footvertaltf = (anim_time as f32 * 16.0 * lab as f32 * speedmult + PI * 1.5).sin();
let footverttaltf = (anim_time as f32 * 16.0 * lab as f32 * speedmult + PI * 1.9).sin();
let footvertslow = (anim_time as f32 * 16.0 * lab as f32 * speedmult + PI * 0.0).sin();
let footverttslow = (anim_time as f32 * 16.0 * lab as f32 * speedmult + PI * 0.4).sin();
let footvertaltslow = (anim_time as f32 * 16.0 * lab as f32 * speedmult + PI * 1.2).sin();
let footverttaltslow = (anim_time as f32 * 16.0 * lab as f32 * speedmult + PI * 1.6).sin();
let footvertfslow = (anim_time as f32 * 16.0 * lab as f32 * speedmult + PI * 0.6).sin();
let footverttfslow = (anim_time as f32 * 16.0 * lab as f32 * speedmult + PI * 1.0).sin();
let footvertaltfslow = (anim_time as f32 * 16.0 * lab as f32 * speedmult + PI * 1.8).sin();
let footverttaltfslow = (anim_time as f32 * 16.0 * lab as f32 * speedmult + PI * 2.2).sin();
//
let ori = Vec2::from(orientation);
let last_ori = Vec2::from(last_ori);
@ -63,130 +76,17 @@ impl Animation for RunAnimation {
} * 1.3;
//let tilt = 0.0;
if speed < 8.0 {
/* //Trot
next.head_upper.offset =
Vec3::new(0.0, skeleton_attr.head_upper.0, skeleton_attr.head_upper.1);
next.head_upper.ori = Quaternion::rotation_x(0.0) * Quaternion::rotation_z(tilt * -1.2);
next.head_upper.scale = Vec3::one();
next.head_lower.offset = Vec3::new(
0.0,
skeleton_attr.head_lower.0 + horichest * 0.4,
skeleton_attr.head_lower.1 + vertchest * -0.8,
);
next.head_lower.ori = Quaternion::rotation_z(tilt * -0.8);
next.head_lower.scale = Vec3::one() * 1.02;
next.jaw.offset = Vec3::new(0.0, skeleton_attr.jaw.0, skeleton_attr.jaw.1);
next.jaw.ori = Quaternion::rotation_x(0.0);
next.jaw.scale = Vec3::one() * 1.02;
next.tail.offset = Vec3::new(0.0, skeleton_attr.tail.0, skeleton_attr.tail.1);
next.tail.ori =
Quaternion::rotation_x(shortalt * 0.08) * Quaternion::rotation_z(tilt * 1.5);
next.tail.scale = Vec3::one();
next.torso_front.offset = Vec3::new(
0.0,
skeleton_attr.torso_front.0,
skeleton_attr.torso_front.1 + shortalt * 0.8,
) * skeleton_attr.scaler
/ 11.0;
next.torso_front.ori = Quaternion::rotation_x(short * 0.03);
next.torso_front.scale = Vec3::one() * skeleton_attr.scaler / 11.0;
next.torso_back.offset =
Vec3::new(0.0, skeleton_attr.torso_back.0, skeleton_attr.torso_back.1 + shortalt * 0.2 - 0.2);
next.torso_back.ori =
Quaternion::rotation_x(short * -0.03) * Quaternion::rotation_z(tilt * 1.8);
next.torso_back.scale = Vec3::one();
next.ears.offset = Vec3::new(0.0, skeleton_attr.ears.0, skeleton_attr.ears.1);
next.ears.ori = Quaternion::rotation_x(shortalt * 0.2 + 0.2);
next.ears.scale = Vec3::one() * 1.02;
////left and right functions currently swapped on some bones to change gait
next.leg_fl.offset = Vec3::new(
-skeleton_attr.leg_f.0,
skeleton_attr.leg_f.1 + foothoril * -1.0,
skeleton_attr.leg_f.2 + footvertl * -0.4,
);
next.leg_fl.ori =
Quaternion::rotation_x(footrotl * -0.3) * Quaternion::rotation_z(tilt * -1.5);
next.leg_fl.scale = Vec3::one() * 0.99;
next.leg_fr.offset = Vec3::new(
skeleton_attr.leg_f.0,
skeleton_attr.leg_f.1 + foothorir * -1.0,
skeleton_attr.leg_f.2 + footvertr * -0.4,
);
next.leg_fr.ori =
Quaternion::rotation_x(footrotr * -0.3) * Quaternion::rotation_z(tilt * -1.5);
next.leg_fr.scale = Vec3::one() * 0.99;
next.leg_bl.offset = Vec3::new(
-skeleton_attr.leg_b.0,
skeleton_attr.leg_b.1 + foothorilb * -1.0,
skeleton_attr.leg_b.2 + footvertlb * -0.4,
);
next.leg_bl.ori =
Quaternion::rotation_x(footrotlb * -0.3) * Quaternion::rotation_z(tilt * -1.5);
next.leg_bl.scale = Vec3::one() * 0.99;
next.leg_br.offset = Vec3::new(
skeleton_attr.leg_b.0,
skeleton_attr.leg_b.1 + foothorirb * -1.0,
skeleton_attr.leg_b.2 + footvertrb * -0.4,
);
next.leg_br.ori =
Quaternion::rotation_x(footrotrb * -0.3) * Quaternion::rotation_z(tilt * -1.5);
next.leg_br.scale = Vec3::one() * 0.99;
next.foot_fl.offset = Vec3::new(
-skeleton_attr.feet_f.0,
skeleton_attr.feet_f.1,
skeleton_attr.feet_f.2 + 1.0 + ((footvertl * -1.0).max(-1.0)),
);
next.foot_fl.ori = Quaternion::rotation_x(footrotl * -0.3);
next.foot_fl.scale = Vec3::one() * 0.97;
next.foot_fr.offset = Vec3::new(
skeleton_attr.feet_f.0,
skeleton_attr.feet_f.1,
skeleton_attr.feet_f.2 + 1.0 + ((footvertr * -1.0).max(-1.0)),
);
next.foot_fr.ori = Quaternion::rotation_x(footrotr * -0.3);
next.foot_fr.scale = Vec3::one() * 0.98;
next.foot_bl.offset = Vec3::new(
-skeleton_attr.feet_b.0,
skeleton_attr.feet_b.1,
skeleton_attr.feet_b.2 + 1.0 + ((footvertlb * -1.0).max(-1.0)),
);
next.foot_bl.ori = Quaternion::rotation_x(footrotlb * -0.3);
next.foot_bl.scale = Vec3::one() * 0.98;
next.foot_br.offset = Vec3::new(
skeleton_attr.feet_b.0,
skeleton_attr.feet_b.1,
skeleton_attr.feet_b.2 + 1.0 + ((footvertrb * -1.0).max(-1.0)),
);
next.foot_br.ori = Quaternion::rotation_x(footrotrb * -0.3);
next.foot_br.scale = Vec3::one() * 0.98;*/
} else {
//Gallop
//Trot
next.head_upper.offset =
Vec3::new(0.0, skeleton_attr.head_upper.0, skeleton_attr.head_upper.1);
next.head_upper.ori =
Quaternion::rotation_x(short * -0.18) * Quaternion::rotation_z(tilt * -1.2);
Quaternion::rotation_x(short * -0.03 - 0.1) * Quaternion::rotation_z(tilt * -1.2);
next.head_upper.scale = Vec3::one();
next.head_lower.offset = Vec3::new(
0.0,
skeleton_attr.head_lower.0 + horichest * 0.4,
skeleton_attr.head_lower.1 + vertchest * -0.8,
);
next.head_lower.ori = Quaternion::rotation_z(tilt * -0.8);
next.head_lower.offset =
Vec3::new(0.0, skeleton_attr.head_lower.0, skeleton_attr.head_lower.1);
next.head_lower.ori =
Quaternion::rotation_z(tilt * -0.8) * Quaternion::rotation_x(short * -0.05);
next.head_lower.scale = Vec3::one() * 1.02;
next.jaw.offset = Vec3::new(0.0, skeleton_attr.jaw.0, skeleton_attr.jaw.1);
@ -201,7 +101,122 @@ impl Animation for RunAnimation {
next.torso_front.offset = Vec3::new(
0.0,
skeleton_attr.torso_front.0,
skeleton_attr.torso_front.1 + shortalt * 2.0,
skeleton_attr.torso_front.1 + shortalt * 1.0,
) * skeleton_attr.scaler
/ 11.0;
next.torso_front.ori =
Quaternion::rotation_x(short * 0.03) * Quaternion::rotation_z(tilt * -1.5);
next.torso_front.scale = Vec3::one() * skeleton_attr.scaler / 11.0;
next.torso_back.offset = Vec3::new(
0.0,
skeleton_attr.torso_back.0,
skeleton_attr.torso_back.1 + shortalt * 0.04 - 0.2,
);
next.torso_back.ori =
Quaternion::rotation_x(short * 0.06) * Quaternion::rotation_z(tilt * 1.8);
next.torso_back.scale = Vec3::one();
next.ears.offset = Vec3::new(0.0, skeleton_attr.ears.0, skeleton_attr.ears.1);
next.ears.ori = Quaternion::rotation_x(shortalt * 0.04 + 0.2);
next.ears.scale = Vec3::one() * 1.02;
next.leg_fl.offset = Vec3::new(
-skeleton_attr.leg_f.0,
skeleton_attr.leg_f.1 + footvertaltfslow * -1.4,
skeleton_attr.leg_f.2 + 1.0 + footverttaltfslow * -0.3,
);
next.leg_fl.ori = Quaternion::rotation_x(footverttaltfslow * -0.35)
* Quaternion::rotation_z(tilt * -0.5);
next.leg_fl.scale = Vec3::one() * 1.02;
next.leg_fr.offset = Vec3::new(
skeleton_attr.leg_f.0,
skeleton_attr.leg_f.1 + footvertaltslow * -1.4,
skeleton_attr.leg_f.2 + 1.0 + footverttaltslow * -0.3,
);
next.leg_fr.ori = Quaternion::rotation_x(footverttaltslow * -0.35)
* Quaternion::rotation_z(tilt * -0.5);
next.leg_fr.scale = Vec3::one() * 1.02;
next.leg_bl.offset = Vec3::new(
-skeleton_attr.leg_b.0,
skeleton_attr.leg_b.1 + footvertaltslow * -1.0,
skeleton_attr.leg_b.2 + 1.0 + footverttaltslow * -0.3,
);
next.leg_bl.ori = Quaternion::rotation_x(footverttaltslow * -0.2)
* Quaternion::rotation_z(tilt * -1.5);
next.leg_bl.scale = Vec3::one() * 1.02;
next.leg_br.offset = Vec3::new(
skeleton_attr.leg_b.0,
skeleton_attr.leg_b.1 + footvertaltfslow * -1.0,
skeleton_attr.leg_b.2 + 1.0 + footverttaltfslow * -0.3,
);
next.leg_br.ori = Quaternion::rotation_x(footverttaltfslow * -0.2)
* Quaternion::rotation_z(tilt * -1.5);
next.leg_br.scale = Vec3::one() * 1.02;
next.foot_fl.offset = Vec3::new(
-skeleton_attr.feet_f.0,
skeleton_attr.feet_f.1,
skeleton_attr.feet_f.2 + ((footvertfslow * -1.0 * skeleton_attr.maximize).max(0.0)),
);
next.foot_fl.ori =
Quaternion::rotation_x((1.0 - skeleton_attr.dampen) * -1.0 + footverttfslow * 0.5);
next.foot_fl.scale = Vec3::one() * 0.96;
next.foot_fr.offset = Vec3::new(
skeleton_attr.feet_f.0,
skeleton_attr.feet_f.1,
skeleton_attr.feet_f.2 + ((footvertslow * -1.0 * skeleton_attr.maximize).max(0.0)),
);
next.foot_fr.ori =
Quaternion::rotation_x((1.0 - skeleton_attr.dampen) * -1.0 + footverttslow * 0.5);
next.foot_fr.scale = Vec3::one() * 0.96;
next.foot_bl.offset = Vec3::new(
-skeleton_attr.feet_b.0,
skeleton_attr.feet_b.1,
skeleton_attr.feet_b.2 + ((footvertslow * -1.8).max(0.0)),
);
next.foot_bl.ori = Quaternion::rotation_x(footverttslow * 0.5 - 0.2);
next.foot_bl.scale = Vec3::one() * 0.96;
next.foot_br.offset = Vec3::new(
skeleton_attr.feet_b.0,
skeleton_attr.feet_b.1,
skeleton_attr.feet_b.2 + ((footvertfslow * -0.8).max(-0.0)),
);
next.foot_br.ori = Quaternion::rotation_x(footverttfslow * 0.5 - 0.2);
next.foot_br.scale = Vec3::one() * 0.96;
} else {
//Gallop
next.head_upper.offset =
Vec3::new(0.0, skeleton_attr.head_upper.0, skeleton_attr.head_upper.1);
next.head_upper.ori =
Quaternion::rotation_x(short * -0.03 - 0.1) * Quaternion::rotation_z(tilt * -1.2);
next.head_upper.scale = Vec3::one();
next.head_lower.offset =
Vec3::new(0.0, skeleton_attr.head_lower.0, skeleton_attr.head_lower.1);
next.head_lower.ori =
Quaternion::rotation_z(tilt * -0.8) * Quaternion::rotation_x(short * -0.05);
next.head_lower.scale = Vec3::one() * 1.02;
next.jaw.offset = Vec3::new(0.0, skeleton_attr.jaw.0, skeleton_attr.jaw.1);
next.jaw.ori = Quaternion::rotation_x(0.0);
next.jaw.scale = Vec3::one() * 1.02;
next.tail.offset = Vec3::new(0.0, skeleton_attr.tail.0, skeleton_attr.tail.1);
next.tail.ori =
Quaternion::rotation_x(shortalt * 0.3) * Quaternion::rotation_z(tilt * 1.5);
next.tail.scale = Vec3::one();
next.torso_front.offset = Vec3::new(
0.0,
skeleton_attr.torso_front.0,
skeleton_attr.torso_front.1 + shortalt * 2.5,
) * skeleton_attr.scaler
/ 11.0;
next.torso_front.ori =
@ -220,78 +235,76 @@ impl Animation for RunAnimation {
next.ears.offset = Vec3::new(0.0, skeleton_attr.ears.0, skeleton_attr.ears.1);
next.ears.ori = Quaternion::rotation_x(shortalt * 0.2 + 0.2);
next.ears.scale = Vec3::one() * 1.02;
let footvertl = (anim_time as f32 * 16.0 * lab as f32 * speedmult + PI * 0.0).sin();
let footvertlt = (anim_time as f32 * 16.0 * lab as f32 * speedmult + PI * 0.4).sin();
let footvertlalt = (anim_time as f32 * 16.0 * lab as f32 * speedmult + PI * 1.2).sin();
let footvertltalt = (anim_time as f32 * 16.0 * lab as f32 * speedmult + PI * 1.6).sin();
////left and right functions currently swapped on some bones to change gait
next.leg_fl.offset = Vec3::new(
-skeleton_attr.leg_f.0,
skeleton_attr.leg_f.1 + footvertlalt * -2.0,
skeleton_attr.leg_f.2 + 1.0 + footvertltalt * -1.9,
skeleton_attr.leg_f.1 + footvertaltf * -1.3,
skeleton_attr.leg_f.2 + 1.0 + footverttaltf * -1.9,
);
next.leg_fl.ori =
Quaternion::rotation_x(footvertltalt * -0.4) * Quaternion::rotation_z(tilt * -0.5);
next.leg_fl.scale = Vec3::one() * 0.99;
Quaternion::rotation_x(footverttaltf * -0.65) * Quaternion::rotation_z(tilt * -0.5);
next.leg_fl.scale = Vec3::one() * 1.02;
next.leg_fr.offset = Vec3::new(
skeleton_attr.leg_f.0,
skeleton_attr.leg_f.1 + footvertlalt * -2.0,
skeleton_attr.leg_f.2 + 1.0 + footvertltalt * -1.9,
skeleton_attr.leg_f.1 + footvertalt * -1.3,
skeleton_attr.leg_f.2 + 1.0 + footverttalt * -1.9,
);
next.leg_fr.ori =
Quaternion::rotation_x(footvertltalt * -0.4) * Quaternion::rotation_z(tilt * -0.5);
next.leg_fr.scale = Vec3::one() * 0.99;
Quaternion::rotation_x(footverttalt * -0.65) * Quaternion::rotation_z(tilt * -0.5);
next.leg_fr.scale = Vec3::one() * 1.02;
next.leg_bl.offset = Vec3::new(
-skeleton_attr.leg_b.0,
skeleton_attr.leg_b.1 + footvertl * -1.7,
skeleton_attr.leg_b.2 + 1.0 + footvertlt * -1.5,
skeleton_attr.leg_b.1 + footvert * -1.7,
skeleton_attr.leg_b.2 + 1.0 + footvertt * -1.5,
);
next.leg_bl.ori = Quaternion::rotation_x(footvertlt * -0.4 - 0.2)
next.leg_bl.ori = Quaternion::rotation_x(footvertt * -0.4 - 0.2)
* Quaternion::rotation_z(tilt * -1.5);
next.leg_bl.scale = Vec3::one() * 0.99;
next.leg_bl.scale = Vec3::one() * 1.02;
next.leg_br.offset = Vec3::new(
skeleton_attr.leg_b.0,
skeleton_attr.leg_b.1 + footvertl * -1.7,
skeleton_attr.leg_b.2 + 1.0 + footvertlt * -1.5,
skeleton_attr.leg_b.1 + footvertf * -1.7,
skeleton_attr.leg_b.2 + 1.0 + footverttf * -1.5,
);
next.leg_br.ori = Quaternion::rotation_x(footvertlt * -0.4 - 0.2)
next.leg_br.ori = Quaternion::rotation_x(footverttf * -0.4 - 0.2)
* Quaternion::rotation_z(tilt * -1.5);
next.leg_br.scale = Vec3::one() * 0.99;
next.leg_br.scale = Vec3::one() * 1.02;
next.foot_fl.offset = Vec3::new(
-skeleton_attr.feet_f.0,
skeleton_attr.feet_f.1,
skeleton_attr.feet_f.2 + ((footvertl * -2.7).max(0.0)),
skeleton_attr.feet_f.2 + ((footvertf * -2.7 * skeleton_attr.maximize).max(0.0)),
);
next.foot_fl.ori = Quaternion::rotation_x(footvertlt * 0.9 * skeleton_attr.dampen);
next.foot_fl.scale = Vec3::one() * 0.97;
next.foot_fl.ori =
Quaternion::rotation_x((1.0 - skeleton_attr.dampen) * -1.0 + footverttf * 0.9);
next.foot_fl.scale = Vec3::one() * 0.96;
next.foot_fr.offset = Vec3::new(
skeleton_attr.feet_f.0,
skeleton_attr.feet_f.1,
skeleton_attr.feet_f.2 + ((footvertl * -2.7).max(0.0)),
skeleton_attr.feet_f.2 + ((footvert * -2.7 * skeleton_attr.maximize).max(0.0)),
);
next.foot_fr.ori = Quaternion::rotation_x(footvertlt * 0.9 * skeleton_attr.dampen);
next.foot_fr.scale = Vec3::one() * 0.98;
next.foot_fr.ori =
Quaternion::rotation_x((1.0 - skeleton_attr.dampen) * -1.0 + footvertt * 0.9);
next.foot_fr.scale = Vec3::one() * 0.96;
next.foot_bl.offset = Vec3::new(
-skeleton_attr.feet_b.0,
skeleton_attr.feet_b.1,
skeleton_attr.feet_b.2 + ((footvertl * 2.4).max(0.0)),
skeleton_attr.feet_b.2 + ((footvert * 2.4).max(0.0)),
);
next.foot_bl.ori = Quaternion::rotation_x(footvertlt * -0.9 - 0.2);
next.foot_bl.scale = Vec3::one() * 0.98;
next.foot_bl.ori = Quaternion::rotation_x(footvertt * -0.9 - 0.2);
next.foot_bl.scale = Vec3::one() * 0.96;
next.foot_br.offset = Vec3::new(
skeleton_attr.feet_b.0,
skeleton_attr.feet_b.1,
skeleton_attr.feet_b.2 + ((footvertl * 2.4).max(-0.0)),
skeleton_attr.feet_b.2 + ((footvertf * 2.4).max(-0.0)),
);
next.foot_br.ori = Quaternion::rotation_x(footvertlt * -0.9 - 0.2);
next.foot_br.scale = Vec3::one() * 0.98;
next.foot_br.ori = Quaternion::rotation_x(footverttf * -0.9 - 0.2);
next.foot_br.scale = Vec3::one() * 0.96;
}
next
}

View File

@ -985,7 +985,7 @@ impl FigureMgr {
(false, _, false) => {
anim::quadruped_medium::JumpAnimation::update_skeleton(
&QuadrupedMediumSkeleton::new(),
(vel.0.magnitude(), time),
(time),
state.state_time,
&mut state_animation_rate,
skeleton_attr,