mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
fix for animal attack motion bug
This commit is contained in:
parent
ecae71c016
commit
b514fb4159
@ -370,6 +370,7 @@ impl Animation for GlideWieldAnimation {
|
|||||||
);
|
);
|
||||||
next.lantern.orientation = Quaternion::rotation_x(0.1) * Quaternion::rotation_y(0.1);
|
next.lantern.orientation = Quaternion::rotation_x(0.1) * Quaternion::rotation_y(0.1);
|
||||||
next.lantern.scale = Vec3::one() * 0.65;
|
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.position = Vec3::new(0.0, 0.0, 0.0) * skeleton_attr.scaler;
|
||||||
next.torso.orientation = Quaternion::rotation_x(0.0);
|
next.torso.orientation = Quaternion::rotation_x(0.0);
|
||||||
|
@ -7,7 +7,7 @@ use std::f32::consts::PI;
|
|||||||
pub struct AlphaAnimation;
|
pub struct AlphaAnimation;
|
||||||
|
|
||||||
impl Animation for AlphaAnimation {
|
impl Animation for AlphaAnimation {
|
||||||
type Dependency = f64;
|
type Dependency = (f32, f64);
|
||||||
type Skeleton = QuadrupedLowSkeleton;
|
type Skeleton = QuadrupedLowSkeleton;
|
||||||
|
|
||||||
#[cfg(feature = "use-dyn-lib")]
|
#[cfg(feature = "use-dyn-lib")]
|
||||||
@ -16,7 +16,7 @@ impl Animation for AlphaAnimation {
|
|||||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "quadruped_low_alpha")]
|
#[cfg_attr(feature = "be-dyn-lib", export_name = "quadruped_low_alpha")]
|
||||||
fn update_skeleton_inner(
|
fn update_skeleton_inner(
|
||||||
skeleton: &Self::Skeleton,
|
skeleton: &Self::Skeleton,
|
||||||
_global_time: Self::Dependency,
|
(velocity, _global_time): Self::Dependency,
|
||||||
anim_time: f64,
|
anim_time: f64,
|
||||||
_rate: &mut f32,
|
_rate: &mut f32,
|
||||||
skeleton_attr: &SkeletonAttr,
|
skeleton_attr: &SkeletonAttr,
|
||||||
@ -66,39 +66,40 @@ impl Animation for AlphaAnimation {
|
|||||||
* Quaternion::rotation_x(-0.12)
|
* Quaternion::rotation_x(-0.12)
|
||||||
* Quaternion::rotation_z(short * 0.3);
|
* Quaternion::rotation_z(short * 0.3);
|
||||||
next.tail_rear.scale = Vec3::one() * 0.98;
|
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,
|
||||||
|
skeleton_attr.feet_f.2,
|
||||||
|
);
|
||||||
|
next.foot_fl.orientation = Quaternion::rotation_y(short * 0.12);
|
||||||
|
next.foot_fl.scale = Vec3::one();
|
||||||
|
|
||||||
next.foot_fl.position = Vec3::new(
|
next.foot_fr.position = Vec3::new(
|
||||||
-skeleton_attr.feet_f.0,
|
skeleton_attr.feet_f.0,
|
||||||
skeleton_attr.feet_f.1,
|
skeleton_attr.feet_f.1,
|
||||||
skeleton_attr.feet_f.2,
|
skeleton_attr.feet_f.2,
|
||||||
);
|
);
|
||||||
next.foot_fl.orientation = Quaternion::rotation_y(short * 0.12);
|
next.foot_fr.orientation = Quaternion::rotation_y(short * 0.12);
|
||||||
next.foot_fl.scale = Vec3::one();
|
next.foot_fr.scale = Vec3::one();
|
||||||
|
|
||||||
next.foot_fr.position = Vec3::new(
|
next.foot_bl.position = Vec3::new(
|
||||||
skeleton_attr.feet_f.0,
|
-skeleton_attr.feet_b.0,
|
||||||
skeleton_attr.feet_f.1,
|
skeleton_attr.feet_b.1,
|
||||||
skeleton_attr.feet_f.2,
|
skeleton_attr.feet_b.2,
|
||||||
);
|
);
|
||||||
next.foot_fr.orientation = Quaternion::rotation_y(short * 0.12);
|
next.foot_bl.orientation = Quaternion::rotation_y(short * 0.12);
|
||||||
next.foot_fr.scale = Vec3::one();
|
next.foot_bl.scale = Vec3::one();
|
||||||
|
|
||||||
next.foot_bl.position = Vec3::new(
|
|
||||||
-skeleton_attr.feet_b.0,
|
|
||||||
skeleton_attr.feet_b.1,
|
|
||||||
skeleton_attr.feet_b.2,
|
|
||||||
);
|
|
||||||
next.foot_bl.orientation = Quaternion::rotation_y(short * 0.12);
|
|
||||||
next.foot_bl.scale = Vec3::one();
|
|
||||||
|
|
||||||
next.foot_br.position = Vec3::new(
|
|
||||||
skeleton_attr.feet_b.0,
|
|
||||||
skeleton_attr.feet_b.1,
|
|
||||||
skeleton_attr.feet_b.2,
|
|
||||||
);
|
|
||||||
next.foot_br.orientation = Quaternion::rotation_y(short * 0.12);
|
|
||||||
next.foot_br.scale = Vec3::one();
|
|
||||||
|
|
||||||
|
next.foot_br.position = Vec3::new(
|
||||||
|
skeleton_attr.feet_b.0,
|
||||||
|
skeleton_attr.feet_b.1,
|
||||||
|
skeleton_attr.feet_b.2,
|
||||||
|
);
|
||||||
|
next.foot_br.orientation = Quaternion::rotation_y(short * 0.12);
|
||||||
|
next.foot_br.scale = Vec3::one();
|
||||||
|
} else {
|
||||||
|
};
|
||||||
next
|
next
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ use std::f32::consts::PI;
|
|||||||
pub struct AlphaAnimation;
|
pub struct AlphaAnimation;
|
||||||
|
|
||||||
impl Animation for AlphaAnimation {
|
impl Animation for AlphaAnimation {
|
||||||
type Dependency = f64;
|
type Dependency = (f32, f64);
|
||||||
type Skeleton = QuadrupedMediumSkeleton;
|
type Skeleton = QuadrupedMediumSkeleton;
|
||||||
|
|
||||||
#[cfg(feature = "use-dyn-lib")]
|
#[cfg(feature = "use-dyn-lib")]
|
||||||
@ -16,7 +16,7 @@ impl Animation for AlphaAnimation {
|
|||||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "quadruped_medium_alpha")]
|
#[cfg_attr(feature = "be-dyn-lib", export_name = "quadruped_medium_alpha")]
|
||||||
fn update_skeleton_inner(
|
fn update_skeleton_inner(
|
||||||
skeleton: &Self::Skeleton,
|
skeleton: &Self::Skeleton,
|
||||||
_global_time: Self::Dependency,
|
(velocity, _global_time): Self::Dependency,
|
||||||
anim_time: f64,
|
anim_time: f64,
|
||||||
_rate: &mut f32,
|
_rate: &mut f32,
|
||||||
skeleton_attr: &SkeletonAttr,
|
skeleton_attr: &SkeletonAttr,
|
||||||
@ -70,78 +70,80 @@ impl Animation for AlphaAnimation {
|
|||||||
next.ears.position = Vec3::new(0.0, skeleton_attr.ears.0, skeleton_attr.ears.1);
|
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.orientation = Quaternion::rotation_x(0.0);
|
||||||
next.ears.scale = Vec3::one() * 1.02;
|
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,
|
||||||
|
skeleton_attr.leg_f.2,
|
||||||
|
);
|
||||||
|
|
||||||
next.leg_fl.position = Vec3::new(
|
next.leg_fl.orientation =
|
||||||
-skeleton_attr.leg_f.0,
|
Quaternion::rotation_x(short * -0.1) * Quaternion::rotation_y(short * 0.15);
|
||||||
skeleton_attr.leg_f.1,
|
next.leg_fl.scale = Vec3::one();
|
||||||
skeleton_attr.leg_f.2,
|
|
||||||
);
|
|
||||||
|
|
||||||
next.leg_fl.orientation =
|
next.leg_fr.position = Vec3::new(
|
||||||
Quaternion::rotation_x(short * -0.1) * Quaternion::rotation_y(short * 0.15);
|
skeleton_attr.leg_f.0,
|
||||||
next.leg_fl.scale = Vec3::one();
|
skeleton_attr.leg_f.1,
|
||||||
|
skeleton_attr.leg_f.2,
|
||||||
|
);
|
||||||
|
next.leg_fr.orientation =
|
||||||
|
Quaternion::rotation_x(short * 0.3) * Quaternion::rotation_y(short * -0.2);
|
||||||
|
next.leg_fr.scale = Vec3::one();
|
||||||
|
|
||||||
next.leg_fr.position = Vec3::new(
|
next.leg_bl.position = Vec3::new(
|
||||||
skeleton_attr.leg_f.0,
|
-skeleton_attr.leg_b.0,
|
||||||
skeleton_attr.leg_f.1,
|
skeleton_attr.leg_b.1,
|
||||||
skeleton_attr.leg_f.2,
|
skeleton_attr.leg_b.2 + 1.0,
|
||||||
);
|
);
|
||||||
next.leg_fr.orientation =
|
next.leg_bl.orientation =
|
||||||
Quaternion::rotation_x(short * 0.3) * Quaternion::rotation_y(short * -0.2);
|
Quaternion::rotation_x(-0.1 + short * -0.2) * Quaternion::rotation_y(short * 0.2);
|
||||||
next.leg_fr.scale = Vec3::one();
|
next.leg_bl.scale = Vec3::one();
|
||||||
|
|
||||||
next.leg_bl.position = Vec3::new(
|
next.leg_br.position = Vec3::new(
|
||||||
-skeleton_attr.leg_b.0,
|
skeleton_attr.leg_b.0,
|
||||||
skeleton_attr.leg_b.1,
|
skeleton_attr.leg_b.1,
|
||||||
skeleton_attr.leg_b.2 + 1.0,
|
skeleton_attr.leg_b.2 + 1.0,
|
||||||
);
|
);
|
||||||
next.leg_bl.orientation =
|
next.leg_br.orientation = Quaternion::rotation_x(-0.1 + short * -0.2)
|
||||||
Quaternion::rotation_x(-0.1 + short * -0.2) * Quaternion::rotation_y(short * 0.2);
|
* Quaternion::rotation_y(0.1 + short * 0.2);
|
||||||
next.leg_bl.scale = Vec3::one();
|
next.leg_br.scale = Vec3::one();
|
||||||
|
|
||||||
next.leg_br.position = Vec3::new(
|
next.foot_fl.position = Vec3::new(
|
||||||
skeleton_attr.leg_b.0,
|
-skeleton_attr.feet_f.0,
|
||||||
skeleton_attr.leg_b.1,
|
skeleton_attr.feet_f.1,
|
||||||
skeleton_attr.leg_b.2 + 1.0,
|
skeleton_attr.feet_f.2 + short * -0.2,
|
||||||
);
|
);
|
||||||
next.leg_br.orientation =
|
next.foot_fl.orientation = Quaternion::rotation_x(short * -0.05);
|
||||||
Quaternion::rotation_x(-0.1 + short * -0.2) * Quaternion::rotation_y(0.1 + short * 0.2);
|
next.foot_fl.scale = Vec3::one();
|
||||||
next.leg_br.scale = Vec3::one();
|
|
||||||
|
|
||||||
next.foot_fl.position = Vec3::new(
|
next.foot_fr.position = Vec3::new(
|
||||||
-skeleton_attr.feet_f.0,
|
skeleton_attr.feet_f.0,
|
||||||
skeleton_attr.feet_f.1,
|
skeleton_attr.feet_f.1,
|
||||||
skeleton_attr.feet_f.2 + short * -0.2,
|
skeleton_attr.feet_f.2,
|
||||||
);
|
);
|
||||||
next.foot_fl.orientation = Quaternion::rotation_x(short * -0.05);
|
next.foot_fr.orientation =
|
||||||
next.foot_fl.scale = Vec3::one();
|
Quaternion::rotation_x(short * -0.4) * Quaternion::rotation_y(short * 0.15);
|
||||||
|
next.foot_fr.scale = Vec3::one();
|
||||||
|
|
||||||
next.foot_fr.position = Vec3::new(
|
next.foot_bl.position = Vec3::new(
|
||||||
skeleton_attr.feet_f.0,
|
-skeleton_attr.feet_b.0,
|
||||||
skeleton_attr.feet_f.1,
|
skeleton_attr.feet_b.1,
|
||||||
skeleton_attr.feet_f.2,
|
skeleton_attr.feet_b.2 + short * -0.8,
|
||||||
);
|
);
|
||||||
next.foot_fr.orientation =
|
next.foot_bl.orientation =
|
||||||
Quaternion::rotation_x(short * -0.4) * Quaternion::rotation_y(short * 0.15);
|
Quaternion::rotation_x(-0.2 + short * 0.2) * Quaternion::rotation_y(short * 0.15);
|
||||||
next.foot_fr.scale = Vec3::one();
|
next.foot_bl.scale = Vec3::one();
|
||||||
|
|
||||||
next.foot_bl.position = Vec3::new(
|
next.foot_br.position = Vec3::new(
|
||||||
-skeleton_attr.feet_b.0,
|
skeleton_attr.feet_b.0,
|
||||||
skeleton_attr.feet_b.1,
|
skeleton_attr.feet_b.1,
|
||||||
skeleton_attr.feet_b.2 + short * -0.8,
|
skeleton_attr.feet_b.2,
|
||||||
);
|
);
|
||||||
next.foot_bl.orientation =
|
next.foot_br.orientation =
|
||||||
Quaternion::rotation_x(-0.2 + short * 0.2) * Quaternion::rotation_y(short * 0.15);
|
Quaternion::rotation_x(-0.2 + short * 0.2) * Quaternion::rotation_y(short * 0.15);
|
||||||
next.foot_bl.scale = Vec3::one();
|
next.foot_br.scale = Vec3::one();
|
||||||
|
} else {
|
||||||
next.foot_br.position = Vec3::new(
|
};
|
||||||
skeleton_attr.feet_b.0,
|
|
||||||
skeleton_attr.feet_b.1,
|
|
||||||
skeleton_attr.feet_b.2,
|
|
||||||
);
|
|
||||||
next.foot_br.orientation =
|
|
||||||
Quaternion::rotation_x(-0.2 + short * 0.2) * Quaternion::rotation_y(short * 0.15);
|
|
||||||
next.foot_br.scale = Vec3::one();
|
|
||||||
next
|
next
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1244,7 +1244,7 @@ impl FigureMgr {
|
|||||||
CharacterState::BasicMelee(_) => {
|
CharacterState::BasicMelee(_) => {
|
||||||
anim::quadruped_medium::AlphaAnimation::update_skeleton(
|
anim::quadruped_medium::AlphaAnimation::update_skeleton(
|
||||||
&target_base,
|
&target_base,
|
||||||
time,
|
(vel.0.magnitude(), time),
|
||||||
state.state_time,
|
state.state_time,
|
||||||
&mut state_animation_rate,
|
&mut state_animation_rate,
|
||||||
skeleton_attr,
|
skeleton_attr,
|
||||||
@ -1344,7 +1344,7 @@ impl FigureMgr {
|
|||||||
CharacterState::BasicMelee(_) => {
|
CharacterState::BasicMelee(_) => {
|
||||||
anim::quadruped_low::AlphaAnimation::update_skeleton(
|
anim::quadruped_low::AlphaAnimation::update_skeleton(
|
||||||
&target_base,
|
&target_base,
|
||||||
time,
|
(vel.0.magnitude(), time),
|
||||||
state.state_time,
|
state.state_time,
|
||||||
&mut state_animation_rate,
|
&mut state_animation_rate,
|
||||||
skeleton_attr,
|
skeleton_attr,
|
||||||
|
Loading…
Reference in New Issue
Block a user