fix for animal attack motion bug

This commit is contained in:
jshipsey 2020-08-24 17:37:23 -04:00
parent ecae71c016
commit b514fb4159
4 changed files with 104 additions and 100 deletions

View File

@ -370,6 +370,7 @@ impl Animation for GlideWieldAnimation {
);
next.lantern.orientation = Quaternion::rotation_x(0.1) * Quaternion::rotation_y(0.1);
next.lantern.scale = Vec3::one() * 0.65;
next.hold.scale = Vec3::one() * 0.0;
next.torso.position = Vec3::new(0.0, 0.0, 0.0) * skeleton_attr.scaler;
next.torso.orientation = Quaternion::rotation_x(0.0);

View File

@ -7,7 +7,7 @@ use std::f32::consts::PI;
pub struct AlphaAnimation;
impl Animation for AlphaAnimation {
type Dependency = f64;
type Dependency = (f32, f64);
type Skeleton = QuadrupedLowSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -16,7 +16,7 @@ impl Animation for AlphaAnimation {
#[cfg_attr(feature = "be-dyn-lib", export_name = "quadruped_low_alpha")]
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
_global_time: Self::Dependency,
(velocity, _global_time): Self::Dependency,
anim_time: f64,
_rate: &mut f32,
skeleton_attr: &SkeletonAttr,
@ -66,7 +66,7 @@ impl Animation for AlphaAnimation {
* Quaternion::rotation_x(-0.12)
* Quaternion::rotation_z(short * 0.3);
next.tail_rear.scale = Vec3::one() * 0.98;
if velocity < 1.0 {
next.foot_fl.position = Vec3::new(
-skeleton_attr.feet_f.0,
skeleton_attr.feet_f.1,
@ -98,7 +98,8 @@ impl Animation for AlphaAnimation {
);
next.foot_br.orientation = Quaternion::rotation_y(short * 0.12);
next.foot_br.scale = Vec3::one();
} else {
};
next
}
}

View File

@ -7,7 +7,7 @@ use std::f32::consts::PI;
pub struct AlphaAnimation;
impl Animation for AlphaAnimation {
type Dependency = f64;
type Dependency = (f32, f64);
type Skeleton = QuadrupedMediumSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -16,7 +16,7 @@ impl Animation for AlphaAnimation {
#[cfg_attr(feature = "be-dyn-lib", export_name = "quadruped_medium_alpha")]
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
_global_time: Self::Dependency,
(velocity, _global_time): Self::Dependency,
anim_time: f64,
_rate: &mut f32,
skeleton_attr: &SkeletonAttr,
@ -70,7 +70,7 @@ impl Animation for AlphaAnimation {
next.ears.position = Vec3::new(0.0, skeleton_attr.ears.0, skeleton_attr.ears.1);
next.ears.orientation = Quaternion::rotation_x(0.0);
next.ears.scale = Vec3::one() * 1.02;
if velocity < 1.0 {
next.leg_fl.position = Vec3::new(
-skeleton_attr.leg_f.0,
skeleton_attr.leg_f.1,
@ -104,8 +104,8 @@ impl Animation for AlphaAnimation {
skeleton_attr.leg_b.1,
skeleton_attr.leg_b.2 + 1.0,
);
next.leg_br.orientation =
Quaternion::rotation_x(-0.1 + short * -0.2) * Quaternion::rotation_y(0.1 + short * 0.2);
next.leg_br.orientation = Quaternion::rotation_x(-0.1 + short * -0.2)
* Quaternion::rotation_y(0.1 + short * 0.2);
next.leg_br.scale = Vec3::one();
next.foot_fl.position = Vec3::new(
@ -142,6 +142,8 @@ impl Animation for AlphaAnimation {
next.foot_br.orientation =
Quaternion::rotation_x(-0.2 + short * 0.2) * Quaternion::rotation_y(short * 0.15);
next.foot_br.scale = Vec3::one();
} else {
};
next
}
}

View File

@ -1244,7 +1244,7 @@ impl FigureMgr {
CharacterState::BasicMelee(_) => {
anim::quadruped_medium::AlphaAnimation::update_skeleton(
&target_base,
time,
(vel.0.magnitude(), time),
state.state_time,
&mut state_animation_rate,
skeleton_attr,
@ -1344,7 +1344,7 @@ impl FigureMgr {
CharacterState::BasicMelee(_) => {
anim::quadruped_low::AlphaAnimation::update_skeleton(
&target_base,
time,
(vel.0.magnitude(), time),
state.state_time,
&mut state_animation_rate,
skeleton_attr,