diff --git a/assets/server/manifests/ship_manifest.ron b/assets/server/manifests/ship_manifest.ron index 817d579120..07151cabda 100644 --- a/assets/server/manifests/ship_manifest.ron +++ b/assets/server/manifests/ship_manifest.ron @@ -4,20 +4,25 @@ //offset: (3.0, 7.0, 1.0), //offset: (-20.75, -34.75, 1.25), //offset: (0.0, 0.0, 0.0), - offset: (-17.5, -35.0, 1.0), + offset: (-17.5, -39.0, 1.0), //phys_offset: (0.25, 0.25, 0.25), phys_offset: (0.0, 0.0, 0.0), central: ("Human_Airship"), ), bone1: ( - offset: (0.0, 40.0, -8.0), + offset: (-8.5, -2.0, -8.5), phys_offset: (0.0, 0.0, 0.0), central: ("propeller-l"), ), bone2: ( - offset: (0.0, 0.0, -4.0), + offset: (-8.5, -2.0, -8.5), phys_offset: (0.0, 0.0, 0.0), central: ("propeller-r"), ), + bone3: ( + offset: (-1.5, -11.0, -5.5), + phys_offset: (0.0, 0.0, 0.0), + central: ("rudder"), + ), ), }) diff --git a/assets/server/voxel/Human_Airship.vox b/assets/server/voxel/Human_Airship.vox index e167e99d3d..d193b7d15f 100644 Binary files a/assets/server/voxel/Human_Airship.vox and b/assets/server/voxel/Human_Airship.vox differ diff --git a/assets/server/voxel/propeller-l.vox b/assets/server/voxel/propeller-l.vox index 2dc7e554e4..d4b2354d97 100644 Binary files a/assets/server/voxel/propeller-l.vox and b/assets/server/voxel/propeller-l.vox differ diff --git a/assets/server/voxel/propeller-r.vox b/assets/server/voxel/propeller-r.vox index 5060173bb6..647eb05281 100644 Binary files a/assets/server/voxel/propeller-r.vox and b/assets/server/voxel/propeller-r.vox differ diff --git a/assets/server/voxel/rudder.vox b/assets/server/voxel/rudder.vox new file mode 100644 index 0000000000..578ce7a5a8 Binary files /dev/null and b/assets/server/voxel/rudder.vox differ diff --git a/common/src/comp/body/ship.rs b/common/src/comp/body/ship.rs index a4a465ccf8..68532b677b 100644 --- a/common/src/comp/body/ship.rs +++ b/common/src/comp/body/ship.rs @@ -58,6 +58,7 @@ pub mod figuredata { pub bone0: ShipCentralSubSpec, pub bone1: ShipCentralSubSpec, pub bone2: ShipCentralSubSpec, + pub bone3: ShipCentralSubSpec, } #[derive(Deserialize)] diff --git a/voxygen/anim/src/character/run.rs b/voxygen/anim/src/character/run.rs index 3a4e350db2..42970f8f98 100644 --- a/voxygen/anim/src/character/run.rs +++ b/voxygen/anim/src/character/run.rs @@ -102,7 +102,6 @@ impl Animation for RunAnimation { } else { 0.0 } * 1.3; - //println!("speednorm {} ",side); let head_look = Vec2::new( (global_time + anim_time / 18.0).floor().mul(7331.0).sin() * 0.2, diff --git a/voxygen/anim/src/ship/idle.rs b/voxygen/anim/src/ship/idle.rs index a8e59d5c56..dc819c8988 100644 --- a/voxygen/anim/src/ship/idle.rs +++ b/voxygen/anim/src/ship/idle.rs @@ -7,7 +7,14 @@ use common::comp::item::ToolKind; pub struct IdleAnimation; impl Animation for IdleAnimation { - type Dependency = (Option, Option, f32); + type Dependency = ( + Option, + Option, + f32, + f32, + Vec3, + Vec3, + ); type Skeleton = ShipSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -17,17 +24,35 @@ impl Animation for IdleAnimation { #[allow(clippy::approx_constant)] // TODO: Pending review in #587 fn update_skeleton_inner( skeleton: &Self::Skeleton, - (_active_tool_kind, _second_tool_kind, _global_time): Self::Dependency, + (_active_tool_kind, _second_tool_kind, _global_time, acc_vel, orientation, last_ori): Self::Dependency, _anim_time: f32, _rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { let mut next = (*skeleton).clone(); - + 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; next.bone0.position = Vec3::new(s_a.bone0.0, s_a.bone0.1, s_a.bone0.2) / 11.0; next.bone1.position = Vec3::new(s_a.bone1.0, s_a.bone1.1, s_a.bone1.2) / 11.0; + next.bone1.orientation = Quaternion::rotation_y(acc_vel * 0.8); + next.bone2.position = Vec3::new(s_a.bone2.0, s_a.bone2.1, s_a.bone2.2) / 11.0; + next.bone2.orientation = Quaternion::rotation_y(-acc_vel * 0.8); + + next.bone3.position = Vec3::new(s_a.bone3.0, s_a.bone3.1, s_a.bone3.2) / 11.0; + next.bone3.orientation = Quaternion::rotation_z(tilt * 25.0); next } } diff --git a/voxygen/anim/src/ship/mod.rs b/voxygen/anim/src/ship/mod.rs index 14316d2ab3..f9c86cf033 100644 --- a/voxygen/anim/src/ship/mod.rs +++ b/voxygen/anim/src/ship/mod.rs @@ -12,13 +12,15 @@ pub type Body = comp::ship::Body; skeleton_impls!(struct ShipSkeleton { + bone0, + bone1, + + bone2, + + bone3, }); impl Skeleton for ShipSkeleton { type Attr = SkeletonAttr; type Body = Body; - const BONE_COUNT: usize = 2; + const BONE_COUNT: usize = 4; #[cfg(feature = "use-dyn-lib")] const COMPUTE_FN: &'static [u8] = b"ship_compute_mats\0"; @@ -32,7 +34,9 @@ impl Skeleton for ShipSkeleton { *(<&mut [_; Self::BONE_COUNT]>::try_from(&mut buf[0..Self::BONE_COUNT]).unwrap()) = [ make_bone(bone0_mat * Mat4::scaling_3d(1.0 / 11.0)), - make_bone(Mat4::::from(self.bone1) * Mat4::scaling_3d(1.0 / 11.0)), /* Decorellated from ori */ + make_bone(bone0_mat * Mat4::::from(self.bone1) * Mat4::scaling_3d(1.0 / 11.0)), /* Decorellated from ori */ + make_bone(bone0_mat * Mat4::::from(self.bone2) * Mat4::scaling_3d(1.0 / 11.0)), /* Decorellated from ori */ + make_bone(bone0_mat * Mat4::::from(self.bone3) * Mat4::scaling_3d(1.0 / 11.0)), /* Decorellated from ori */ ]; Vec3::unit_z() * 0.5 } @@ -41,6 +45,8 @@ impl Skeleton for ShipSkeleton { pub struct SkeletonAttr { bone0: (f32, f32, f32), bone1: (f32, f32, f32), + bone2: (f32, f32, f32), + bone3: (f32, f32, f32), } impl<'a> std::convert::TryFrom<&'a comp::Body> for SkeletonAttr { @@ -58,7 +64,9 @@ impl Default for SkeletonAttr { fn default() -> Self { Self { bone0: (0.0, 0.0, 0.0), - bone1: (0.0, 0.0, 0.0), + bone1: (-13.0, -25.0, 10.0), + bone2: (13.0, -25.0, 10.0), + bone3: (0.0, -27.5, 8.5), } } } diff --git a/voxygen/src/scene/figure/load.rs b/voxygen/src/scene/figure/load.rs index a04e9c5d16..ae677b6127 100644 --- a/voxygen/src/scene/figure/load.rs +++ b/voxygen/src/scene/figure/load.rs @@ -4215,7 +4215,7 @@ impl BodySpec for ship::Body { Some(mesh_ship_bone(map, body, |spec| &spec.bone0)), Some(mesh_ship_bone(map, body, |spec| &spec.bone1)), Some(mesh_ship_bone(map, body, |spec| &spec.bone2)), - None, + Some(mesh_ship_bone(map, body, |spec| &spec.bone3)), None, None, None, diff --git a/voxygen/src/scene/figure/mod.rs b/voxygen/src/scene/figure/mod.rs index fb7d715217..8ca381fc96 100644 --- a/voxygen/src/scene/figure/mod.rs +++ b/voxygen/src/scene/figure/mod.rs @@ -4239,14 +4239,28 @@ impl FigureMgr { // Standing (true, false, false) => anim::ship::IdleAnimation::update_skeleton( &ShipSkeleton::default(), - (active_tool_kind, second_tool_kind, time), + ( + active_tool_kind, + second_tool_kind, + time, + state.acc_vel, + ori * anim::vek::Vec3::::unit_y(), + state.last_ori * anim::vek::Vec3::::unit_y(), + ), state.state_time, &mut state_animation_rate, skeleton_attr, ), _ => anim::ship::IdleAnimation::update_skeleton( &ShipSkeleton::default(), - (active_tool_kind, second_tool_kind, time), + ( + active_tool_kind, + second_tool_kind, + time, + state.acc_vel, + ori * anim::vek::Vec3::::unit_y(), + state.last_ori * anim::vek::Vec3::::unit_y(), + ), state.state_time, &mut state_animation_rate, skeleton_attr,