placeholder attack anim

This commit is contained in:
jshipsey 2020-06-30 00:28:09 -04:00
parent 894a823aad
commit f164bd2280
7 changed files with 364 additions and 61 deletions

View File

@ -60,9 +60,11 @@ impl Animation for IdleAnimation {
next.jaw.ori = Quaternion::rotation_x(slow * 0.04);
next.jaw.scale = Vec3::one() * 0.98;
next.chest.offset = Vec3::new(0.0, skeleton_attr.chest.0, skeleton_attr.chest.1) *skeleton_attr.scaler/11.0;
next.chest.offset = Vec3::new(0.0, skeleton_attr.chest.0, skeleton_attr.chest.1)
* skeleton_attr.scaler
/ 11.0;
next.chest.ori = Quaternion::rotation_y(slow * 0.01);
next.chest.scale = Vec3::one() *skeleton_attr.scaler/11.0;
next.chest.scale = Vec3::one() * skeleton_attr.scaler / 11.0;
next.tail_front.offset =
Vec3::new(0.0, skeleton_attr.tail_front.0, skeleton_attr.tail_front.1);

View File

@ -21,7 +21,7 @@ impl Animation for RunAnimation {
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let lab = 0.7 * (skeleton_attr.lean.0 + 1.0)*(1.0/skeleton_attr.scaler);
let lab = 0.7 * (skeleton_attr.lean.0 + 1.0) * (1.0 / skeleton_attr.scaler);
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();
@ -109,16 +109,17 @@ impl Animation for RunAnimation {
} else {
0.0
} * 1.3;
//let tilt = 0.0;
//let tilt = 0.0;
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(-skeleton_attr.lean.0) * Quaternion::rotation_z(short * -0.06 + tilt * -1.5);
next.head_upper.ori = Quaternion::rotation_x(-skeleton_attr.lean.0)
* Quaternion::rotation_z(short * -0.06 + tilt * -1.5);
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(0.0) * Quaternion::rotation_z(short * -0.15 + tilt * -0.8);
next.head_lower.ori =
Quaternion::rotation_x(0.0) * Quaternion::rotation_z(short * -0.15 + tilt * -0.8);
next.head_lower.scale = Vec3::one();
next.jaw.offset = Vec3::new(0.0, skeleton_attr.jaw.0, skeleton_attr.jaw.1);
@ -145,11 +146,13 @@ impl Animation for RunAnimation {
* Quaternion::rotation_x(-0.04);
next.tail_rear.scale = Vec3::one();
next.chest.offset = Vec3::new(0.0, skeleton_attr.chest.0, skeleton_attr.chest.1) *skeleton_attr.scaler/11.0;
next.chest.offset = Vec3::new(0.0, skeleton_attr.chest.0, skeleton_attr.chest.1)
* skeleton_attr.scaler
/ 11.0;
next.chest.ori = Quaternion::rotation_z(short * 0.13 + tilt * -1.9)
* Quaternion::rotation_y(shortalt * 0.12)
* Quaternion::rotation_x(skeleton_attr.lean.0);
next.chest.scale = Vec3::one() *skeleton_attr.scaler/11.0;
next.chest.scale = Vec3::one() * skeleton_attr.scaler / 11.0;
next.foot_fl.offset = Vec3::new(
-skeleton_attr.feet_f.0,

View File

@ -0,0 +1,260 @@
use super::{super::Animation, QuadrupedMediumSkeleton, SkeletonAttr};
use std::{f32::consts::PI, ops::Mul};
use vek::*;
pub struct AlphaAnimation;
impl Animation for AlphaAnimation {
type Dependency = f64;
type Skeleton = QuadrupedMediumSkeleton;
#[cfg(feature = "use-dyn-lib")]
const UPDATE_FN: &'static [u8] = b"quadruped_medium_alpha\0";
#[cfg_attr(feature = "be-dyn-lib", export_name = "quadruped_medium_alpha")]
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
global_time: Self::Dependency,
anim_time: f64,
_rate: &mut f32,
skeleton_attr: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let slower = (anim_time as f32 * 1.0 + PI).sin();
let wave_ultra_slow_cos = (anim_time as f32 * 1.0 + PI).cos();
let slow = (anim_time as f32 * 3.5 + PI).sin();
let wave_slow_cos = (anim_time as f32 * 3.5 + PI).cos();
let short = (((1.0)
/ (0.5 + 0.5 * ((anim_time as f32 * 2.0 + PI * 1.0).sin()).powf(2.0 as f32)))
.sqrt())
* ((anim_time as f32 * 2.0 + PI * 1.0).sin());
let look = Vec2::new(
((global_time + anim_time) as f32 / 8.0)
.floor()
.mul(7331.0)
.sin()
* 0.5,
((global_time + anim_time) as f32 / 8.0)
.floor()
.mul(1337.0)
.sin()
* 0.25,
);
let tailmove = Vec2::new(
((global_time + anim_time) as f32 / 2.0)
.floor()
.mul(7331.0)
.sin()
* 0.25,
((global_time + anim_time) as f32 / 2.0)
.floor()
.mul(1337.0)
.sin()
* 0.125,
);
let random = ((((2.0
* ((global_time as f32 - anim_time as f32)
- ((global_time as f32 - anim_time as f32).round())))
.abs())
* 10.0)
.round())
/ 10.0;
let switch = if random > 0.5 { 1.0 } else { -1.0 };
next.head_upper.offset = Vec3::new(
0.0,
skeleton_attr.head_upper.0 + 1.0 + short * 3.0,
skeleton_attr.head_upper.1,
);
next.head_upper.ori = Quaternion::rotation_y(short * -0.2 * switch)
* Quaternion::rotation_x(0.2 + short * 0.6);
next.head_upper.scale = Vec3::one();
next.head_lower.offset = Vec3::new(
0.0,
skeleton_attr.head_lower.0 + 2.0 + short * 3.0,
skeleton_attr.head_lower.1,
);
next.head_lower.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.head_lower.scale = Vec3::one() * 1.02;
next.jaw.offset = Vec3::new(0.0, skeleton_attr.jaw.0, skeleton_attr.jaw.1);
next.jaw.ori = Quaternion::rotation_x(0.5 + short * 1.0);
next.jaw.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) * Quaternion::rotation_x(0.0);
next.tail.scale = Vec3::one();
next.torso_front.offset = Vec3::new(
0.0,
skeleton_attr.torso_front.0 + short * 2.8,
skeleton_attr.torso_front.1 + short * 1.0,
) * skeleton_attr.scaler
/ 11.0;
next.torso_front.ori = Quaternion::rotation_y(short * -0.1 * switch);
next.torso_front.scale = Vec3::one() * skeleton_attr.scaler / 11.0;
next.torso_back.offset =
Vec3::new(0.0, skeleton_attr.torso_back.0, skeleton_attr.torso_back.1);
next.torso_back.ori = Quaternion::rotation_y(short * -0.1 * switch)
* Quaternion::rotation_z(0.0)
* Quaternion::rotation_x(0.0);
next.torso_back.scale = Vec3::one();
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.02;
if random > 0.5 {
next.leg_fl.offset = Vec3::new(
-skeleton_attr.leg_f.0,
skeleton_attr.leg_f.1,
skeleton_attr.leg_f.2,
);
next.leg_fl.ori =
Quaternion::rotation_x(short * -0.2) * Quaternion::rotation_y(short * 0.15);
next.leg_fl.scale = Vec3::one();
next.leg_fr.offset = Vec3::new(
skeleton_attr.leg_f.0,
skeleton_attr.leg_f.1,
skeleton_attr.leg_f.2 + 1.5,
);
next.leg_fr.ori = Quaternion::rotation_x(-0.1 + short * -0.2)
* Quaternion::rotation_y(0.2 + short * 0.2);
next.leg_fr.scale = Vec3::one();
next.leg_bl.offset = Vec3::new(
-skeleton_attr.leg_b.0,
skeleton_attr.leg_b.1,
skeleton_attr.leg_b.2 - 1.5,
);
next.leg_bl.ori =
Quaternion::rotation_x(-0.1 + short * -0.2) * Quaternion::rotation_y(short * 0.2);
next.leg_bl.scale = Vec3::one();
next.leg_br.offset = Vec3::new(
skeleton_attr.leg_b.0,
skeleton_attr.leg_b.1,
skeleton_attr.leg_b.2 + 1.0,
);
next.leg_br.ori = 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.offset = Vec3::new(
-skeleton_attr.feet_f.0,
skeleton_attr.feet_f.1,
skeleton_attr.feet_f.2 + short * -1.5,
);
next.foot_fl.ori = Quaternion::rotation_x(-0.5 + short * -0.1);
next.foot_fl.scale = Vec3::one();
next.foot_fr.offset = Vec3::new(
skeleton_attr.feet_f.0,
skeleton_attr.feet_f.1,
skeleton_attr.feet_f.2 + short * -1.5,
);
next.foot_fr.ori =
Quaternion::rotation_x(-0.2 + short * 0.2) * Quaternion::rotation_y(short * 0.15);
next.foot_fr.scale = Vec3::one();
next.foot_bl.offset = Vec3::new(
-skeleton_attr.feet_b.0,
skeleton_attr.feet_b.1,
skeleton_attr.feet_b.2 + short * -1.5,
);
next.foot_bl.ori =
Quaternion::rotation_x(-0.2 + short * 0.2) * Quaternion::rotation_y(short * 0.15);
next.foot_bl.scale = Vec3::one();
next.foot_br.offset = Vec3::new(
skeleton_attr.feet_b.0,
skeleton_attr.feet_b.1,
skeleton_attr.feet_b.2 + short * -1.5,
);
next.foot_br.ori =
Quaternion::rotation_x(-0.2 + short * 0.2) * Quaternion::rotation_y(short * 0.15);
next.foot_br.scale = Vec3::one();
} else {
next.leg_fl.offset = Vec3::new(
-skeleton_attr.leg_f.0,
skeleton_attr.leg_f.1,
skeleton_attr.leg_f.2 + 1.5,
);
next.leg_fl.ori = Quaternion::rotation_x(-0.1 + short * -0.2)
* Quaternion::rotation_y(0.2 + short * 0.2);
next.leg_fl.scale = Vec3::one();
next.leg_fr.offset = Vec3::new(
skeleton_attr.leg_f.0,
skeleton_attr.leg_f.1,
skeleton_attr.leg_f.2,
);
next.leg_fr.ori =
Quaternion::rotation_x(short * -0.2) * Quaternion::rotation_y(short * -0.15);
next.leg_fr.scale = Vec3::one();
next.leg_bl.offset = Vec3::new(
-skeleton_attr.leg_b.0,
skeleton_attr.leg_b.1,
skeleton_attr.leg_b.2 + 1.0,
);
next.leg_bl.ori = Quaternion::rotation_x(-0.1 + short * -0.2)
* Quaternion::rotation_y(0.1 + short * 0.2);
next.leg_bl.scale = Vec3::one();
next.leg_br.offset = Vec3::new(
skeleton_attr.leg_b.0,
skeleton_attr.leg_b.1,
skeleton_attr.leg_b.2 - 1.5,
);
next.leg_br.ori =
Quaternion::rotation_x(-0.1 + short * -0.2) * Quaternion::rotation_y(short * -0.2);
next.leg_br.scale = Vec3::one();
next.foot_fl.offset = Vec3::new(
-skeleton_attr.feet_f.0,
skeleton_attr.feet_f.1,
skeleton_attr.feet_f.2 + short * -1.5,
);
next.foot_fl.ori =
Quaternion::rotation_x(-0.2 + short * 0.2) * Quaternion::rotation_y(short * 0.15);
next.foot_fl.scale = Vec3::one();
next.foot_fr.offset = Vec3::new(
skeleton_attr.feet_f.0,
skeleton_attr.feet_f.1,
skeleton_attr.feet_f.2 + short * -1.5,
);
next.foot_fr.ori = Quaternion::rotation_x(-0.5 + short * -0.1);
next.foot_fr.scale = Vec3::one();
next.foot_bl.offset = Vec3::new(
-skeleton_attr.feet_b.0,
skeleton_attr.feet_b.1,
skeleton_attr.feet_b.2 + short * -1.5,
);
next.foot_bl.ori =
Quaternion::rotation_x(-0.2 + short * 0.2) * Quaternion::rotation_y(short * 0.15);
next.foot_bl.scale = Vec3::one();
next.foot_br.offset = Vec3::new(
skeleton_attr.feet_b.0,
skeleton_attr.feet_b.1,
skeleton_attr.feet_b.2 + short * -1.5,
);
next.foot_br.ori =
Quaternion::rotation_x(-0.2 + short * 0.2) * Quaternion::rotation_y(short * 0.15);
next.foot_br.scale = Vec3::one();
}
next
}
}

View File

@ -85,9 +85,10 @@ impl Animation for IdleAnimation {
0.0,
skeleton_attr.torso_front.0,
skeleton_attr.torso_front.1 + slower * 0.3,
) *skeleton_attr.scaler/11.0;
) * skeleton_attr.scaler
/ 11.0;
next.torso_front.ori = Quaternion::rotation_y(slow * 0.02);
next.torso_front.scale = Vec3::one() *skeleton_attr.scaler/11.0;
next.torso_front.scale = Vec3::one() * skeleton_attr.scaler / 11.0;
next.torso_back.offset = Vec3::new(
0.0,

View File

@ -1,9 +1,12 @@
pub mod alpha;
pub mod idle;
pub mod jump;
pub mod run;
// Reexports
pub use self::{idle::IdleAnimation, jump::JumpAnimation, run::RunAnimation};
pub use self::{
alpha::AlphaAnimation, idle::IdleAnimation, jump::JumpAnimation, run::RunAnimation,
};
use super::{Bone, FigureBoneData, Skeleton};
use common::comp::{self};
@ -166,10 +169,10 @@ impl<'a> From<&'a comp::quadruped_medium::Body> for SkeletonAttr {
Self {
head_upper: match (body.species, body.body_type) {
(Grolgar, _) => (-8.0, 1.5),
(Saber, _) => (-11.0, -3.0),
(Tuskram, _) => (6.0, 1.0),
(Lion, _) => (12.0, 2.0),
(Tarasque, _) => (5.5, 3.5),
(Saber, _) => (0.0, -3.0),
(Tuskram, _) => (2.0, 1.0),
(Lion, _) => (2.5, 2.0),
(Tarasque, _) => (-5.5, 3.5),
(Tiger, _) => (2.0, 1.0),
(Wolf, _) => (-0.5, 3.0),
(Frostfang, _) => (1.0, -2.0),
@ -188,10 +191,10 @@ impl<'a> From<&'a comp::quadruped_medium::Body> for SkeletonAttr {
},
jaw: match (body.species, body.body_type) {
(Grolgar, _) => (-2.5, 0.5),
(Saber, _) => (18.0, -1.0),
(Tuskram, _) => (4.0, -4.0),
(Lion, _) => (0.0, -4.5),
(Tarasque, _) => (9.0, -10.0),
(Saber, _) => (12.0, -2.0),
(Tuskram, _) => (10.0, -4.0),
(Lion, _) => (9.0, -4.5),
(Tarasque, _) => (17.5, -10.0),
(Tiger, _) => (7.0, -4.0),
(Wolf, _) => (5.0, -3.0),
(Frostfang, _) => (5.0, -3.0),
@ -232,10 +235,10 @@ impl<'a> From<&'a comp::quadruped_medium::Body> for SkeletonAttr {
},
ears: match (body.species, body.body_type) {
(Grolgar, _) => (5.0, 9.5),
(Saber, _) => (13.0, 7.0),
(Tuskram, _) => (1.5, 9.5),
(Lion, _) => (-8.0, 4.5),
(Tarasque, _) => (3.0, 1.0),
(Saber, _) => (12.0, 7.0),
(Tuskram, _) => (5.5, 12.5),
(Lion, _) => (2.0, 4.5),
(Tarasque, _) => (11.0, 1.0),
(Tiger, _) => (2.5, 5.0),
(Wolf, _) => (3.0, 5.0),
(Frostfang, _) => (2.0, 5.0),

View File

@ -24,7 +24,11 @@ impl Animation for RunAnimation {
*rate = 1.0;
let lab = 0.6;
let speedmult = if speed > 8.0 { 1.2* (1.0/skeleton_attr.scaler) } else { 1.0*(1.0/skeleton_attr.scaler) };
let speedmult = if speed > 8.0 {
1.2 * (1.0 / skeleton_attr.scaler)
} else {
1.0 * (1.0 / skeleton_attr.scaler)
};
let short = (((1.0)
/ (0.72
@ -107,7 +111,7 @@ impl Animation for RunAnimation {
.max(0.2);
let horichest = (anim_time as f32 * lab as f32 * speedmult + PI * 0.8).sin();
//
//
let ori = Vec2::from(orientation);
let last_ori = Vec2::from(last_ori);
let tilt = if Vec2::new(ori, last_ori)
@ -121,12 +125,12 @@ impl Animation for RunAnimation {
} else {
0.0
} * 1.3;
//let tilt = 0.0;
//let tilt = 0.0;
if speed < 8.0 {
//Trot
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(0.0) * Quaternion::rotation_z(tilt *-1.2);
next.head_upper.ori = Quaternion::rotation_x(0.0) * Quaternion::rotation_z(tilt * -1.2);
next.head_upper.scale = Vec3::one();
next.head_lower.offset = Vec3::new(
@ -134,7 +138,7 @@ impl Animation for RunAnimation {
skeleton_attr.head_lower.0 + horichest * 0.4,
skeleton_attr.head_lower.1 + vertchest * -0.8,
);
next.head_lower.ori = Quaternion::rotation_z(tilt *-0.8);
next.head_lower.ori = Quaternion::rotation_z(tilt * -0.8);
next.head_lower.scale = Vec3::one() * 1.02;
next.jaw.offset = Vec3::new(0.0, skeleton_attr.jaw.0, skeleton_attr.jaw.1);
@ -142,20 +146,23 @@ impl Animation for RunAnimation {
next.jaw.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_x(shortalt * 0.08)* Quaternion::rotation_z(tilt *1.5);
next.tail.ori =
Quaternion::rotation_x(shortalt * 0.08) * Quaternion::rotation_z(tilt * 1.5);
next.tail.scale = Vec3::one();
next.torso_front.offset = Vec3::new(
0.0,
skeleton_attr.torso_front.0,
skeleton_attr.torso_front.1 + shortalt * 0.8,
) *skeleton_attr.scaler/11.0;
) * skeleton_attr.scaler
/ 11.0;
next.torso_front.ori = Quaternion::rotation_x(short * 0.03);
next.torso_front.scale = Vec3::one() *skeleton_attr.scaler/11.0;
next.torso_front.scale = Vec3::one() * skeleton_attr.scaler / 11.0;
next.torso_back.offset =
Vec3::new(0.0, skeleton_attr.torso_back.0, skeleton_attr.torso_back.1);
next.torso_back.ori = Quaternion::rotation_x(short * -0.03)*Quaternion::rotation_z(tilt*1.8);
next.torso_back.ori =
Quaternion::rotation_x(short * -0.03) * Quaternion::rotation_z(tilt * 1.8);
next.torso_back.scale = Vec3::one();
next.ears.offset = Vec3::new(0.0, skeleton_attr.ears.0, skeleton_attr.ears.1);
@ -168,7 +175,8 @@ impl Animation for RunAnimation {
skeleton_attr.leg_f.1 + foothoril * -1.0,
skeleton_attr.leg_f.2 + footvertl * -0.4,
);
next.leg_fl.ori = Quaternion::rotation_x(footrotl * -0.3)*Quaternion::rotation_z(tilt * -1.5);
next.leg_fl.ori =
Quaternion::rotation_x(footrotl * -0.3) * Quaternion::rotation_z(tilt * -1.5);
next.leg_fl.scale = Vec3::one() * 0.99;
next.leg_fr.offset = Vec3::new(
@ -176,7 +184,8 @@ impl Animation for RunAnimation {
skeleton_attr.leg_f.1 + foothorir * -1.0,
skeleton_attr.leg_f.2 + footvertr * -0.4,
);
next.leg_fr.ori = Quaternion::rotation_x(footrotr * -0.3)*Quaternion::rotation_z(tilt * -1.5);
next.leg_fr.ori =
Quaternion::rotation_x(footrotr * -0.3) * Quaternion::rotation_z(tilt * -1.5);
next.leg_fr.scale = Vec3::one() * 0.99;
next.leg_bl.offset = Vec3::new(
@ -184,7 +193,8 @@ impl Animation for RunAnimation {
skeleton_attr.leg_b.1 + foothorilb * -1.0,
skeleton_attr.leg_b.2 + footvertlb * -0.4,
);
next.leg_bl.ori = Quaternion::rotation_x(footrotlb * -0.3)*Quaternion::rotation_z(tilt * -1.5);
next.leg_bl.ori =
Quaternion::rotation_x(footrotlb * -0.3) * Quaternion::rotation_z(tilt * -1.5);
next.leg_bl.scale = Vec3::one() * 0.99;
next.leg_br.offset = Vec3::new(
@ -192,7 +202,8 @@ impl Animation for RunAnimation {
skeleton_attr.leg_b.1 + foothorirb * -1.0,
skeleton_attr.leg_b.2 + footvertrb * -0.4,
);
next.leg_br.ori = Quaternion::rotation_x(footrotrb * -0.3)*Quaternion::rotation_z(tilt * -1.5);
next.leg_br.ori =
Quaternion::rotation_x(footrotrb * -0.3) * Quaternion::rotation_z(tilt * -1.5);
next.leg_br.scale = Vec3::one() * 0.99;
next.foot_fl.offset = Vec3::new(
@ -230,7 +241,8 @@ impl Animation for RunAnimation {
//Gallop
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(0.0) * Quaternion::rotation_z(tilt *-1.2);
next.head_upper.ori =
Quaternion::rotation_x(short * -0.18) * Quaternion::rotation_z(tilt * -1.2);
next.head_upper.scale = Vec3::one();
next.head_lower.offset = Vec3::new(
@ -238,7 +250,7 @@ impl Animation for RunAnimation {
skeleton_attr.head_lower.0 + horichest * 0.4,
skeleton_attr.head_lower.1 + vertchest * -0.8,
);
next.head_lower.ori = Quaternion::rotation_z(tilt *-0.8);
next.head_lower.ori = Quaternion::rotation_z(tilt * -0.8);
next.head_lower.scale = Vec3::one() * 1.02;
next.jaw.offset = Vec3::new(0.0, skeleton_attr.jaw.0, skeleton_attr.jaw.1);
@ -246,20 +258,24 @@ impl Animation for RunAnimation {
next.jaw.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_x(shortalt * 0.3)*Quaternion::rotation_z(tilt * 1.5);
next.tail.ori =
Quaternion::rotation_x(shortalt * 0.3) * Quaternion::rotation_z(tilt * 1.5);
next.tail.scale = Vec3::one();
next.torso_front.offset = Vec3::new(
0.0,
skeleton_attr.torso_front.0,
skeleton_attr.torso_front.1 + shortalt * 2.0,
) *skeleton_attr.scaler/11.0;
next.torso_front.ori = Quaternion::rotation_x(short * 0.13)*Quaternion::rotation_z(tilt * -1.5);
next.torso_front.scale = Vec3::one() *skeleton_attr.scaler/11.0;
) * skeleton_attr.scaler
/ 11.0;
next.torso_front.ori =
Quaternion::rotation_x(short * 0.13) * Quaternion::rotation_z(tilt * -1.5);
next.torso_front.scale = Vec3::one() * skeleton_attr.scaler / 11.0;
next.torso_back.offset =
Vec3::new(0.0, skeleton_attr.torso_back.0, skeleton_attr.torso_back.1);
next.torso_back.ori = Quaternion::rotation_x(short * 0.1)*Quaternion::rotation_z(tilt*1.8);
next.torso_back.ori =
Quaternion::rotation_x(short * 0.1) * Quaternion::rotation_z(tilt * 1.8);
next.torso_back.scale = Vec3::one();
next.ears.offset = Vec3::new(0.0, skeleton_attr.ears.0, skeleton_attr.ears.1);
@ -272,7 +288,8 @@ impl Animation for RunAnimation {
skeleton_attr.leg_f.1 + foothoril * -2.5,
skeleton_attr.leg_f.2 + 1.0 + footvertl * -1.0,
);
next.leg_fl.ori = Quaternion::rotation_x(footrotl * -0.6)*Quaternion::rotation_z(tilt * -0.5);
next.leg_fl.ori =
Quaternion::rotation_x(footrotl * -0.6) * Quaternion::rotation_z(tilt * -0.5);
next.leg_fl.scale = Vec3::one() * 0.99;
next.leg_fr.offset = Vec3::new(
@ -280,7 +297,8 @@ impl Animation for RunAnimation {
skeleton_attr.leg_f.1 + foothoril * -2.5,
skeleton_attr.leg_f.2 + 1.0 + footvertl * -1.0,
);
next.leg_fr.ori = Quaternion::rotation_x(footrotl * -0.6)*Quaternion::rotation_z(tilt * -0.5);
next.leg_fr.ori =
Quaternion::rotation_x(footrotl * -0.6) * Quaternion::rotation_z(tilt * -0.5);
next.leg_fr.scale = Vec3::one() * 0.99;
next.leg_bl.offset = Vec3::new(
@ -288,7 +306,8 @@ impl Animation for RunAnimation {
skeleton_attr.leg_b.1 + foothorirb * -2.5,
skeleton_attr.leg_b.2 + 1.0 + footvertrb * -1.2,
);
next.leg_bl.ori = Quaternion::rotation_x(footrotrb * -0.6)*Quaternion::rotation_z(tilt * -1.5);
next.leg_bl.ori =
Quaternion::rotation_x(footrotrb * -0.6) * Quaternion::rotation_z(tilt * -1.5);
next.leg_bl.scale = Vec3::one() * 0.99;
next.leg_br.offset = Vec3::new(
@ -296,7 +315,8 @@ impl Animation for RunAnimation {
skeleton_attr.leg_b.1 + foothorirb * -2.5,
skeleton_attr.leg_b.2 + 1.0 + footvertrb * -1.2,
);
next.leg_br.ori = Quaternion::rotation_x(footrotrb * -0.6)*Quaternion::rotation_z(tilt * -1.5);
next.leg_br.ori =
Quaternion::rotation_x(footrotrb * -0.6) * Quaternion::rotation_z(tilt * -1.5);
next.leg_br.scale = Vec3::one() * 0.99;
next.foot_fl.offset = Vec3::new(

View File

@ -911,7 +911,6 @@ impl FigureMgr {
&mut state_animation_rate,
skeleton_attr,
),
// TODO!
_ => state.skeleton_mut().clone(),
};
@ -975,15 +974,13 @@ impl FigureMgr {
)
},
// Running
(true, true, false) => {
anim::quadruped_medium::RunAnimation::update_skeleton(
&QuadrupedMediumSkeleton::new(),
(vel.0.magnitude(), ori, state.last_ori, time),
state.state_time,
&mut state_animation_rate,
skeleton_attr,
)
},
(true, true, _) => anim::quadruped_medium::RunAnimation::update_skeleton(
&QuadrupedMediumSkeleton::new(),
(vel.0.magnitude(), ori, state.last_ori, time),
state.state_time,
&mut state_animation_rate,
skeleton_attr,
),
// In air
(false, _, false) => {
anim::quadruped_medium::JumpAnimation::update_skeleton(
@ -994,12 +991,29 @@ impl FigureMgr {
skeleton_attr,
)
},
_ => anim::quadruped_medium::IdleAnimation::update_skeleton(
&QuadrupedMediumSkeleton::new(),
time,
state.state_time,
&mut state_animation_rate,
skeleton_attr,
),
};
let target_bones = match &character {
CharacterState::BasicMelee(_) => {
anim::quadruped_medium::AlphaAnimation::update_skeleton(
&target_base,
time,
state.state_time,
&mut state_animation_rate,
skeleton_attr,
)
},
// TODO!
_ => state.skeleton_mut().clone(),
_ => target_base,
};
state.skeleton.interpolate(&target_base, dt);
state.skeleton.interpolate(&target_bones, dt);
state.update(
renderer,
pos.0,