mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
keep mobs from exploding whenever they're hit
This commit is contained in:
parent
ef70949d5d
commit
ceb771bb2c
@ -89,6 +89,7 @@ impl Animation for SitAnimation {
|
||||
skeleton_attr.foot.2,
|
||||
);
|
||||
next.l_foot.ori = Quaternion::rotation_x(slow * 0.1 + stop * 1.2 + slow * 0.1);
|
||||
next.l_foot.scale = Vec3::one();
|
||||
|
||||
next.r_foot.offset = Vec3::new(
|
||||
skeleton_attr.foot.0,
|
||||
@ -96,6 +97,7 @@ impl Animation for SitAnimation {
|
||||
skeleton_attr.foot.2,
|
||||
);
|
||||
next.r_foot.ori = Quaternion::rotation_x(slowa * 0.1 + stop * 1.2 + slowa * 0.1);
|
||||
next.r_foot.scale = Vec3::one();
|
||||
|
||||
next.l_shoulder.offset = Vec3::new(
|
||||
-skeleton_attr.shoulder.0,
|
||||
|
@ -13,28 +13,28 @@ impl Animation for JumpAnimation {
|
||||
_global_time: Self::Dependency,
|
||||
_anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
_skeleton_attr: &CritterAttr,
|
||||
skeleton_attr: &CritterAttr,
|
||||
) -> Self::Skeleton {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
next.head.offset = Vec3::new(0.0, 0.0, 0.0) / 18.0;
|
||||
next.head.ori = Quaternion::rotation_z(0.0);
|
||||
next.head.offset = Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1) / 18.0;
|
||||
next.head.ori = Quaternion::rotation_z(0.8) * Quaternion::rotation_x(0.5);
|
||||
next.head.scale = Vec3::one() / 18.0;
|
||||
|
||||
next.chest.offset = Vec3::new(0.0, 0.0, 0.0) / 18.0;
|
||||
next.chest.ori = Quaternion::rotation_x(0.0);
|
||||
next.chest.offset = Vec3::new(0.0, skeleton_attr.chest.0, skeleton_attr.chest.1) / 18.0;
|
||||
next.chest.ori = Quaternion::rotation_y(0.0);
|
||||
next.chest.scale = Vec3::one() / 18.0;
|
||||
|
||||
next.feet_f.offset = Vec3::new(0.0, 0.0, 0.0) / 18.0;
|
||||
next.feet_f.offset = Vec3::new(0.0, skeleton_attr.feet_f.0, skeleton_attr.feet_f.1) / 18.0;
|
||||
next.feet_f.ori = Quaternion::rotation_z(0.0);
|
||||
next.feet_f.scale = Vec3::one() / 18.0;
|
||||
|
||||
next.feet_b.offset = Vec3::new(0.0, 0.0, 0.0) / 18.0;
|
||||
next.feet_b.offset = Vec3::new(0.0, skeleton_attr.feet_b.0, skeleton_attr.feet_b.1) / 18.0;
|
||||
next.feet_b.ori = Quaternion::rotation_x(0.0);
|
||||
next.feet_b.scale = Vec3::one() / 18.0;
|
||||
|
||||
next.tail.offset = Vec3::new(0.0, 0.0, 0.0) / 18.0;
|
||||
next.tail.ori = Quaternion::rotation_x(0.0);
|
||||
next.tail.offset = Vec3::new(0.0, skeleton_attr.tail.0, skeleton_attr.tail.1) / 18.0;
|
||||
next.tail.ori = Quaternion::rotation_y(0.0);
|
||||
next.tail.scale = Vec3::one() / 18.0;
|
||||
|
||||
next
|
||||
|
@ -1,5 +1,4 @@
|
||||
use super::{super::Animation, QuadrupedMediumSkeleton, SkeletonAttr};
|
||||
use std::f32::consts::PI;
|
||||
use vek::*;
|
||||
|
||||
pub struct JumpAnimation;
|
||||
@ -11,61 +10,82 @@ impl Animation for JumpAnimation {
|
||||
fn update_skeleton(
|
||||
skeleton: &Self::Skeleton,
|
||||
_global_time: Self::Dependency,
|
||||
anim_time: f64,
|
||||
_anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
_skeleton_attr: &SkeletonAttr,
|
||||
skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
let wave = (anim_time as f32 * 14.0).sin();
|
||||
let wave_slow = (anim_time as f32 * 3.5 + PI).sin();
|
||||
let wave_stop = (anim_time as f32 * 5.0).min(PI / 2.0).sin();
|
||||
next.head_upper.offset = Vec3::new(
|
||||
0.0,
|
||||
skeleton_attr.head_upper.0,
|
||||
skeleton_attr.head_upper.1 + 3.0,
|
||||
) / 11.0;
|
||||
next.head_upper.ori = Quaternion::rotation_z(0.8) * Quaternion::rotation_x(0.5);
|
||||
next.head_upper.scale = Vec3::one() / 10.98;
|
||||
|
||||
next.head_upper.offset = Vec3::new(0.0, 7.5, 15.0 + wave_stop * 4.8) / 11.0;
|
||||
next.head_upper.ori =
|
||||
Quaternion::rotation_z(0.0) * Quaternion::rotation_x(wave_slow * -0.25);
|
||||
next.head_upper.scale = Vec3::one() / 10.88;
|
||||
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(-0.4);
|
||||
next.head_lower.scale = Vec3::one() * 1.02;
|
||||
|
||||
next.head_lower.offset = Vec3::new(0.0, 3.1, -4.5);
|
||||
next.head_lower.ori = Quaternion::rotation_x(wave_stop * -0.1);
|
||||
next.head_lower.scale = Vec3::one() * 0.98;
|
||||
|
||||
next.jaw.offset = Vec3::new(0.0, 4.5, 2.0);
|
||||
next.jaw.offset = Vec3::new(0.0, skeleton_attr.jaw.0, skeleton_attr.jaw.1);
|
||||
next.jaw.ori = Quaternion::rotation_x(0.0);
|
||||
next.jaw.scale = Vec3::one() * 1.01;
|
||||
next.jaw.scale = Vec3::one() * 0.98;
|
||||
|
||||
next.tail.offset = Vec3::new(0.0, -12.0, 8.0) / 11.0;
|
||||
next.tail.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(wave_slow * -0.25);
|
||||
next.tail.scale = Vec3::one() / 11.0;
|
||||
next.tail.offset = Vec3::new(0.0, skeleton_attr.tail.0, skeleton_attr.tail.1);
|
||||
next.tail.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
|
||||
next.tail.scale = Vec3::one();
|
||||
|
||||
next.torso_back.offset =
|
||||
Vec3::new(0.0, -9.5 + wave_stop * 1.0, 11.0 + wave_stop * 2.2) / 11.0;
|
||||
next.torso_back.ori = Quaternion::rotation_x(wave_slow * -0.25);
|
||||
next.torso_back.offset = Vec3::new(
|
||||
0.0,
|
||||
skeleton_attr.torso_back.0,
|
||||
skeleton_attr.torso_back.1 + 2.0,
|
||||
) / 11.0;
|
||||
next.torso_back.ori = Quaternion::rotation_z(-0.8)
|
||||
* Quaternion::rotation_z(0.0)
|
||||
* Quaternion::rotation_x(0.2);
|
||||
next.torso_back.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.torso_mid.offset = Vec3::new(0.0, 0.0, 12.0 + wave_stop * 3.6) / 11.0;
|
||||
next.torso_mid.ori = Quaternion::rotation_x(wave_slow * -0.25);
|
||||
next.torso_mid.scale = Vec3::one() / 10.5;
|
||||
next.torso_mid.offset =
|
||||
Vec3::new(0.0, skeleton_attr.torso_mid.0, skeleton_attr.torso_mid.1) / 11.0;
|
||||
next.torso_mid.ori = Quaternion::rotation_x(-0.4);
|
||||
next.torso_mid.scale = Vec3::one() / 10.98;
|
||||
|
||||
next.ears.offset = Vec3::new(0.0, 0.75, 6.25);
|
||||
next.ears.offset = Vec3::new(0.0, skeleton_attr.ears.0, skeleton_attr.ears.1);
|
||||
next.ears.ori = Quaternion::rotation_x(0.0);
|
||||
next.ears.scale = Vec3::one() * 1.05;
|
||||
next.ears.scale = Vec3::one() / 1.02;
|
||||
|
||||
next.foot_lf.offset = Vec3::new(-5.0, 5.0 + wave_stop * 3.0, 5.0 + wave_stop * 7.0) / 11.0;
|
||||
next.foot_lf.ori = Quaternion::rotation_x(wave_stop * 1.0 + wave * 0.15);
|
||||
next.foot_lf.offset = Vec3::new(
|
||||
-skeleton_attr.feet_f.0,
|
||||
skeleton_attr.feet_f.1,
|
||||
skeleton_attr.feet_f.2,
|
||||
) / 11.0;
|
||||
next.foot_lf.ori = Quaternion::rotation_x(0.0);
|
||||
next.foot_lf.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.foot_rf.offset = Vec3::new(5.0, 5.0 - wave_stop * 3.0, 5.0 + wave_stop * 5.0) / 11.0;
|
||||
next.foot_rf.ori = Quaternion::rotation_x(wave_stop * -1.0 + wave * 0.15);
|
||||
next.foot_rf.offset = Vec3::new(
|
||||
skeleton_attr.feet_f.0,
|
||||
skeleton_attr.feet_f.1,
|
||||
skeleton_attr.feet_f.2,
|
||||
) / 11.0;
|
||||
next.foot_rf.ori = Quaternion::rotation_x(0.0);
|
||||
next.foot_rf.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.foot_lb.offset =
|
||||
Vec3::new(-5.0, -10.0 - wave_stop * 2.0, 5.0 + wave_stop * 0.0) / 11.0;
|
||||
next.foot_lb.ori = Quaternion::rotation_x(wave_stop * -1.0 + wave * 0.15);
|
||||
next.foot_lb.offset = Vec3::new(
|
||||
-skeleton_attr.feet_b.0,
|
||||
skeleton_attr.feet_b.1,
|
||||
skeleton_attr.feet_b.2,
|
||||
) / 11.0;
|
||||
next.foot_lb.ori = Quaternion::rotation_x(0.0);
|
||||
next.foot_lb.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.foot_rb.offset = Vec3::new(5.0, -10.0 + wave_stop * 2.0, 5.0 + wave_stop * 2.0) / 11.0;
|
||||
next.foot_rb.ori = Quaternion::rotation_x(wave_stop * 1.0 + wave * 0.15);
|
||||
next.foot_rb.offset = Vec3::new(
|
||||
skeleton_attr.feet_b.0,
|
||||
skeleton_attr.feet_b.1,
|
||||
skeleton_attr.feet_b.2,
|
||||
) / 11.0;
|
||||
next.foot_rb.ori = Quaternion::rotation_x(0.0);
|
||||
next.foot_rb.scale = Vec3::one() / 11.0;
|
||||
|
||||
next
|
||||
|
@ -1,5 +1,4 @@
|
||||
use super::{super::Animation, QuadrupedSmallSkeleton, SkeletonAttr};
|
||||
use std::f32::consts::PI;
|
||||
use vek::*;
|
||||
|
||||
pub struct JumpAnimation;
|
||||
@ -11,37 +10,50 @@ impl Animation for JumpAnimation {
|
||||
fn update_skeleton(
|
||||
skeleton: &Self::Skeleton,
|
||||
(_velocity, _global_time): Self::Dependency,
|
||||
anim_time: f64,
|
||||
_anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
_skeleton_attr: &SkeletonAttr,
|
||||
skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
let wave_slow = (anim_time as f32 * 7.0 + PI).sin();
|
||||
let wave_stop = (anim_time as f32 * 4.5).min(PI / 2.0).sin();
|
||||
|
||||
next.head.offset = Vec3::new(0.0, 0.0, -1.5) / 11.0;
|
||||
next.head.ori = Quaternion::rotation_x(wave_stop * 0.4);
|
||||
next.head.offset = Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1) / 11.0;
|
||||
next.head.ori = Quaternion::rotation_z(-0.8) * Quaternion::rotation_x(0.5);
|
||||
next.head.scale = Vec3::one() / 10.5;
|
||||
|
||||
next.chest.offset = Vec3::new(0.0, -9.0, 1.5) / 11.0;
|
||||
next.chest.ori = Quaternion::rotation_x(0.0);
|
||||
next.chest.offset = Vec3::new(0.0, skeleton_attr.chest.0, skeleton_attr.chest.1) / 11.0;
|
||||
next.chest.ori = Quaternion::rotation_y(0.0);
|
||||
next.chest.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.leg_lf.offset = Vec3::new(-4.5, 3.0, 1.5) / 11.0;
|
||||
next.leg_lf.ori = Quaternion::rotation_x(wave_stop * 0.6 - wave_slow * 0.3);
|
||||
next.leg_lf.offset = Vec3::new(
|
||||
-skeleton_attr.feet_f.0,
|
||||
skeleton_attr.feet_f.1,
|
||||
skeleton_attr.feet_f.2,
|
||||
) / 11.0;
|
||||
next.leg_lf.ori = Quaternion::rotation_x(0.0);
|
||||
next.leg_lf.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.leg_rf.offset = Vec3::new(2.5, 3.0, 1.5) / 11.0;
|
||||
next.leg_rf.ori = Quaternion::rotation_x(wave_stop * 0.6 - wave_slow * 0.3);
|
||||
next.leg_rf.offset = Vec3::new(
|
||||
skeleton_attr.feet_f.0,
|
||||
skeleton_attr.feet_f.1,
|
||||
skeleton_attr.feet_f.2,
|
||||
) / 11.0;
|
||||
next.leg_rf.ori = Quaternion::rotation_x(0.0);
|
||||
next.leg_rf.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.leg_lb.offset = Vec3::new(-4.5, -4.0, 2.0) / 11.0;
|
||||
next.leg_lb.ori = Quaternion::rotation_x(wave_stop * -0.6 + wave_slow * 0.3);
|
||||
next.leg_lb.offset = Vec3::new(
|
||||
-skeleton_attr.feet_b.0,
|
||||
skeleton_attr.feet_b.1,
|
||||
skeleton_attr.feet_b.2,
|
||||
) / 11.0;
|
||||
next.leg_lb.ori = Quaternion::rotation_x(0.0);
|
||||
next.leg_lb.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.leg_rb.offset = Vec3::new(2.5, -4.0, 2.0) / 11.0;
|
||||
next.leg_rb.ori = Quaternion::rotation_x(wave_stop * -0.6 + wave_slow * 0.3);
|
||||
next.leg_rb.offset = Vec3::new(
|
||||
skeleton_attr.feet_b.0,
|
||||
skeleton_attr.feet_b.1,
|
||||
skeleton_attr.feet_b.2,
|
||||
) / 11.0;
|
||||
next.leg_rb.ori = Quaternion::rotation_x(0.0);
|
||||
next.leg_rb.scale = Vec3::one() / 11.0;
|
||||
|
||||
next
|
||||
|
Loading…
Reference in New Issue
Block a user