Merge branch 'slipped/animalfixes' into 'master'

quad_medium animation

See merge request veloren/veloren!763
This commit is contained in:
Justin Shipsey 2020-01-27 14:16:23 +00:00
commit 11e61f9ab9
6 changed files with 108 additions and 93 deletions

Binary file not shown.

View File

@ -25,7 +25,7 @@
central: ("npc.wolf.male.ears"),
),
tail: (
offset: (-2.0, -7.5, -5.0),
offset: (-2.0, -9.5, -5.0),
central: ("npc.wolf.male.tail"),
),
),
@ -55,7 +55,7 @@
central: ("npc.wolf.female.ears"),
),
tail: (
offset: (-2.0, -7.5, -5.0),
offset: (-2.0, -9.5, -5.0),
central: ("npc.wolf.female.tail"),
),
),
@ -146,8 +146,8 @@
central: ("armor.empty"),
),
tail: (
offset: (-1.0, -5.0, -1.5),
central: ("armor.empty"),
offset: (-1.0, -8.0, -1.5),
central: ("npc.viper.male.tail"),
),
),
(Viper, Female): (
@ -177,12 +177,12 @@
),
tail: (
offset: (-1.0, -5.0, -1.5),
central: ("npc.viper.male.tail"),
central: ("npc.viper.female.tail"),
),
),
(Tuskram, Male): (
upper: (
offset: (-4.0, -6.5, -7.0),
offset: (-4.0, -2.5, -7.0),
central: ("npc.tuskram.female.head_upper"),
),
lower: (
@ -212,7 +212,7 @@
),
(Tuskram, Female): (
upper: (
offset: (-4.0, -6.5, -7.0),
offset: (-4.0, -2.5, -7.0),
central: ("npc.tuskram.female.head_upper"),
),
lower: (
@ -266,7 +266,7 @@
central: ("armor.empty"),
),
tail: (
offset: (-2.0, -4.5, -1.5),
offset: (-2.0, -7.5, -1.5),
central: ("npc.alligator.male.tail"),
),
),
@ -296,7 +296,7 @@
central: ("armor.empty"),
),
tail: (
offset: (-2.0, -4.5, -1.5),
offset: (-2.0, -7.5, -1.5),
central: ("npc.alligator.male.tail"),
),
),

View File

@ -109,37 +109,37 @@
),
(Tuskram, Male): (
left_front: (
offset: (-1.5, -1.5, -2.5),
offset: (-1.5, -1.5, -4.5),
lateral: ("npc.tuskram.male.foot_lf"),
),
right_front: (
offset: (-1.5, -1.5, -2.5),
offset: (-1.5, -1.5, -4.5),
lateral: ("npc.tuskram.male.foot_rf"),
),
left_back: (
offset: (-1.5, -3.0, -3.5),
offset: (-1.5, -4.0, -5.5),
lateral: ("npc.tuskram.male.foot_lb"),
),
right_back: (
offset: (-1.5, -3.0, -3.5),
offset: (-1.5, -4.0, -5.5),
lateral: ("npc.tuskram.male.foot_rb"),
),
),
(Tuskram, Female): (
left_front: (
offset: (-1.5, -1.5, -2.5),
offset: (-1.5, -1.5, -4.5),
lateral: ("npc.tuskram.female.foot_lf"),
),
right_front: (
offset: (-1.5, -1.5, -2.5),
offset: (-1.5, -1.5, -4.5),
lateral: ("npc.tuskram.female.foot_rf"),
),
left_back: (
offset: (-1.5, -3.0, -3.5),
offset: (-1.5, -4.0, -5.5),
lateral: ("npc.tuskram.female.foot_lb"),
),
right_back: (
offset: (-1.5, -3.0, -3.5),
offset: (-1.5, -4.0, -5.5),
lateral: ("npc.tuskram.female.foot_rb"),
),
),

View File

