cyclops run anim

This commit is contained in:
jshipsey 2020-07-30 02:13:58 -04:00
parent 990762ba76
commit 487131efb8
5 changed files with 85 additions and 63 deletions

View File

@ -37,7 +37,7 @@
center: ("npc.cyclops.male.torso_upper"), center: ("npc.cyclops.male.torso_upper"),
), ),
torso_lower: ( torso_lower: (
offset: (-6.0, -5.5, -6.0), offset: (-6.0, -5.5, -12.0),
center: ("npc.cyclops.male.torso_lower"), center: ("npc.cyclops.male.torso_lower"),
) )
), ),
@ -51,7 +51,7 @@
center: ("npc.cyclops.male.torso_upper"), center: ("npc.cyclops.male.torso_upper"),
), ),
torso_lower: ( torso_lower: (
offset: (-6.0, -5.5, -6.0), offset: (-6.0, -5.5, -12.0),
center: ("npc.cyclops.male.torso_lower"), center: ("npc.cyclops.male.torso_lower"),
) )
), ),

View File

@ -225,11 +225,11 @@
lateral: ("npc.rocksnapper.male.foot_fr"), lateral: ("npc.rocksnapper.male.foot_fr"),
), ),
back_left: ( back_left: (
offset: (-11.0, 0.0, -9.0), offset: (-11.0, -6.0, -9.0),
lateral: ("npc.rocksnapper.male.foot_bl"), lateral: ("npc.rocksnapper.male.foot_bl"),
), ),
back_right: ( back_right: (
offset: (0.0, 0.0, -9.0), offset: (0.0, -6.0, -9.0),
lateral: ("npc.rocksnapper.male.foot_br"), lateral: ("npc.rocksnapper.male.foot_br"),
), ),
), ),

View File

@ -38,9 +38,9 @@ impl Body {
Body::Dragon(_) => 250.0, Body::Dragon(_) => 250.0,
Body::BirdSmall(_) => 75.0, Body::BirdSmall(_) => 75.0,
Body::FishSmall(_) => 40.0, Body::FishSmall(_) => 40.0,
Body::BipedLarge(_) => 120.0, Body::BipedLarge(_) => 75.0,
Body::Object(_) => 40.0, Body::Object(_) => 40.0,
Body::Golem(_) => 130.0, Body::Golem(_) => 60.0,
Body::Critter(_) => 85.0, Body::Critter(_) => 85.0,
Body::QuadrupedLow(_) => 120.0, Body::QuadrupedLow(_) => 120.0,
} }

View File

