starting run anim

This commit is contained in:
jshipsey 2020-06-05 23:23:09 -04:00
parent cdb91e95c1
commit 3d936e6872
10 changed files with 99 additions and 39 deletions

@ -17,7 +17,7 @@
central: ("npc.crocodile.male.chest"),
),
tail_rear: (
offset: (-1.0, -4.5, -1.5),
offset: (-1.0, -9.0, -1.5),
central: ("npc.crocodile.male.tail_rear"),
),
tail_front: (
@ -43,7 +43,7 @@
central: ("npc.crocodile.female.chest"),
),
tail_rear: (
offset: (-1.0, -4.5, -1.5),
offset: (-1.0, -9.0, -1.5),
central: ("npc.crocodile.female.tail_rear"),
),
tail_front: (
@ -53,7 +53,7 @@
),
(Alligator, Male): (
upper: (
offset: (-4.0, -8.5, -2.5),
offset: (-4.0, -0.0, -2.5),
central: ("npc.alligator.male.head_upper"),
),
lower: (
@ -79,7 +79,7 @@
),
(Alligator, Female): (
upper: (
offset: (-4.0, -8.5, -2.5),
offset: (-4.0, -0.0, -2.5),
central: ("npc.alligator.female.head_upper"),
),
lower: (

@ -19,19 +19,19 @@ impl Animation for IdleAnimation {
let ultra_slow = 0.0*(anim_time as f32 * 1.0).sin();
let slow = 0.0*(anim_time as f32 * 2.5).sin();
let slowalt = 0.0*(anim_time as f32 * 2.5 + PI / 2.0).sin();
let slowalt = (anim_time as f32 * 2.5 + PI / 2.0).sin();
let dragon_look = Vec2::new(
((global_time + anim_time) as f32 / 8.0)
.floor()
.mul(7331.0)
.sin()
* 0.5,
* 0.2,
((global_time + anim_time) as f32 / 8.0)
.floor()
.mul(1337.0)
.sin()
* 0.25,
* 0.1,
);
next.head_upper.offset = Vec3::new(
@ -66,12 +66,12 @@ impl Animation for IdleAnimation {
next.tail_front.offset =
Vec3::new(0.0, skeleton_attr.tail_front.0, skeleton_attr.tail_front.1);
next.tail_front.ori = Quaternion::rotation_z(0.0);
next.tail_front.ori = Quaternion::rotation_x(0.15)*Quaternion::rotation_z(slowalt * 0.12);
next.tail_front.scale = Vec3::one()*0.98;
next.tail_rear.offset =
Vec3::new(0.0, skeleton_attr.tail_rear.0, skeleton_attr.tail_rear.1);
next.tail_rear.ori = Quaternion::rotation_z(slowalt * 0.12);
next.tail_rear.ori = Quaternion::rotation_z(slowalt * 0.12)*Quaternion::rotation_x(-0.12);
next.tail_rear.scale = Vec3::one()*0.98;
next.foot_fl.offset = Vec3::new(

@ -128,19 +128,19 @@ impl<'a> From<&'a comp::quadruped_low::Body> for SkeletonAttr {
Self {
head_upper: match (body.species, body.body_type) {
(Crocodile, _) => (8.0, 4.0),
(Alligator, _) => (7.0, 4.0),
(Alligator, _) => (-0.5, 3.0),
(Salamander, _) => (3.0, 3.0),
(Monitor, _) => (4.0, 2.0),
},
head_lower: match (body.species, body.body_type) {
(Crocodile, _) => (8.0, 0.0),
(Alligator, _) => (7.0, 0.0),
(Alligator, _) => (9.0, 0.0),
(Salamander, _) => (10.0, 2.0),
(Monitor, _) => (10.0, 3.0),
},
jaw: match (body.species, body.body_type) {
(Crocodile, _) => (0.0, -3.0),
(Alligator, _) => (0.0, -2.0),
(Alligator, _) => (8.5, -2.0),
(Salamander, _) => (2.0, -3.0),
(Monitor, _) => (0.0, -1.0),
},
@ -151,16 +151,16 @@ impl<'a> From<&'a comp::quadruped_low::Body> for SkeletonAttr {
(Monitor, _) => (0.0, 5.0),
},
tail_rear: match (body.species, body.body_type) {
(Crocodile, _) => (-14.0, -1.0),
(Crocodile, _) => (-12.5, -1.0),
(Alligator, _) => (-13.0, -1.0),
(Salamander, _) => (-7.0, 0.0),
(Monitor, _) => (-5.0, 0.0),
(Monitor, _) => (-10.0, 0.0),
},
tail_front: match (body.species, body.body_type) {
(Crocodile, _) => (-6.0, 0.0),
(Alligator, _) => (-5.0, 0.0),
(Salamander, _) => (-5.0, 0.0),
(Monitor, _) => (-5.0, 0.0),
(Salamander, _) => (-6.5, 0.0),
(Monitor, _) => (-6.5, 0.0),
},
feet_f: match (body.species, body.body_type) {
(Crocodile, _) => (6.0, 6.0, 0.0),

@ -17,7 +17,7 @@ impl Animation for RunAnimation {
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let lab = 14;
let lab = 0.1;
let wave_ultra_slow_cos = (anim_time as f32 * 3.0 + PI).cos();
let wave_slow = (anim_time as f32 * 4.5).sin();
@ -38,6 +38,66 @@ impl Animation for RunAnimation {
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();
let short = (((5.0)
/ (2.5
+ 2.5 * ((anim_time as f32 *16.0* lab as f32+ PI * 0.25).sin()).powf(2.0 as f32)))
.sqrt())
* ((anim_time as f32 *16.0* lab as f32+ PI * 0.25).sin());
let foothoril = (anim_time as f32 * 16.0 * lab as f32 + PI * 1.45).sin();
let foothorir = (anim_time as f32 * 16.0 * lab as f32 + PI * (0.45)).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 footrotl = (((5.0)
/ (2.5
+ (2.5)
* ((anim_time as f32 * 16.0 * lab as f32 + PI * 1.4).sin())
.powf(2.0 as f32)))
.sqrt())
* ((anim_time as f32 * 16.0 * lab as f32 + PI * 1.4).sin());
let footrotr = (((5.0)
/ (1.0
+ (4.0)
* ((anim_time as f32 * 16.0 * lab as f32 + PI * 0.4).sin())
.powf(2.0 as f32)))
.sqrt())
* ((anim_time as f32 * 16.0 * lab as f32 + PI * 0.4).sin());
///
let foothorilb = (anim_time as f32 * 16.0 * lab as f32 + PI * 1.25).sin();
let foothorirb = (anim_time as f32 * 16.0 * lab as f32 + PI * (0.25)).sin();
let footvertlb = (anim_time as f32 * 16.0 * lab as f32).sin();
let footvertrb = (anim_time as f32 * 16.0 * lab as f32 + PI*1.0).sin();
let footrotlb = (((5.0)
/ (2.5
+ (2.5)
* ((anim_time as f32 * 16.0 * lab as f32 + PI * 1.6).sin())
.powf(2.0 as f32)))
.sqrt())
* ((anim_time as f32 * 16.0 * lab as f32 + PI * 1.6).sin());
let footrotrb = (((5.0)
/ (1.0
+ (4.0)
* ((anim_time as f32 * 16.0 * lab as f32 + PI * 0.4).sin())
.powf(2.0 as f32)))
.sqrt())
* ((anim_time as f32 * 16.0 * lab as f32 + PI * 0.4).sin());
let dragon_look = Vec2::new(
((global_time + anim_time) as f32 / 4.0)
.floor()
@ -54,28 +114,28 @@ impl Animation for RunAnimation {
next.head_upper.offset =
Vec3::new(0.0, skeleton_attr.head_upper.0, skeleton_attr.head_upper.1);
next.head_upper.ori =
Quaternion::rotation_x(dragon_look.y) * Quaternion::rotation_z(dragon_look.x);
Quaternion::rotation_x(0.0) * Quaternion::rotation_z(short*-0.15);
next.head_upper.scale = Vec3::one();
next.head_lower.offset =
Vec3::new(0.0, skeleton_attr.head_lower.0, skeleton_attr.head_lower.1);
next.head_lower.ori = Quaternion::rotation_x(wave_slow * 0.05);
next.head_lower.ori = Quaternion::rotation_x(0.0)* Quaternion::rotation_z(short*-0.25);
next.head_lower.scale = Vec3::one();
next.jaw.offset = Vec3::new(
0.0,
skeleton_attr.jaw.0 - wave_ultra_slow_cos * 0.12,
skeleton_attr.jaw.1 + wave_slow * 0.2,
skeleton_attr.jaw.0,
skeleton_attr.jaw.1,
);
next.jaw.ori = Quaternion::rotation_x(wave_slow * 0.03);
next.jaw.scale = Vec3::one();
next.jaw.ori = Quaternion::rotation_x(0.0);
next.jaw.scale = Vec3::one()*0.98;
next.tail_front.offset = Vec3::new(
0.0,
skeleton_attr.tail_front.0,
skeleton_attr.tail_front.1 + centeroffset * 0.6,
skeleton_attr.tail_front.1,
);
next.tail_front.ori = Quaternion::rotation_x(center * 0.03);
next.tail_front.ori = Quaternion::rotation_z(short*0.2)*Quaternion::rotation_y(short*0.15);
next.tail_front.scale = Vec3::one();
next.tail_rear.offset = Vec3::new(
@ -83,44 +143,44 @@ impl Animation for RunAnimation {
skeleton_attr.tail_rear.0,
skeleton_attr.tail_rear.1 + centeroffset * 0.6,
);
next.tail_rear.ori = Quaternion::rotation_x(center * 0.03);
next.tail_rear.ori = Quaternion::rotation_z(short*0.3)*Quaternion::rotation_y(short*0.1);
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.ori = Quaternion::rotation_y(horichest * -0.09);
next.chest.ori = Quaternion::rotation_z(short*0.25)*Quaternion::rotation_y(short*0.15);
next.chest.scale = Vec3::one()/6.0;
next.foot_fl.offset = Vec3::new(
-skeleton_attr.feet_f.0,
skeleton_attr.feet_f.1 + horilf * 2.5,
skeleton_attr.feet_f.2 + vertlf * 5.0 * skeleton_attr.height - 0.5,
skeleton_attr.feet_f.1 + foothoril * -3.5,
skeleton_attr.feet_f.2 + ((footvertl * -0.6).max(-1.0)),
);
next.foot_fl.ori = Quaternion::rotation_x(horilf * 0.4);
next.foot_fl.ori = Quaternion::rotation_x(-0.2 + footrotl * -0.5);
next.foot_fl.scale = Vec3::one();
next.foot_fr.offset = Vec3::new(
skeleton_attr.feet_f.0,
skeleton_attr.feet_f.1 + horirfoffset * 2.5,
skeleton_attr.feet_f.2 + vertrfoffset * 5.0 * skeleton_attr.height - 0.5,
skeleton_attr.feet_f.1 + foothorir * -3.5,
skeleton_attr.feet_f.2 + ((footvertr * -0.6).max(-1.0)),
);
next.foot_fr.ori = Quaternion::rotation_x(horirfoffset * 0.4);
next.foot_fr.ori = Quaternion::rotation_x(-0.2 + footrotr * -0.5);
next.foot_fr.scale = Vec3::one();
next.foot_bl.offset = Vec3::new(
-skeleton_attr.feet_b.0,
skeleton_attr.feet_b.1 + horilboffset * 3.0,
skeleton_attr.feet_b.2 + vertlboffset * 5.0 * skeleton_attr.height - 0.5,
skeleton_attr.feet_b.1 + foothorilb * -3.5,
skeleton_attr.feet_b.2 + ((footvertlb * -0.6).max(-1.0)),
);
next.foot_bl.ori = Quaternion::rotation_x(horilboffset * 0.35);
next.foot_bl.ori = Quaternion::rotation_x(-0.2 + footrotlb * -0.5);
next.foot_bl.scale = Vec3::one();
next.foot_br.offset = Vec3::new(
skeleton_attr.feet_b.0,
skeleton_attr.feet_b.1 + horirb * 3.0,
skeleton_attr.feet_b.2 + vertrb * 5.0 * skeleton_attr.height - 0.5,
skeleton_attr.feet_b.1 + foothorirb * -3.5,
skeleton_attr.feet_b.2 + ((footvertrb * -0.6).max(-1.0)),
);
next.foot_br.ori = Quaternion::rotation_x(horirb * 0.35);
next.foot_br.ori = Quaternion::rotation_x(-0.2 + footrotrb * -0.5);
next.foot_br.scale = Vec3::one();
next