@ -77,10 +77,10 @@ impl Animation for IdleAnimation {
0.0,
skeleton_attr.tail.0,
skeleton_attr.tail.1 + wave_ultra_slow * 0.6,
) / 11.0;
);
next.tail.ori = Quaternion::rotation_z(0.0 + wave_slow * 0.2 + tailmove.x)
* Quaternion::rotation_x(tailmove.y);
next.tail.scale = Vec3::one() / 11.0;
next.tail.scale = Vec3::one();
next.torso_back.offset = Vec3::new(
0.0,

View File

@ -38,14 +38,14 @@ impl Skeleton for QuadrupedMediumSkeleton {
let ears_mat = self.ears.compute_base_matrix();
let head_upper_mat = self.head_upper.compute_base_matrix();
let head_lower_mat = self.head_lower.compute_base_matrix();
let torso_mid_mat = self.torso_mid.compute_base_matrix();
[
FigureBoneData::new(head_upper_mat),
FigureBoneData::new(head_upper_mat * head_lower_mat),
FigureBoneData::new(head_upper_mat * self.jaw.compute_base_matrix()),
FigureBoneData::new(self.tail.compute_base_matrix()),
FigureBoneData::new(torso_mid_mat * self.tail.compute_base_matrix()),
FigureBoneData::new(self.torso_back.compute_base_matrix()),
FigureBoneData::new(self.torso_mid.compute_base_matrix()),
FigureBoneData::new(torso_mid_mat),
FigureBoneData::new(head_upper_mat * ears_mat),
FigureBoneData::new(self.foot_lf.compute_base_matrix()),
FigureBoneData::new(self.foot_rf.compute_base_matrix()),
@ -84,6 +84,7 @@ pub struct SkeletonAttr {
ears: (f32, f32),
feet_f: (f32, f32, f32),
feet_b: (f32, f32, f32),
height: f32,
}
impl<'a> std::convert::TryFrom<&'a comp::Body> for SkeletonAttr {
@ -109,6 +110,7 @@ impl Default for SkeletonAttr {
ears: (0.0, 0.0),
feet_f: (0.0, 0.0, 0.0),
feet_b: (0.0, 0.0, 0.0),
height: (0.0),
}
}
}
@ -121,21 +123,21 @@ impl<'a> From<&'a comp::quadruped_medium::Body> for SkeletonAttr {
(Wolf, _) => (12.0, 16.0),
(Saber, _) => (14.0, 12.0),
(Viper, _) => (14.0, 10.0),
(Tuskram, _) => (13.0, 12.0),
(Tuskram, _) => (9.0, 12.0),
(Alligator, _) => (16.0, 11.0),
(Monitor, _) => (14.0, 6.0),
(Lion, _) => (11.5, 14.0),
(Lion, _) => (12.5, 14.0),
(Tarasque, _) => (12.0, 19.0),
},
head_lower: match (body.species, body.body_type) {
(Wolf, _) => (-4.0, -7.0),
(Saber, _) => (-6.0, 1.0),
(Viper, _) => (-3.0, -2.0),
(Tuskram, _) => (-3.0, 0.0),
(Saber, _) => (-6.0, 0.0),
(Viper, _) => (-3.0, -1.0),
(Tuskram, _) => (-3.0, -1.0),
(Alligator, _) => (-5.0, -4.0),
(Monitor, _) => (0.0, -1.0),
(Lion, _) => (-6.0, -1.0),
(Tarasque, _) => (-5.0, -8.0),
(Monitor, _) => (-3.0, -1.0),
(Lion, _) => (-5.0, -1.0),
(Tarasque, _) => (-5.0, -6.0),
},
jaw: match (body.species, body.body_type) {
(Wolf, _) => (3.0, -5.0),
@ -144,18 +146,18 @@ impl<'a> From<&'a comp::quadruped_medium::Body> for SkeletonAttr {
(Tuskram, _) => (2.0, -2.0),
(Alligator, _) => (6.0, -6.0),
(Monitor, _) => (4.0, -3.0),
(Lion, _) => (3.0, -3.0),
(Lion, _) => (2.0, -3.0),
(Tarasque, _) => (4.0, -9.0),
},
tail: match (body.species, body.body_type) {
(Wolf, _) => (-13.0, 5.0),
(Saber, _) => (-13.0, 5.0),
(Viper, _) => (-13.0, 5.0),
(Tuskram, _) => (-13.0, 5.0),
(Alligator, _) => (-16.0, 5.0),
(Monitor, _) => (-13.0, 5.0),
(Lion, _) => (-14.0, 8.0),
(Tarasque, _) => (-13.0, 5.0),
(Wolf, _) => (-6.0, -2.0),
(Saber, _) => (-5.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),
(Tarasque, _) => (-7.0, -2.0),
},
torso_back: match (body.species, body.body_type) {
(Wolf, _) => (4.0, 11.0),
@ -178,35 +180,45 @@ impl<'a> From<&'a comp::quadruped_medium::Body> for SkeletonAttr {
(Tarasque, _) => (-7.0, 8.0),
},
ears: match (body.species, body.body_type) {
(Wolf, _) => (1.0, 6.0),
(Wolf, _) => (-1.0, 5.0),
(Saber, _) => (-1.0, 6.0),
(Viper, _) => (10.0, 2.0),
(Tuskram, _) => (10.0, 2.0),
(Alligator, _) => (10.0, 2.0),
(Monitor, _) => (10.0, 2.0),
(Lion, _) => (-2.0, 4.0),
(Tarasque, _) => (1.0, 2.0),
(Tarasque, _) => (1.5, -2.0),
},
feet_f: match (body.species, body.body_type) {
(Wolf, _) => (4.0, 6.0, 3.0),
(Wolf, _) => (5.0, 6.0, 3.0),
(Saber, _) => (4.0, 6.0, 3.0),
(Viper, _) => (4.0, 6.0, 3.0),
(Tuskram, _) => (4.0, 6.0, 3.0),
(Tuskram, _) => (4.0, 6.0, 4.5),
(Alligator, _) => (4.0, 6.0, 3.0),
(Monitor, _) => (4.0, 6.0, 3.0),
(Lion, _) => (4.0, 6.0, 3.0),
(Lion, _) => (5.0, 6.0, 3.0),
(Tarasque, _) => (4.0, 6.0, 3.0),
},
feet_b: match (body.species, body.body_type) {
(Wolf, _) => (4.0, -4.0, 3.5),
(Wolf, _) => (5.0, -4.0, 3.5),
(Saber, _) => (4.0, -4.0, 3.5),
(Viper, _) => (4.0, -4.0, 3.5),
(Tuskram, _) => (4.0, -8.0, 3.5),
(Tuskram, _) => (4.0, -8.0, 5.5),
(Alligator, _) => (4.0, -4.0, 3.5),
(Monitor, _) => (4.0, -6.0, 3.5),
(Lion, _) => (4.0, -7.0, 3.5),
(Lion, _) => (5.5, -8.0, 3.5),
(Tarasque, _) => (4.0, -8.0, 3.5),
},
height: match (body.species, body.body_type) {
(Wolf, _) => (1.2),
(Saber, _) => (1.0),
(Viper, _) => (0.7),
(Tuskram, _) => (1.0),
(Alligator, _) => (0.5),
(Monitor, _) => (0.4),
(Lion, _) => (1.4),
(Tarasque, _) => (1.1),
},
}
}
}

View File

@ -17,13 +17,20 @@ impl Animation for RunAnimation {
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let wave = (anim_time as f32 * 14.0).sin();
let wave_slow = (anim_time as f32 * 3.5 + PI).sin();
let wave_slow_cos = (anim_time as f32 * 3.5 + PI).cos();
let wave_quick = (anim_time as f32 * 18.0).sin();
let wave_med = (anim_time as f32 * 12.0).sin();
let wave_med_cos = (anim_time as f32 * 12.0).cos();
let wave_quick_cos = (anim_time as f32 * 18.0).cos();
let lab = 14; //14.0
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);
let vertrb = (anim_time as f32 * lab as f32 + PI).sin().max(0.15);
let horilf = (anim_time as f32 * lab as f32 + PI * 1.2).sin();
let horirfoffset = (anim_time as f32 * lab as f32 + PI * 0.20).sin();
let horilboffset = (anim_time as f32 * lab as f32 + PI * 1.4).sin();
let horirb = (anim_time as f32 * lab as f32 + PI * 0.4).sin();
let vertchest = (anim_time as f32 * lab as f32 + PI * 0.3).sin().max(0.2);
let horichest = (anim_time as f32 * lab as f32 + PI * 0.8).sin();
let verthead = (anim_time as f32 * lab as f32 + PI * 0.3).sin();
let wolf_look = Vec2::new(
((global_time + anim_time) as f32 / 4.0)
@ -40,83 +47,79 @@ impl Animation for RunAnimation {
next.head_upper.offset = Vec3::new(
0.0,
skeleton_attr.head_upper.0 + wave_quick_cos * 2.0,
skeleton_attr.head_upper.1 + wave_med * 3.0,
skeleton_attr.head_upper.0 + horichest * 1.8,
skeleton_attr.head_upper.1 + verthead * -1.8,
) / 11.0;
next.head_upper.ori = Quaternion::rotation_x(-0.12 + wave_quick_cos * 0.12 + wolf_look.y)
* Quaternion::rotation_z(wolf_look.x);
next.head_upper.ori =
Quaternion::rotation_x(wolf_look.y) * Quaternion::rotation_z(wolf_look.x);
next.head_upper.scale = Vec3::one() / 10.98;
next.head_lower.offset = Vec3::new(
0.0,
skeleton_attr.head_lower.0,
skeleton_attr.head_lower.1 + wave_med * 1.0,
skeleton_attr.head_lower.0 + horichest * 0.8,
skeleton_attr.head_lower.1 + vertchest * -0.8 + verthead * 1.8,
);
next.head_lower.ori = Quaternion::rotation_z(0.0);
next.head_lower.scale = Vec3::one() * 0.98;
next.jaw.offset = Vec3::new(
0.0,
skeleton_attr.jaw.0,
skeleton_attr.jaw.1 + wave_slow_cos * 1.0,
);
next.jaw.ori = Quaternion::rotation_x(wave_slow * 0.05);
next.jaw.scale = Vec3::one() * 1.01;
next.jaw.offset = Vec3::new(0.0, skeleton_attr.jaw.0, skeleton_attr.jaw.1);
next.jaw.ori = Quaternion::rotation_x(0.0);
next.jaw.scale = Vec3::one() * 1.02;
next.tail.offset = Vec3::new(0.0, skeleton_attr.tail.0, skeleton_attr.tail.1) / 11.0;
next.tail.ori = Quaternion::rotation_x(wave_quick * 0.18);
next.tail.scale = Vec3::one() / 11.0;
next.tail.offset = Vec3::new(0.0, skeleton_attr.tail.0, skeleton_attr.tail.1);
next.tail.ori = Quaternion::rotation_x(0.0);
next.tail.scale = Vec3::one();
next.torso_back.offset = Vec3::new(
0.0,
skeleton_attr.torso_back.0 + wave_quick_cos * 2.2,
skeleton_attr.torso_back.1 + wave_med * 2.8,
skeleton_attr.torso_back.0 + horichest * 2.9,
skeleton_attr.torso_back.1 + vertchest * -3.6 + 1.0,
) / 11.0;
next.torso_back.ori = Quaternion::rotation_x(-0.05 + wave_med_cos * 0.14);
next.torso_back.ori = Quaternion::rotation_y(horichest * -0.12);
next.torso_back.scale = Vec3::one() / 11.0;
next.torso_mid.offset = Vec3::new(
0.0,
skeleton_attr.torso_mid.0 + wave_quick_cos * 2.2,
skeleton_attr.torso_mid.1 + wave_med * 3.2,
skeleton_attr.torso_mid.0 + horichest * 2.5,
skeleton_attr.torso_mid.1 + vertchest * -3.2 + 1.0,
) / 11.0;
next.torso_mid.ori = Quaternion::rotation_x(-0.05 + wave_med_cos * 0.12);
next.torso_mid.scale = Vec3::one() / 10.98;
next.torso_mid.ori = Quaternion::rotation_y(horichest * -0.09);
next.torso_mid.scale = Vec3::one() * 0.98 / 11.0;
next.ears.offset = Vec3::new(0.0, skeleton_attr.ears.0 + wave * 0.4, skeleton_attr.ears.1);
next.ears.ori = Quaternion::rotation_x(wave * 0.2);
next.ears.offset = Vec3::new(0.0, skeleton_attr.ears.0, skeleton_attr.ears.1);
next.ears.ori = Quaternion::rotation_x(0.0);
next.ears.scale = Vec3::one() * 1.02;
next.foot_lf.offset = Vec3::new(
-skeleton_attr.feet_f.0,
skeleton_attr.feet_f.1 + wave_quick * 3.0,
skeleton_attr.feet_f.2 + wave_quick_cos * 4.0,
skeleton_attr.feet_f.1 + horilf * 2.5,
skeleton_attr.feet_f.2 + vertlf * 5.0 * skeleton_attr.height - 0.5,
) / 11.0;
next.foot_lf.ori = Quaternion::rotation_x(wave_quick * 0.8);
next.foot_lf.ori = Quaternion::rotation_x(horilf * 0.4);
next.foot_lf.scale = Vec3::one() / 11.0;
next.foot_rf.offset = Vec3::new(
skeleton_attr.feet_f.0,
skeleton_attr.feet_f.1 - wave_quick_cos * 3.0,
skeleton_attr.feet_f.2 + wave_quick * 4.0,
skeleton_attr.feet_f.1 + horirfoffset * 2.5,
skeleton_attr.feet_f.2 + vertrfoffset * 5.0 * skeleton_attr.height - 0.5,
) / 11.0;
next.foot_rf.ori = Quaternion::rotation_x(wave_quick_cos * 0.8);
next.foot_rf.ori = Quaternion::rotation_x(horirfoffset * 0.4);
next.foot_rf.scale = Vec3::one() / 11.0;
next.foot_lb.offset = Vec3::new(
-skeleton_attr.feet_b.0,
skeleton_attr.feet_b.1 - wave_quick_cos * 3.0,
skeleton_attr.feet_b.2 + wave_quick * 4.0,
skeleton_attr.feet_b.1 + horilboffset * 3.0,
skeleton_attr.feet_b.2 + vertlboffset * 5.0 * skeleton_attr.height - 0.5,
) / 11.0;
next.foot_lb.ori = Quaternion::rotation_x(wave_quick_cos * 0.8);
next.foot_lb.ori = Quaternion::rotation_x(horilboffset * 0.35);
next.foot_lb.scale = Vec3::one() / 11.0;
next.foot_rb.offset = Vec3::new(
skeleton_attr.feet_b.0,
skeleton_attr.feet_b.1 + wave_quick * 3.0,
skeleton_attr.feet_b.2 + wave_quick_cos * 4.0,
skeleton_attr.feet_b.1 + horirb * 3.0,
skeleton_attr.feet_b.2 + vertrb * 5.0 * skeleton_attr.height - 0.5,
) / 11.0;
next.foot_rb.ori = Quaternion::rotation_x(wave_quick * 0.8);
next.foot_rb.ori = Quaternion::rotation_x(horirb * 0.35);
next.foot_rb.scale = Vec3::one() / 11.0;
next