@ -40,6 +40,7 @@ impl Skeleton for BipedLargeSkeleton {
#[cfg_attr(feature = "be-dyn-lib", export_name = "biped_large_compute_mats")] #[cfg_attr(feature = "be-dyn-lib", export_name = "biped_large_compute_mats")]
fn compute_matrices_inner(&self) -> ([FigureBoneData; 16], Vec3<f32>) { fn compute_matrices_inner(&self) -> ([FigureBoneData; 16], Vec3<f32>) {
let upper_torso_mat = self.upper_torso.compute_base_matrix(); let upper_torso_mat = self.upper_torso.compute_base_matrix();
let lower_torso_mat = self.lower_torso.compute_base_matrix();
let shoulder_l_mat = self.shoulder_l.compute_base_matrix(); let shoulder_l_mat = self.shoulder_l.compute_base_matrix();
let shoulder_r_mat = self.shoulder_r.compute_base_matrix(); let shoulder_r_mat = self.shoulder_r.compute_base_matrix();
let leg_l_mat = self.leg_l.compute_base_matrix(); let leg_l_mat = self.leg_l.compute_base_matrix();
@ -49,19 +50,23 @@ impl Skeleton for BipedLargeSkeleton {
[ [
FigureBoneData::new(torso_mat * upper_torso_mat * self.head.compute_base_matrix()), FigureBoneData::new(torso_mat * upper_torso_mat * self.head.compute_base_matrix()),
FigureBoneData::new(torso_mat * upper_torso_mat), FigureBoneData::new(torso_mat * upper_torso_mat),
FigureBoneData::new( FigureBoneData::new(torso_mat * upper_torso_mat * lower_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_l_mat),
FigureBoneData::new(torso_mat * upper_torso_mat * shoulder_r_mat), FigureBoneData::new(torso_mat * upper_torso_mat * shoulder_r_mat),
FigureBoneData::new( FigureBoneData::new(
torso_mat * upper_torso_mat * self.hand_l.compute_base_matrix(), torso_mat
* upper_torso_mat
* shoulder_l_mat
* self.hand_l.compute_base_matrix(),
), ),
FigureBoneData::new( FigureBoneData::new(
torso_mat * upper_torso_mat * self.hand_r.compute_base_matrix(), torso_mat
* upper_torso_mat
* shoulder_r_mat
* self.hand_r.compute_base_matrix(),
), ),
FigureBoneData::new(torso_mat * upper_torso_mat * leg_l_mat), FigureBoneData::new(torso_mat * upper_torso_mat * lower_torso_mat * leg_l_mat),
FigureBoneData::new(torso_mat * upper_torso_mat * leg_r_mat), FigureBoneData::new(torso_mat * upper_torso_mat * lower_torso_mat * leg_r_mat),
FigureBoneData::new(self.foot_l.compute_base_matrix()), FigureBoneData::new(self.foot_l.compute_base_matrix()),
FigureBoneData::new(self.foot_r.compute_base_matrix()), FigureBoneData::new(self.foot_r.compute_base_matrix()),
FigureBoneData::default(), FigureBoneData::default(),
@ -131,7 +136,7 @@ impl<'a> From<&'a comp::biped_large::Body> for SkeletonAttr {
Self { Self {
head: match (body.species, body.body_type) { head: match (body.species, body.body_type) {
(Ogre, _) => (3.0, 6.0), (Ogre, _) => (3.0, 6.0),
(Cyclops, _) => (3.0, 9.0), (Cyclops, _) => (4.5, 7.5),
(Wendigo, _) => (3.0, 13.5), (Wendigo, _) => (3.0, 13.5),
(Troll, _) => (6.0, 10.0), (Troll, _) => (6.0, 10.0),
}, },
@ -143,25 +148,25 @@ impl<'a> From<&'a comp::biped_large::Body> for SkeletonAttr {
}, },
lower_torso: match (body.species, body.body_type) { lower_torso: match (body.species, body.body_type) {
(Ogre, _) => (1.0, -9.5), (Ogre, _) => (1.0, -9.5),
(Cyclops, _) => (1.0, -10.5), (Cyclops, _) => (1.0, -4.5),
(Wendigo, _) => (-1.5, -8.0), (Wendigo, _) => (-1.5, -8.0),
(Troll, _) => (1.0, -12.5), (Troll, _) => (1.0, -12.5),
}, },
shoulder: match (body.species, body.body_type) { shoulder: match (body.species, body.body_type) {
(Ogre, _) => (6.1, 0.5, 2.5), (Ogre, _) => (6.1, 0.5, 2.5),
(Cyclops, _) => (9.5, 0.5, 2.5), (Cyclops, _) => (9.5, 2.5, 2.5),
(Wendigo, _) => (9.0, 0.5, -0.5), (Wendigo, _) => (9.0, 0.5, -0.5),
(Troll, _) => (11.0, 0.5, -2.5), (Troll, _) => (11.0, 0.5, -2.5),
}, },
hand: match (body.species, body.body_type) { hand: match (body.species, body.body_type) {
(Ogre, _) => (10.5, -1.0, -0.5), (Ogre, _) => (10.5, -1.0, -0.5),
(Cyclops, _) => (10.5, 0.0, -0.5), (Cyclops, _) => (0.0, 0.0, -3.5),
(Wendigo, _) => (12.0, 0.0, -0.5), (Wendigo, _) => (12.0, 0.0, -0.5),
(Troll, _) => (11.5, 0.0, -1.5), (Troll, _) => (11.5, 0.0, -1.5),
}, },
leg: match (body.species, body.body_type) { leg: match (body.species, body.body_type) {
(Ogre, _) => (0.0, 0.0, -6.0), (Ogre, _) => (0.0, 0.0, -6.0),
(Cyclops, _) => (0.0, 0.0, -9.0), (Cyclops, _) => (0.0, 0.0, -5.0),
(Wendigo, _) => (2.0, 0.0, -8.5), (Wendigo, _) => (2.0, 0.0, -8.5),
(Troll, _) => (5.0, 0.0, -16.0), (Troll, _) => (5.0, 0.0, -16.0),
}, },

View File

@ -21,39 +21,52 @@ impl Animation for RunAnimation {
) -> Self::Skeleton { ) -> Self::Skeleton {
let mut next = (*skeleton).clone(); let mut next = (*skeleton).clone();
let lab = 10.0; let lab = 0.55; //.65
let foothoril = (((1.0)
let belt = (anim_time as f32 * lab as f32 + 1.5 * PI).sin(); / (0.4
let beltsnap = (((5.0) + (0.6)
/ (1.0 + (4.0) * ((anim_time as f32 * lab as f32 + PI * 1.5).sin()).powf(2.0 as f32))) * ((anim_time as f32 * 16.0 * lab as f32 + PI * 1.4).sin()).powf(2.0 as f32)))
.sqrt()) .sqrt())
* ((anim_time as f32 * lab as f32 + PI * 1.5).sin()); * ((anim_time as f32 * 16.0 * lab as f32 + PI * 1.4).sin());
let foothoril = (anim_time as f32 * lab as f32 + PI * 1.4).sin(); let foothorir = (((1.0)
let foothorir = (anim_time as f32 * lab as f32 + PI * 0.4).sin(); / (0.4
+ (0.6)
let footvertl = (anim_time as f32 * lab as f32).sin().max(0.1); * ((anim_time as f32 * 16.0 * lab as f32 + PI * 0.4).sin()).powf(2.0 as f32)))
let footvertr = (anim_time as f32 * lab as f32 + PI).sin().max(0.1); .sqrt())
* ((anim_time as f32 * 16.0 * lab as f32 + PI * 0.4).sin());
let footvertl = (anim_time as f32 * 16.0 * lab as f32).sin();
let footvertr = (anim_time as f32 * 16.0 * lab as f32 + PI).sin();
let handhoril = (anim_time as f32 * 16.0 * lab as f32 + PI * 1.4).sin();
let handhorir = (anim_time as f32 * 16.0 * lab as f32 + PI * 0.4).sin();
let footrotl = (((5.0) let footrotl = (((5.0)
/ (1.0 + (4.0) * ((anim_time as f32 * lab as f32 + PI * 1.4).sin()).powf(2.0 as f32))) / (2.5
+ (2.5)
* ((anim_time as f32 * 16.0 * lab as f32 + PI * 1.4).sin()).powf(2.0 as f32)))
.sqrt()) .sqrt())
* ((anim_time as f32 * lab as f32 + PI * 1.4).sin()); * ((anim_time as f32 * 16.0 * lab as f32 + PI * 1.4).sin());
let footrotr = (((5.0) let footrotr = (((5.0)
/ (1.0 + (4.0) * ((anim_time as f32 * lab as f32 + PI * 0.4).sin()).powf(2.0 as f32))) / (1.0
+ (4.0)
* ((anim_time as f32 * 16.0 * lab as f32 + PI * 0.4).sin()).powf(2.0 as f32)))
.sqrt()) .sqrt())
* ((anim_time as f32 * lab as f32 + PI * 0.4).sin()); * ((anim_time as f32 * 16.0 * lab as f32 + PI * 0.4).sin());
let short = (anim_time as f32 * lab as f32 * 16.0).sin();
let shortalt = (anim_time as f32 * lab as f32 * 16.0 + PI / 2.0).sin();
next.head.offset = Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1) * 1.02; next.head.offset = Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1) * 1.02;
next.head.ori = Quaternion::rotation_z(belt * -0.3) * Quaternion::rotation_x(0.1); next.head.ori = Quaternion::rotation_z(short * -0.18) * Quaternion::rotation_x(-0.05);
next.head.scale = Vec3::one() * 1.02; next.head.scale = Vec3::one() * 1.02;
next.upper_torso.offset = Vec3::new( next.upper_torso.offset = Vec3::new(
0.0, 0.0,
skeleton_attr.upper_torso.0, skeleton_attr.upper_torso.0,
skeleton_attr.upper_torso.1 + belt * 1.0, skeleton_attr.upper_torso.1 + shortalt * -1.5,
) / 8.0; ) / 8.0;
next.upper_torso.ori = Quaternion::rotation_z(belt * 0.40) * Quaternion::rotation_x(0.0); next.upper_torso.ori = Quaternion::rotation_z(short * 0.18);
next.upper_torso.scale = Vec3::one() / 8.0; next.upper_torso.scale = Vec3::one() / 8.0;
next.lower_torso.offset = Vec3::new( next.lower_torso.offset = Vec3::new(
@ -61,25 +74,27 @@ impl Animation for RunAnimation {
skeleton_attr.lower_torso.0, skeleton_attr.lower_torso.0,
skeleton_attr.lower_torso.1, skeleton_attr.lower_torso.1,
); );
next.lower_torso.ori = Quaternion::rotation_z(belt * -0.55) * Quaternion::rotation_x(0.0); next.lower_torso.ori = Quaternion::rotation_z(short * 0.15) * Quaternion::rotation_x(0.14);
next.lower_torso.scale = Vec3::one() * 1.02; next.lower_torso.scale = Vec3::one() * 1.02;
next.shoulder_l.offset = Vec3::new( next.shoulder_l.offset = Vec3::new(
-skeleton_attr.shoulder.0, -skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1, skeleton_attr.shoulder.1 + foothoril * -3.0,
skeleton_attr.shoulder.2, skeleton_attr.shoulder.2,
); );
next.shoulder_l.ori = next.shoulder_l.ori = Quaternion::rotation_x(footrotl * -0.36)
Quaternion::rotation_z(0.0) * Quaternion::rotation_x(footrotl * -0.15); * Quaternion::rotation_y(0.1)
* Quaternion::rotation_z(footrotl * 0.3);
next.shoulder_l.scale = Vec3::one(); next.shoulder_l.scale = Vec3::one();
next.shoulder_r.offset = Vec3::new( next.shoulder_r.offset = Vec3::new(
skeleton_attr.shoulder.0, skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1, skeleton_attr.shoulder.1 + foothorir * -3.0,
skeleton_attr.shoulder.2, skeleton_attr.shoulder.2,
); );
next.shoulder_r.ori = next.shoulder_r.ori = Quaternion::rotation_x(footrotr * -0.36)
Quaternion::rotation_z(0.0) * Quaternion::rotation_x(footrotr * -0.15); * Quaternion::rotation_y(-0.1)
* Quaternion::rotation_z(footrotr * -0.3);
next.shoulder_r.scale = Vec3::one(); next.shoulder_r.scale = Vec3::one();
next.hand_l.offset = Vec3::new( next.hand_l.offset = Vec3::new(
@ -87,8 +102,8 @@ impl Animation for RunAnimation {
skeleton_attr.hand.1, skeleton_attr.hand.1,
skeleton_attr.hand.2, skeleton_attr.hand.2,
); );
next.hand_l.ori = next.hand_l.ori = Quaternion::rotation_x(0.3 + (handhoril * -0.6).max(0.0))
Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.3 + foothoril * -0.6); * Quaternion::rotation_y(handhoril * -0.1);
next.hand_l.scale = Vec3::one() * 1.02; next.hand_l.scale = Vec3::one() * 1.02;
next.hand_r.offset = Vec3::new( next.hand_r.offset = Vec3::new(
@ -96,47 +111,49 @@ impl Animation for RunAnimation {
skeleton_attr.hand.1, skeleton_attr.hand.1,
skeleton_attr.hand.2, skeleton_attr.hand.2,
); );
next.hand_r.ori = next.hand_r.ori = Quaternion::rotation_x(0.3 + (handhorir * -0.6).max(0.0))
Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.3 + foothorir * -0.6); * Quaternion::rotation_y(handhorir * 0.1);
next.hand_r.scale = Vec3::one() * 1.02; next.hand_r.scale = Vec3::one() * 1.02;
next.leg_l.offset = Vec3::new( next.leg_l.offset = Vec3::new(
-skeleton_attr.leg.0, -skeleton_attr.leg.0,
skeleton_attr.leg.1, skeleton_attr.leg.1,
skeleton_attr.leg.2, skeleton_attr.leg.2,
) * 1.02; ) * 0.98;
next.leg_l.ori = next.leg_l.ori =
Quaternion::rotation_z(belt * -0.8) * Quaternion::rotation_x(foothoril * 0.2); Quaternion::rotation_z(short * 0.18) * Quaternion::rotation_x(foothoril * 0.3);
next.leg_l.scale = Vec3::one() * 1.02; next.leg_l.scale = Vec3::one() * 0.98;
next.leg_r.offset = Vec3::new( next.leg_r.offset = Vec3::new(
skeleton_attr.leg.0, skeleton_attr.leg.0,
skeleton_attr.leg.1, skeleton_attr.leg.1,
skeleton_attr.leg.2, skeleton_attr.leg.2,
) * 1.02; ) * 0.98;
next.leg_r.ori = next.leg_r.ori =
Quaternion::rotation_z(belt * -0.8) * Quaternion::rotation_x(foothorir * 0.2); Quaternion::rotation_z(short * 0.18) * Quaternion::rotation_x(foothorir * 0.3);
next.leg_r.scale = Vec3::one() * 1.02; next.leg_r.scale = Vec3::one() * 0.98;
next.foot_l.offset = Vec3::new( next.foot_l.offset = Vec3::new(
-skeleton_attr.foot.0, -skeleton_attr.foot.0,
skeleton_attr.foot.1 + foothoril * 8.0 + 3.0, 4.0 + skeleton_attr.foot.1 + foothoril * 8.5,
skeleton_attr.foot.2 + footvertl * 4.0, skeleton_attr.foot.2 + ((footvertl * 6.5).max(0.0)),
) / 8.0; ) / 8.0;
next.foot_l.ori = Quaternion::rotation_x(footrotl * 0.5); next.foot_l.ori =
next.foot_l.scale = Vec3::one() / 8.0 * 0.98; Quaternion::rotation_x(-0.5 + footrotl * 0.85) * Quaternion::rotation_y(0.0);
next.foot_l.scale = Vec3::one() / 8.0;
next.foot_r.offset = Vec3::new( next.foot_r.offset = Vec3::new(
skeleton_attr.foot.0, skeleton_attr.foot.0,
skeleton_attr.foot.1 + foothorir * 8.0 + 3.0, 4.0 + skeleton_attr.foot.1 + foothorir * 8.5,
skeleton_attr.foot.2 + footvertr * 4.0, skeleton_attr.foot.2 + ((footvertr * 6.5).max(0.0)),
) / 8.0; ) / 8.0;
next.foot_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(footrotr * 0.5); next.foot_r.ori =
next.foot_r.scale = Vec3::one() / 8.0 * 0.98; Quaternion::rotation_x(-0.5 + footrotr * 0.85) * Quaternion::rotation_y(0.0);
next.foot_r.scale = Vec3::one() / 8.0;
next.torso.offset = Vec3::new(0.0, 0.0, beltsnap * 0.25); next.torso.offset = Vec3::new(0.0, 0.0, 0.0);
next.torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(-0.13); next.torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(-0.25);
next.torso.scale = Vec3::one(); next.torso.scale = Vec3::one();
next next
} }