diff --git a/CHANGELOG.md b/CHANGELOG.md index b4d10f00ae..312df3c7af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,7 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - First version of multisalvage that allows to obtain more than one piece of material from salvage - Axe - Combat music toggle -- Spawn rtsim wyverns that travel the world, providing dragon scale loot drops +- Spawn rtsim wyverns that travel the world, providing dragon scale loot drops - Hardwood in tropical forests, frostwood in cold forests, and iron wood on the top of giant trees - Recipe for shovel, which is used to dig in mud and graves - Recipe for a new leather pack @@ -41,7 +41,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Deflect no longer parry melee hits - Changed recipes for some bags to make them more horizontal - Increase invetory slots on some bags to improve early game experience - - Made helmets, necklaces, rings, twig armors and some gliders salvageable - Tweaked stats on some foods so they generally increase a tiny bit more HP - Reduced idle time after consumption from 5 to 4 seconds @@ -57,6 +56,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Chat command responses sent by the server can now be localized - Frost Gigas spawns in cold areas (but isn't forced to stay there) - The ability limit for non-humanoids has been removed +- Improved running, wielding, and riding animations +- Fixed offset of items carried on backs when wearing cloaks and backpacks ### Removed - Medium and large potions from all loot tables diff --git a/assets/common/items/armor/merchant/back.ron b/assets/common/items/armor/merchant/back.ron index 998baf4426..6c27d557e4 100644 --- a/assets/common/items/armor/merchant/back.ron +++ b/assets/common/items/armor/merchant/back.ron @@ -2,10 +2,10 @@ ItemDef( name: "Merchant Backpack", description: "", kind: Armor(( - kind: Back, + kind: Backpack, stats: FromSet("Merchant"), )), quality: High, slots: 18, tags: [], -) \ No newline at end of file +) diff --git a/assets/common/items/armor/miner/back.ron b/assets/common/items/armor/miner/back.ron index 85e9fc273a..b1a0223377 100644 --- a/assets/common/items/armor/miner/back.ron +++ b/assets/common/items/armor/miner/back.ron @@ -2,9 +2,9 @@ ItemDef( name: "Miner's Backpack", description: "Battered from heavy rocks being carried inside.", kind: Armor(( - kind: Back, + kind: Backpack, stats: FromSet("Miner"), )), quality: High, tags: [], -) \ No newline at end of file +) diff --git a/assets/common/items/armor/misc/back/backpack.ron b/assets/common/items/armor/misc/back/backpack.ron index db1f9da3f7..91a4ac1531 100644 --- a/assets/common/items/armor/misc/back/backpack.ron +++ b/assets/common/items/armor/misc/back/backpack.ron @@ -2,11 +2,11 @@ ItemDef( name: "Traveler's Backpack", description: "Comfortable and with enough capacity, its a hoarder's best friend.", kind: Armor(( - kind: Back, + kind: Backpack, stats: Direct(( )), )), quality: Epic, tags: [Bag], slots: 20, -) \ No newline at end of file +) diff --git a/assets/common/items/npc_armor/back/backpack_blue.ron b/assets/common/items/npc_armor/back/backpack_blue.ron index 3ea2bd65bc..fb850e4ed0 100644 --- a/assets/common/items/npc_armor/back/backpack_blue.ron +++ b/assets/common/items/npc_armor/back/backpack_blue.ron @@ -2,7 +2,7 @@ ItemDef( name: "Rugged Backpack", description: "Keeps all your stuff together.", kind: Armor(( - kind: Back, + kind: Backpack, stats: Direct(( protection: Some(Normal(0.0)), poise_resilience: Some(Normal(0.0)), diff --git a/assets/voxygen/i18n/en/hud/bag.ftl b/assets/voxygen/i18n/en/hud/bag.ftl index 2504109630..2351ac22d1 100644 --- a/assets/voxygen/i18n/en/hud/bag.ftl +++ b/assets/voxygen/i18n/en/hud/bag.ftl @@ -14,6 +14,7 @@ hud-bag-glider = Glider hud-bag-belt = Belt hud-bag-ring = Ring hud-bag-back = Back +hud-bag-backpack = Backpack hud-bag-legs = Legs hud-bag-feet = Feet hud-bag-mainhand = Mainhand diff --git a/assets/voxygen/voxel/humanoid_armor_back_manifest.ron b/assets/voxygen/voxel/humanoid_armor_back_manifest.ron index 9e68eb5679..0db340b87a 100644 --- a/assets/voxygen/voxel/humanoid_armor_back_manifest.ron +++ b/assets/voxygen/voxel/humanoid_armor_back_manifest.ron @@ -149,7 +149,7 @@ color: None ), "common.items.armor.merchant.back": ( - vox_spec: ("armor.merchant.back", (-9.0, -7.0, -12.0)), + vox_spec: ("armor.merchant.back", (-8.0, -7.0, -11.0)), color: None ), }, diff --git a/common/src/bin/csv_export/main.rs b/common/src/bin/csv_export/main.rs index 2468aec2ec..99b8dd8561 100644 --- a/common/src/bin/csv_export/main.rs +++ b/common/src/bin/csv_export/main.rs @@ -203,6 +203,7 @@ fn get_armor_kind(kind: &ArmorKind) -> String { ArmorKind::Pants => "Pants".to_string(), ArmorKind::Foot => "Foot".to_string(), ArmorKind::Back => "Back".to_string(), + ArmorKind::Backpack => "Backpack".to_string(), ArmorKind::Ring => "Ring".to_string(), ArmorKind::Neck => "Neck".to_string(), ArmorKind::Head => "Head".to_string(), diff --git a/common/src/comp/body/item_drop.rs b/common/src/comp/body/item_drop.rs index cd82e456ed..97a7730068 100644 --- a/common/src/comp/body/item_drop.rs +++ b/common/src/comp/body/item_drop.rs @@ -75,6 +75,7 @@ impl From<&Item> for Body { ArmorKind::Pants => Body::Armor(ItemDropArmorKind::Pants), ArmorKind::Foot => Body::Armor(ItemDropArmorKind::Foot), ArmorKind::Back => Body::Armor(ItemDropArmorKind::Back), + ArmorKind::Backpack => Body::Armor(ItemDropArmorKind::Back), ArmorKind::Ring => Body::Armor(ItemDropArmorKind::Ring), ArmorKind::Neck => Body::Armor(ItemDropArmorKind::Neck), ArmorKind::Head => Body::Armor(ItemDropArmorKind::Head), diff --git a/common/src/comp/inventory/item/armor.rs b/common/src/comp/inventory/item/armor.rs index a334a95aa5..155add6b82 100644 --- a/common/src/comp/inventory/item/armor.rs +++ b/common/src/comp/inventory/item/armor.rs @@ -23,6 +23,7 @@ pub enum ArmorKind { Head, Tabard, Bag, + Backpack, } impl ArmorKind { @@ -35,6 +36,7 @@ impl ArmorKind { ArmorKind::Pants => true, ArmorKind::Foot => true, ArmorKind::Back => true, + ArmorKind::Backpack => true, ArmorKind::Ring => false, ArmorKind::Neck => false, ArmorKind::Head => true, @@ -252,6 +254,7 @@ impl Armor { ArmorKind::Pants => 2.0, ArmorKind::Foot => 1.0, ArmorKind::Back => 0.5, + ArmorKind::Backpack => 0.0, ArmorKind::Ring => 0.0, ArmorKind::Neck => 0.0, ArmorKind::Head => 0.0, diff --git a/common/src/comp/inventory/slot.rs b/common/src/comp/inventory/slot.rs index 4490deb120..37ca0c981d 100644 --- a/common/src/comp/inventory/slot.rs +++ b/common/src/comp/inventory/slot.rs @@ -142,6 +142,7 @@ impl ArmorSlot { | (Self::Ring1, ArmorKind::Ring) | (Self::Ring2, ArmorKind::Ring) | (Self::Back, ArmorKind::Back) + | (Self::Back, ArmorKind::Backpack) | (Self::Belt, ArmorKind::Belt) | (Self::Legs, ArmorKind::Pants) | (Self::Feet, ArmorKind::Foot) diff --git a/voxygen/anim/src/bird_large/run.rs b/voxygen/anim/src/bird_large/run.rs index d57eae12de..0094c655bb 100644 --- a/voxygen/anim/src/bird_large/run.rs +++ b/voxygen/anim/src/bird_large/run.rs @@ -29,7 +29,7 @@ impl Animation for RunAnimation { let speednorm = (speed / 13.0).powf(0.25); let speedmult = 0.8; - let lab: f32 = 0.6; //6 + let lab: f32 = 0.9; //6 // acc_vel and anim_time mix to make sure phase lenght isn't starting at // +infinite @@ -92,18 +92,18 @@ impl Animation for RunAnimation { next.foot_l.position = Vec3::new( -s_a.foot.0, s_a.foot.1 + foot1b * -1.0, - s_a.foot.2 + (foot1a * 1.5).max(0.0), + s_a.foot.2 + (foot1a * 4.0).max(0.0), ); - next.foot_l.orientation = Quaternion::rotation_x(0.2 * speednorm + foot1b * -0.8 + 0.1) + next.foot_l.orientation = Quaternion::rotation_x(0.2 * speednorm + foot1b * -0.3 + 0.1) * 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 + foot2b * -1.0, - s_a.foot.2 + (foot2a * 1.5).max(0.0), + s_a.foot.2 + (foot2a * 4.0).max(0.0), ); - next.foot_r.orientation = Quaternion::rotation_x(0.2 * speednorm + foot2b * -0.8 + 0.1) + next.foot_r.orientation = Quaternion::rotation_x(0.2 * speednorm + foot2b * -0.3 + 0.1) * Quaternion::rotation_y(tilt * -1.0) * Quaternion::rotation_z(tilt * -0.5); @@ -114,12 +114,15 @@ impl Animation for RunAnimation { s_a.chest.1 + short * 0.5 + x_tilt * 10.0 + speednorm * -2.0, ) * s_a.scaler; next.chest.orientation = Quaternion::rotation_x(-0.1 + short * 0.07 + x_tilt) - * Quaternion::rotation_y(tilt * 0.8) - * Quaternion::rotation_z(shortalt * 0.10); + * Quaternion::rotation_y(tilt * 0.8 - shortalt * 0.2) + * Quaternion::rotation_z(shortalt * 0.1); + + next.neck.orientation = next.neck.orientation * Quaternion::rotation_y(shortalt * 0.2); 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.3 + short * -0.02) * Quaternion::rotation_z(tilt * 2.0); + next.tail_front.orientation = Quaternion::rotation_x(0.3 + short * -0.02) + * Quaternion::rotation_y(shortalt * 0.2) + * Quaternion::rotation_z(tilt * 2.0); next.tail_rear.position = Vec3::new(0.0, s_a.tail_rear.0, s_a.tail_rear.1); next.tail_rear.orientation = @@ -137,10 +140,10 @@ impl Animation for RunAnimation { ); next.wing_in_l.orientation = Quaternion::rotation_x(foot2a * -0.05 + speednorm * -0.3) - * Quaternion::rotation_y(-0.8 + speednorm * 0.5 + foot2b * -0.2) + * Quaternion::rotation_y(-0.8 + speednorm * 0.5 + foot2b * -0.2 + shortalt * 0.3) * Quaternion::rotation_z(0.2 + foot2a * 0.6); next.wing_in_r.orientation = Quaternion::rotation_x(foot1a * -0.05 + speednorm * -0.3) - * Quaternion::rotation_y(0.8 + speednorm * -0.55 + foot1b * 0.2) + * Quaternion::rotation_y(0.8 + speednorm * -0.55 + foot1b * 0.2 + shortalt * 0.3) * Quaternion::rotation_z(-0.2 + foot1a * -0.6); next.wing_mid_l.position = Vec3::new(-s_a.wing_mid.0, s_a.wing_mid.1, s_a.wing_mid.2); @@ -161,18 +164,18 @@ impl Animation for RunAnimation { next.leg_l.position = Vec3::new( -s_a.leg.0, - s_a.leg.1 + foot1b * -2.3, + s_a.leg.1 + foot1b * -4.0, s_a.leg.2 + foot2b * -1.5, ); - next.leg_l.orientation = Quaternion::rotation_x(-1.0 * speednorm + foot1a * 0.15) + next.leg_l.orientation = Quaternion::rotation_x(-0.3 * speednorm + foot1a * 0.15) * Quaternion::rotation_y(tilt * 0.5); next.leg_r.position = Vec3::new( s_a.leg.0, - s_a.leg.1 + foot2b * -2.3, + s_a.leg.1 + foot2b * -4.0, s_a.leg.2 + foot1b * -1.5, ); - next.leg_r.orientation = Quaternion::rotation_x(-1.0 * speednorm + foot2a * 0.15) + next.leg_r.orientation = Quaternion::rotation_x(-0.3 * speednorm + foot2a * 0.15) * Quaternion::rotation_y(tilt * 0.5); } else { next.chest.position = Vec3::new( @@ -180,9 +183,12 @@ impl Animation for RunAnimation { s_a.chest.0, s_a.chest.1 + short * 0.5 + x_tilt * 10.0 + 0.5 * speednorm, ) * s_a.scaler; - next.chest.orientation = Quaternion::rotation_x(short * 0.07 + x_tilt) - * Quaternion::rotation_y(tilt * 0.8) - * Quaternion::rotation_z(shortalt * 0.10); + next.chest.orientation = + Quaternion::rotation_x(short * 0.07 + x_tilt + foot1b.max(foot2b) * 0.2) + * Quaternion::rotation_y(tilt * 0.8 - foot1b * 0.2) + * Quaternion::rotation_z(shortalt * 0.1); + + next.neck.orientation = next.neck.orientation * Quaternion::rotation_y(shortalt * -0.2); 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.6 + short * -0.02); @@ -210,13 +216,13 @@ impl Animation for RunAnimation { next.wing_out_r.orientation = Quaternion::rotation_y(0.2 + short * -0.05) * Quaternion::rotation_z(-0.2); - next.leg_l.position = Vec3::new(-s_a.leg.0, s_a.leg.1 + foot1b * -2.3, s_a.leg.2); - next.leg_l.orientation = Quaternion::rotation_x(-0.2 * speednorm + foot1a * 0.15) - * Quaternion::rotation_y(tilt * 0.5); + next.leg_l.position = Vec3::new(-s_a.leg.0, s_a.leg.1 + foot1b * -5.0, s_a.leg.2); + next.leg_l.orientation = Quaternion::rotation_x(-0.2 * speednorm + foot1a * 0.1) + * Quaternion::rotation_y(tilt * 0.5 + (foot1a + 1.0) * 0.15); - next.leg_r.position = Vec3::new(s_a.leg.0, s_a.leg.1 + foot2b * -2.3, s_a.leg.2); - next.leg_r.orientation = Quaternion::rotation_x(-0.2 * speednorm + foot2a * 0.15) - * Quaternion::rotation_y(tilt * 0.5); + next.leg_r.position = Vec3::new(s_a.leg.0, s_a.leg.1 + foot2b * -5.0, s_a.leg.2); + next.leg_r.orientation = Quaternion::rotation_x(-0.2 * speednorm + foot2a * 0.1) + * Quaternion::rotation_y(tilt * 0.5 - (foot2a + 1.0) * 0.15); } next } diff --git a/voxygen/anim/src/bird_medium/run.rs b/voxygen/anim/src/bird_medium/run.rs index 010d08eb11..4e235db385 100644 --- a/voxygen/anim/src/bird_medium/run.rs +++ b/voxygen/anim/src/bird_medium/run.rs @@ -26,10 +26,10 @@ impl Animation for RunAnimation { *rate = 1.0; //let speednorm = speed / 13.0; - let speednorm = (speed / 13.0).powf(0.25); + let speednorm = (speed / 13.0).powf(0.5); let speedmult = 0.8; - let lab: f32 = 0.6; //6 + let lab: f32 = 0.8; //6 // acc_vel and anim_time mix to make sure phase lenght isn't starting at // +infinite @@ -76,16 +76,21 @@ impl Animation for RunAnimation { next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1); next.head.orientation = Quaternion::rotation_x(-0.1 * speednorm + short * -0.05) - * Quaternion::rotation_y(tilt * 0.2) + * Quaternion::rotation_y(tilt * 0.2 + foot1a * 0.25) * Quaternion::rotation_z(shortalt * -0.05 - tilt * 1.5); next.chest.position = Vec3::new( 0.0, s_a.chest.0, - s_a.chest.1 + short * 0.5 + x_tilt * 4.0 + 0.5 * speednorm, + s_a.chest.1 + + 1.5 + + short * 0.5 + + foot1b.max(foot2b) * 2.0 + + x_tilt * 4.0 + + 0.5 * speednorm, ) * s_a.scaler; next.chest.orientation = Quaternion::rotation_x(short * 0.07 + x_tilt) - * Quaternion::rotation_y(tilt * 0.8) + * Quaternion::rotation_y(tilt * 0.8 - foot1a * 0.25) * Quaternion::rotation_z(shortalt * 0.10); next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1); @@ -108,13 +113,21 @@ impl Animation for RunAnimation { next.wing_out_r.orientation = Quaternion::rotation_y(0.2 + short * -0.05) * Quaternion::rotation_z(-0.2); - next.leg_l.position = Vec3::new(-s_a.leg.0, s_a.leg.1 + foot1b * -0.8, s_a.leg.2); - next.leg_l.orientation = Quaternion::rotation_x(-0.2 * speednorm + foot1a * 0.15) - * Quaternion::rotation_y(tilt * 0.5); + next.leg_l.position = Vec3::new( + -s_a.leg.0, + s_a.leg.1 + foot1b * -1.8, + s_a.leg.2 + (foot1b + 1.0) * 0.75, + ); + next.leg_l.orientation = Quaternion::rotation_x(-0.2 * speednorm + foot1a * 0.75) + * Quaternion::rotation_y(tilt * 0.5 + foot1b.max(0.0) * 0.6); - next.leg_r.position = Vec3::new(s_a.leg.0, s_a.leg.1 + foot2b * -0.8, s_a.leg.2); - next.leg_r.orientation = Quaternion::rotation_x(-0.2 * speednorm + foot2a * 0.15) - * Quaternion::rotation_y(tilt * 0.5); + next.leg_r.position = Vec3::new( + s_a.leg.0, + s_a.leg.1 + foot2b * -1.8, + s_a.leg.2 + (foot2b + 1.0) * 0.75, + ); + next.leg_r.orientation = Quaternion::rotation_x(-0.2 * speednorm + foot2a * 0.75) + * Quaternion::rotation_y(tilt * 0.5 - foot2b.max(0.0) * 0.6); next } } diff --git a/voxygen/anim/src/character/glidewield.rs b/voxygen/anim/src/character/glidewield.rs index a9e7daf68c..962f46c27e 100644 --- a/voxygen/anim/src/character/glidewield.rs +++ b/voxygen/anim/src/character/glidewield.rs @@ -31,6 +31,9 @@ impl Animation for GlideWieldAnimation { glider_pos + glider_ori * Vec3::new(-s_a.hand.0 + -2.0, s_a.hand.1 + 8.0, s_a.hand.2); next.hand_l.orientation = Quaternion::rotation_x(3.35) * Quaternion::rotation_y(0.2); + next.shoulder_r.orientation = glider_ori * Quaternion::rotation_x(2.0); + next.shoulder_l.orientation = next.shoulder_r.orientation; + next.hand_r.position = glider_pos + glider_ori * Vec3::new(s_a.hand.0 + 2.0, s_a.hand.1 + 8.0, s_a.hand.2); next.hand_r.orientation = Quaternion::rotation_x(3.35) * Quaternion::rotation_y(-0.2); diff --git a/voxygen/anim/src/character/gliding.rs b/voxygen/anim/src/character/gliding.rs index ed51914751..e1e35a7596 100644 --- a/voxygen/anim/src/character/gliding.rs +++ b/voxygen/anim/src/character/gliding.rs @@ -58,6 +58,9 @@ impl Animation for GlidingAnimation { next.shorts.position = Vec3::new(0.0, s_a.shorts.0, s_a.shorts.1); next.shorts.orientation = Quaternion::rotation_z(-speedlog + slow * 0.15); + next.shoulder_r.orientation = glider_ori * Quaternion::rotation_x(2.0); + next.shoulder_l.orientation = next.shoulder_r.orientation; + next.hand_l.position = glider_pos + glider_ori * Vec3::new(-s_a.hand.0 + -2.0, s_a.hand.1 + 8.0, s_a.hand.2); next.hand_l.orientation = Quaternion::rotation_x(3.35) * Quaternion::rotation_y(0.2); diff --git a/voxygen/anim/src/character/idle.rs b/voxygen/anim/src/character/idle.rs index a1de8aa61a..d010bce292 100644 --- a/voxygen/anim/src/character/idle.rs +++ b/voxygen/anim/src/character/idle.rs @@ -89,17 +89,17 @@ impl Animation for IdleAnimation { match hands { (Some(Hands::Two), _) | (None, Some(Hands::Two)) => match active_tool_kind { Some(ToolKind::Bow) => { - next.main.position = Vec3::new(0.0, -5.0, 6.0); + next.main.position = Vec3::new(0.0, -5.0 - skeleton.back_carry_offset, 6.0); next.main.orientation = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(PI / 2.0); }, Some(ToolKind::Staff) | Some(ToolKind::Sceptre) => { - next.main.position = Vec3::new(2.0, -5.0, -1.0); + next.main.position = Vec3::new(2.0, -5.0 - skeleton.back_carry_offset, -1.0); next.main.orientation = Quaternion::rotation_y(-0.5) * Quaternion::rotation_z(PI / 2.0); }, _ => { - next.main.position = Vec3::new(-7.0, -5.0, 15.0); + next.main.position = Vec3::new(-7.0, -5. - skeleton.back_carry_offset, 15.0); next.main.orientation = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(PI / 2.0); }, @@ -110,12 +110,12 @@ impl Animation for IdleAnimation { match hands { (Some(Hands::One), _) => match active_tool_kind { Some(ToolKind::Dagger) => { - next.main.position = Vec3::new(5.0, 1.0, 2.0); + next.main.position = Vec3::new(5.0, 1.0 - skeleton.back_carry_offset, 2.0); next.main.orientation = Quaternion::rotation_x(-1.35 * PI) * Quaternion::rotation_z(2.0 * PI); }, Some(ToolKind::Axe) | Some(ToolKind::Hammer) | Some(ToolKind::Sword) => { - next.main.position = Vec3::new(-4.0, -5.0, 10.0); + next.main.position = Vec3::new(-4.0, -4.0 - skeleton.back_carry_offset, 10.0); next.main.orientation = Quaternion::rotation_y(2.35) * Quaternion::rotation_z(PI / 2.0); }, @@ -127,12 +127,12 @@ impl Animation for IdleAnimation { match hands { (None | Some(Hands::One), Some(Hands::One)) => match second_tool_kind { Some(ToolKind::Dagger) => { - next.second.position = Vec3::new(-5.0, 1.0, 2.0); + next.second.position = Vec3::new(-5.0, 1.0 - skeleton.back_carry_offset, 2.0); next.second.orientation = Quaternion::rotation_x(-1.35 * PI) * Quaternion::rotation_z(-2.0 * PI); }, Some(ToolKind::Axe) | Some(ToolKind::Hammer) | Some(ToolKind::Sword) => { - next.second.position = Vec3::new(4.0, -6.0, 10.0); + next.second.position = Vec3::new(4.0, -5.0 - skeleton.back_carry_offset, 10.0); next.second.orientation = Quaternion::rotation_y(-2.5) * Quaternion::rotation_z(-PI / 2.0); }, diff --git a/voxygen/anim/src/character/jump.rs b/voxygen/anim/src/character/jump.rs index 16d8ed963b..b57c1bdd8d 100644 --- a/voxygen/anim/src/character/jump.rs +++ b/voxygen/anim/src/character/jump.rs @@ -144,27 +144,27 @@ impl Animation for JumpAnimation { match main_tool { Some(ToolKind::Dagger) => { - next.main.position = Vec3::new(5.0, 1.0, 2.0); + next.main.position = Vec3::new(5.0, 1.0 - skeleton.back_carry_offset, 2.0); next.main.orientation = Quaternion::rotation_x(-1.35 * PI) * Quaternion::rotation_z(2.0 * PI); }, Some(ToolKind::Shield) => { - next.main.position = Vec3::new(-0.0, -5.0, 3.0); + next.main.position = Vec3::new(-0.0, -5.0 - skeleton.back_carry_offset, 3.0); next.main.orientation = Quaternion::rotation_y(0.25 * PI) * Quaternion::rotation_z(-1.5 * PI); }, Some(ToolKind::Staff) | Some(ToolKind::Sceptre) => { - next.main.position = Vec3::new(2.0, -5.0, -1.0); + next.main.position = Vec3::new(2.0, -5.0 - skeleton.back_carry_offset, -1.0); next.main.orientation = Quaternion::rotation_y(-0.5) * Quaternion::rotation_z(PI / 2.0); }, Some(ToolKind::Bow) => { - next.main.position = Vec3::new(0.0, -5.0, 6.0); + next.main.position = Vec3::new(0.0, -5.0 - skeleton.back_carry_offset, 6.0); next.main.orientation = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(PI / 2.0); }, _ => { - next.main.position = Vec3::new(-7.0, -5.0, 15.0); + next.main.position = Vec3::new(-7.0, -5.0 - skeleton.back_carry_offset, 15.0); next.main.orientation = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(PI / 2.0); }, @@ -172,18 +172,18 @@ impl Animation for JumpAnimation { match second_tool_kind { Some(ToolKind::Dagger) => { - next.second.position = Vec3::new(-5.0, 1.0, 2.0); + next.second.position = Vec3::new(-5.0, 1.0 - skeleton.back_carry_offset, 2.0); next.second.orientation = Quaternion::rotation_x(-1.35 * PI) * Quaternion::rotation_z(-2.0 * PI); }, Some(ToolKind::Shield) => { - next.second.position = Vec3::new(0.0, -4.0, 3.0); + next.second.position = Vec3::new(0.0, -4.5 - skeleton.back_carry_offset, 3.0); next.second.orientation = Quaternion::rotation_y(-0.25 * PI) * Quaternion::rotation_z(1.5 * PI); }, _ => { - next.second.position = Vec3::new(-7.0, -5.0, 15.0); + next.second.position = Vec3::new(-7.0, -5.0 - skeleton.back_carry_offset, 15.0); next.second.orientation = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(PI / 2.0); }, @@ -211,7 +211,7 @@ impl Animation for JumpAnimation { match hands { (Some(Hands::One), _) => match active_tool_kind { Some(ToolKind::Axe) | Some(ToolKind::Hammer) | Some(ToolKind::Sword) => { - next.main.position = Vec3::new(-4.0, -5.0, 10.0); + next.main.position = Vec3::new(-4.0, -5.0 - skeleton.back_carry_offset, 10.0); next.main.orientation = Quaternion::rotation_y(2.35) * Quaternion::rotation_z(PI / 2.0); }, @@ -223,7 +223,7 @@ impl Animation for JumpAnimation { match hands { (None | Some(Hands::One), Some(Hands::One)) => match second_tool_kind { Some(ToolKind::Axe) | Some(ToolKind::Hammer) | Some(ToolKind::Sword) => { - next.second.position = Vec3::new(4.0, -6.0, 10.0); + next.second.position = Vec3::new(4.0, -6.0 - skeleton.back_carry_offset, 10.0); next.second.orientation = Quaternion::rotation_y(-2.5) * Quaternion::rotation_z(-PI / 2.0); }, diff --git a/voxygen/anim/src/character/mod.rs b/voxygen/anim/src/character/mod.rs index a3a583cb5f..c5cf136a64 100644 --- a/voxygen/anim/src/character/mod.rs +++ b/voxygen/anim/src/character/mod.rs @@ -86,6 +86,8 @@ skeleton_impls!(struct CharacterSkeleton { control_r, :: // Begin non-bone fields holding_lantern: bool, + // The offset from the back that carried weapons should be given to avoid clipping due to, say, a backpack + back_carry_offset: f32, main_weapon_trail: bool, off_weapon_trail: bool, // Cannot exist at same time as weapon trails. Since gliding and attacking are mutually exclusive, should never be a concern. @@ -93,9 +95,10 @@ skeleton_impls!(struct CharacterSkeleton { }); impl CharacterSkeleton { - pub fn new(holding_lantern: bool) -> Self { + pub fn new(holding_lantern: bool, back_carry_offset: f32) -> Self { Self { holding_lantern, + back_carry_offset, ..Self::default() } } diff --git a/voxygen/anim/src/character/roll.rs b/voxygen/anim/src/character/roll.rs index 7baf43bad6..f250c915cd 100644 --- a/voxygen/anim/src/character/roll.rs +++ b/voxygen/anim/src/character/roll.rs @@ -211,22 +211,38 @@ impl Animation for RollAnimation { s_a.hand.1 + 1.0 * movement1, s_a.hand.2 + 2.0 * movement1, ); - next.hand_l.orientation = Quaternion::rotation_x(0.6 * movement1); - next.hand_r.position = Vec3::new( - -1.0 * movement1 + s_a.hand.0, - s_a.hand.1 + 1.0 * movement1, - s_a.hand.2 + 2.0 * movement1, - ); - next.hand_r.orientation = Quaternion::rotation_x(0.6 * movement1); + next.hand_r.position = if prev_aimed_dir.is_some() { + Vec3::new( + -1.0 * movement1 + s_a.hand.0, + s_a.hand.1 + 1.0 * movement1, + s_a.hand.2 + 2.0 * movement1, + ) + } else { + Vec3::new( + -1.0 * movement1 + s_a.hand.0 + 3.0, + s_a.hand.1 + 1.0 * movement1, + s_a.hand.2 + 2.0 * movement1 + 8.0, + ) + }; + next.hand_r.orientation = if prev_aimed_dir.is_some() { + Quaternion::rotation_x(0.6 * movement1) + } else { + Quaternion::rotation_y(-1.0) + }; }; next.head.position = Vec3::new( 0.0, s_a.head.0 + 1.5 * movement1, s_a.head.1 - 1.0 * movement1, ); - next.head.orientation = Quaternion::rotation_x(-0.3 * movement1); + next.head.orientation = Quaternion::rotation_x(-0.3 * movement1) + * if prev_aimed_dir.is_some() { + Quaternion::identity() + } else { + Quaternion::rotation_y(-0.4) + }; next.chest.position = Vec3::new(0.0, s_a.chest.0, -9.5 * movement1 + s_a.chest.1); next.chest.orientation = Quaternion::rotation_x(-0.2 * movement1); @@ -246,20 +262,32 @@ impl Animation for RollAnimation { next.shorts.orientation = Quaternion::rotation_x(0.8 * movement1); next.foot_l.position = Vec3::new( - 1.0 * movement1 - s_a.foot.0, + if prev_aimed_dir.is_some() { + 1.0 * movement1 - s_a.foot.0 + } else { + 1.0 * movement1 - s_a.foot.0 + 5.0 + }, s_a.foot.1 + 5.5 * movement1, s_a.foot.2 - 5.0 * movement1, ); next.foot_l.orientation = Quaternion::rotation_x(0.9 * movement1); next.foot_r.position = Vec3::new( - 1.0 * movement1 + s_a.foot.0, + if prev_aimed_dir.is_some() { + 1.0 * movement1 + s_a.foot.0 + } else { + 1.0 * movement1 + s_a.foot.0 + 3.0 + }, s_a.foot.1 + 5.5 * movement1, s_a.foot.2 - 5.0 * movement1, ); next.foot_r.orientation = Quaternion::rotation_x(0.9 * movement1); - next.torso.position = Vec3::new(0.0, 0.0, 7.0 * movement1); + next.torso.position = if prev_aimed_dir.is_some() { + Vec3::new(0.0, 0.0, 7.0 * movement1) + } else { + Vec3::new(4.0, 0.0, 7.0 * movement1) + }; let roll_spin = Quaternion::rotation_x(-0.3 + movement1 * -0.4 + movement2 * -2.0 * PI); next.torso.orientation = if let Some(prev_aimed_dir) = prev_aimed_dir { // This is *slightly* hacky. Because rolling is not strafed movement, we @@ -278,7 +306,7 @@ impl Animation for RollAnimation { }) .unwrap_or_default() } else { - roll_spin * Quaternion::rotation_z(tilt * -10.0) + roll_spin * Quaternion::rotation_z(tilt * -10.0) * Quaternion::rotation_y(-0.6) }; next diff --git a/voxygen/anim/src/character/run.rs b/voxygen/anim/src/character/run.rs index 098e96cb38..7973b508c8 100644 --- a/voxygen/anim/src/character/run.rs +++ b/voxygen/anim/src/character/run.rs @@ -52,9 +52,9 @@ impl Animation for RunAnimation { let speed = Vec2::::from(velocity).magnitude(); *rate = 1.0; let impact = (avg_vel.z).max(-8.0); - let speednorm = (speed / 9.4).powf(0.6); + let speednorm = (speed / 9.4).powf(0.65); - let lab: f32 = 0.5 / s_a.scaler; + let lab: f32 = 0.6 / s_a.scaler.powf(0.75); let footrotl = ((1.0 / (0.5 + (0.5) * ((acc_vel * 1.6 * lab + PI * 1.4).sin()).powi(2))) .sqrt()) @@ -70,13 +70,36 @@ impl Animation for RunAnimation { let shorte = ((1.0 / (0.8 + 0.2 * ((acc_vel * lab * 1.6).sin()).powi(2))).sqrt()) * ((acc_vel * lab * 1.6).sin()); - let foothoril = (acc_vel * 1.6 * lab + PI * 1.45).sin(); - let foothorir = (acc_vel * 1.6 * lab + PI * (0.45)).sin(); - let footstrafel = (acc_vel * 1.6 * lab + PI * 1.45).sin(); - let footstrafer = (acc_vel * 1.6 * lab + PI * (0.95)).sin(); + let back_speed = 2.6; - let footvertl = (acc_vel * 1.6 * lab).sin(); - let footvertr = (acc_vel * 1.6 * lab + PI).sin(); + let dirside = orientation.xy().dot(velocity.xy()).signum(); + let foothoril = if dirside > 0.0 { + (acc_vel * 1.6 * lab + PI * 1.45).sin() * dirside + } else { + (acc_vel * back_speed * lab + PI * 1.45).sin() * dirside + }; + let foothorir = if dirside > 0.0 { + (acc_vel * 1.6 * lab + PI * (0.45)).sin() * dirside + } else { + (acc_vel * back_speed * lab + PI * (0.45)).sin() * dirside + }; + let strafeside = orientation + .xy() + .dot(velocity.xy().rotated_z(PI * -0.5)) + .signum(); + let footstrafel = (acc_vel * 1.6 * lab + PI * 1.5).sin() * strafeside; + let footstrafer = (acc_vel * 1.6 * lab + PI).sin() * -strafeside; + + let footvertl = if dirside > 0.0 { + (acc_vel * 1.6 * lab).sin() + } else { + (acc_vel * back_speed * lab).sin() + }; + let footvertr = if dirside > 0.0 { + (acc_vel * 1.6 * lab + PI).sin() + } else { + (acc_vel * back_speed * lab + PI).sin() + }; let footvertsl = (acc_vel * 1.6 * lab).sin(); let footvertsr = (acc_vel * 1.6 * lab + PI * 0.5).sin(); @@ -85,7 +108,6 @@ impl Animation for RunAnimation { let short = ((5.0 / (1.5 + 3.5 * ((acc_vel * lab * 1.6 + PI * 0.5).sin()).powi(2))).sqrt()) * ((acc_vel * lab * 1.6 + PI * 0.5).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; @@ -143,55 +165,56 @@ impl Animation for RunAnimation { next.hand_l.position = Vec3::new( -s_a.hand.0 * 1.2 - foothorir * 1.3 * speednorm + (foothoril.abs().powf(2.0) - 0.5) * speednorm * 4.0, - s_a.hand.1 * 1.3 + foothorir * -7.0 * speednorm, + s_a.hand.1 * 1.3 + foothorir * -7.0 * speednorm * (1.0 - sideabs), s_a.hand.2 - foothorir * 2.75 * speednorm + foothoril.abs().powf(3.0) * speednorm * 8.0, ); next.hand_l.orientation = - Quaternion::rotation_x(0.6 * speednorm + (footrotr * -1.5 + 0.5) * speednorm) - * Quaternion::rotation_y(footrotr * 0.4 * speednorm + PI * 0.07); + Quaternion::rotation_x( + 0.6 * speednorm + (footrotr * -1.5 + 0.5) * speednorm * (1.0 - sideabs), + ) * Quaternion::rotation_y(footrotr * 0.4 * speednorm + PI * 0.07); next.hand_r.position = Vec3::new( s_a.hand.0 * 1.2 + foothoril * 1.3 * speednorm - (foothorir.abs().powf(2.0) - 0.5) * speednorm * 4.0, - s_a.hand.1 * 1.3 + foothoril * -7.0 * speednorm, + s_a.hand.1 * 1.3 + foothoril * -7.0 * speednorm * (1.0 - sideabs), s_a.hand.2 - foothoril * 2.75 * speednorm + foothorir.abs().powf(3.0) * speednorm * 8.0, ); next.hand_r.orientation = - Quaternion::rotation_x(0.6 * speednorm + (footrotl * -1.5 + 0.5) * speednorm) - * Quaternion::rotation_y(footrotl * -0.4 * speednorm - PI * 0.07); + Quaternion::rotation_x( + 0.6 * speednorm + (footrotl * -1.5 + 0.5) * speednorm * (1.0 - sideabs), + ) * Quaternion::rotation_y(footrotl * -0.4 * speednorm - PI * 0.07); - // next.foot_l.position = Vec3::new( - -s_a.foot.0 + footstrafel * sideabs * 3.0 + tilt * -10.0, - s_a.foot.1 - + (1.0 - sideabs) * (-0.5 * speednorm + foothoril * -10.5 * speednorm) - + (direction * 5.0).max(0.0), + -s_a.foot.0 + footstrafel * sideabs * 7.0 + tilt * -10.0, + s_a.foot.1 + (1.0 - sideabs) * (-0.5 * speednorm + foothoril * -10.5 * speednorm), s_a.foot.2 + (1.0 - sideabs) * (1.25 * speednorm + ((footvertl * -5.0 * speednorm).max(-1.0))) - + side * ((footvertsl * 1.5).max(-1.0)) - + foothoril.abs().powf(6.0) * speednorm * 5.0, + + side * ((footvertsl * 1.5).max(-1.0)), ); next.foot_l.orientation = Quaternion::rotation_x( - (1.0 - sideabs) * (-0.3 + foothoril * -1.5 * speednorm) + sideabs * -0.5, + (1.0 - sideabs) * (foothoril + 0.4 * (1.0 - sideabs)) * -1.5 * speednorm + + sideabs * -0.5, ) * Quaternion::rotation_y( tilt * -0.5 + side * 0.3 + side * (foothoril * 0.3), - ) * Quaternion::rotation_z(side * 0.2); + ) * Quaternion::rotation_z( + side * 0.9 * orientation.xy().dot(velocity.xy() / (speed + 0.01)), + ); next.foot_r.position = Vec3::new( - s_a.foot.0 + footstrafer * sideabs * 3.0 + tilt * -10.0, - s_a.foot.1 - + (1.0 - sideabs) * (-0.5 * speednorm + foothorir * -10.5 * speednorm) - + (direction * 5.0).max(0.0), + s_a.foot.0 + footstrafer * sideabs * 7.0 + tilt * -10.0, + s_a.foot.1 + (1.0 - sideabs) * (-0.5 * speednorm + foothorir * -10.5 * speednorm), s_a.foot.2 + (1.0 - sideabs) * (1.25 * speednorm + ((footvertr * -5.0 * speednorm).max(-1.0))) - + side * ((footvertsr * -1.5).max(-1.0)) - + foothorir.abs().powf(6.0) * speednorm * 5.0, + + side * ((footvertsr * -1.5).max(-1.0)), ); next.foot_r.orientation = Quaternion::rotation_x( - (1.0 - sideabs) * (-0.3 + foothorir * -1.5 * speednorm) + sideabs * -0.5, + (1.0 - sideabs) * (foothorir + 0.4 * (1.0 - sideabs)) * -1.5 * speednorm + + sideabs * -0.5, ) * Quaternion::rotation_y( tilt * -0.5 + side * 0.3 + side * (foothorir * 0.3), - ) * Quaternion::rotation_z(side * 0.2); + ) * Quaternion::rotation_z( + side * 0.9 * orientation.xy().dot(velocity.xy() / (speed + 0.01)), + ); // next.shoulder_l.position = Vec3::new(-s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2); @@ -215,27 +238,27 @@ impl Animation for RunAnimation { match main_tool { Some(ToolKind::Dagger) => { - next.main.position = Vec3::new(5.0, 1.0, 2.0); + next.main.position = Vec3::new(5.0, 1.0 - skeleton.back_carry_offset, 2.0); next.main.orientation = Quaternion::rotation_x(-1.35 * PI) * Quaternion::rotation_z(2.0 * PI); }, Some(ToolKind::Shield) => { - next.main.position = Vec3::new(-0.0, -5.0, 3.0); + next.main.position = Vec3::new(-0.0, -5.0 - skeleton.back_carry_offset, 3.0); next.main.orientation = Quaternion::rotation_y(0.25 * PI) * Quaternion::rotation_z(-1.5 * PI); }, Some(ToolKind::Staff) | Some(ToolKind::Sceptre) => { - next.main.position = Vec3::new(2.0, -5.0, -1.0); + next.main.position = Vec3::new(2.0, -5.0 - skeleton.back_carry_offset, -1.0); next.main.orientation = Quaternion::rotation_y(-0.5) * Quaternion::rotation_z(PI / 2.0); }, Some(ToolKind::Bow) => { - next.main.position = Vec3::new(0.0, -5.0, 6.0); + next.main.position = Vec3::new(0.0, -5.0 - skeleton.back_carry_offset, 6.0); next.main.orientation = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(PI / 2.0); }, _ => { - next.main.position = Vec3::new(-7.0, -5.0, 15.0); + next.main.position = Vec3::new(-7.0, -5.0 - skeleton.back_carry_offset, 15.0); next.main.orientation = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(PI / 2.0 + shorte * -0.2); }, @@ -243,17 +266,17 @@ impl Animation for RunAnimation { match second_tool_kind { Some(ToolKind::Dagger) => { - next.second.position = Vec3::new(-5.0, 1.0, 2.0); + next.second.position = Vec3::new(-5.0, 1.0 - skeleton.back_carry_offset, 2.0); next.second.orientation = Quaternion::rotation_x(-1.35 * PI) * Quaternion::rotation_z(-2.0 * PI); }, Some(ToolKind::Shield) => { - next.second.position = Vec3::new(0.0, -4.0, 3.0); + next.second.position = Vec3::new(0.0, -4.5 - skeleton.back_carry_offset, 3.0); next.second.orientation = Quaternion::rotation_y(-0.25 * PI) * Quaternion::rotation_z(1.5 * PI); }, _ => { - next.second.position = Vec3::new(-7.0, -5.0, 15.0); + next.second.position = Vec3::new(-7.0, -5.0 - skeleton.back_carry_offset, 15.0); next.second.orientation = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(PI / 2.0); }, @@ -288,7 +311,7 @@ impl Animation for RunAnimation { match hands { (Some(Hands::One), _) => match active_tool_kind { Some(ToolKind::Axe) | Some(ToolKind::Hammer) | Some(ToolKind::Sword) => { - next.main.position = Vec3::new(-4.0, -5.0, 10.0); + next.main.position = Vec3::new(-4.0, -4.5 - skeleton.back_carry_offset, 10.0); next.main.orientation = Quaternion::rotation_y(2.35) * Quaternion::rotation_z(PI / 2.0); }, @@ -300,7 +323,7 @@ impl Animation for RunAnimation { match hands { (None | Some(Hands::One), Some(Hands::One)) => match second_tool_kind { Some(ToolKind::Axe) | Some(ToolKind::Hammer) | Some(ToolKind::Sword) => { - next.second.position = Vec3::new(4.0, -6.0, 10.0); + next.second.position = Vec3::new(4.0, -5.0 - skeleton.back_carry_offset, 10.0); next.second.orientation = Quaternion::rotation_y(-2.5) * Quaternion::rotation_z(-PI / 2.0); }, diff --git a/voxygen/anim/src/character/stand.rs b/voxygen/anim/src/character/stand.rs index 347f06623e..24f70e64d3 100644 --- a/voxygen/anim/src/character/stand.rs +++ b/voxygen/anim/src/character/stand.rs @@ -111,17 +111,17 @@ impl Animation for StandAnimation { match (hands, active_tool_kind, second_tool_kind) { ((Some(Hands::Two), _), tool, _) | ((None, Some(Hands::Two)), _, tool) => match tool { Some(ToolKind::Bow) => { - next.main.position = Vec3::new(0.0, -5.0, 6.0); + next.main.position = Vec3::new(0.0, -5.0 - skeleton.back_carry_offset, 6.0); next.main.orientation = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(PI / 2.0); }, Some(ToolKind::Staff) | Some(ToolKind::Sceptre) => { - next.main.position = Vec3::new(2.0, -5.0, -1.0); + next.main.position = Vec3::new(2.0, -5.0 - skeleton.back_carry_offset, -1.0); next.main.orientation = Quaternion::rotation_y(-0.5) * Quaternion::rotation_z(PI / 2.0); }, _ => { - next.main.position = Vec3::new(-7.0, -5.0, 15.0); + next.main.position = Vec3::new(-7.0, -5.0 - skeleton.back_carry_offset, 15.0); next.main.orientation = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(PI / 2.0); }, @@ -132,17 +132,17 @@ impl Animation for StandAnimation { match hands { (Some(Hands::One), _) => match active_tool_kind { Some(ToolKind::Dagger) => { - next.main.position = Vec3::new(5.0, 1.0, 2.0); + next.main.position = Vec3::new(5.0, 1.0 - skeleton.back_carry_offset, 2.0); next.main.orientation = Quaternion::rotation_x(-1.35 * PI) * Quaternion::rotation_z(2.0 * PI); }, Some(ToolKind::Axe) | Some(ToolKind::Hammer) | Some(ToolKind::Sword) => { - next.main.position = Vec3::new(-4.0, -5.0, 10.0); + next.main.position = Vec3::new(-4.0, -4.5 - skeleton.back_carry_offset, 10.0); next.main.orientation = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(PI / 2.0); }, Some(ToolKind::Shield) => { - next.main.position = Vec3::new(-0.0, -4.0, 3.0); + next.main.position = Vec3::new(-0.0, -4.0 - skeleton.back_carry_offset, 3.0); next.main.orientation = Quaternion::rotation_y(0.25 * PI) * Quaternion::rotation_z(-1.5 * PI); }, @@ -153,17 +153,17 @@ impl Animation for StandAnimation { match hands { (None | Some(Hands::One), Some(Hands::One)) => match second_tool_kind { Some(ToolKind::Dagger) => { - next.second.position = Vec3::new(-5.0, 1.0, 2.0); + next.second.position = Vec3::new(-5.0, 1.0 - skeleton.back_carry_offset, 2.0); next.second.orientation = Quaternion::rotation_x(-1.35 * PI) * Quaternion::rotation_z(-2.0 * PI); }, Some(ToolKind::Axe) | Some(ToolKind::Hammer) | Some(ToolKind::Sword) => { - next.second.position = Vec3::new(4.0, -6.0, 10.0); + next.second.position = Vec3::new(4.0, -5.0 - skeleton.back_carry_offset, 10.0); next.second.orientation = Quaternion::rotation_y(-2.5) * Quaternion::rotation_z(-PI / 2.0); }, Some(ToolKind::Shield) => { - next.second.position = Vec3::new(0.0, -4.0, 3.0); + next.second.position = Vec3::new(0.0, -4.0 - skeleton.back_carry_offset, 3.0); next.second.orientation = Quaternion::rotation_y(-0.25 * PI) * Quaternion::rotation_z(1.5 * PI); }, diff --git a/voxygen/anim/src/character/wield.rs b/voxygen/anim/src/character/wield.rs index 243db1abfc..6d9dfb7551 100644 --- a/voxygen/anim/src/character/wield.rs +++ b/voxygen/anim/src/character/wield.rs @@ -110,8 +110,8 @@ impl Animation for WieldAnimation { s_a.foot.2 + (tilt * footvertlstatic * 1.0).max(0.0), ); next.foot_l.orientation = Quaternion::rotation_x( - jump * -0.7 + u_slowalt * 0.035 - 0.2 + tilt * footvertlstatic * 0.1 - - tilt.abs() * 0.3, + jump * -0.7 + u_slowalt * 0.035 + tilt * footvertlstatic * 0.1 + - tilt.abs() * 0.3 * speednorm, ) * Quaternion::rotation_z(-tilt * 0.3); next.foot_r.position = Vec3::new( @@ -120,7 +120,8 @@ impl Animation for WieldAnimation { s_a.foot.2 + (tilt * footvertrstatic * 1.0).max(0.0), ); next.foot_r.orientation = Quaternion::rotation_x( - jump * 0.7 + u_slow * 0.035 + tilt * footvertrstatic * 0.1 - tilt.abs() * 0.3, + jump * 0.7 + u_slow * 0.035 + tilt * footvertrstatic * 0.1 + - tilt.abs() * 0.3 * speednorm, ) * Quaternion::rotation_z(-tilt * 0.3); next.chest.orientation = Quaternion::rotation_y(u_slowalt * 0.04) diff --git a/voxygen/anim/src/quadruped_medium/run.rs b/voxygen/anim/src/quadruped_medium/run.rs index 19e7c1e5c2..3fa693d5fb 100644 --- a/voxygen/anim/src/quadruped_medium/run.rs +++ b/voxygen/anim/src/quadruped_medium/run.rs @@ -104,9 +104,9 @@ impl Animation for RunAnimation { //Gallop next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1 + shortalt * -0.2); next.head.orientation = Quaternion::rotation_x( - look.y * 0.3 / ((canceler).max(0.5)) + amplitude * short * 0.05 - 0.1, + look.y * 0.3 / ((canceler).max(0.5)) + amplitude * short * 0.2 - 0.1, ) * Quaternion::rotation_z( - look.x * 0.3 / ((canceler).max(0.5)) + tilt * -1.2, + look.x * 0.3 / ((canceler).max(0.5)) + tilt * -2.0, ) * Quaternion::rotation_y(tilt * 0.8); next.neck.position = Vec3::new(0.0, s_a.neck.0, s_a.neck.1 + shortalt * -0.8); @@ -167,21 +167,21 @@ impl Animation for RunAnimation { next.leg_bl.position = Vec3::new( -s_a.leg_b.0, - s_a.leg_b.1 + amplitude3 * foot3b * -1.1, - s_a.leg_b.2 + amplitude3 * foot3a * 1.1, + s_a.leg_b.1 + amplitude3 * foot3a * -4.5, + s_a.leg_b.2 + amplitude3 * foot3b * -2.2, ); next.leg_bl.orientation = - Quaternion::rotation_x(canceler * -0.2 + amplitude3 * foot3b * -0.55) + Quaternion::rotation_x(canceler * -0.1 + amplitude3 * foot3a * -1.2) * Quaternion::rotation_y(tilt * 1.5) * Quaternion::rotation_z(tilt * -1.5); next.leg_br.position = Vec3::new( s_a.leg_b.0, - s_a.leg_b.1 + amplitude3 * foot4b * -1.1, - s_a.leg_b.2 + amplitude3 * foot4a * 1.1, + s_a.leg_b.1 + amplitude3 * foot4a * -4.5, + s_a.leg_b.2 + amplitude3 * foot4b * -2.2, ); next.leg_br.orientation = - Quaternion::rotation_x(canceler * -0.2 + amplitude3 * foot4b * -0.55) + Quaternion::rotation_x(canceler * -0.1 + amplitude3 * foot4a * -1.2) * Quaternion::rotation_y(tilt * 1.5) * Quaternion::rotation_z(tilt * -1.5); diff --git a/voxygen/anim/src/theropod/run.rs b/voxygen/anim/src/theropod/run.rs index 5e0f4db10e..a30a77e718 100644 --- a/voxygen/anim/src/theropod/run.rs +++ b/voxygen/anim/src/theropod/run.rs @@ -30,7 +30,7 @@ impl Animation for RunAnimation { let mixed_vel = acc_vel + anim_time * 6.0; //sets run frequency using speed, with anim_time setting a floor let speedmult = 1.0; - let lab: f32 = 0.6; //6 + let lab: f32 = 0.45; //6 let short = ((1.0 / (0.72 @@ -120,8 +120,8 @@ impl Animation for RunAnimation { }; next.leg_l.position = Vec3::new( -s_a.leg.0 + speednorm * 1.5, - s_a.leg.1 + foot1b * -1.3, - s_a.leg.2 + foot1a * 1.0, + s_a.leg.1 + foot1b * -2.3, + s_a.leg.2 * 1.5 + foot1a.max(0.0) * 3.0, ); next.leg_l.orientation = Quaternion::rotation_x(-0.2 * speednorm + foot1a * 0.15) * Quaternion::rotation_y(tilt * 0.5) @@ -129,8 +129,8 @@ impl Animation for RunAnimation { next.leg_r.position = Vec3::new( s_a.leg.0 + speednorm * -1.5, - s_a.leg.1 + foot2b * -1.3, - s_a.leg.2 + foot2a * 1.0, + s_a.leg.1 + foot2b * -2.3, + s_a.leg.2 * 1.5 + foot2a.max(0.0) * 3.0, ); next.leg_r.orientation = Quaternion::rotation_x(-0.2 * speednorm + foot2a * 0.15) * Quaternion::rotation_y(tilt * 0.5) @@ -141,17 +141,16 @@ impl Animation for RunAnimation { s_a.foot.1 + foot1b * -2.0, s_a.foot.2 + speednorm * 0.5 + (foot1a * 1.5).max(0.0), ); - next.foot_l.orientation = Quaternion::rotation_x(-0.2 * speednorm + foot1b * -0.35) - * Quaternion::rotation_y(tilt * -1.0) - * Quaternion::rotation_z(tilt * -0.5); + next.foot_l.orientation = + Quaternion::rotation_x(0.2 + foot2b * 0.6) * Quaternion::rotation_y(tilt * -1.0); next.foot_r.position = Vec3::new( s_a.foot.0, s_a.foot.1 + foot2b * -2.0, s_a.foot.2 + speednorm * 0.5 + (foot2a * 1.5).max(0.0), ); - next.foot_r.orientation = Quaternion::rotation_x(-0.2 * speednorm + foot2b * -0.35) - * Quaternion::rotation_y(tilt * -1.0); + next.foot_r.orientation = + Quaternion::rotation_x(0.2 + foot1b * 0.6) * Quaternion::rotation_y(tilt * -1.0); next } diff --git a/voxygen/src/hud/util.rs b/voxygen/src/hud/util.rs index 94e07b1eb7..61ea847b74 100644 --- a/voxygen/src/hud/util.rs +++ b/voxygen/src/hud/util.rs @@ -293,6 +293,7 @@ fn armor_kind<'a>(armor: &Armor, i18n: &'a Localization) -> Cow<'a, str> { ArmorKind::Pants => i18n.get_msg("hud-bag-legs"), ArmorKind::Foot => i18n.get_msg("hud-bag-feet"), ArmorKind::Back => i18n.get_msg("hud-bag-back"), + ArmorKind::Backpack => i18n.get_msg("hud-bag-backpack"), ArmorKind::Ring => i18n.get_msg("hud-bag-ring"), ArmorKind::Neck => i18n.get_msg("hud-bag-neck"), ArmorKind::Head => i18n.get_msg("hud-bag-head"), diff --git a/voxygen/src/scene/figure/mod.rs b/voxygen/src/scene/figure/mod.rs index edb5b3dbef..41617fdd25 100644 --- a/voxygen/src/scene/figure/mod.rs +++ b/voxygen/src/scene/figure/mod.rs @@ -37,8 +37,9 @@ use anim::{ use common::{ comp::{ inventory::slot::EquipSlot, - item::{Hands, ItemKind, ToolKind}, + item::{armor::ArmorKind, Hands, ItemKind, ToolKind}, ship::{self, figuredata::VOXEL_COLLIDER_MANIFEST}, + slot::ArmorSlot, Body, CharacterActivity, CharacterState, Collider, Controller, Health, Inventory, Item, ItemKey, Last, LightAnimation, LightEmitter, Object, Ori, PhysicsState, PoiseState, Pos, Scale, Vel, @@ -1107,6 +1108,21 @@ impl FigureMgr { && !character.map_or(false, |c| c.is_using_hands()) && physics.in_liquid().is_none(); + let back_carry_offset = inventory + .and_then(|i| i.equipped(EquipSlot::Armor(ArmorSlot::Back))) + .and_then(|i| { + if let ItemKind::Armor(armor) = i.kind().as_ref() { + match &armor.kind { + ArmorKind::Backpack => Some(4.0), + ArmorKind::Back => Some(1.5), + _ => None, + } + } else { + None + } + }) + .unwrap_or(0.0); + let state = self .states .character_states @@ -1114,7 +1130,7 @@ impl FigureMgr { .or_insert_with(|| { FigureState::new( renderer, - CharacterSkeleton::new(holding_lantern), + CharacterSkeleton::new(holding_lantern, back_carry_offset), body, ) }); @@ -1141,7 +1157,7 @@ impl FigureMgr { // Standing or Skating (true, false, false, false, _) | (_, _, false, false, true) => { anim::character::StandAnimation::update_skeleton( - &CharacterSkeleton::new(holding_lantern), + &CharacterSkeleton::new(holding_lantern, back_carry_offset), ( active_tool_kind, second_tool_kind, @@ -1160,7 +1176,7 @@ impl FigureMgr { // Running (true, true, false, false, _) => { anim::character::RunAnimation::update_skeleton( - &CharacterSkeleton::new(holding_lantern), + &CharacterSkeleton::new(holding_lantern, back_carry_offset), ( active_tool_kind, second_tool_kind, @@ -1182,7 +1198,7 @@ impl FigureMgr { // In air (false, _, false, false, _) => { anim::character::JumpAnimation::update_skeleton( - &CharacterSkeleton::new(holding_lantern), + &CharacterSkeleton::new(holding_lantern, back_carry_offset), ( active_tool_kind, second_tool_kind, @@ -1200,7 +1216,7 @@ impl FigureMgr { }, // Swim (_, _, true, false, _) => anim::character::SwimAnimation::update_skeleton( - &CharacterSkeleton::new(holding_lantern), + &CharacterSkeleton::new(holding_lantern, back_carry_offset), ( active_tool_kind, second_tool_kind, @@ -1218,7 +1234,7 @@ impl FigureMgr { ), // Mount (_, _, _, true, _) => anim::character::MountAnimation::update_skeleton( - &CharacterSkeleton::new(holding_lantern), + &CharacterSkeleton::new(holding_lantern, back_carry_offset), ( active_tool_kind, second_tool_kind,