minor anim tweaks

This commit is contained in:
Justin Shipsey 2020-01-29 06:38:08 +00:00
parent 76060f5360
commit 908e099aa5
32 changed files with 653 additions and 299 deletions

BIN
assets/voxygen/voxel/armor/hand/assa_left.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/armor/hand/assa_right.vox (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -9,7 +9,7 @@
center: ("npc.giant.male.torso_upper"),
),
torso_lower: (
offset: (-5.0, 4.5, 4.5),
offset: (-5.0, -4.5, -4.5),
center: ("npc.giant.male.torso_lower"),
)
),
@ -23,7 +23,7 @@
center: ("npc.giant.female.torso_upper"),
),
torso_lower: (
offset: (-5.0, 4.5, 4.5),
offset: (-5.0, -4.5, -4.5),
center: ("npc.giant.female.torso_lower"),
)
),

View File

@ -1,69 +1,69 @@
({
(Giant, Male): (
shoulder_l: (
offset: (-5.0, -5.5, -4.0),
lateral: ("npc.giant.male.shoulder_l"),
offset: (-4.0, -5.5, -4.0),
lateral: ("armor.empty"),
),
shoulder_r: (
offset: (-5.0, -5.5, -4.0),
offset: (-4.0, -5.5, -4.0),
lateral: ("npc.giant.male.shoulder_r"),
),
hand_l: (
offset: (-3.0, -2.5, -3.0),
offset: (-3.0, -2.5, -14.0),
lateral: ("npc.giant.male.hand_l"),
),
hand_r: (
offset: (-3.0, -2.5, -3.0),
offset: (-3.0, -2.5, -14.0),
lateral: ("npc.giant.male.hand_r"),
),
leg_l: (
offset: (-3.0, -3.5, -2.0),
offset: (-3.0, -3.5, -7.0),
lateral: ("npc.giant.male.leg_l"),
),
leg_r: (
offset: (-3.0, -3.5, -2.0),
offset: (-3.0, -3.5, -7.0),
lateral: ("npc.giant.male.leg_r"),
),
foot_l: (
offset: (-3.0, -5.5, -2.5),
offset: (-3.0, -5.5, -10.5),
lateral: ("npc.giant.male.foot_l"),
),
foot_r: (
offset: (-3.0, -5.5, -2.5),
offset: (-3.0, -5.5, -10.5),
lateral: ("npc.giant.male.foot_r"),
)
),
(Giant, Female): (
shoulder_l: (
offset: (-5.0, -5.5, -4.0),
lateral: ("npc.giant.female.shoulder_l"),
offset: (-4.0, -5.5, -4.0),
lateral: ("armor.empty"),
),
shoulder_r: (
offset: (-5.0, -5.5, -4.0),
offset: (-4.0, -5.5, -4.0),
lateral: ("npc.giant.female.shoulder_r"),
),
hand_l: (
offset: (-3.0, -2.5, -3.0),
offset: (-3.0, -2.5, -14.0),
lateral: ("npc.giant.female.hand_l"),
),
hand_r: (
offset: (-3.0, -2.5, -3.0),
offset: (-3.0, -2.5, -14.0),
lateral: ("npc.giant.female.hand_r"),
),
leg_l: (
offset: (-3.0, -3.5, -2.0),
offset: (-3.0, -3.5, -7.0),
lateral: ("npc.giant.female.leg_l"),
),
leg_r: (
offset: (-3.0, -3.5, -2.0),
offset: (-3.0, -3.5, -7.0),
lateral: ("npc.giant.female.leg_r"),
),
foot_l: (
offset: (-3.0, -5.5, -2.5),
offset: (-3.0, -5.5, -10.5),
lateral: ("npc.giant.female.foot_l"),
),
foot_r: (
offset: (-3.0, -5.5, -2.5),
offset: (-3.0, -5.5, -10.5),
lateral: ("npc.giant.female.foot_r"),
)
),

View File

@ -37,7 +37,7 @@
center: ("npc.chicken.male.torso"),
),
tail: (
offset: (-1.5, -1.5, -3.5),
offset: (-1.5, -2.5, -3.5),
center: ("npc.chicken.male.tail"),
)
),
@ -85,7 +85,7 @@
),
(Peacock, Male): (
head: (
offset: (-2.0, -3.5, -3.0),
offset: (-2.0, -1.5, -6.5),
center: ("npc.peacock.male.head"),
),
torso: (
@ -99,7 +99,7 @@
),
(Peacock, Female): (
head: (
offset: (-2.0, -3.5, -3.5),
offset: (-2.0, -1.5, -6.5),
center: ("npc.peacock.female.head"),
),
torso: (

View File

@ -1,145 +1,145 @@
({
(Duck, Male): (
wing_l: (
offset: (-0.5, -2.5, -1.5),
offset: (-0.5, -2.5, -8.0),
lateral: ("npc.duck.male.wing"),
),
wing_r: (
offset: (-0.5, -2.5, -1.5),
offset: (-0.5, -2.5, -8.0),
lateral: ("npc.duck.male.wing"),
),
foot_l: (
offset: (-1.0, -1.5, -3.5),
offset: (-1.0, 0.0, -4.0),
lateral: ("npc.duck.male.leg_l"),
),
foot_r: (
offset: (-1.0, -1.5, -3.5),
offset: (-1.0, 0.0, -4.0),
lateral: ("npc.duck.male.leg_r"),
)
),
(Duck, Female): (
wing_l: (
offset: (-0.5, -2.5, -1.5),
offset: (-0.5, -2.5, -8.0),
lateral: ("npc.duck.female.wing"),
),
wing_r: (
offset: (-0.5, -2.5, -1.5),
offset: (-0.5, -2.5, -8.0),
lateral: ("npc.duck.female.wing"),
),
foot_l: (
offset: (-1.0, -1.5, -3.5),
offset: (-1.0, 0.0, -4.0),
lateral: ("npc.duck.female.leg_l"),
),
foot_r: (
offset: (-1.0, -1.5, -3.5),
offset: (-1.0, 0.0, -4.0),
lateral: ("npc.duck.female.leg_r"),
)
),
(Chicken, Male): (
wing_l: (
offset: (-0.5, -2.5, -1.5),
offset: (-0.5, -2.5, -8.0),
lateral: ("npc.chicken.male.wing"),
),
wing_r: (
offset: (-0.5, -2.5, -1.5),
offset: (-0.5, -2.5, -8.0),
lateral: ("npc.chicken.male.wing"),
),
foot_l: (
offset: (-1.0, -1.5, -1.5),
offset: (-1.0, 0.0, -4.0),
lateral: ("npc.chicken.male.leg_l"),
),
foot_r: (
offset: (-1.0, -1.5, -1.5),
offset: (-1.0, 0.0, -4.0),
lateral: ("npc.chicken.male.leg_r"),
)
),
(Chicken, Female): (
wing_l: (
offset: (-0.5, -2.5, -1.5),
offset: (-0.5, -2.5, -8.0),
lateral: ("npc.chicken.female.wing"),
),
wing_r: (
offset: (-0.5, -2.5, -1.5),
offset: (-0.5, -2.5, -8.0),
lateral: ("npc.chicken.female.wing"),
),
foot_l: (
offset: (-1.0, -1.5, -1.5),
offset: (-1.0, 0.0, -4.0),
lateral: ("npc.chicken.female.leg_l"),
),
foot_r: (
offset: (-1.0, -1.5, -1.5),
offset: (-1.0, 0.0, -4.0),
lateral: ("npc.chicken.female.leg_r"),
)
),
(Goose, Male): (
wing_l: (
offset: (-0.5, -2.5, -1.5),
offset: (-0.5, -2.5, -11.0),
lateral: ("npc.goose.male.wing"),
),
wing_r: (
offset: (-0.5, -2.5, -1.5),
offset: (-0.5, -2.5, -11.0),
lateral: ("npc.goose.male.wing"),
),
foot_l: (
offset: (-1.0, -1.5, -1.5),
offset: (-1.0, 0.0, -6.5),
lateral: ("npc.goose.male.leg_l"),
),
foot_r: (
offset: (-1.0, -1.5, -1.5),
offset: (-1.0, 0.0, -6.5),
lateral: ("npc.goose.male.leg_r"),
)
),
(Goose, Female): (
wing_l: (
offset: (-0.5, -2.5, -1.5),
offset: (-0.5, -2.5, -11.0),
lateral: ("npc.goose.female.wing"),
),
wing_r: (
offset: (-0.5, -2.5, -1.5),
offset: (-0.5, -2.5, -11.0),
lateral: ("npc.goose.female.wing"),
),
foot_l: (
offset: (-1.0, -1.5, -1.5),
offset: (-1.0, 0.0, -6.5),
lateral: ("npc.goose.female.leg_l"),
),
foot_r: (
offset: (-1.0, -1.5, -1.5),
offset: (-1.0, 0.0, -6.5),
lateral: ("npc.goose.female.leg_r"),
)
),
(Peacock, Male): (
wing_l: (
offset: (-1.0, -3.5, -2.5),
offset: (-1.0, -3.5, -13.0),
lateral: ("npc.peacock.male.wing_l"),
),
wing_r: (
offset: (-1.0, -3.5, -2.5),
offset: (-1.0, -3.5, -13.0),
lateral: ("npc.peacock.male.wing_r"),
),
foot_l: (
offset: (-1.0, -1.5, -3.5),
offset: (-1.0, 0.0, -8.0),
lateral: ("npc.peacock.male.leg_l"),
),
foot_r: (
offset: (-1.0, -1.5, -3.5),
offset: (-1.0, 0.0, -8.0),
lateral: ("npc.peacock.male.leg_r"),
)
),
(Peacock, Female): (
wing_l: (
offset: (-1.0, -3.5, -2.5),
offset: (-1.0, -3.5, -13.0),
lateral: ("npc.peacock.female.wing_l"),
),
wing_r: (
offset: (-1.0, -3.5, -2.5),
offset: (-1.0, -3.5, -13.0),
lateral: ("npc.peacock.female.wing_r"),
),
foot_l: (
offset: (-1.0, -1.5, -3.5),
offset: (-1.0, 0.0, -8.0),
lateral: ("npc.peacock.female.leg_l"),
),
foot_r: (
offset: (-1.0, -1.5, -3.5),
offset: (-1.0, 0.0, -8.0),
lateral: ("npc.peacock.female.leg_r"),
)
),

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,5 +1,5 @@
use super::{super::Animation, BipedLargeSkeleton, SkeletonAttr};
//use std::{f32::consts::PI, ops::Mul};
use std::{f32::consts::PI, ops::Mul};
use vek::*;
pub struct IdleAnimation;
@ -10,56 +10,120 @@ impl Animation for IdleAnimation {
fn update_skeleton(
skeleton: &Self::Skeleton,
_global_time: Self::Dependency,
_anim_time: f64,
global_time: Self::Dependency,
anim_time: f64,
_rate: &mut f32,
_skeleton_attr: &SkeletonAttr,
skeleton_attr: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
next.head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.head.scale = Vec3::one() / 11.0;
let lab = 1.0;
let torso = (anim_time as f32 * lab as f32 + 1.5 * PI).sin();
next.upper_torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
let look = Vec2::new(
((global_time + anim_time) as f32 / 8.0)
.floor()
.mul(7331.0)
.sin()
* 0.5,
((global_time + anim_time) as f32 / 8.0)
.floor()
.mul(1337.0)
.sin()
* 0.25,
);
next.head.offset = Vec3::new(
0.0,
skeleton_attr.head.0,
skeleton_attr.head.1 + torso * 0.6,
) / 8.0;
next.head.ori = Quaternion::rotation_z(look.x * 0.6) * Quaternion::rotation_x(look.y * 0.6);
next.head.scale = Vec3::one() / 8.0;
next.upper_torso.offset = Vec3::new(
0.0,
skeleton_attr.upper_torso.0,
skeleton_attr.upper_torso.1 + torso * 0.5,
) / 8.0;
next.upper_torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.upper_torso.scale = Vec3::one() / 11.0;
next.upper_torso.scale = Vec3::one() / 8.0;
next.lower_torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.lower_torso.offset = Vec3::new(
0.0,
skeleton_attr.lower_torso.0,
skeleton_attr.lower_torso.1 + torso * 0.35,
);
next.lower_torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.lower_torso.scale = Vec3::one();
next.lower_torso.scale = Vec3::one() * 1.02;
next.shoulder_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.shoulder_l.offset = Vec3::new(
-skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1,
skeleton_attr.shoulder.2,
);
next.shoulder_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.shoulder_l.scale = Vec3::one();
next.shoulder_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.shoulder_r.offset = Vec3::new(
skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1,
skeleton_attr.shoulder.2,
);
next.shoulder_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.shoulder_r.scale = Vec3::one();
next.hand_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.hand_l.offset = Vec3::new(
-skeleton_attr.hand.0,
skeleton_attr.hand.1,
skeleton_attr.hand.2 + torso * 0.6,
);
next.hand_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.hand_l.scale = Vec3::one();
next.hand_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.hand_r.offset = Vec3::new(
skeleton_attr.hand.0,
skeleton_attr.hand.1,
skeleton_attr.hand.2 + torso * 0.6,
);
next.hand_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.hand_r.scale = Vec3::one();
next.leg_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.leg_l.offset = Vec3::new(
-skeleton_attr.leg.0,
skeleton_attr.leg.1,
skeleton_attr.leg.2 + torso * 0.2,
) / 8.0;
next.leg_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.leg_l.scale = Vec3::one() / 11.0;
next.leg_l.scale = Vec3::one() / 8.0;
next.leg_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.leg_r.offset = Vec3::new(
skeleton_attr.leg.0,
skeleton_attr.leg.1,
skeleton_attr.leg.2 + torso * 0.2,
) / 8.0;
next.leg_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.leg_r.scale = Vec3::one() / 10.88;
next.leg_r.scale = Vec3::one() / 8.0;
next.foot_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.foot_l.offset = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1,
skeleton_attr.foot.2,
) / 8.0;
next.foot_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.foot_l.scale = Vec3::one();
next.foot_l.scale = Vec3::one() / 8.0;
next.foot_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.foot_r.offset = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1,
skeleton_attr.foot.2,
) / 8.0;
next.foot_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.foot_r.scale = Vec3::one();
next.foot_r.scale = Vec3::one() / 8.0;
next.torso.offset = Vec3::new(0.0, 0.0, 0.0);
next.torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.torso.scale = Vec3::one();
next
}
}

View File

@ -24,6 +24,7 @@ pub struct BipedLargeSkeleton {
leg_r: Bone,
foot_l: Bone,
foot_r: Bone,
torso: Bone,
}
impl BipedLargeSkeleton {
@ -40,6 +41,7 @@ impl BipedLargeSkeleton {
leg_r: Bone::default(),
foot_l: Bone::default(),
foot_r: Bone::default(),
torso: Bone::default(),
}
}
}
@ -52,23 +54,26 @@ impl Skeleton for BipedLargeSkeleton {
let shoulder_r_mat = self.shoulder_r.compute_base_matrix();
let leg_l_mat = self.leg_l.compute_base_matrix();
let leg_r_mat = self.leg_r.compute_base_matrix();
let torso_mat = self.torso.compute_base_matrix();
[
FigureBoneData::new(self.head.compute_base_matrix()),
FigureBoneData::new(upper_torso_mat),
FigureBoneData::new(self.lower_torso.compute_base_matrix() * upper_torso_mat),
FigureBoneData::new(shoulder_l_mat * upper_torso_mat),
FigureBoneData::new(shoulder_r_mat * upper_torso_mat),
FigureBoneData::new(torso_mat * self.head.compute_base_matrix()),
FigureBoneData::new(torso_mat * upper_torso_mat),
FigureBoneData::new(
self.hand_l.compute_base_matrix() * shoulder_l_mat * upper_torso_mat,
torso_mat * upper_torso_mat * self.lower_torso.compute_base_matrix(),
),
FigureBoneData::new(torso_mat * upper_torso_mat * shoulder_l_mat),
FigureBoneData::new(torso_mat * upper_torso_mat * shoulder_r_mat),
FigureBoneData::new(
torso_mat * upper_torso_mat * shoulder_l_mat * self.hand_l.compute_base_matrix(),
),
FigureBoneData::new(
self.hand_r.compute_base_matrix() * shoulder_r_mat * upper_torso_mat,
torso_mat * upper_torso_mat * shoulder_r_mat * self.hand_r.compute_base_matrix(),
),
FigureBoneData::new(leg_l_mat),
FigureBoneData::new(leg_r_mat),
FigureBoneData::new(self.foot_l.compute_base_matrix() * leg_l_mat),
FigureBoneData::new(self.foot_r.compute_base_matrix() * leg_r_mat),
FigureBoneData::new(torso_mat * leg_l_mat),
FigureBoneData::new(torso_mat * leg_r_mat),
FigureBoneData::new(torso_mat * self.foot_l.compute_base_matrix()),
FigureBoneData::new(torso_mat * self.foot_r.compute_base_matrix()),
FigureBoneData::default(),
FigureBoneData::default(),
FigureBoneData::default(),
@ -89,10 +94,19 @@ impl Skeleton for BipedLargeSkeleton {
self.leg_r.interpolate(&target.leg_r, dt);
self.foot_l.interpolate(&target.foot_l, dt);
self.foot_r.interpolate(&target.foot_r, dt);
self.torso.interpolate(&target.torso, dt);
}
}
pub struct SkeletonAttr;
pub struct SkeletonAttr {
head: (f32, f32),
upper_torso: (f32, f32),
lower_torso: (f32, f32),
shoulder: (f32, f32, f32),
hand: (f32, f32, f32),
leg: (f32, f32, f32),
foot: (f32, f32, f32),
}
impl<'a> std::convert::TryFrom<&'a comp::Body> for SkeletonAttr {
type Error = ();
@ -107,12 +121,43 @@ impl<'a> std::convert::TryFrom<&'a comp::Body> for SkeletonAttr {
impl Default for SkeletonAttr {
fn default() -> Self {
Self
Self {
head: (0.0, 0.0),
upper_torso: (0.0, 0.0),
lower_torso: (0.0, 0.0),
shoulder: (0.0, 0.0, 0.0),
hand: (0.0, 0.0, 0.0),
leg: (0.0, 0.0, 0.0),
foot: (0.0, 0.0, 0.0),
}
}
}
impl<'a> From<&'a comp::biped_large::Body> for SkeletonAttr {
fn from(_body: &'a comp::biped_large::Body) -> Self {
Self
fn from(body: &'a comp::biped_large::Body) -> Self {
use comp::biped_large::Species::*;
Self {
head: match (body.species, body.body_type) {
(Giant, _) => (0.0, 28.5),
},
upper_torso: match (body.species, body.body_type) {
(Giant, _) => (0.0, 18.5),
},
lower_torso: match (body.species, body.body_type) {
(Giant, _) => (1.0, -9.5),
},
shoulder: match (body.species, body.body_type) {
(Giant, _) => (6.0, 0.5, 2.5),
},
hand: match (body.species, body.body_type) {
(Giant, _) => (3.5, -1.0, 3.0),
},
leg: match (body.species, body.body_type) {
(Giant, _) => (3.5, 0.0, 14.0),
},
foot: match (body.species, body.body_type) {
(Giant, _) => (4.0, 0.5, 11.0),
},
}
}
}

View File

@ -1,5 +1,5 @@
use super::{super::Animation, BipedLargeSkeleton, SkeletonAttr};
//use std::{f32::consts::PI, ops::Mul};
use std::f32::consts::PI;
use vek::*;
pub struct RunAnimation;
@ -11,55 +11,112 @@ impl Animation for RunAnimation {
fn update_skeleton(
skeleton: &Self::Skeleton,
(_velocity, _global_time): Self::Dependency,
_anim_time: f64,
anim_time: f64,
_rate: &mut f32,
_skeleton_attr: &SkeletonAttr,
skeleton_attr: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
next.head.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.head.scale = Vec3::one() / 10.88;
let lab = 14.0;
next.upper_torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.upper_torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.upper_torso.scale = Vec3::one() / 10.88;
let legl = (anim_time as f32 * lab as f32).sin();
let legr = (anim_time as f32 * lab as f32 + PI).sin();
let belt = (anim_time as f32 * lab as f32 + 1.5 * PI).sin();
next.lower_torso.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
let foothoril = (anim_time as f32 * lab as f32).sin();
let foothorir = (anim_time as f32 * lab as f32 + PI).sin();
let footvertl = (anim_time as f32 * lab as f32 + PI * 1.4).sin().max(0.0);
let footvertr = (anim_time as f32 * lab as f32 + PI * 0.4).sin().max(0.0);
next.head.offset =
Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1 + belt * 1.0) / 8.0;
next.head.ori = Quaternion::rotation_z(belt * 0.1) * Quaternion::rotation_x(0.3);
next.head.scale = Vec3::one() / 8.0;
next.upper_torso.offset = Vec3::new(
0.0,
skeleton_attr.upper_torso.0,
skeleton_attr.upper_torso.1 + belt * 1.0,
) / 8.0;
next.upper_torso.ori = Quaternion::rotation_z(belt * 0.3) * Quaternion::rotation_x(0.0);
next.upper_torso.scale = Vec3::one() / 8.0;
next.lower_torso.offset = Vec3::new(
0.0,
skeleton_attr.lower_torso.0,
skeleton_attr.lower_torso.1,
);
next.lower_torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.lower_torso.scale = Vec3::one() / 10.88;
next.lower_torso.scale = Vec3::one() * 1.02;
next.shoulder_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.shoulder_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.shoulder_l.scale = Vec3::one() / 10.88;
next.shoulder_l.offset = Vec3::new(
-skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1,
skeleton_attr.shoulder.2,
);
next.shoulder_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(legr * 0.06);
next.shoulder_l.scale = Vec3::one();
next.shoulder_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.shoulder_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.shoulder_r.scale = Vec3::one() / 10.88;
next.shoulder_r.offset = Vec3::new(
skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1,
skeleton_attr.shoulder.2,
);
next.shoulder_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(legl * 0.1);
next.shoulder_r.scale = Vec3::one();
next.hand_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.hand_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.hand_l.scale = Vec3::one() / 10.88;
next.hand_l.offset = Vec3::new(
-skeleton_attr.hand.0,
skeleton_attr.hand.1,
skeleton_attr.hand.2,
);
next.hand_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.3 + legr * 0.5);
next.hand_l.scale = Vec3::one();
next.hand_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.hand_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.hand_r.scale = Vec3::one() / 10.88;
next.hand_r.offset = Vec3::new(
skeleton_attr.hand.0,
skeleton_attr.hand.1,
skeleton_attr.hand.2,
);
next.hand_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.3 - legr * 0.5);
next.hand_r.scale = Vec3::one();
next.leg_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.leg_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.leg_l.scale = Vec3::one() / 10.88;
next.leg_l.offset = Vec3::new(
-skeleton_attr.leg.0,
skeleton_attr.leg.1,
skeleton_attr.leg.2 + belt * 0.4,
) / 8.0;
next.leg_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(-legl * 0.3);
next.leg_l.scale = Vec3::one() / 8.0;
next.leg_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.leg_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.leg_r.scale = Vec3::one() / 10.88;
next.leg_r.offset = Vec3::new(
skeleton_attr.leg.0,
skeleton_attr.leg.1,
skeleton_attr.leg.2 + belt * 0.4,
) / 8.0;
next.leg_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(-legr * 0.3);
next.leg_r.scale = Vec3::one() / 8.0;
next.foot_l.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.foot_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.foot_l.scale = Vec3::one() / 10.88;
next.foot_l.offset = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1 - foothoril * 4.5 - 0.5,
skeleton_attr.foot.2 + footvertl * 6.0,
) / 8.0;
next.foot_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0 - legl * 0.5);
next.foot_l.scale = Vec3::one() / 8.0 * 0.98;
next.foot_r.offset = Vec3::new(0.0, 7.5, 15.0) / 11.0;
next.foot_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.foot_r.scale = Vec3::one() / 10.88;
next.foot_r.offset = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1 - foothorir * 4.5 - 0.5,
skeleton_attr.foot.2 + footvertr * 6.0,
) / 8.0;
next.foot_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0 - legr * 0.5);
next.foot_r.scale = Vec3::one() / 8.0 * 0.98;
next.torso.offset = Vec3::new(0.0, 0.0, 0.0);
next.torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(-0.3);
next.torso.scale = Vec3::one();
next
}
}

