tweaks and fixes

This commit is contained in:
jshipsey 2020-07-05 01:00:15 -04:00
parent 1b778ca191
commit 62eb66173f
11 changed files with 79 additions and 71 deletions

View File

@ -35,6 +35,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Zoomable Map
- M2 attack for hammer
- Spawnable training dummies
- New quadruped_low body for reptile-likes
- Added new animals
- Better pathfinding
### Changed
@ -53,6 +56,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Replaced `log` with `tracing` in all crates
- Switch to a new network backend that will allow several improvements in the future
- Connection screen fails after 4 minutes if it can't connect to the server instead of 80 minutes
- Rebuilt quadruped_medium animation and assets
### Removed

View File

@ -1,7 +1,7 @@
({
(Crocodile, Male): (
upper: (
offset: (-4.0, -8.5, -3.0),
offset: (-4.0, 0.0, -3.0),
central: ("npc.crocodile.male.head_upper"),
),
lower: (
@ -27,7 +27,7 @@
),
(Crocodile, Female): (
upper: (
offset: (-4.0, -8.5, -3.0),
offset: (-4.0, 0.0, -3.0),
central: ("npc.crocodile.male.head_upper"),
),
lower: (
@ -105,7 +105,7 @@
),
(Salamander, Male): (
upper: (
offset: (-6.5, -6.0, -2.0),
offset: (-6.5, 0.0, -2.0),
central: ("npc.salamander.male.head_upper"),
),
lower: (
@ -131,7 +131,7 @@
),
(Salamander, Female): (
upper: (
offset: (-6.5, -6.0, -2.0),
offset: (-6.5, 0.0, -2.0),
central: ("npc.salamander.male.head_upper"),
),
lower: (

View File

@ -177,7 +177,7 @@
central: ("npc.cat.male.head"),
),
chest: (
offset: (-0.5, -3.0, -4.0),
offset: (-1.5, -3.0, -2.0),
central: ("npc.cat.male.chest"),
),
tail: (
@ -191,7 +191,7 @@
central: ("npc.cat.female.head"),
),
chest: (
offset: (-1.5, -4.0, -2.0),
offset: (-1.5, -3.0, -2.0),
central: ("npc.cat.female.chest"),
),
tail: (

View File

@ -170,19 +170,19 @@
(Jackalope, Female): (
left_front: (
offset: (-1.5, -2.5, -4.0),
lateral: ("npc.jackalope.female.foot_fl"),
lateral: ("npc.jackalope.male.foot_fl"),
),
right_front: (
offset: (-1.5, -2.5, -4.0),
lateral: ("npc.jackalope.female.foot_fr"),
lateral: ("npc.jackalope.male.foot_fr"),
),
left_back: (
offset: (-1.5, -2.5, -6.0),
lateral: ("npc.jackalope.female.foot_bl"),
lateral: ("npc.jackalope.male.foot_bl"),
),
right_back: (
offset: (-1.5, -2.5, -6.0),
lateral: ("npc.jackalope.female.foot_br"),
lateral: ("npc.jackalope.male.foot_br"),
),
),
(Skunk, Male): (
@ -207,19 +207,19 @@
(Skunk, Female): (
left_front: (
offset: (-1.0, -1.0, -3.5),
lateral: ("npc.skunk.female.foot_fl"),
lateral: ("npc.skunk.male.foot_fl"),
),
right_front: (
offset: (-1.0, -1.0, -3.5),
lateral: ("npc.skunk.female.foot_fr"),
lateral: ("npc.skunk.male.foot_fr"),
),
left_back: (
offset: (-1.0, -1.0, -3.5),
lateral: ("npc.skunk.female.foot_bl"),
lateral: ("npc.skunk.male.foot_bl"),
),
right_back: (
offset: (-1.0, -1.0, -3.5),
lateral: ("npc.skunk.female.foot_br"),
lateral: ("npc.skunk.male.foot_br"),
),
),
@ -283,19 +283,19 @@
(Batfox, Female): (
left_front: (
offset: (-1.0, -1.5, -2.5),
lateral: ("npc.batfox.female.foot_fl"),
lateral: ("npc.batfox.male.foot_fl"),
),
right_front: (
offset: (-1.0, -1.5, -2.5),
lateral: ("npc.batfox.female.foot_fr"),
lateral: ("npc.batfox.male.foot_fr"),
),
left_back: (
offset: (-1.0, -2.5, -3.5),
lateral: ("npc.batfox.female.foot_bl"),
lateral: ("npc.batfox.male.foot_bl"),
),
right_back: (
offset: (-1.0, -2.5, -3.5),
lateral: ("npc.batfox.female.foot_br"),
lateral: ("npc.batfox.male.foot_br"),
),
),
@ -321,19 +321,19 @@
(Raccoon, Female): (
left_front: (
offset: (-0.5, -0.5, -2.5),
lateral: ("npc.raccoon.female.foot_fl"),
lateral: ("npc.raccoon.male.foot_fl"),
),
right_front: (
offset: (-0.5, -0.5, -2.5),
lateral: ("npc.raccoon.female.foot_fr"),
lateral: ("npc.raccoon.male.foot_fr"),
),
left_back: (
offset: (-1.0, -1.5, -2.5),
lateral: ("npc.raccoon.female.foot_bl"),
lateral: ("npc.raccoon.male.foot_bl"),
),
right_back: (
offset: (-1.0, -1.5, -2.5),
lateral: ("npc.raccoon.female.foot_br"),
lateral: ("npc.raccoon.male.foot_br"),
),
),
(Quokka, Male): (
@ -358,19 +358,19 @@
(Quokka, Female): (
left_front: (
offset: (-1.0, -1.0, -2.5),
lateral: ("npc.quokka.female.foot_fl"),
lateral: ("npc.quokka.male.foot_fl"),
),
right_front: (
offset: (-1.0, -1.0, -2.5),
lateral: ("npc.quokka.female.foot_fr"),
lateral: ("npc.quokka.male.foot_fr"),
),
left_back: (
offset: (-1.0, -1.5, -2.5),
lateral: ("npc.quokka.female.foot_bl"),
lateral: ("npc.quokka.male.foot_bl"),
),
right_back: (
offset: (-1.0, -1.5, -2.5),
lateral: ("npc.quokka.female.foot_br"),
lateral: ("npc.quokka.male.foot_br"),
),
),
(Dodarock, Male): (
@ -395,19 +395,19 @@
(Dodarock, Female): (
left_front: (
offset: (-2.0, -3.0, -4.0),
lateral: ("npc.dodarock.female.foot_fl"),
lateral: ("npc.dodarock.male.foot_fl"),
),
right_front: (
offset: (-2.0, -3.0, -4.0),
lateral: ("npc.dodarock.female.foot_fr"),
lateral: ("npc.dodarock.male.foot_fr"),
),
left_back: (
offset: (-1.5, -2.0, -2.5),
lateral: ("npc.dodarock.female.foot_bl"),
lateral: ("npc.dodarock.male.foot_bl"),
),
right_back: (
offset: (-1.5, -2.0, -2.5),
lateral: ("npc.dodarock.female.foot_br"),
lateral: ("npc.dodarock.male.foot_br"),
),
),
(Holladon, Male): (
@ -432,19 +432,19 @@
(Holladon, Female): (
left_front: (
offset: (-1.0, -2.0, -2.5),
lateral: ("npc.holladon.female.foot_fl"),
lateral: ("npc.holladon.male.foot_fl"),
),
right_front: (
offset: (-1.0, -2.0, -2.5),
lateral: ("npc.holladon.female.foot_fr"),
lateral: ("npc.holladon.male.foot_fr"),
),
left_back: (
offset: (-1.0, -2.0, -2.5),
lateral: ("npc.holladon.female.foot_bl"),
lateral: ("npc.holladon.male.foot_bl"),
),
right_back: (
offset: (-1.0, -2.0, -2.5),
lateral: ("npc.holladon.female.foot_br"),
lateral: ("npc.holladon.male.foot_br"),
),
),
(Hyena, Male): (
@ -469,19 +469,19 @@
(Hyena, Female): (
left_front: (
offset: (-1.5, -2.0, -5.0),
lateral: ("npc.hyena.female.foot_fl"),
lateral: ("npc.hyena.male.foot_fl"),
),
right_front: (
offset: (-1.5, -2.0, -5.0),
lateral: ("npc.hyena.female.foot_fr"),
lateral: ("npc.hyena.male.foot_fr"),
),
left_back: (
offset: (-1.5, -2.0, -4.5),
lateral: ("npc.hyena.female.foot_bl"),
lateral: ("npc.hyena.male.foot_bl"),
),
right_back: (
offset: (-1.5, -2.0, -4.5),
lateral: ("npc.hyena.female.foot_br"),
lateral: ("npc.hyena.male.foot_br"),
),
),
})

View File

@ -134,9 +134,9 @@ impl<'a> From<&'a comp::quadruped_low::Body> for SkeletonAttr {
use comp::quadruped_low::Species::*;
Self {
head_upper: match (body.species, body.body_type) {
(Crocodile, _) => (10.0, 2.0),
(Crocodile, _) => (1.5, 2.0),
(Alligator, _) => (0.5, 2.0),
(Salamander, _) => (6.5, 2.5),
(Salamander, _) => (0.5, 2.5),
(Monitor, _) => (4.5, 1.0),
(Asp, _) => (6.0, 5.5),
(Tortoise, _) => (5.0, 1.0),
@ -154,9 +154,9 @@ impl<'a> From<&'a comp::quadruped_low::Body> for SkeletonAttr {
(Pangolin, _) => (8.0, -9.0),
},
jaw: match (body.species, body.body_type) {
(Crocodile, _) => (-6.0, -3.0),
(Crocodile, _) => (2.5, -3.0),
(Alligator, _) => (2.5, -2.0),
(Salamander, _) => (-6.0, -2.0),
(Salamander, _) => (0.0, -2.0),
(Monitor, _) => (-2.0, -1.0),
(Asp, _) => (-3.0, -2.0),
(Tortoise, _) => (-3.5, -2.0),
@ -201,7 +201,7 @@ impl<'a> From<&'a comp::quadruped_low::Body> for SkeletonAttr {
(Asp, _) => (1.5, 4.0, -1.0),
(Tortoise, _) => (5.5, 6.5, -3.0),
(Rocksnapper, _) => (7.5, 5.0, -8.5),
(Pangolin, _) => (5.0, 5.0, -1.0),
(Pangolin, _) => (5.5, 5.5, -1.0),
},
feet_b: match (body.species, body.body_type) {
(Crocodile, _) => (3.5, -6.0, -1.0),
@ -211,7 +211,7 @@ impl<'a> From<&'a comp::quadruped_low::Body> for SkeletonAttr {
(Asp, _) => (2.5, -5.5, -1.0),
(Tortoise, _) => (5.5, -11.5, -3.0),
(Rocksnapper, _) => (8.0, -12.0, -9.5),
(Pangolin, _) => (6.0, -4.0, -1.0),
(Pangolin, _) => (6.5, -3.5, -1.0),
},
lean: match (body.species, body.body_type) {
(Pangolin, _) => (0.4, 0.0),

View File

@ -22,7 +22,7 @@ impl Animation for RunAnimation {
let mut next = (*skeleton).clone();
let lab = 0.7 * skeleton_attr.tempo;
let x_tilt = avg_vel.z.atan2(avg_vel.xy().magnitude());
let x_tilt = avg_vel.z.atan2(avg_vel.xy().magnitude()).max(-0.7);
let short = (((1.0)
/ (0.72
@ -83,17 +83,18 @@ impl Animation for RunAnimation {
} else {
0.0
} * 1.3;
//let tilt = 0.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_x(-skeleton_attr.lean.0)
next.head_upper.ori = Quaternion::rotation_x(-skeleton_attr.lean.0 + x_tilt * -1.0)
* Quaternion::rotation_y(tilt * 0.3)
* Quaternion::rotation_z(short * -0.06 + tilt * -1.5);
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.0) * Quaternion::rotation_z(short * -0.15 + tilt * -0.8);
next.head_lower.ori = Quaternion::rotation_y(tilt * 1.0)
* Quaternion::rotation_z(short * -0.15 + tilt * -0.8)
* Quaternion::rotation_x(x_tilt * 0.4);
next.head_lower.scale = Vec3::one();
next.jaw.offset = Vec3::new(0.0, skeleton_attr.jaw.0, skeleton_attr.jaw.1);
@ -107,7 +108,7 @@ impl Animation for RunAnimation {
);
next.tail_front.ori = Quaternion::rotation_z(shortalt * 0.18 + tilt * 1.8)
* Quaternion::rotation_y(shortalt * 0.1)
* Quaternion::rotation_x(0.06 - skeleton_attr.lean.0 * 1.2);
* Quaternion::rotation_x(0.06 - skeleton_attr.lean.0 * 1.2 + x_tilt * 0.2);
next.tail_front.scale = Vec3::one();
next.tail_rear.offset = Vec3::new(
@ -117,14 +118,14 @@ impl Animation for RunAnimation {
);
next.tail_rear.ori = Quaternion::rotation_z(shortalt * 0.25 + tilt * 1.6)
* Quaternion::rotation_y(shortalt * 0.1)
* Quaternion::rotation_x(-0.04);
* Quaternion::rotation_x(-0.04 + x_tilt * 0.5);
next.tail_rear.scale = Vec3::one();
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_z(short * 0.13 + tilt * -1.9)
* Quaternion::rotation_y(short * 0.12)
* Quaternion::rotation_y(short * 0.12 + tilt * 0.7)
* Quaternion::rotation_x(x_tilt + skeleton_attr.lean.0);
next.chest.scale = Vec3::one() * skeleton_attr.scaler / 11.0;
@ -135,7 +136,8 @@ impl Animation for RunAnimation {
);
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);
) * Quaternion::rotation_y(tilt * -1.0)
* Quaternion::rotation_z(footvertl * 0.4 * skeleton_attr.lean.1);
next.foot_fl.scale = Vec3::one();
next.foot_fr.offset = Vec3::new(
@ -143,10 +145,10 @@ impl Animation for RunAnimation {
skeleton_attr.feet_f.1 + foothorir * -1.0,
skeleton_attr.feet_f.2 + 1.0 + ((footvertr * -0.8).max(-0.0)),
);
next.foot_fr.ori =
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.ori = Quaternion::rotation_x(
-0.2 + footvertr * -0.25 * skeleton_attr.lean.1 - skeleton_attr.lean.0,
) * Quaternion::rotation_y(tilt * -1.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(
@ -155,6 +157,7 @@ impl Animation for RunAnimation {
skeleton_attr.feet_b.2 + 1.0 + ((footvertlb * -0.6).max(-0.0)),
);
next.foot_bl.ori = Quaternion::rotation_x(-0.2 + footvertlb * -0.3 - skeleton_attr.lean.0)
* Quaternion::rotation_y(tilt * -1.0)
* Quaternion::rotation_z(footvertlb * 0.4);
next.foot_bl.scale = Vec3::one();
@ -164,6 +167,7 @@ impl Animation for RunAnimation {
skeleton_attr.feet_b.2 + 1.0 + ((footvertrb * -0.6).max(-0.0)),
);
next.foot_br.ori = Quaternion::rotation_x(-0.2 + footvertrb * -0.3 - skeleton_attr.lean.0)
* Quaternion::rotation_y(tilt * -1.0)
* Quaternion::rotation_z(footvertrb * -0.4);
next.foot_br.scale = Vec3::one();

View File

@ -117,10 +117,10 @@ impl Animation for AlphaAnimation {
next.foot_fr.offset = Vec3::new(
skeleton_attr.feet_f.0,
skeleton_attr.feet_f.1,
skeleton_attr.feet_f.2 + short * -1.5,
skeleton_attr.feet_f.2,
);
next.foot_fr.ori =
Quaternion::rotation_x(short * -0.2) * Quaternion::rotation_y(short * 0.15);
Quaternion::rotation_x(short * -0.4) * Quaternion::rotation_y(short * 0.15);
next.foot_fr.scale = Vec3::one();
next.foot_bl.offset = Vec3::new(
@ -135,7 +135,7 @@ impl Animation for AlphaAnimation {
next.foot_br.offset = Vec3::new(
skeleton_attr.feet_b.0,
skeleton_attr.feet_b.1,
skeleton_attr.feet_b.2 + short * -1.5,
skeleton_attr.feet_b.2,
);
next.foot_br.ori =
Quaternion::rotation_x(-0.2 + short * 0.2) * Quaternion::rotation_y(short * 0.15);

View File

@ -231,7 +231,7 @@ impl<'a> From<&'a comp::quadruped_medium::Body> for SkeletonAttr {
torso_back: match (body.species, body.body_type) {
(Grolgar, _) => (-10.0, 1.5),
(Saber, _) => (-13.5, 0.0),
(Tuskram, _) => (-13.0, -2.0),
(Tuskram, _) => (-12.5, -2.0),
(Lion, _) => (-12.0, -0.5),
(Tarasque, _) => (-14.0, -1.0),
(Tiger, _) => (-13.0, 0.0),

View File

@ -22,7 +22,7 @@ impl Animation for RunAnimation {
let mut next = (*skeleton).clone();
let speed = Vec2::<f32>::from(velocity).magnitude();
*rate = 1.0;
let lab = 0.6; //6
let lab = 0.1; //6
let speedmult = if speed > 8.0 {
1.2 * (1.0 * skeleton_attr.tempo)
@ -71,19 +71,18 @@ impl Animation for RunAnimation {
0.0
} * 1.3;
let x_tilt = avg_vel.z.atan2(avg_vel.xy().magnitude());
//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(short * -0.03 - 0.1) * Quaternion::rotation_z(tilt * -1.2);
next.head_upper.ori = Quaternion::rotation_x(short * -0.03 - 0.1 + x_tilt * -0.5)
* 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.ori = Quaternion::rotation_z(tilt * -0.8)
* Quaternion::rotation_x(short * -0.05 + x_tilt * -0.5);
next.head_lower.scale = Vec3::one() * 1.02;
next.jaw.offset = Vec3::new(0.0, skeleton_attr.jaw.0, skeleton_attr.jaw.1);

View File

@ -5,7 +5,7 @@ use vek::*;
pub struct RunAnimation;
impl Animation for RunAnimation {
type Dependency = (f32, f64);
type Dependency = (f32, f64, Vec3<f32>);
type Skeleton = QuadrupedSmallSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -14,7 +14,7 @@ impl Animation for RunAnimation {
#[cfg_attr(feature = "be-dyn-lib", export_name = "quadruped_small_run")]
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(_velocity, _global_time): Self::Dependency,
(_velocity, _global_time, avg_vel): Self::Dependency,
anim_time: f64,
_rate: &mut f32,
skeleton_attr: &SkeletonAttr,
@ -25,6 +25,7 @@ impl Animation for RunAnimation {
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();
let x_tilt = avg_vel.z.atan2(avg_vel.xy().magnitude()).max(-0.7);
next.head.offset =
Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1 + slow * 1.5) / 11.0;
@ -37,7 +38,7 @@ impl Animation for RunAnimation {
skeleton_attr.chest.0,
skeleton_attr.chest.1 + slow_alt * 1.2,
) / 11.0;
next.chest.ori = Quaternion::rotation_x(slow * 0.1);
next.chest.ori = Quaternion::rotation_x(slow * 0.1 + x_tilt);
next.chest.scale = Vec3::one() / 11.0;
next.leg_fl.offset = Vec3::new(

View File

@ -898,7 +898,7 @@ impl FigureMgr {
(true, true, false) => {
anim::quadruped_small::RunAnimation::update_skeleton(
&QuadrupedSmallSkeleton::new(),
(vel.0.magnitude(), time),
(vel.0.magnitude(), time, state.avg_vel),
state.state_time,
&mut state_animation_rate,
skeleton_attr,