fixed jump anim bug and non-attack bug for bipedlarge

This commit is contained in:
Justin Shipsey 2020-08-14 10:50:08 +00:00 committed by Songtronix
parent 26a8205316
commit bdc05accbe
40 changed files with 353 additions and 133 deletions

@ -1,15 +1,15 @@
({
(Ogre, Male): (
head: (
offset: (-8.0, -5.0, -6.0),
offset: (-8.0, -6.0, -6.5),
center: ("npc.ogre.male.head"),
),
torso_upper: (
offset: (-8.0, -4.5, -5.0),
offset: (-8.0, -6.0, -8.0),
center: ("npc.ogre.male.torso_upper"),
),
torso_lower: (
offset: (-5.0, -4.5, -9.0),
offset: (-6.0, -5.5, -10.0),
center: ("npc.ogre.male.torso_lower"),
),
jaw: (
@ -25,22 +25,22 @@
center: ("armor.empty"),
),
main: (
offset: (-8.0, -4.5, -5.0),
center: ("armor.empty"),
offset: (-5.0, -5.5, -5.0),
center: ("npc.ogre.male.hammer"),
)
),
(Ogre, Female): (
head: (
offset: (-8.0, -5.0, -6.0),
center: ("npc.ogre.male.head"),
offset: (-9.0, -5.5, -6.0),
center: ("npc.ogre.female..head"),
),
torso_upper: (
offset: (-8.0, -4.5, -5.0),
center: ("npc.ogre.male.torso_upper"),
offset: (-6.0, -5.0, -6.0),
center: ("npc.ogre.female.torso_upper"),
),
torso_lower: (
offset: (-5.0, -4.5, -9.0),
center: ("npc.ogre.male.torso_lower"),
offset: (-5.0, -4.5, -6.0),
center: ("npc.ogre.female.torso_lower"),
),
jaw: (
offset: (0.0, 0.0, 0.0),
@ -55,8 +55,8 @@
center: ("armor.empty"),
),
main: (
offset: (-8.0, -4.5, -5.0),
center: ("armor.empty"),
offset: (-2.5, -5.5, -5.0),
center: ("npc.ogre.female.main"),
)
),
(Cyclops, Male): (
@ -116,7 +116,7 @@
),
main: (
offset: (-5.0, -6.5, -4.0),
center: ("npc.cyclops.male.hammer"),
center: ("npc.cyclops.female.hammer"),
)
),
(Wendigo, Male): (
@ -145,8 +145,8 @@
center: ("armor.empty"),
),
main: (
offset: (-8.0, -4.5, -5.0),
center: ("armor.empty"),
offset: (-5.0, -6.5, -4.0),
center: ("npc.wendigo.male.hammer"),
)
),
(Wendigo, Female): (
@ -175,8 +175,8 @@
center: ("armor.empty"),
),
main: (
offset: (-8.0, -4.5, -5.0),
center: ("armor.empty"),
offset: (-5.0, -6.5, -4.0),
center: ("npc.wendigo.male.hammer"),
)
),
(Troll, Male): (
@ -205,8 +205,8 @@
center: ("armor.empty"),
),
main: (
offset: (-8.0, -4.5, -5.0),
center: ("armor.empty"),
offset: (-5.0, -6.5, -4.0),
center: ("npc.troll.male.hammer"),
)
),
(Troll, Female): (
@ -235,8 +235,8 @@
center: ("armor.empty"),
),
main: (
offset: (-8.0, -4.5, -5.0),
center: ("armor.empty"),
offset: (-5.0, -6.5, -4.0),
center: ("npc.troll.female.hammer"),
)
),
@ -267,8 +267,8 @@
center: ("armor.empty"),
),
main: (
offset: (-1.5, -9.0, -10.0),
center: ("npc.dullahan.male.sword"),
offset: (-5.0, -6.5, -4.0),
center: ("npc.cyclops.male.hammer"),
)
),
@ -298,8 +298,8 @@
center: ("armor.empty"),
),
main: (
offset: (-1.5, -9.0, -10.0),
center: ("npc.dullahan.male.sword"),
offset: (-5.0, -6.5, -4.0),
center: ("npc.cyclops.male.hammer"),
)
),
})

