mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
wielding
This commit is contained in:
parent
31208e29ee
commit
6a57dd25d0
@ -16,10 +16,6 @@
|
||||
offset: (-0.5, -5.0, -2.5),
|
||||
central: ("armor.empty"),
|
||||
),
|
||||
main: (
|
||||
offset: (-1.5, -7.5, -5.0),
|
||||
central: ("armor.empty"),
|
||||
),
|
||||
),
|
||||
(Gnome, Female): (
|
||||
head: (
|
||||
@ -38,10 +34,6 @@
|
||||
offset: (-0.5, -5.0, -2.5),
|
||||
central: ("armor.empty"),
|
||||
),
|
||||
main: (
|
||||
offset: (-1.5, -7.5, -5.0),
|
||||
central: ("armor.empty"),
|
||||
),
|
||||
),
|
||||
(Sahagin, Male): (
|
||||
head: (
|
||||
@ -60,10 +52,6 @@
|
||||
offset: (-1.5, -13.0, -5.0),
|
||||
central: ("npc.sahagin.male.tail"),
|
||||
),
|
||||
main: (
|
||||
offset: (-0.5, -7.5, -5.0),
|
||||
central: ("weapon.spear.sahagin"),
|
||||
),
|
||||
),
|
||||
(Sahagin, Female): (
|
||||
head: (
|
||||
@ -82,10 +70,6 @@
|
||||
offset: (-1.5, -13.0, -5.0),
|
||||
central: ("npc.sahagin.male.tail"),
|
||||
),
|
||||
main: (
|
||||
offset: (-0.5, -7.5, -5.0),
|
||||
central: ("weapon.spear.sahagin"),
|
||||
),
|
||||
),
|
||||
(Adlet, Male): (
|
||||
head: (
|
||||
@ -104,10 +88,6 @@
|
||||
offset: (-1.0, -5.0, -1.0),
|
||||
central: ("npc.adlet.male.tail"),
|
||||
),
|
||||
main: (
|
||||
offset: (-0.5, -7.5, -5.0),
|
||||
central: ("weapon.spear.adlet"),
|
||||
),
|
||||
),
|
||||
(Adlet, Female): (
|
||||
head: (
|
||||
@ -126,10 +106,6 @@
|
||||
offset: (-1.0, -5.0, -1.0),
|
||||
central: ("npc.adlet.male.tail"),
|
||||
),
|
||||
main: (
|
||||
offset: (-0.5, -7.5, -5.0),
|
||||
central: ("weapon.spear.adlet"),
|
||||
),
|
||||
),
|
||||
(Gnarling, Male): (
|
||||
head: (
|
||||
@ -148,10 +124,6 @@
|
||||
offset: (-1.5, -13.0, -3.0),
|
||||
central: ("npc.gnarling.male.tail"),
|
||||
),
|
||||
main: (
|
||||
offset: (-0.5, -7.5, -5.0),
|
||||
central: ("weapon.spear.adlet"),
|
||||
),
|
||||
),
|
||||
(Gnarling, Female): (
|
||||
head: (
|
||||
@ -170,10 +142,6 @@
|
||||
offset: (-1.5, -13.0, -3.0),
|
||||
central: ("npc.gnarling.male.tail"),
|
||||
),
|
||||
main: (
|
||||
offset: (-0.5, -7.5, -5.0),
|
||||
central: ("weapon.spear.adlet"),
|
||||
),
|
||||
),
|
||||
(Mandragora, Male): (
|
||||
head: (
|
||||
@ -192,10 +160,6 @@
|
||||
offset: (0.0, 0.0, 0.0),
|
||||
central: ("armor.empty"),
|
||||
),
|
||||
main: (
|
||||
offset: (-0.5, -7.5, -5.0),
|
||||
central: ("weapon.spear.adlet"),
|
||||
),
|
||||
),
|
||||
(Mandragora, Female): (
|
||||
head: (
|
||||
@ -214,10 +178,6 @@
|
||||
offset: (0.0, 0.0, 0.0),
|
||||
central: ("armor.empty"),
|
||||
),
|
||||
main: (
|
||||
offset: (-0.5, -7.5, -5.0),
|
||||
central: ("weapon.spear.adlet"),
|
||||
),
|
||||
),
|
||||
(Kappa, Male): (
|
||||
head: (
|
||||
@ -236,10 +196,6 @@
|
||||
offset: (-2.5, -10.0, -5.0),
|
||||
central: ("npc.kappa.male.tail"),
|
||||
),
|
||||
main: (
|
||||
offset: (-0.5, -7.5, -5.0),
|
||||
central: ("weapon.spear.adlet"),
|
||||
),
|
||||
),
|
||||
(Kappa, Female): (
|
||||
head: (
|
||||
@ -258,9 +214,5 @@
|
||||
offset: (-2.5, -10.0, -5.0),
|
||||
central: ("npc.kappa.male.tail"),
|
||||
),
|
||||
main: (
|
||||
offset: (-0.5, -7.5, -5.0),
|
||||
central: ("weapon.spear.adlet"),
|
||||
),
|
||||
),
|
||||
})
|
||||
|
@ -1,11 +1,11 @@
|
||||
({
|
||||
(Gnome, Male): (
|
||||
hand_l: (
|
||||
offset: (-2.0, -2.0, -5.0),
|
||||
offset: (-4.0, -2.0, -5.0),
|
||||
lateral: ("npc.gnome.male.hand_l"),
|
||||
),
|
||||
hand_r: (
|
||||
offset: (-2.0, -2.0, -5.0),
|
||||
offset: (0.0, -2.0, -5.0),
|
||||
lateral: ("npc.gnome.male.hand_r"),
|
||||
),
|
||||
foot_l: (
|
||||
@ -19,11 +19,11 @@
|
||||
),
|
||||
(Gnome, Female): (
|
||||
hand_l: (
|
||||
offset: (-2.0, -2.0, -5.0),
|
||||
offset: (-4.0, -2.0, -5.0),
|
||||
lateral: ("npc.gnome.male.hand_l"),
|
||||
),
|
||||
hand_r: (
|
||||
offset: (-2.0, -2.0, -5.0),
|
||||
offset: (0.0, -2.0, -5.0),
|
||||
lateral: ("npc.gnome.male.hand_r"),
|
||||
),
|
||||
foot_l: (
|
||||
@ -37,11 +37,11 @@
|
||||
),
|
||||
(Sahagin, Male): (
|
||||
hand_l: (
|
||||
offset: (0.0, -4.0, -11.0),
|
||||
offset: (-7.0, -4.0, -13.0),
|
||||
lateral: ("npc.sahagin.male.hand_l"),
|
||||
),
|
||||
hand_r: (
|
||||
offset: (0.0, -4.0, -11.0),
|
||||
offset: (0.0, -4.0, -13.0),
|
||||
lateral: ("npc.sahagin.male.hand_r"),
|
||||
),
|
||||
foot_l: (
|
||||
@ -55,11 +55,11 @@
|
||||
),
|
||||
(Sahagin, Female): (
|
||||
hand_l: (
|
||||
offset: (0.0, -4.0, -11.0),
|
||||
offset: (-7.0, -4.0, -13.0),
|
||||
lateral: ("npc.sahagin.male.hand_l"),
|
||||
),
|
||||
hand_r: (
|
||||
offset: (-7.0, -4.0, -11.0),
|
||||
offset: (0.0, -4.0, -13.0),
|
||||
lateral: ("npc.sahagin.male.hand_r"),
|
||||
),
|
||||
foot_l: (
|
||||
@ -73,11 +73,11 @@
|
||||
),
|
||||
(Adlet, Male): (
|
||||
hand_l: (
|
||||
offset: (-2.0, -2.0, -6.0),
|
||||
offset: (-4.0, -2.0, -7.0),
|
||||
lateral: ("npc.adlet.male.hand_l"),
|
||||
),
|
||||
hand_r: (
|
||||
offset: (-2.0, -2.0, -6.0),
|
||||
offset: (0.0, -2.0, -7.0),
|
||||
lateral: ("npc.adlet.male.hand_r"),
|
||||
),
|
||||
foot_l: (
|
||||
@ -91,11 +91,11 @@
|
||||
),
|
||||
(Adlet, Female): (
|
||||
hand_l: (
|
||||
offset: (-2.0, -2.0, -6.0),
|
||||
offset: (-4.0, -2.0, -7.0),
|
||||
lateral: ("npc.adlet.male.hand_l"),
|
||||
),
|
||||
hand_r: (
|
||||
offset: (-2.0, -2.0, -6.0),
|
||||
offset: (0.0, -2.0, -7.0),
|
||||
lateral: ("npc.adlet.male.hand_r"),
|
||||
),
|
||||
foot_l: (
|
||||
@ -109,11 +109,11 @@
|
||||
),
|
||||
(Gnarling, Male): (
|
||||
hand_l: (
|
||||
offset: (-1.5, -1.5, -7.0),
|
||||
offset: (-3.0, -1.5, -7.0),
|
||||
lateral: ("npc.gnarling.male.hand_l"),
|
||||
),
|
||||
hand_r: (
|
||||
offset: (-1.5, -1.5, -7.0),
|
||||
offset: (0.0, -1.5, -7.0),
|
||||
lateral: ("npc.gnarling.male.hand_r"),
|
||||
),
|
||||
foot_l: (
|
||||
@ -127,11 +127,11 @@
|
||||
),
|
||||
(Gnarling, Female): (
|
||||
hand_l: (
|
||||
offset: (-1.5, -1.5, -7.0),
|
||||
offset: (-3.0, -1.5, -7.0),
|
||||
lateral: ("npc.gnarling.male.hand_l"),
|
||||
),
|
||||
hand_r: (
|
||||
offset: (-1.5, -1.5, -7.0),
|
||||
offset: (0.0, -1.5, -7.0),
|
||||
lateral: ("npc.gnarling.male.hand_r"),
|
||||
),
|
||||
foot_l: (
|
||||
@ -145,11 +145,11 @@
|
||||
),
|
||||
(Mandragora, Male): (
|
||||
hand_l: (
|
||||
offset: (-2.0, -1.5, -7.0),
|
||||
offset: (-4.0, -1.5, -7.0),
|
||||
lateral: ("npc.mandragora.male.hand_l"),
|
||||
),
|
||||
hand_r: (
|
||||
offset: (-2.0, -1.5, -7.0),
|
||||
offset: (0.0, -1.5, -7.0),
|
||||
lateral: ("npc.mandragora.male.hand_r"),
|
||||
),
|
||||
foot_l: (
|
||||
@ -163,11 +163,11 @@
|
||||
),
|
||||
(Mandragora, Female): (
|
||||
hand_l: (
|
||||
offset: (-2.0, -1.5, -7.0),
|
||||
offset: (-4.0, -1.5, -7.0),
|
||||
lateral: ("npc.mandragora.male.hand_l"),
|
||||
),
|
||||
hand_r: (
|
||||
offset: (-2.0, -1.5, -7.0),
|
||||
offset: (0.0, -1.5, -7.0),
|
||||
lateral: ("npc.mandragora.male.hand_r"),
|
||||
),
|
||||
foot_l: (
|
||||
@ -181,11 +181,11 @@
|
||||
),
|
||||
(Kappa, Male): (
|
||||
hand_l: (
|
||||
offset: (-3.0, -4.0, -10.0),
|
||||
offset: (-6.0, -4.0, -12.0),
|
||||
lateral: ("npc.kappa.male.hand_l"),
|
||||
),
|
||||
hand_r: (
|
||||
offset: (-3.0, -4.0, -10.0),
|
||||
offset: (0.0, -4.0, -12.0),
|
||||
lateral: ("npc.kappa.male.hand_r"),
|
||||
),
|
||||
foot_l: (
|
||||
@ -199,11 +199,11 @@
|
||||
),
|
||||
(Kappa, Female): (
|
||||
hand_l: (
|
||||
offset: (-3.0, -4.0, -10.0),
|
||||
offset: (-6.0, -4.0, -12.0),
|
||||
lateral: ("npc.kappa.male.hand_l"),
|
||||
),
|
||||
hand_r: (
|
||||
offset: (-3.0, -4.0, -10.0),
|
||||
offset: (0.0, -4.0, -12.0),
|
||||
lateral: ("npc.kappa.male.hand_r"),
|
||||
),
|
||||
foot_l: (
|
||||
|
74
assets/voxygen/voxel/biped_small_weapon_manifest.ron
Normal file
74
assets/voxygen/voxel/biped_small_weapon_manifest.ron
Normal file
@ -0,0 +1,74 @@
|
||||
({
|
||||
(Gnome, Male): (
|
||||
main: (
|
||||
offset: (-1.5, -3.0, -5.0),
|
||||
weapon: ("weapon.spear.sahagin"),
|
||||
),
|
||||
),
|
||||
(Gnome, Female): (
|
||||
main: (
|
||||
offset: (-1.5, -3.0, -5.0),
|
||||
weapon: ("weapon.spear.sahagin"),
|
||||
),
|
||||
),
|
||||
(Sahagin, Male): (
|
||||
main: (
|
||||
offset: (-1.5, -3.0, -5.0),
|
||||
weapon: ("weapon.spear.sahagin"),
|
||||
),
|
||||
),
|
||||
(Sahagin, Female): (
|
||||
main: (
|
||||
offset: (-1.5, -3.0, -5.0),
|
||||
weapon: ("weapon.spear.sahagin"),
|
||||
),
|
||||
),
|
||||
(Adlet, Male): (
|
||||
main: (
|
||||
offset: (-0.5, -3.0, -5.0),
|
||||
weapon: ("weapon.spear.adlet"),
|
||||
),
|
||||
),
|
||||
(Adlet, Female): (
|
||||
main: (
|
||||
offset: (-0.5, -3.0, -5.0),
|
||||
weapon: ("weapon.spear.adlet"),
|
||||
),
|
||||
),
|
||||
(Gnarling, Male): (
|
||||
main: (
|
||||
offset: (-0.5, -3.0, -5.0),
|
||||
weapon: ("weapon.spear.adlet"),
|
||||
),
|
||||
),
|
||||
(Gnarling, Female): (
|
||||
main: (
|
||||
offset: (-0.5, -3.0, -5.0),
|
||||
weapon: ("weapon.spear.adlet"),
|
||||
),
|
||||
),
|
||||
(Mandragora, Male): (
|
||||
main: (
|
||||
offset: (-0.5, -3.0, -5.0),
|
||||
weapon: ("weapon.spear.adlet"),
|
||||
),
|
||||
),
|
||||
(Mandragora, Female): (
|
||||
main: (
|
||||
offset: (-0.5, -3.0, -5.0),
|
||||
weapon: ("weapon.spear.adlet"),
|
||||
),
|
||||
),
|
||||
(Kappa, Male): (
|
||||
main: (
|
||||
offset: (-0.5, -3.0, -5.0),
|
||||
weapon: ("weapon.spear.adlet"),
|
||||
),
|
||||
),
|
||||
(Kappa, Female): (
|
||||
main: (
|
||||
offset: (-0.5, -3.0, -5.0),
|
||||
weapon: ("weapon.spear.adlet"),
|
||||
),
|
||||
),
|
||||
})
|
BIN
assets/voxygen/voxel/npc/basilisk/male/chest.vox
(Stored with Git LFS)
BIN
assets/voxygen/voxel/npc/basilisk/male/chest.vox
(Stored with Git LFS)
Binary file not shown.
BIN
assets/voxygen/voxel/npc/basilisk/male/head_lower.vox
(Stored with Git LFS)
BIN
assets/voxygen/voxel/npc/basilisk/male/head_lower.vox
(Stored with Git LFS)
Binary file not shown.
BIN
assets/voxygen/voxel/npc/basilisk/male/tail_front.vox
(Stored with Git LFS)
BIN
assets/voxygen/voxel/npc/basilisk/male/tail_front.vox
(Stored with Git LFS)
Binary file not shown.
BIN
assets/voxygen/voxel/npc/sunlizard/male/chest_back.vox
(Stored with Git LFS)
BIN
assets/voxygen/voxel/npc/sunlizard/male/chest_back.vox
(Stored with Git LFS)
Binary file not shown.
@ -2,7 +2,6 @@ use super::{
|
||||
super::{vek::*, Animation},
|
||||
BipedSmallSkeleton, SkeletonAttr,
|
||||
};
|
||||
use std::{f32::consts::PI, ops::Mul};
|
||||
|
||||
pub struct IdleAnimation;
|
||||
|
||||
|
@ -1,8 +1,9 @@
|
||||
pub mod idle;
|
||||
pub mod run;
|
||||
pub mod wield;
|
||||
|
||||
// Reexports
|
||||
pub use self::{idle::IdleAnimation, run::RunAnimation};
|
||||
pub use self::{idle::IdleAnimation, run::RunAnimation, wield::WieldAnimation};
|
||||
|
||||
use super::{make_bone, vek::*, FigureBoneData, Skeleton};
|
||||
use common::comp::{self};
|
||||
@ -20,6 +21,10 @@ skeleton_impls!(struct BipedSmallSkeleton {
|
||||
+ hand_r,
|
||||
+ foot_l,
|
||||
+ foot_r,
|
||||
control,
|
||||
control_l,
|
||||
control_r,
|
||||
|
||||
});
|
||||
|
||||
impl Skeleton for BipedSmallSkeleton {
|
||||
@ -38,15 +43,17 @@ impl Skeleton for BipedSmallSkeleton {
|
||||
) -> Vec3<f32> {
|
||||
let chest_mat = base_mat * Mat4::<f32>::from(self.chest);
|
||||
let shorts_mat = chest_mat * Mat4::<f32>::from(self.shorts);
|
||||
|
||||
let control_mat = chest_mat * Mat4::<f32>::from(self.control);
|
||||
let control_l_mat = Mat4::<f32>::from(self.control_l);
|
||||
let control_r_mat = Mat4::<f32>::from(self.control_r);
|
||||
*(<&mut [_; Self::BONE_COUNT]>::try_from(&mut buf[0..Self::BONE_COUNT]).unwrap()) = [
|
||||
make_bone(chest_mat * Mat4::<f32>::from(self.head)),
|
||||
make_bone(chest_mat),
|
||||
make_bone(shorts_mat),
|
||||
make_bone(shorts_mat * Mat4::<f32>::from(self.tail)),
|
||||
make_bone(chest_mat * Mat4::<f32>::from(self.main)),
|
||||
make_bone(chest_mat * Mat4::<f32>::from(self.hand_l)),
|
||||
make_bone(chest_mat * Mat4::<f32>::from(self.hand_r)),
|
||||
make_bone(control_mat * Mat4::<f32>::from(self.main)),
|
||||
make_bone(control_mat * control_l_mat * Mat4::<f32>::from(self.hand_l)),
|
||||
make_bone(control_mat * control_r_mat * Mat4::<f32>::from(self.hand_r)),
|
||||
make_bone(base_mat * Mat4::<f32>::from(self.foot_l)),
|
||||
make_bone(base_mat * Mat4::<f32>::from(self.foot_r)),
|
||||
];
|
||||
@ -61,6 +68,7 @@ pub struct SkeletonAttr {
|
||||
tail: (f32, f32),
|
||||
hand: (f32, f32, f32),
|
||||
foot: (f32, f32, f32),
|
||||
grip: (f32, f32, f32),
|
||||
}
|
||||
|
||||
impl<'a> std::convert::TryFrom<&'a comp::Body> for SkeletonAttr {
|
||||
@ -83,6 +91,7 @@ impl Default for SkeletonAttr {
|
||||
tail: (0.0, 0.0),
|
||||
hand: (0.0, 0.0, 0.0),
|
||||
foot: (0.0, 0.0, 0.0),
|
||||
grip: (0.0, 0.0, 0.0),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -104,7 +113,7 @@ impl<'a> From<&'a Body> for SkeletonAttr {
|
||||
(Sahagin, _) => (0.0, 15.0),
|
||||
(Adlet, _) => (0.0, 11.0),
|
||||
(Gnarling, _) => (0.0, 7.5),
|
||||
(Mandragora, _) => (0.0, 8.5),
|
||||
(Mandragora, _) => (0.0, 10.5),
|
||||
(Kappa, _) => (0.0, 14.5),
|
||||
},
|
||||
shorts: match (body.species, body.body_type) {
|
||||
@ -112,7 +121,7 @@ impl<'a> From<&'a Body> for SkeletonAttr {
|
||||
(Sahagin, _) => (0.5, -7.0),
|
||||
(Adlet, _) => (0.0, -3.0),
|
||||
(Gnarling, _) => (0.0, -3.0),
|
||||
(Mandragora, _) => (0.0, -3.0),
|
||||
(Mandragora, _) => (0.0, -6.5),
|
||||
(Kappa, _) => (0.0, -3.0),
|
||||
},
|
||||
tail: match (body.species, body.body_type) {
|
||||
@ -120,16 +129,16 @@ impl<'a> From<&'a Body> for SkeletonAttr {
|
||||
(Sahagin, _) => (-2.5, -2.0),
|
||||
(Adlet, _) => (-4.5, -2.0),
|
||||
(Gnarling, _) => (-2.0, 1.5),
|
||||
(Mandragora, _) => (0.0, 0.0),
|
||||
(Kappa, _) => (0.0, -3.0),
|
||||
(Mandragora, _) => (0.0, -1.0),
|
||||
(Kappa, _) => (0.0, -4.0),
|
||||
},
|
||||
hand: match (body.species, body.body_type) {
|
||||
(Gnome, _) => (6.0, 0.5, -1.0),
|
||||
(Sahagin, _) => (9.5, 3.5, -2.0),
|
||||
(Adlet, _) => (6.0, -0.5, 0.0),
|
||||
(Gnarling, _) => (5.0, 0.0, 1.5),
|
||||
(Mandragora, _) => (6.0, -0.5, -2.5),
|
||||
(Kappa, _) => (7.5, 3.5, -2.0),
|
||||
(Gnome, _) => (4.0, 0.5, -1.0),
|
||||
(Sahagin, _) => (3.5, 3.5, -2.0),
|
||||
(Adlet, _) => (4.5, -0.5, 2.0),
|
||||
(Gnarling, _) => (4.0, 0.0, 1.5),
|
||||
(Mandragora, _) => (4.0, -0.5, -2.5),
|
||||
(Kappa, _) => (4.0, 3.5, -0.5),
|
||||
},
|
||||
foot: match (body.species, body.body_type) {
|
||||
(Gnome, _) => (3.0, 0.0, 4.0),
|
||||
@ -139,6 +148,14 @@ impl<'a> From<&'a Body> for SkeletonAttr {
|
||||
(Mandragora, _) => (3.0, 0.0, 4.0),
|
||||
(Kappa, _) => (3.0, 3.0, 9.0),
|
||||
},
|
||||
grip: match (body.species, body.body_type) {
|
||||
(Gnome, _) => (0.0, 0.0, 5.0),
|
||||
(Sahagin, _) => (1.0, 0.0, 13.0),
|
||||
(Adlet, _) => (0.0, 0.0, 7.0),
|
||||
(Gnarling, _) => (0.0, 0.0, 7.0),
|
||||
(Mandragora, _) => (0.0, 0.0, 7.0),
|
||||
(Kappa, _) => (0.75, 1.0, 12.0),
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ impl Animation for RunAnimation {
|
||||
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
(velocity, orientation, last_ori, global_time, avg_vel, acc_vel): Self::Dependency,
|
||||
(velocity, orientation, last_ori, global_time, _avg_vel, acc_vel): Self::Dependency,
|
||||
anim_time: f64,
|
||||
rate: &mut f32,
|
||||
s_a: &SkeletonAttr,
|
||||
@ -27,7 +27,6 @@ impl Animation for RunAnimation {
|
||||
let mut next = (*skeleton).clone();
|
||||
let speed = Vec2::<f32>::from(velocity).magnitude();
|
||||
*rate = 1.0;
|
||||
let impact = (avg_vel.z).max(-8.0);
|
||||
let speednorm = speed / 9.4;
|
||||
|
||||
let lab = 1.0;
|
||||
@ -105,9 +104,7 @@ impl Animation for RunAnimation {
|
||||
) / 13.0;
|
||||
next.chest.orientation = Quaternion::rotation_z(short * 0.06 + tilt * -0.6)
|
||||
* Quaternion::rotation_y(tilt * 1.6)
|
||||
* Quaternion::rotation_x(
|
||||
impact * 0.06 + shortalter * 0.035 + speednorm * -0.4 + (tilt.abs()),
|
||||
);
|
||||
* Quaternion::rotation_x(shortalter * 0.035 + speednorm * -0.4 + (tilt.abs()));
|
||||
|
||||
next.shorts.position = Vec3::new(0.0, s_a.shorts.0, s_a.shorts.1);
|
||||
next.shorts.orientation = Quaternion::rotation_x(0.1 * speednorm)
|
||||
@ -136,10 +133,10 @@ impl Animation for RunAnimation {
|
||||
next.foot_l.position = Vec3::new(
|
||||
-s_a.foot.0 + footstrafel * sideabs * 3.0 + tilt * -2.0,
|
||||
s_a.foot.1
|
||||
+ (1.0 - sideabs) * (-1.0 * speednorm + footrotl * -4.5 * speednorm)
|
||||
+ (1.0 - sideabs) * (-1.0 * speednorm + footrotl * -1.5 * speednorm)
|
||||
+ (direction * 5.0).max(0.0),
|
||||
s_a.foot.2
|
||||
+ (1.0 - sideabs) * (2.0 * speednorm + ((footvertl * -2.1 * speednorm).max(-1.0)))
|
||||
+ (1.0 - sideabs) * (2.0 * speednorm + ((footvertl * -1.1 * speednorm).max(-1.0)))
|
||||
+ side * ((footvertsl * 1.5).max(-1.0)),
|
||||
) / 13.0;
|
||||
next.foot_l.orientation = Quaternion::rotation_x(
|
||||
@ -151,10 +148,10 @@ impl Animation for RunAnimation {
|
||||
next.foot_r.position = Vec3::new(
|
||||
s_a.foot.0 + footstrafer * sideabs * 3.0 + tilt * -2.0,
|
||||
s_a.foot.1
|
||||
+ (1.0 - sideabs) * (-1.0 * speednorm + footrotr * -4.5 * speednorm)
|
||||
+ (1.0 - sideabs) * (-1.0 * speednorm + footrotr * -1.5 * speednorm)
|
||||
+ (direction * 5.0).max(0.0),
|
||||
s_a.foot.2
|
||||
+ (1.0 - sideabs) * (2.0 * speednorm + ((footvertr * -2.1 * speednorm).max(-1.0)))
|
||||
+ (1.0 - sideabs) * (2.0 * speednorm + ((footvertr * -1.1 * speednorm).max(-1.0)))
|
||||
+ side * ((footvertsr * -1.5).max(-1.0)),
|
||||
) / 13.0;
|
||||
next.foot_r.orientation = Quaternion::rotation_x(
|
||||
|
85
voxygen/anim/src/biped_small/wield.rs
Normal file
85
voxygen/anim/src/biped_small/wield.rs
Normal file
@ -0,0 +1,85 @@
|
||||
use super::{
|
||||
super::{vek::*, Animation},
|
||||
BipedSmallSkeleton, SkeletonAttr,
|
||||
};
|
||||
use std::f32::consts::PI;
|
||||
|
||||
pub struct WieldAnimation;
|
||||
|
||||
type WieldAnimationDependency = (Vec3<f32>, Vec3<f32>, Vec3<f32>, f64, Vec3<f32>, f32);
|
||||
|
||||
impl Animation for WieldAnimation {
|
||||
type Dependency = WieldAnimationDependency;
|
||||
type Skeleton = BipedSmallSkeleton;
|
||||
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
const UPDATE_FN: &'static [u8] = b"biped_small_wield\0";
|
||||
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "biped_small_wield")]
|
||||
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
(velocity, _orientation, _last_ori, _global_time, _avg_vel, acc_vel): Self::Dependency,
|
||||
anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
s_a: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
let mut next = (*skeleton).clone();
|
||||
let speed = Vec2::<f32>::from(velocity).magnitude();
|
||||
|
||||
let fastacc = (acc_vel * 2.0).sin();
|
||||
let fast = (anim_time as f32 * 10.0).sin();
|
||||
let fastalt = (anim_time as f32 * 10.0 + PI / 2.0).sin();
|
||||
let slow = (anim_time as f32 * 2.0).sin();
|
||||
|
||||
let speednorm = speed / 9.4;
|
||||
let speednormcancel = 1.0 - speednorm;
|
||||
|
||||
next.foot_l.scale = Vec3::one() / 13.0;
|
||||
next.foot_r.scale = Vec3::one() / 13.0;
|
||||
|
||||
next.chest.scale = Vec3::one() / 13.0;
|
||||
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1 + fast * -0.1 * speednormcancel);
|
||||
next.head.orientation = Quaternion::rotation_x(0.45 * speednorm)
|
||||
* Quaternion::rotation_y(fast * 0.15 * speednormcancel);
|
||||
next.chest.position = Vec3::new(
|
||||
0.0,
|
||||
s_a.chest.0,
|
||||
s_a.chest.1 + fastalt * 0.4 * speednormcancel + speednormcancel * -0.5,
|
||||
) / 13.0;
|
||||
|
||||
next.shorts.position = Vec3::new(0.0, s_a.shorts.0, s_a.shorts.1);
|
||||
//next.main.position = Vec3::new(0.0, s_a.hand.2*-1.0, 0.0);
|
||||
|
||||
next.main.position = Vec3::new(0.0, 0.0, 0.0);
|
||||
|
||||
next.hand_l.position = Vec3::new(s_a.grip.0 * 4.0, 0.0, s_a.grip.2);
|
||||
next.hand_r.position = Vec3::new(-s_a.grip.0 * 4.0, 0.0, s_a.grip.2);
|
||||
|
||||
next.hand_l.orientation = Quaternion::rotation_x(0.0);
|
||||
next.hand_r.orientation = Quaternion::rotation_x(0.0);
|
||||
|
||||
next.control_l.position = Vec3::new(1.0 - s_a.grip.0 * 2.0, 2.0, -2.0);
|
||||
next.control_r.position = Vec3::new(-1.0 + s_a.grip.0 * 2.0, 2.0, 2.0);
|
||||
|
||||
next.control.position = Vec3::new(
|
||||
-3.0,
|
||||
s_a.grip.2,
|
||||
-s_a.grip.2 / 2.5 + s_a.grip.0 * -2.0 + fastacc * 1.5 + fastalt * 0.5 * speednormcancel,
|
||||
);
|
||||
|
||||
next.control_l.orientation =
|
||||
Quaternion::rotation_x(PI / 1.5 + slow * 0.1) * Quaternion::rotation_y(-0.3);
|
||||
next.control_r.orientation =
|
||||
Quaternion::rotation_x(PI / 1.5 + slow * 0.1 + s_a.grip.0 * 0.2)
|
||||
* Quaternion::rotation_y(0.5 + slow * 0.0 + s_a.grip.0 * 0.2);
|
||||
|
||||
next.control.orientation = Quaternion::rotation_x(-1.35 + 0.5 * speednorm);
|
||||
|
||||
next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1);
|
||||
next.tail.orientation = Quaternion::rotation_x(0.05 * fastalt * speednormcancel)
|
||||
* Quaternion::rotation_z(fast * 0.15 * speednormcancel);
|
||||
|
||||
next
|
||||
}
|
||||
}
|
@ -2478,7 +2478,6 @@ struct SidedBSCentralVoxSpec {
|
||||
chest: BipedSmallCentralSubSpec,
|
||||
shorts: BipedSmallCentralSubSpec,
|
||||
tail: BipedSmallCentralSubSpec,
|
||||
main: BipedSmallCentralSubSpec,
|
||||
}
|
||||
#[derive(Deserialize)]
|
||||
struct BipedSmallCentralSubSpec {
|
||||
@ -2500,11 +2499,24 @@ struct BipedSmallLateralSubSpec {
|
||||
lateral: VoxSimple,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
struct BipedSmallWeaponSpec(HashMap<(BSSpecies, BSBodyType), SidedBSWeaponVoxSpec>);
|
||||
#[derive(Deserialize)]
|
||||
struct SidedBSWeaponVoxSpec {
|
||||
main: BipedSmallWeaponSubSpec,
|
||||
}
|
||||
#[derive(Deserialize)]
|
||||
struct BipedSmallWeaponSubSpec {
|
||||
offset: [f32; 3], // Should be relative to initial origin
|
||||
weapon: VoxSimple,
|
||||
}
|
||||
|
||||
make_vox_spec!(
|
||||
biped_small::Body,
|
||||
struct BipedSmallSpec {
|
||||
central: BipedSmallCentralSpec = "voxygen.voxel.biped_small_central_manifest",
|
||||
lateral: BipedSmallLateralSpec = "voxygen.voxel.biped_small_lateral_manifest",
|
||||
weapon: BipedSmallWeaponSpec = "voxygen.voxel.biped_small_weapon_manifest",
|
||||
},
|
||||
|FigureKey { body, .. }, spec| {
|
||||
[
|
||||
@ -2524,7 +2536,7 @@ make_vox_spec!(
|
||||
body.species,
|
||||
body.body_type,
|
||||
)),
|
||||
Some(spec.central.read().0.mesh_main(
|
||||
Some(spec.weapon.read().0.mesh_main(
|
||||
body.species,
|
||||
body.body_type,
|
||||
)),
|
||||
@ -2619,22 +2631,6 @@ impl BipedSmallCentralSpec {
|
||||
|
||||
(central, Vec3::from(spec.tail.offset))
|
||||
}
|
||||
|
||||
fn mesh_main(&self, species: BSSpecies, body_type: BSBodyType) -> BoneMeshes {
|
||||
let spec = match self.0.get(&(species, body_type)) {
|
||||
Some(spec) => spec,
|
||||
None => {
|
||||
error!(
|
||||
"No main specification exists for the combination of {:?} and {:?}",
|
||||
species, body_type
|
||||
);
|
||||
return load_mesh("not_found", Vec3::new(-5.0, -5.0, -2.5));
|
||||
},
|
||||
};
|
||||
let central = graceful_load_segment(&spec.main.central.0);
|
||||
|
||||
(central, Vec3::from(spec.main.offset))
|
||||
}
|
||||
}
|
||||
|
||||
impl BipedSmallLateralSpec {
|
||||
@ -2702,6 +2698,24 @@ impl BipedSmallLateralSpec {
|
||||
(lateral, Vec3::from(spec.foot_r.offset))
|
||||
}
|
||||
}
|
||||
impl BipedSmallWeaponSpec {
|
||||
fn mesh_main(&self, species: BSSpecies, body_type: BSBodyType) -> BoneMeshes {
|
||||
let spec = match self.0.get(&(species, body_type)) {
|
||||
Some(spec) => spec,
|
||||
None => {
|
||||
error!(
|
||||
"No main specification exists for the combination of {:?} and {:?}",
|
||||
species, body_type
|
||||
);
|
||||
return load_mesh("not_found", Vec3::new(-5.0, -5.0, -2.5));
|
||||
},
|
||||
};
|
||||
let weapon = graceful_load_segment(&spec.main.weapon.0);
|
||||
|
||||
(weapon, Vec3::from(spec.main.offset))
|
||||
}
|
||||
}
|
||||
|
||||
////
|
||||
|
||||
#[derive(Deserialize)]
|
||||
|
@ -2624,8 +2624,19 @@ impl FigureMgr {
|
||||
&mut state_animation_rate,
|
||||
skeleton_attr,
|
||||
),
|
||||
_ => anim::biped_small::RunAnimation::update_skeleton(
|
||||
_ => anim::biped_small::IdleAnimation::update_skeleton(
|
||||
&BipedSmallSkeleton::default(),
|
||||
(vel.0, ori, state.last_ori, time, state.avg_vel),
|
||||
state.state_time,
|
||||
&mut state_animation_rate,
|
||||
skeleton_attr,
|
||||
),
|
||||
};
|
||||
|
||||
let target_bones = match &character {
|
||||
CharacterState::Wielding { .. } => {
|
||||
anim::biped_small::WieldAnimation::update_skeleton(
|
||||
&target_base,
|
||||
(
|
||||
vel.0,
|
||||
ori,
|
||||
@ -2637,10 +2648,13 @@ impl FigureMgr {
|
||||
state.state_time,
|
||||
&mut state_animation_rate,
|
||||
skeleton_attr,
|
||||
),
|
||||
)
|
||||
},
|
||||
// TODO!
|
||||
_ => target_base,
|
||||
};
|
||||
|
||||
state.skeleton = anim::vek::Lerp::lerp(&state.skeleton, &target_base, dt_lerp);
|
||||
state.skeleton = anim::vek::Lerp::lerp(&state.skeleton, &target_bones, dt_lerp);
|
||||
state.update(
|
||||
renderer,
|
||||
pos.0,
|
||||
|
Loading…
Reference in New Issue
Block a user