initial wield testing

This commit is contained in:
jshipsey 2021-03-23 21:56:25 -04:00
parent e30cc4abd7
commit b53e1653f6
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,190 +152,237 @@ 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 {
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);
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);
next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2);
next.hand_l.orientation =
Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4);
next.hand_r.position = Vec3::new(s_a.shr.0, s_a.shr.1, s_a.shr.2);
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.orientation = Quaternion::rotation_x(s_a.sc.3 + u_slow * 0.15)
* Quaternion::rotation_z(u_slowalt * 0.08);
},
Some(ToolKind::Dagger) => {
next.control.position = Vec3::new(0.0, 0.0, 0.0);
next.hand_l.position = Vec3::new(0.0, 0.0, 0.0);
next.hand_l.orientation = Quaternion::rotation_x(0.0 * PI)
* Quaternion::rotation_y(0.0 * PI)
* Quaternion::rotation_z(0.0 * PI);
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_x(0.0 * PI)
* Quaternion::rotation_y(0.0 * PI)
* Quaternion::rotation_z(0.0 * PI);
next.control_l.position = Vec3::new(-7.0, 0.0, 0.0);
next.hand_r.position = Vec3::new(0.0, 0.0, 0.0);
next.hand_r.orientation = Quaternion::rotation_x(0.0 * PI)
* Quaternion::rotation_y(0.0 * PI)
* Quaternion::rotation_z(0.0 * PI);
next.second.position = Vec3::new(0.0, 0.0, 0.0);
next.second.orientation = Quaternion::rotation_x(0.0 * PI)
* Quaternion::rotation_y(0.0 * PI)
* Quaternion::rotation_z(0.0 * PI);
next.control_r.position = Vec3::new(7.0, 0.0, 0.0);
},
Some(ToolKind::Axe) => {
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_x(0.0);
if speed < 0.5 {
next.head.position =
Vec3::new(0.0, 0.0 + s_a.head.0, s_a.head.1 + u_slow * 0.1);
next.head.orientation = Quaternion::rotation_z(head_look.x)
* Quaternion::rotation_x(0.35 + head_look.y.abs() + look_dir.z * 0.7);
next.chest.orientation = Quaternion::rotation_x(-0.35)
* Quaternion::rotation_y(u_slowalt * 0.04)
* Quaternion::rotation_z(0.15);
next.belt.position = Vec3::new(0.0, 1.0 + s_a.belt.0, s_a.belt.1);
next.belt.orientation = Quaternion::rotation_x(0.15)
* Quaternion::rotation_y(u_slowalt * 0.03)
* Quaternion::rotation_z(0.15);
next.shorts.position = Vec3::new(0.0, 1.0 + s_a.shorts.0, s_a.shorts.1);
next.shorts.orientation =
Quaternion::rotation_x(0.15) * Quaternion::rotation_z(0.25);
} else {
}
next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2);
next.hand_l.orientation =
Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4);
next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2);
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.orientation = Quaternion::rotation_x(s_a.ac.3)
* Quaternion::rotation_y(s_a.ac.4)
* Quaternion::rotation_z(s_a.ac.5);
},
Some(ToolKind::Hammer) | Some(ToolKind::HammerSimple) | Some(ToolKind::Pick) => {
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_x(0.0);
next.hand_l.position = Vec3::new(s_a.hhl.0, s_a.hhl.1, s_a.hhl.2);
next.hand_l.orientation =
Quaternion::rotation_x(s_a.hhl.3) * Quaternion::rotation_y(s_a.hhl.4);
next.hand_r.position = Vec3::new(s_a.hhr.0, s_a.hhr.1, s_a.hhr.2);
next.hand_r.orientation =
Quaternion::rotation_x(s_a.hhr.3) * Quaternion::rotation_y(s_a.hhr.4);
next.control.position = Vec3::new(
s_a.hc.0,
s_a.hc.1 + speed * 0.2,
s_a.hc.2 + speed * 0.8 + direction * -5.0,
);
next.control.orientation = Quaternion::rotation_x(s_a.hc.3 + u_slow * 0.15)
* Quaternion::rotation_y(s_a.hc.4 + speed * -0.04)
* Quaternion::rotation_z(s_a.hc.5 + u_slowalt * 0.07);
},
Some(ToolKind::Staff) | Some(ToolKind::Sceptre) => {
if speed > 0.5 && velocity.z == 0.0 {
next.hand_r.position = Vec3::new(
7.0 + s_a.hand.0 + foothoril * 1.3,
-4.0 + s_a.hand.1 + foothoril * -7.0,
1.0 + s_a.hand.2 - foothoril * 5.5,
);
next.hand_r.orientation = Quaternion::rotation_x(0.6 + footrotl * -1.2)
* Quaternion::rotation_y(footrotl * -0.4);
} else {
next.hand_r.position = Vec3::new(s_a.sthr.0, s_a.sthr.1, s_a.sthr.2);
next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2);
next.hand_l.orientation =
Quaternion::rotation_x(s_a.shl.3) * Quaternion::rotation_y(s_a.shl.4);
next.hand_r.position = Vec3::new(s_a.shr.0, s_a.shr.1, s_a.shr.2);
next.hand_r.orientation =
Quaternion::rotation_x(s_a.sthr.3) * Quaternion::rotation_y(s_a.sthr.4);
};
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_y(0.0);
Quaternion::rotation_x(s_a.shr.3) * Quaternion::rotation_y(s_a.shr.4);
next.control.position =
Vec3::new(s_a.stc.0, s_a.stc.1, s_a.stc.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);
},
Some(ToolKind::Dagger) => {
next.control.position = Vec3::new(0.0, 0.0, 0.0);
next.hand_l.position = Vec3::new(s_a.sthl.0, s_a.sthl.1, s_a.sthl.2);
next.hand_l.orientation = Quaternion::rotation_x(s_a.sthl.3);
next.hand_l.position = Vec3::new(0.0, 0.0, 0.0);
next.hand_l.orientation = Quaternion::rotation_x(0.0 * PI)
* Quaternion::rotation_y(0.0 * PI)
* Quaternion::rotation_z(0.0 * PI);
next.control.orientation = Quaternion::rotation_x(s_a.stc.3 + u_slow * 0.1)
* Quaternion::rotation_y(s_a.stc.4)
* Quaternion::rotation_z(s_a.stc.5 + u_slowalt * 0.1);
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_x(0.0 * PI)
* Quaternion::rotation_y(0.0 * PI)
* Quaternion::rotation_z(0.0 * PI);
next.control_l.position = Vec3::new(-7.0, 0.0, 0.0);
next.hand_r.position = Vec3::new(0.0, 0.0, 0.0);
next.hand_r.orientation = Quaternion::rotation_x(0.0 * PI)
* Quaternion::rotation_y(0.0 * PI)
* Quaternion::rotation_z(0.0 * PI);
next.second.position = Vec3::new(0.0, 0.0, 0.0);
next.second.orientation = Quaternion::rotation_x(0.0 * PI)
* Quaternion::rotation_y(0.0 * PI)
* Quaternion::rotation_z(0.0 * PI);
next.control_r.position = Vec3::new(7.0, 0.0, 0.0);
},
Some(ToolKind::Axe) => {
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_x(0.0);
if speed < 0.5 {
next.head.position =
Vec3::new(0.0, 0.0 + s_a.head.0, s_a.head.1 + u_slow * 0.1);
next.head.orientation = Quaternion::rotation_z(head_look.x)
* Quaternion::rotation_x(0.35 + head_look.y.abs() + look_dir.z * 0.7);
next.chest.orientation = Quaternion::rotation_x(-0.35)
* Quaternion::rotation_y(u_slowalt * 0.04)
* Quaternion::rotation_z(0.15);
next.belt.position = Vec3::new(0.0, 1.0 + s_a.belt.0, s_a.belt.1);
next.belt.orientation = Quaternion::rotation_x(0.15)
* Quaternion::rotation_y(u_slowalt * 0.03)
* Quaternion::rotation_z(0.15);
next.shorts.position = Vec3::new(0.0, 1.0 + s_a.shorts.0, s_a.shorts.1);
next.shorts.orientation =
Quaternion::rotation_x(0.15) * Quaternion::rotation_z(0.25);
} else {
}
next.hand_l.position = Vec3::new(s_a.ahl.0, s_a.ahl.1, s_a.ahl.2);
next.hand_l.orientation =
Quaternion::rotation_x(s_a.ahl.3) * Quaternion::rotation_y(s_a.ahl.4);
next.hand_r.position = Vec3::new(s_a.ahr.0, s_a.ahr.1, s_a.ahr.2);
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.orientation = Quaternion::rotation_x(s_a.ac.3)
* Quaternion::rotation_y(s_a.ac.4)
* Quaternion::rotation_z(s_a.ac.5);
},
Some(ToolKind::Hammer) | Some(ToolKind::HammerSimple) | Some(ToolKind::Pick) => {
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_x(0.0);
next.hand_l.position = Vec3::new(s_a.hhl.0, s_a.hhl.1, s_a.hhl.2);
next.hand_l.orientation =
Quaternion::rotation_x(s_a.hhl.3) * Quaternion::rotation_y(s_a.hhl.4);
next.hand_r.position = Vec3::new(s_a.hhr.0, s_a.hhr.1, s_a.hhr.2);
next.hand_r.orientation =
Quaternion::rotation_x(s_a.hhr.3) * Quaternion::rotation_y(s_a.hhr.4);
next.control.position = Vec3::new(
s_a.hc.0,
s_a.hc.1 + speed * 0.2,
s_a.hc.2 + speed * 0.8 + direction * -5.0,
);
next.control.orientation = Quaternion::rotation_x(s_a.hc.3 + u_slow * 0.15)
* Quaternion::rotation_y(s_a.hc.4 + speed * -0.04)
* Quaternion::rotation_z(s_a.hc.5 + u_slowalt * 0.07);
},
Some(ToolKind::Staff) | Some(ToolKind::Sceptre) => {
if speed > 0.5 && velocity.z == 0.0 {
next.hand_r.position = Vec3::new(
7.0 + s_a.hand.0 + foothoril * 1.3,
-4.0 + s_a.hand.1 + foothoril * -7.0,
1.0 + s_a.hand.2 - foothoril * 5.5,
);
next.hand_r.orientation = Quaternion::rotation_x(0.6 + footrotl * -1.2)
* Quaternion::rotation_y(footrotl * -0.4);
} else {
next.hand_r.position = Vec3::new(s_a.sthr.0, s_a.sthr.1, s_a.sthr.2);
next.hand_r.orientation =
Quaternion::rotation_x(s_a.sthr.3) * Quaternion::rotation_y(s_a.sthr.4);
};
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_y(0.0);
next.control.position =
Vec3::new(s_a.stc.0, s_a.stc.1, s_a.stc.2 + direction * -5.0);
next.hand_l.position = Vec3::new(s_a.sthl.0, s_a.sthl.1, s_a.sthl.2);
next.hand_l.orientation = Quaternion::rotation_x(s_a.sthl.3);
next.control.orientation = Quaternion::rotation_x(s_a.stc.3 + u_slow * 0.1)
* Quaternion::rotation_y(s_a.stc.4)
* Quaternion::rotation_z(s_a.stc.5 + u_slowalt * 0.1);
},
Some(ToolKind::Shield) => {
next.control.position = Vec3::new(0.0, 0.0, 0.0);
next.hand_l.position = Vec3::new(0.0, 0.0, 0.0);
next.hand_l.orientation = Quaternion::rotation_x(0.0 * PI);
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_x(0.0 * PI);
next.control_l.position = Vec3::new(-7.0, 0.0, 0.0);
next.hand_r.position = Vec3::new(0.0, 0.0, 0.0);
next.hand_r.orientation = Quaternion::rotation_x(0.0);
next.second.position = Vec3::new(0.0, 0.0, 0.0);
next.second.orientation = Quaternion::rotation_x(0.0 * PI);
next.control_r.position = Vec3::new(7.0, 0.0, 0.0);
},
Some(ToolKind::Bow) => {
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_x(0.0);
next.hand_l.position = Vec3::new(s_a.bhl.0, s_a.bhl.1, s_a.bhl.2);
next.hand_l.orientation = Quaternion::rotation_x(s_a.bhl.3);
next.hand_r.position = Vec3::new(s_a.bhr.0, s_a.bhr.1, s_a.bhr.2);
next.hand_r.orientation = Quaternion::rotation_x(s_a.bhr.3);
next.hold.position = Vec3::new(0.0, -1.0, -5.2);
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.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);
},
Some(ToolKind::Debug) => {
next.hand_l.position = Vec3::new(-7.0, 4.0, 3.0);
next.hand_l.orientation = Quaternion::rotation_x(1.27);
next.main.position = Vec3::new(-5.0, 5.0, 23.0);
next.main.orientation = Quaternion::rotation_x(PI);
},
Some(ToolKind::Farming) => {
if speed < 0.5 {
next.head.orientation = Quaternion::rotation_z(head_look.x)
* Quaternion::rotation_x(-0.2 + head_look.y.abs() + look_dir.z * 0.7);
}
next.hand_l.position = Vec3::new(9.0, 1.0, 1.0);
next.hand_l.orientation = Quaternion::rotation_x(1.57);
next.hand_r.position = Vec3::new(9.0, 1.0, 11.0);
next.hand_r.orientation = Quaternion::rotation_x(1.57);
next.main.position = Vec3::new(7.5, 7.5, 13.2);
next.main.orientation = Quaternion::rotation_y(3.14);
next.control.position = Vec3::new(-11.0 + slow * 2.0, 1.8, 4.0);
next.control.orientation = Quaternion::rotation_x(u_slow * 0.1)
* Quaternion::rotation_y(0.6 + u_slow * 0.1)
* Quaternion::rotation_z(u_slowalt * 0.1);
},
_ => {},
},
Some(ToolKind::Shield) => {
next.control.position = Vec3::new(0.0, 0.0, 0.0);
next.hand_l.position = Vec3::new(0.0, 0.0, 0.0);
next.hand_l.orientation = Quaternion::rotation_x(0.0 * PI);
(_, _) => {},
};
match hands {
(Some(Hands::One), _) => {
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_x(0.0 * PI);
next.control_l.position = Vec3::new(-7.0, 0.0, 0.0);
next.hand_r.position = Vec3::new(0.0, 0.0, 0.0);
next.hand_r.orientation = Quaternion::rotation_x(0.0);
next.second.position = Vec3::new(0.0, 0.0, 0.0);
next.second.orientation = Quaternion::rotation_x(0.0 * PI);
next.main.orientation = Quaternion::rotation_z(PI);
next.second.orientation = Quaternion::rotation_z(PI);
next.control_r.position = Vec3::new(7.0, 0.0, 0.0);
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)
},
Some(ToolKind::Bow) => {
(_, _) => {},
};
match hands {
(_, Some(Hands::One)) => {
next.main.position = Vec3::new(0.0, 0.0, 0.0);
next.main.orientation = Quaternion::rotation_x(0.0);
next.hand_l.position = Vec3::new(s_a.bhl.0, s_a.bhl.1, s_a.bhl.2);
next.hand_l.orientation = Quaternion::rotation_x(s_a.bhl.3);
next.hand_r.position = Vec3::new(s_a.bhr.0, s_a.bhr.1, s_a.bhr.2);
next.hand_r.orientation = Quaternion::rotation_x(s_a.bhr.3);
next.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.hold.position = Vec3::new(0.0, -1.0, -5.2);
next.hold.orientation = Quaternion::rotation_x(-1.57);
next.hold.scale = Vec3::one() * 1.0;
next.control_r.position = Vec3::new(8.0, 9.0, 4.0);
next.control_r.orientation = Quaternion::rotation_x(-0.3);
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);
next.hand_r.position = Vec3::new(0.0, 0.5, -4.0);
next.hand_r.orientation = Quaternion::rotation_x(1.57)
},
Some(ToolKind::Debug) => {
next.hand_l.position = Vec3::new(-7.0, 4.0, 3.0);
next.hand_l.orientation = Quaternion::rotation_x(1.27);
next.main.position = Vec3::new(-5.0, 5.0, 23.0);
next.main.orientation = Quaternion::rotation_x(PI);
(_, _) => {},
};
match hands {
(None, _) => {
next.hand_l.position = Vec3::new(0.0, 0.0, 20.0);
},
Some(ToolKind::Farming) => {
if speed < 0.5 {
next.head.orientation = Quaternion::rotation_z(head_look.x)
* Quaternion::rotation_x(-0.2 + head_look.y.abs() + look_dir.z * 0.7);
}
next.hand_l.position = Vec3::new(9.0, 1.0, 1.0);
next.hand_l.orientation = Quaternion::rotation_x(1.57);
next.hand_r.position = Vec3::new(9.0, 1.0, 11.0);
next.hand_r.orientation = Quaternion::rotation_x(1.57);
next.main.position = Vec3::new(7.5, 7.5, 13.2);
next.main.orientation = Quaternion::rotation_y(3.14);
(_, _) => {},
};
next.control.position = Vec3::new(-11.0 + slow * 2.0, 1.8, 4.0);
next.control.orientation = Quaternion::rotation_x(u_slow * 0.1)
* Quaternion::rotation_y(0.6 + u_slow * 0.1)
* Quaternion::rotation_z(u_slowalt * 0.1);
match hands {
(_, None) => {
next.hand_r.position = Vec3::new(0.0, 0.0, 20.0);
},
_ => {},
}
(_, _) => {},
};
next
}
}

View File

@ -146,23 +146,25 @@ 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 || {
let mut modified_paths = std::collections::HashSet::new();
while let Ok(path) = reload_recv.recv() {
modified_paths.insert(path);
// Wait for any additional modify events before reloading
while let Ok(path) = reload_recv.recv_timeout(Duration::from_millis(300)) {
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);
// Wait for any additional modify events before reloading
while let Ok(path) = reload_recv.recv_timeout(Duration::from_millis(300)) {
modified_paths.insert(path);
}
info!(
?modified_paths,
"Hot reloading animations because files in `anim` modified."
);
hotreload();
}
info!(
?modified_paths,
"Hot reloading animations because files in `anim` modified."
);
hotreload();
}
});
});
// Let the watcher live forever
std::mem::forget(watcher);

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(),