mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Improved running animation of several skeletons
This commit is contained in:
parent
5b4876b90f
commit
7f922d8a27
@ -29,7 +29,7 @@ impl Animation for RunAnimation {
|
|||||||
let speednorm = (speed / 13.0).powf(0.25);
|
let speednorm = (speed / 13.0).powf(0.25);
|
||||||
|
|
||||||
let speedmult = 0.8;
|
let speedmult = 0.8;
|
||||||
let lab: f32 = 0.6; //6
|
let lab: f32 = 0.9; //6
|
||||||
|
|
||||||
// acc_vel and anim_time mix to make sure phase lenght isn't starting at
|
// acc_vel and anim_time mix to make sure phase lenght isn't starting at
|
||||||
// +infinite
|
// +infinite
|
||||||
@ -92,18 +92,18 @@ impl Animation for RunAnimation {
|
|||||||
next.foot_l.position = Vec3::new(
|
next.foot_l.position = Vec3::new(
|
||||||
-s_a.foot.0,
|
-s_a.foot.0,
|
||||||
s_a.foot.1 + foot1b * -1.0,
|
s_a.foot.1 + foot1b * -1.0,
|
||||||
s_a.foot.2 + (foot1a * 1.5).max(0.0),
|
s_a.foot.2 + (foot1a * 4.0).max(0.0),
|
||||||
);
|
);
|
||||||
next.foot_l.orientation = Quaternion::rotation_x(0.2 * speednorm + foot1b * -0.8 + 0.1)
|
next.foot_l.orientation = Quaternion::rotation_x(0.2 * speednorm + foot1b * -0.3 + 0.1)
|
||||||
* Quaternion::rotation_y(tilt * -1.0)
|
* Quaternion::rotation_y(tilt * -1.0)
|
||||||
* Quaternion::rotation_z(tilt * -0.5);
|
* Quaternion::rotation_z(tilt * -0.5);
|
||||||
|
|
||||||
next.foot_r.position = Vec3::new(
|
next.foot_r.position = Vec3::new(
|
||||||
s_a.foot.0,
|
s_a.foot.0,
|
||||||
s_a.foot.1 + foot2b * -1.0,
|
s_a.foot.1 + foot2b * -1.0,
|
||||||
s_a.foot.2 + (foot2a * 1.5).max(0.0),
|
s_a.foot.2 + (foot2a * 4.0).max(0.0),
|
||||||
);
|
);
|
||||||
next.foot_r.orientation = Quaternion::rotation_x(0.2 * speednorm + foot2b * -0.8 + 0.1)
|
next.foot_r.orientation = Quaternion::rotation_x(0.2 * speednorm + foot2b * -0.3 + 0.1)
|
||||||
* Quaternion::rotation_y(tilt * -1.0)
|
* Quaternion::rotation_y(tilt * -1.0)
|
||||||
* Quaternion::rotation_z(tilt * -0.5);
|
* Quaternion::rotation_z(tilt * -0.5);
|
||||||
|
|
||||||
@ -114,12 +114,15 @@ impl Animation for RunAnimation {
|
|||||||
s_a.chest.1 + short * 0.5 + x_tilt * 10.0 + speednorm * -2.0,
|
s_a.chest.1 + short * 0.5 + x_tilt * 10.0 + speednorm * -2.0,
|
||||||
) * s_a.scaler;
|
) * s_a.scaler;
|
||||||
next.chest.orientation = Quaternion::rotation_x(-0.1 + short * 0.07 + x_tilt)
|
next.chest.orientation = Quaternion::rotation_x(-0.1 + short * 0.07 + x_tilt)
|
||||||
* Quaternion::rotation_y(tilt * 0.8)
|
* Quaternion::rotation_y(tilt * 0.8 - shortalt * 0.2)
|
||||||
* Quaternion::rotation_z(shortalt * 0.10);
|
* Quaternion::rotation_z(shortalt * 0.1);
|
||||||
|
|
||||||
|
next.neck.orientation = next.neck.orientation * Quaternion::rotation_y(shortalt * 0.2);
|
||||||
|
|
||||||
next.tail_front.position = Vec3::new(0.0, s_a.tail_front.0, s_a.tail_front.1);
|
next.tail_front.position = Vec3::new(0.0, s_a.tail_front.0, s_a.tail_front.1);
|
||||||
next.tail_front.orientation =
|
next.tail_front.orientation = Quaternion::rotation_x(0.3 + short * -0.02)
|
||||||
Quaternion::rotation_x(0.3 + short * -0.02) * Quaternion::rotation_z(tilt * 2.0);
|
* Quaternion::rotation_y(shortalt * 0.2)
|
||||||
|
* Quaternion::rotation_z(tilt * 2.0);
|
||||||
|
|
||||||
next.tail_rear.position = Vec3::new(0.0, s_a.tail_rear.0, s_a.tail_rear.1);
|
next.tail_rear.position = Vec3::new(0.0, s_a.tail_rear.0, s_a.tail_rear.1);
|
||||||
next.tail_rear.orientation =
|
next.tail_rear.orientation =
|
||||||
@ -137,10 +140,10 @@ impl Animation for RunAnimation {
|
|||||||
);
|
);
|
||||||
|
|
||||||
next.wing_in_l.orientation = Quaternion::rotation_x(foot2a * -0.05 + speednorm * -0.3)
|
next.wing_in_l.orientation = Quaternion::rotation_x(foot2a * -0.05 + speednorm * -0.3)
|
||||||
* Quaternion::rotation_y(-0.8 + speednorm * 0.5 + foot2b * -0.2)
|
* Quaternion::rotation_y(-0.8 + speednorm * 0.5 + foot2b * -0.2 + shortalt * 0.3)
|
||||||
* Quaternion::rotation_z(0.2 + foot2a * 0.6);
|
* Quaternion::rotation_z(0.2 + foot2a * 0.6);
|
||||||
next.wing_in_r.orientation = Quaternion::rotation_x(foot1a * -0.05 + speednorm * -0.3)
|
next.wing_in_r.orientation = Quaternion::rotation_x(foot1a * -0.05 + speednorm * -0.3)
|
||||||
* Quaternion::rotation_y(0.8 + speednorm * -0.55 + foot1b * 0.2)
|
* Quaternion::rotation_y(0.8 + speednorm * -0.55 + foot1b * 0.2 + shortalt * 0.3)
|
||||||
* Quaternion::rotation_z(-0.2 + foot1a * -0.6);
|
* Quaternion::rotation_z(-0.2 + foot1a * -0.6);
|
||||||
|
|
||||||
next.wing_mid_l.position = Vec3::new(-s_a.wing_mid.0, s_a.wing_mid.1, s_a.wing_mid.2);
|
next.wing_mid_l.position = Vec3::new(-s_a.wing_mid.0, s_a.wing_mid.1, s_a.wing_mid.2);
|
||||||
@ -161,18 +164,18 @@ impl Animation for RunAnimation {
|
|||||||
|
|
||||||
next.leg_l.position = Vec3::new(
|
next.leg_l.position = Vec3::new(
|
||||||
-s_a.leg.0,
|
-s_a.leg.0,
|
||||||
s_a.leg.1 + foot1b * -2.3,
|
s_a.leg.1 + foot1b * -4.0,
|
||||||
s_a.leg.2 + foot2b * -1.5,
|
s_a.leg.2 + foot2b * -1.5,
|
||||||
);
|
);
|
||||||
next.leg_l.orientation = Quaternion::rotation_x(-1.0 * speednorm + foot1a * 0.15)
|
next.leg_l.orientation = Quaternion::rotation_x(-0.3 * speednorm + foot1a * 0.15)
|
||||||
* Quaternion::rotation_y(tilt * 0.5);
|
* Quaternion::rotation_y(tilt * 0.5);
|
||||||
|
|
||||||
next.leg_r.position = Vec3::new(
|
next.leg_r.position = Vec3::new(
|
||||||
s_a.leg.0,
|
s_a.leg.0,
|
||||||
s_a.leg.1 + foot2b * -2.3,
|
s_a.leg.1 + foot2b * -4.0,
|
||||||
s_a.leg.2 + foot1b * -1.5,
|
s_a.leg.2 + foot1b * -1.5,
|
||||||
);
|
);
|
||||||
next.leg_r.orientation = Quaternion::rotation_x(-1.0 * speednorm + foot2a * 0.15)
|
next.leg_r.orientation = Quaternion::rotation_x(-0.3 * speednorm + foot2a * 0.15)
|
||||||
* Quaternion::rotation_y(tilt * 0.5);
|
* Quaternion::rotation_y(tilt * 0.5);
|
||||||
} else {
|
} else {
|
||||||
next.chest.position = Vec3::new(
|
next.chest.position = Vec3::new(
|
||||||
@ -180,9 +183,12 @@ impl Animation for RunAnimation {
|
|||||||
s_a.chest.0,
|
s_a.chest.0,
|
||||||
s_a.chest.1 + short * 0.5 + x_tilt * 10.0 + 0.5 * speednorm,
|
s_a.chest.1 + short * 0.5 + x_tilt * 10.0 + 0.5 * speednorm,
|
||||||
) * s_a.scaler;
|
) * s_a.scaler;
|
||||||
next.chest.orientation = Quaternion::rotation_x(short * 0.07 + x_tilt)
|
next.chest.orientation =
|
||||||
* Quaternion::rotation_y(tilt * 0.8)
|
Quaternion::rotation_x(short * 0.07 + x_tilt + foot1b.max(foot2b) * 0.2)
|
||||||
* Quaternion::rotation_z(shortalt * 0.10);
|
* Quaternion::rotation_y(tilt * 0.8 - foot1b * 0.2)
|
||||||
|
* Quaternion::rotation_z(shortalt * 0.1);
|
||||||
|
|
||||||
|
next.neck.orientation = next.neck.orientation * Quaternion::rotation_y(shortalt * -0.2);
|
||||||
|
|
||||||
next.tail_front.position = Vec3::new(0.0, s_a.tail_front.0, s_a.tail_front.1);
|
next.tail_front.position = Vec3::new(0.0, s_a.tail_front.0, s_a.tail_front.1);
|
||||||
next.tail_front.orientation = Quaternion::rotation_x(0.6 + short * -0.02);
|
next.tail_front.orientation = Quaternion::rotation_x(0.6 + short * -0.02);
|
||||||
@ -210,13 +216,13 @@ impl Animation for RunAnimation {
|
|||||||
next.wing_out_r.orientation =
|
next.wing_out_r.orientation =
|
||||||
Quaternion::rotation_y(0.2 + short * -0.05) * Quaternion::rotation_z(-0.2);
|
Quaternion::rotation_y(0.2 + short * -0.05) * Quaternion::rotation_z(-0.2);
|
||||||
|
|
||||||
next.leg_l.position = Vec3::new(-s_a.leg.0, s_a.leg.1 + foot1b * -2.3, s_a.leg.2);
|
next.leg_l.position = Vec3::new(-s_a.leg.0, s_a.leg.1 + foot1b * -5.0, s_a.leg.2);
|
||||||
next.leg_l.orientation = Quaternion::rotation_x(-0.2 * speednorm + foot1a * 0.15)
|
next.leg_l.orientation = Quaternion::rotation_x(-0.2 * speednorm + foot1a * 0.1)
|
||||||
* Quaternion::rotation_y(tilt * 0.5);
|
* Quaternion::rotation_y(tilt * 0.5 + (foot1a + 1.0) * 0.15);
|
||||||
|
|
||||||
next.leg_r.position = Vec3::new(s_a.leg.0, s_a.leg.1 + foot2b * -2.3, s_a.leg.2);
|
next.leg_r.position = Vec3::new(s_a.leg.0, s_a.leg.1 + foot2b * -5.0, s_a.leg.2);
|
||||||
next.leg_r.orientation = Quaternion::rotation_x(-0.2 * speednorm + foot2a * 0.15)
|
next.leg_r.orientation = Quaternion::rotation_x(-0.2 * speednorm + foot2a * 0.1)
|
||||||
* Quaternion::rotation_y(tilt * 0.5);
|
* Quaternion::rotation_y(tilt * 0.5 - (foot2a + 1.0) * 0.15);
|
||||||
}
|
}
|
||||||
next
|
next
|
||||||
}
|
}
|
||||||
|
@ -26,10 +26,10 @@ impl Animation for RunAnimation {
|
|||||||
*rate = 1.0;
|
*rate = 1.0;
|
||||||
|
|
||||||
//let speednorm = speed / 13.0;
|
//let speednorm = speed / 13.0;
|
||||||
let speednorm = (speed / 13.0).powf(0.25);
|
let speednorm = (speed / 13.0).powf(0.5);
|
||||||
|
|
||||||
let speedmult = 0.8;
|
let speedmult = 0.8;
|
||||||
let lab: f32 = 0.6; //6
|
let lab: f32 = 0.8; //6
|
||||||
|
|
||||||
// acc_vel and anim_time mix to make sure phase lenght isn't starting at
|
// acc_vel and anim_time mix to make sure phase lenght isn't starting at
|
||||||
// +infinite
|
// +infinite
|
||||||
@ -76,16 +76,21 @@ impl Animation for RunAnimation {
|
|||||||
|
|
||||||
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
|
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
|
||||||
next.head.orientation = Quaternion::rotation_x(-0.1 * speednorm + short * -0.05)
|
next.head.orientation = Quaternion::rotation_x(-0.1 * speednorm + short * -0.05)
|
||||||
* Quaternion::rotation_y(tilt * 0.2)
|
* Quaternion::rotation_y(tilt * 0.2 + foot1a * 0.25)
|
||||||
* Quaternion::rotation_z(shortalt * -0.05 - tilt * 1.5);
|
* Quaternion::rotation_z(shortalt * -0.05 - tilt * 1.5);
|
||||||
|
|
||||||
next.chest.position = Vec3::new(
|
next.chest.position = Vec3::new(
|
||||||
0.0,
|
0.0,
|
||||||
s_a.chest.0,
|
s_a.chest.0,
|
||||||
s_a.chest.1 + short * 0.5 + x_tilt * 4.0 + 0.5 * speednorm,
|
s_a.chest.1
|
||||||
|
+ 1.5
|
||||||
|
+ short * 0.5
|
||||||
|
+ foot1b.max(foot2b) * 2.0
|
||||||
|
+ x_tilt * 4.0
|
||||||
|
+ 0.5 * speednorm,
|
||||||
) * s_a.scaler;
|
) * s_a.scaler;
|
||||||
next.chest.orientation = Quaternion::rotation_x(short * 0.07 + x_tilt)
|
next.chest.orientation = Quaternion::rotation_x(short * 0.07 + x_tilt)
|
||||||
* Quaternion::rotation_y(tilt * 0.8)
|
* Quaternion::rotation_y(tilt * 0.8 - foot1a * 0.25)
|
||||||
* Quaternion::rotation_z(shortalt * 0.10);
|
* Quaternion::rotation_z(shortalt * 0.10);
|
||||||
|
|
||||||
next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1);
|
next.tail.position = Vec3::new(0.0, s_a.tail.0, s_a.tail.1);
|
||||||
@ -108,13 +113,21 @@ impl Animation for RunAnimation {
|
|||||||
next.wing_out_r.orientation =
|
next.wing_out_r.orientation =
|
||||||
Quaternion::rotation_y(0.2 + short * -0.05) * Quaternion::rotation_z(-0.2);
|
Quaternion::rotation_y(0.2 + short * -0.05) * Quaternion::rotation_z(-0.2);
|
||||||
|
|
||||||
next.leg_l.position = Vec3::new(-s_a.leg.0, s_a.leg.1 + foot1b * -0.8, s_a.leg.2);
|
next.leg_l.position = Vec3::new(
|
||||||
next.leg_l.orientation = Quaternion::rotation_x(-0.2 * speednorm + foot1a * 0.15)
|
-s_a.leg.0,
|
||||||
* Quaternion::rotation_y(tilt * 0.5);
|
s_a.leg.1 + foot1b * -1.8,
|
||||||
|
s_a.leg.2 + (foot1b + 1.0) * 0.75,
|
||||||
|
);
|
||||||
|
next.leg_l.orientation = Quaternion::rotation_x(-0.2 * speednorm + foot1a * 0.75)
|
||||||
|
* Quaternion::rotation_y(tilt * 0.5 + (foot1b + 1.0) * 0.3);
|
||||||
|
|
||||||
next.leg_r.position = Vec3::new(s_a.leg.0, s_a.leg.1 + foot2b * -0.8, s_a.leg.2);
|
next.leg_r.position = Vec3::new(
|
||||||
next.leg_r.orientation = Quaternion::rotation_x(-0.2 * speednorm + foot2a * 0.15)
|
s_a.leg.0,
|
||||||
* Quaternion::rotation_y(tilt * 0.5);
|
s_a.leg.1 + foot2b * -1.8,
|
||||||
|
s_a.leg.2 + (foot2b + 1.0) * 0.75,
|
||||||
|
);
|
||||||
|
next.leg_r.orientation = Quaternion::rotation_x(-0.2 * speednorm + foot2a * 0.75)
|
||||||
|
* Quaternion::rotation_y(tilt * 0.5 - (foot2b + 1.0) * 0.3);
|
||||||
next
|
next
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ impl Animation for RunAnimation {
|
|||||||
*rate = 1.0;
|
*rate = 1.0;
|
||||||
let lab: f32 = 0.72;
|
let lab: f32 = 0.72;
|
||||||
let amplitude = (speed / 24.0).powf(0.6);
|
let amplitude = (speed / 24.0).powf(0.6);
|
||||||
let amplitude2 = (speed / 24.0).powf(0.6);
|
let amplitude2 = (speed / 8.0).powf(0.6);
|
||||||
let amplitude3 = (speed / 24.0).powf(0.6);
|
let amplitude3 = (speed / 24.0).powf(0.6);
|
||||||
let speedmult = s_a.tempo;
|
let speedmult = s_a.tempo;
|
||||||
let canceler = (speed / 24.0).powf(0.6);
|
let canceler = (speed / 24.0).powf(0.6);
|
||||||
@ -104,9 +104,9 @@ impl Animation for RunAnimation {
|
|||||||
//Gallop
|
//Gallop
|
||||||
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1 + shortalt * -0.2);
|
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1 + shortalt * -0.2);
|
||||||
next.head.orientation = Quaternion::rotation_x(
|
next.head.orientation = Quaternion::rotation_x(
|
||||||
look.y * 0.3 / ((canceler).max(0.5)) + amplitude * short * 0.05 - 0.1,
|
look.y * 0.3 / ((canceler).max(0.5)) + amplitude * short * 0.2 - 0.1,
|
||||||
) * Quaternion::rotation_z(
|
) * Quaternion::rotation_z(
|
||||||
look.x * 0.3 / ((canceler).max(0.5)) + tilt * -1.2,
|
look.x * 0.3 / ((canceler).max(0.5)) + tilt * -2.0,
|
||||||
) * Quaternion::rotation_y(tilt * 0.8);
|
) * Quaternion::rotation_y(tilt * 0.8);
|
||||||
|
|
||||||
next.neck.position = Vec3::new(0.0, s_a.neck.0, s_a.neck.1 + shortalt * -0.8);
|
next.neck.position = Vec3::new(0.0, s_a.neck.0, s_a.neck.1 + shortalt * -0.8);
|
||||||
|
@ -30,7 +30,7 @@ impl Animation for RunAnimation {
|
|||||||
let mixed_vel = acc_vel + anim_time * 6.0; //sets run frequency using speed, with anim_time setting a floor
|
let mixed_vel = acc_vel + anim_time * 6.0; //sets run frequency using speed, with anim_time setting a floor
|
||||||
|
|
||||||
let speedmult = 1.0;
|
let speedmult = 1.0;
|
||||||
let lab: f32 = 0.6; //6
|
let lab: f32 = 0.45; //6
|
||||||
|
|
||||||
let short = ((1.0
|
let short = ((1.0
|
||||||
/ (0.72
|
/ (0.72
|
||||||
@ -120,8 +120,8 @@ impl Animation for RunAnimation {
|
|||||||
};
|
};
|
||||||
next.leg_l.position = Vec3::new(
|
next.leg_l.position = Vec3::new(
|
||||||
-s_a.leg.0 + speednorm * 1.5,
|
-s_a.leg.0 + speednorm * 1.5,
|
||||||
s_a.leg.1 + foot1b * -1.3,
|
s_a.leg.1 + foot1b * -2.3,
|
||||||
s_a.leg.2 + foot1a * 1.0,
|
s_a.leg.2 * 1.5 + foot1a.max(0.0) * 3.0,
|
||||||
);
|
);
|
||||||
next.leg_l.orientation = Quaternion::rotation_x(-0.2 * speednorm + foot1a * 0.15)
|
next.leg_l.orientation = Quaternion::rotation_x(-0.2 * speednorm + foot1a * 0.15)
|
||||||
* Quaternion::rotation_y(tilt * 0.5)
|
* Quaternion::rotation_y(tilt * 0.5)
|
||||||
@ -129,8 +129,8 @@ impl Animation for RunAnimation {
|
|||||||
|
|
||||||
next.leg_r.position = Vec3::new(
|
next.leg_r.position = Vec3::new(
|
||||||
s_a.leg.0 + speednorm * -1.5,
|
s_a.leg.0 + speednorm * -1.5,
|
||||||
s_a.leg.1 + foot2b * -1.3,
|
s_a.leg.1 + foot2b * -2.3,
|
||||||
s_a.leg.2 + foot2a * 1.0,
|
s_a.leg.2 * 1.5 + foot2a.max(0.0) * 3.0,
|
||||||
);
|
);
|
||||||
next.leg_r.orientation = Quaternion::rotation_x(-0.2 * speednorm + foot2a * 0.15)
|
next.leg_r.orientation = Quaternion::rotation_x(-0.2 * speednorm + foot2a * 0.15)
|
||||||
* Quaternion::rotation_y(tilt * 0.5)
|
* Quaternion::rotation_y(tilt * 0.5)
|
||||||
@ -141,17 +141,16 @@ impl Animation for RunAnimation {
|
|||||||
s_a.foot.1 + foot1b * -2.0,
|
s_a.foot.1 + foot1b * -2.0,
|
||||||
s_a.foot.2 + speednorm * 0.5 + (foot1a * 1.5).max(0.0),
|
s_a.foot.2 + speednorm * 0.5 + (foot1a * 1.5).max(0.0),
|
||||||
);
|
);
|
||||||
next.foot_l.orientation = Quaternion::rotation_x(-0.2 * speednorm + foot1b * -0.35)
|
next.foot_l.orientation =
|
||||||
* Quaternion::rotation_y(tilt * -1.0)
|
Quaternion::rotation_x(0.2 + foot2b * 0.6) * Quaternion::rotation_y(tilt * -1.0);
|
||||||
* Quaternion::rotation_z(tilt * -0.5);
|
|
||||||
|
|
||||||
next.foot_r.position = Vec3::new(
|
next.foot_r.position = Vec3::new(
|
||||||
s_a.foot.0,
|
s_a.foot.0,
|
||||||
s_a.foot.1 + foot2b * -2.0,
|
s_a.foot.1 + foot2b * -2.0,
|
||||||
s_a.foot.2 + speednorm * 0.5 + (foot2a * 1.5).max(0.0),
|
s_a.foot.2 + speednorm * 0.5 + (foot2a * 1.5).max(0.0),
|
||||||
);
|
);
|
||||||
next.foot_r.orientation = Quaternion::rotation_x(-0.2 * speednorm + foot2b * -0.35)
|
next.foot_r.orientation =
|
||||||
* Quaternion::rotation_y(tilt * -1.0);
|
Quaternion::rotation_x(0.2 + foot1b * 0.6) * Quaternion::rotation_y(tilt * -1.0);
|
||||||
|
|
||||||
next
|
next
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user