@ -1,70 +1,70 @@
({
(Ogre, Male): (
shoulder_l: (
offset: (-4.0, -5.5, -4.0),
lateral: ("armor.empty"),
offset: (-6.0, -3.5, -4.0),
lateral: ("npc.ogre.male.shoulder_l"),
),
shoulder_r: (
offset: (-4.0, -5.5, -4.0),
offset: (-6.0, -4.5, -4.0),
lateral: ("npc.ogre.male.shoulder_r"),
),
hand_l: (
offset: (-2.5, -2.5, -11.0),
offset: (-5.5, -3.5, -15.0),
lateral: ("npc.ogre.male.hand_l"),
),
hand_r: (
offset: (-2.5, -2.5, -11.0),
offset: (-5.5, -3.5, -15.0),
lateral: ("npc.ogre.male.hand_r"),
),
leg_l: (
offset: (-6.0, -3.5, -7.0),
offset: (-6.0, -3.5, -8.0),
lateral: ("npc.ogre.male.leg_l"),
),
leg_r: (
offset: (0.0, -3.5, -7.0),
offset: (0.0, -3.5, -8.0),
lateral: ("npc.ogre.male.leg_r"),
),
foot_l: (
offset: (-3.0, -5.0, -2.5),
offset: (-3.0, -5.0, -8.0),
lateral: ("npc.ogre.male.foot_l"),
),
foot_r: (
offset: (-3.0, -5.0, -2.5),
offset: (-3.0, -5.5, -8.0),
lateral: ("npc.ogre.male.foot_r"),
),
),
(Ogre, Female): (
shoulder_l: (
offset: (-4.0, -5.5, -4.0),
lateral: ("armor.empty"),
offset: (-3.0, -3.0, -3.5),
lateral: ("npc.ogre.female.shoulder_l"),
),
shoulder_r: (
offset: (-4.0, -5.5, -4.0),
lateral: ("npc.ogre.male.shoulder_r"),
offset: (-3.0, -3.0, -3.5),
lateral: ("npc.ogre.female.shoulder_r"),
),
hand_l: (
offset: (-2.5, -2.5, -11.0),
lateral: ("npc.ogre.male.hand_l"),
offset: (-3.0, -3.0, -8.0),
lateral: ("npc.ogre.female.hand_l"),
),
hand_r: (
offset: (-2.5, -2.5, -11.0),
lateral: ("npc.ogre.male.hand_r"),
offset: (-3.0, -3.0, -8.0),
lateral: ("npc.ogre.female.hand_r"),
),
leg_l: (
offset: (-6.0, -3.5, -7.0),
lateral: ("npc.ogre.male.leg_l"),
offset: (-7.0, -3.5, -11.0),
lateral: ("npc.ogre.female.leg_l"),
),
leg_r: (
offset: (0.0, -3.5, -7.0),
lateral: ("npc.ogre.male.leg_r"),
offset: (0.0, -3.5, -11.0),
lateral: ("npc.ogre.female.leg_r"),
),
foot_l: (
offset: (-3.0, -5.0, -2.5),
lateral: ("npc.ogre.male.foot_l"),
offset: (-3.0, -5.0, -8.0),
lateral: ("npc.ogre.female.foot_l"),
),
foot_r: (
offset: (-3.0, -5.0, -2.5),
lateral: ("npc.ogre.male.foot_r"),
offset: (-3.0, -5.0, -8.0),
lateral: ("npc.ogre.female.foot_r"),
),
),
(Cyclops, Male): (

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -8,7 +8,7 @@ edition = "2018"
name = "voxygen_anim"
# Uncomment to use animation hot reloading
# Note: this breaks `cargo test`
#crate-type = ["lib", "cdylib"]
# crate-type = ["lib", "cdylib"]
[features]
use-dyn-lib = ["libloading", "notify", "lazy_static", "tracing", "find_folder"]

@ -0,0 +1,213 @@
use super::{super::Animation, BipedLargeSkeleton, SkeletonAttr};
use std::f32::consts::PI;
use vek::*;
pub struct AlphaAnimation;
impl Animation for AlphaAnimation {
type Dependency = (f32, f64);
type Skeleton = BipedLargeSkeleton;
#[cfg(feature = "use-dyn-lib")]
const UPDATE_FN: &'static [u8] = b"biped_large_alpha\0";
#[cfg_attr(feature = "be-dyn-lib", export_name = "biped_large_alpha")]
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
(velocity, _global_time): Self::Dependency,
anim_time: f64,
_rate: &mut f32,
skeleton_attr: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let lab = 0.55;
let slower = (((1.0)
/ (0.05
+ 0.95
* ((anim_time as f32 * lab as f32 * 10.0 - 0.8 * PI).sin()).powf(2.0 as f32)))
.sqrt())
* ((anim_time as f32 * lab as f32 * 10.0 - 0.8 * PI).sin());
let slowersmooth = (anim_time as f32 * lab as f32 * 4.0).sin();
let foothoril = (((1.0)
/ (0.4
+ (0.6)
* ((anim_time as f32 * 16.0 * lab as f32 + PI * 1.4).sin()).powf(2.0 as f32)))
.sqrt())
* ((anim_time as f32 * 16.0 * lab as f32 + PI * 1.4).sin());
let foothorir = (((1.0)
/ (0.4
+ (0.6)
* ((anim_time as f32 * 16.0 * lab as f32 + PI * 0.4).sin()).powf(2.0 as f32)))
.sqrt())
* ((anim_time as f32 * 16.0 * lab as f32 + PI * 0.4).sin());
let footrotl = (((5.0)
/ (2.5
+ (2.5)
* ((anim_time as f32 * 16.0 * lab as f32 + PI * 1.4).sin()).powf(2.0 as f32)))
.sqrt())
* ((anim_time as f32 * 16.0 * lab as f32 + PI * 1.4).sin());
let footrotr = (((5.0)
/ (1.0
+ (4.0)
* ((anim_time as f32 * 16.0 * lab as f32 + PI * 0.4).sin()).powf(2.0 as f32)))
.sqrt())
* ((anim_time as f32 * 16.0 * lab as f32 + PI * 0.4).sin());
let short = (anim_time as f32 * lab as f32 * 16.0).sin();
next.head.offset = Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1) * 1.02;
next.head.ori = Quaternion::rotation_z(slower * 1.0) * Quaternion::rotation_x(0.0);
next.head.scale = Vec3::one() * 1.02;
next.main.offset = Vec3::new(0.0, 0.0, 0.0);
next.main.ori = Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(-1.57)
* Quaternion::rotation_z(1.0);
next.main.scale = Vec3::one() * 1.02;
next.second.offset = Vec3::new(0.0, 0.0, 0.0);
next.second.ori =
Quaternion::rotation_x(PI) * Quaternion::rotation_y(0.0) * Quaternion::rotation_z(0.0);
next.second.scale = Vec3::one() * 0.0;
next.hand_l.offset = Vec3::new(
-skeleton_attr.hand.0 - 7.0,
skeleton_attr.hand.1 - 7.0,
skeleton_attr.hand.2 + 10.0,
);
next.hand_l.ori = Quaternion::rotation_x(0.57) * Quaternion::rotation_z(1.57);
next.hand_l.scale = Vec3::one() * 1.02;
next.hand_r.offset = Vec3::new(
skeleton_attr.hand.0 - 7.0,
skeleton_attr.hand.1 - 7.0,
skeleton_attr.hand.2 + 10.0,
);
next.hand_r.ori = Quaternion::rotation_x(0.57) * Quaternion::rotation_z(1.57);
next.hand_r.scale = Vec3::one() * 1.02;
next.upper_torso.offset = Vec3::new(
0.0,
skeleton_attr.upper_torso.0,
skeleton_attr.upper_torso.1,
);
next.upper_torso.ori = Quaternion::rotation_z(slower * -1.2) * Quaternion::rotation_x(-0.3);
next.upper_torso.scale = Vec3::one();
next.control.offset = Vec3::new(7.0, 9.0, -10.0);
next.control.ori = Quaternion::rotation_x(slowersmooth * 0.35)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(slowersmooth * -0.5 + slower * -0.5);
next.control.scale = Vec3::one();
if velocity < 0.5 {
next.lower_torso.offset = Vec3::new(
0.0,
skeleton_attr.lower_torso.0,
skeleton_attr.lower_torso.1,
);
next.lower_torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.2);
next.lower_torso.scale = Vec3::one() * 1.02;
next.jaw.offset = Vec3::new(0.0, skeleton_attr.jaw.0, skeleton_attr.jaw.1 * 0.0);
next.jaw.ori = Quaternion::rotation_z(0.0);
next.jaw.scale = Vec3::one();
next.tail.offset = Vec3::new(0.0, skeleton_attr.tail.0, skeleton_attr.tail.1);
next.tail.ori = Quaternion::rotation_z(0.0);
next.tail.scale = Vec3::one();
next.shoulder_l.offset = Vec3::new(
-skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1,
skeleton_attr.shoulder.2,
);
next.shoulder_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.shoulder_l.scale = Vec3::one();
next.shoulder_r.offset = Vec3::new(
skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1,
skeleton_attr.shoulder.2,
);
next.shoulder_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.shoulder_r.scale = Vec3::one();
next.leg_l.offset = Vec3::new(
-skeleton_attr.leg.0,
skeleton_attr.leg.1,
skeleton_attr.leg.2,
) * 1.02;
next.leg_l.ori = Quaternion::rotation_z(0.0);
next.leg_l.scale = Vec3::one() * 1.02;
next.leg_r.offset = Vec3::new(
skeleton_attr.leg.0,
skeleton_attr.leg.1,
skeleton_attr.leg.2,
) * 1.02;
next.leg_r.ori = Quaternion::rotation_z(0.0);
next.leg_r.scale = Vec3::one() * 1.02;
next.foot_l.offset = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1,
skeleton_attr.foot.2,
) / 8.0;
next.foot_l.ori = Quaternion::rotation_z(0.0);
next.foot_l.scale = Vec3::one() / 8.0;
next.foot_r.offset = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1,
skeleton_attr.foot.2,
) / 8.0;
next.foot_r.ori = Quaternion::rotation_z(0.0);
next.foot_r.scale = Vec3::one() / 8.0;
next.torso.offset = Vec3::new(0.0, 0.0, 0.0) / 8.0;
next.torso.ori = Quaternion::rotation_z(0.0);
next.torso.scale = Vec3::one() / 8.0;
} else {
next.lower_torso.offset = Vec3::new(
0.0,
skeleton_attr.lower_torso.0,
skeleton_attr.lower_torso.1,
);
next.lower_torso.ori =
Quaternion::rotation_z(short * 0.15) * Quaternion::rotation_x(0.14);
next.lower_torso.scale = Vec3::one() * 1.02;
next.shoulder_l.offset = Vec3::new(
-skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1 + foothoril * -1.0,
skeleton_attr.shoulder.2,
);
next.shoulder_l.ori = Quaternion::rotation_x(0.5 + footrotl * -0.16)
* Quaternion::rotation_y(0.1)
* Quaternion::rotation_z(footrotl * 0.1);
next.shoulder_l.scale = Vec3::one();
next.shoulder_r.offset = Vec3::new(
skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1 + foothorir * -1.0,
skeleton_attr.shoulder.2,
);
next.shoulder_r.ori = Quaternion::rotation_x(0.5 + footrotr * -0.16)
* Quaternion::rotation_y(-0.1)
* Quaternion::rotation_z(footrotr * -0.1);
next.shoulder_r.scale = Vec3::one();
next.torso.offset = Vec3::new(0.0, 0.0, 0.0) / 8.0;
next.torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(-0.25);
next.torso.scale = Vec3::one() / 8.0;
}
next
}
}

