From d98bfa72ad4225d89e7e27b183ce7ad8daf8ce01 Mon Sep 17 00:00:00 2001 From: Snowram Date: Tue, 17 Nov 2020 22:54:12 +0100 Subject: [PATCH] Improves bipedlarge and theropod anims, balance tweaks --- .../npc_weapons/staff/mindflayer_staff.ron | 2 +- .../voxel/biped_large_central_manifest.ron | 2 +- .../voxel/npc/antelope/male/torso_front.vox | 4 +- .../voxel/npc/horse/male/torso_front.vox | 4 +- .../voxel/npc/kelpie/male/torso_front.vox | 4 +- .../quadruped_medium_central_manifest.ron | 12 +- common/src/comp/agent.rs | 5 + common/src/comp/body.rs | 53 +- voxygen/src/anim/src/biped_large/beam.rs | 16 +- voxygen/src/anim/src/biped_large/equip.rs | 4 +- voxygen/src/anim/src/biped_large/idle.rs | 10 + voxygen/src/anim/src/biped_large/mod.rs | 3 + voxygen/src/anim/src/biped_large/run.rs | 24 + voxygen/src/anim/src/biped_large/shoot.rs | 473 +++++------------- voxygen/src/anim/src/biped_large/wield.rs | 13 +- voxygen/src/anim/src/quadruped_medium/mod.rs | 26 +- voxygen/src/anim/src/theropod/jump.rs | 4 +- voxygen/src/anim/src/theropod/run.rs | 66 ++- voxygen/src/scene/figure/mod.rs | 112 +++-- world/src/lib.rs | 2 + world/src/site/dungeon/mod.rs | 31 +- 21 files changed, 404 insertions(+), 466 deletions(-) diff --git a/assets/common/items/npc_weapons/staff/mindflayer_staff.ron b/assets/common/items/npc_weapons/staff/mindflayer_staff.ron index 7c01ad067f..0e231d0d1e 100644 --- a/assets/common/items/npc_weapons/staff/mindflayer_staff.ron +++ b/assets/common/items/npc_weapons/staff/mindflayer_staff.ron @@ -5,7 +5,7 @@ ItemDef( ( kind: Staff, stats: ( - equip_time_millis: 500, + equip_time_millis: 300, power: 1.00, speed: 1.0, ), diff --git a/assets/voxygen/voxel/biped_large_central_manifest.ron b/assets/voxygen/voxel/biped_large_central_manifest.ron index 1323845e17..1c61fc917d 100644 --- a/assets/voxygen/voxel/biped_large_central_manifest.ron +++ b/assets/voxygen/voxel/biped_large_central_manifest.ron @@ -549,7 +549,7 @@ central: ("npc.mindflayer.male.torso_upper"), ), torso_lower: ( - offset: (-4.5, -6.0, -7.5), + offset: (-12.5, -10.0, -9.0), central: ("npc.mindflayer.male.torso_lower"), ), jaw: ( diff --git a/assets/voxygen/voxel/npc/antelope/male/torso_front.vox b/assets/voxygen/voxel/npc/antelope/male/torso_front.vox index bfeac78769..ff8445ed50 100644 --- a/assets/voxygen/voxel/npc/antelope/male/torso_front.vox +++ b/assets/voxygen/voxel/npc/antelope/male/torso_front.vox @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:819e84f66727cb0ced0ff00a3a230a919f48cc4636eda23230155d99a09fa42f -size 2432 +oid sha256:7f4ad0d599b7cee3a741a3a2f94d9620bcfbfb695e7aa313daf880216143f28a +size 2512 diff --git a/assets/voxygen/voxel/npc/horse/male/torso_front.vox b/assets/voxygen/voxel/npc/horse/male/torso_front.vox index ccd171047e..13723afc29 100644 --- a/assets/voxygen/voxel/npc/horse/male/torso_front.vox +++ b/assets/voxygen/voxel/npc/horse/male/torso_front.vox @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:edd7135e2d79bccb49e5bcab4ba2ad2cf2a12f0d38740002b4437cd5a7fe4361 -size 3808 +oid sha256:b066ee1fb84a613b5cf1d0c8e23bab0e345ccac78b5cbbc231dc05ae453a411a +size 3944 diff --git a/assets/voxygen/voxel/npc/kelpie/male/torso_front.vox b/assets/voxygen/voxel/npc/kelpie/male/torso_front.vox index 124f6de2ef..5a1d0f1666 100644 --- a/assets/voxygen/voxel/npc/kelpie/male/torso_front.vox +++ b/assets/voxygen/voxel/npc/kelpie/male/torso_front.vox @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b56d6a15cf1e44491d465ad62a14a3db385e5790b923eb147c8732540523a10d -size 3976 +oid sha256:c7de1bc5484a6dc334af3e919e37752254ff4761f115e917971fa769b3b4b55f +size 4104 diff --git a/assets/voxygen/voxel/quadruped_medium_central_manifest.ron b/assets/voxygen/voxel/quadruped_medium_central_manifest.ron index bc73744896..563c3ddf41 100644 --- a/assets/voxygen/voxel/quadruped_medium_central_manifest.ron +++ b/assets/voxygen/voxel/quadruped_medium_central_manifest.ron @@ -1037,7 +1037,7 @@ central: ("npc.antelope.male.torso_front"), ), torso_back: ( - offset: (-4.0, -5.5, -3.5), + offset: (-4.0, -11.0, -3.5), central: ("npc.antelope.male.torso_back"), ), ears: ( @@ -1067,7 +1067,7 @@ central: ("npc.antelope.male.torso_front"), ), torso_back: ( - offset: (-4.0, -5.5, -3.5), + offset: (-4.0, -11.0, -3.5), central: ("npc.antelope.male.torso_back"), ), ears: ( @@ -1097,7 +1097,7 @@ central: ("npc.kelpie.male.torso_front"), ), torso_back: ( - offset: (-4.0, -12.0, -4.0), + offset: (-4.0, -10.0, -4.0), central: ("npc.kelpie.male.torso_back"), ), ears: ( @@ -1127,7 +1127,7 @@ central: ("npc.kelpie.male.torso_front"), ), torso_back: ( - offset: (-4.0, -12.0, -4.0), + offset: (-4.0, -10.0, -4.0), central: ("npc.kelpie.male.torso_back"), ), ears: ( @@ -1157,7 +1157,7 @@ central: ("npc.horse.male.torso_front"), ), torso_back: ( - offset: (-4.0, -6.0, -4.5), + offset: (-4.0, -10.0, -4.5), central: ("npc.horse.male.torso_back"), ), ears: ( @@ -1187,7 +1187,7 @@ central: ("npc.horse.male.torso_front"), ), torso_back: ( - offset: (-4.0, -6.0, -4.5), + offset: (-4.0, -10.0, -4.5), central: ("npc.horse.male.torso_back"), ), ears: ( diff --git a/common/src/comp/agent.rs b/common/src/comp/agent.rs index 8fe596ca38..3d4fa82a90 100644 --- a/common/src/comp/agent.rs +++ b/common/src/comp/agent.rs @@ -107,6 +107,11 @@ impl<'a> From<&'a Body> for Psyche { quadruped_medium::Species::Catoblepas => 0.8, quadruped_medium::Species::Deer => 0.6, quadruped_medium::Species::Hirdrasil => 0.7, + quadruped_medium::Species::Donkey => 0.7, + quadruped_medium::Species::Camel => 0.7, + quadruped_medium::Species::Zebra => 0.7, + quadruped_medium::Species::Antelope => 0.6, + quadruped_medium::Species::Horse => 0.8, _ => 1.0, }, Body::QuadrupedLow(quadruped_low) => match quadruped_low.species { diff --git a/common/src/comp/body.rs b/common/src/comp/body.rs index 31c77ecc35..0ec5ea5b3d 100644 --- a/common/src/comp/body.rs +++ b/common/src/comp/body.rs @@ -221,7 +221,7 @@ impl Body { quadruped_low::Species::Maneater => 4.0, _ => 1.3, }, - Body::Theropod(_) => 0.7, + Body::Theropod(_) => 3.0, Body::BirdMedium(body) => match body.species { bird_medium::Species::Cockatrice => 1.8, _ => 1.1, @@ -230,7 +230,12 @@ impl Body { Body::Dragon(_) => 16.0, Body::BirdSmall(_) => 1.1, Body::FishSmall(_) => 0.9, - Body::BipedLarge(_) => 4.6, + Body::BipedLarge(body) => match body.species { + biped_large::Species::Slysaurok => 2.3, + biped_large::Species::Occultsaurok => 2.8, + biped_large::Species::Mightysaurok => 2.3, + _ => 4.6, + }, Body::Golem(_) => 5.8, Body::Object(_) => 1.0, } @@ -274,6 +279,12 @@ impl Body { quadruped_medium::Species::Deer => 300, quadruped_medium::Species::Hirdrasil => 500, quadruped_medium::Species::Roshwalr => 600, + quadruped_medium::Species::Donkey => 500, + quadruped_medium::Species::Camel => 600, + quadruped_medium::Species::Zebra => 500, + quadruped_medium::Species::Antelope => 300, + quadruped_medium::Species::Kelpie => 600, + quadruped_medium::Species::Horse => 600, _ => 400, }, Body::BirdMedium(bird_medium) => match bird_medium.species { @@ -296,11 +307,12 @@ impl Body { biped_large::Species::Wendigo => 2000, biped_large::Species::Troll => 1500, biped_large::Species::Dullahan => 2000, + biped_large::Species::Mindflayer => 1500, _ => 1000, }, Body::Object(_) => 10000, Body::Golem(_) => 2740, - Body::Theropod(_) => 50, + Body::Theropod(_) => 1000, Body::QuadrupedLow(quadruped_low) => match quadruped_low.species { quadruped_low::Species::Crocodile => 600, quadruped_low::Species::Alligator => 600, @@ -311,6 +323,8 @@ impl Body { quadruped_low::Species::Rocksnapper => 1000, quadruped_low::Species::Pangolin => 80, quadruped_low::Species::Maneater => 400, + quadruped_low::Species::Sandshark => 600, + quadruped_low::Species::Hakulaq => 400, _ => 200, }, } @@ -341,9 +355,15 @@ impl Body { quadruped_medium::Species::Mouflon => 30, quadruped_medium::Species::Catoblepas => 50, quadruped_medium::Species::Bonerattler => 30, - quadruped_medium::Species::Deer => 30, + quadruped_medium::Species::Deer => 20, quadruped_medium::Species::Hirdrasil => 30, quadruped_medium::Species::Roshwalr => 40, + quadruped_medium::Species::Donkey => 30, + quadruped_medium::Species::Camel => 30, + quadruped_medium::Species::Zebra => 30, + quadruped_medium::Species::Antelope => 20, + quadruped_medium::Species::Kelpie => 30, + quadruped_medium::Species::Horse => 30, _ => 20, }, Body::BirdMedium(bird_medium) => match bird_medium.species { @@ -366,6 +386,7 @@ impl Body { biped_large::Species::Wendigo => 80, biped_large::Species::Troll => 60, biped_large::Species::Dullahan => 120, + biped_large::Species::Mindflayer => 80, _ => 100, }, Body::Object(_) => 10, @@ -381,6 +402,8 @@ impl Body { quadruped_low::Species::Rocksnapper => 50, quadruped_low::Species::Pangolin => 10, quadruped_low::Species::Maneater => 30, + quadruped_low::Species::Sandshark => 40, + quadruped_low::Species::Hakulaq => 10, _ => 20, }, } @@ -411,9 +434,15 @@ impl Body { quadruped_medium::Species::Mouflon => 7, quadruped_medium::Species::Catoblepas => 10, quadruped_medium::Species::Bonerattler => 10, - quadruped_medium::Species::Deer => 7, - quadruped_medium::Species::Hirdrasil => 10, + quadruped_medium::Species::Deer => 6, + quadruped_medium::Species::Hirdrasil => 9, quadruped_medium::Species::Roshwalr => 10, + quadruped_medium::Species::Donkey => 8, + quadruped_medium::Species::Camel => 8, + quadruped_medium::Species::Zebra => 8, + quadruped_medium::Species::Antelope => 6, + quadruped_medium::Species::Kelpie => 8, + quadruped_medium::Species::Horse => 8, _ => 6, }, Body::BirdMedium(bird_medium) => match bird_medium.species { @@ -434,6 +463,7 @@ impl Body { biped_large::Species::Wendigo => 70, biped_large::Species::Troll => 50, biped_large::Species::Dullahan => 100, + biped_large::Species::Mindflayer => 80, _ => 100, }, Body::Object(_) => 1, @@ -449,6 +479,8 @@ impl Body { quadruped_low::Species::Rocksnapper => 12, quadruped_low::Species::Pangolin => 3, quadruped_low::Species::Maneater => 14, + quadruped_low::Species::Sandshark => 12, + quadruped_low::Species::Hakulaq => 10, _ => 10, }, } @@ -493,6 +525,12 @@ impl Body { quadruped_medium::Species::Deer => 30, quadruped_medium::Species::Hirdrasil => 50, quadruped_medium::Species::Roshwalr => 60, + quadruped_medium::Species::Donkey => 40, + quadruped_medium::Species::Camel => 40, + quadruped_medium::Species::Zebra => 40, + quadruped_medium::Species::Antelope => 6, + quadruped_medium::Species::Kelpie => 60, + quadruped_medium::Species::Horse => 50, _ => 40, }, Body::BirdMedium(bird_medium) => match bird_medium.species { @@ -515,6 +553,7 @@ impl Body { biped_large::Species::Wendigo => 60, biped_large::Species::Troll => 60, biped_large::Species::Dullahan => 80, + biped_large::Species::Mindflayer => 50, _ => 60, }, Body::Object(_) => 0, @@ -530,6 +569,8 @@ impl Body { quadruped_low::Species::Rocksnapper => 80, quadruped_low::Species::Pangolin => 10, quadruped_low::Species::Maneater => 40, + quadruped_low::Species::Sandshark => 60, + quadruped_low::Species::Hakulaq => 40, _ => 20, }, } diff --git a/voxygen/src/anim/src/biped_large/beam.rs b/voxygen/src/anim/src/biped_large/beam.rs index 38319a44bb..0fa4a173f3 100644 --- a/voxygen/src/anim/src/biped_large/beam.rs +++ b/voxygen/src/anim/src/biped_large/beam.rs @@ -61,7 +61,7 @@ impl Animation for BeamAnimation { s_a.stc.2 + (movement1 * 16.0) * (1.0 - movement3), ); next.control.orientation = - Quaternion::rotation_x(s_a.stc.3 + (movement1 * -1.2) * (1.0 - movement3)) + Quaternion::rotation_x(s_a.stc.3 + (movement1 * -0.8) * (1.0 - movement3)) * Quaternion::rotation_y( s_a.stc.4 + (movement1 * -1.4 + (movement2 * 16.0).sin() * 0.07) @@ -75,7 +75,7 @@ impl Animation for BeamAnimation { next.hand_l.position = Vec3::new( 0.0 + (movement1 * -1.0 + (movement2 * 8.0).sin() * 3.5) * (1.0 - movement3), - 0.0 + (movement1 * -5.0 + 0.0 + (movement1 * -8.0 + (movement2 * 8.0).sin() * -2.0 + (movement2 * 16.0).sin() * -1.5) * (1.0 - movement3), @@ -90,6 +90,18 @@ impl Animation for BeamAnimation { ) * Quaternion::rotation_z((movement1 * -2.8) * (1.0 - movement3)); + next.shoulder_l.orientation = Quaternion::rotation_z(0.2) + * Quaternion::rotation_x( + (movement1 * 0.6 + (movement2 * 8.0 + PI / 2.0).sin() * -0.1) + * (1.0 - movement3), + ); + + next.shoulder_r.orientation = Quaternion::rotation_z(-0.2) + * Quaternion::rotation_x( + (movement1 * 1.1 + (movement2 * 8.0 + PI / 2.0).sin() * -0.1) + * (1.0 - movement3), + ); + if velocity < 0.5 { next.head.orientation = Quaternion::rotation_z(movement1 * -0.5 + (movement2 * 16.0).sin() * 0.05); diff --git a/voxygen/src/anim/src/biped_large/equip.rs b/voxygen/src/anim/src/biped_large/equip.rs index dd063cb044..8dbd2bac71 100644 --- a/voxygen/src/anim/src/biped_large/equip.rs +++ b/voxygen/src/anim/src/biped_large/equip.rs @@ -54,8 +54,8 @@ impl Animation for EquipAnimation { Quaternion::rotation_y(2.2) * Quaternion::rotation_z(-1.57); }, Some(ToolKind::Bow) => { - next.hand_l.position = Vec3::new(-3.0, -5.0, 9.0); - next.hand_r.position = Vec3::new(-1.75, -4.5, 7.0); + next.hand_l.position = Vec3::new(-9.0, -5.0, -8.0); + next.hand_r.position = Vec3::new(-7.75, -4.5, -10.0); }, _ => {}, } diff --git a/voxygen/src/anim/src/biped_large/idle.rs b/voxygen/src/anim/src/biped_large/idle.rs index 2526f0ed12..b8421f944c 100644 --- a/voxygen/src/anim/src/biped_large/idle.rs +++ b/voxygen/src/anim/src/biped_large/idle.rs @@ -133,6 +133,16 @@ impl Animation for IdleAnimation { next.torso.position = Vec3::new(0.0, 0.0, 0.0) / 8.0; + if s_a.float { + next.upper_torso.position = Vec3::new( + 0.0, + s_a.upper_torso.0, + s_a.upper_torso.1 + slower * 1.0 + 4.0, + ); + next.foot_l.orientation = Quaternion::rotation_x(-0.5 + slow * 0.1); + next.foot_r.orientation = Quaternion::rotation_x(-0.5 + slow * 0.1); + } + next } } diff --git a/voxygen/src/anim/src/biped_large/mod.rs b/voxygen/src/anim/src/biped_large/mod.rs index 9c335e059a..a097139895 100644 --- a/voxygen/src/anim/src/biped_large/mod.rs +++ b/voxygen/src/anim/src/biped_large/mod.rs @@ -134,6 +134,7 @@ pub struct SkeletonAttr { bhr: (f32, f32, f32, f32, f32, f32), bc: (f32, f32, f32, f32, f32, f32), beast: bool, + float: bool, } impl<'a> std::convert::TryFrom<&'a comp::Body> for SkeletonAttr { @@ -172,6 +173,7 @@ impl Default for SkeletonAttr { bhr: (0.0, 0.0, 0.0, 0.0, 0.0, 0.0), bc: (0.0, 0.0, 0.0, 0.0, 0.0, 0.0), beast: false, + float: false, } } } @@ -354,6 +356,7 @@ impl<'a> From<&'a Body> for SkeletonAttr { (_, _) => (-7.0, 3.0, -8.0, 0.0, 0.0, 0.0), }, beast: matches!((body.species, body.body_type), (Werewolf, _)), + float: matches!((body.species, body.body_type), (Mindflayer, _)), } } } diff --git a/voxygen/src/anim/src/biped_large/run.rs b/voxygen/src/anim/src/biped_large/run.rs index 8ca0796598..f49e3f61e6 100644 --- a/voxygen/src/anim/src/biped_large/run.rs +++ b/voxygen/src/anim/src/biped_large/run.rs @@ -128,6 +128,8 @@ impl Animation for RunAnimation { (anim_time as f32 * (16.0) * lab as f32 * speedmult + 1.57 + canceler * 0.05 + shift4) .sin(); //0.7 // + let _slower = (anim_time as f32 * 1.0 + PI).sin(); + let slow = (anim_time as f32 * 3.5 + PI).sin(); let ori: Vec2 = Vec2::from(orientation); let last_ori = Vec2::from(last_ori); @@ -387,6 +389,28 @@ impl Animation for RunAnimation { next.torso.position = Vec3::new(0.0, 0.0, 0.0) / 8.0; next.torso.orientation = Quaternion::rotation_x(-0.25); } + + if s_a.float { + next.head.orientation = Quaternion::rotation_x(slow * 0.1); + next.upper_torso.position = + Vec3::new(0.0, s_a.upper_torso.0, s_a.upper_torso.1 + slow * 2.0 + 4.0); + next.upper_torso.orientation = Quaternion::rotation_x(-0.1 + slow * 0.05); + next.lower_torso.orientation = + Quaternion::rotation_z(short * 0.05) * Quaternion::rotation_x(0.14); + next.shoulder_l.position = Vec3::new(-s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2); + next.shoulder_l.orientation = Quaternion::rotation_x(-0.4 + slow * 0.1); + next.shoulder_r.position = Vec3::new(s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2); + next.shoulder_r.orientation = Quaternion::rotation_x(-0.4 + slow * 0.1); + next.hand_l.position = Vec3::new(-s_a.hand.0, s_a.hand.1, s_a.hand.2); + next.hand_l.orientation = Quaternion::rotation_x(-0.4 + slow * 0.1); + next.hand_r.position = Vec3::new(s_a.hand.0, s_a.hand.1, s_a.hand.2); + next.hand_r.orientation = Quaternion::rotation_x(-0.4 + slow * 0.1); + next.foot_l.position = Vec3::new(-s_a.foot.0, s_a.foot.1, s_a.foot.2); + next.foot_l.orientation = Quaternion::rotation_x(-0.5 + slow * 0.1); + next.foot_r.position = Vec3::new(s_a.foot.0, s_a.foot.1, s_a.foot.2); + next.foot_r.orientation = Quaternion::rotation_x(-0.5 + slow * 0.1); + } + next } } diff --git a/voxygen/src/anim/src/biped_large/shoot.rs b/voxygen/src/anim/src/biped_large/shoot.rs index 714f82bc82..19b63eadc4 100644 --- a/voxygen/src/anim/src/biped_large/shoot.rs +++ b/voxygen/src/anim/src/biped_large/shoot.rs @@ -2,390 +2,185 @@ use super::{ super::{vek::*, Animation}, BipedLargeSkeleton, SkeletonAttr, }; -use common::comp::item::ToolKind; +use common::{comp::item::ToolKind, states::utils::StageSection}; +use std::f32::consts::PI; pub struct ShootAnimation; +type ShootAnimationDependency = ( + Option, + Option, + f32, + Vec3, + Vec3, + f64, + Option, +); impl Animation for ShootAnimation { - type Dependency = (Option, Option, f32, f64); + type Dependency = ShootAnimationDependency; type Skeleton = BipedLargeSkeleton; #[cfg(feature = "use-dyn-lib")] const UPDATE_FN: &'static [u8] = b"biped_large_shoot\0"; #[cfg_attr(feature = "be-dyn-lib", export_name = "biped_large_shoot")] - /* fn update_skeleton_inner( - skeleton: &Self::Skeleton, - (active_tool_kind, _second_tool_kind, velocity, global_time): Self::Dependency, - anim_time: f64, - _rate: &mut f32, - s_a: &SkeletonAttr, - ) -> Self::Skeleton { - let mut next = (*skeleton).clone(); - - let lab = 0.55; - let breathe = (anim_time as f32 + 1.5 * PI).sin(); - let test = (anim_time as f32 + 36.0 * PI).sin(); - - let slower = (anim_time as f32 * 1.0 + PI).sin(); - let slow = (anim_time as f32 * 3.5 + PI).sin(); - - let exp = ((anim_time as f32).powf(0.3 as f32)).min(1.2); - - 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 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 foothoril = (((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 foothorir = (((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 footvertl = (anim_time as f32 * 16.0 * lab as f32).sin(); - let footvertr = (anim_time as f32 * 16.0 * lab as f32 + PI).sin(); - - let footrotl = (((5.0) - / (2.5 - + (2.5) - * ((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 = (((5.0) - / (1.0 - + (4.0) - * ((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 short = (anim_time as f32 * lab as f32 * 16.0).sin(); - let shortalt = (anim_time as f32 * lab as f32 * 16.0 + PI / 2.0).sin(); - - if velocity < 0.5 { - next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1 + breathe * 0.2) * 1.02; - next.head.orientation = - Quaternion::rotation_z(look.x * 0.6) * Quaternion::rotation_x(look.y * 0.6); - - next.upper_torso.position = - Vec3::new(0.0, s_a.upper_torso.0, s_a.upper_torso.1 + breathe * 0.5); - next.upper_torso.orientation = - Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - - next.lower_torso.position = - Vec3::new(0.0, s_a.lower_torso.0, s_a.lower_torso.1 + breathe * 0.15); - next.lower_torso.orientation = - Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - - next.jaw.position = Vec3::new(0.0, s_a.jaw.0 - slower * 0.12, s_a.jaw.1 + slow * 0.2); - next.jaw.orientation = Quaternion::rotation_x(slow * 0.05); - - next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1); - next.tail.orientation = - Quaternion::rotation_z(0.0 + slow * 0.2 + tailmove.x) * Quaternion::rotation_x(0.0); - - next.shoulder_l.position = Vec3::new(-s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2); - next.shoulder_l.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - - next.shoulder_r.position = Vec3::new(s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2); - next.shoulder_r.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0); - - next.leg_l.position = - Vec3::new(-s_a.leg.0, s_a.leg.1, s_a.leg.2 + breathe * 0.2) * 1.02; - next.leg_l.orientation = Quaternion::rotation_z(0.0); - - next.leg_r.position = Vec3::new(s_a.leg.0, s_a.leg.1, s_a.leg.2 + breathe * 0.2) * 1.02; - next.leg_r.orientation = Quaternion::rotation_z(0.0); - - next.foot_l.position = Vec3::new(-s_a.foot.0, s_a.foot.1, s_a.foot.2); - next.foot_l.orientation = Quaternion::rotation_z(0.0); - - next.foot_r.position = Vec3::new(s_a.foot.0, s_a.foot.1, s_a.foot.2); - next.foot_r.orientation = Quaternion::rotation_z(0.0); - - next.torso.position = Vec3::new(0.0, 0.0, 0.0) / 8.0; - next.torso.orientation = Quaternion::rotation_z(test * 0.0); - - next.control.position = Vec3::new(7.0, 9.0, -10.0); - next.control.orientation = Quaternion::rotation_x(test * 0.02) - * Quaternion::rotation_y(test * 0.02) - * Quaternion::rotation_z(test * 0.02); - } else { - next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1) * 1.02; - next.head.orientation = - Quaternion::rotation_z(short * -0.18) * Quaternion::rotation_x(-0.05); - - next.upper_torso.position = - Vec3::new(0.0, s_a.upper_torso.0, s_a.upper_torso.1 + shortalt * -1.5); - next.upper_torso.orientation = Quaternion::rotation_z(short * 0.18); - - next.lower_torso.position = Vec3::new(0.0, s_a.lower_torso.0, s_a.lower_torso.1); - next.lower_torso.orientation = - Quaternion::rotation_z(short * 0.15) * Quaternion::rotation_x(0.14); - - next.jaw.position = Vec3::new(0.0, s_a.jaw.0 - slower * 0.12, s_a.jaw.1 + slow * 0.2); - next.jaw.orientation = Quaternion::rotation_x(slow * 0.05); - - next.tail.orientation = - Quaternion::rotation_z(0.0 + slow * 0.2 + tailmove.x) * Quaternion::rotation_x(0.0); - - next.shoulder_l.position = Vec3::new( - -s_a.shoulder.0, - s_a.shoulder.1 + foothoril * -1.0, - s_a.shoulder.2, - ); - next.shoulder_l.orientation = Quaternion::rotation_x(0.5 + footrotl * -0.16) - * Quaternion::rotation_y(0.1) - * Quaternion::rotation_z(footrotl * 0.1); - - next.shoulder_r.position = Vec3::new( - s_a.shoulder.0, - s_a.shoulder.1 + foothorir * -1.0, - s_a.shoulder.2, - ); - next.shoulder_r.orientation = Quaternion::rotation_x(0.5 + footrotr * -0.16) - * Quaternion::rotation_y(-0.1) - * Quaternion::rotation_z(footrotr * -0.1); - - next.torso.position = Vec3::new(0.0, 0.0, 0.0) / 8.0; - next.torso.orientation = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(-0.25); - - next.leg_l.orientation = - Quaternion::rotation_z(short * 0.18) * Quaternion::rotation_x(foothoril * 0.3); - - next.leg_r.orientation = - Quaternion::rotation_z(short * 0.18) * Quaternion::rotation_x(foothorir * 0.3); - - next.foot_l.position = Vec3::new( - -s_a.foot.0, - 4.0 + s_a.foot.1 + foothoril * 8.5, - s_a.foot.2 + ((footvertl * 6.5).max(0.0)), - ); - next.foot_l.orientation = Quaternion::rotation_x(-0.5 + footrotl * 0.85); - - next.foot_r.position = Vec3::new( - s_a.foot.0, - 4.0 + s_a.foot.1 + foothorir * 8.5, - s_a.foot.2 + ((footvertr * 6.5).max(0.0)), - ); - next.foot_r.orientation = Quaternion::rotation_x(-0.5 + footrotr * 0.85); - } - match active_tool_kind { - Some(ToolKind::Bow(_)) => { - next.hand_l.position = - Vec3::new(-10.0 - exp * 2.0, -4.0 - exp * 4.0, -1.0 + exp * 6.0); - next.hand_l.orientation = Quaternion::rotation_x(1.20) - * Quaternion::rotation_y(-0.6 + exp * 0.8) - * Quaternion::rotation_z(-0.3 + exp * 0.9); - - next.hand_r.position = Vec3::new(4.9, 3.0, -4.0); - next.hand_r.orientation = Quaternion::rotation_x(1.20) - * Quaternion::rotation_y(-0.6) - * Quaternion::rotation_z(-0.3); - - next.shoulder_l.position = Vec3::new( - -s_a.shoulder.0, - s_a.shoulder.1 + foothoril * -1.0, - s_a.shoulder.2, - ); - next.shoulder_l.orientation = Quaternion::rotation_x(1.4 + footrotl * -0.06) - * Quaternion::rotation_y(-0.9) - * Quaternion::rotation_z(footrotl * -0.05); - - next.shoulder_r.position = Vec3::new( - s_a.shoulder.0, - s_a.shoulder.1 + foothorir * -1.0, - s_a.shoulder.2, - ); - next.shoulder_r.orientation = Quaternion::rotation_x(1.8 + footrotr * -0.06) - * Quaternion::rotation_y(-0.5) //1.9 - * Quaternion::rotation_z(footrotr * -0.05); - - next.jaw.position = Vec3::new(0.0, s_a.jaw.0, s_a.jaw.1); - next.jaw.orientation = Quaternion::rotation_x(-0.2); - - next.main.position = Vec3::new(7.0, 5.0, -13.0); - next.main.orientation = Quaternion::rotation_x(-0.3) - * Quaternion::rotation_y(0.3) - * Quaternion::rotation_z(-0.6); - - next.control.position = Vec3::new(6.0, 6.0, 8.0); - next.control.orientation = Quaternion::rotation_x(exp * 0.4); - }, - Some(ToolKind::Staff(_)) => { - next.hand_l.position = Vec3::new(11.0, 5.0, -4.0); - next.hand_l.orientation = - Quaternion::rotation_x(1.27) * Quaternion::rotation_y(0.0); - - next.hand_r.position = Vec3::new(12.0, 5.5, 2.0); - next.hand_r.orientation = - Quaternion::rotation_x(1.57) * Quaternion::rotation_y(0.2); - - next.jaw.position = Vec3::new(0.0, s_a.jaw.0, s_a.jaw.1); - - next.shoulder_l.position = - Vec3::new(-s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2); - next.shoulder_l.orientation = - Quaternion::rotation_z(0.0) * Quaternion::rotation_x(2.0); - - next.shoulder_r.position = - Vec3::new(s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2); - next.shoulder_r.orientation = - Quaternion::rotation_z(0.4) * Quaternion::rotation_x(2.0); - - next.jaw.orientation = Quaternion::rotation_x(-0.2); - - next.main.position = Vec3::new(10.0, 12.5, 13.2); - next.main.orientation = Quaternion::rotation_y(PI); - - next.control.position = Vec3::new(-7.0, 6.0, 6.0 - exp * 5.0); - next.control.orientation = - Quaternion::rotation_x(exp * 1.3) * Quaternion::rotation_z(exp * 1.5); - }, - _ => {}, - } - - next - } - } - */ fn update_skeleton_inner( skeleton: &Self::Skeleton, - (active_tool_kind, _second_tool_kind, velocity, _global_time): Self::Dependency, + ( + active_tool_kind, + _second_tool_kind, + velocity, + orientation, + last_ori, + _global_time, + stage_section, + ): Self::Dependency, anim_time: f64, rate: &mut f32, s_a: &SkeletonAttr, ) -> Self::Skeleton { *rate = 1.0; + let speed = Vec2::::from(velocity).magnitude(); let mut next = (*skeleton).clone(); let lab = 1.0; - let foot = (((5.0) - / (0.2 + 4.8 * ((anim_time as f32 * lab as f32 * 8.0).sin()).powf(2.0 as f32))) - .sqrt()) - * ((anim_time as f32 * lab as f32 * 8.0).sin()); - let foote = (((5.0) - / (0.5 + 4.5 * ((anim_time as f32 * lab as f32 * 8.0 + 1.57).sin()).powf(2.0 as f32))) - .sqrt()) - * ((anim_time as f32 * lab as f32 * 8.0).sin()); + 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; - let exp = ((anim_time as f32).powf(0.3 as f32)).min(1.2); - - next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1); - next.head.orientation = Quaternion::rotation_z(exp * -0.4) - * Quaternion::rotation_x(0.0) - * Quaternion::rotation_y(exp * 0.1); - - next.upper_torso.position = - Vec3::new(0.0, s_a.upper_torso.0 - exp * 1.5, s_a.upper_torso.1); - next.upper_torso.orientation = Quaternion::rotation_z(0.4 + exp * 1.0) - * Quaternion::rotation_x(0.0 + exp * 0.2) - * Quaternion::rotation_y(exp * -0.08); - - next.lower_torso.position = - Vec3::new(0.0, s_a.lower_torso.0 + exp * 1.0, s_a.lower_torso.1); - next.lower_torso.orientation = next.upper_torso.orientation * -0.08; + next.jaw.position = Vec3::new(0.0, s_a.jaw.0, s_a.jaw.1); + next.jaw.orientation = Quaternion::rotation_x(0.0); match active_tool_kind { Some(ToolKind::Staff) | Some(ToolKind::Sceptre) => { + let (movement1, movement2, movement3) = match stage_section { + Some(StageSection::Buildup) => (anim_time as f32, 0.0, 0.0), + Some(StageSection::Swing) => (1.0, (anim_time as f32).powf(0.25), 0.0), + Some(StageSection::Recover) => (1.0, 1.0, anim_time as f32), + _ => (0.0, 0.0, 0.0), + }; + let xmove = (movement1 as f32 * 6.0 * lab as f32 + PI).sin(); + let ymove = (movement1 as f32 * 6.0 * lab as f32 + PI * (0.5)).sin(); next.hand_l.position = Vec3::new(s_a.sthl.0, s_a.sthl.1, s_a.sthl.2); next.hand_l.orientation = Quaternion::rotation_x(s_a.sthl.3); next.hand_r.position = Vec3::new(s_a.sthr.0, s_a.sthr.1, s_a.sthr.2); next.hand_r.orientation = Quaternion::rotation_x(s_a.sthr.3) * Quaternion::rotation_y(s_a.sthr.4); + next.shoulder_l.orientation = Quaternion::rotation_z(0.2) + * Quaternion::rotation_x( + (movement1 * (movement2 * 8.0 + PI / 2.0).sin() * -0.1) * (1.0 - movement3), + ); + next.shoulder_r.orientation = Quaternion::rotation_z(-0.2) + * Quaternion::rotation_x( + 1.0 + movement1 * (movement2 * 8.0 + PI / 2.0).sin() * -0.1, + ); next.main.position = Vec3::new(0.0, 0.0, 0.0); next.main.orientation = Quaternion::rotation_y(0.0); next.control.position = Vec3::new( - s_a.stc.0, - s_a.stc.1 + exp * 5.0, - 10.0 + s_a.stc.2 - exp * 5.0, + s_a.stc.0 + (xmove * 3.0 + movement1 * -4.0) * (1.0 - movement3), + s_a.stc.1 + (2.0 + ymove * 3.0 + movement2 * 3.0) * (1.0 - movement3), + s_a.stc.2, ); - next.control.orientation = Quaternion::rotation_x(s_a.stc.3 + exp * 0.4) - * Quaternion::rotation_y(s_a.stc.4) - * Quaternion::rotation_z(s_a.stc.5 + exp * 1.5); + next.control.orientation = + Quaternion::rotation_x(s_a.stc.3 + (movement2 * 0.6) * (1.0 - movement3)) + * Quaternion::rotation_y(s_a.stc.4 + (movement1 * 0.5 + movement2 * -0.5)) + * Quaternion::rotation_z( + s_a.stc.5 + - (0.2 + movement1 * -0.5 + movement2 * 0.8) * (1.0 - movement3), + ); + next.upper_torso.orientation = + Quaternion::rotation_z((movement1 * 0.3 + movement2 * 0.2) * (1.0 - movement3)); + next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1); + next.head.orientation = Quaternion::rotation_z( + tilt * -2.5 + (movement1 * -0.2 + movement2 * -0.4) * (1.0 - movement3), + ); + + if speed < 0.5 { + next.lower_torso.orientation = + Quaternion::rotation_x(0.08) * Quaternion::rotation_z(0.0); + + next.foot_l.position = Vec3::new(-s_a.foot.0, s_a.foot.1 - 5.0, s_a.foot.2); + next.foot_l.orientation = Quaternion::rotation_x(-0.5); + + next.foot_r.position = Vec3::new(s_a.foot.0, s_a.foot.1 + 3.0, s_a.foot.2); + next.foot_r.orientation = + Quaternion::rotation_x(0.5) * Quaternion::rotation_z(0.3); + } else { + }; }, Some(ToolKind::Bow) => { - next.hand_l.position = Vec3::new( - s_a.bhl.0 - exp * 2.0, - s_a.bhl.1 - exp * 4.0, - s_a.bhl.2 + exp * 6.0, - ); - next.hand_l.orientation = Quaternion::rotation_x(s_a.bhl.3) - * Quaternion::rotation_y(s_a.bhl.4 + exp * 0.8) - * Quaternion::rotation_z(s_a.bhl.5 + exp * 0.9); - next.hand_r.position = Vec3::new(s_a.bhr.0, s_a.bhr.1, s_a.bhr.2); - next.hand_r.orientation = Quaternion::rotation_x(s_a.bhl.3) - * Quaternion::rotation_y(s_a.bhr.4) - * Quaternion::rotation_z(s_a.bhr.5); + let (movement1, movement2, movement3) = match stage_section { + Some(StageSection::Buildup) => ((anim_time as f32).powf(0.25), 0.0, 0.0), + Some(StageSection::Swing) => (1.0, anim_time as f32, 0.0), + Some(StageSection::Recover) => (1.0, 1.0, (anim_time as f32).powf(4.0)), + _ => (0.0, 0.0, 0.0), + }; next.main.position = Vec3::new(0.0, 0.0, 0.0); next.main.orientation = Quaternion::rotation_x(0.0); + next.hand_l.position = Vec3::new( + s_a.bhl.0 + movement2 * -2.0, + s_a.bhl.1 + movement2 * -12.0, + s_a.bhl.2 + movement2 * -3.0, + ); + next.hand_l.orientation = Quaternion::rotation_x(s_a.bhl.3); + next.hand_r.position = Vec3::new(s_a.bhr.0, s_a.bhr.1, s_a.bhr.2); + next.hand_r.orientation = Quaternion::rotation_x(s_a.bhr.3); + next.shoulder_l.orientation = Quaternion::rotation_z(0.2) + * Quaternion::rotation_x( + (movement1 * (movement2 * 8.0 + PI / 2.0).sin() * 1.1) * (1.0 - movement3), + ); - next.control.position = Vec3::new(s_a.bc.0, s_a.bc.1, 4.0 + s_a.bc.2); - next.control.orientation = Quaternion::rotation_x(s_a.bc.3 + exp * 0.4); + next.shoulder_r.orientation = Quaternion::rotation_z(-0.2) + * Quaternion::rotation_x( + 1.5 + movement1 * (movement2 * 8.0 + PI / 2.0).sin() * -0.1, + ); + next.hold.position = + Vec3::new(0.0, -1.0 + movement2 * 2.0, -5.2 + movement2 * -3.0); + next.hold.orientation = Quaternion::rotation_x(-1.57); + next.hold.scale = Vec3::one() * 1.0 * (1.0 - movement2); + + next.control.position = Vec3::new(s_a.bc.0 + 11.0, s_a.bc.1 + 2.0, s_a.bc.2 + 8.0); + next.control.orientation = + Quaternion::rotation_x(0.0 + (movement2 as f32 * 0.1).sin()) + * Quaternion::rotation_y(s_a.bc.4 - 1.25) + * Quaternion::rotation_z(s_a.bc.5 - 0.2 + (movement2 as f32 * -0.2).sin()); + next.upper_torso.orientation = Quaternion::rotation_z(0.8); + next.head.position = Vec3::new(0.0 - 2.0, s_a.head.0, s_a.head.1); + + next.head.orientation = + Quaternion::rotation_z(tilt * -2.5 - 0.5 + (movement2 as f32 * 0.2).sin()); + if speed < 0.5 { + next.upper_torso.orientation = + Quaternion::rotation_z(0.8 + (movement2 as f32 * 0.1).sin()); + + next.lower_torso.orientation = Quaternion::rotation_x(0.08) + * Quaternion::rotation_z((movement2 as f32 * -0.15).sin()); + + next.foot_l.position = Vec3::new(-s_a.foot.0, s_a.foot.1 - 5.0, s_a.foot.2); + next.foot_l.orientation = Quaternion::rotation_x(-0.5); + + next.foot_r.position = Vec3::new(s_a.foot.0, s_a.foot.1 + 3.0, s_a.foot.2); + next.foot_r.orientation = + Quaternion::rotation_x(0.5) * Quaternion::rotation_z(0.3); + } else { + }; }, _ => {}, } - if velocity > 0.5 { - next.foot_l.position = Vec3::new( - -s_a.foot.0 - foot * 1.0 + exp * -1.0, - foote * 0.8 + exp * 1.5, - s_a.foot.2, - ); - next.foot_l.orientation = Quaternion::rotation_x(exp * 0.5) - * Quaternion::rotation_z(exp * 0.4) - * Quaternion::rotation_y(0.15); - - next.foot_r.position = Vec3::new( - s_a.foot.0 + foot * 1.0 + exp * 1.0, - foote * -0.8 + exp * -1.0, - s_a.foot.2, - ); - next.foot_r.orientation = Quaternion::rotation_x(exp * -0.5) - * Quaternion::rotation_z(exp * 0.4) - * Quaternion::rotation_y(0.0); - next.torso.orientation = Quaternion::rotation_x(-0.15); - } else { - next.foot_l.position = Vec3::new(-s_a.foot.0, -2.5, s_a.foot.2 + exp * 2.5); - next.foot_l.orientation = - Quaternion::rotation_x(exp * -0.2 - 0.2) * Quaternion::rotation_z(exp * 1.0); - - next.foot_r.position = Vec3::new(s_a.foot.0, 3.5 - exp * 2.0, s_a.foot.2); - next.foot_r.orientation = - Quaternion::rotation_x(exp * 0.1) * Quaternion::rotation_z(exp * 0.5); - } next } diff --git a/voxygen/src/anim/src/biped_large/wield.rs b/voxygen/src/anim/src/biped_large/wield.rs index bd77702bb5..4f898ea49b 100644 --- a/voxygen/src/anim/src/biped_large/wield.rs +++ b/voxygen/src/anim/src/biped_large/wield.rs @@ -238,7 +238,7 @@ impl Animation for WieldAnimation { next.hold.orientation = Quaternion::rotation_x(-1.57); next.hold.scale = Vec3::one() * 1.0; - next.control.position = Vec3::new(s_a.bc.0, s_a.bc.1, s_a.bc.2); + next.control.position = Vec3::new(s_a.bc.0, s_a.bc.1, s_a.bc.2 - 5.0); next.control.orientation = Quaternion::rotation_x(u_slow * 0.06) * Quaternion::rotation_y(s_a.bc.4) * Quaternion::rotation_z(s_a.bc.5 + u_slowalt * 0.1); @@ -436,6 +436,17 @@ impl Animation for WieldAnimation { _ => {}, } }; + + if s_a.float { + next.upper_torso.position = Vec3::new( + 0.0, + s_a.upper_torso.0, + s_a.upper_torso.1 + slower * 1.0 + 4.0, + ); + next.foot_l.orientation = Quaternion::rotation_x(-0.5 + slow * 0.1); + next.foot_r.orientation = Quaternion::rotation_x(-0.5 + slow * 0.1); + } + next } } diff --git a/voxygen/src/anim/src/quadruped_medium/mod.rs b/voxygen/src/anim/src/quadruped_medium/mod.rs index 582d6aa403..c96b5511d6 100644 --- a/voxygen/src/anim/src/quadruped_medium/mod.rs +++ b/voxygen/src/anim/src/quadruped_medium/mod.rs @@ -220,9 +220,9 @@ impl<'a> From<&'a Body> for SkeletonAttr { (Donkey, _) => (-11.0, 1.5), (Camel, _) => (-14.0, -1.0), (Zebra, _) => (-10.0, 1.5), - (Antelope, _) => (-4.5, 2.0), - (Kelpie, _) => (-11.0, 3.0), - (Horse, _) => (-5.0, 1.5), + (Antelope, _) => (-10.0, 2.0), + (Kelpie, _) => (-9.0, 3.0), + (Horse, _) => (-9.0, 1.5), }, torso_front: match (body.species, body.body_type) { (Grolgar, _) => (10.0, 13.0), @@ -264,9 +264,9 @@ impl<'a> From<&'a Body> for SkeletonAttr { (Donkey, _) => (-6.0, -1.0), (Camel, _) => (-12.0, -0.5), (Zebra, _) => (-6.0, -1.0), - (Antelope, _) => (-12.5, 0.0), - (Kelpie, _) => (-6.0, -1.0), - (Horse, _) => (-11.0, -1.5), + (Antelope, _) => (-7.0, 0.0), + (Kelpie, _) => (-8.0, -1.0), + (Horse, _) => (-8.0, -1.5), }, ears: match (body.species, body.body_type) { (Grolgar, _) => (5.0, 8.0), @@ -330,9 +330,9 @@ impl<'a> From<&'a Body> for SkeletonAttr { (Donkey, _) => (4.0, -9.0, -3.0), (Camel, _) => (4.5, -10.5, -5.0), (Zebra, _) => (3.5, -8.0, -3.5), - (Antelope, _) => (3.5, -2.0, -3.5), - (Kelpie, _) => (3.5, -9.0, -2.5), - (Horse, _) => (3.5, -4.0, -2.0), + (Antelope, _) => (3.5, -7.5, -3.5), + (Kelpie, _) => (3.5, -7.0, -2.5), + (Horse, _) => (3.5, -7.0, -2.0), }, feet_f: match (body.species, body.body_type) { (Grolgar, _) => (0.0, 0.0, -4.0), @@ -472,10 +472,10 @@ impl<'a> From<&'a Body> for SkeletonAttr { (Mouflon, _) => (true, 1.0), (Deer, _) => (true, 1.0), (Hirdrasil, _) => (true, 0.9), - (Donkey, _) => (true, 1.0), - (Zebra, _) => (true, 1.0), - (Antelope, _) => (true, 0.9), - (Kelpie, _) => (true, 1.0), + (Donkey, _) => (false, 1.0), + (Zebra, _) => (false, 1.0), + (Antelope, _) => (false, 0.9), + (Kelpie, _) => (false, 1.0), (Horse, _) => (true, 0.85), (_, _) => (false, 0.0), }, diff --git a/voxygen/src/anim/src/theropod/jump.rs b/voxygen/src/anim/src/theropod/jump.rs index 1c32684d86..cd37180b7b 100644 --- a/voxygen/src/anim/src/theropod/jump.rs +++ b/voxygen/src/anim/src/theropod/jump.rs @@ -5,7 +5,7 @@ use super::super::vek::*; pub struct JumpAnimation; impl Animation for JumpAnimation { - type Dependency = (f32, f64); + type Dependency = (f32, Vec3, Vec3, f64, Vec3); type Skeleton = TheropodSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -14,7 +14,7 @@ impl Animation for JumpAnimation { #[cfg_attr(feature = "be-dyn-lib", export_name = "theropod_jump")] fn update_skeleton_inner( skeleton: &Self::Skeleton, - _global_time: Self::Dependency, + (_velocity, _orientation, _last_ori, _global_time, _avg_vel): Self::Dependency, _anim_time: f64, _rate: &mut f32, s_a: &SkeletonAttr, diff --git a/voxygen/src/anim/src/theropod/run.rs b/voxygen/src/anim/src/theropod/run.rs index 94c34b30c0..7ef233c7c4 100644 --- a/voxygen/src/anim/src/theropod/run.rs +++ b/voxygen/src/anim/src/theropod/run.rs @@ -6,7 +6,7 @@ use std::f32::consts::PI; pub struct RunAnimation; impl Animation for RunAnimation { - type Dependency = (f32, f64); + type Dependency = (f32, Vec3, Vec3, f64, Vec3); type Skeleton = TheropodSkeleton; #[cfg(feature = "use-dyn-lib")] @@ -15,7 +15,7 @@ impl Animation for RunAnimation { #[cfg_attr(feature = "be-dyn-lib", export_name = "theropod_run")] fn update_skeleton_inner( skeleton: &Self::Skeleton, - (velocity, _global_time): Self::Dependency, + (velocity, orientation, last_ori, _global_time, avg_vel): Self::Dependency, anim_time: f64, rate: &mut f32, s_a: &SkeletonAttr, @@ -56,8 +56,20 @@ impl Animation for RunAnimation { //FR let foot2a = (anim_time as f32 * (16.0) * lab as f32 * speedmult).sin(); //1.2 let foot2b = (anim_time as f32 * (16.0) * lab as f32 * speedmult + 1.57).sin(); //1.6 - //BL - //BR + 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; + let x_tilt = avg_vel.z.atan2(avg_vel.xy().magnitude()); next.head.scale = Vec3::one() * 1.02; next.neck.scale = Vec3::one() * 0.98; @@ -67,32 +79,40 @@ impl Animation for RunAnimation { next.chest_front.scale = Vec3::one() / s_a.scaler; next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1 + breathe * 0.3); - next.head.orientation = - Quaternion::rotation_x(-0.1 + short * -0.05) * Quaternion::rotation_z(shortalt * -0.2); + next.head.orientation = Quaternion::rotation_x(-0.1 + short * -0.05) + * Quaternion::rotation_y(tilt * 0.8) + * Quaternion::rotation_z(shortalt * -0.2 - tilt * 1.2); next.jaw.position = Vec3::new(0.0, s_a.jaw.0, s_a.jaw.1); next.jaw.orientation = Quaternion::rotation_x(short * -0.03); next.neck.position = Vec3::new(0.0, s_a.neck.0, s_a.neck.1); - next.neck.orientation = - Quaternion::rotation_x(-0.1 + short * -0.04) * Quaternion::rotation_z(shortalt * -0.1); + next.neck.orientation = Quaternion::rotation_x(-0.1 + short * -0.04) + * Quaternion::rotation_y(tilt * 0.3) + * Quaternion::rotation_z(shortalt * -0.1 - tilt * 1.2); - next.chest_front.position = - Vec3::new(0.0, s_a.chest_front.0, s_a.chest_front.1 + short * 0.5) / s_a.scaler; + next.chest_front.position = Vec3::new( + 0.0, + s_a.chest_front.0, + s_a.chest_front.1 + short * 0.5 + x_tilt * 10.0 * canceler, + ) / s_a.scaler; next.chest_front.orientation = - Quaternion::rotation_x(short * 0.07) * Quaternion::rotation_z(shortalt * 0.15); + Quaternion::rotation_x(short * 0.07 + x_tilt * (canceler * 6.0).min(1.0)) + * Quaternion::rotation_y(tilt * 0.8) + * Quaternion::rotation_z(shortalt * 0.15 + tilt * -1.5); next.chest_back.position = Vec3::new(0.0, s_a.chest_back.0, s_a.chest_back.1); - next.chest_back.orientation = - Quaternion::rotation_x(short * -0.04) * Quaternion::rotation_z(shortalt * -0.15); + next.chest_back.orientation = Quaternion::rotation_x(short * -0.04) + * Quaternion::rotation_y(tilt * 0.6) + * Quaternion::rotation_z(shortalt * -0.15 + tilt * 0.6); next.tail_front.position = Vec3::new(0.0, s_a.tail_front.0, s_a.tail_front.1); - next.tail_front.orientation = - Quaternion::rotation_x(0.1 + short * -0.02) * Quaternion::rotation_z(shortalt * -0.1); + next.tail_front.orientation = Quaternion::rotation_x(0.1 + short * -0.02) + * Quaternion::rotation_z(shortalt * -0.1 + tilt * 1.0); next.tail_back.position = Vec3::new(0.0, s_a.tail_back.0, s_a.tail_back.1); - next.tail_back.orientation = - Quaternion::rotation_x(0.2 + short * -0.2) * Quaternion::rotation_z(shortalt * -0.2); + next.tail_back.orientation = Quaternion::rotation_x(0.2 + short * -0.1) + * Quaternion::rotation_z(shortalt * -0.2 + tilt * 1.4); next.hand_l.position = Vec3::new(-s_a.hand.0, s_a.hand.1, s_a.hand.2); next.hand_l.orientation = Quaternion::rotation_x(-0.2 + amplitude3 * foot2a * 0.3); @@ -106,7 +126,8 @@ impl Animation for RunAnimation { s_a.leg.2 + amplitude3 * foot1a * 1.4, ); next.leg_l.orientation = Quaternion::rotation_x(-0.2 + amplitude3 * foot1a * 0.2) - * Quaternion::rotation_z(foot1a * -0.3); + * Quaternion::rotation_y(tilt * 0.5) + * Quaternion::rotation_z(foot1a * -0.3 + tilt * -0.5); next.leg_r.position = Vec3::new( s_a.leg.0, @@ -114,7 +135,8 @@ impl Animation for RunAnimation { s_a.leg.2 + amplitude3 * foot2a * 1.4, ); next.leg_r.orientation = Quaternion::rotation_x(-0.2 + amplitude3 * foot2a * 0.2) - * Quaternion::rotation_z(foot2a * 0.3); + * Quaternion::rotation_y(tilt * 0.5) + * Quaternion::rotation_z(foot2a * 0.3 + tilt * -0.5); next.foot_l.position = Vec3::new( -s_a.foot.0, @@ -122,14 +144,16 @@ impl Animation for RunAnimation { s_a.foot.2 + canceler * 2.0 + (foot1a * 2.0).max(0.0) * amplitude2, ); next.foot_l.orientation = Quaternion::rotation_x(-0.3 + amplitude2 * foot1b * -0.35) - * Quaternion::rotation_y(0.0); + * Quaternion::rotation_y(tilt * -1.0) + * Quaternion::rotation_z(tilt * -0.5); next.foot_r.position = Vec3::new( s_a.foot.0, s_a.foot.1 + canceler * -2.0 + amplitude3 * foot2b * -2.0, s_a.foot.2 + canceler * 2.0 + (foot2a * 2.0).max(0.0) * amplitude2, ); - next.foot_r.orientation = Quaternion::rotation_x(-0.3 + amplitude2 * foot2b * -0.35); + next.foot_r.orientation = Quaternion::rotation_x(-0.3 + amplitude2 * foot2b * -0.35) + * Quaternion::rotation_y(tilt * -1.0); next } diff --git a/voxygen/src/scene/figure/mod.rs b/voxygen/src/scene/figure/mod.rs index c9cf99ae27..aae6b08720 100644 --- a/voxygen/src/scene/figure/mod.rs +++ b/voxygen/src/scene/figure/mod.rs @@ -1986,7 +1986,7 @@ impl FigureMgr { // Running (true, true, false) => anim::theropod::RunAnimation::update_skeleton( &TheropodSkeleton::default(), - (vel.0.magnitude(), time), + (vel.0.magnitude(), ori, state.last_ori, time, state.avg_vel), state.state_time, &mut state_animation_rate, skeleton_attr, @@ -1994,7 +1994,7 @@ impl FigureMgr { // In air (false, _, false) => anim::theropod::JumpAnimation::update_skeleton( &TheropodSkeleton::default(), - (vel.0.magnitude(), time), + (vel.0.magnitude(), ori, state.last_ori, time, state.avg_vel), state.state_time, &mut state_animation_rate, skeleton_attr, @@ -2299,57 +2299,65 @@ impl FigureMgr { skeleton_attr, ) }, - CharacterState::BasicRanged(data) => { - if data.exhausted { - anim::biped_large::ShootAnimation::update_skeleton( - &target_base, - (active_tool_kind, second_tool_kind, vel.0.magnitude(), time), - state.state_time, - &mut state_animation_rate, - skeleton_attr, - ) - } else { - anim::biped_large::ChargeAnimation::update_skeleton( - &target_base, - ( - active_tool_kind, - second_tool_kind, - vel.0.magnitude(), - ori, - state.last_ori, - time, - ), - state.state_time, - &mut state_animation_rate, - skeleton_attr, - ) - } + CharacterState::BasicRanged(s) => { + let stage_time = s.timer.as_secs_f64(); + + let stage_progress = match s.stage_section { + StageSection::Buildup => { + stage_time / s.static_data.buildup_duration.as_secs_f64() + }, + StageSection::Recover => { + stage_time / s.static_data.recover_duration.as_secs_f64() + }, + + _ => 0.0, + }; + + anim::biped_large::ShootAnimation::update_skeleton( + &target_base, + ( + active_tool_kind, + second_tool_kind, + vel.0.magnitude(), + ori, + state.last_ori, + time, + Some(s.stage_section), + ), + stage_progress, + &mut state_animation_rate, + skeleton_attr, + ) }, - CharacterState::ChargedRanged(data) => { - if data.exhausted { - anim::biped_large::ShootAnimation::update_skeleton( - &target_base, - (active_tool_kind, second_tool_kind, vel.0.magnitude(), time), - state.state_time, - &mut state_animation_rate, - skeleton_attr, - ) - } else { - anim::biped_large::ChargeAnimation::update_skeleton( - &target_base, - ( - active_tool_kind, - second_tool_kind, - vel.0.magnitude(), - ori, - state.last_ori, - time, - ), - state.state_time, - &mut state_animation_rate, - skeleton_attr, - ) - } + CharacterState::ChargedRanged(s) => { + let stage_time = s.timer.as_secs_f64(); + + let stage_progress = match s.stage_section { + StageSection::Buildup => { + stage_time / s.static_data.buildup_duration.as_secs_f64() + }, + StageSection::Recover => { + stage_time / s.static_data.recover_duration.as_secs_f64() + }, + + _ => 0.0, + }; + + anim::biped_large::ShootAnimation::update_skeleton( + &target_base, + ( + active_tool_kind, + second_tool_kind, + vel.0.magnitude(), + ori, + state.last_ori, + time, + Some(s.stage_section), + ), + stage_progress, + &mut state_animation_rate, + skeleton_attr, + ) }, CharacterState::DashMelee(s) => { let stage_time = s.timer.as_secs_f64(); diff --git a/world/src/lib.rs b/world/src/lib.rs index d945414f22..5fccc613c9 100644 --- a/world/src/lib.rs +++ b/world/src/lib.rs @@ -293,6 +293,8 @@ impl World { quadruped_low::Species::Crocodile => is_hostile = true, quadruped_low::Species::Alligator => is_hostile = true, quadruped_low::Species::Maneater => is_hostile = true, + quadruped_low::Species::Sandshark => is_hostile = true, + quadruped_low::Species::Hakulaq => is_hostile = true, _ => is_hostile = false, } }, diff --git a/world/src/site/dungeon/mod.rs b/world/src/site/dungeon/mod.rs index 147164eaec..e81c241545 100644 --- a/world/src/site/dungeon/mod.rs +++ b/world/src/site/dungeon/mod.rs @@ -362,11 +362,11 @@ impl Floor { 0 => self.create_room(Room { seed: ctx.rng.gen(), loot_density: 0.000025 + level as f32 * 0.00015, - enemy_density: Some(0.001 + level as f32 * 0.00002), + enemy_density: None, miniboss: true, boss: false, area, - height: ctx.rng.gen_range(20, 25), + height: ctx.rng.gen_range(15, 20), pillars: Some(4), }), _ => self.create_room(Room { @@ -553,26 +553,29 @@ impl Floor { } } if room.miniboss { - let boss_spawn_tile = room.area.center(); - // Don't spawn the boss in a pillar - let boss_tile_is_pillar = room + let miniboss_spawn_tile = room.area.center(); + // Don't spawn the miniboss in a pillar + let miniboss_tile_is_pillar = room .pillars .map(|pillar_space| { - boss_spawn_tile + miniboss_spawn_tile .map(|e| e.rem_euclid(pillar_space) == 0) .reduce_and() }) .unwrap_or(false); - let boss_spawn_tile = - boss_spawn_tile + if boss_tile_is_pillar { 1 } else { 0 }; + let miniboss_spawn_tile = + miniboss_spawn_tile + if miniboss_tile_is_pillar { 1 } else { 0 }; - if tile_pos == boss_spawn_tile && tile_wcenter.xy() == wpos2d { - let chosen = Lottery::::load_expect( - "common.loot_tables.loot_table_boss_cultist-leader", - ); + if tile_pos == miniboss_spawn_tile && tile_wcenter.xy() == wpos2d { + let chosen = + Lottery::::load_expect(match dynamic_rng.gen_range(0, 5) { + 0 => "common.loot_tables.loot_table_humanoids", + 1 => "common.loot_tables.loot_table_armor_misc", + _ => "common.loot_tables.loot_table_cultists", + }); let chosen = chosen.choose(); let entity = EntityInfo::at(tile_wcenter.map(|e| e as f32)) - .with_level(dynamic_rng.gen_range(1, 5)) + .with_level(1) .with_alignment(comp::Alignment::Enemy) .with_body(comp::Body::BipedLarge( comp::biped_large::Body::random_with( @@ -580,7 +583,7 @@ impl Floor { &comp::biped_large::Species::Mindflayer, ), )) - .with_name("Bob".to_string()) + .with_name("Mindflayer") .with_loot_drop(comp::Item::new_from_asset_expect(chosen)); supplement.add_entity(entity);