mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Improve bipedlarge beast walk animation
This commit is contained in:
parent
f4a068c422
commit
a4f4fa38e2
@ -57,7 +57,7 @@ impl Animation for IdleAnimation {
|
||||
// Controls for the beast breathing
|
||||
let intensity = 0.04;
|
||||
let lenght = 1.0;
|
||||
let chop = 0.2;
|
||||
let chop = 0.15;
|
||||
let chop_freq = 40.0;
|
||||
|
||||
let breathing = intensity * (lenght * anim_time as f32).sin() + 0.05 * chop * (anim_time as f32 * chop_freq).sin() * (anim_time as f32 * lenght).cos();
|
||||
@ -91,7 +91,7 @@ impl Animation for IdleAnimation {
|
||||
skeleton_attr.jaw.0 - slower * 0.12,
|
||||
skeleton_attr.jaw.1 + slow * 0.2,
|
||||
);
|
||||
next.jaw.orientation = Quaternion::rotation_x(slow * 0.05);
|
||||
next.jaw.orientation = Quaternion::rotation_x(-0.1 + breathing * 2.0);
|
||||
next.jaw.scale = Vec3::one() * 1.02;
|
||||
|
||||
next.tail.position = Vec3::new(0.0, skeleton_attr.tail.0, skeleton_attr.tail.1);
|
||||
|
@ -48,13 +48,6 @@ impl Animation for RunAnimation {
|
||||
.sqrt())
|
||||
* ((anim_time as f32 * 16.0 * lab as f32 + PI * 1.4).sin());
|
||||
|
||||
let footrotr2 = (((5.0)
|
||||
/ (2.5
|
||||
+ (2.5)
|
||||
* ((anim_time as f32 * 16.0 * lab as f32 + PI * 1.4).cos()).powf(2.0 as f32)))
|
||||
.sqrt())
|
||||
* ((anim_time as f32 * 16.0 * lab as f32 + PI * 1.4).cos());
|
||||
|
||||
let footrotr = (((5.0)
|
||||
/ (1.0
|
||||
+ (4.0)
|
||||
@ -62,13 +55,51 @@ impl Animation for RunAnimation {
|
||||
.sqrt())
|
||||
* ((anim_time as f32 * 16.0 * lab as f32 + PI * 0.4).sin());
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
let foothoril2 = (((1.0)
|
||||
/ (0.4
|
||||
+ (0.6)
|
||||
* ((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 foothorir2 = (((1.0)
|
||||
/ (0.4
|
||||
+ (0.6)
|
||||
* ((anim_time as f32 * 16.0 * lab as f32).cos()).powf(2.0 as f32)))
|
||||
.sqrt())
|
||||
* ((anim_time as f32 * 16.0 * lab as f32).cos());
|
||||
let footvertl2 = (anim_time as f32 * 16.0 * lab as f32 + 1.4 * PI).cos();
|
||||
let footvertr2 = (anim_time as f32 * 16.0 * lab as f32 + 1.4 * PI).sin();
|
||||
let handhoril2 = (anim_time as f32 * 16.0 * lab as f32).sin();
|
||||
let handhorir2 = (anim_time as f32 * 16.0 * lab as f32 + PI).sin();
|
||||
|
||||
let footrotl2 = (((5.0)
|
||||
/ (2.5
|
||||
+ (2.5)
|
||||
* ((anim_time as f32 * 16.0 * lab as f32 + PI * 1.1).cos()).powf(2.0 as f32)))
|
||||
.sqrt())
|
||||
* ((anim_time as f32 * 16.0 * lab as f32 + PI * 1.1).cos());
|
||||
|
||||
let footrotr2 = (((5.0)
|
||||
/ (2.5
|
||||
+ (2.5)
|
||||
* ((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 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();
|
||||
|
||||
if skeleton_attr.beast {
|
||||
next.head.position = Vec3::new(0.0, skeleton_attr.head.0 - 3.0, skeleton_attr.head.1 + 4.0) * 1.02;
|
||||
next.head.orientation = Quaternion::rotation_z(short * -0.18) * Quaternion::rotation_x(0.45);
|
||||
next.head.orientation = Quaternion::rotation_z(short * -0.18) * Quaternion::rotation_x(0.45 - short * 0.05);
|
||||
next.head.scale = Vec3::one() * 1.02;
|
||||
|
||||
next.upper_torso.position = Vec3::new(
|
||||
@ -93,7 +124,7 @@ impl Animation for RunAnimation {
|
||||
|
||||
next.tail.position = Vec3::new(0.0, skeleton_attr.tail.0, skeleton_attr.tail.1);
|
||||
next.tail.orientation =
|
||||
Quaternion::rotation_x(shortalt * 0.05 + 0.45);
|
||||
Quaternion::rotation_x(shortalt * 0.1 + 0.45);
|
||||
next.tail.scale = Vec3::one();
|
||||
|
||||
next.second.position = Vec3::new(0.0, 0.0, 0.0);
|
||||
@ -112,40 +143,40 @@ impl Animation for RunAnimation {
|
||||
|
||||
next.shoulder_l.position = Vec3::new(
|
||||
-skeleton_attr.shoulder.0,
|
||||
skeleton_attr.shoulder.1 + foothoril * -3.0,
|
||||
skeleton_attr.shoulder.1 + foothoril2 * -3.0,
|
||||
skeleton_attr.shoulder.2,
|
||||
);
|
||||
next.shoulder_l.orientation = Quaternion::rotation_x(footrotl * -0.36 + 0.45)
|
||||
next.shoulder_l.orientation = Quaternion::rotation_x(footrotl2 * -0.36 + 0.45)
|
||||
* Quaternion::rotation_y(0.1)
|
||||
* Quaternion::rotation_z(footrotl * 0.3);
|
||||
* Quaternion::rotation_z(footrotl2 * -0.3);
|
||||
next.shoulder_l.scale = Vec3::one();
|
||||
|
||||
next.shoulder_r.position = Vec3::new(
|
||||
skeleton_attr.shoulder.0,
|
||||
skeleton_attr.shoulder.1 + foothorir * -3.0,
|
||||
skeleton_attr.shoulder.1 + foothorir2 * -3.0,
|
||||
skeleton_attr.shoulder.2,
|
||||
);
|
||||
next.shoulder_r.orientation = Quaternion::rotation_x(footrotr * -0.36 + 0.45)
|
||||
next.shoulder_r.orientation = Quaternion::rotation_x(footrotr2 * -0.36 + 0.45)
|
||||
* Quaternion::rotation_y(-0.1)
|
||||
* Quaternion::rotation_z(footrotr * -0.3);
|
||||
* Quaternion::rotation_z(footrotr2 * -0.3);
|
||||
next.shoulder_r.scale = Vec3::one();
|
||||
|
||||
next.hand_l.position = Vec3::new(
|
||||
-1.0 + -skeleton_attr.hand.0,
|
||||
skeleton_attr.hand.1 + foothoril * -4.0 + 2.0,
|
||||
skeleton_attr.hand.2 + foothoril * 0.5 + 2.0,
|
||||
-skeleton_attr.hand.0,
|
||||
skeleton_attr.hand.1 + foothoril2 * -4.0 + 2.0,
|
||||
skeleton_attr.hand.2 + foothoril2 * 0.5 + 2.0,
|
||||
);
|
||||
next.hand_l.orientation = Quaternion::rotation_x(0.15 + (handhoril * -1.2).max(-0.3) + 0.45)
|
||||
* Quaternion::rotation_y(handhoril * 0.1);
|
||||
next.hand_l.orientation = Quaternion::rotation_x(0.15 + (handhoril2 * -1.2).max(-0.3) + 0.45)
|
||||
* Quaternion::rotation_y(handhoril2 * 0.1);
|
||||
next.hand_l.scale = Vec3::one() * 1.02;
|
||||
|
||||
next.hand_r.position = Vec3::new(
|
||||
1.0 + skeleton_attr.hand.0,
|
||||
skeleton_attr.hand.1 + foothorir * -4.0 + 2.0,
|
||||
skeleton_attr.hand.2 + foothorir * 0.5 + 2.0,
|
||||
skeleton_attr.hand.0,
|
||||
skeleton_attr.hand.1 + foothorir2 * -4.0 + 2.0,
|
||||
skeleton_attr.hand.2 + foothorir2 * 0.5 + 2.0,
|
||||
);
|
||||
next.hand_r.orientation = Quaternion::rotation_x(0.15 + (handhorir * -1.2).max(-0.3) + 0.45)
|
||||
* Quaternion::rotation_y(handhorir * -0.1);
|
||||
next.hand_r.orientation = Quaternion::rotation_x(0.15 + (handhorir2 * -1.2).max(-0.3) + 0.45)
|
||||
* Quaternion::rotation_y(handhorir2 * -0.1);
|
||||
next.hand_r.scale = Vec3::one() * 1.02;
|
||||
|
||||
next.leg_l.position = Vec3::new(
|
||||
@ -154,7 +185,7 @@ impl Animation for RunAnimation {
|
||||
skeleton_attr.leg.2,
|
||||
) * 0.98;
|
||||
next.leg_l.orientation =
|
||||
Quaternion::rotation_z(short * 0.18) * Quaternion::rotation_x(foothoril * 0.5 - 0.25);
|
||||
Quaternion::rotation_z(short * 0.18) * Quaternion::rotation_x(foothoril2 * 0.6 - 0.45);
|
||||
next.leg_l.scale = Vec3::one() * 0.98;
|
||||
|
||||
next.leg_r.position = Vec3::new(
|
||||
@ -163,22 +194,22 @@ impl Animation for RunAnimation {
|
||||
skeleton_attr.leg.2,
|
||||
) * 0.98;
|
||||
next.leg_r.orientation =
|
||||
Quaternion::rotation_z(short * 0.18) * Quaternion::rotation_x(foothorir * 0.5 - 0.25);
|
||||
Quaternion::rotation_z(short * 0.18) * Quaternion::rotation_x(foothorir2 * 0.6 - 0.45);
|
||||
next.leg_r.scale = Vec3::one() * 0.98;
|
||||
|
||||
next.foot_l.position = Vec3::new(
|
||||
-skeleton_attr.foot.0,
|
||||
4.0 + skeleton_attr.foot.1 + foothoril * 4.5 - 10.0,
|
||||
skeleton_attr.foot.2 + ((footvertl * 5.0).max(0.0)),
|
||||
4.0 + skeleton_attr.foot.1 + foothoril2 * 4.0 - 11.0,
|
||||
skeleton_attr.foot.2 + ((footvertl2 * 6.0).max(0.0)),
|
||||
) / 8.0;
|
||||
next.foot_l.orientation =
|
||||
Quaternion::rotation_x(-0.5 + footrotl * 0.85);
|
||||
Quaternion::rotation_x(-0.5 + footrotl2 * 0.85);
|
||||
next.foot_l.scale = Vec3::one() / 8.0;
|
||||
|
||||
next.foot_r.position = Vec3::new(
|
||||
skeleton_attr.foot.0,
|
||||
4.0 + skeleton_attr.foot.1 + foothorir * 4.5 - 10.0,
|
||||
skeleton_attr.foot.2 + ((footvertr * 5.0).max(0.0)),
|
||||
4.0 + skeleton_attr.foot.1 + foothorir2 * 4.0 - 11.0,
|
||||
skeleton_attr.foot.2 + ((footvertr2 * 6.0).max(0.0)),
|
||||
) / 8.0;
|
||||
next.foot_r.orientation =
|
||||
Quaternion::rotation_x(-0.5 + footrotr2 * 0.85);
|
||||
|
Loading…
Reference in New Issue
Block a user