@ -1,11 +1,11 @@
use super::{super::Animation, BipedLargeSkeleton, SkeletonAttr};
//use std::f32::consts::PI;
use std::f32::consts::PI;
use vek::*;
pub struct JumpAnimation;
impl Animation for JumpAnimation {
type Dependency = (f32, f64);
type Dependency = f64;
type Skeleton = BipedLargeSkeleton;
#[cfg(feature = "use-dyn-lib")]
@ -15,46 +15,73 @@ impl Animation for JumpAnimation {
fn update_skeleton_inner(
skeleton: &Self::Skeleton,
_global_time: Self::Dependency,
_anim_time: f64,
anim_time: f64,
_rate: &mut f32,
skeleton_attr: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
next.head.offset = Vec3::new(0.0, skeleton_attr.head.0, skeleton_attr.head.1) * 1.02;
let lab = 1.0;
let torso = (anim_time as f32 * lab as f32 + 1.5 * PI).sin();
let wave_slow = (anim_time as f32 * 0.8).sin();
next.head.offset = Vec3::new(
0.0,
skeleton_attr.head.0,
skeleton_attr.head.1 + torso * 0.2,
) * 1.02;
next.head.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.head.scale = Vec3::one() * 1.02;
next.upper_torso.offset = Vec3::new(
0.0,
skeleton_attr.upper_torso.0,
skeleton_attr.upper_torso.1,
) / 8.0;
next.upper_torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.upper_torso.scale = Vec3::one() / 8.0;
skeleton_attr.upper_torso.1 + torso * 0.5,
);
next.upper_torso.ori = Quaternion::rotation_x(-0.3);
next.upper_torso.scale = Vec3::one();
next.lower_torso.offset = Vec3::new(
0.0,
skeleton_attr.lower_torso.0,
skeleton_attr.lower_torso.1,
skeleton_attr.lower_torso.1 + torso * 0.15,
);
next.lower_torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.lower_torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.2);
next.lower_torso.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_z(0.0);
next.jaw.ori = Quaternion::rotation_x(wave_slow * 0.09);
next.jaw.scale = Vec3::one();
next.tail.offset = Vec3::new(0.0, skeleton_attr.tail.0, skeleton_attr.tail.1 * 0.0);
next.tail.offset = Vec3::new(
0.0,
skeleton_attr.tail.0,
skeleton_attr.tail.1 + torso * 0.0,
);
next.tail.ori = Quaternion::rotation_z(0.0);
next.tail.scale = Vec3::one();
next.control.offset = Vec3::new(0.0, 0.0, 0.0);
next.control.ori = Quaternion::rotation_z(0.0);
next.control.scale = Vec3::one();
next.second.offset = Vec3::new(0.0, 0.0, 0.0);
next.second.ori =
Quaternion::rotation_x(PI) * Quaternion::rotation_y(0.0) * Quaternion::rotation_z(0.0);
next.second.scale = Vec3::one() * 0.0;
next.main.offset = Vec3::new(-5.0, -7.0, 7.0);
next.main.ori =
Quaternion::rotation_x(PI) * Quaternion::rotation_y(0.6) * Quaternion::rotation_z(1.57);
next.main.scale = Vec3::one() * 1.02;
next.shoulder_l.offset = Vec3::new(
-skeleton_attr.shoulder.0,
skeleton_attr.shoulder.1,
skeleton_attr.shoulder.2,
);
next.shoulder_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.shoulder_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.5);
next.shoulder_l.scale = Vec3::one();
next.shoulder_r.offset = Vec3::new(
@ -62,60 +89,61 @@ impl Animation for JumpAnimation {
skeleton_attr.shoulder.1,
skeleton_attr.shoulder.2,
);
next.shoulder_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.shoulder_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(-0.5);
next.shoulder_r.scale = Vec3::one();
next.hand_l.offset = Vec3::new(
-skeleton_attr.hand.0,
skeleton_attr.hand.1,
skeleton_attr.hand.2,
skeleton_attr.hand.2 + torso * 0.6,
);
next.hand_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.hand_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.8);
next.hand_l.scale = Vec3::one() * 1.02;
next.hand_r.offset = Vec3::new(
skeleton_attr.hand.0,
skeleton_attr.hand.1,
skeleton_attr.hand.2,
skeleton_attr.hand.2 + torso * 0.6,
);
next.hand_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.hand_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(-0.8);
next.hand_r.scale = Vec3::one() * 1.02;
next.leg_l.offset = Vec3::new(
-skeleton_attr.leg.0,
skeleton_attr.leg.1,
skeleton_attr.leg.2,
skeleton_attr.leg.2 + torso * 0.2,
) * 1.02;
next.leg_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.leg_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(-0.4);
next.leg_l.scale = Vec3::one() * 1.02;
next.leg_r.offset = Vec3::new(
skeleton_attr.leg.0,
skeleton_attr.leg.1,
skeleton_attr.leg.2,
skeleton_attr.leg.2 + torso * 0.2,
) * 1.02;
next.leg_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.leg_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.4);
next.leg_r.scale = Vec3::one() * 1.02;
next.foot_l.offset = Vec3::new(
-skeleton_attr.foot.0,
skeleton_attr.foot.1,
-5.0 + skeleton_attr.foot.1,
skeleton_attr.foot.2,
) / 8.0;
next.foot_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.foot_l.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(-0.4);
next.foot_l.scale = Vec3::one() / 8.0;
next.foot_r.offset = Vec3::new(
skeleton_attr.foot.0,
skeleton_attr.foot.1,
5.0 + skeleton_attr.foot.1,
skeleton_attr.foot.2,
) / 8.0;
next.foot_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.foot_r.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.4);
next.foot_r.scale = Vec3::one() / 8.0;
next.torso.offset = Vec3::new(0.0, 0.0, 0.0);
next.torso.offset = Vec3::new(0.0, 0.0, 0.0) / 8.0;
next.torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0);
next.torso.scale = Vec3::one();
next.torso.scale = Vec3::one() / 8.0;
next
}
}

