Added foot motion when turning on the spot

This commit is contained in:
Joshua Barretto 2023-10-13 15:16:47 +01:00
parent 8088e4d691
commit a1349d8176
3 changed files with 26 additions and 14 deletions

View File

@ -497,11 +497,8 @@ fn backpack_crash() {
let mut inv = Inventory::with_empty(); let mut inv = Inventory::with_empty();
let backpack = Item::new_from_asset_expect("common.items.armor.misc.back.backpack"); let backpack = Item::new_from_asset_expect("common.items.armor.misc.back.backpack");
inv.loadout.swap( inv.loadout
EquipSlot::Armor(ArmorSlot::Backpack), .swap(EquipSlot::Armor(ArmorSlot::Back), Some(backpack), Time(0.0));
Some(backpack),
Time(0.0),
);
fill_inv_slots(&mut inv, 35); fill_inv_slots(&mut inv, 35);
@ -510,7 +507,7 @@ fn backpack_crash() {
let returned_items = inv.swap_inventory_loadout( let returned_items = inv.swap_inventory_loadout(
InvSlotId::new(9, 17), InvSlotId::new(9, 17),
EquipSlot::Armor(ArmorSlot::Backpack), EquipSlot::Armor(ArmorSlot::Back),
Time(0.0), Time(0.0),
); );
assert_eq!(18, returned_items.len()); assert_eq!(18, returned_items.len());

View File

@ -95,10 +95,21 @@ impl Animation for StandAnimation {
); );
next.hand_r.orientation = Quaternion::rotation_x(slow * -0.06 + impact * -0.1); next.hand_r.orientation = Quaternion::rotation_x(slow * -0.06 + impact * -0.1);
next.foot_l.position = Vec3::new(-s_a.foot.0, s_a.foot.1 - impact * 0.15, s_a.foot.2); let on_spot = (anim_time * 7.0).sin() * tilt;
let on_spotz = (anim_time * 7.0 + PI * 0.5).sin() * tilt.clamp(-0.3, 0.3);
next.foot_l.position = Vec3::new(
-s_a.foot.0,
s_a.foot.1 - impact * 0.15 - on_spot * 15.0,
s_a.foot.2 + (-on_spotz).max(0.0) * 5.0,
);
next.foot_l.orientation = Quaternion::rotation_x(impact * 0.02); next.foot_l.orientation = Quaternion::rotation_x(impact * 0.02);
next.foot_r.position = Vec3::new(s_a.foot.0, s_a.foot.1 + impact * 0.15, s_a.foot.2); next.foot_r.position = Vec3::new(
s_a.foot.0,
s_a.foot.1 + impact * 0.15 + on_spot * 15.0,
s_a.foot.2 + on_spotz.max(0.0) * 5.0,
);
next.foot_r.orientation = Quaternion::rotation_x(impact * -0.02); next.foot_r.orientation = Quaternion::rotation_x(impact * -0.02);
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);

View File

@ -104,23 +104,27 @@ impl Animation for WieldAnimation {
next.shorts.orientation = Quaternion::rotation_z(0.3 + beltstatic * tilt * 0.2); next.shorts.orientation = Quaternion::rotation_z(0.3 + beltstatic * tilt * 0.2);
next.torso.orientation = Quaternion::rotation_z(tilt * 0.4); next.torso.orientation = Quaternion::rotation_z(tilt * 0.4);
let on_spot = (anim_time * 7.0).sin() * tilt;
let on_spotz = (anim_time * 7.0 + PI * 0.5).sin() * tilt.clamp(-0.3, 0.3);
next.foot_l.position = Vec3::new( next.foot_l.position = Vec3::new(
-s_a.foot.0, -s_a.foot.0,
-2.0 + s_a.foot.1 + jump * -4.0, -2.0 + s_a.foot.1 + jump * -4.0 - on_spot * 5.0,
s_a.foot.2 + (tilt * footvertlstatic * 1.0).max(0.0), s_a.foot.2 + (tilt * footvertlstatic * 1.0).max(0.0) + (-on_spotz).max(0.0) * 5.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 - 0.2 + 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(
s_a.foot.0, s_a.foot.0,
2.0 + s_a.foot.1 + jump * 4.0, 2.0 + s_a.foot.1 + jump * 4.0 + on_spot * 5.0,
s_a.foot.2 + (tilt * footvertrstatic * 1.0).max(0.0), s_a.foot.2 + (tilt * footvertrstatic * 1.0).max(0.0) + on_spotz.max(0.0) * 5.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)