species specific improvement

This commit is contained in:
jshipsey 2020-09-02 01:14:50 -04:00
parent 6a16268ff0
commit 06b39b9072
9 changed files with 215 additions and 182 deletions

View File

@ -325,7 +325,7 @@
central: ("npc.tiger.male.ears"),
),
tail: (
offset: (-1.5, -12.0, -1.0),
offset: (-1.5, -12.0, -10.0),
central: ("npc.tiger.male.tail"),
),
),
@ -355,7 +355,7 @@
central: ("npc.tiger.male.ears"),
),
tail: (
offset: (-1.5, -12.0, -1.0),
offset: (-1.5, -12.0, -10.0),
central: ("npc.tiger.male.tail"),
),
),

View File

@ -1,11 +1,11 @@
({
(Grolgar, Male): (
leg_fl: (
offset: (-2.5, -12.0, -7.5),//these are done very case by case
offset: (-2.5, -5.0, -10.0),//these are done very case by case
lateral: ("npc.grolgar.male.leg_fl"),
),
leg_fr: (
offset: (-2.5, -12.0, -7.5),
offset: (-2.5, -5.0, -10.0),
lateral: ("npc.grolgar.male.leg_fr"),
),
leg_bl: (
@ -17,11 +17,11 @@
lateral: ("npc.grolgar.male.leg_br"),
),
foot_fl: (
offset: (-2.5, -3.0, -6.0),//y pivot should be -1/4 of the y dimension of the model
offset: (-2.5, -2.0, -6.0),//y pivot should be -1/4 of the y dimension of the model
lateral: ("npc.grolgar.male.foot_fl"),
),
foot_fr: (
offset: (-2.5, -3.0, -6.0),//y pivot should be -1/4 of the y dimension of the model
offset: (-2.5, -2.0, -6.0),//y pivot should be -1/4 of the y dimension of the model
lateral: ("npc.grolgar.male.foot_fr"),
),
foot_bl: (
@ -35,11 +35,11 @@
),
(Grolgar, Female): (
leg_fl: (
offset: (-2.5, -12.0, -7.5),
offset: (-2.5, -5.0, -10.0),
lateral: ("npc.grolgar.male.leg_fl"),
),
leg_fr: (
offset: (-2.5, -12.0, -7.5),
offset: (-2.5, -5.0, -10.0),
lateral: ("npc.grolgar.male.leg_fr"),
),
leg_bl: (
@ -51,11 +51,11 @@
lateral: ("npc.grolgar.male.leg_br"),
),
foot_fl: (
offset: (-2.5, -3.0, -6.0),
offset: (-2.5, -2.0, -6.0),
lateral: ("npc.grolgar.male.foot_fl"),
),
foot_fr: (
offset: (-2.5, -3.0, -6.0),
offset: (-2.5, -2.0, -6.0),
lateral: ("npc.grolgar.male.foot_fr"),
),
foot_bl: (
@ -341,19 +341,19 @@
),
(Tiger, Male): (
leg_fl: (
offset: (-2.0, -3.0, -5.0),
offset: (-2.0, -3.0, -10.0),
lateral: ("npc.tiger.male.leg_fl"),
),
leg_fr: (
offset: (-2.0, -3.0, -5.0),
offset: (-2.0, -3.0, -10.0),
lateral: ("npc.tiger.male.leg_fr"),
),
leg_bl: (
offset: (-2.0, -3.0, -5.0),
offset: (-2.0, -3.0, -10.0),
lateral: ("npc.tiger.male.leg_bl"),
),
leg_br: (
offset: (-2.0, -3.0, -5.0),
offset: (-2.0, -3.0, -10.0),
lateral: ("npc.tiger.male.leg_br"),
),
foot_fl: (
@ -375,19 +375,19 @@
),
(Tiger, Female): (
leg_fl: (
offset: (-2.0, -3.0, -5.0),
offset: (-2.0, -3.0, -10.0),
lateral: ("npc.tiger.male.leg_fl"),
),
leg_fr: (
offset: (-2.0, -3.0, -5.0),
offset: (-2.0, -3.0, -10.0),
lateral: ("npc.tiger.male.leg_fr"),
),
leg_bl: (
offset: (-2.0, -3.0, -5.0),
offset: (-2.0, -3.0, -10.0),
lateral: ("npc.tiger.male.leg_bl"),
),
leg_br: (
offset: (-2.0, -3.0, -5.0),
offset: (-2.0, -3.0, -10.0),
lateral: ("npc.tiger.male.leg_br"),
),
foot_fl: (
@ -569,11 +569,11 @@
lateral: ("npc.mouflon.male.foot_fr"),
),
foot_bl: (
offset: (-1.0, -2.0, -6.0),
offset: (-1.0, -2.0, -10.0),
lateral: ("npc.mouflon.male.foot_bl"),
),
foot_br: (
offset: (-1.0, -2.0, -6.0),
offset: (-1.0, -2.0, -10.0),
lateral: ("npc.mouflon.male.foot_br"),
),
),
@ -603,11 +603,11 @@
lateral: ("npc.mouflon.male.foot_fr"),
),
foot_bl: (
offset: (-1.0, -2.0, -6.0),
offset: (-1.0, -2.0, -10.0),
lateral: ("npc.mouflon.male.foot_bl"),
),
foot_br: (
offset: (-1.0, -2.0, -6.0),
offset: (-1.0, -2.0, -10.0),
lateral: ("npc.mouflon.male.foot_br"),
),
),

View File

@ -32,7 +32,7 @@ impl Body {
match self {
Body::Humanoid(_) => 100.0,
Body::QuadrupedSmall(_) => 125.0,
Body::QuadrupedMedium(_) => 180.0,
Body::QuadrupedMedium(_) => 30.0,
Body::BirdMedium(_) => 80.0,
Body::FishMedium(_) => 50.0,
Body::Dragon(_) => 250.0,

View File

@ -89,9 +89,10 @@ pub struct SkeletonAttr {
feet_f: (f32, f32, f32),
feet_b: (f32, f32, f32),
scaler: f32,
dampen: f32,
startangle: f32,
maximize: f32,
tempo: f32,
spring: f32,
}
impl<'a> std::convert::TryFrom<&'a comp::Body> for SkeletonAttr {
@ -120,9 +121,10 @@ impl Default for SkeletonAttr {
feet_f: (0.0, 0.0, 0.0),
feet_b: (0.0, 0.0, 0.0),
scaler: 0.0,
dampen: 0.0,
startangle: 0.0,
maximize: 0.0,
tempo: 0.0,
spring: 0.0,
}
}
}
@ -183,7 +185,7 @@ impl<'a> From<&'a Body> for SkeletonAttr {
(Tuskram, _) => (-9.0, 2.0),
(Lion, _) => (-11.0, 1.0),
(Tarasque, _) => (-11.0, 0.0),
(Tiger, _) => (-13.5, -7.0),
(Tiger, _) => (-13.5, 3.0),
(Wolf, _) => (-11.0, 0.0),
(Frostfang, _) => (-7.0, -3.5),
(Mouflon, _) => (-10.5, 3.0),
@ -238,15 +240,15 @@ impl<'a> From<&'a Body> for SkeletonAttr {
(Hirdrassil, _) => (2.5, 5.0),
},
leg_f: match (body.species, body.body_type) {
(Grolgar, _) => (-7.0, 4.0, 0.0),
(Grolgar, _) => (7.0, -2.0, 2.0),
(Saber, _) => (7.0, -4.0, -3.5),
(Tuskram, _) => (6.0, -6.5, -0.5),
(Lion, _) => (6.5, -6.5, -2.0),
(Tarasque, _) => (7.0, -8.0, -6.0),
(Tiger, _) => (6.0, -5.0, -3.0),
(Tiger, _) => (6.0, -5.0, 1.0),
(Wolf, _) => (4.5, -6.5, -1.5),
(Frostfang, _) => (5.5, -5.5, -2.0),
(Mouflon, _) => (4.0, -5.0, -5.0),
(Mouflon, _) => (4.0, -5.0, -4.0),
(Catoblepas, _) => (7.0, 2.0, -6.0),
(Bonerattler, _) => (5.5, 5.0, -4.0),
(Deer, _) => (3.5, -4.5, -3.5),
@ -258,41 +260,41 @@ impl<'a> From<&'a Body> for SkeletonAttr {
(Tuskram, _) => (5.0, -5.5, -3.5),
(Lion, _) => (6.0, -6.0, -2.0),
(Tarasque, _) => (6.0, -6.5, -6.5),
(Tiger, _) => (6.0, -7.5, -3.0),
(Tiger, _) => (6.0, -7.5, 1.0),
(Wolf, _) => (5.0, -6.5, -3.0),
(Frostfang, _) => (3.5, -4.5, -2.0),
(Mouflon, _) => (3.5, -8.0, -4.5),
(Mouflon, _) => (3.5, -8.0, -3.5),
(Catoblepas, _) => (6.0, -2.5, -2.5),
(Bonerattler, _) => (6.0, -8.0, -4.0),
(Deer, _) => (3.0, -6.5, -3.5),
(Hirdrassil, _) => (4.0, -6.5, -3.0),
},
feet_f: match (body.species, body.body_type) {
(Grolgar, _) => (0.0, -9.0, -7.0),
(Grolgar, _) => (0.0, -3.0, -9.0),
(Saber, _) => (1.0, -3.5, -2.5),
(Tuskram, _) => (0.5, 0.5, -9.0),
(Lion, _) => (0.0, 0.0, -7.0),
(Tarasque, _) => (1.0, 0.0, -3.0),
(Tiger, _) => (0.5, 0.0, -5.0),
(Tiger, _) => (0.5, 0.0, -9.0),
(Wolf, _) => (0.5, 0.0, -2.0),
(Frostfang, _) => (0.5, 1.5, -3.5),
(Mouflon, _) => (-0.5, -0.5, -1.5),
(Mouflon, _) => (-0.5, -0.5, -3.0),
(Catoblepas, _) => (1.0, 4.0, -3.0),
(Bonerattler, _) => (-0.5, -3.0, -2.5),
(Deer, _) => (-0.5, -0.5, -2.5),
(Hirdrassil, _) => (-0.5, -3.0, -3.5),
},
feet_b: match (body.species, body.body_type) {
(Grolgar, _) => (0.0, 0.0, -5.0),
(Grolgar, _) => (0.0, -1.0, -5.0),
(Saber, _) => (1.0, -1.0, -1.0),
(Tuskram, _) => (0.5, 0.0, -3.0),
(Tuskram, _) => (0.5, 0.0, -3.5),
(Lion, _) => (0.5, 0.5, -5.5),
(Tarasque, _) => (1.5, -1.0, -2.5),
(Tiger, _) => (1.0, 0.5, -4.0),
(Tiger, _) => (1.0, 0.5, -8.0),
(Wolf, _) => (0.0, -1.0, -1.5),
(Frostfang, _) => (0.0, -1.5, -3.5),
(Mouflon, _) => (-1.0, 0.0, -2.5),
(Catoblepas, _) => (0.5, 0.5, -3.0),
(Mouflon, _) => (-1.0, 0.0, -0.5),
(Catoblepas, _) => (0.5, 0.5, -4.0),
(Bonerattler, _) => (0.0, 3.0, -2.5),
(Deer, _) => (-1.0, -0.5, -2.0),
(Hirdrassil, _) => (-1.0, -2.0, -4.5),
@ -312,20 +314,21 @@ impl<'a> From<&'a Body> for SkeletonAttr {
(Deer, _) => (1.0),
(Hirdrassil, _) => (1.0),
},
dampen: match (body.species, body.body_type) {
(Grolgar, _) => (0.5),
(Saber, _) => (0.5),
(Tuskram, _) => (0.6),
(Lion, _) => (0.8),
(Tarasque, _) => (0.6),
(Tiger, _) => (0.6),
(Wolf, _) => (1.0),
(Frostfang, _) => (1.0),
(Mouflon, _) => (1.0),
(Catoblepas, _) => (0.6),
(Bonerattler, _) => (0.6),
(Deer, _) => (1.0),
(Hirdrassil, _) => (1.0),
startangle: match (body.species, body.body_type) {
//changes the default angle of front feet
(Grolgar, _) => (-0.3),
(Saber, _) => (-0.2),
(Tuskram, _) => (0.3),
(Lion, _) => (0.2),
(Tarasque, _) => (0.2),
(Tiger, _) => (0.0),
(Wolf, _) => (0.0),
(Frostfang, _) => (0.0),
(Mouflon, _) => (0.0),
(Catoblepas, _) => (0.2),
(Bonerattler, _) => (0.2),
(Deer, _) => (0.0),
(Hirdrassil, _) => (0.0),
},
maximize: match (body.species, body.body_type) {
(Grolgar, _) => (2.0),
@ -357,6 +360,21 @@ impl<'a> From<&'a Body> for SkeletonAttr {
(Deer, _) => (0.85),
(Hirdrassil, _) => (0.85),
},
spring: match (body.species, body.body_type) {
(Grolgar, _) => (1.0),
(Saber, _) => (0.9),
(Tuskram, _) => (0.9),
(Lion, _) => (1.0),
(Tarasque, _) => (1.0),
(Tiger, _) => (1.0),
(Wolf, _) => (1.2),
(Frostfang, _) => (1.0),
(Mouflon, _) => (0.6),
(Catoblepas, _) => (0.7),
(Bonerattler, _) => (1.1),
(Deer, _) => (0.9),
(Hirdrassil, _) => (1.1),
},
}
}
}

View File

@ -25,16 +25,12 @@ impl Animation for RunAnimation {
let speed = Vec2::<f32>::from(velocity).magnitude();
*rate = 1.0;
//let increasefreqtest = (((1.0/speed)*3.0).round()).min(5.0);
let lab = 0.6; //6
let lab = 0.72; //0.72
let amplitude = (speed / 24.0).max(0.25);
let amplitude2 = (speed * 1.4 / 24.0).max(0.6);
let amplitude3 = (speed / 24.0).max(0.35);
let speedmult = if speed > 0.0 {
1.2 * (1.0 * skeleton_attr.tempo)
} else {
0.9 * (1.0 * skeleton_attr.tempo)
};
let canceler = speed / 25.0;
let speedmult = skeleton_attr.tempo;
let canceler = speed / 24.0;
let short = (((1.0)
/ (0.72
+ 0.28
@ -60,7 +56,7 @@ impl Animation for RunAnimation {
* 0.25,
);
let speedadjust = if speed < 5.0 { 0.0 } else { speed / 25.0 };
let speedadjust = if speed < 5.0 { 0.0 } else { speed / 24.0 };
let shift1 = speedadjust - PI / 2.0 - speedadjust * PI * 3.0 / 4.0;
let shift2 = speedadjust + PI / 2.0 + speedadjust * PI / 2.0;
let shift3 = speedadjust + PI / 4.0 - speedadjust * PI / 4.0;
@ -68,10 +64,10 @@ impl Animation for RunAnimation {
//FL
let foot1a =
(anim_time as f32 * (16.0) * lab as f32 * speedmult + 0.0 + canceler * 0.08 + shift1)
(anim_time as f32 * (16.0) * lab as f32 * speedmult + 0.0 + canceler * 0.05 + shift1)
.sin(); //1.5
let foot1b =
(anim_time as f32 * (16.0) * lab as f32 * speedmult + 1.57 + canceler * 0.08 + shift1)
(anim_time as f32 * (16.0) * lab as f32 * speedmult + 1.57 + canceler * 0.05 + shift1)
.sin(); //1.9
//FR
let foot2a = (anim_time as f32 * (16.0) * lab as f32 * speedmult + shift2).sin(); //1.2
@ -81,10 +77,10 @@ impl Animation for RunAnimation {
let foot3b = (anim_time as f32 * (16.0) * lab as f32 * speedmult + 1.57 + shift3).sin(); //0.4
//BR
let foot4a =
(anim_time as f32 * (16.0) * lab as f32 * speedmult + 0.0 + canceler * 0.15 + shift4)
(anim_time as f32 * (16.0) * lab as f32 * speedmult + 0.0 + canceler * 0.05 + shift4)
.sin(); //0.3
let foot4b =
(anim_time as f32 * (16.0) * lab as f32 * speedmult + 1.57 + canceler * 0.15 + shift4)
(anim_time as f32 * (16.0) * lab as f32 * speedmult + 1.57 + canceler * 0.05 + shift4)
.sin(); //0.7
//
let ori: Vec2<f32> = Vec2::from(orientation);
@ -105,10 +101,11 @@ impl Animation for RunAnimation {
//Gallop
next.head_upper.position =
Vec3::new(0.0, skeleton_attr.head_upper.0, skeleton_attr.head_upper.1);
next.head_upper.orientation =
Quaternion::rotation_x(look.y*0.3 / ((canceler).max(0.5)) + amplitude * short * -0.03 - 0.1)
* Quaternion::rotation_z(look.x*0.3 / ((canceler).max(0.5)) + tilt * -1.2)
* Quaternion::rotation_y(tilt * 0.8);
next.head_upper.orientation = Quaternion::rotation_x(
look.y * 0.3 / ((canceler).max(0.5)) + amplitude * short * -0.03 - 0.1,
) * Quaternion::rotation_z(
look.x * 0.3 / ((canceler).max(0.5)) + tilt * -1.2,
) * Quaternion::rotation_y(tilt * 0.8);
next.head_upper.scale = Vec3::one();
next.head_lower.position =
@ -132,14 +129,15 @@ impl Animation for RunAnimation {
skeleton_attr.torso_front.0,
skeleton_attr.torso_front.1
+ canceler * 1.0
+ canceler * shortalt * 2.5
+ canceler * shortalt * 2.5 * skeleton_attr.spring
+ x_tilt * 10.0 * canceler,
) * skeleton_attr.scaler
/ 11.0;
next.torso_front.orientation =
Quaternion::rotation_x((amplitude * (short * -0.13).max(-0.2)) + x_tilt * (canceler * 6.0).min(1.0))
* Quaternion::rotation_y(tilt * 0.8)
* Quaternion::rotation_z(tilt * -1.5);
next.torso_front.orientation = Quaternion::rotation_x(
(amplitude * (short * -0.13).max(-0.2)) * skeleton_attr.spring
+ x_tilt * (canceler * 6.0).min(1.0),
) * Quaternion::rotation_y(tilt * 0.8)
* Quaternion::rotation_z(tilt * -1.5);
next.torso_front.scale = Vec3::one() * skeleton_attr.scaler / 11.0;
next.torso_back.position = Vec3::new(
@ -169,8 +167,8 @@ impl Animation for RunAnimation {
next.leg_fr.position = Vec3::new(
skeleton_attr.leg_f.0,
skeleton_attr.leg_f.1 + amplitude3 * foot2b * -2.2,////////////fix
skeleton_attr.leg_f.2 + amplitude3 * foot2a * 2.8,
skeleton_attr.leg_f.1 + amplitude3 * foot2b * -1.6,
skeleton_attr.leg_f.2 + amplitude3 * foot2a * 2.3,
);
next.leg_fr.orientation =
Quaternion::rotation_x(0.2 * canceler + amplitude3 * foot2a * 0.85)
@ -181,21 +179,23 @@ impl Animation for RunAnimation {
next.leg_bl.position = Vec3::new(
-skeleton_attr.leg_b.0,
skeleton_attr.leg_b.1 + amplitude3 * foot3b * -1.1,
skeleton_attr.leg_b.2 + canceler + amplitude3 * foot3a * 1.6,
skeleton_attr.leg_b.2 + amplitude3 * foot3a * 1.1,
);
next.leg_bl.orientation = Quaternion::rotation_x(amplitude3 * foot1b * 0.85)
* Quaternion::rotation_y(tilt * 1.5)
* Quaternion::rotation_z(tilt * -1.5);
next.leg_bl.orientation =
Quaternion::rotation_x(canceler * -0.2 + amplitude3 * foot3b * -0.55)
* Quaternion::rotation_y(tilt * 1.5)
* Quaternion::rotation_z(tilt * -1.5);
next.leg_bl.scale = Vec3::one() * 1.02;
next.leg_br.position = Vec3::new(
skeleton_attr.leg_b.0,
skeleton_attr.leg_b.1 + amplitude3 * foot4b * -1.1,
skeleton_attr.leg_b.2 + canceler + amplitude3 * foot4a * 1.6,
skeleton_attr.leg_b.2 + amplitude3 * foot4a * 1.1,
);
next.leg_br.orientation = Quaternion::rotation_x(amplitude3 * foot2b * 0.85)
* Quaternion::rotation_y(tilt * 1.5)
* Quaternion::rotation_z(tilt * -1.5);
next.leg_br.orientation =
Quaternion::rotation_x(canceler * -0.2 + amplitude3 * foot4b * -0.55)
* Quaternion::rotation_y(tilt * 1.5)
* Quaternion::rotation_z(tilt * -1.5);
next.leg_br.scale = Vec3::one() * 1.02;
next.foot_fl.position = Vec3::new(
@ -204,7 +204,7 @@ impl Animation for RunAnimation {
skeleton_attr.feet_f.2 + (foot1a * 2.0).max(-1.0) * amplitude2 + 1.0 * canceler,
);
next.foot_fl.orientation = Quaternion::rotation_x(
((1.0 - skeleton_attr.dampen) * -1.0) * canceler + amplitude2 * foot1b * -0.7,
skeleton_attr.startangle * canceler + amplitude2 * foot1b * -0.7,
) * Quaternion::rotation_y(tilt * -1.0);
next.foot_fl.scale = Vec3::one() * 0.96;
@ -214,27 +214,27 @@ impl Animation for RunAnimation {
skeleton_attr.feet_f.2 + (foot2a * 2.0).max(-1.0) * amplitude2 + 1.0 * canceler,
);
next.foot_fr.orientation = Quaternion::rotation_x(
((1.0 - skeleton_attr.dampen) * -1.0) * canceler + amplitude2 * foot2b * -0.7,
skeleton_attr.startangle * canceler + amplitude2 * foot2b * -0.7,
) * Quaternion::rotation_y(tilt * -1.0);
next.foot_fr.scale = Vec3::one() * 0.96;
next.foot_bl.position = Vec3::new(
-skeleton_attr.feet_b.0,
skeleton_attr.feet_b.1,
skeleton_attr.feet_b.2 + (foot3a * 0.5).max(0.0) * amplitude2 + 2.0 * canceler,
skeleton_attr.feet_b.2 + (foot3a * 0.8).max(0.0) * amplitude2 + 1.0 * canceler,
);
next.foot_bl.orientation =
Quaternion::rotation_x(amplitude2 * foot3b * -0.5 - 0.5 * canceler)
Quaternion::rotation_x(amplitude2 * foot3b * -0.7 - 0.2 * canceler)
* Quaternion::rotation_y(tilt * -1.0);
next.foot_bl.scale = Vec3::one() * 0.96;
next.foot_br.position = Vec3::new(
skeleton_attr.feet_b.0,
skeleton_attr.feet_b.1,
skeleton_attr.feet_b.2 + (foot4a * 0.5).max(0.0) * amplitude2 + 2.0 * canceler,
skeleton_attr.feet_b.2 + (foot4a * 0.8).max(0.0) * amplitude2 + 1.0 * canceler,
);
next.foot_br.orientation =
Quaternion::rotation_x(amplitude2 * foot4b * -0.5 - 0.5 * canceler)
Quaternion::rotation_x(amplitude2 * foot4b * -0.7 - 0.2 * canceler)
* Quaternion::rotation_y(tilt * -1.0);
next.foot_br.scale = Vec3::one() * 0.96;
next

View File

@ -22,29 +22,35 @@ impl Animation for IdleAnimation {
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let breathe = (anim_time as f32 * 0.8).sin();
next.head.position = Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1+breathe * 0.3);
next.head.orientation = Quaternion::rotation_x(breathe * 0.1-0.1);
next.head.scale = Vec3::one()*1.02;
next.head.position = Vec3::new(
0.0,
skeleton_attr.head.0,
skeleton_attr.head.1 + breathe * 0.3,
);
next.head.orientation = Quaternion::rotation_x(breathe * 0.1 - 0.1);
next.head.scale = Vec3::one() * 1.02;
next.jaw.position = Vec3::new(0.0, skeleton_attr.jaw.0, skeleton_attr.jaw.1);
next.jaw.orientation = Quaternion::rotation_x(breathe * 0.05);
next.jaw.scale = Vec3::one()*0.98;
next.jaw.scale = Vec3::one() * 0.98;
next.neck.position = Vec3::new(0.0, skeleton_attr.neck.0, skeleton_attr.neck.1+breathe * 0.2);
next.neck.position = Vec3::new(
0.0,
skeleton_attr.neck.0,
skeleton_attr.neck.1 + breathe * 0.2,
);
next.neck.orientation = Quaternion::rotation_x(-0.1);
next.neck.scale = Vec3::one()*0.98;
next.neck.scale = Vec3::one() * 0.98;
next.chest_front.position = Vec3::new(
0.0,
skeleton_attr.chest_front.0,
skeleton_attr.chest_front.1+breathe * 0.3,
)/3.0;
skeleton_attr.chest_front.1 + breathe * 0.3,
) / 3.0;
next.chest_front.orientation = Quaternion::rotation_x(breathe * 0.04);
next.chest_front.scale = Vec3::one()/3.0;
next.chest_front.scale = Vec3::one() / 3.0;
next.chest_back.position =
Vec3::new(0.0, skeleton_attr.chest_back.0, skeleton_attr.chest_back.1);
@ -80,7 +86,7 @@ impl Animation for IdleAnimation {
next.leg_l.position = Vec3::new(
-skeleton_attr.leg.0,
skeleton_attr.leg.1,
skeleton_attr.leg.2+breathe * 0.05,
skeleton_attr.leg.2 + breathe * 0.05,
);
next.leg_l.orientation = Quaternion::rotation_z(0.0);
next.leg_l.scale = Vec3::one();
@ -88,7 +94,7 @@ impl Animation for IdleAnimation {
next.leg_r.position = Vec3::new(
skeleton_attr.leg.0,
skeleton_attr.leg.1,
skeleton_attr.leg.2+breathe * 0.05,
skeleton_attr.leg.2 + breathe * 0.05,
);
next.leg_r.orientation = Quaternion::rotation_z(0.0);
next.leg_r.scale = Vec3::one();
@ -96,18 +102,18 @@ impl Animation for IdleAnimation {
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1,
skeleton_attr.foot.2+breathe * -0.35,
skeleton_attr.foot.2 + breathe * -0.35,
);
next.foot_l.orientation = Quaternion::rotation_z(0.0);
next.foot_l.scale = Vec3::one()*1.02;
next.foot_l.scale = Vec3::one() * 1.02;
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1,
skeleton_attr.foot.2+breathe * -0.45,
skeleton_attr.foot.2 + breathe * -0.45,
);
next.foot_r.orientation = Quaternion::rotation_z(0.0);
next.foot_r.scale = Vec3::one()*1.02;
next.foot_r.scale = Vec3::one() * 1.02;
next
}

View File

@ -23,26 +23,33 @@ impl Animation for JumpAnimation {
let breathe = (anim_time as f32 * 0.8).sin();
next.head.position = Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1+breathe * 0.3);
next.head.orientation = Quaternion::rotation_x(breathe * 0.1-0.1);
next.head.scale = Vec3::one()*1.02;
next.head.position = Vec3::new(
0.0,
skeleton_attr.head.0,
skeleton_attr.head.1 + breathe * 0.3,
);
next.head.orientation = Quaternion::rotation_x(breathe * 0.1 - 0.1);
next.head.scale = Vec3::one() * 1.02;
next.jaw.position = Vec3::new(0.0, skeleton_attr.jaw.0, skeleton_attr.jaw.1);
next.jaw.orientation = Quaternion::rotation_x(breathe * 0.05);
next.jaw.scale = Vec3::one()*0.98;
next.jaw.scale = Vec3::one() * 0.98;
next.neck.position = Vec3::new(0.0, skeleton_attr.neck.0, skeleton_attr.neck.1+breathe * 0.2);
next.neck.position = Vec3::new(
0.0,
skeleton_attr.neck.0,
skeleton_attr.neck.1 + breathe * 0.2,
);
next.neck.orientation = Quaternion::rotation_x(-0.1);
next.neck.scale = Vec3::one()*0.98;
next.neck.scale = Vec3::one() * 0.98;
next.chest_front.position = Vec3::new(
0.0,
skeleton_attr.chest_front.0,
skeleton_attr.chest_front.1+breathe * 0.3,
)/3.0;
skeleton_attr.chest_front.1 + breathe * 0.3,
) / 3.0;
next.chest_front.orientation = Quaternion::rotation_x(breathe * 0.04);
next.chest_front.scale = Vec3::one()/3.0;
next.chest_front.scale = Vec3::one() / 3.0;
next.chest_back.position =
Vec3::new(0.0, skeleton_attr.chest_back.0, skeleton_attr.chest_back.1);
@ -78,7 +85,7 @@ impl Animation for JumpAnimation {
next.leg_l.position = Vec3::new(
-skeleton_attr.leg.0,
skeleton_attr.leg.1,
skeleton_attr.leg.2+breathe * 0.05,
skeleton_attr.leg.2 + breathe * 0.05,
);
next.leg_l.orientation = Quaternion::rotation_z(0.0);
next.leg_l.scale = Vec3::one();
@ -86,7 +93,7 @@ impl Animation for JumpAnimation {
next.leg_r.position = Vec3::new(
skeleton_attr.leg.0,
skeleton_attr.leg.1,
skeleton_attr.leg.2+breathe * 0.05,
skeleton_attr.leg.2 + breathe * 0.05,
);
next.leg_r.orientation = Quaternion::rotation_z(0.0);
next.leg_r.scale = Vec3::one();
@ -94,18 +101,18 @@ impl Animation for JumpAnimation {
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1,
skeleton_attr.foot.2+breathe * -0.35,
skeleton_attr.foot.2 + breathe * -0.35,
);
next.foot_l.orientation = Quaternion::rotation_z(0.0);
next.foot_l.scale = Vec3::one()*1.02;
next.foot_l.scale = Vec3::one() * 1.02;
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1,
skeleton_attr.foot.2+breathe * -0.45,
skeleton_attr.foot.2 + breathe * -0.45,
);
next.foot_r.orientation = Quaternion::rotation_z(0.0);
next.foot_r.scale = Vec3::one()*1.02;
next.foot_r.scale = Vec3::one() * 1.02;
next
}

View File

@ -28,7 +28,7 @@ impl Animation for RunAnimation {
//let wave_slow = (anim_time as f32 * 6.5 + PI).sin();
let breathe = (anim_time as f32 * 0.8).sin();
let topspeed = 18.0;
let topspeed = 18.0;
let canceler = speed / topspeed;
let lab = 0.5; //6
@ -56,51 +56,57 @@ impl Animation for RunAnimation {
(anim_time as f32 * (16.0) * lab as f32 * speedmult + PI * 3.0 / 8.0 - 0.5).sin();
//FL
let foot1a =
(anim_time as f32 * (16.0) * lab as f32 * speedmult + 0.0+PI )
.sin(); //1.5
let foot1b =
(anim_time as f32 * (16.0) * lab as f32 * speedmult + 1.57+PI )
.sin(); //1.9
let foot1a = (anim_time as f32 * (16.0) * lab as f32 * speedmult + 0.0 + PI).sin(); //1.5
let foot1b = (anim_time as f32 * (16.0) * lab as f32 * speedmult + 1.57 + PI).sin(); //1.9
//FR
let foot2a = (anim_time as f32 * (16.0) * lab as f32 * speedmult ).sin(); //1.2
let foot2b = (anim_time as f32 * (16.0) * lab as f32 * speedmult + 1.57 ).sin(); //1.6
let foot2a = (anim_time as f32 * (16.0) * lab as f32 * speedmult).sin(); //1.2
let foot2b = (anim_time as f32 * (16.0) * lab as f32 * speedmult + 1.57).sin(); //1.6
//BL
//BR
next.head.position = Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1+breathe * 0.3);
next.head.orientation = Quaternion::rotation_x(-0.1+short*-0.05)*Quaternion::rotation_z(shortalt*-0.2);
next.head.scale = Vec3::one()*1.02;
next.head.position = Vec3::new(
0.0,
skeleton_attr.head.0,
skeleton_attr.head.1 + breathe * 0.3,
);
next.head.orientation =
Quaternion::rotation_x(-0.1 + short * -0.05) * Quaternion::rotation_z(shortalt * -0.2);
next.head.scale = Vec3::one() * 1.02;
next.jaw.position = Vec3::new(0.0, skeleton_attr.jaw.0, skeleton_attr.jaw.1);
next.jaw.orientation = Quaternion::rotation_x(short*-0.03);
next.jaw.scale = Vec3::one()*0.98;
next.jaw.orientation = Quaternion::rotation_x(short * -0.03);
next.jaw.scale = Vec3::one() * 0.98;
next.neck.position = Vec3::new(0.0, skeleton_attr.neck.0, skeleton_attr.neck.1);
next.neck.orientation = Quaternion::rotation_x(-0.1+short*-0.04)*Quaternion::rotation_z(shortalt*-0.1);
next.neck.scale = Vec3::one()*0.98;
next.neck.orientation =
Quaternion::rotation_x(-0.1 + short * -0.04) * Quaternion::rotation_z(shortalt * -0.1);
next.neck.scale = Vec3::one() * 0.98;
next.chest_front.position = Vec3::new(
0.0,
skeleton_attr.chest_front.0,
skeleton_attr.chest_front.1+short * 0.5,
)/3.0;
next.chest_front.orientation = Quaternion::rotation_x(short * 0.07)*Quaternion::rotation_z(shortalt * 0.15);
next.chest_front.scale = Vec3::one()/3.0;
skeleton_attr.chest_front.1 + short * 0.5,
) / 3.0;
next.chest_front.orientation =
Quaternion::rotation_x(short * 0.07) * Quaternion::rotation_z(shortalt * 0.15);
next.chest_front.scale = Vec3::one() / 3.0;
next.chest_back.position =
Vec3::new(0.0, skeleton_attr.chest_back.0, skeleton_attr.chest_back.1);
next.chest_back.orientation = Quaternion::rotation_x(short * -0.04)*Quaternion::rotation_z(shortalt * -0.15);;
next.chest_back.orientation =
Quaternion::rotation_x(short * -0.04) * Quaternion::rotation_z(shortalt * -0.15);
next.chest_back.scale = Vec3::one();
next.tail_front.position =
Vec3::new(0.0, skeleton_attr.tail_front.0, skeleton_attr.tail_front.1);
next.tail_front.orientation = Quaternion::rotation_x(0.1+short * -0.02)*Quaternion::rotation_z(shortalt*-0.1);
next.tail_front.orientation =
Quaternion::rotation_x(0.1 + short * -0.02) * Quaternion::rotation_z(shortalt * -0.1);
next.tail_front.scale = Vec3::one();
next.tail_back.position =
Vec3::new(0.0, skeleton_attr.tail_back.0, skeleton_attr.tail_back.1);
next.tail_back.orientation = Quaternion::rotation_x(0.2+short * -0.2)*Quaternion::rotation_z(shortalt*-0.2);
next.tail_back.orientation =
Quaternion::rotation_x(0.2 + short * -0.2) * Quaternion::rotation_z(shortalt * -0.2);
next.tail_back.scale = Vec3::one();
next.hand_l.position = Vec3::new(
@ -108,7 +114,7 @@ impl Animation for RunAnimation {
skeleton_attr.hand.1,
skeleton_attr.hand.2,
);
next.hand_l.orientation = Quaternion::rotation_x( -0.2+amplitude3 * foot2a * 0.3);
next.hand_l.orientation = Quaternion::rotation_x(-0.2 + amplitude3 * foot2a * 0.3);
next.hand_l.scale = Vec3::one();
next.hand_r.position = Vec3::new(
@ -116,7 +122,7 @@ impl Animation for RunAnimation {
skeleton_attr.hand.1,
skeleton_attr.hand.2,
);
next.hand_r.orientation = Quaternion::rotation_x( -0.2+amplitude3 * foot1a * 0.3);
next.hand_r.orientation = Quaternion::rotation_x(-0.2 + amplitude3 * foot1a * 0.3);
next.hand_r.scale = Vec3::one();
next.leg_l.position = Vec3::new(
@ -124,10 +130,9 @@ impl Animation for RunAnimation {
skeleton_attr.leg.1 + amplitude3 * foot1b * -1.3,
skeleton_attr.leg.2 + amplitude3 * foot1a * 1.4,
);
next.leg_l.orientation =
Quaternion::rotation_x( -0.2+amplitude3 * foot1a * 0.2)
* Quaternion::rotation_z(foot1a*-0.3)
* Quaternion::rotation_y(0.0);
next.leg_l.orientation = Quaternion::rotation_x(-0.2 + amplitude3 * foot1a * 0.2)
* Quaternion::rotation_z(foot1a * -0.3)
* Quaternion::rotation_y(0.0);
next.leg_l.scale = Vec3::one() * 1.0;
next.leg_r.position = Vec3::new(
@ -135,30 +140,27 @@ impl Animation for RunAnimation {
skeleton_attr.leg.1 + amplitude3 * foot2b * -1.3,
skeleton_attr.leg.2 + amplitude3 * foot2a * 1.4,
);
next.leg_r.orientation =
Quaternion::rotation_x( -0.2+amplitude3 * foot2a * 0.2)
* Quaternion::rotation_z(foot2a*0.3)
* Quaternion::rotation_y(0.0);
next.leg_r.orientation = Quaternion::rotation_x(-0.2 + amplitude3 * foot2a * 0.2)
* Quaternion::rotation_z(foot2a * 0.3)
* Quaternion::rotation_y(0.0);
next.leg_r.scale = Vec3::one() * 1.0;
next.foot_l.position = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1+canceler*-2.0+ amplitude3 * foot1b * -2.0,
skeleton_attr.foot.2 +canceler*2.0+ (foot1a * 2.0).max(0.0) * amplitude2 ,
skeleton_attr.foot.1 + canceler * -2.0 + amplitude3 * foot1b * -2.0,
skeleton_attr.foot.2 + canceler * 2.0 + (foot1a * 2.0).max(0.0) * amplitude2,
);
next.foot_l.orientation = Quaternion::rotation_x(-0.3+
amplitude2 * foot1b * -0.35,
) * Quaternion::rotation_y(0.0);
next.foot_l.orientation = Quaternion::rotation_x(-0.3 + amplitude2 * foot1b * -0.35)
* Quaternion::rotation_y(0.0);
next.foot_l.scale = Vec3::one() * 0.96;
next.foot_r.position = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1+canceler*-2.0+ amplitude3 * foot2b * -2.0,
skeleton_attr.foot.2 +canceler*2.0+ (foot2a * 2.0).max(0.0) * amplitude2 ,
skeleton_attr.foot.1 + canceler * -2.0 + amplitude3 * foot2b * -2.0,
skeleton_attr.foot.2 + canceler * 2.0 + (foot2a * 2.0).max(0.0) * amplitude2,
);
next.foot_r.orientation = Quaternion::rotation_x(-0.3+
amplitude2 * foot2b * -0.35,
) * Quaternion::rotation_y(0.0);
next.foot_r.orientation = Quaternion::rotation_x(-0.3 + amplitude2 * foot2b * -0.35)
* Quaternion::rotation_y(0.0);
next.foot_r.scale = Vec3::one() * 0.96;
next

View File

@ -1123,15 +1123,13 @@ impl FigureMgr {
)
},
// Running
(false, _, true) => {
anim::quadruped_small::RunAnimation::update_skeleton(
&QuadrupedSmallSkeleton::default(),
(vel.0.magnitude(), ori, state.last_ori, time, state.avg_vel),
state.state_time,
&mut state_animation_rate,
skeleton_attr,
)
},
(false, _, true) => anim::quadruped_small::RunAnimation::update_skeleton(
&QuadrupedSmallSkeleton::default(),
(vel.0.magnitude(), ori, state.last_ori, time, state.avg_vel),
state.state_time,
&mut state_animation_rate,
skeleton_attr,
),
// In air
(false, _, false) => anim::quadruped_small::JumpAnimation::update_skeleton(
&QuadrupedSmallSkeleton::default(),
@ -1225,13 +1223,15 @@ impl FigureMgr {
)
},
// Running
(true, true, false) => anim::quadruped_medium::RunAnimation::update_skeleton(
&QuadrupedMediumSkeleton::default(),
(vel.0.magnitude(), ori, state.last_ori, time, state.avg_vel),
state.state_time,
&mut state_animation_rate,
skeleton_attr,
),
(true, true, false) => {
anim::quadruped_medium::RunAnimation::update_skeleton(
&QuadrupedMediumSkeleton::default(),
(vel.0.magnitude(), ori, state.last_ori, time, state.avg_vel),
state.state_time,
&mut state_animation_rate,
skeleton_attr,
)
},
//Swimming
(false, _, true) => anim::quadruped_medium::RunAnimation::update_skeleton(
&QuadrupedMediumSkeleton::default(),