From 21b6b3affb9a06fe8ff1f7e8e751b66191f81132 Mon Sep 17 00:00:00 2001 From: jshipsey Date: Wed, 1 Jul 2020 01:26:59 -0400 Subject: [PATCH] simplify quadmed run, integrate dampener variable --- .../voxygen/voxel/npc/wolf/male/foot_bl.vox | Bin 1456 -> 1500 bytes .../voxygen/voxel/npc/wolf/male/foot_br.vox | Bin 1456 -> 1496 bytes .../voxygen/voxel/npc/wolf/male/foot_fl.vox | Bin 1456 -> 1500 bytes .../voxygen/voxel/npc/wolf/male/foot_fr.vox | Bin 1456 -> 1500 bytes .../quadruped_medium_central_manifest.ron | 40 +++--- .../quadruped_medium_lateral_manifest.ron | 16 +-- voxygen/src/anim/src/quadruped_medium/mod.rs | 51 ++++--- voxygen/src/anim/src/quadruped_medium/run.rs | 126 +++++------------- 8 files changed, 94 insertions(+), 139 deletions(-) diff --git a/assets/voxygen/voxel/npc/wolf/male/foot_bl.vox b/assets/voxygen/voxel/npc/wolf/male/foot_bl.vox index f547d166be1290e946d5e075bbb3c26e38d0d907..c965e251ebb6872dc3f69dc11cad3bf5460cfed7 100644 GIT binary patch delta 97 zcmdnMeTQ2x%s)b58Uq7^ucN0QkYYG7QBYiv3&@CwjPjhp2ohpoNZn|e&8Wl3#96?^ q2*gaB`Ap25`HYM}nt`)`5r`R>IP(~oIrA8Sn1PWqZ}SpH9u@$F!w{+f delta 52 zcmcb^y@6XW%s)b58Uq7^ucN0QkYboKQBYiv6Uc~&jPlH31PL)PL~XRpX54&%k%t8U DF)|AP diff --git a/assets/voxygen/voxel/npc/wolf/male/foot_br.vox b/assets/voxygen/voxel/npc/wolf/male/foot_br.vox index 8e0c3212f99bfc75a74f702fcb66d699f26a2de1..9d006d34f2354bd3dee5b40917720147c69bda68 100644 GIT binary patch delta 92 zcmdnMeS=#t%s)b58Uq7^ucN0QkYYG8QBYiv3&@CwjPjhq2ohpoNZDwa&8W`E%$di; m1jNjoxr|Jl1q{rb`3xYMfwO>-0mx?L%x7fe+`O2PmjwVZtPiUI delta 52 zcmcb?y@6XW%s)b58Uq7^ucN0QkYboKQBYiv6Uc~&jPlH31PL)PL~XRpX54&+k%t8U DFj5Nm diff --git a/assets/voxygen/voxel/npc/wolf/male/foot_fl.vox b/assets/voxygen/voxel/npc/wolf/male/foot_fl.vox index a31452a6d847c0967e04dfeb5e636f5999dd8611..33ad5e79d74c83b43f935c3db33ac900e8745d89 100644 GIT binary patch delta 97 zcmdnMeTQ2x%s)b58Uq7^ucN0QkYYG7QBYiv3&@CwjPjhp2ohpoNZn|e&8Wl3#F@{; n48$Osk+Xmigc&#sn1Gmpi8GIZku#TpnKPFWh&L}` std::convert::TryFrom<&'a comp::Body> for SkeletonAttr { @@ -159,6 +160,7 @@ impl Default for SkeletonAttr { feet_f: (0.0, 0.0, 0.0), feet_b: (0.0, 0.0, 0.0), scaler: 0.0, + dampen: 0.0, } } } @@ -169,14 +171,14 @@ impl<'a> From<&'a comp::quadruped_medium::Body> for SkeletonAttr { Self { head_upper: match (body.species, body.body_type) { (Grolgar, _) => (-8.0, 1.5), - (Saber, _) => (-10.0, -3.0), - (Tuskram, _) => (2.0, 1.0), - (Lion, _) => (12.5, 2.0), - (Tarasque, _) => (5.5, 3.5), + (Saber, _) => (0.0, -3.0), + (Tuskram, _) => (0.0, 1.0), + (Lion, _) => (2.5, 2.0), + (Tarasque, _) => (-4.0, 3.5), (Tiger, _) => (2.0, 1.0), (Wolf, _) => (-0.5, 3.0), (Frostfang, _) => (1.0, -2.0), - (Mouflon, _) => (-5.5, 6.0), + (Mouflon, _) => (-2.5, 6.0), }, head_lower: match (body.species, body.body_type) { (Grolgar, _) => (3.5, -3.0), @@ -190,12 +192,12 @@ impl<'a> From<&'a comp::quadruped_medium::Body> for SkeletonAttr { (Mouflon, _) => (-1.0, 0.5), }, jaw: match (body.species, body.body_type) { - (Grolgar, _) => (-2.5, 0.5), - (Saber, _) => (21.0, -2.0), - (Tuskram, _) => (1.5, -4.0), - (Lion, _) => (0.0, -4.5), + (Grolgar, _) => (8.5, 4.5), + (Saber, _) => (3.5, -2.0), + (Tuskram, _) => (5.5, -4.0), + (Lion, _) => (3.5, -4.5), (Tarasque, _) => (9.0, -10.0), - (Tiger, _) => (7.0, -4.0), + (Tiger, _) => (3.5, -4.0), (Wolf, _) => (5.0, -3.0), (Frostfang, _) => (5.0, -3.0), (Mouflon, _) => (10.5, -4.0), @@ -214,11 +216,11 @@ impl<'a> From<&'a comp::quadruped_medium::Body> for SkeletonAttr { torso_front: match (body.species, body.body_type) { (Grolgar, _) => (10.0, 11.0), (Saber, _) => (14.0, 13.0), - (Tuskram, _) => (10.0, 15.5), + (Tuskram, _) => (10.0, 14.5), (Lion, _) => (10.0, 13.0), (Tarasque, _) => (11.5, 18.5), (Tiger, _) => (10.0, 14.0), - (Wolf, _) => (12.0, 14.0), + (Wolf, _) => (12.0, 13.0), (Frostfang, _) => (9.0, 11.5), (Mouflon, _) => (11.0, 13.5), }, @@ -235,10 +237,10 @@ impl<'a> From<&'a comp::quadruped_medium::Body> for SkeletonAttr { }, ears: match (body.species, body.body_type) { (Grolgar, _) => (5.0, 8.0), - (Saber, _) => (12.0, 5.5), + (Saber, _) => (3.0, 5.5), (Tuskram, _) => (5.5, 12.0), - (Lion, _) => (-7.0, 3.5), - (Tarasque, _) => (2.0, -3.0), + (Lion, _) => (2.0, 3.5), + (Tarasque, _) => (11.0, -3.0), (Tiger, _) => (2.5, 4.0), (Wolf, _) => (3.0, 2.5), (Frostfang, _) => (2.0, 3.5), @@ -269,22 +271,22 @@ impl<'a> From<&'a comp::quadruped_medium::Body> for SkeletonAttr { 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, -5.0), + (Tuskram, _) => (0.5, 0.5, -4.0), (Lion, _) => (0.0, 0.0, -1.5), (Tarasque, _) => (1.0, 0.0, -3.0), (Tiger, _) => (0.5, 0.0, -5.0), - (Wolf, _) => (0.5, -1.0, -3.5), + (Wolf, _) => (0.5, 0.0, -2.0), (Frostfang, _) => (0.5, 1.5, -3.5), (Mouflon, _) => (-0.5, -0.5, -1.5), }, feet_b: match (body.species, body.body_type) { (Grolgar, _) => (0.0, 0.0, -5.0), (Saber, _) => (1.0, -2.0, 0.0), - (Tuskram, _) => (0.5, 0.0, -4.0), + (Tuskram, _) => (0.5, 0.0, -3.0), (Lion, _) => (0.5, 0.5, -4.0), (Tarasque, _) => (1.5, -1.0, -2.5), (Tiger, _) => (1.0, 0.5, -4.0), - (Wolf, _) => (0.0, -2.0, -3.0), + (Wolf, _) => (0.0, -1.0, -1.5), (Frostfang, _) => (0.0, -1.5, -3.5), (Mouflon, _) => (-1.0, -1.5, -2.5), }, @@ -299,6 +301,17 @@ impl<'a> From<&'a comp::quadruped_medium::Body> for SkeletonAttr { (Frostfang, _) => (1.0), (Mouflon, _) => (1.0), }, + dampen: match (body.species, body.body_type) { + (Grolgar, _) => (0.5), + (Saber, _) => (0.7), + (Tuskram, _) => (0.9), + (Lion, _) => (0.7), + (Tarasque, _) => (0.7), + (Tiger, _) => (0.6), + (Wolf, _) => (1.0), + (Frostfang, _) => (1.0), + (Mouflon, _) => (1.0), + }, } } } diff --git a/voxygen/src/anim/src/quadruped_medium/run.rs b/voxygen/src/anim/src/quadruped_medium/run.rs index a215431cef..b978c82579 100644 --- a/voxygen/src/anim/src/quadruped_medium/run.rs +++ b/voxygen/src/anim/src/quadruped_medium/run.rs @@ -22,7 +22,7 @@ impl Animation for RunAnimation { let mut next = (*skeleton).clone(); let speed = Vec2::::from(velocity).magnitude(); *rate = 1.0; - let lab = 0.6; + let lab = 0.6; //6 let speedmult = if speed > 8.0 { 1.2 * (1.0 / skeleton_attr.scaler) @@ -38,71 +38,7 @@ impl Animation for RunAnimation { .sqrt()) * ((anim_time as f32 * 16.0 * lab as f32 * speedmult + PI * 1.0).sin()); - let foothoril = (((1.0) - / (0.5 - + (0.5) - * ((anim_time as f32 * 16.0 * lab as f32 * speedmult + PI * 1.45).sin()) - .powf(2.0 as f32))) - .sqrt()) - * ((anim_time as f32 * 16.0 * lab as f32 * speedmult + PI * 1.45).sin()); - let foothorir = (((1.0) - / (0.2 - + (0.8) - * ((anim_time as f32 * 16.0 * lab as f32 * speedmult + PI * 0.45).sin()) - .powf(2.0 as f32))) - .sqrt()) - * ((anim_time as f32 * 16.0 * lab as f32 * speedmult + PI * 0.45).sin()); - let footvertl = (anim_time as f32 * 16.0 * lab as f32 * speedmult + PI * 0.0).sin(); - let footvertr = (anim_time as f32 * 16.0 * lab as f32 * speedmult + PI).sin(); - - let footrotl = (((1.0) - / (0.5 - + (0.5) - * ((anim_time as f32 * 16.0 * lab as f32 * speedmult + PI * 1.4).sin()) - .powf(2.0 as f32))) - .sqrt()) - * ((anim_time as f32 * 16.0 * lab as f32 * speedmult + PI * 1.4).sin()); - - let footrotr = (((1.0) - / (0.5 - + (0.5) - * ((anim_time as f32 * 16.0 * lab as f32 * speedmult + PI * 1.8).sin()) - .powf(2.0 as f32))) - .sqrt()) - * ((anim_time as f32 * 16.0 * lab as f32 * speedmult + PI * 1.8).sin()); // - let foothorilb = (((5.0) - / (1.0 - + (4.0) - * ((anim_time as f32 * 16.0 * lab as f32 * speedmult + PI * 1.05).sin()) - .powf(2.0 as f32))) - .sqrt()) - * ((anim_time as f32 * 16.0 * lab as f32 * speedmult + PI * 1.05).sin()); - let foothorirb = (((1.0) - / (0.2 - + (0.8) - * ((anim_time as f32 * 16.0 * lab as f32 * speedmult + PI * 0.05).sin()) - .powf(2.0 as f32))) - .sqrt()) - * ((anim_time as f32 * 16.0 * lab as f32 * speedmult + PI * 0.05).sin()); - let footvertlb = (anim_time as f32 * 16.0 * lab as f32 * speedmult + PI * (-0.4)).sin(); - let footvertrb = (anim_time as f32 * 16.0 * lab as f32 * speedmult + PI * 0.6).sin(); - - let footrotlb = (((1.0) - / (0.5 - + (0.5) - * ((anim_time as f32 * 16.0 * lab as f32 * speedmult + PI * 0.0).sin()) - .powf(2.0 as f32))) - .sqrt()) - * ((anim_time as f32 * 16.0 * lab as f32 * speedmult + PI * 0.0).sin()); - - let footrotrb = (((1.0) - / (0.5 - + (0.5) - * ((anim_time as f32 * 16.0 * lab as f32 * speedmult + PI * 0.4).sin()) - .powf(2.0 as f32))) - .sqrt()) - * ((anim_time as f32 * 16.0 * lab as f32 * speedmult + PI * 0.4).sin()); let shortalt = (anim_time as f32 * 16.0 * lab as f32 * speedmult + PI * 0.5).sin(); @@ -127,7 +63,7 @@ impl Animation for RunAnimation { } * 1.3; //let tilt = 0.0; if speed < 8.0 { - //Trot + /* //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); @@ -236,7 +172,7 @@ impl Animation for RunAnimation { 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; + next.foot_br.scale = Vec3::one() * 0.98;*/ } else { //Gallop next.head_upper.offset = @@ -272,8 +208,11 @@ impl Animation for RunAnimation { Quaternion::rotation_x(short * 0.13) * 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.2 - 0.2); + 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.1) * Quaternion::rotation_z(tilt * 1.8); next.torso_back.scale = Vec3::one(); @@ -281,74 +220,77 @@ 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 + foothoril * -2.5, - skeleton_attr.leg_f.2 + 1.0 + footvertl * -1.0, + skeleton_attr.leg_f.1 + footvertlalt * -2.0, + skeleton_attr.leg_f.2 + 1.0 + footvertltalt * -1.9, ); next.leg_fl.ori = - Quaternion::rotation_x(footrotl * -0.6) * Quaternion::rotation_z(tilt * -0.5); + Quaternion::rotation_x(footvertltalt * -0.4) * Quaternion::rotation_z(tilt * -0.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 + foothoril * -2.5, - skeleton_attr.leg_f.2 + 1.0 + footvertl * -1.0, + skeleton_attr.leg_f.1 + footvertlalt * -2.0, + skeleton_attr.leg_f.2 + 1.0 + footvertltalt * -1.9, ); next.leg_fr.ori = - Quaternion::rotation_x(footrotr * -0.6) * Quaternion::rotation_z(tilt * -0.5); + Quaternion::rotation_x(footvertltalt * -0.4) * Quaternion::rotation_z(tilt * -0.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 + foothorirb * -2.5, - skeleton_attr.leg_b.2 + 1.0 + footvertrb * -1.2, + skeleton_attr.leg_b.1 + footvertl * -1.7, + skeleton_attr.leg_b.2 + 1.0 + footvertlt * -1.5, ); - next.leg_bl.ori = - Quaternion::rotation_x(footrotlb * -0.6) * Quaternion::rotation_z(tilt * -1.5); + next.leg_bl.ori = Quaternion::rotation_x(footvertlt * -0.4 - 0.2) + * 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 * -2.5, - skeleton_attr.leg_b.2 + 1.0 + footvertrb * -1.2, + skeleton_attr.leg_b.1 + footvertl * -1.7, + skeleton_attr.leg_b.2 + 1.0 + footvertlt * -1.5, ); - next.leg_br.ori = - Quaternion::rotation_x(footrotrb * -0.6) * Quaternion::rotation_z(tilt * -1.5); + next.leg_br.ori = Quaternion::rotation_x(footvertlt * -0.4 - 0.2) + * 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 + 2.0 + ((footvertl * -2.0).max(-1.0)), + skeleton_attr.feet_f.2 + ((footvertl * -2.7).max(0.0)), ); - next.foot_fl.ori = Quaternion::rotation_x(footrotl * -0.7); + next.foot_fl.ori = Quaternion::rotation_x(footvertlt * 0.9 * skeleton_attr.dampen); 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 + 2.0 + ((footvertl * -2.0).max(-1.0)), + skeleton_attr.feet_f.2 + ((footvertl * -2.7).max(0.0)), ); - next.foot_fr.ori = Quaternion::rotation_x(footrotr * -0.7); + next.foot_fr.ori = Quaternion::rotation_x(footvertlt * 0.9 * skeleton_attr.dampen); 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 + 2.0 + ((footvertrb * -2.0).max(-1.0)), + skeleton_attr.feet_b.2 + ((footvertl * 2.4).max(0.0)), ); - next.foot_bl.ori = Quaternion::rotation_x(footrotlb * -0.7); + next.foot_bl.ori = Quaternion::rotation_x(footvertlt * -0.9 - 0.2); 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 + 2.0 + ((footvertrb * -2.0).max(-1.0)), + skeleton_attr.feet_b.2 + ((footvertl * 2.4).max(-0.0)), ); - next.foot_br.ori = Quaternion::rotation_x(footrotrb * -0.7); + next.foot_br.ori = Quaternion::rotation_x(footvertlt * -0.9 - 0.2); next.foot_br.scale = Vec3::one() * 0.98; } next