initial wield testing

This commit is contained in:
jshipsey 2021-03-23 21:56:25 -04:00
parent c3ae820694
commit f94169ed22
6 changed files with 289 additions and 224 deletions

View File

@ -165,91 +165,91 @@
),
// 1h Swords
"common.items.weapons.sword_1h.bloodsteel-0": (
vox_spec: ("weapon.sword_1h.bloodsteel-0", (-2.0, -4.5, -7.5)),
vox_spec: ("weapon.sword_1h.bloodsteel-0", (-2.0, -4.5, -3.0)),
color: None
),
"common.items.weapons.sword_1h.bloodsteel-1": (
vox_spec: ("weapon.sword_1h.bloodsteel-1", (-2.0, -4.5, -7.5)),
vox_spec: ("weapon.sword_1h.bloodsteel-1", (-2.0, -4.5, -3.0)),
color: None
),
"common.items.weapons.sword_1h.bloodsteel-2": (
vox_spec: ("weapon.sword_1h.bloodsteel-2", (-2.0, -4.5, -7.5)),
vox_spec: ("weapon.sword_1h.bloodsteel-2", (-2.0, -4.5, -3.0)),
color: None
),
"common.items.weapons.sword_1h.bronze-0": (
vox_spec: ("weapon.sword_1h.bronze-0", (-2.0, -4.5, -7.5)),
vox_spec: ("weapon.sword_1h.bronze-0", (-2.0, -4.5, -3.0)),
color: None
),
"common.items.weapons.sword_1h.bronze-1": (
vox_spec: ("weapon.sword_1h.bronze-1", (-2.0, -4.5, -7.5)),
vox_spec: ("weapon.sword_1h.bronze-1", (-2.0, -4.5, -3.0)),
color: None
),
"common.items.weapons.sword_1h.bronze-2": (
vox_spec: ("weapon.sword_1h.bronze-2", (-2.0, -4.5, -7.5)),
vox_spec: ("weapon.sword_1h.bronze-2", (-2.0, -4.5, -3.0)),
color: None
),
"common.items.weapons.sword_1h.cobalt-0": (
vox_spec: ("weapon.sword_1h.cobalt-0", (-2.0, -4.5, -7.5)),
vox_spec: ("weapon.sword_1h.cobalt-0", (-2.0, -4.5, -3.0)),
color: None
),
"common.items.weapons.sword_1h.cobalt-1": (
vox_spec: ("weapon.sword_1h.cobalt-1", (-2.0, -4.5, -7.5)),
vox_spec: ("weapon.sword_1h.cobalt-1", (-2.0, -4.5, -3.0)),
color: None
),
"common.items.weapons.sword_1h.cobalt-2": (
vox_spec: ("weapon.sword_1h.cobalt-2", (-2.0, -4.5, -7.5)),
vox_spec: ("weapon.sword_1h.cobalt-2", (-2.0, -4.5, -3.0)),
color: None
),
"common.items.weapons.sword_1h.cobalt-3": (
vox_spec: ("weapon.sword_1h.cobalt-3", (-2.0, -4.5, -7.5)),
vox_spec: ("weapon.sword_1h.cobalt-3", (-2.0, -4.5, -3.0)),
color: None
),
"common.items.weapons.sword_1h.iron-0": (
vox_spec: ("weapon.sword_1h.iron-0", (-2.0, -4.5, -7.5)),
vox_spec: ("weapon.sword_1h.iron-0", (-2.0, -4.5, -3.0)),
color: None
),
"common.items.weapons.sword_1h.iron-1": (
vox_spec: ("weapon.sword_1h.iron-1", (-2.0, -4.5, -7.5)),
vox_spec: ("weapon.sword_1h.iron-1", (-2.0, -4.5, -3.0)),
color: None
),
"common.items.weapons.sword_1h.iron-2": (
vox_spec: ("weapon.sword_1h.iron-2", (-2.0, -4.5, -7.5)),
vox_spec: ("weapon.sword_1h.iron-2", (-2.0, -4.5, -3.0)),
color: None
),
"common.items.weapons.sword_1h.iron-3": (
vox_spec: ("weapon.sword_1h.iron-3", (-2.0, -4.5, -7.5)),
vox_spec: ("weapon.sword_1h.iron-3", (-2.0, -4.5, -3.0)),
color: None
),
"common.items.weapons.sword_1h.iron-4": (
vox_spec: ("weapon.sword_1h.iron-4", (-2.0, -4.5, -7.5)),
vox_spec: ("weapon.sword_1h.iron-4", (-2.0, -4.5, -3.0)),
color: None
),
"common.items.weapons.sword_1h.obsidian-0": (
vox_spec: ("weapon.sword_1h.obsidian-0", (-2.0, -4.5, -7.5)),
vox_spec: ("weapon.sword_1h.obsidian-0", (-2.0, -4.5, -3.0)),
color: None
),
"common.items.weapons.sword_1h.orichalcum-0": (
vox_spec: ("weapon.sword_1h.orichalcum-0", (-2.0, -4.5, -7.5)),
vox_spec: ("weapon.sword_1h.orichalcum-0", (-2.0, -4.5, -3.0)),
color: None
),
"common.items.weapons.sword_1h.orichalcum-1": (
vox_spec: ("weapon.sword_1h.orichalcum-1", (-2.0, -4.5, -7.5)),
vox_spec: ("weapon.sword_1h.orichalcum-1", (-2.0, -4.5, -3.0)),
color: None
),
"common.items.weapons.sword_1h.steel-0": (
vox_spec: ("weapon.sword_1h.steel-0", (-2.0, -4.5, -7.5)),
vox_spec: ("weapon.sword_1h.steel-0", (-2.0, -4.5, -3.0)),
color: None
),
"common.items.weapons.sword_1h.steel-1": (
vox_spec: ("weapon.sword_1h.steel-1", (-2.0, -4.5, -7.5)),
vox_spec: ("weapon.sword_1h.steel-1", (-2.0, -4.5, -3.0)),
color: None
),
"common.items.weapons.sword_1h.steel-2": (
vox_spec: ("weapon.sword_1h.steel-2", (-2.0, -4.5, -7.5)),
vox_spec: ("weapon.sword_1h.steel-2", (-2.0, -4.5, -3.0)),
color: None
),
"common.items.weapons.sword_1h.steel-3": (
vox_spec: ("weapon.sword_1h.steel-3", (-2.0, -4.5, -7.5)),
vox_spec: ("weapon.sword_1h.steel-3", (-2.0, -4.5, -3.0)),
color: None
),
// Axes
@ -391,75 +391,75 @@
),
// 1h Axes
"common.items.weapons.axe_1h.bloodsteel-0": (
vox_spec: ("weapon.axe_1h.bloodsteel-0", (-1.5, -5.0, -6.0)),
vox_spec: ("weapon.axe_1h.bloodsteel-0", (-1.5, -7.5, -3.0)),
color: None
),
"common.items.weapons.axe_1h.bloodsteel-1": (
vox_spec: ("weapon.axe_1h.bloodsteel-1", (-1.5, -5.0, -6.0)),
vox_spec: ("weapon.axe_1h.bloodsteel-1", (-1.5, -5.0, -3.0)),
color: None
),
"common.items.weapons.axe_1h.bronze-0": (
vox_spec: ("weapon.axe_1h.bronze-0", (-1.5, -5.0, -6.0)),
vox_spec: ("weapon.axe_1h.bronze-0", (-1.5, -5.0, -3.0)),
color: None
),
"common.items.weapons.axe_1h.bronze-1": (
vox_spec: ("weapon.axe_1h.bronze-1", (-1.5, -5.0, -6.0)),
vox_spec: ("weapon.axe_1h.bronze-1", (-1.5, -5.0, -3.0)),
color: None
),
"common.items.weapons.axe_1h.cobalt-0": (
vox_spec: ("weapon.axe_1h.cobalt-0", (-1.5, -5.0, -6.0)),
vox_spec: ("weapon.axe_1h.cobalt-0", (-1.5, -5.0, -3.0)),
color: None
),
"common.items.weapons.axe_1h.cobalt-1": (
vox_spec: ("weapon.axe_1h.cobalt-1", (-1.5, -5.0, -6.0)),
vox_spec: ("weapon.axe_1h.cobalt-1", (-1.5, -5.0, -3.0)),
color: None
),
"common.items.weapons.axe_1h.iron-0": (
vox_spec: ("weapon.axe_1h.iron-0", (-1.5, -5.0, -6.0)),
vox_spec: ("weapon.axe_1h.iron-0", (-1.5, -5.0, -3.0)),
color: None
),
"common.items.weapons.axe_1h.iron-1": (
vox_spec: ("weapon.axe_1h.iron-1", (-1.5, -5.0, -6.0)),
vox_spec: ("weapon.axe_1h.iron-1", (-1.5, -5.0, -3.0)),
color: None
),
"common.items.weapons.axe_1h.iron-2": (
vox_spec: ("weapon.axe_1h.iron-2", (-1.5, -5.0, -6.0)),
vox_spec: ("weapon.axe_1h.iron-2", (-1.5, -5.0, -3.0)),
color: None
),
"common.items.weapons.axe_1h.iron-3": (
vox_spec: ("weapon.axe_1h.iron-3", (-1.5, -5.0, -6.0)),
vox_spec: ("weapon.axe_1h.iron-3", (-1.5, -5.0, -3.0)),
color: None
),
"common.items.weapons.axe_1h.orichalcum-0": (
vox_spec: ("weapon.axe_1h.orichalcum-0", (-1.5, -5.0, -6.0)),
vox_spec: ("weapon.axe_1h.orichalcum-0", (-1.5, -5.0, -3.0)),
color: None
),
"common.items.weapons.axe_1h.steel-0": (
vox_spec: ("weapon.axe_1h.steel-0", (-1.5, -5.0, -6.0)),
vox_spec: ("weapon.axe_1h.steel-0", (-1.5, -5.0, -3.0)),
color: None
),
"common.items.weapons.axe_1h.steel-1": (
vox_spec: ("weapon.axe_1h.steel-1", (-1.5, -5.0, -6.0)),
vox_spec: ("weapon.axe_1h.steel-1", (-1.5, -5.0, -3.0)),
color: None
),
"common.items.weapons.axe_1h.steel-2": (
vox_spec: ("weapon.axe_1h.steel-2", (-1.5, -5.0, -6.0)),
vox_spec: ("weapon.axe_1h.steel-2", (-1.5, -5.0, -3.0)),
color: None
),
"common.items.weapons.axe_1h.stone-0": (
vox_spec: ("weapon.axe_1h.stone-0", (-1.5, -5.0, -6.0)),
vox_spec: ("weapon.axe_1h.stone-0", (-1.5, -5.0, -3.0)),
color: None
),
"common.items.weapons.axe_1h.stone-1": (
vox_spec: ("weapon.axe_1h.stone-1", (-1.5, -5.0, -6.0)),
vox_spec: ("weapon.axe_1h.stone-1", (-1.5, -5.0, -3.0)),
color: None
),
"common.items.weapons.axe_1h.wood-0": (
vox_spec: ("weapon.axe_1h.wood-0", (-1.5, -5.0, -6.0)),
vox_spec: ("weapon.axe_1h.wood-0", (-1.5, -5.0, -3.0)),
color: None
),
"common.items.weapons.axe_1h.wood-1": (
vox_spec: ("weapon.axe_1h.wood-1", (-1.5, -5.0, -6.0)),
vox_spec: ("weapon.axe_1h.wood-1", (-1.5, -5.0, -3.0)),
color: None
),
// Hammers