View File

@ -17,8 +17,8 @@ impl Animation for IdleAnimation {
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let wave_slow = (anim_time as f32 * 3.5).sin();
let wave_slow_cos = (anim_time as f32 * 3.5).cos();
let wave_slow = (anim_time as f32 * 4.5).sin();
let wave_slow_cos = (anim_time as f32 * 4.5).cos();
let duck_head_look = Vec2::new(
((global_time + anim_time) as f32 / 8.0)
@ -35,7 +35,7 @@ impl Animation for IdleAnimation {
next.head.offset = Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1) / 11.0;
next.head.ori = Quaternion::rotation_z(duck_head_look.x)
* Quaternion::rotation_x(duck_head_look.y + wave_slow_cos * 0.03);
* Quaternion::rotation_x(-duck_head_look.y.abs() + wave_slow_cos * 0.03);
next.head.scale = Vec3::one();
next.torso.offset = Vec3::new(

View File

@ -100,34 +100,34 @@ impl<'a> From<&'a comp::bird_medium::Body> for SkeletonAttr {
use comp::bird_medium::Species::*;
Self {
head: match (body.species, body.body_type) {
(Duck, _) => (4.0, 4.0),
(Chicken, _) => (4.0, 4.0),
(Duck, _) => (4.0, 3.0),
(Chicken, _) => (4.0, 3.0),
(Goose, _) => (5.0, 5.0),
(Peacock, _) => (5.0, 6.0),
(Peacock, _) => (4.0, 7.0),
},
chest: match (body.species, body.body_type) {
(Duck, _) => (0.0, 6.0),
(Chicken, _) => (0.0, 6.0),
(Duck, _) => (0.0, 5.0),
(Chicken, _) => (0.0, 5.0),
(Goose, _) => (0.0, 8.0),
(Peacock, _) => (0.0, 9.0),
(Peacock, _) => (0.0, 10.0),
},
tail: match (body.species, body.body_type) {
(Duck, _) => (-3.5, 3.0),
(Chicken, _) => (-3.5, 3.0),
(Duck, _) => (-3.0, 1.5),
(Chicken, _) => (-3.0, 1.5),
(Goose, _) => (-5.0, 3.0),
(Peacock, _) => (-5.0, 2.0),
(Peacock, _) => (-5.5, 2.0),
},
wing: match (body.species, body.body_type) {
(Duck, _) => (2.75, 0.0, 0.0),
(Chicken, _) => (2.75, 0.0, 0.0),
(Goose, _) => (3.75, 0.0, 0.0),
(Peacock, _) => (3.0, 0.0, 0.0),
(Duck, _) => (2.75, 0.0, 6.0),
(Chicken, _) => (2.75, 0.0, 6.0),
(Goose, _) => (3.75, -1.0, 9.0),
(Peacock, _) => (3.0, 0.0, 9.0),
},
foot: match (body.species, body.body_type) {
(Duck, _) => (2.0, 0.0, 4.0),
(Chicken, _) => (2.0, 0.0, 4.0),
(Goose, _) => (2.0, 0.0, 3.0),
(Peacock, _) => (2.0, 0.5, 3.0),
(Duck, _) => (2.0, -1.5, 4.0),
(Chicken, _) => (2.0, -1.5, 4.0),
(Goose, _) => (2.0, -1.5, 7.0),
(Peacock, _) => (2.0, -2.5, 8.0),
},
}
}

View File

@ -1,5 +1,5 @@
use super::{super::Animation, BirdMediumSkeleton, SkeletonAttr};
//use std::{f32::consts::PI, ops::Mul};
use std::f32::consts::PI;
use vek::*;
pub struct RunAnimation;
@ -17,24 +17,35 @@ impl Animation for RunAnimation {
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let wave = (anim_time as f32 * 18.0).sin();
let wave_cos = (anim_time as f32 * 18.0).cos();
let lab = 16.0; //14.0
next.head.offset =
Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1 + wave * 0.5) / 11.0;
next.head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0 + wave_cos * 0.03);
let footl = (anim_time as f32 * lab as f32 + PI).sin();
let footr = (anim_time as f32 * lab as f32).sin();
let center = (anim_time as f32 * lab as f32 + PI / 2.0).sin();
let centeroffset = (anim_time as f32 * lab as f32 + PI * 1.5).sin();
next.head.offset = Vec3::new(
0.0,
skeleton_attr.head.0,
skeleton_attr.head.1 + center * 0.5,
) / 11.0;
next.head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0 + center * 0.03);
next.head.scale = Vec3::one();
next.torso.offset = Vec3::new(
0.0,
skeleton_attr.chest.0,
wave * 0.3 + skeleton_attr.chest.1,
skeleton_attr.chest.0 + centeroffset * 0.6,
center * 0.6 + skeleton_attr.chest.1,
) / 11.0;
next.torso.ori = Quaternion::rotation_y(wave * 0.03);
next.torso.ori = Quaternion::rotation_y(center * 0.05);
next.torso.scale = Vec3::one() / 11.0;
next.tail.offset = Vec3::new(0.0, skeleton_attr.tail.0, skeleton_attr.tail.1) / 11.0;
next.tail.ori = Quaternion::rotation_x(wave_cos * 0.03);
next.tail.offset = Vec3::new(
0.0,
skeleton_attr.tail.0,
skeleton_attr.tail.1 + centeroffset * 0.6,
) / 11.0;
next.tail.ori = Quaternion::rotation_x(center * 0.03);
next.tail.scale = Vec3::one();
next.wing_l.offset = Vec3::new(
@ -42,7 +53,7 @@ impl Animation for RunAnimation {
skeleton_attr.wing.1,
skeleton_attr.wing.2,
) / 11.0;
next.wing_l.ori = Quaternion::rotation_z(0.0);
next.wing_l.ori = Quaternion::rotation_y(footl * 0.3);
next.wing_l.scale = Vec3::one() * 1.05;
next.wing_r.offset = Vec3::new(
@ -50,23 +61,23 @@ impl Animation for RunAnimation {
skeleton_attr.wing.1,
skeleton_attr.wing.2,
) / 11.0;
next.wing_r.ori = Quaternion::rotation_y(0.0);
next.wing_r.ori = Quaternion::rotation_y(footr * 0.3);
next.wing_r.scale = Vec3::one() * 1.05;
next.leg_l.offset = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1,
skeleton_attr.foot.1 + footl * 1.0,
skeleton_attr.foot.2,
) / 11.0;
next.leg_l.ori = Quaternion::rotation_x(wave_cos * 1.0);
next.leg_l.ori = Quaternion::rotation_x(footl * 0.5);
next.leg_l.scale = Vec3::one() / 11.0;
next.leg_r.offset = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1,
skeleton_attr.foot.1 + footr * 1.0,
skeleton_attr.foot.2,
) / 11.0;
next.leg_r.ori = Quaternion::rotation_x(wave * 1.0);
next.leg_r.ori = Quaternion::rotation_x(footr * 0.5);
next.leg_r.scale = Vec3::one() / 11.0;
next
}

