diff --git a/assets/common/npc_names.ron b/assets/common/npc_names.ron index 6827f42355..0e93b93ccc 100644 --- a/assets/common/npc_names.ron +++ b/assets/common/npc_names.ron @@ -889,9 +889,9 @@ ] ), species: ( - clownfish: ( - keyword: "gremlin", - generic: "Gremlin" + gnome: ( + keyword: "gnome", + generic: "Gnome" ) ) ), diff --git a/assets/voxygen/voxel/biped_small_central_manifest.ron b/assets/voxygen/voxel/biped_small_central_manifest.ron index 50dd30551c..9b325d72bc 100644 --- a/assets/voxygen/voxel/biped_small_central_manifest.ron +++ b/assets/voxygen/voxel/biped_small_central_manifest.ron @@ -1,46 +1,46 @@ ({ - (Gremlin, Male): ( + (Gnome, Male): ( head: ( - offset: (-1.5, -7.5, -5.0), - central: ("npc.gremlin.male.chest"), + offset: (-8.0, -6.5, -12.0), + central: ("npc.gnome.male.head"), ), chest: ( - offset: (-1.5, -7.5, -5.0), - central: ("npc.gremlin.male.chest"), + offset: (-5.0, -3.0, -2.5), + central: ("npc.gnome.male.chest"), ), shorts: ( - offset: (-1.5, -7.5, -5.0), - central: ("npc.gremlin.male.chest"), + offset: (-4.0, -3.5, -2.5), + central: ("npc.gnome.male.shorts"), ), tail: ( offset: (-0.5, -5.0, -2.5), - central: ("npc.gremlin.male.tail"), + central: ("armor.empty"), ), main: ( offset: (-1.5, -7.5, -5.0), - central: ("npc.gremlin.male.chest"), + central: ("armor.empty"), ), ), - (Gremlin, Female): ( + (Gnome, Female): ( head: ( - offset: (-1.5, -7.5, -5.0), - central: ("npc.gremlin.male.chest"), + offset: (-8.0, -6.5, -12.0), + central: ("npc.gnome.male.head"), ), chest: ( - offset: (-1.5, -7.5, -5.0), - central: ("npc.gremlin.male.chest"), + offset: (-5.0, -3.0, -2.5), + central: ("npc.gnome.male.chest"), ), shorts: ( - offset: (-1.5, -7.5, -5.0), - central: ("npc.gremlin.male.chest"), + offset: (-4.0, -3.5, -2.5), + central: ("npc.gnome.male.shorts"), ), tail: ( offset: (-0.5, -5.0, -2.5), - central: ("npc.gremlin.male.tail"), + central: ("armor.empty"), ), main: ( offset: (-1.5, -7.5, -5.0), - central: ("npc.gremlin.male.chest"), + central: ("armor.empty"), ), ), }) diff --git a/assets/voxygen/voxel/biped_small_lateral_manifest.ron b/assets/voxygen/voxel/biped_small_lateral_manifest.ron index 75fa3b3901..aa2ddba155 100644 --- a/assets/voxygen/voxel/biped_small_lateral_manifest.ron +++ b/assets/voxygen/voxel/biped_small_lateral_manifest.ron @@ -1,38 +1,38 @@ ({ - (Gremlin, Male): ( + (Gnome, Male): ( hand_l: ( - offset: (-0.5, -3.0, -4.0), - lateral: ("npc.gremlin.male.hand_l"), + offset: (-2.0, -2.0, -5.0), + lateral: ("npc.gnome.male.hand_l"), ), hand_r: ( - offset: (-0.5, -3.0, -4.0), - lateral: ("npc.gremlin.male.hand_r"), + offset: (-2.0, -2.0, -5.0), + lateral: ("npc.gnome.male.hand_r"), ), foot_l: ( - offset: (-0.5, -3.0, -4.0), - lateral: ("npc.gremlin.male.fooot_l"), + offset: (-1.5, -2.0, -4.0), + lateral: ("npc.gnome.male.foot_l"), ), foot_r: ( - offset: (-0.5, -3.0, -4.0), - lateral: ("npc.gremlin.male.foot_r"), + offset: (-1.5, -2.0, -4.0), + lateral: ("npc.gnome.male.foot_r"), ), ), - (Gremlin, Female): ( + (Gnome, Female): ( hand_l: ( - offset: (-0.5, -3.0, -4.0), - lateral: ("npc.gremlin.male.hand_l"), + offset: (-2.0, -2.0, -5.0), + lateral: ("npc.gnome.male.hand_l"), ), hand_r: ( - offset: (-0.5, -3.0, -4.0), - lateral: ("npc.gremlin.male.hand_r"), + offset: (-2.0, -2.0, -5.0), + lateral: ("npc.gnome.male.hand_r"), ), foot_l: ( - offset: (-0.5, -3.0, -4.0), - lateral: ("npc.gremlin.male.fooot_l"), + offset: (-1.5, -2.0, -4.0), + lateral: ("npc.gnome.male.foot_l"), ), foot_r: ( - offset: (-0.5, -3.0, -4.0), - lateral: ("npc.gremlin.male.foot_r"), + offset: (-1.5, -2.0, -4.0), + lateral: ("npc.gnome.male.foot_r"), ), ), }) diff --git a/assets/voxygen/voxel/npc/gnome/male/chest.vox b/assets/voxygen/voxel/npc/gnome/male/chest.vox new file mode 100644 index 0000000000..04a2841e16 --- /dev/null +++ b/assets/voxygen/voxel/npc/gnome/male/chest.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6acdfb5c0d402b8b8f82c9a294e1d65adc8ad23f1911b380a90a93ce6ca00f78 +size 1752 diff --git a/assets/voxygen/voxel/npc/gnome/male/foot_l.vox b/assets/voxygen/voxel/npc/gnome/male/foot_l.vox new file mode 100644 index 0000000000..245f2e5c04 --- /dev/null +++ b/assets/voxygen/voxel/npc/gnome/male/foot_l.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e1df3ebd080235330d78d44113bc16e5dd8fb9d515afee112cb86b27dc22c3e3 +size 1264 diff --git a/assets/voxygen/voxel/npc/gnome/male/foot_r.vox b/assets/voxygen/voxel/npc/gnome/male/foot_r.vox new file mode 100644 index 0000000000..8c3e8a9c9c --- /dev/null +++ b/assets/voxygen/voxel/npc/gnome/male/foot_r.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:417fa23a21f543a0d08ecd7621436792008e2e5c12a816eeffb9bd4443bb4137 +size 1264 diff --git a/assets/voxygen/voxel/npc/gnome/male/hand_l.vox b/assets/voxygen/voxel/npc/gnome/male/hand_l.vox new file mode 100644 index 0000000000..cf25e21c4b --- /dev/null +++ b/assets/voxygen/voxel/npc/gnome/male/hand_l.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7b7ab3b14b7850bd213ad400712ad88189fcf8574b075e0c9941b4752bf766d3 +size 1380 diff --git a/assets/voxygen/voxel/npc/gnome/male/hand_r.vox b/assets/voxygen/voxel/npc/gnome/male/hand_r.vox new file mode 100644 index 0000000000..cb179f89f2 --- /dev/null +++ b/assets/voxygen/voxel/npc/gnome/male/hand_r.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:347ca2a79d3f5199e5c3e4d68078fa74e616b8bf8ed8d3a3110a32bb346a6d08 +size 1380 diff --git a/assets/voxygen/voxel/npc/gnome/male/head.vox b/assets/voxygen/voxel/npc/gnome/male/head.vox new file mode 100644 index 0000000000..6dfa08ca40 --- /dev/null +++ b/assets/voxygen/voxel/npc/gnome/male/head.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d3113963a0773c49f7c5d59ca26a654d6a5dfced6f3da78e92c286da57ad89bf +size 3848 diff --git a/assets/voxygen/voxel/npc/gnome/male/shorts.vox b/assets/voxygen/voxel/npc/gnome/male/shorts.vox new file mode 100644 index 0000000000..e64cbb4730 --- /dev/null +++ b/assets/voxygen/voxel/npc/gnome/male/shorts.vox @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0e0deb158454c543936ca5e4e40ac179e6d6b8be9d4d6c160425028823355fb3 +size 1680 diff --git a/common/src/comp/body/biped_small.rs b/common/src/comp/body/biped_small.rs index b6fe13c5ff..85950c8d20 100644 --- a/common/src/comp/body/biped_small.rs +++ b/common/src/comp/body/biped_small.rs @@ -34,7 +34,7 @@ make_case_elim!( #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] #[repr(u32)] pub enum Species { - Gremlin = 0, + Gnome = 0, } ); @@ -43,7 +43,7 @@ make_case_elim!( /// NOTE: Deliberately don't (yet?) implement serialize. #[derive(Clone, Debug, Deserialize)] pub struct AllSpecies { - pub gremlin: SpeciesMeta, + pub gnome: SpeciesMeta, } impl<'a, SpeciesMeta> core::ops::Index<&'a Species> for AllSpecies { @@ -52,12 +52,12 @@ impl<'a, SpeciesMeta> core::ops::Index<&'a Species> for AllSpecies #[inline] fn index(&self, &index: &'a Species) -> &Self::Output { match index { - Species::Gremlin => &self.gremlin, + Species::Gnome => &self.gnome, } } } -pub const ALL_SPECIES: [Species; 1] = [Species::Gremlin]; +pub const ALL_SPECIES: [Species; 1] = [Species::Gnome]; impl<'a, SpeciesMeta: 'a> IntoIterator for &'a AllSpecies { type IntoIter = std::iter::Copied>; diff --git a/common/src/npc.rs b/common/src/npc.rs index 17414adc78..d7eebe5f17 100644 --- a/common/src/npc.rs +++ b/common/src/npc.rs @@ -16,7 +16,7 @@ pub enum NpcKind { Clownfish, Marlin, Ogre, - Gremlin, + Gnome, Archaeos, StoneGolem, Reddragon, @@ -31,7 +31,7 @@ pub const ALL_NPCS: [NpcKind; 12] = [ NpcKind::Clownfish, NpcKind::Marlin, NpcKind::Ogre, - NpcKind::Gremlin, + NpcKind::Gnome, NpcKind::Archaeos, NpcKind::StoneGolem, NpcKind::Reddragon, @@ -125,7 +125,7 @@ pub fn kind_to_body(kind: NpcKind) -> Body { NpcKind::Clownfish => comp::fish_small::Body::random().into(), NpcKind::Marlin => comp::fish_medium::Body::random().into(), NpcKind::Ogre => comp::biped_large::Body::random().into(), - NpcKind::Gremlin => comp::biped_small::Body::random().into(), + NpcKind::Gnome => comp::biped_small::Body::random().into(), NpcKind::Archaeos => comp::theropod::Body::random().into(), NpcKind::StoneGolem => comp::golem::Body::random().into(), NpcKind::Reddragon => comp::dragon::Body::random().into(), @@ -255,7 +255,7 @@ impl NpcBody { .or_else(|| { parse( s, - NpcKind::Gremlin, + NpcKind::Gnome, &npc_names.biped_small, comp::biped_small::Body::random_with, ) diff --git a/voxygen/anim/src/biped_small/idle.rs b/voxygen/anim/src/biped_small/idle.rs index 6e90bc485e..6dad997260 100644 --- a/voxygen/anim/src/biped_small/idle.rs +++ b/voxygen/anim/src/biped_small/idle.rs @@ -2,6 +2,7 @@ use super::{ super::{vek::*, Animation}, BipedSmallSkeleton, SkeletonAttr, }; +use std::{f32::consts::PI, ops::Mul}; pub struct IdleAnimation; @@ -14,7 +15,7 @@ impl Animation for IdleAnimation { #[cfg(feature = "use-dyn-lib")] const UPDATE_FN: &'static [u8] = b"biped_small_idle\0"; - #[cfg_attr(feature = "be-dyn-lib", export_name = "Biped_small_idle")] + #[cfg_attr(feature = "be-dyn-lib", export_name = "biped_small_idle")] fn update_skeleton_inner( skeleton: &Self::Skeleton, @@ -24,20 +25,23 @@ impl Animation for IdleAnimation { s_a: &SkeletonAttr, ) -> Self::Skeleton { let mut next = (*skeleton).clone(); + let slow = (anim_time as f32 * 4.0).sin(); - next.head.scale = Vec3::one(); + next.foot_l.scale = Vec3::one() / 13.0; + next.foot_r.scale = Vec3::one() / 13.0; next.chest.scale = Vec3::one() / 13.0; + next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1 + slow * -0.1); - next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1) / 13.0; + next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + slow * 0.3) / 13.0; next.shorts.position = Vec3::new(0.0, s_a.shorts.0, s_a.shorts.1); next.main.position = Vec3::new(0.0, 0.0, 0.0); next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1); - next.hand_l.position = Vec3::new(s_a.hand.0, s_a.hand.1, s_a.hand.2); - next.hand_r.position = Vec3::new(s_a.hand.0, s_a.hand.1, s_a.hand.2); - next.foot_l.position = Vec3::new(s_a.foot.0, s_a.foot.1, s_a.foot.2); - next.foot_r.position = Vec3::new(s_a.foot.0, s_a.foot.1, s_a.foot.2); + next.hand_l.position = Vec3::new(-s_a.hand.0, s_a.hand.1, s_a.hand.2 + slow * -0.1); + next.hand_r.position = Vec3::new(s_a.hand.0, s_a.hand.1, s_a.hand.2 + slow * -0.1); + next.foot_l.position = Vec3::new(-s_a.foot.0, s_a.foot.1, s_a.foot.2) / 13.0; + next.foot_r.position = Vec3::new(s_a.foot.0, s_a.foot.1, s_a.foot.2) / 13.0; next } diff --git a/voxygen/anim/src/biped_small/mod.rs b/voxygen/anim/src/biped_small/mod.rs index 408ab9f139..73c22b02f3 100644 --- a/voxygen/anim/src/biped_small/mod.rs +++ b/voxygen/anim/src/biped_small/mod.rs @@ -37,7 +37,7 @@ impl Skeleton for BipedSmallSkeleton { buf: &mut [FigureBoneData; super::MAX_BONE_COUNT], ) -> Vec3 { let chest_mat = base_mat * Mat4::::from(self.chest); - let shorts_mat = chest_mat * Mat4::::from(self.chest); + let shorts_mat = chest_mat * Mat4::::from(self.shorts); *(<&mut [_; Self::BONE_COUNT]>::try_from(&mut buf[0..Self::BONE_COUNT]).unwrap()) = [ make_bone(chest_mat * Mat4::::from(self.head)), @@ -46,9 +46,9 @@ impl Skeleton for BipedSmallSkeleton { make_bone(shorts_mat * Mat4::::from(self.tail)), make_bone(chest_mat * Mat4::::from(self.main)), make_bone(chest_mat * Mat4::::from(self.hand_l)), - make_bone(chest_mat * Mat4::::from(self.hand_l)), - make_bone(base_mat * Mat4::::from(self.foot_l)), + make_bone(chest_mat * Mat4::::from(self.hand_r)), make_bone(base_mat * Mat4::::from(self.foot_l)), + make_bone(base_mat * Mat4::::from(self.foot_r)), ]; Vec3::default() } @@ -92,22 +92,22 @@ impl<'a> From<&'a Body> for SkeletonAttr { use comp::biped_small::Species::*; Self { head: match (body.species, body.body_type) { - (Gremlin, _) => (0.0, 5.0), + (Gnome, _) => (-1.0, 9.0), }, chest: match (body.species, body.body_type) { - (Gremlin, _) => (0.0, 5.0), + (Gnome, _) => (0.0, 9.0), }, shorts: match (body.species, body.body_type) { - (Gremlin, _) => (0.0, 5.0), + (Gnome, _) => (0.0, -3.0), }, tail: match (body.species, body.body_type) { - (Gremlin, _) => (-7.5, -0.5), + (Gnome, _) => (0.0, 0.0), }, hand: match (body.species, body.body_type) { - (Gremlin, _) => (2.0, 0.5, 1.0), + (Gnome, _) => (6.0, 0.5, -1.0), }, foot: match (body.species, body.body_type) { - (Gremlin, _) => (2.0, 0.5, 1.0), + (Gnome, _) => (3.0, 0.0, 4.0), }, } } diff --git a/voxygen/anim/src/biped_small/run.rs b/voxygen/anim/src/biped_small/run.rs index c1ed6375ae..7afb3e20d8 100644 --- a/voxygen/anim/src/biped_small/run.rs +++ b/voxygen/anim/src/biped_small/run.rs @@ -2,10 +2,11 @@ use super::{ super::{vek::*, Animation}, BipedSmallSkeleton, SkeletonAttr, }; +use std::{f32::consts::PI, ops::Mul}; pub struct RunAnimation; -type RunAnimationDependency = (Vec3, Vec3, Vec3, f64, Vec3); +type RunAnimationDependency = (Vec3, Vec3, Vec3, f64, Vec3, f32); impl Animation for RunAnimation { type Dependency = RunAnimationDependency; @@ -14,30 +15,157 @@ impl Animation for RunAnimation { #[cfg(feature = "use-dyn-lib")] const UPDATE_FN: &'static [u8] = b"biped_small_run\0"; - #[cfg_attr(feature = "be-dyn-lib", export_name = "Biped_small_run")] + #[cfg_attr(feature = "be-dyn-lib", export_name = "biped_small_run")] fn update_skeleton_inner( skeleton: &Self::Skeleton, - (_velocity, _orientation, _last_ori, _global_time, _avg_vel): Self::Dependency, + (velocity, orientation, last_ori, global_time, avg_vel, acc_vel): Self::Dependency, anim_time: f64, - _rate: &mut f32, + rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { let mut next = (*skeleton).clone(); + let speed = Vec2::::from(velocity).magnitude(); + *rate = 1.0; + let impact = (avg_vel.z).max(-8.0); + let speednorm = speed / 9.4; + + let lab = 1.0; + + let footrotl = (((1.0) + / (0.5 + (0.5) * ((acc_vel * 1.6 * lab as f32 + PI * 1.4).sin()).powi(2))) + .sqrt()) + * ((acc_vel * 1.6 * lab as f32 + PI * 1.4).sin()); + + let footrotr = (((1.0) + / (0.5 + (0.5) * ((acc_vel * 1.6 * lab as f32 + PI * 0.4).sin()).powi(2))) + .sqrt()) + * ((acc_vel * 1.6 * lab as f32 + PI * 0.4).sin()); + + let shortalter = (acc_vel * lab as f32 * 1.6 + PI / -2.0).sin(); + + let foothoril = (acc_vel * 1.6 * lab as f32 + PI * 1.45).sin(); + let foothorir = (acc_vel * 1.6 * lab as f32 + PI * (0.45)).sin(); + let footstrafel = (acc_vel * 1.6 * lab as f32 + PI * 1.45).sin(); + let footstrafer = (acc_vel * 1.6 * lab as f32 + PI * (0.95)).sin(); + + let footvertl = (acc_vel * 1.6 * lab as f32).sin(); + let footvertr = (acc_vel * 1.6 * lab as f32 + PI).sin(); + let footvertsl = (acc_vel * 1.6 * lab as f32).sin(); + let footvertsr = (acc_vel * 1.6 * lab as f32 + PI * 0.5).sin(); + + let shortalt = (acc_vel * lab as f32 * 1.6 + PI / 2.0).sin(); + + let short = (((5.0) / (1.5 + 3.5 * ((acc_vel * lab as f32 * 1.6).sin()).powi(2))).sqrt()) + * ((acc_vel * lab as f32 * 1.6).sin()); + let direction = velocity.y * -0.098 * orientation.y + velocity.x * -0.098 * orientation.x; + + let side = + (velocity.x * -0.098 * orientation.y + velocity.y * 0.098 * orientation.x) * -1.0; + let sideabs = side.abs(); + let ori: Vec2 = Vec2::from(orientation); + let last_ori = Vec2::from(last_ori); + let tilt = if ::vek::Vec2::new(ori, last_ori) + .map(|o| o.magnitude_squared()) + .map(|m| m > 0.001 && m.is_finite()) + .reduce_and() + && ori.angle_between(last_ori).is_finite() + { + ori.angle_between(last_ori).min(0.2) + * last_ori.determine_side(Vec2::zero(), ori).signum() + } else { + 0.0 + } * 1.3; + //println!("speednorm {} ",side); + + let head_look = Vec2::new( + ((global_time + anim_time) as f32 / 18.0) + .floor() + .mul(7331.0) + .sin() + * 0.2, + ((global_time + anim_time) as f32 / 18.0) + .floor() + .mul(1337.0) + .sin() + * 0.1, + ); + next.chest.scale = Vec3::one() / 13.0; + next.foot_l.scale = Vec3::one() / 13.0; + next.foot_r.scale = Vec3::one() / 13.0; + next.head.position = Vec3::new(0.0, -1.0 + s_a.head.0, s_a.head.1 + short * 0.1); + next.head.orientation = + Quaternion::rotation_z(tilt * -2.5 + head_look.x * 0.2 - short * 0.02) + * Quaternion::rotation_x(head_look.y + 0.45 * speednorm); + + next.chest.position = Vec3::new( + 0.0, + s_a.chest.0, + s_a.chest.1 + 1.0 * speednorm + shortalt * -0.8, + ) / 13.0; + next.chest.orientation = Quaternion::rotation_z(short * 0.06 + tilt * -0.6) + * Quaternion::rotation_y(tilt * 1.6) + * Quaternion::rotation_x( + impact * 0.06 + shortalter * 0.035 + speednorm * -0.4 + (tilt.abs()), + ); + + next.shorts.position = Vec3::new(0.0, s_a.shorts.0, s_a.shorts.1); + next.shorts.orientation = Quaternion::rotation_x(0.1 * speednorm) + * Quaternion::rotation_z(short * 0.25 + tilt * -1.5) + * Quaternion::rotation_y(tilt * 0.7); + + next.hand_l.position = Vec3::new( + -s_a.hand.0 + foothorir * -1.3 * speednorm, + 1.0 * speednorm + s_a.hand.1 + foothorir * -3.5 * speednorm, + 1.5 * speednorm + s_a.hand.2 - foothorir * 2.5 * speednorm, + ); + next.hand_l.orientation = + Quaternion::rotation_x(0.4 * speednorm + (footrotr * -1.2) * speednorm) + * Quaternion::rotation_y(footrotr * 0.4 * speednorm); + + next.hand_r.position = Vec3::new( + s_a.hand.0 + foothoril * 1.3 * speednorm, + 1.0 * speednorm + s_a.hand.1 + foothoril * -3.5 * speednorm, + 1.5 * speednorm + s_a.hand.2 - foothoril * 2.5 * speednorm, + ); + next.hand_r.orientation = + Quaternion::rotation_x(0.4 * speednorm + (footrotl * -1.2) * speednorm) + * Quaternion::rotation_y(footrotl * -0.4 * speednorm); + + // + next.foot_l.position = Vec3::new( + -s_a.foot.0 + footstrafel * sideabs * 3.0 + tilt * -2.0, + s_a.foot.1 + + (1.0 - sideabs) * (-1.0 * speednorm + foothoril * -7.5 * speednorm) + + (direction * 5.0).max(0.0), + s_a.foot.2 + + (1.0 - sideabs) * (2.0 * speednorm + ((footvertl * -2.1 * speednorm).max(-1.0))) + + side * ((footvertsl * 1.5).max(-1.0)), + ) / 13.0; + next.foot_l.orientation = Quaternion::rotation_x( + (1.0 - sideabs) * (-0.2 + foothoril * -1.3 * speednorm) + sideabs * -0.5, + ) * Quaternion::rotation_y( + tilt * 2.0 + side * 0.3 + side * (foothoril * 0.3), + ) * Quaternion::rotation_z(side * 0.2); + + next.foot_r.position = Vec3::new( + s_a.foot.0 + footstrafer * sideabs * 3.0 + tilt * -2.0, + s_a.foot.1 + + (1.0 - sideabs) * (-1.0 * speednorm + foothorir * -7.5 * speednorm) + + (direction * 5.0).max(0.0), + s_a.foot.2 + + (1.0 - sideabs) * (2.0 * speednorm + ((footvertr * -2.1 * speednorm).max(-1.0))) + + side * ((footvertsr * -1.5).max(-1.0)), + ) / 13.0; + next.foot_r.orientation = Quaternion::rotation_x( + (1.0 - sideabs) * (-0.2 + foothorir * -1.3 * speednorm) + sideabs * -0.5, + ) * Quaternion::rotation_y( + tilt * 2.0 + side * 0.3 + side * (foothorir * 0.3), + ) * Quaternion::rotation_z(side * 0.2); next.head.scale = Vec3::one(); - next.chest.scale = Vec3::one() / 13.0; - - next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1) / 13.0; - next.shorts.position = Vec3::new(0.0, s_a.shorts.0, s_a.shorts.1); - next.main.position = Vec3::new(0.0, 0.0, 0.0); - next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1); - next.hand_l.position = Vec3::new(s_a.hand.0, s_a.hand.1, s_a.hand.2); - next.hand_r.position = Vec3::new(s_a.hand.0, s_a.hand.1, s_a.hand.2); - next.foot_l.position = Vec3::new(s_a.foot.0, s_a.foot.1, s_a.foot.2); - next.foot_r.position = Vec3::new(s_a.foot.0, s_a.foot.1, s_a.foot.2); next } diff --git a/voxygen/anim/src/character/run.rs b/voxygen/anim/src/character/run.rs index 44025d0af7..6f6de75c29 100644 --- a/voxygen/anim/src/character/run.rs +++ b/voxygen/anim/src/character/run.rs @@ -175,7 +175,7 @@ impl Animation for RunAnimation { + side * ((footvertsl * 1.5).max(-1.0)), ); next.foot_l.orientation = Quaternion::rotation_x( - (1.0 - sideabs) * (-0.2 + foothoril * -1.3 * speednorm) + sideabs * -0.5, + (1.0 - sideabs) * (-0.2 + foothoril * -0.9 * speednorm) + sideabs * -0.5, ) * Quaternion::rotation_y( tilt * 2.0 + side * 0.3 + side * (foothoril * 0.3), ) * Quaternion::rotation_z(side * 0.2); @@ -190,7 +190,7 @@ impl Animation for RunAnimation { + side * ((footvertsr * -1.5).max(-1.0)), ); next.foot_r.orientation = Quaternion::rotation_x( - (1.0 - sideabs) * (-0.2 + foothorir * -1.3 * speednorm) + sideabs * -0.5, + (1.0 - sideabs) * (-0.2 + foothorir * -0.9 * speednorm) + sideabs * -0.5, ) * Quaternion::rotation_y( tilt * 2.0 + side * 0.3 + side * (foothorir * 0.3), ) * Quaternion::rotation_z(side * 0.2); diff --git a/voxygen/src/scene/figure/mod.rs b/voxygen/src/scene/figure/mod.rs index 88c6146357..a9d645ae5f 100644 --- a/voxygen/src/scene/figure/mod.rs +++ b/voxygen/src/scene/figure/mod.rs @@ -2582,7 +2582,14 @@ impl FigureMgr { // Run (true, true, _) => anim::biped_small::RunAnimation::update_skeleton( &BipedSmallSkeleton::default(), - (vel.0, ori, state.last_ori, time, state.avg_vel), + ( + vel.0, + ori, + state.last_ori, + time, + state.avg_vel, + state.acc_vel, + ), state.state_time, &mut state_animation_rate, skeleton_attr, @@ -2590,7 +2597,14 @@ impl FigureMgr { // Jump (false, _, false) => anim::biped_small::RunAnimation::update_skeleton( &BipedSmallSkeleton::default(), - (vel.0, ori, state.last_ori, time, state.avg_vel), + ( + vel.0, + ori, + state.last_ori, + time, + state.avg_vel, + state.acc_vel, + ), state.state_time, &mut state_animation_rate, skeleton_attr, @@ -2598,14 +2612,28 @@ impl FigureMgr { // Swim (false, _, true) => anim::biped_small::RunAnimation::update_skeleton( &BipedSmallSkeleton::default(), - (vel.0, ori, state.last_ori, time, state.avg_vel), + ( + vel.0, + ori, + state.last_ori, + time, + state.avg_vel, + state.acc_vel, + ), state.state_time, &mut state_animation_rate, skeleton_attr, ), _ => anim::biped_small::RunAnimation::update_skeleton( &BipedSmallSkeleton::default(), - (vel.0, ori, state.last_ori, time, state.avg_vel), + ( + vel.0, + ori, + state.last_ori, + time, + state.avg_vel, + state.acc_vel, + ), state.state_time, &mut state_animation_rate, skeleton_attr,