View File

@ -484,8 +484,11 @@ fn handle_ability(data: &JoinData, update: &mut StateUpdate, input: InputKind) {
// Mouse1 and Skill1 always use the MainHand slot
let always_main_hand = matches!(input, InputKind::Primary | InputKind::Ability(0));
let no_main_hand = hands(EquipSlot::Mainhand).is_none();
// skill_index used to select ability for the AbilityKey::Skill2 input
let (equip_slot, skill_index) = if always_main_hand {
let (equip_slot, skill_index) = if no_main_hand {
(Some(EquipSlot::Offhand), 1)
} else if always_main_hand {
(Some(EquipSlot::Mainhand), 0)
} else {
let hands = (hands(EquipSlot::Mainhand), hands(EquipSlot::Offhand));

View File

@ -141,6 +141,7 @@ impl Animation for StandAnimation {
next.lantern.orientation = Quaternion::rotation_x(0.1) * Quaternion::rotation_y(0.1);
next.torso.position = Vec3::new(0.0, 0.0, 0.0) * s_a.scaler;
next.second.scale = Vec3::one();
next.second.scale = match hands {
(Some(Hands::One), Some(Hands::One)) => Vec3::one(),

View File

@ -2,7 +2,10 @@ use super::{
super::{vek::*, Animation},
CharacterSkeleton, SkeletonAttr,
};
use common::{comp::item::ToolKind, util::Dir};
use common::{
comp::item::{Hands, ToolKind},
util::Dir,
};
use std::{f32::consts::PI, ops::Mul};
pub struct WieldAnimation;
@ -10,6 +13,7 @@ pub struct WieldAnimation;
type WieldAnimationDependency = (
Option<ToolKind>,
Option<ToolKind>,
(Option<Hands>, Option<Hands>),
Vec3<f32>,
Vec3<f32>,
Dir,
@ -30,6 +34,7 @@ impl Animation for WieldAnimation {
(
active_tool_kind,
_second_tool_kind,
hands,
orientation,
last_ori,
look_dir,
@ -87,6 +92,12 @@ impl Animation for WieldAnimation {
} * 1.25)
* 4.0;
let jump = if velocity.z == 0.0 { 0.0 } else { 1.0 };
// next.second.scale = match hands {
// (Some(Hands::One), Some(Hands::One)) => Vec3::one(),
// (_, _) => Vec3::zero(),
// };
if speed > 0.2 && velocity.z == 0.0 {
next.chest.orientation = Quaternion::rotation_z(short * 0.1 + strafe * 0.7)
* Quaternion::rotation_y(strafe * 0.2)
@ -141,7 +152,8 @@ impl Animation for WieldAnimation {
next.back.orientation = Quaternion::rotation_x(-0.2);
next.shorts.position = Vec3::new(0.0, s_a.shorts.0, s_a.shorts.1);
}
match active_tool_kind {
match hands {
(Some(Hands::Two), _) => match active_tool_kind {
Some(ToolKind::Sword) | Some(ToolKind::SwordSimple) => {
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_x(0.0);
@ -153,7 +165,8 @@ impl Animation for WieldAnimation {
next.hand_r.orientation =
Quaternion::rotation_x(s_a.shr.3) * Quaternion::rotation_y(s_a.shr.4);
next.control.position = Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2 + direction * -5.0);
next.control.position =
Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2 + direction * -5.0);
next.control.orientation = Quaternion::rotation_x(s_a.sc.3 + u_slow * 0.15)
* Quaternion::rotation_z(u_slowalt * 0.08);
},
@ -212,7 +225,8 @@ impl Animation for WieldAnimation {
next.hand_r.orientation =
Quaternion::rotation_x(s_a.ahr.3) * Quaternion::rotation_z(s_a.ahr.5);
next.control.position = Vec3::new(s_a.ac.0, s_a.ac.1, s_a.ac.2 + direction * -5.0);
next.control.position =
Vec3::new(s_a.ac.0, s_a.ac.1, s_a.ac.2 + direction * -5.0);
next.control.orientation = Quaternion::rotation_x(s_a.ac.3)
* Quaternion::rotation_y(s_a.ac.4)
* Quaternion::rotation_z(s_a.ac.5);
@ -294,7 +308,8 @@ impl Animation for WieldAnimation {
next.hold.orientation = Quaternion::rotation_x(-1.57);
next.hold.scale = Vec3::one() * 1.0;
next.control.position = Vec3::new(s_a.bc.0, s_a.bc.1, s_a.bc.2 + direction * -5.0);
next.control.position =
Vec3::new(s_a.bc.0, s_a.bc.1, s_a.bc.2 + direction * -5.0);
next.control.orientation = Quaternion::rotation_x(u_slow * 0.06)
* Quaternion::rotation_y(s_a.bc.4)
* Quaternion::rotation_z(s_a.bc.5 + u_slowalt * 0.1);
@ -323,8 +338,51 @@ impl Animation for WieldAnimation {
* Quaternion::rotation_z(u_slowalt * 0.1);
},
_ => {},
}
},
(_, _) => {},
};
match hands {
(Some(Hands::One), _) => {
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.second.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_z(PI);
next.second.orientation = Quaternion::rotation_z(PI);
next.control_l.position = Vec3::new(-8.0, 9.0, 4.0);
next.control_l.orientation = Quaternion::rotation_x(-0.3);
next.hand_l.position = Vec3::new(0.0, 0.5, -4.0);
next.hand_l.orientation = Quaternion::rotation_x(1.57)
},
(_, _) => {},
};
match hands {
(_, Some(Hands::One)) => {
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.second.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_z(PI);
next.second.orientation = Quaternion::rotation_z(PI);
next.control_r.position = Vec3::new(8.0, 9.0, 4.0);
next.control_r.orientation = Quaternion::rotation_x(-0.3);
next.hand_r.position = Vec3::new(0.0, 0.5, -4.0);
next.hand_r.orientation = Quaternion::rotation_x(1.57)
},
(_, _) => {},
};
match hands {
(None, _) => {
next.hand_l.position = Vec3::new(0.0, 0.0, 20.0);
},
(_, _) => {},
};
match hands {
(_, None) => {
next.hand_r.position = Vec3::new(0.0, 0.0, 20.0);
},
(_, _) => {},
};
next
}
}

View File

@ -146,7 +146,9 @@ pub fn init() {
// Start reloader that watcher signals
// "Debounces" events since I can't find the option to do this in the latest
// `notify`
std::thread::Builder::new("voxygen_anim_watcher".to_owned()).spawn(move || {
std::thread::Builder::new()
.name("voxygen_anim_watcher".to_owned())
.spawn(move || {
let mut modified_paths = std::collections::HashSet::new();
while let Ok(path) = reload_recv.recv() {
modified_paths.insert(path);

View File

@ -1453,6 +1453,7 @@ impl FigureMgr {
(
active_tool_kind,
second_tool_kind,
hands,
// TODO: Update to use the quaternion.
ori * anim::vek::Vec3::<f32>::unit_y(),
state.last_ori * anim::vek::Vec3::<f32>::unit_y(),