View File

@ -14,26 +14,27 @@ impl Animation for AttackAnimation {
fn update_skeleton(
skeleton: &Self::Skeleton,
(_active_tool_kind, _global_time): Self::Dependency,
(active_tool_kind, _global_time): Self::Dependency,
anim_time: f64,
_rate: &mut f32,
skeleton_attr: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let wave_quicken = 1.0 - (anim_time as f32 * 16.0).cos();
let wave_quicken_slow = 1.0 - (anim_time as f32 * 12.0).cos();
let wave_quicken_double = 1.0 - (anim_time as f32 * 24.0).cos();
let wave_stop_quick = (anim_time as f32 * 16.0).min(PI / 2.0).sin();
let slow = (anim_time as f32 * 9.0).sin();
let accel_med = 1.0 - (anim_time as f32 * 16.0).cos();
let accel_slow = 1.0 - (anim_time as f32 * 12.0).cos();
let accel_fast = 1.0 - (anim_time as f32 * 24.0).cos();
let decel = (anim_time as f32 * 16.0).min(PI / 2.0).sin();
next.head.offset = Vec3::new(
0.0 + skeleton_attr.neck_right,
-2.0 + skeleton_attr.neck_forward,
skeleton_attr.neck_height + 21.0,
);
next.head.ori = Quaternion::rotation_z(wave_stop_quick * -0.25)
* Quaternion::rotation_x(0.0 + wave_stop_quick * -0.1)
* Quaternion::rotation_y(wave_stop_quick * 0.1);
next.head.ori = Quaternion::rotation_z(decel * -0.25)
* Quaternion::rotation_x(0.0 + decel * -0.1)
* Quaternion::rotation_y(decel * 0.1);
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
next.chest.offset = Vec3::new(0.0, 0.0, 7.0);
@ -48,52 +49,206 @@ impl Animation for AttackAnimation {
next.shorts.ori = Quaternion::rotation_x(0.0);
next.shorts.scale = Vec3::one();
next.l_hand.offset = Vec3::new(
-8.0 + wave_quicken_slow * 10.0,
8.0 + wave_quicken_double * 3.0,
0.0,
);
next.l_hand.ori = Quaternion::rotation_z(-0.8)
* Quaternion::rotation_x(0.0 + wave_quicken * -0.8)
* Quaternion::rotation_y(0.0 + wave_quicken * -0.4);
next.l_hand.scale = Vec3::one() * 1.01;
match active_tool_kind {
//TODO: Inventory
Some(Tool::Sword) => {
next.l_hand.offset =
Vec3::new(-8.0 + accel_slow * 10.0, 8.0 + accel_fast * 3.0, 0.0);
next.l_hand.ori = Quaternion::rotation_z(-0.8)
* Quaternion::rotation_x(0.0 + accel_med * -0.8)
* Quaternion::rotation_y(0.0 + accel_med * -0.4);
next.l_hand.scale = Vec3::one() * 1.01;
next.r_hand.offset = Vec3::new(
-8.0 + wave_quicken_slow * 10.0,
8.0 + wave_quicken_double * 3.0,
-2.0,
);
next.r_hand.ori = Quaternion::rotation_z(-0.8)
* Quaternion::rotation_x(0.0 + wave_quicken * -0.8)
* Quaternion::rotation_y(0.0 + wave_quicken * -0.4);
next.r_hand.scale = Vec3::one() * 1.01;
next.r_hand.offset =
Vec3::new(-8.0 + accel_slow * 10.0, 8.0 + accel_fast * 3.0, -2.0);
next.r_hand.ori = Quaternion::rotation_z(-0.8)
* Quaternion::rotation_x(0.0 + accel_med * -0.8)
* Quaternion::rotation_y(0.0 + accel_med * -0.4);
next.r_hand.scale = Vec3::one() * 1.01;
//next.l_foot.offset = Vec3::new(
// -3.4,
// -0.1 + wave_stop_quick * 2.0,
// 8.0 + wave_stop_quick * -4.0,
//);
//next.l_foot.ori = Quaternion::rotation_x(wave_stop_quick * -1.2);
//next.l_foot.scale = Vec3::one();
next.main.offset = Vec3::new(
-8.0 + accel_slow * 10.0 + skeleton_attr.weapon_x,
8.0 + accel_fast * 3.0,
0.0,
);
next.main.ori = Quaternion::rotation_z(-0.8)
* Quaternion::rotation_x(0.0 + accel_med * -0.8)
* Quaternion::rotation_y(0.0 + accel_med * -0.4);
next.main.scale = Vec3::one();
}
Some(Tool::Axe) => {
next.l_hand.offset =
Vec3::new(-8.0 + accel_slow * 10.0, 8.0 + accel_fast * 3.0, 0.0);
next.l_hand.ori = Quaternion::rotation_z(-0.8)
* Quaternion::rotation_x(0.0 + accel_med * -0.8)
* Quaternion::rotation_y(0.0 + accel_med * -0.4);
next.l_hand.scale = Vec3::one() * 1.01;
//next.r_foot.offset = Vec3::new(
// 3.4,
// -0.1 - wave_stop_quick * -2.0,
// 8.0 + wave_stop_quick * -2.0,
//);
//next.r_foot.ori = Quaternion::rotation_x(wave_stop_quick * 1.2);
//next.r_foot.scale = Vec3::one();
next.r_hand.offset =
Vec3::new(-8.0 + accel_slow * 10.0, 8.0 + accel_fast * 3.0, -2.0);
next.r_hand.ori = Quaternion::rotation_z(-0.8)
* Quaternion::rotation_x(0.0 + accel_med * -0.8)
* Quaternion::rotation_y(0.0 + accel_med * -0.4);
next.r_hand.scale = Vec3::one() * 1.01;
next.main.offset = Vec3::new(
-8.0 + wave_quicken_slow * 10.0 + skeleton_attr.weapon_x,
8.0 + wave_quicken_double * 3.0,
0.0,
);
next.main.ori = Quaternion::rotation_z(-0.8)
* Quaternion::rotation_x(0.0 + wave_quicken * -0.8)
* Quaternion::rotation_y(0.0 + wave_quicken * -0.4);
next.main.scale = Vec3::one();
next.main.offset = Vec3::new(
-8.0 + accel_slow * 10.0 + skeleton_attr.weapon_x,
8.0 + accel_fast * 3.0,
0.0,
);
next.main.ori = Quaternion::rotation_z(-0.8)
* Quaternion::rotation_x(0.0 + accel_med * -0.8)
* Quaternion::rotation_y(0.0 + accel_med * -0.4);
next.main.scale = Vec3::one();
}
Some(Tool::Hammer) => {
next.l_hand.offset =
Vec3::new(-8.0 + accel_slow * 10.0, 8.0 + accel_fast * 3.0, 0.0);
next.l_hand.ori = Quaternion::rotation_z(-0.8)
* Quaternion::rotation_x(0.0 + accel_med * -0.8)
* Quaternion::rotation_y(0.0 + accel_med * -0.4);
next.l_hand.scale = Vec3::one() * 1.01;
next.r_hand.offset =
Vec3::new(-8.0 + accel_slow * 10.0, 8.0 + accel_fast * 3.0, -2.0);
next.r_hand.ori = Quaternion::rotation_z(-0.8)
* Quaternion::rotation_x(0.0 + accel_med * -0.8)
* Quaternion::rotation_y(0.0 + accel_med * -0.4);
next.r_hand.scale = Vec3::one() * 1.01;
next.main.offset = Vec3::new(
-8.0 + accel_slow * 10.0 + skeleton_attr.weapon_x,
8.0 + accel_fast * 3.0,
0.0,
);
next.main.ori = Quaternion::rotation_z(-0.8)
* Quaternion::rotation_x(0.0 + accel_med * -0.8)
* Quaternion::rotation_y(0.0 + accel_med * -0.4);
next.main.scale = Vec3::one();
}
Some(Tool::Staff) => {
next.l_hand.offset =
Vec3::new(-8.0 + accel_slow * 10.0, 8.0 + accel_fast * 3.0, 0.0);
next.l_hand.ori = Quaternion::rotation_z(-0.8)
* Quaternion::rotation_x(0.0 + accel_med * -0.8)
* Quaternion::rotation_y(0.0 + accel_med * -0.4);
next.l_hand.scale = Vec3::one() * 1.01;
next.r_hand.offset =
Vec3::new(-8.0 + accel_slow * 10.0, 8.0 + accel_fast * 3.0, -2.0);
next.r_hand.ori = Quaternion::rotation_z(-0.8)
* Quaternion::rotation_x(0.0 + accel_med * -0.8)
* Quaternion::rotation_y(0.0 + accel_med * -0.4);
next.r_hand.scale = Vec3::one() * 1.01;
next.main.offset = Vec3::new(
-8.0 + accel_slow * 10.0 + skeleton_attr.weapon_x,
8.0 + accel_fast * 3.0,
0.0,
);
next.main.ori = Quaternion::rotation_z(-0.8)
* Quaternion::rotation_x(0.0 + accel_med * -0.8)
* Quaternion::rotation_y(0.0 + accel_med * -0.4);
next.main.scale = Vec3::one();
}
Some(Tool::Shield) => {
next.l_hand.offset =
Vec3::new(-8.0 + accel_slow * 10.0, 8.0 + accel_fast * 3.0, 0.0);
next.l_hand.ori = Quaternion::rotation_z(-0.8)
* Quaternion::rotation_x(0.0 + accel_med * -0.8)
* Quaternion::rotation_y(0.0 + accel_med * -0.4);
next.l_hand.scale = Vec3::one() * 1.01;
next.r_hand.offset =
Vec3::new(-8.0 + accel_slow * 10.0, 8.0 + accel_fast * 3.0, -2.0);
next.r_hand.ori = Quaternion::rotation_z(-0.8)
* Quaternion::rotation_x(0.0 + accel_med * -0.8)
* Quaternion::rotation_y(0.0 + accel_med * -0.4);
next.r_hand.scale = Vec3::one() * 1.01;
next.main.offset = Vec3::new(
-8.0 + accel_slow * 10.0 + skeleton_attr.weapon_x,
8.0 + accel_fast * 3.0,
0.0,
);
next.main.ori = Quaternion::rotation_z(-0.8)
* Quaternion::rotation_x(0.0 + accel_med * -0.8)
* Quaternion::rotation_y(0.0 + accel_med * -0.4);
next.main.scale = Vec3::one();
}
Some(Tool::Bow) => {
next.l_hand.offset = Vec3::new(-7.0, -2.0 + slow * 5.0, -1.0);
next.l_hand.ori = Quaternion::rotation_x(PI / 2.0)
* Quaternion::rotation_y(-0.3)
* Quaternion::rotation_z(0.3);
next.l_hand.scale = Vec3::one() * 1.01;
next.r_hand.offset = Vec3::new(1.0, 8.0, 2.5);
next.r_hand.ori = Quaternion::rotation_x(PI / 2.0)
* Quaternion::rotation_y(0.3)
* Quaternion::rotation_z(0.3);
next.r_hand.scale = Vec3::one() * 1.01;
next.main.offset = Vec3::new(
-4.0 + skeleton_attr.weapon_x,
15.0 + skeleton_attr.weapon_y,
-4.0,
);
next.main.ori = Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(0.4)
* Quaternion::rotation_z(0.0);
next.main.scale = Vec3::one();
}
Some(Tool::Dagger) => {
next.l_hand.offset =
Vec3::new(-8.0 + accel_slow * 10.0, 8.0 + accel_fast * 3.0, 0.0);
next.l_hand.ori = Quaternion::rotation_z(-0.8)
* Quaternion::rotation_x(0.0 + accel_med * -0.8)
* Quaternion::rotation_y(0.0 + accel_med * -0.4);
next.l_hand.scale = Vec3::one() * 1.01;
next.r_hand.offset =
Vec3::new(-8.0 + accel_slow * 10.0, 8.0 + accel_fast * 3.0, -2.0);
next.r_hand.ori = Quaternion::rotation_z(-0.8)
* Quaternion::rotation_x(0.0 + accel_med * -0.8)
* Quaternion::rotation_y(0.0 + accel_med * -0.4);
next.r_hand.scale = Vec3::one() * 1.01;
next.main.offset = Vec3::new(
-8.0 + accel_slow * 10.0 + skeleton_attr.weapon_x,
8.0 + accel_fast * 3.0,
0.0,
);
next.main.ori = Quaternion::rotation_z(-0.8)
* Quaternion::rotation_x(0.0 + accel_med * -0.8)
* Quaternion::rotation_y(0.0 + accel_med * -0.4);
next.main.scale = Vec3::one();
}
Some(Tool::Debug(_)) => {
next.l_hand.offset =
Vec3::new(-8.0 + accel_slow * 10.0, 8.0 + accel_fast * 3.0, 0.0);
next.l_hand.ori = Quaternion::rotation_z(-0.8)
* Quaternion::rotation_x(0.0 + accel_med * -0.8)
* Quaternion::rotation_y(0.0 + accel_med * -0.4);
next.l_hand.scale = Vec3::one() * 1.01;
next.r_hand.offset =
Vec3::new(-8.0 + accel_slow * 10.0, 8.0 + accel_fast * 3.0, -2.0);
next.r_hand.ori = Quaternion::rotation_z(-0.8)
* Quaternion::rotation_x(0.0 + accel_med * -0.8)
* Quaternion::rotation_y(0.0 + accel_med * -0.4);
next.r_hand.scale = Vec3::one() * 1.01;
next.main.offset = Vec3::new(
-8.0 + accel_slow * 10.0 + skeleton_attr.weapon_x,
8.0 + accel_fast * 3.0,
0.0,
);
next.main.ori = Quaternion::rotation_z(-0.8)
* Quaternion::rotation_x(0.0 + accel_med * -0.8)
* Quaternion::rotation_y(0.0 + accel_med * -0.4);
next.main.scale = Vec3::one();
}
_ => {}
}
next.l_shoulder.offset = Vec3::new(-5.0, 0.0, 4.7);
next.l_shoulder.ori = Quaternion::rotation_x(0.0);
next.l_shoulder.scale = Vec3::one() * 1.1;
@ -111,9 +266,9 @@ impl Animation for AttackAnimation {
next.lantern.scale = Vec3::one() * 0.0;
next.torso.offset = Vec3::new(0.0, -0.2, 0.1) * skeleton_attr.scaler;
next.torso.ori = Quaternion::rotation_z(wave_stop_quick * -0.2)
* Quaternion::rotation_x(0.0 + wave_stop_quick * -0.2)
* Quaternion::rotation_y(wave_stop_quick * 0.2);
next.torso.ori = Quaternion::rotation_z(decel * -0.2)
* Quaternion::rotation_x(0.0 + decel * -0.2)
* Quaternion::rotation_y(decel * 0.2);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
next
}

View File

@ -138,24 +138,24 @@ impl Animation for CidleAnimation {
Some(Tool::Staff) => {
next.l_hand.offset = Vec3::new(
-6.0 + wave_ultra_slow_cos * 1.0,
3.5 + wave_ultra_slow_cos * 0.5,
0.0 + wave_ultra_slow * 1.0,
1.0 + wave_ultra_slow_cos * 0.5,
5.0 + wave_ultra_slow * 1.0,
);
next.l_hand.ori = Quaternion::rotation_x(-0.3);
next.l_hand.scale = Vec3::one() * 1.01;
next.l_hand.ori = Quaternion::rotation_x(1.27);
next.l_hand.scale = Vec3::one() * 1.0;
next.r_hand.offset = Vec3::new(
-6.0 + wave_ultra_slow_cos * 1.0,
3.0 + wave_ultra_slow_cos * 0.5,
-1.5 + wave_ultra_slow_cos * 0.5,
-2.0 + wave_ultra_slow * 1.0,
);
next.r_hand.ori = Quaternion::rotation_x(-0.3);
next.r_hand.ori = Quaternion::rotation_x(1.27);
next.r_hand.scale = Vec3::one() * 1.01;
next.main.offset = Vec3::new(
-6.0 + skeleton_attr.weapon_x + wave_ultra_slow_cos * 1.0,
4.5 + skeleton_attr.weapon_y + wave_ultra_slow_cos * 0.5,
0.0 + wave_ultra_slow * 1.0,
8.5 + skeleton_attr.weapon_y + wave_ultra_slow_cos * 0.5,
17.0 + wave_ultra_slow * 1.0,
);
next.main.ori = Quaternion::rotation_x(-0.3)
next.main.ori = Quaternion::rotation_x(-0.3 + PI)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.main.scale = Vec3::one();
@ -187,31 +187,31 @@ impl Animation for CidleAnimation {
}
Some(Tool::Bow) => {
next.l_hand.offset = Vec3::new(
-4.0 + wave_ultra_slow_cos * 1.0,
5.0 + wave_ultra_slow_cos * 0.5,
0.0 + wave_ultra_slow * 1.0,
-1.0 + wave_ultra_slow_cos * 1.0,
3.0 + wave_ultra_slow_cos * 0.5,
5.0 + wave_ultra_slow * 1.0,
);
next.l_hand.ori = Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(-1.9)
* Quaternion::rotation_z(0.85);
next.l_hand.ori = Quaternion::rotation_x(PI / 2.0)
* Quaternion::rotation_y(-0.3)
* Quaternion::rotation_z(0.3);
next.l_hand.scale = Vec3::one() * 1.01;
next.r_hand.offset = Vec3::new(
2.0 + wave_ultra_slow_cos * 1.0,
1.0 + wave_ultra_slow_cos * 1.0,
8.0 + wave_ultra_slow_cos * 0.5,
-3.5 + wave_ultra_slow * 1.0,
2.5 + wave_ultra_slow * 1.0,
);
next.r_hand.ori = Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(-1.7)
* Quaternion::rotation_z(0.85);
next.r_hand.ori = Quaternion::rotation_x(PI / 2.0)
* Quaternion::rotation_y(0.3)
* Quaternion::rotation_z(0.3);
next.r_hand.scale = Vec3::one() * 1.01;
next.main.offset = Vec3::new(
9.0 + skeleton_attr.weapon_x + wave_ultra_slow_cos * 1.0,
10.0 + skeleton_attr.weapon_y + wave_ultra_slow_cos * 0.5,
-3.0 + wave_ultra_slow * 1.0,
-4.0 + skeleton_attr.weapon_x + wave_ultra_slow_cos * 1.0,
15.0 + skeleton_attr.weapon_y + wave_ultra_slow_cos * 0.5,
-4.0 + wave_ultra_slow * 1.0,
);
next.main.ori = Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(-1.7)
* Quaternion::rotation_z(0.85);
* Quaternion::rotation_y(0.4)
* Quaternion::rotation_z(0.0);
next.main.scale = Vec3::one();
}
Some(Tool::Dagger) => {

View File

@ -41,7 +41,7 @@ impl Animation for RollAnimation {
next.head.offset = Vec3::new(
0.0 + skeleton_attr.neck_right,
-2.0 + skeleton_attr.neck_forward,
skeleton_attr.neck_height + 21.0 + wave_dub * -8.0,
skeleton_attr.neck_height + 17.0 + wave_dub * -8.0,
);
next.head.ori = Quaternion::rotation_x(wave_dub * 0.4);
next.head.scale = Vec3::one();
@ -77,11 +77,11 @@ impl Animation for RollAnimation {
Quaternion::rotation_x(wave_slow * 6.5) * Quaternion::rotation_y(wave * 0.3);
next.r_hand.scale = Vec3::one();
next.l_foot.offset = Vec3::new(-3.4, -0.1, 9.0 - 0.0 + wave_dub * -1.2 + wave_slow * 4.0);
next.l_foot.offset = Vec3::new(-3.4, -0.1, 10.0 - 0.0 + wave_dub * -1.2 + wave_slow * 4.0);
next.l_foot.ori = Quaternion::rotation_x(wave * 0.6);
next.l_foot.scale = Vec3::one();
next.r_foot.offset = Vec3::new(3.4, -0.1, 9.0 - 0.0 + wave_dub * -1.0 + wave_slow * 4.0);
next.r_foot.offset = Vec3::new(3.4, -0.1, 10.0 - 0.0 + wave_dub * -1.0 + wave_slow * 4.0);
next.r_foot.ori = Quaternion::rotation_x(wave * -0.4);
next.r_foot.scale = Vec3::one();
@ -112,7 +112,7 @@ impl Animation for RollAnimation {
next.lantern.scale = Vec3::one() * 0.0;
next.torso.offset =
Vec3::new(0.0, 11.0, 0.1 + wave_dub * 16.0) / 11.0 * skeleton_attr.scaler;
Vec3::new(0.0, 0.0, 0.1 + wave_dub * 16.0) / 11.0 * skeleton_attr.scaler;
next.torso.ori = Quaternion::rotation_x(wave_slow * 6.5) * Quaternion::rotation_y(tilt);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
next

View File

@ -22,6 +22,9 @@ impl Animation for WieldAnimation {
let speed = Vec2::<f32>::from(velocity).magnitude();
*rate = speed;
let wave_ultra_slow = (anim_time as f32 * 3.0 + PI).sin();
let wave_ultra_slow_cos = (anim_time as f32 * 3.0 + PI).cos();
let wave = (anim_time as f32 * 1.0).sin();
let wave_stop = (anim_time as f32 * 2.6).min(PI / 2.0).sin();
match active_tool_kind {
@ -84,18 +87,26 @@ impl Animation for WieldAnimation {
next.main.scale = Vec3::one();
}
Some(Tool::Staff) => {
next.l_hand.offset = Vec3::new(-6.0, 3.5, 0.0);
next.l_hand.ori = Quaternion::rotation_x(-0.3);
next.l_hand.scale = Vec3::one() * 1.01;
next.r_hand.offset = Vec3::new(-6.0, 3.0, -2.0);
next.r_hand.ori = Quaternion::rotation_x(-0.3);
next.l_hand.offset = Vec3::new(
-6.0 + wave_ultra_slow_cos * 1.0,
1.0 + wave_ultra_slow_cos * 0.5,
5.0 + wave_ultra_slow * 1.0,
);
next.l_hand.ori = Quaternion::rotation_x(1.27);
next.l_hand.scale = Vec3::one() * 1.0;
next.r_hand.offset = Vec3::new(
-6.0 + wave_ultra_slow_cos * 1.0,
-1.5 + wave_ultra_slow_cos * 0.5,
-2.0 + wave_ultra_slow * 1.0,
);
next.r_hand.ori = Quaternion::rotation_x(1.27);
next.r_hand.scale = Vec3::one() * 1.01;
next.main.offset = Vec3::new(
-6.0 + skeleton_attr.weapon_x,
4.5 + skeleton_attr.weapon_y,
0.0,
-6.0 + skeleton_attr.weapon_x + wave_ultra_slow_cos * 1.0,
8.5 + skeleton_attr.weapon_y + wave_ultra_slow_cos * 0.5,
17.0 + wave_ultra_slow * 1.0,
);
next.main.ori = Quaternion::rotation_x(-0.3)
next.main.ori = Quaternion::rotation_x(-0.3 + PI)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.main.scale = Vec3::one();
@ -118,24 +129,32 @@ impl Animation for WieldAnimation {
next.main.scale = Vec3::one();
}
Some(Tool::Bow) => {
next.l_hand.offset = Vec3::new(-4.0, 5.0, 0.0);
next.l_hand.ori = Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(-1.9)
* Quaternion::rotation_z(0.85);
next.l_hand.offset = Vec3::new(
-1.0 - wave_ultra_slow_cos * 1.0,
3.0 + wave_ultra_slow_cos * 0.5,
5.0 + wave_ultra_slow * 1.0,
);
next.l_hand.ori = Quaternion::rotation_x(PI / 2.0)
* Quaternion::rotation_y(-0.3)
* Quaternion::rotation_z(0.3);
next.l_hand.scale = Vec3::one() * 1.01;
next.r_hand.offset = Vec3::new(2.0, 8.0, -3.5);
next.r_hand.ori = Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(-1.7)
* Quaternion::rotation_z(0.85);
next.r_hand.offset = Vec3::new(
1.0 + wave_ultra_slow_cos * 1.0,
8.0 + wave_ultra_slow_cos * 0.5,
2.5 + wave_ultra_slow * 1.0,
);
next.r_hand.ori = Quaternion::rotation_x(PI / 2.0)
* Quaternion::rotation_y(0.3)
* Quaternion::rotation_z(0.3);
next.r_hand.scale = Vec3::one() * 1.01;
next.main.offset = Vec3::new(
9.0 + skeleton_attr.weapon_x,
10.0 + skeleton_attr.weapon_y,
-3.0,
-4.0 + skeleton_attr.weapon_x + wave_ultra_slow_cos * 1.0,
15.0 + skeleton_attr.weapon_y + wave_ultra_slow_cos * 0.5,
-4.0 + wave_ultra_slow * 1.0,
);
next.main.ori = Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(-1.7)
* Quaternion::rotation_z(0.85);
* Quaternion::rotation_y(0.4)
* Quaternion::rotation_z(0.0);
next.main.scale = Vec3::one();
}
Some(Tool::Dagger) => {

View File

@ -151,12 +151,12 @@ impl<'a> From<&'a comp::quadruped_medium::Body> for SkeletonAttr {
},
tail: match (body.species, body.body_type) {
(Wolf, _) => (-6.0, -2.0),
(Saber, _) => (-5.0, -2.0),
(Saber, _) => (-4.0, -2.0),
(Viper, _) => (-6.0, -1.0),
(Tuskram, _) => (-6.0, -2.0),
(Alligator, _) => (-7.0, -1.0),
(Monitor, _) => (-7.0, -1.0),
(Lion, _) => (-6.0, -4.0),
(Lion, _) => (-8.0, -6.0),
(Tarasque, _) => (-7.0, -2.0),
},
torso_back: match (body.species, body.body_type) {
@ -171,12 +171,12 @@ impl<'a> From<&'a comp::quadruped_medium::Body> for SkeletonAttr {
},
torso_mid: match (body.species, body.body_type) {
(Wolf, _) => (-7.0, 10.5),
(Saber, _) => (-8.0, 9.5),
(Saber, _) => (-7.0, 9.5),
(Viper, _) => (-7.0, 7.0),
(Tuskram, _) => (-7.0, 9.0),
(Alligator, _) => (-7.0, 6.0),
(Monitor, _) => (-7.0, 4.0),
(Lion, _) => (-7.0, 9.0),
(Lion, _) => (-9.0, 9.0),
(Tarasque, _) => (-7.0, 8.0),
},
ears: match (body.species, body.body_type) {
@ -190,7 +190,7 @@ impl<'a> From<&'a comp::quadruped_medium::Body> for SkeletonAttr {
(Tarasque, _) => (1.5, -2.0),
},
feet_f: match (body.species, body.body_type) {
(Wolf, _) => (5.0, 6.0, 3.0),
(Wolf, _) => (5.0, 6.0, 2.0),
(Saber, _) => (4.0, 6.0, 3.0),
(Viper, _) => (4.0, 6.0, 3.0),
(Tuskram, _) => (4.0, 6.0, 4.5),
@ -200,8 +200,8 @@ impl<'a> From<&'a comp::quadruped_medium::Body> for SkeletonAttr {
(Tarasque, _) => (4.0, 6.0, 3.0),
},
feet_b: match (body.species, body.body_type) {
(Wolf, _) => (5.0, -4.0, 3.5),
(Saber, _) => (4.0, -4.0, 3.5),
(Wolf, _) => (5.0, -4.0, 3.0),
(Saber, _) => (4.0, -6.0, 3.5),
(Viper, _) => (4.0, -4.0, 3.5),
(Tuskram, _) => (4.0, -8.0, 5.5),
(Alligator, _) => (4.0, -4.0, 3.5),

View File

@ -17,7 +17,7 @@ impl Animation for RunAnimation {
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let lab = 14; //14.0
let lab = 14;
let vertlf = (anim_time as f32 * lab as f32 + PI * 1.8).sin().max(0.15);
let vertrfoffset = (anim_time as f32 * lab as f32 + PI * 0.80).sin().max(0.15);
let vertlboffset = (anim_time as f32 * lab as f32).sin().max(0.15);

View File

@ -146,7 +146,7 @@ impl<'a> From<&'a comp::quadruped_small::Body> for SkeletonAttr {
(Raccoon, _) => (3.0, -2.0, 3.0),
(Quokka, _) => (3.0, -4.0, 3.0),
(Dodarock, _) => (4.5, -3.0, 4.0),
(Holladon, _) => (4.0, -4.0, 0.0),
(Holladon, _) => (4.0, -4.0, 3.0),
},
}
}