@ -1,3 +1,4 @@
pub mod alpha;
pub mod idle;
pub mod jump;
pub mod run;
@ -5,7 +6,8 @@ pub mod wield;
// Reexports
pub use self::{
idle::IdleAnimation, jump::JumpAnimation, run::RunAnimation, wield::WieldAnimation,
alpha::AlphaAnimation, idle::IdleAnimation, jump::JumpAnimation, run::RunAnimation,
wield::WieldAnimation,
};
use super::{Bone, FigureBoneData, Skeleton};
@ -71,12 +73,12 @@ impl Skeleton for BipedLargeSkeleton {
FigureBoneData::new(torso_mat * upper_torso_mat),
FigureBoneData::new(torso_mat * upper_torso_mat * lower_torso_mat),
FigureBoneData::new(torso_mat * upper_torso_mat * lower_torso_mat * tail_mat),
FigureBoneData::new(torso_mat * control_mat * upper_torso_mat * main_mat),
FigureBoneData::new(torso_mat * control_mat * upper_torso_mat * second_mat),
FigureBoneData::new(torso_mat * upper_torso_mat * control_mat * main_mat),
FigureBoneData::new(torso_mat * upper_torso_mat * control_mat * second_mat),
FigureBoneData::new(torso_mat * upper_torso_mat * shoulder_l_mat),
FigureBoneData::new(torso_mat * upper_torso_mat * shoulder_r_mat),
FigureBoneData::new(torso_mat * control_mat * upper_torso_mat * hand_l_mat),
FigureBoneData::new(torso_mat * control_mat * upper_torso_mat * hand_r_mat),
FigureBoneData::new(torso_mat * upper_torso_mat * control_mat * hand_l_mat),
FigureBoneData::new(torso_mat * upper_torso_mat * control_mat * hand_r_mat),
FigureBoneData::new(torso_mat * upper_torso_mat * lower_torso_mat * leg_l_mat),
FigureBoneData::new(torso_mat * upper_torso_mat * lower_torso_mat * leg_r_mat),
FigureBoneData::new(self.foot_l.compute_base_matrix()),
@ -149,10 +151,11 @@ impl Default for SkeletonAttr {
impl<'a> From<&'a comp::biped_large::Body> for SkeletonAttr {
fn from(body: &'a comp::biped_large::Body) -> Self {
use comp::biped_large::Species::*;
use comp::biped_large::{BodyType::*, Species::*};
Self {
head: match (body.species, body.body_type) {
(Ogre, _) => (3.0, 6.0),
(Ogre, Male) => (3.0, 9.0),
(Ogre, Female) => (1.0, 7.5),
(Cyclops, _) => (4.5, 7.5),
(Wendigo, _) => (3.0, 13.5),
(Troll, _) => (6.0, 10.0),
@ -166,14 +169,16 @@ impl<'a> From<&'a comp::biped_large::Body> for SkeletonAttr {
(Dullahan, _) => (0.0, 0.0),
},
upper_torso: match (body.species, body.body_type) {
(Ogre, _) => (0.0, 19.0),
(Ogre, Male) => (0.0, 28.0),
(Ogre, Female) => (0.0, 28.0),
(Cyclops, _) => (-2.0, 27.0),
(Wendigo, _) => (-1.0, 29.0),
(Troll, _) => (-1.0, 27.5),
(Dullahan, _) => (0.0, 29.0),
},
lower_torso: match (body.species, body.body_type) {
(Ogre, _) => (1.0, -5.5),
(Ogre, Male) => (1.0, -7.0),
(Ogre, Female) => (0.0, -6.0),
(Cyclops, _) => (1.0, -4.5),
(Wendigo, _) => (-1.5, -6.0),
(Troll, _) => (1.0, -10.5),
@ -187,28 +192,32 @@ impl<'a> From<&'a comp::biped_large::Body> for SkeletonAttr {
(Dullahan, _) => (0.0, 0.0),
},
shoulder: match (body.species, body.body_type) {
(Ogre, _) => (6.1, 0.5, 2.5),
(Ogre, Male) => (12.0, 0.5, 0.0),
(Ogre, Female) => (8.0, 0.5, -1.0),
(Cyclops, _) => (9.5, 2.5, 2.5),
(Wendigo, _) => (9.0, 0.5, -0.5),
(Troll, _) => (11.0, 0.5, -1.5),
(Dullahan, _) => (14.0, 0.5, 4.5),
},
hand: match (body.species, body.body_type) {
(Ogre, _) => (10.5, -1.0, -0.5),
(Ogre, Male) => (14.5, 0.0, -2.0),
(Ogre, Female) => (9.0, 0.5, -4.5),
(Cyclops, _) => (10.0, 2.0, -0.5),
(Wendigo, _) => (12.0, 0.0, -0.5),
(Troll, _) => (11.5, 0.0, -1.5),
(Dullahan, _) => (14.5, 0.0, -2.5),
},
leg: match (body.species, body.body_type) {
(Ogre, _) => (0.0, 0.0, 0.0),
(Ogre, Male) => (0.0, 0.0, -4.0),
(Ogre, Female) => (0.0, 0.0, -2.0),
(Cyclops, _) => (0.0, 0.0, -5.0),
(Wendigo, _) => (2.0, 2.0, -2.5),
(Troll, _) => (5.0, 0.0, -6.0),
(Dullahan, _) => (0.0, 0.0, -5.0),
},
foot: match (body.species, body.body_type) {
(Ogre, _) => (4.0, 2.5, 2.5),
(Ogre, Male) => (4.0, 2.5, 8.0),
(Ogre, Female) => (4.0, 0.5, 8.0),
(Cyclops, _) => (4.0, 0.5, 5.0),
(Wendigo, _) => (5.0, 0.5, 6.0),
(Troll, _) => (6.0, 0.5, 4.0),

@ -50,8 +50,6 @@ impl Animation for WieldAnimation {
* ((anim_time as f32 * 16.0 * lab as f32 + PI * 0.4).sin()).powf(2.0 as f32)))
.sqrt())
* ((anim_time as f32 * 16.0 * lab as f32 + PI * 0.4).sin());
let footvertl = (anim_time as f32 * 16.0 * lab as f32).sin();
let footvertr = (anim_time as f32 * 16.0 * lab as f32 + PI).sin();
let footrotl = (((5.0)
/ (2.5
@ -231,43 +229,6 @@ impl Animation for WieldAnimation {
* Quaternion::rotation_z(footrotr * -0.1);
next.shoulder_r.scale = Vec3::one();
next.leg_l.offset = Vec3::new(
-skeleton_attr.leg.0,
skeleton_attr.leg.1,
skeleton_attr.leg.2,
) * 0.98;
next.leg_l.ori =
Quaternion::rotation_z(short * 0.18) * Quaternion::rotation_x(foothoril * 0.3);
next.leg_l.scale = Vec3::one() * 0.98;
next.leg_r.offset = Vec3::new(
skeleton_attr.leg.0,
skeleton_attr.leg.1,
skeleton_attr.leg.2,
) * 0.98;
next.leg_r.ori =
Quaternion::rotation_z(short * 0.18) * Quaternion::rotation_x(foothorir * 0.3);
next.leg_r.scale = Vec3::one() * 0.98;
next.foot_l.offset = Vec3::new(
-skeleton_attr.foot.0,
4.0 + skeleton_attr.foot.1 + foothoril * 8.5,
skeleton_attr.foot.2 + ((footvertl * 6.5).max(0.0)),
) / 8.0;
next.foot_l.ori =
Quaternion::rotation_x(-0.5 + footrotl * 0.85) * Quaternion::rotation_y(0.0);
next.foot_l.scale = Vec3::one() / 8.0;
next.foot_r.offset = Vec3::new(
skeleton_attr.foot.0,
4.0 + skeleton_attr.foot.1 + foothorir * 8.5,
skeleton_attr.foot.2 + ((footvertr * 6.5).max(0.0)),
) / 8.0;
next.foot_r.ori =
Quaternion::rotation_x(-0.5 + footrotr * 0.85) * Quaternion::rotation_y(0.0);
next.foot_r.scale = Vec3::one() / 8.0;
next.torso.offset = Vec3::new(0.0, 0.0, 0.0) / 8.0;
next.torso.ori = Quaternion::rotation_z(0.0) * Quaternion::rotation_x(-0.25);
next.torso.scale = Vec3::one() / 8.0;

@ -1724,7 +1724,7 @@ impl FigureMgr {
// In air
(false, _, false) => anim::biped_large::JumpAnimation::update_skeleton(
&BipedLargeSkeleton::new(),
(vel.0.magnitude(), time),
time,
state.state_time,
&mut state_animation_rate,
skeleton_attr,
@ -1747,6 +1747,15 @@ impl FigureMgr {
skeleton_attr,
)
},
CharacterState::BasicMelee(_) => {
anim::biped_large::AlphaAnimation::update_skeleton(
&target_base,
(vel.0.magnitude(), time),
state.state_time,
&mut state_animation_rate,
skeleton_attr,
)
},
// TODO!
_ => target_base,
};