mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch 'zesterer/backpack-fixes' into 'master'
Make backpacks distinct ArmorKinds, fix visual offsets of carried weapons See merge request veloren/veloren!4131
This commit is contained in:
commit
32b0b33abe
@ -41,7 +41,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
- Deflect no longer parry melee hits
|
- Deflect no longer parry melee hits
|
||||||
- Changed recipes for some bags to make them more horizontal
|
- Changed recipes for some bags to make them more horizontal
|
||||||
- Increase invetory slots on some bags to improve early game experience
|
- Increase invetory slots on some bags to improve early game experience
|
||||||
|
|
||||||
- Made helmets, necklaces, rings, twig armors and some gliders salvageable
|
- Made helmets, necklaces, rings, twig armors and some gliders salvageable
|
||||||
- Tweaked stats on some foods so they generally increase a tiny bit more HP
|
- Tweaked stats on some foods so they generally increase a tiny bit more HP
|
||||||
- Reduced idle time after consumption from 5 to 4 seconds
|
- 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
|
- Chat command responses sent by the server can now be localized
|
||||||
- Frost Gigas spawns in cold areas (but isn't forced to stay there)
|
- Frost Gigas spawns in cold areas (but isn't forced to stay there)
|
||||||
- The ability limit for non-humanoids has been removed
|
- 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
|
### Removed
|
||||||
- Medium and large potions from all loot tables
|
- Medium and large potions from all loot tables
|
||||||
|
@ -2,7 +2,7 @@ ItemDef(
|
|||||||
name: "Merchant Backpack",
|
name: "Merchant Backpack",
|
||||||
description: "",
|
description: "",
|
||||||
kind: Armor((
|
kind: Armor((
|
||||||
kind: Back,
|
kind: Backpack,
|
||||||
stats: FromSet("Merchant"),
|
stats: FromSet("Merchant"),
|
||||||
)),
|
)),
|
||||||
quality: High,
|
quality: High,
|
||||||
|
@ -2,7 +2,7 @@ ItemDef(
|
|||||||
name: "Miner's Backpack",
|
name: "Miner's Backpack",
|
||||||
description: "Battered from heavy rocks being carried inside.",
|
description: "Battered from heavy rocks being carried inside.",
|
||||||
kind: Armor((
|
kind: Armor((
|
||||||
kind: Back,
|
kind: Backpack,
|
||||||
stats: FromSet("Miner"),
|
stats: FromSet("Miner"),
|
||||||
)),
|
)),
|
||||||
quality: High,
|
quality: High,
|
||||||
|
@ -2,7 +2,7 @@ ItemDef(
|
|||||||
name: "Traveler's Backpack",
|
name: "Traveler's Backpack",
|
||||||
description: "Comfortable and with enough capacity, its a hoarder's best friend.",
|
description: "Comfortable and with enough capacity, its a hoarder's best friend.",
|
||||||
kind: Armor((
|
kind: Armor((
|
||||||
kind: Back,
|
kind: Backpack,
|
||||||
stats: Direct((
|
stats: Direct((
|
||||||
)),
|
)),
|
||||||
)),
|
)),
|
||||||
|
@ -2,7 +2,7 @@ ItemDef(
|
|||||||
name: "Rugged Backpack",
|
name: "Rugged Backpack",
|
||||||
description: "Keeps all your stuff together.",
|
description: "Keeps all your stuff together.",
|
||||||
kind: Armor((
|
kind: Armor((
|
||||||
kind: Back,
|
kind: Backpack,
|
||||||
stats: Direct((
|
stats: Direct((
|
||||||
protection: Some(Normal(0.0)),
|
protection: Some(Normal(0.0)),
|
||||||
poise_resilience: Some(Normal(0.0)),
|
poise_resilience: Some(Normal(0.0)),
|
||||||
|
@ -14,6 +14,7 @@ hud-bag-glider = Glider
|
|||||||
hud-bag-belt = Belt
|
hud-bag-belt = Belt
|
||||||
hud-bag-ring = Ring
|
hud-bag-ring = Ring
|
||||||
hud-bag-back = Back
|
hud-bag-back = Back
|
||||||
|
hud-bag-backpack = Backpack
|
||||||
hud-bag-legs = Legs
|
hud-bag-legs = Legs
|
||||||
hud-bag-feet = Feet
|
hud-bag-feet = Feet
|
||||||
hud-bag-mainhand = Mainhand
|
hud-bag-mainhand = Mainhand
|
||||||
|
@ -149,7 +149,7 @@
|
|||||||
color: None
|
color: None
|
||||||
),
|
),
|
||||||
"common.items.armor.merchant.back": (
|
"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
|
color: None
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
@ -203,6 +203,7 @@ fn get_armor_kind(kind: &ArmorKind) -> String {
|
|||||||
ArmorKind::Pants => "Pants".to_string(),
|
ArmorKind::Pants => "Pants".to_string(),
|
||||||
ArmorKind::Foot => "Foot".to_string(),
|
ArmorKind::Foot => "Foot".to_string(),
|
||||||
ArmorKind::Back => "Back".to_string(),
|
ArmorKind::Back => "Back".to_string(),
|
||||||
|
ArmorKind::Backpack => "Backpack".to_string(),
|
||||||
ArmorKind::Ring => "Ring".to_string(),
|
ArmorKind::Ring => "Ring".to_string(),
|
||||||
ArmorKind::Neck => "Neck".to_string(),
|
ArmorKind::Neck => "Neck".to_string(),
|
||||||
ArmorKind::Head => "Head".to_string(),
|
ArmorKind::Head => "Head".to_string(),
|
||||||
|
@ -75,6 +75,7 @@ impl From<&Item> for Body {
|
|||||||
ArmorKind::Pants => Body::Armor(ItemDropArmorKind::Pants),
|
ArmorKind::Pants => Body::Armor(ItemDropArmorKind::Pants),
|
||||||
ArmorKind::Foot => Body::Armor(ItemDropArmorKind::Foot),
|
ArmorKind::Foot => Body::Armor(ItemDropArmorKind::Foot),
|
||||||
ArmorKind::Back => Body::Armor(ItemDropArmorKind::Back),
|
ArmorKind::Back => Body::Armor(ItemDropArmorKind::Back),
|
||||||
|
ArmorKind::Backpack => Body::Armor(ItemDropArmorKind::Back),
|
||||||
ArmorKind::Ring => Body::Armor(ItemDropArmorKind::Ring),
|
ArmorKind::Ring => Body::Armor(ItemDropArmorKind::Ring),
|
||||||
ArmorKind::Neck => Body::Armor(ItemDropArmorKind::Neck),
|
ArmorKind::Neck => Body::Armor(ItemDropArmorKind::Neck),
|
||||||
ArmorKind::Head => Body::Armor(ItemDropArmorKind::Head),
|
ArmorKind::Head => Body::Armor(ItemDropArmorKind::Head),
|
||||||
|
@ -23,6 +23,7 @@ pub enum ArmorKind {
|
|||||||
Head,
|
Head,
|
||||||
Tabard,
|
Tabard,
|
||||||
Bag,
|
Bag,
|
||||||
|
Backpack,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ArmorKind {
|
impl ArmorKind {
|
||||||
@ -35,6 +36,7 @@ impl ArmorKind {
|
|||||||
ArmorKind::Pants => true,
|
ArmorKind::Pants => true,
|
||||||
ArmorKind::Foot => true,
|
ArmorKind::Foot => true,
|
||||||
ArmorKind::Back => true,
|
ArmorKind::Back => true,
|
||||||
|
ArmorKind::Backpack => true,
|
||||||
ArmorKind::Ring => false,
|
ArmorKind::Ring => false,
|
||||||
ArmorKind::Neck => false,
|
ArmorKind::Neck => false,
|
||||||
ArmorKind::Head => true,
|
ArmorKind::Head => true,
|
||||||
@ -252,6 +254,7 @@ impl Armor {
|
|||||||
ArmorKind::Pants => 2.0,
|
ArmorKind::Pants => 2.0,
|
||||||
ArmorKind::Foot => 1.0,
|
ArmorKind::Foot => 1.0,
|
||||||
ArmorKind::Back => 0.5,
|
ArmorKind::Back => 0.5,
|
||||||
|
ArmorKind::Backpack => 0.0,
|
||||||
ArmorKind::Ring => 0.0,
|
ArmorKind::Ring => 0.0,
|
||||||
ArmorKind::Neck => 0.0,
|
ArmorKind::Neck => 0.0,
|
||||||
ArmorKind::Head => 0.0,
|
ArmorKind::Head => 0.0,
|
||||||
|
@ -142,6 +142,7 @@ impl ArmorSlot {
|
|||||||
| (Self::Ring1, ArmorKind::Ring)
|
| (Self::Ring1, ArmorKind::Ring)
|
||||||
| (Self::Ring2, ArmorKind::Ring)
|
| (Self::Ring2, ArmorKind::Ring)
|
||||||
| (Self::Back, ArmorKind::Back)
|
| (Self::Back, ArmorKind::Back)
|
||||||
|
| (Self::Back, ArmorKind::Backpack)
|
||||||
| (Self::Belt, ArmorKind::Belt)
|
| (Self::Belt, ArmorKind::Belt)
|
||||||
| (Self::Legs, ArmorKind::Pants)
|
| (Self::Legs, ArmorKind::Pants)
|
||||||
| (Self::Feet, ArmorKind::Foot)
|
| (Self::Feet, ArmorKind::Foot)
|
||||||
|
@ -29,7 +29,7 @@ impl Animation for RunAnimation {
|
|||||||
let speednorm = (speed / 13.0).powf(0.25);
|
let speednorm = (speed / 13.0).powf(0.25);
|
||||||
|
|
||||||
let speedmult = 0.8;
|
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
|
// acc_vel and anim_time mix to make sure phase lenght isn't starting at
|
||||||
// +infinite
|
// +infinite
|
||||||
@ -92,18 +92,18 @@ impl Animation for RunAnimation {
|
|||||||
next.foot_l.position = Vec3::new(
|
next.foot_l.position = Vec3::new(
|
||||||
-s_a.foot.0,
|
-s_a.foot.0,
|
||||||
s_a.foot.1 + foot1b * -1.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_y(tilt * -1.0)
|
||||||
* Quaternion::rotation_z(tilt * -0.5);
|
* Quaternion::rotation_z(tilt * -0.5);
|
||||||
|
|
||||||
next.foot_r.position = Vec3::new(
|
next.foot_r.position = Vec3::new(
|
||||||
s_a.foot.0,
|
s_a.foot.0,
|
||||||
s_a.foot.1 + foot2b * -1.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_y(tilt * -1.0)
|
||||||
* Quaternion::rotation_z(tilt * -0.5);
|
* 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.chest.1 + short * 0.5 + x_tilt * 10.0 + speednorm * -2.0,
|
||||||
) * s_a.scaler;
|
) * s_a.scaler;
|
||||||
next.chest.orientation = Quaternion::rotation_x(-0.1 + short * 0.07 + x_tilt)
|
next.chest.orientation = Quaternion::rotation_x(-0.1 + short * 0.07 + x_tilt)
|
||||||
* Quaternion::rotation_y(tilt * 0.8)
|
* Quaternion::rotation_y(tilt * 0.8 - shortalt * 0.2)
|
||||||
* Quaternion::rotation_z(shortalt * 0.10);
|
* 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.position = Vec3::new(0.0, s_a.tail_front.0, s_a.tail_front.1);
|
||||||
next.tail_front.orientation =
|
next.tail_front.orientation = Quaternion::rotation_x(0.3 + short * -0.02)
|
||||||
Quaternion::rotation_x(0.3 + short * -0.02) * Quaternion::rotation_z(tilt * 2.0);
|
* 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.position = Vec3::new(0.0, s_a.tail_rear.0, s_a.tail_rear.1);
|
||||||
next.tail_rear.orientation =
|
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)
|
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);
|
* Quaternion::rotation_z(0.2 + foot2a * 0.6);
|
||||||
next.wing_in_r.orientation = Quaternion::rotation_x(foot1a * -0.05 + speednorm * -0.3)
|
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);
|
* 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);
|
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(
|
next.leg_l.position = Vec3::new(
|
||||||
-s_a.leg.0,
|
-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,
|
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);
|
* Quaternion::rotation_y(tilt * 0.5);
|
||||||
|
|
||||||
next.leg_r.position = Vec3::new(
|
next.leg_r.position = Vec3::new(
|
||||||
s_a.leg.0,
|
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,
|
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);
|
* Quaternion::rotation_y(tilt * 0.5);
|
||||||
} else {
|
} else {
|
||||||
next.chest.position = Vec3::new(
|
next.chest.position = Vec3::new(
|
||||||
@ -180,9 +183,12 @@ impl Animation for RunAnimation {
|
|||||||
s_a.chest.0,
|
s_a.chest.0,
|
||||||
s_a.chest.1 + short * 0.5 + x_tilt * 10.0 + 0.5 * speednorm,
|
s_a.chest.1 + short * 0.5 + x_tilt * 10.0 + 0.5 * speednorm,
|
||||||
) * s_a.scaler;
|
) * s_a.scaler;
|
||||||
next.chest.orientation = Quaternion::rotation_x(short * 0.07 + x_tilt)
|
next.chest.orientation =
|
||||||
* Quaternion::rotation_y(tilt * 0.8)
|
Quaternion::rotation_x(short * 0.07 + x_tilt + foot1b.max(foot2b) * 0.2)
|
||||||
* Quaternion::rotation_z(shortalt * 0.10);
|
* 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.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);
|
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 =
|
next.wing_out_r.orientation =
|
||||||
Quaternion::rotation_y(0.2 + short * -0.05) * Quaternion::rotation_z(-0.2);
|
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.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.15)
|
next.leg_l.orientation = Quaternion::rotation_x(-0.2 * speednorm + foot1a * 0.1)
|
||||||
* Quaternion::rotation_y(tilt * 0.5);
|
* 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.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.15)
|
next.leg_r.orientation = Quaternion::rotation_x(-0.2 * speednorm + foot2a * 0.1)
|
||||||
* Quaternion::rotation_y(tilt * 0.5);
|
* Quaternion::rotation_y(tilt * 0.5 - (foot2a + 1.0) * 0.15);
|
||||||
}
|
}
|
||||||
next
|
next
|
||||||
}
|
}
|
||||||
|
@ -26,10 +26,10 @@ impl Animation for RunAnimation {
|
|||||||
*rate = 1.0;
|
*rate = 1.0;
|
||||||
|
|
||||||
//let speednorm = speed / 13.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 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
|
// acc_vel and anim_time mix to make sure phase lenght isn't starting at
|
||||||
// +infinite
|
// +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.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)
|
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);
|
* Quaternion::rotation_z(shortalt * -0.05 - tilt * 1.5);
|
||||||
|
|
||||||
next.chest.position = Vec3::new(
|
next.chest.position = Vec3::new(
|
||||||
0.0,
|
0.0,
|
||||||
s_a.chest.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;
|
) * s_a.scaler;
|
||||||
next.chest.orientation = Quaternion::rotation_x(short * 0.07 + x_tilt)
|
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);
|
* Quaternion::rotation_z(shortalt * 0.10);
|
||||||
|
|
||||||
next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1);
|
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 =
|
next.wing_out_r.orientation =
|
||||||
Quaternion::rotation_y(0.2 + short * -0.05) * Quaternion::rotation_z(-0.2);
|
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.position = Vec3::new(
|
||||||
next.leg_l.orientation = Quaternion::rotation_x(-0.2 * speednorm + foot1a * 0.15)
|
-s_a.leg.0,
|
||||||
* Quaternion::rotation_y(tilt * 0.5);
|
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.position = Vec3::new(
|
||||||
next.leg_r.orientation = Quaternion::rotation_x(-0.2 * speednorm + foot2a * 0.15)
|
s_a.leg.0,
|
||||||
* Quaternion::rotation_y(tilt * 0.5);
|
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
|
next
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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);
|
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.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 =
|
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);
|
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);
|
next.hand_r.orientation = Quaternion::rotation_x(3.35) * Quaternion::rotation_y(-0.2);
|
||||||
|
@ -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.position = Vec3::new(0.0, s_a.shorts.0, s_a.shorts.1);
|
||||||
next.shorts.orientation = Quaternion::rotation_z(-speedlog + slow * 0.15);
|
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 =
|
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);
|
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.hand_l.orientation = Quaternion::rotation_x(3.35) * Quaternion::rotation_y(0.2);
|
||||||
|
@ -89,17 +89,17 @@ impl Animation for IdleAnimation {
|
|||||||
match hands {
|
match hands {
|
||||||
(Some(Hands::Two), _) | (None, Some(Hands::Two)) => match active_tool_kind {
|
(Some(Hands::Two), _) | (None, Some(Hands::Two)) => match active_tool_kind {
|
||||||
Some(ToolKind::Bow) => {
|
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 =
|
next.main.orientation =
|
||||||
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(PI / 2.0);
|
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(PI / 2.0);
|
||||||
},
|
},
|
||||||
Some(ToolKind::Staff) | Some(ToolKind::Sceptre) => {
|
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 =
|
next.main.orientation =
|
||||||
Quaternion::rotation_y(-0.5) * Quaternion::rotation_z(PI / 2.0);
|
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 =
|
next.main.orientation =
|
||||||
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(PI / 2.0);
|
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(PI / 2.0);
|
||||||
},
|
},
|
||||||
@ -110,12 +110,12 @@ impl Animation for IdleAnimation {
|
|||||||
match hands {
|
match hands {
|
||||||
(Some(Hands::One), _) => match active_tool_kind {
|
(Some(Hands::One), _) => match active_tool_kind {
|
||||||
Some(ToolKind::Dagger) => {
|
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 =
|
next.main.orientation =
|
||||||
Quaternion::rotation_x(-1.35 * PI) * Quaternion::rotation_z(2.0 * PI);
|
Quaternion::rotation_x(-1.35 * PI) * Quaternion::rotation_z(2.0 * PI);
|
||||||
},
|
},
|
||||||
Some(ToolKind::Axe) | Some(ToolKind::Hammer) | Some(ToolKind::Sword) => {
|
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 =
|
next.main.orientation =
|
||||||
Quaternion::rotation_y(2.35) * Quaternion::rotation_z(PI / 2.0);
|
Quaternion::rotation_y(2.35) * Quaternion::rotation_z(PI / 2.0);
|
||||||
},
|
},
|
||||||
@ -127,12 +127,12 @@ impl Animation for IdleAnimation {
|
|||||||
match hands {
|
match hands {
|
||||||
(None | Some(Hands::One), Some(Hands::One)) => match second_tool_kind {
|
(None | Some(Hands::One), Some(Hands::One)) => match second_tool_kind {
|
||||||
Some(ToolKind::Dagger) => {
|
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 =
|
next.second.orientation =
|
||||||
Quaternion::rotation_x(-1.35 * PI) * Quaternion::rotation_z(-2.0 * PI);
|
Quaternion::rotation_x(-1.35 * PI) * Quaternion::rotation_z(-2.0 * PI);
|
||||||
},
|
},
|
||||||
Some(ToolKind::Axe) | Some(ToolKind::Hammer) | Some(ToolKind::Sword) => {
|
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 =
|
next.second.orientation =
|
||||||
Quaternion::rotation_y(-2.5) * Quaternion::rotation_z(-PI / 2.0);
|
Quaternion::rotation_y(-2.5) * Quaternion::rotation_z(-PI / 2.0);
|
||||||
},
|
},
|
||||||
|
@ -144,27 +144,27 @@ impl Animation for JumpAnimation {
|
|||||||
|
|
||||||
match main_tool {
|
match main_tool {
|
||||||
Some(ToolKind::Dagger) => {
|
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 =
|
next.main.orientation =
|
||||||
Quaternion::rotation_x(-1.35 * PI) * Quaternion::rotation_z(2.0 * PI);
|
Quaternion::rotation_x(-1.35 * PI) * Quaternion::rotation_z(2.0 * PI);
|
||||||
},
|
},
|
||||||
Some(ToolKind::Shield) => {
|
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 =
|
next.main.orientation =
|
||||||
Quaternion::rotation_y(0.25 * PI) * Quaternion::rotation_z(-1.5 * PI);
|
Quaternion::rotation_y(0.25 * PI) * Quaternion::rotation_z(-1.5 * PI);
|
||||||
},
|
},
|
||||||
Some(ToolKind::Staff) | Some(ToolKind::Sceptre) => {
|
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 =
|
next.main.orientation =
|
||||||
Quaternion::rotation_y(-0.5) * Quaternion::rotation_z(PI / 2.0);
|
Quaternion::rotation_y(-0.5) * Quaternion::rotation_z(PI / 2.0);
|
||||||
},
|
},
|
||||||
Some(ToolKind::Bow) => {
|
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 =
|
next.main.orientation =
|
||||||
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(PI / 2.0);
|
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 =
|
next.main.orientation =
|
||||||
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(PI / 2.0);
|
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(PI / 2.0);
|
||||||
},
|
},
|
||||||
@ -172,18 +172,18 @@ impl Animation for JumpAnimation {
|
|||||||
|
|
||||||
match second_tool_kind {
|
match second_tool_kind {
|
||||||
Some(ToolKind::Dagger) => {
|
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 =
|
next.second.orientation =
|
||||||
Quaternion::rotation_x(-1.35 * PI) * Quaternion::rotation_z(-2.0 * PI);
|
Quaternion::rotation_x(-1.35 * PI) * Quaternion::rotation_z(-2.0 * PI);
|
||||||
},
|
},
|
||||||
Some(ToolKind::Shield) => {
|
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 =
|
next.second.orientation =
|
||||||
Quaternion::rotation_y(-0.25 * PI) * Quaternion::rotation_z(1.5 * PI);
|
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 =
|
next.second.orientation =
|
||||||
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(PI / 2.0);
|
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(PI / 2.0);
|
||||||
},
|
},
|
||||||
@ -211,7 +211,7 @@ impl Animation for JumpAnimation {
|
|||||||
match hands {
|
match hands {
|
||||||
(Some(Hands::One), _) => match active_tool_kind {
|
(Some(Hands::One), _) => match active_tool_kind {
|
||||||
Some(ToolKind::Axe) | Some(ToolKind::Hammer) | Some(ToolKind::Sword) => {
|
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 =
|
next.main.orientation =
|
||||||
Quaternion::rotation_y(2.35) * Quaternion::rotation_z(PI / 2.0);
|
Quaternion::rotation_y(2.35) * Quaternion::rotation_z(PI / 2.0);
|
||||||
},
|
},
|
||||||
@ -223,7 +223,7 @@ impl Animation for JumpAnimation {
|
|||||||
match hands {
|
match hands {
|
||||||
(None | Some(Hands::One), Some(Hands::One)) => match second_tool_kind {
|
(None | Some(Hands::One), Some(Hands::One)) => match second_tool_kind {
|
||||||
Some(ToolKind::Axe) | Some(ToolKind::Hammer) | Some(ToolKind::Sword) => {
|
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 =
|
next.second.orientation =
|
||||||
Quaternion::rotation_y(-2.5) * Quaternion::rotation_z(-PI / 2.0);
|
Quaternion::rotation_y(-2.5) * Quaternion::rotation_z(-PI / 2.0);
|
||||||
},
|
},
|
||||||
|
@ -86,6 +86,8 @@ skeleton_impls!(struct CharacterSkeleton {
|
|||||||
control_r,
|
control_r,
|
||||||
:: // Begin non-bone fields
|
:: // Begin non-bone fields
|
||||||
holding_lantern: bool,
|
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,
|
main_weapon_trail: bool,
|
||||||
off_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.
|
// 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 {
|
impl CharacterSkeleton {
|
||||||
pub fn new(holding_lantern: bool) -> Self {
|
pub fn new(holding_lantern: bool, back_carry_offset: f32) -> Self {
|
||||||
Self {
|
Self {
|
||||||
holding_lantern,
|
holding_lantern,
|
||||||
|
back_carry_offset,
|
||||||
..Self::default()
|
..Self::default()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -211,22 +211,38 @@ impl Animation for RollAnimation {
|
|||||||
s_a.hand.1 + 1.0 * movement1,
|
s_a.hand.1 + 1.0 * movement1,
|
||||||
s_a.hand.2 + 2.0 * movement1,
|
s_a.hand.2 + 2.0 * movement1,
|
||||||
);
|
);
|
||||||
|
|
||||||
next.hand_l.orientation = Quaternion::rotation_x(0.6 * movement1);
|
next.hand_l.orientation = Quaternion::rotation_x(0.6 * movement1);
|
||||||
|
|
||||||
next.hand_r.position = Vec3::new(
|
next.hand_r.position = if prev_aimed_dir.is_some() {
|
||||||
|
Vec3::new(
|
||||||
-1.0 * movement1 + s_a.hand.0,
|
-1.0 * movement1 + s_a.hand.0,
|
||||||
s_a.hand.1 + 1.0 * movement1,
|
s_a.hand.1 + 1.0 * movement1,
|
||||||
s_a.hand.2 + 2.0 * movement1,
|
s_a.hand.2 + 2.0 * movement1,
|
||||||
);
|
)
|
||||||
next.hand_r.orientation = Quaternion::rotation_x(0.6 * 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(
|
next.head.position = Vec3::new(
|
||||||
0.0,
|
0.0,
|
||||||
s_a.head.0 + 1.5 * movement1,
|
s_a.head.0 + 1.5 * movement1,
|
||||||
s_a.head.1 - 1.0 * 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.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);
|
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.shorts.orientation = Quaternion::rotation_x(0.8 * movement1);
|
||||||
|
|
||||||
next.foot_l.position = Vec3::new(
|
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.1 + 5.5 * movement1,
|
||||||
s_a.foot.2 - 5.0 * movement1,
|
s_a.foot.2 - 5.0 * movement1,
|
||||||
);
|
);
|
||||||
next.foot_l.orientation = Quaternion::rotation_x(0.9 * movement1);
|
next.foot_l.orientation = Quaternion::rotation_x(0.9 * movement1);
|
||||||
|
|
||||||
next.foot_r.position = Vec3::new(
|
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.1 + 5.5 * movement1,
|
||||||
s_a.foot.2 - 5.0 * movement1,
|
s_a.foot.2 - 5.0 * movement1,
|
||||||
);
|
);
|
||||||
next.foot_r.orientation = Quaternion::rotation_x(0.9 * 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);
|
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 {
|
next.torso.orientation = if let Some(prev_aimed_dir) = prev_aimed_dir {
|
||||||
// This is *slightly* hacky. Because rolling is not strafed movement, we
|
// This is *slightly* hacky. Because rolling is not strafed movement, we
|
||||||
@ -278,7 +306,7 @@ impl Animation for RollAnimation {
|
|||||||
})
|
})
|
||||||
.unwrap_or_default()
|
.unwrap_or_default()
|
||||||
} else {
|
} else {
|
||||||
roll_spin * Quaternion::rotation_z(tilt * -10.0)
|
roll_spin * Quaternion::rotation_z(tilt * -10.0) * Quaternion::rotation_y(-0.6)
|
||||||
};
|
};
|
||||||
|
|
||||||
next
|
next
|
||||||
|
@ -52,9 +52,9 @@ impl Animation for RunAnimation {
|
|||||||
let speed = Vec2::<f32>::from(velocity).magnitude();
|
let speed = Vec2::<f32>::from(velocity).magnitude();
|
||||||
*rate = 1.0;
|
*rate = 1.0;
|
||||||
let impact = (avg_vel.z).max(-8.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)))
|
let footrotl = ((1.0 / (0.5 + (0.5) * ((acc_vel * 1.6 * lab + PI * 1.4).sin()).powi(2)))
|
||||||
.sqrt())
|
.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())
|
let shorte = ((1.0 / (0.8 + 0.2 * ((acc_vel * lab * 1.6).sin()).powi(2))).sqrt())
|
||||||
* ((acc_vel * lab * 1.6).sin());
|
* ((acc_vel * lab * 1.6).sin());
|
||||||
|
|
||||||
let foothoril = (acc_vel * 1.6 * lab + PI * 1.45).sin();
|
let back_speed = 2.6;
|
||||||
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 footvertl = (acc_vel * 1.6 * lab).sin();
|
let dirside = orientation.xy().dot(velocity.xy()).signum();
|
||||||
let footvertr = (acc_vel * 1.6 * lab + PI).sin();
|
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 footvertsl = (acc_vel * 1.6 * lab).sin();
|
||||||
let footvertsr = (acc_vel * 1.6 * lab + PI * 0.5).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())
|
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());
|
* ((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 =
|
let side =
|
||||||
(velocity.x * -0.098 * orientation.y + velocity.y * 0.098 * orientation.x) * -1.0;
|
(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(
|
next.hand_l.position = Vec3::new(
|
||||||
-s_a.hand.0 * 1.2 - foothorir * 1.3 * speednorm
|
-s_a.hand.0 * 1.2 - foothorir * 1.3 * speednorm
|
||||||
+ (foothoril.abs().powf(2.0) - 0.5) * speednorm * 4.0,
|
+ (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,
|
s_a.hand.2 - foothorir * 2.75 * speednorm + foothoril.abs().powf(3.0) * speednorm * 8.0,
|
||||||
);
|
);
|
||||||
next.hand_l.orientation =
|
next.hand_l.orientation =
|
||||||
Quaternion::rotation_x(0.6 * speednorm + (footrotr * -1.5 + 0.5) * speednorm)
|
Quaternion::rotation_x(
|
||||||
* Quaternion::rotation_y(footrotr * 0.4 * speednorm + PI * 0.07);
|
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(
|
next.hand_r.position = Vec3::new(
|
||||||
s_a.hand.0 * 1.2 + foothoril * 1.3 * speednorm
|
s_a.hand.0 * 1.2 + foothoril * 1.3 * speednorm
|
||||||
- (foothorir.abs().powf(2.0) - 0.5) * speednorm * 4.0,
|
- (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,
|
s_a.hand.2 - foothoril * 2.75 * speednorm + foothorir.abs().powf(3.0) * speednorm * 8.0,
|
||||||
);
|
);
|
||||||
next.hand_r.orientation =
|
next.hand_r.orientation =
|
||||||
Quaternion::rotation_x(0.6 * speednorm + (footrotl * -1.5 + 0.5) * speednorm)
|
Quaternion::rotation_x(
|
||||||
* Quaternion::rotation_y(footrotl * -0.4 * speednorm - PI * 0.07);
|
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(
|
next.foot_l.position = Vec3::new(
|
||||||
-s_a.foot.0 + footstrafel * sideabs * 3.0 + tilt * -10.0,
|
-s_a.foot.0 + footstrafel * sideabs * 7.0 + tilt * -10.0,
|
||||||
s_a.foot.1
|
s_a.foot.1 + (1.0 - sideabs) * (-0.5 * speednorm + foothoril * -10.5 * speednorm),
|
||||||
+ (1.0 - sideabs) * (-0.5 * speednorm + foothoril * -10.5 * speednorm)
|
|
||||||
+ (direction * 5.0).max(0.0),
|
|
||||||
s_a.foot.2
|
s_a.foot.2
|
||||||
+ (1.0 - sideabs) * (1.25 * speednorm + ((footvertl * -5.0 * speednorm).max(-1.0)))
|
+ (1.0 - sideabs) * (1.25 * speednorm + ((footvertl * -5.0 * speednorm).max(-1.0)))
|
||||||
+ side * ((footvertsl * 1.5).max(-1.0))
|
+ side * ((footvertsl * 1.5).max(-1.0)),
|
||||||
+ foothoril.abs().powf(6.0) * speednorm * 5.0,
|
|
||||||
);
|
);
|
||||||
next.foot_l.orientation = Quaternion::rotation_x(
|
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(
|
) * Quaternion::rotation_y(
|
||||||
tilt * -0.5 + side * 0.3 + side * (foothoril * 0.3),
|
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(
|
next.foot_r.position = Vec3::new(
|
||||||
s_a.foot.0 + footstrafer * sideabs * 3.0 + tilt * -10.0,
|
s_a.foot.0 + footstrafer * sideabs * 7.0 + tilt * -10.0,
|
||||||
s_a.foot.1
|
s_a.foot.1 + (1.0 - sideabs) * (-0.5 * speednorm + foothorir * -10.5 * speednorm),
|
||||||
+ (1.0 - sideabs) * (-0.5 * speednorm + foothorir * -10.5 * speednorm)
|
|
||||||
+ (direction * 5.0).max(0.0),
|
|
||||||
s_a.foot.2
|
s_a.foot.2
|
||||||
+ (1.0 - sideabs) * (1.25 * speednorm + ((footvertr * -5.0 * speednorm).max(-1.0)))
|
+ (1.0 - sideabs) * (1.25 * speednorm + ((footvertr * -5.0 * speednorm).max(-1.0)))
|
||||||
+ side * ((footvertsr * -1.5).max(-1.0))
|
+ side * ((footvertsr * -1.5).max(-1.0)),
|
||||||
+ foothorir.abs().powf(6.0) * speednorm * 5.0,
|
|
||||||
);
|
);
|
||||||
next.foot_r.orientation = Quaternion::rotation_x(
|
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(
|
) * Quaternion::rotation_y(
|
||||||
tilt * -0.5 + side * 0.3 + side * (foothorir * 0.3),
|
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);
|
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 {
|
match main_tool {
|
||||||
Some(ToolKind::Dagger) => {
|
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 =
|
next.main.orientation =
|
||||||
Quaternion::rotation_x(-1.35 * PI) * Quaternion::rotation_z(2.0 * PI);
|
Quaternion::rotation_x(-1.35 * PI) * Quaternion::rotation_z(2.0 * PI);
|
||||||
},
|
},
|
||||||
Some(ToolKind::Shield) => {
|
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 =
|
next.main.orientation =
|
||||||
Quaternion::rotation_y(0.25 * PI) * Quaternion::rotation_z(-1.5 * PI);
|
Quaternion::rotation_y(0.25 * PI) * Quaternion::rotation_z(-1.5 * PI);
|
||||||
},
|
},
|
||||||
Some(ToolKind::Staff) | Some(ToolKind::Sceptre) => {
|
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 =
|
next.main.orientation =
|
||||||
Quaternion::rotation_y(-0.5) * Quaternion::rotation_z(PI / 2.0);
|
Quaternion::rotation_y(-0.5) * Quaternion::rotation_z(PI / 2.0);
|
||||||
},
|
},
|
||||||
Some(ToolKind::Bow) => {
|
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 =
|
next.main.orientation =
|
||||||
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(PI / 2.0);
|
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 =
|
next.main.orientation =
|
||||||
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(PI / 2.0 + shorte * -0.2);
|
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 {
|
match second_tool_kind {
|
||||||
Some(ToolKind::Dagger) => {
|
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 =
|
next.second.orientation =
|
||||||
Quaternion::rotation_x(-1.35 * PI) * Quaternion::rotation_z(-2.0 * PI);
|
Quaternion::rotation_x(-1.35 * PI) * Quaternion::rotation_z(-2.0 * PI);
|
||||||
},
|
},
|
||||||
Some(ToolKind::Shield) => {
|
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 =
|
next.second.orientation =
|
||||||
Quaternion::rotation_y(-0.25 * PI) * Quaternion::rotation_z(1.5 * PI);
|
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 =
|
next.second.orientation =
|
||||||
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(PI / 2.0);
|
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(PI / 2.0);
|
||||||
},
|
},
|
||||||
@ -288,7 +311,7 @@ impl Animation for RunAnimation {
|
|||||||
match hands {
|
match hands {
|
||||||
(Some(Hands::One), _) => match active_tool_kind {
|
(Some(Hands::One), _) => match active_tool_kind {
|
||||||
Some(ToolKind::Axe) | Some(ToolKind::Hammer) | Some(ToolKind::Sword) => {
|
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 =
|
next.main.orientation =
|
||||||
Quaternion::rotation_y(2.35) * Quaternion::rotation_z(PI / 2.0);
|
Quaternion::rotation_y(2.35) * Quaternion::rotation_z(PI / 2.0);
|
||||||
},
|
},
|
||||||
@ -300,7 +323,7 @@ impl Animation for RunAnimation {
|
|||||||
match hands {
|
match hands {
|
||||||
(None | Some(Hands::One), Some(Hands::One)) => match second_tool_kind {
|
(None | Some(Hands::One), Some(Hands::One)) => match second_tool_kind {
|
||||||
Some(ToolKind::Axe) | Some(ToolKind::Hammer) | Some(ToolKind::Sword) => {
|
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 =
|
next.second.orientation =
|
||||||
Quaternion::rotation_y(-2.5) * Quaternion::rotation_z(-PI / 2.0);
|
Quaternion::rotation_y(-2.5) * Quaternion::rotation_z(-PI / 2.0);
|
||||||
},
|
},
|
||||||
|
@ -111,17 +111,17 @@ impl Animation for StandAnimation {
|
|||||||
match (hands, active_tool_kind, second_tool_kind) {
|
match (hands, active_tool_kind, second_tool_kind) {
|
||||||
((Some(Hands::Two), _), tool, _) | ((None, Some(Hands::Two)), _, tool) => match tool {
|
((Some(Hands::Two), _), tool, _) | ((None, Some(Hands::Two)), _, tool) => match tool {
|
||||||
Some(ToolKind::Bow) => {
|
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 =
|
next.main.orientation =
|
||||||
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(PI / 2.0);
|
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(PI / 2.0);
|
||||||
},
|
},
|
||||||
Some(ToolKind::Staff) | Some(ToolKind::Sceptre) => {
|
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 =
|
next.main.orientation =
|
||||||
Quaternion::rotation_y(-0.5) * Quaternion::rotation_z(PI / 2.0);
|
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 =
|
next.main.orientation =
|
||||||
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(PI / 2.0);
|
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(PI / 2.0);
|
||||||
},
|
},
|
||||||
@ -132,17 +132,17 @@ impl Animation for StandAnimation {
|
|||||||
match hands {
|
match hands {
|
||||||
(Some(Hands::One), _) => match active_tool_kind {
|
(Some(Hands::One), _) => match active_tool_kind {
|
||||||
Some(ToolKind::Dagger) => {
|
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 =
|
next.main.orientation =
|
||||||
Quaternion::rotation_x(-1.35 * PI) * Quaternion::rotation_z(2.0 * PI);
|
Quaternion::rotation_x(-1.35 * PI) * Quaternion::rotation_z(2.0 * PI);
|
||||||
},
|
},
|
||||||
Some(ToolKind::Axe) | Some(ToolKind::Hammer) | Some(ToolKind::Sword) => {
|
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 =
|
next.main.orientation =
|
||||||
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(PI / 2.0);
|
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(PI / 2.0);
|
||||||
},
|
},
|
||||||
Some(ToolKind::Shield) => {
|
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 =
|
next.main.orientation =
|
||||||
Quaternion::rotation_y(0.25 * PI) * Quaternion::rotation_z(-1.5 * PI);
|
Quaternion::rotation_y(0.25 * PI) * Quaternion::rotation_z(-1.5 * PI);
|
||||||
},
|
},
|
||||||
@ -153,17 +153,17 @@ impl Animation for StandAnimation {
|
|||||||
match hands {
|
match hands {
|
||||||
(None | Some(Hands::One), Some(Hands::One)) => match second_tool_kind {
|
(None | Some(Hands::One), Some(Hands::One)) => match second_tool_kind {
|
||||||
Some(ToolKind::Dagger) => {
|
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 =
|
next.second.orientation =
|
||||||
Quaternion::rotation_x(-1.35 * PI) * Quaternion::rotation_z(-2.0 * PI);
|
Quaternion::rotation_x(-1.35 * PI) * Quaternion::rotation_z(-2.0 * PI);
|
||||||
},
|
},
|
||||||
Some(ToolKind::Axe) | Some(ToolKind::Hammer) | Some(ToolKind::Sword) => {
|
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 =
|
next.second.orientation =
|
||||||
Quaternion::rotation_y(-2.5) * Quaternion::rotation_z(-PI / 2.0);
|
Quaternion::rotation_y(-2.5) * Quaternion::rotation_z(-PI / 2.0);
|
||||||
},
|
},
|
||||||
Some(ToolKind::Shield) => {
|
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 =
|
next.second.orientation =
|
||||||
Quaternion::rotation_y(-0.25 * PI) * Quaternion::rotation_z(1.5 * PI);
|
Quaternion::rotation_y(-0.25 * PI) * Quaternion::rotation_z(1.5 * PI);
|
||||||
},
|
},
|
||||||
|
@ -110,8 +110,8 @@ impl Animation for WieldAnimation {
|
|||||||
s_a.foot.2 + (tilt * footvertlstatic * 1.0).max(0.0),
|
s_a.foot.2 + (tilt * footvertlstatic * 1.0).max(0.0),
|
||||||
);
|
);
|
||||||
next.foot_l.orientation = Quaternion::rotation_x(
|
next.foot_l.orientation = Quaternion::rotation_x(
|
||||||
jump * -0.7 + u_slowalt * 0.035 - 0.2 + tilt * footvertlstatic * 0.1
|
jump * -0.7 + u_slowalt * 0.035 + tilt * footvertlstatic * 0.1
|
||||||
- tilt.abs() * 0.3,
|
- tilt.abs() * 0.3 * speednorm,
|
||||||
) * Quaternion::rotation_z(-tilt * 0.3);
|
) * Quaternion::rotation_z(-tilt * 0.3);
|
||||||
|
|
||||||
next.foot_r.position = Vec3::new(
|
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),
|
s_a.foot.2 + (tilt * footvertrstatic * 1.0).max(0.0),
|
||||||
);
|
);
|
||||||
next.foot_r.orientation = Quaternion::rotation_x(
|
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);
|
) * Quaternion::rotation_z(-tilt * 0.3);
|
||||||
|
|
||||||
next.chest.orientation = Quaternion::rotation_y(u_slowalt * 0.04)
|
next.chest.orientation = Quaternion::rotation_y(u_slowalt * 0.04)
|
||||||
|
@ -104,9 +104,9 @@ impl Animation for RunAnimation {
|
|||||||
//Gallop
|
//Gallop
|
||||||
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1 + shortalt * -0.2);
|
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1 + shortalt * -0.2);
|
||||||
next.head.orientation = Quaternion::rotation_x(
|
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(
|
) * 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);
|
) * Quaternion::rotation_y(tilt * 0.8);
|
||||||
|
|
||||||
next.neck.position = Vec3::new(0.0, s_a.neck.0, s_a.neck.1 + shortalt * -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(
|
next.leg_bl.position = Vec3::new(
|
||||||
-s_a.leg_b.0,
|
-s_a.leg_b.0,
|
||||||
s_a.leg_b.1 + amplitude3 * foot3b * -1.1,
|
s_a.leg_b.1 + amplitude3 * foot3a * -4.5,
|
||||||
s_a.leg_b.2 + amplitude3 * foot3a * 1.1,
|
s_a.leg_b.2 + amplitude3 * foot3b * -2.2,
|
||||||
);
|
);
|
||||||
next.leg_bl.orientation =
|
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_y(tilt * 1.5)
|
||||||
* Quaternion::rotation_z(tilt * -1.5);
|
* Quaternion::rotation_z(tilt * -1.5);
|
||||||
|
|
||||||
next.leg_br.position = Vec3::new(
|
next.leg_br.position = Vec3::new(
|
||||||
s_a.leg_b.0,
|
s_a.leg_b.0,
|
||||||
s_a.leg_b.1 + amplitude3 * foot4b * -1.1,
|
s_a.leg_b.1 + amplitude3 * foot4a * -4.5,
|
||||||
s_a.leg_b.2 + amplitude3 * foot4a * 1.1,
|
s_a.leg_b.2 + amplitude3 * foot4b * -2.2,
|
||||||
);
|
);
|
||||||
next.leg_br.orientation =
|
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_y(tilt * 1.5)
|
||||||
* Quaternion::rotation_z(tilt * -1.5);
|
* Quaternion::rotation_z(tilt * -1.5);
|
||||||
|
|
||||||
|
@ -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 mixed_vel = acc_vel + anim_time * 6.0; //sets run frequency using speed, with anim_time setting a floor
|
||||||
|
|
||||||
let speedmult = 1.0;
|
let speedmult = 1.0;
|
||||||
let lab: f32 = 0.6; //6
|
let lab: f32 = 0.45; //6
|
||||||
|
|
||||||
let short = ((1.0
|
let short = ((1.0
|
||||||
/ (0.72
|
/ (0.72
|
||||||
@ -120,8 +120,8 @@ impl Animation for RunAnimation {
|
|||||||
};
|
};
|
||||||
next.leg_l.position = Vec3::new(
|
next.leg_l.position = Vec3::new(
|
||||||
-s_a.leg.0 + speednorm * 1.5,
|
-s_a.leg.0 + speednorm * 1.5,
|
||||||
s_a.leg.1 + foot1b * -1.3,
|
s_a.leg.1 + foot1b * -2.3,
|
||||||
s_a.leg.2 + foot1a * 1.0,
|
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)
|
next.leg_l.orientation = Quaternion::rotation_x(-0.2 * speednorm + foot1a * 0.15)
|
||||||
* Quaternion::rotation_y(tilt * 0.5)
|
* Quaternion::rotation_y(tilt * 0.5)
|
||||||
@ -129,8 +129,8 @@ impl Animation for RunAnimation {
|
|||||||
|
|
||||||
next.leg_r.position = Vec3::new(
|
next.leg_r.position = Vec3::new(
|
||||||
s_a.leg.0 + speednorm * -1.5,
|
s_a.leg.0 + speednorm * -1.5,
|
||||||
s_a.leg.1 + foot2b * -1.3,
|
s_a.leg.1 + foot2b * -2.3,
|
||||||
s_a.leg.2 + foot2a * 1.0,
|
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)
|
next.leg_r.orientation = Quaternion::rotation_x(-0.2 * speednorm + foot2a * 0.15)
|
||||||
* Quaternion::rotation_y(tilt * 0.5)
|
* Quaternion::rotation_y(tilt * 0.5)
|
||||||
@ -141,17 +141,16 @@ impl Animation for RunAnimation {
|
|||||||
s_a.foot.1 + foot1b * -2.0,
|
s_a.foot.1 + foot1b * -2.0,
|
||||||
s_a.foot.2 + speednorm * 0.5 + (foot1a * 1.5).max(0.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)
|
next.foot_l.orientation =
|
||||||
* Quaternion::rotation_y(tilt * -1.0)
|
Quaternion::rotation_x(0.2 + foot2b * 0.6) * Quaternion::rotation_y(tilt * -1.0);
|
||||||
* Quaternion::rotation_z(tilt * -0.5);
|
|
||||||
|
|
||||||
next.foot_r.position = Vec3::new(
|
next.foot_r.position = Vec3::new(
|
||||||
s_a.foot.0,
|
s_a.foot.0,
|
||||||
s_a.foot.1 + foot2b * -2.0,
|
s_a.foot.1 + foot2b * -2.0,
|
||||||
s_a.foot.2 + speednorm * 0.5 + (foot2a * 1.5).max(0.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)
|
next.foot_r.orientation =
|
||||||
* Quaternion::rotation_y(tilt * -1.0);
|
Quaternion::rotation_x(0.2 + foot1b * 0.6) * Quaternion::rotation_y(tilt * -1.0);
|
||||||
|
|
||||||
next
|
next
|
||||||
}
|
}
|
||||||
|
@ -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::Pants => i18n.get_msg("hud-bag-legs"),
|
||||||
ArmorKind::Foot => i18n.get_msg("hud-bag-feet"),
|
ArmorKind::Foot => i18n.get_msg("hud-bag-feet"),
|
||||||
ArmorKind::Back => i18n.get_msg("hud-bag-back"),
|
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::Ring => i18n.get_msg("hud-bag-ring"),
|
||||||
ArmorKind::Neck => i18n.get_msg("hud-bag-neck"),
|
ArmorKind::Neck => i18n.get_msg("hud-bag-neck"),
|
||||||
ArmorKind::Head => i18n.get_msg("hud-bag-head"),
|
ArmorKind::Head => i18n.get_msg("hud-bag-head"),
|
||||||
|
@ -37,8 +37,9 @@ use anim::{
|
|||||||
use common::{
|
use common::{
|
||||||
comp::{
|
comp::{
|
||||||
inventory::slot::EquipSlot,
|
inventory::slot::EquipSlot,
|
||||||
item::{Hands, ItemKind, ToolKind},
|
item::{armor::ArmorKind, Hands, ItemKind, ToolKind},
|
||||||
ship::{self, figuredata::VOXEL_COLLIDER_MANIFEST},
|
ship::{self, figuredata::VOXEL_COLLIDER_MANIFEST},
|
||||||
|
slot::ArmorSlot,
|
||||||
Body, CharacterActivity, CharacterState, Collider, Controller, Health, Inventory, Item,
|
Body, CharacterActivity, CharacterState, Collider, Controller, Health, Inventory, Item,
|
||||||
ItemKey, Last, LightAnimation, LightEmitter, Object, Ori, PhysicsState, PoiseState, Pos,
|
ItemKey, Last, LightAnimation, LightEmitter, Object, Ori, PhysicsState, PoiseState, Pos,
|
||||||
Scale, Vel,
|
Scale, Vel,
|
||||||
@ -1107,6 +1108,21 @@ impl FigureMgr {
|
|||||||
&& !character.map_or(false, |c| c.is_using_hands())
|
&& !character.map_or(false, |c| c.is_using_hands())
|
||||||
&& physics.in_liquid().is_none();
|
&& 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
|
let state = self
|
||||||
.states
|
.states
|
||||||
.character_states
|
.character_states
|
||||||
@ -1114,7 +1130,7 @@ impl FigureMgr {
|
|||||||
.or_insert_with(|| {
|
.or_insert_with(|| {
|
||||||
FigureState::new(
|
FigureState::new(
|
||||||
renderer,
|
renderer,
|
||||||
CharacterSkeleton::new(holding_lantern),
|
CharacterSkeleton::new(holding_lantern, back_carry_offset),
|
||||||
body,
|
body,
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
@ -1141,7 +1157,7 @@ impl FigureMgr {
|
|||||||
// Standing or Skating
|
// Standing or Skating
|
||||||
(true, false, false, false, _) | (_, _, false, false, true) => {
|
(true, false, false, false, _) | (_, _, false, false, true) => {
|
||||||
anim::character::StandAnimation::update_skeleton(
|
anim::character::StandAnimation::update_skeleton(
|
||||||
&CharacterSkeleton::new(holding_lantern),
|
&CharacterSkeleton::new(holding_lantern, back_carry_offset),
|
||||||
(
|
(
|
||||||
active_tool_kind,
|
active_tool_kind,
|
||||||
second_tool_kind,
|
second_tool_kind,
|
||||||
@ -1160,7 +1176,7 @@ impl FigureMgr {
|
|||||||
// Running
|
// Running
|
||||||
(true, true, false, false, _) => {
|
(true, true, false, false, _) => {
|
||||||
anim::character::RunAnimation::update_skeleton(
|
anim::character::RunAnimation::update_skeleton(
|
||||||
&CharacterSkeleton::new(holding_lantern),
|
&CharacterSkeleton::new(holding_lantern, back_carry_offset),
|
||||||
(
|
(
|
||||||
active_tool_kind,
|
active_tool_kind,
|
||||||
second_tool_kind,
|
second_tool_kind,
|
||||||
@ -1182,7 +1198,7 @@ impl FigureMgr {
|
|||||||
// In air
|
// In air
|
||||||
(false, _, false, false, _) => {
|
(false, _, false, false, _) => {
|
||||||
anim::character::JumpAnimation::update_skeleton(
|
anim::character::JumpAnimation::update_skeleton(
|
||||||
&CharacterSkeleton::new(holding_lantern),
|
&CharacterSkeleton::new(holding_lantern, back_carry_offset),
|
||||||
(
|
(
|
||||||
active_tool_kind,
|
active_tool_kind,
|
||||||
second_tool_kind,
|
second_tool_kind,
|
||||||
@ -1200,7 +1216,7 @@ impl FigureMgr {
|
|||||||
},
|
},
|
||||||
// Swim
|
// Swim
|
||||||
(_, _, true, false, _) => anim::character::SwimAnimation::update_skeleton(
|
(_, _, true, false, _) => anim::character::SwimAnimation::update_skeleton(
|
||||||
&CharacterSkeleton::new(holding_lantern),
|
&CharacterSkeleton::new(holding_lantern, back_carry_offset),
|
||||||
(
|
(
|
||||||
active_tool_kind,
|
active_tool_kind,
|
||||||
second_tool_kind,
|
second_tool_kind,
|
||||||
@ -1218,7 +1234,7 @@ impl FigureMgr {
|
|||||||
),
|
),
|
||||||
// Mount
|
// Mount
|
||||||
(_, _, _, true, _) => anim::character::MountAnimation::update_skeleton(
|
(_, _, _, true, _) => anim::character::MountAnimation::update_skeleton(
|
||||||
&CharacterSkeleton::new(holding_lantern),
|
&CharacterSkeleton::new(holding_lantern, back_carry_offset),
|
||||||
(
|
(
|
||||||
active_tool_kind,
|
active_tool_kind,
|
||||||
second_tool_kind,
|
second_tool_kind,
|
||||||
|
Loading…
Reference in New Issue
Block a user