mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Various changes to npcs animations
- Improved dragon run with tilting - New run animation for quadsmall, added tilting
This commit is contained in:
parent
a0da059676
commit
3524d644f5
@ -17,7 +17,7 @@
|
||||
center: ("npc.reddragon.male.chest_front"),
|
||||
),
|
||||
chest_rear: (
|
||||
offset: (-6.5, -7.0, -7.0),
|
||||
offset: (-6.5, -13.0, -7.0),
|
||||
center: ("npc.reddragon.male.chest_rear"),
|
||||
),
|
||||
tail_front: (
|
||||
@ -47,7 +47,7 @@
|
||||
center: ("npc.reddragon.male.chest_front"),
|
||||
),
|
||||
chest_rear: (
|
||||
offset: (-6.5, -7.0, -7.0),
|
||||
offset: (-6.5, -13.0, -7.0),
|
||||
center: ("npc.reddragon.male.chest_rear"),
|
||||
),
|
||||
tail_front: (
|
||||
|
@ -50,11 +50,11 @@ impl Animation for IdleAnimation {
|
||||
next.chest.ori = Quaternion::rotation_y(wave_slow * 0.06);
|
||||
next.chest.scale = Vec3::one() / 18.0;
|
||||
|
||||
next.feet_f.offset = Vec3::new(0.0, skeleton_attr.feet_f.0, skeleton_attr.feet_f.1 + 3.0);
|
||||
next.feet_f.offset = Vec3::new(0.0, skeleton_attr.feet_f.0, skeleton_attr.feet_f.1);
|
||||
next.feet_f.ori = Quaternion::rotation_z(0.0);
|
||||
next.feet_f.scale = Vec3::one();
|
||||
|
||||
next.feet_b.offset = Vec3::new(0.0, skeleton_attr.feet_b.0, skeleton_attr.feet_b.1 + 3.0);
|
||||
next.feet_b.offset = Vec3::new(0.0, skeleton_attr.feet_b.0, skeleton_attr.feet_b.1);
|
||||
next.feet_b.ori = Quaternion::rotation_x(0.0);
|
||||
next.feet_b.scale = Vec3::one();
|
||||
|
||||
|
@ -35,7 +35,7 @@ impl Animation for RunAnimation {
|
||||
skeleton_attr.chest.0 + wave * 1.0,
|
||||
skeleton_attr.chest.1,
|
||||
) / 18.0;
|
||||
next.chest.ori = Quaternion::rotation_y(wave_slow * 0.3);
|
||||
next.chest.ori = Quaternion::rotation_y(0.0);
|
||||
next.chest.scale = Vec3::one() / 18.0;
|
||||
|
||||
next.feet_f.offset = Vec3::new(0.0, skeleton_attr.feet_f.0, skeleton_attr.feet_f.1);
|
||||
|
@ -65,12 +65,12 @@ impl Animation for IdleAnimation {
|
||||
skeleton_attr.chest_front.0,
|
||||
skeleton_attr.chest_front.1,
|
||||
);
|
||||
next.chest_front.ori = Quaternion::rotation_y(slow * 0.01);
|
||||
next.chest_front.ori = Quaternion::rotation_y(0.0);
|
||||
next.chest_front.scale = Vec3::one() * 1.05;
|
||||
|
||||
next.chest_rear.offset =
|
||||
Vec3::new(0.0, skeleton_attr.chest_rear.0, skeleton_attr.chest_rear.1);
|
||||
next.chest_rear.ori = Quaternion::rotation_y(slow * 0.01);
|
||||
next.chest_rear.ori = Quaternion::rotation_y(0.0);
|
||||
next.chest_rear.scale = Vec3::one() * 1.05;
|
||||
|
||||
next.tail_front.offset =
|
||||
@ -83,38 +83,6 @@ impl Animation for IdleAnimation {
|
||||
next.tail_rear.ori = Quaternion::rotation_z(slowalt * 0.12) * Quaternion::rotation_x(0.05);
|
||||
next.tail_rear.scale = Vec3::one() * 0.98;
|
||||
|
||||
next.wing_in_l.offset = Vec3::new(
|
||||
-skeleton_attr.wing_in.0,
|
||||
skeleton_attr.wing_in.1,
|
||||
skeleton_attr.wing_in.2,
|
||||
);
|
||||
next.wing_in_l.ori = Quaternion::rotation_y(0.8);
|
||||
next.wing_in_l.scale = Vec3::one();
|
||||
|
||||
next.wing_in_r.offset = Vec3::new(
|
||||
skeleton_attr.wing_in.0,
|
||||
skeleton_attr.wing_in.1,
|
||||
skeleton_attr.wing_in.2,
|
||||
);
|
||||
next.wing_in_r.ori = Quaternion::rotation_y(-0.8);
|
||||
next.wing_in_r.scale = Vec3::one();
|
||||
|
||||
next.wing_out_l.offset = Vec3::new(
|
||||
-skeleton_attr.wing_out.0,
|
||||
skeleton_attr.wing_out.1,
|
||||
skeleton_attr.wing_out.2,
|
||||
);
|
||||
next.wing_out_l.ori = Quaternion::rotation_y(-2.0);
|
||||
next.wing_out_l.scale = Vec3::one();
|
||||
|
||||
next.wing_out_r.offset = Vec3::new(
|
||||
skeleton_attr.wing_out.0,
|
||||
skeleton_attr.wing_out.1,
|
||||
skeleton_attr.wing_out.2,
|
||||
);
|
||||
next.wing_out_r.ori = Quaternion::rotation_y(2.0);
|
||||
next.wing_out_r.scale = Vec3::one();
|
||||
|
||||
next.foot_fl.offset = Vec3::new(
|
||||
-skeleton_attr.feet_f.0,
|
||||
skeleton_attr.feet_f.1,
|
||||
@ -147,6 +115,38 @@ impl Animation for IdleAnimation {
|
||||
next.foot_br.ori = Quaternion::rotation_x(0.0);
|
||||
next.foot_br.scale = Vec3::one();
|
||||
|
||||
next.wing_in_l.offset = Vec3::new(
|
||||
-skeleton_attr.wing_in.0,
|
||||
skeleton_attr.wing_in.1,
|
||||
skeleton_attr.wing_in.2,
|
||||
);
|
||||
next.wing_in_l.ori = Quaternion::rotation_y(0.8 + slow * 0.02);
|
||||
next.wing_in_l.scale = Vec3::one();
|
||||
|
||||
next.wing_in_r.offset = Vec3::new(
|
||||
skeleton_attr.wing_in.0,
|
||||
skeleton_attr.wing_in.1,
|
||||
skeleton_attr.wing_in.2,
|
||||
);
|
||||
next.wing_in_r.ori = Quaternion::rotation_y(-0.8 - slow * 0.02);
|
||||
next.wing_in_r.scale = Vec3::one();
|
||||
|
||||
next.wing_out_l.offset = Vec3::new(
|
||||
-skeleton_attr.wing_out.0,
|
||||
skeleton_attr.wing_out.1,
|
||||
skeleton_attr.wing_out.2,
|
||||
);
|
||||
next.wing_out_l.ori = Quaternion::rotation_y(-2.0 + slow * 0.02);
|
||||
next.wing_out_l.scale = Vec3::one();
|
||||
|
||||
next.wing_out_r.offset = Vec3::new(
|
||||
skeleton_attr.wing_out.0,
|
||||
skeleton_attr.wing_out.1,
|
||||
skeleton_attr.wing_out.2,
|
||||
);
|
||||
next.wing_out_r.ori = Quaternion::rotation_y(2.0 - slow * 0.02);
|
||||
next.wing_out_r.scale = Vec3::one();
|
||||
|
||||
next
|
||||
}
|
||||
}
|
||||
|
@ -168,7 +168,7 @@ impl<'a> From<&'a comp::dragon::Body> for SkeletonAttr {
|
||||
(Reddragon, _) => (0.0, 15.0),
|
||||
},
|
||||
chest_rear: match (body.species, body.body_type) {
|
||||
(Reddragon, _) => (-12.5, 0.0),
|
||||
(Reddragon, _) => (-6.5, 0.0),
|
||||
},
|
||||
tail_front: match (body.species, body.body_type) {
|
||||
(Reddragon, _) => (-6.5, 1.5),
|
||||
|
@ -5,7 +5,7 @@ use vek::*;
|
||||
pub struct RunAnimation;
|
||||
|
||||
impl Animation for RunAnimation {
|
||||
type Dependency = (f32, f64);
|
||||
type Dependency = (f32, Vec3<f32>, Vec3<f32>, f64, Vec3<f32>);
|
||||
type Skeleton = DragonSkeleton;
|
||||
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
@ -14,13 +14,57 @@ impl Animation for RunAnimation {
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "dragon_run")]
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
(_velocity, global_time): Self::Dependency,
|
||||
(velocity, orientation, last_ori, global_time, avg_vel): Self::Dependency,
|
||||
anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
let lab = 0.6; //6
|
||||
|
||||
let short = (((1.0)
|
||||
/ (0.72
|
||||
+ 0.28
|
||||
* ((anim_time as f32 * 16.0 * lab as f32+ PI * 1.0).sin())
|
||||
.powf(2.0 as f32)))
|
||||
.sqrt())
|
||||
* ((anim_time as f32 * 16.0 * lab as f32 + PI * 1.0).sin());
|
||||
|
||||
//
|
||||
|
||||
let shortalt = (anim_time as f32 * 16.0 * lab as f32 + PI * 0.5).sin();
|
||||
|
||||
let footvert = (anim_time as f32 * 16.0 * lab as f32 + PI * 0.0).sin();
|
||||
let footvertt = (anim_time as f32 * 16.0 * lab as f32 + PI * 0.4).sin();
|
||||
let footvertalt = (anim_time as f32 * 16.0 * lab as f32 + PI * 1.2).sin();
|
||||
let footverttalt = (anim_time as f32 * 16.0 * lab as f32 + PI * 1.6).sin();
|
||||
|
||||
let footvertf = (anim_time as f32 * 16.0 * lab as f32 + PI * 0.3).sin();
|
||||
let footverttf = (anim_time as f32 * 16.0 * lab as f32 + PI * 0.7).sin();
|
||||
let footvertaltf = (anim_time as f32 * 16.0 * lab as f32 + PI * 1.5).sin();
|
||||
let footverttaltf = (anim_time as f32 * 16.0 * lab as f32 + PI * 1.9).sin();
|
||||
|
||||
let footvertfslow = (anim_time as f32 * 16.0 * lab as f32 + PI * 0.6).sin();
|
||||
let footverttfslow = (anim_time as f32 * 16.0 * lab as f32 + PI * 1.0).sin();
|
||||
let footvertaltfslow = (anim_time as f32 * 16.0 * lab as f32 + PI * 1.8).sin();
|
||||
let footverttaltfslow = (anim_time as f32 * 16.0 * lab as f32 + PI * 2.2).sin();
|
||||
//
|
||||
let ori: Vec2<f32> = Vec2::from(orientation);
|
||||
let last_ori = Vec2::from(last_ori);
|
||||
let tilt = if Vec2::new(ori, last_ori)
|
||||
.map(|o| o.magnitude_squared())
|
||||
.map(|m| m > 0.001 && m.is_finite())
|
||||
.reduce_and()
|
||||
&& ori.angle_between(last_ori).is_finite()
|
||||
{
|
||||
ori.angle_between(last_ori).min(0.2)
|
||||
* last_ori.determine_side(Vec2::zero(), ori).signum()
|
||||
} else {
|
||||
0.0
|
||||
} * 1.3;
|
||||
let x_tilt = avg_vel.z.atan2(avg_vel.xy().magnitude());
|
||||
|
||||
let lab = 14;
|
||||
|
||||
let wave_ultra_slow_cos = (anim_time as f32 * 3.0 + PI).cos();
|
||||
@ -42,29 +86,19 @@ impl Animation for RunAnimation {
|
||||
let center = (anim_time as f32 * lab as f32 + PI / 2.0).sin();
|
||||
let centeroffset = (anim_time as f32 * lab as f32 + PI * 1.5).sin();
|
||||
|
||||
let dragon_look = Vec2::new(
|
||||
((global_time + anim_time) as f32 / 4.0)
|
||||
.floor()
|
||||
.mul(7331.0)
|
||||
.sin()
|
||||
* 0.25,
|
||||
((global_time + anim_time) as f32 / 4.0)
|
||||
.floor()
|
||||
.mul(1337.0)
|
||||
.sin()
|
||||
* 0.125,
|
||||
);
|
||||
|
||||
next.head_upper.offset =
|
||||
Vec3::new(0.0, skeleton_attr.head_upper.0, skeleton_attr.head_upper.1);
|
||||
next.head_upper.ori =
|
||||
Quaternion::rotation_x(dragon_look.y) * Quaternion::rotation_z(dragon_look.x);
|
||||
next.head_upper.scale = Vec3::one();
|
||||
Vec3::new(0.0, skeleton_attr.head_upper.0, skeleton_attr.head_upper.1);
|
||||
next.head_upper.ori = Quaternion::rotation_x(short * -0.03 - 0.1)
|
||||
* Quaternion::rotation_z(tilt * -1.2)
|
||||
* Quaternion::rotation_y(tilt * 0.8);
|
||||
next.head_upper.scale = Vec3::one();
|
||||
|
||||
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(wave_slow * 0.05);
|
||||
next.head_lower.scale = Vec3::one();
|
||||
next.head_lower.offset =
|
||||
Vec3::new(0.0, skeleton_attr.head_lower.0, skeleton_attr.head_lower.1);
|
||||
next.head_lower.ori = Quaternion::rotation_z(tilt * -0.8)
|
||||
* Quaternion::rotation_x(short * -0.05)
|
||||
* Quaternion::rotation_y(tilt * 0.3);
|
||||
next.head_lower.scale = Vec3::one() * 1.02;
|
||||
|
||||
next.jaw.offset = Vec3::new(
|
||||
0.0,
|
||||
@ -79,7 +113,8 @@ impl Animation for RunAnimation {
|
||||
skeleton_attr.tail_front.0,
|
||||
skeleton_attr.tail_front.1 + centeroffset * 0.6,
|
||||
);
|
||||
next.tail_front.ori = Quaternion::rotation_x(center * 0.03);
|
||||
next.tail_front.ori =
|
||||
Quaternion::rotation_x(center * 0.03) * Quaternion::rotation_z(tilt * 1.5);
|
||||
next.tail_front.scale = Vec3::one() * 0.98;
|
||||
|
||||
next.tail_rear.offset = Vec3::new(
|
||||
@ -87,20 +122,27 @@ impl Animation for RunAnimation {
|
||||
skeleton_attr.tail_rear.0,
|
||||
skeleton_attr.tail_rear.1 + centeroffset * 0.6,
|
||||
);
|
||||
next.tail_rear.ori = Quaternion::rotation_x(center * 0.03);
|
||||
next.tail_rear.ori =
|
||||
Quaternion::rotation_x(center * 0.03) * Quaternion::rotation_z(tilt * 1.5);
|
||||
next.tail_rear.scale = Vec3::one() * 0.98;
|
||||
|
||||
next.chest_front.offset = Vec3::new(
|
||||
0.0,
|
||||
skeleton_attr.chest_front.0 + horichest * 1.25,
|
||||
skeleton_attr.chest_front.1 + vertchest * -1.6 + 1.0,
|
||||
);
|
||||
next.chest_front.ori = Quaternion::rotation_y(horichest * -0.09);
|
||||
skeleton_attr.chest_front.0,
|
||||
skeleton_attr.chest_front.1 + shortalt * 2.5 + x_tilt * 10.0,);
|
||||
next.chest_front.ori = Quaternion::rotation_x(short * 0.13 + x_tilt)
|
||||
* Quaternion::rotation_y(0.0)
|
||||
* Quaternion::rotation_z(tilt * -1.5);
|
||||
next.chest_front.scale = Vec3::one();
|
||||
|
||||
next.chest_rear.offset =
|
||||
Vec3::new(0.0, skeleton_attr.chest_rear.0, skeleton_attr.chest_rear.1);
|
||||
next.chest_rear.ori = Quaternion::rotation_y(horichest * -0.09);
|
||||
next.chest_rear.offset = Vec3::new(
|
||||
0.0,
|
||||
skeleton_attr.chest_rear.0,
|
||||
skeleton_attr.chest_rear.1 + shortalt * 0.2,
|
||||
);
|
||||
next.chest_rear.ori = Quaternion::rotation_x(short * 0.1)
|
||||
* Quaternion::rotation_y(0.0)
|
||||
* Quaternion::rotation_z(tilt * 1.8);
|
||||
next.chest_rear.scale = Vec3::one();
|
||||
|
||||
next.foot_fl.offset = Vec3::new(
|
||||
@ -108,7 +150,7 @@ impl Animation for RunAnimation {
|
||||
skeleton_attr.feet_f.1 + horilf * 2.5,
|
||||
skeleton_attr.feet_f.2 + vertlf * 5.0 * skeleton_attr.height - 0.5,
|
||||
);
|
||||
next.foot_fl.ori = Quaternion::rotation_x(horilf * 0.4);
|
||||
next.foot_fl.ori = Quaternion::rotation_x(horilf * 0.6);
|
||||
next.foot_fl.scale = Vec3::one();
|
||||
|
||||
next.foot_fr.offset = Vec3::new(
|
||||
@ -116,7 +158,7 @@ impl Animation for RunAnimation {
|
||||
skeleton_attr.feet_f.1 + horirfoffset * 2.5,
|
||||
skeleton_attr.feet_f.2 + vertrfoffset * 5.0 * skeleton_attr.height - 0.5,
|
||||
);
|
||||
next.foot_fr.ori = Quaternion::rotation_x(horirfoffset * 0.4);
|
||||
next.foot_fr.ori = Quaternion::rotation_x(horirb * 0.6);
|
||||
next.foot_fr.scale = Vec3::one();
|
||||
|
||||
next.foot_bl.offset = Vec3::new(
|
||||
@ -124,7 +166,7 @@ impl Animation for RunAnimation {
|
||||
skeleton_attr.feet_b.1 + horilboffset * 3.0,
|
||||
skeleton_attr.feet_b.2 + vertlboffset * 5.0 * skeleton_attr.height - 0.5,
|
||||
);
|
||||
next.foot_bl.ori = Quaternion::rotation_x(horilboffset * 0.35);
|
||||
next.foot_bl.ori = Quaternion::rotation_x(horilf * 0.55);
|
||||
next.foot_bl.scale = Vec3::one();
|
||||
|
||||
next.foot_br.offset = Vec3::new(
|
||||
@ -132,7 +174,7 @@ impl Animation for RunAnimation {
|
||||
skeleton_attr.feet_b.1 + horirb * 3.0,
|
||||
skeleton_attr.feet_b.2 + vertrb * 5.0 * skeleton_attr.height - 0.5,
|
||||
);
|
||||
next.foot_br.ori = Quaternion::rotation_x(horirb * 0.35);
|
||||
next.foot_br.ori = Quaternion::rotation_x(horirb * 0.55);
|
||||
next.foot_br.scale = Vec3::one();
|
||||
|
||||
next.wing_in_l.offset = Vec3::new(
|
||||
@ -140,7 +182,7 @@ impl Animation for RunAnimation {
|
||||
skeleton_attr.wing_in.1,
|
||||
skeleton_attr.wing_in.2,
|
||||
);
|
||||
next.wing_in_l.ori = Quaternion::rotation_y(0.8);
|
||||
next.wing_in_l.ori = Quaternion::rotation_y(0.8 + tilt * 1.0);
|
||||
next.wing_in_l.scale = Vec3::one();
|
||||
|
||||
next.wing_in_r.offset = Vec3::new(
|
||||
@ -148,23 +190,23 @@ impl Animation for RunAnimation {
|
||||
skeleton_attr.wing_in.1,
|
||||
skeleton_attr.wing_in.2,
|
||||
);
|
||||
next.wing_in_r.ori = Quaternion::rotation_y(-0.8);
|
||||
next.wing_in_r.ori = Quaternion::rotation_y(-0.8 + tilt * 1.0);
|
||||
next.wing_in_r.scale = Vec3::one();
|
||||
|
||||
next.wing_out_l.offset = Vec3::new(
|
||||
-skeleton_attr.wing_out.0,
|
||||
skeleton_attr.wing_out.1,
|
||||
skeleton_attr.wing_out.2 - 1.4,
|
||||
skeleton_attr.wing_out.2,
|
||||
);
|
||||
next.wing_out_l.ori = Quaternion::rotation_y(-2.0);
|
||||
next.wing_out_l.ori = Quaternion::rotation_y(-2.0 + tilt * 1.0);
|
||||
next.wing_out_l.scale = Vec3::one();
|
||||
|
||||
next.wing_out_r.offset = Vec3::new(
|
||||
skeleton_attr.wing_out.0,
|
||||
skeleton_attr.wing_out.1,
|
||||
skeleton_attr.wing_out.2 - 1.4,
|
||||
skeleton_attr.wing_out.2,
|
||||
);
|
||||
next.wing_out_r.ori = Quaternion::rotation_y(2.0);
|
||||
next.wing_out_r.ori = Quaternion::rotation_y(2.0 + tilt * 1.0);
|
||||
next.wing_out_r.scale = Vec3::one();
|
||||
|
||||
next
|
||||
|
@ -5,7 +5,7 @@ use vek::*;
|
||||
pub struct RunAnimation;
|
||||
|
||||
impl Animation for RunAnimation {
|
||||
type Dependency = (f32, f64, Vec3<f32>);
|
||||
type Dependency = (f32, Vec3<f32>, Vec3<f32>, f64, Vec3<f32>);
|
||||
type Skeleton = QuadrupedSmallSkeleton;
|
||||
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
@ -14,12 +14,13 @@ impl Animation for RunAnimation {
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "quadruped_small_run")]
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
(_velocity, _global_time, avg_vel): Self::Dependency,
|
||||
(velocity, orientation, last_ori, _global_time, avg_vel): Self::Dependency,
|
||||
anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
let mut next = (*skeleton).clone();
|
||||
let speed = Vec2::<f32>::from(velocity).magnitude();
|
||||
|
||||
let slow = (anim_time as f32 * 14.0).sin();
|
||||
let fast = (anim_time as f32 * 20.0).sin();
|
||||
@ -27,51 +28,104 @@ impl Animation for RunAnimation {
|
||||
let slow_alt = (anim_time as f32 * 14.0 + PI / 2.0).sin();
|
||||
let x_tilt = avg_vel.z.atan2(avg_vel.xy().magnitude()).max(-0.7);
|
||||
|
||||
|
||||
let lab = 0.6; //6
|
||||
|
||||
let speedmult = if speed > 8.0 {
|
||||
1.2 * (1.0)
|
||||
} else {
|
||||
0.8 * (1.0)
|
||||
};
|
||||
let abssin = (((anim_time as f32 * 5.0 * speedmult + PI * 1.6).sin().abs()) - 0.2).abs().max(-0.2);
|
||||
let abssint = (((anim_time as f32 * 5.0 * speedmult).sin().abs()) - 0.2).abs().max(-0.2);
|
||||
let shortalt = (anim_time as f32 * 16.0 * lab as f32 * speedmult + PI * 0.5).sin();
|
||||
|
||||
let footvert = (anim_time as f32 * 20.0 * lab as f32 * speedmult + PI * 0.0).sin();
|
||||
let footvertt = (anim_time as f32 * 20.0 * lab as f32 * speedmult + PI * 0.4).sin();
|
||||
let footvertalt = (anim_time as f32 * 20.0 * lab as f32 * speedmult + PI * 1.2).sin();
|
||||
let footverttalt = (anim_time as f32 * 20.0 * lab as f32 * speedmult + PI * 1.6).sin();
|
||||
|
||||
let footvertf = (anim_time as f32 * 20.0 * lab as f32 * speedmult + PI * 0.3).sin();
|
||||
let footverttf = (anim_time as f32 * 20.0 * lab as f32 * speedmult + PI * 0.7).sin();
|
||||
let footvertaltf = (anim_time as f32 * 20.0 * lab as f32 * speedmult + PI * 1.5).sin();
|
||||
let footverttaltf = (anim_time as f32 * 20.0 * lab as f32 * speedmult + PI * 1.9).sin();
|
||||
|
||||
let footvertfslow = (anim_time as f32 * 20.0 * lab as f32 * speedmult + PI * 0.6).sin();
|
||||
let footverttfslow = (anim_time as f32 * 20.0 * lab as f32 * speedmult + PI * 1.0).sin();
|
||||
let footvertaltfslow = (anim_time as f32 * 20.0 * lab as f32 * speedmult + PI * 1.8).sin();
|
||||
let footverttaltfslow = (anim_time as f32 * 20.0 * lab as f32 * speedmult + PI * 2.2).sin();
|
||||
|
||||
let ori: Vec2<f32> = Vec2::from(orientation);
|
||||
let last_ori = Vec2::from(last_ori);
|
||||
let tilt = if Vec2::new(ori, last_ori)
|
||||
.map(|o| o.magnitude_squared())
|
||||
.map(|m| m > 0.001 && m.is_finite())
|
||||
.reduce_and()
|
||||
&& ori.angle_between(last_ori).is_finite()
|
||||
{
|
||||
ori.angle_between(last_ori).min(0.2)
|
||||
* last_ori.determine_side(Vec2::zero(), ori).signum()
|
||||
} else {
|
||||
0.0
|
||||
} * 1.3;
|
||||
let x_tilt = avg_vel.z.atan2(avg_vel.xy().magnitude());
|
||||
|
||||
next.head.offset =
|
||||
Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1 + slow * 1.5);
|
||||
next.head.ori =
|
||||
Quaternion::rotation_x(0.2 + slow * 0.05) * Quaternion::rotation_y(slow_alt * 0.03);
|
||||
Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1 + abssint * 2.0);
|
||||
next.head.ori = Quaternion::rotation_x(0.2 + slow * 0.05 + x_tilt * -0.5)
|
||||
* Quaternion::rotation_y(tilt * 0.8)
|
||||
* Quaternion::rotation_z(tilt * -1.2);
|
||||
next.head.scale = Vec3::one();
|
||||
|
||||
next.chest.offset = Vec3::new(
|
||||
0.0,
|
||||
skeleton_attr.chest.0,
|
||||
skeleton_attr.chest.1 + slow_alt * 1.2,
|
||||
skeleton_attr.chest.1 + abssin * 8.0 + x_tilt * 6.0,
|
||||
) / 11.0;
|
||||
next.chest.ori = Quaternion::rotation_x(slow * 0.1 + x_tilt);
|
||||
next.chest.ori = Quaternion::rotation_x(abssin * 0.5 - 0.2 + x_tilt)
|
||||
* Quaternion::rotation_y(tilt * 0.8)
|
||||
* Quaternion::rotation_z(tilt * -1.5);
|
||||
next.chest.scale = Vec3::one() / 11.0;
|
||||
|
||||
next.leg_fl.offset = Vec3::new(
|
||||
-skeleton_attr.feet_f.0,
|
||||
skeleton_attr.feet_f.1 + fast * 0.8,
|
||||
skeleton_attr.feet_f.2 + fast_alt * 1.5,
|
||||
skeleton_attr.feet_f.1 + footvertaltf * -1.3,
|
||||
skeleton_attr.feet_f.2 + 1.0 + footverttaltf * -1.9,
|
||||
);
|
||||
next.leg_fl.ori = Quaternion::rotation_x(fast * 0.3);
|
||||
next.leg_fl.scale = Vec3::one();
|
||||
next.leg_fl.ori = Quaternion::rotation_x(footverttaltf * -0.65)
|
||||
* Quaternion::rotation_z(tilt * -0.5)
|
||||
* Quaternion::rotation_y(tilt * 1.5);
|
||||
next.leg_fl.scale = Vec3::one() * 1.02;
|
||||
|
||||
next.leg_fr.offset = Vec3::new(
|
||||
skeleton_attr.feet_f.0,
|
||||
skeleton_attr.feet_f.1 + fast_alt * -0.8,
|
||||
skeleton_attr.feet_f.2 + fast * 1.5,
|
||||
skeleton_attr.feet_f.1 + footvertaltf * -1.3,
|
||||
skeleton_attr.feet_f.2 + 1.0 + footvertaltf * -1.9,
|
||||
);
|
||||
next.leg_fr.ori = Quaternion::rotation_x(fast_alt * -0.3);
|
||||
next.leg_fr.scale = Vec3::one();
|
||||
next.leg_fr.ori = Quaternion::rotation_x(footvertaltf * -0.65)
|
||||
* Quaternion::rotation_z(tilt * -0.5)
|
||||
* Quaternion::rotation_y(tilt * 1.5);
|
||||
next.leg_fr.scale = Vec3::one() * 1.02;
|
||||
|
||||
next.leg_bl.offset = Vec3::new(
|
||||
-skeleton_attr.feet_b.0,
|
||||
skeleton_attr.feet_b.1 + fast_alt * -0.8,
|
||||
skeleton_attr.feet_b.2 + fast * 1.5,
|
||||
skeleton_attr.feet_b.1 + footvert * -1.7,
|
||||
skeleton_attr.feet_b.2 + 1.0 + footvertt * -1.5,
|
||||
);
|
||||
next.leg_bl.ori = Quaternion::rotation_x(fast_alt * -0.3);
|
||||
next.leg_bl.scale = Vec3::one();
|
||||
next.leg_bl.ori = Quaternion::rotation_x(footvertt * -0.45 - 0.2)
|
||||
* Quaternion::rotation_y(tilt * 1.5)
|
||||
* Quaternion::rotation_z(tilt * -1.5);
|
||||
next.leg_bl.scale = Vec3::one() * 1.02;
|
||||
|
||||
next.leg_br.offset = Vec3::new(
|
||||
skeleton_attr.feet_b.0,
|
||||
skeleton_attr.feet_b.1 + fast * 0.8,
|
||||
skeleton_attr.feet_b.2 + fast_alt * 1.5,
|
||||
skeleton_attr.feet_b.1 + footvertt * -1.7,
|
||||
skeleton_attr.feet_b.2 + 1.0 + footvertt * -1.5,
|
||||
);
|
||||
next.leg_br.ori = Quaternion::rotation_x(fast * 0.3);
|
||||
next.leg_br.scale = Vec3::one();
|
||||
next.leg_br.ori = Quaternion::rotation_x(footvertt * -0.45 - 0.2)
|
||||
* Quaternion::rotation_y(tilt * 1.5)
|
||||
* Quaternion::rotation_z(tilt * -1.5);
|
||||
next.leg_br.scale = Vec3::one() * 1.02;
|
||||
|
||||
next.tail.offset = Vec3::new(0.0, skeleton_attr.tail.0, skeleton_attr.tail.1);
|
||||
next.tail.ori = Quaternion::rotation_z(0.0);
|
||||
|
@ -933,7 +933,7 @@ impl FigureMgr {
|
||||
(true, true, false) => {
|
||||
anim::quadruped_small::RunAnimation::update_skeleton(
|
||||
&QuadrupedSmallSkeleton::new(),
|
||||
(vel.0.magnitude(), time, state.avg_vel),
|
||||
(vel.0.magnitude(), ori, state.last_ori, time, state.avg_vel),
|
||||
state.state_time,
|
||||
&mut state_animation_rate,
|
||||
skeleton_attr,
|
||||
@ -1340,21 +1340,25 @@ impl FigureMgr {
|
||||
physics.in_fluid, // In water
|
||||
) {
|
||||
// Standing
|
||||
(true, false, false) => anim::dragon::IdleAnimation::update_skeleton(
|
||||
&DragonSkeleton::new(),
|
||||
time,
|
||||
state.state_time,
|
||||
&mut state_animation_rate,
|
||||
skeleton_attr,
|
||||
),
|
||||
(true, false, false) => {
|
||||
anim::dragon::IdleAnimation::update_skeleton(
|
||||
&DragonSkeleton::new(),
|
||||
time,
|
||||
state.state_time,
|
||||
&mut state_animation_rate,
|
||||
skeleton_attr,
|
||||
)
|
||||
},
|
||||
// Running
|
||||
(true, true, false) => anim::dragon::RunAnimation::update_skeleton(
|
||||
&DragonSkeleton::new(),
|
||||
(vel.0.magnitude(), time),
|
||||
state.state_time,
|
||||
&mut state_animation_rate,
|
||||
skeleton_attr,
|
||||
),
|
||||
(true, true, false) => {
|
||||
anim::dragon::RunAnimation::update_skeleton(
|
||||
&DragonSkeleton::new(),
|
||||
(vel.0.magnitude(), ori, state.last_ori, time, state.avg_vel),
|
||||
state.state_time,
|
||||
&mut state_animation_rate,
|
||||
skeleton_attr,
|
||||
)
|
||||
},
|
||||
// In air
|
||||
(false, _, false) => anim::dragon::FlyAnimation::update_skeleton(
|
||||
&DragonSkeleton::new(),
|
||||
@ -1363,7 +1367,6 @@ impl FigureMgr {
|
||||
&mut state_animation_rate,
|
||||
skeleton_attr,
|
||||
),
|
||||
|
||||
// TODO!
|
||||
_ => state.skeleton_mut().clone(),
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user