custom scaling by species

This commit is contained in:
jshipsey 2020-06-28 16:56:30 -04:00
parent 94ab3665d5
commit a7c23ea5be
6 changed files with 35 additions and 10 deletions

View File

@ -60,9 +60,9 @@ impl Animation for IdleAnimation {
next.jaw.ori = Quaternion::rotation_x(slow * 0.04);
next.jaw.scale = Vec3::one() * 0.98;
next.chest.offset = Vec3::new(0.0, skeleton_attr.chest.0, skeleton_attr.chest.1) / 6.0;
next.chest.offset = Vec3::new(0.0, skeleton_attr.chest.0, skeleton_attr.chest.1) *skeleton_attr.scaler/11.0;
next.chest.ori = Quaternion::rotation_y(slow * 0.01);
next.chest.scale = Vec3::one() / 6.0;
next.chest.scale = Vec3::one() *skeleton_attr.scaler/11.0;
next.tail_front.offset =
Vec3::new(0.0, skeleton_attr.tail_front.0, skeleton_attr.tail_front.1);

View File

@ -93,6 +93,7 @@ pub struct SkeletonAttr {
feet_f: (f32, f32, f32),
feet_b: (f32, f32, f32),
lean: (f32, f32),
scaler: f32,
}
impl<'a> std::convert::TryFrom<&'a comp::Body> for SkeletonAttr {
@ -118,6 +119,7 @@ impl Default for SkeletonAttr {
feet_f: (0.0, 0.0, 0.0),
feet_b: (0.0, 0.0, 0.0),
lean: (0.0, 0.0),
scaler: 0.0,
}
}
}
@ -210,6 +212,16 @@ impl<'a> From<&'a comp::quadruped_low::Body> for SkeletonAttr {
(Pangolin, _) => (0.4, 0.0),
_ => (0.0, 1.0),
},
scaler: match (body.species, body.body_type) {
(Crocodile, _) => (1.3),
(Alligator, _) => (1.5),
(Salamander, _) => (1.4),
(Monitor, _) => (1.1),
(Asp, _) => (1.2),
(Tortoise, _) => (1.0),
(Rocksnapper, _) => (1.2),
(Pangolin, _) => (1.3),
},
}
}
}

View File

@ -132,11 +132,11 @@ impl Animation for RunAnimation {
* Quaternion::rotation_x(-0.04);
next.tail_rear.scale = Vec3::one();
next.chest.offset = Vec3::new(0.0, skeleton_attr.chest.0, skeleton_attr.chest.1) / 6.0;
next.chest.offset = Vec3::new(0.0, skeleton_attr.chest.0, skeleton_attr.chest.1) *skeleton_attr.scaler/11.0;
next.chest.ori = Quaternion::rotation_z(short * 0.12)
* Quaternion::rotation_y(shortalt * 0.12)
* Quaternion::rotation_x(skeleton_attr.lean.0);
next.chest.scale = Vec3::one() / 6.0;
next.chest.scale = Vec3::one() *skeleton_attr.scaler/11.0;
next.foot_fl.offset = Vec3::new(
-skeleton_attr.feet_f.0,

View File

@ -85,9 +85,9 @@ impl Animation for IdleAnimation {
0.0,
skeleton_attr.torso_front.0,
skeleton_attr.torso_front.1 + slower * 0.3,
) / 8.0;
) *skeleton_attr.scaler/11.0;
next.torso_front.ori = Quaternion::rotation_y(slow * 0.02);
next.torso_front.scale = Vec3::one() / 8.0;
next.torso_front.scale = Vec3::one() *skeleton_attr.scaler/11.0;
next.torso_back.offset = Vec3::new(
0.0,

View File

@ -127,6 +127,7 @@ pub struct SkeletonAttr {
leg_b: (f32, f32, f32),
feet_f: (f32, f32, f32),
feet_b: (f32, f32, f32),
scaler: f32,
}
impl<'a> std::convert::TryFrom<&'a comp::Body> for SkeletonAttr {
@ -154,6 +155,7 @@ impl Default for SkeletonAttr {
leg_b: (0.0, 0.0, 0.0),
feet_f: (0.0, 0.0, 0.0),
feet_b: (0.0, 0.0, 0.0),
scaler: 0.0,
}
}
}
@ -283,6 +285,17 @@ impl<'a> From<&'a comp::quadruped_medium::Body> for SkeletonAttr {
(Frostfang, _) => (0.0, -1.5, -3.5),
(Mouflon, _) => (-1.0, -1.5, -2.5),
},
scaler: match (body.species, body.body_type) {
(Grolgar, _) => (1.3),
(Saber, _) => (1.1),
(Tuskram, _) => (1.2),
(Lion, _) => (1.3),
(Tarasque, _) => (1.3),
(Tiger, _) => (1.2),
(Wolf, _) => (1.0),
(Frostfang, _) => (1.0),
(Mouflon, _) => (1.0),
},
}
}
}

View File

@ -134,9 +134,9 @@ impl Animation for RunAnimation {
0.0,
skeleton_attr.torso_front.0,
skeleton_attr.torso_front.1 + shortalt * 0.8,
) / 8.0;
) *skeleton_attr.scaler/11.0;
next.torso_front.ori = Quaternion::rotation_x(short * 0.03);
next.torso_front.scale = Vec3::one() / 8.0;
next.torso_front.scale = Vec3::one() *skeleton_attr.scaler/11.0;
next.torso_back.offset =
Vec3::new(0.0, skeleton_attr.torso_back.0, skeleton_attr.torso_back.1);
@ -238,9 +238,9 @@ impl Animation for RunAnimation {
0.0,
skeleton_attr.torso_front.0,
skeleton_attr.torso_front.1 + shortalt * 2.0,
) / 8.0;
) *skeleton_attr.scaler/11.0;
next.torso_front.ori = Quaternion::rotation_x(short * 0.13);
next.torso_front.scale = Vec3::one() / 8.0;
next.torso_front.scale = Vec3::one() *skeleton_attr.scaler/11.0;
next.torso_back.offset =
Vec3::new(0.0, skeleton_attr.torso_back.0, skeleton_attr.torso_back.1);