weapon control bone

This commit is contained in:
Justin Shipsey 2020-03-05 14:02:11 +00:00
parent 3c7a8a7ce7
commit 86e15695fc
35 changed files with 513 additions and 253 deletions

View File

@ -21,6 +21,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added sfx for wielding/unwielding weapons - Added sfx for wielding/unwielding weapons
- Fixed NPCs attacking the player forever after killing them - Fixed NPCs attacking the player forever after killing them
- Added sfx for collecting, dropping and using inventory items - Added sfx for collecting, dropping and using inventory items
- New attack animation
- weapon control system
### Changed ### Changed

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -47,7 +47,7 @@ impl BipedLargeSkeleton {
impl Skeleton for BipedLargeSkeleton { impl Skeleton for BipedLargeSkeleton {
type Attr = SkeletonAttr; type Attr = SkeletonAttr;
fn compute_matrices(&self) -> [FigureBoneData; 16] { fn compute_matrices(&self) -> [FigureBoneData; 18] {
let upper_torso_mat = self.upper_torso.compute_base_matrix(); let upper_torso_mat = self.upper_torso.compute_base_matrix();
let shoulder_l_mat = self.shoulder_l.compute_base_matrix(); let shoulder_l_mat = self.shoulder_l.compute_base_matrix();
let shoulder_r_mat = self.shoulder_r.compute_base_matrix(); let shoulder_r_mat = self.shoulder_r.compute_base_matrix();
@ -78,6 +78,8 @@ impl Skeleton for BipedLargeSkeleton {
FigureBoneData::default(), FigureBoneData::default(),
FigureBoneData::default(), FigureBoneData::default(),
FigureBoneData::default(), FigureBoneData::default(),
FigureBoneData::default(),
FigureBoneData::default(),
] ]
} }

View File

@ -27,7 +27,7 @@ impl BirdMediumSkeleton {
impl Skeleton for BirdMediumSkeleton { impl Skeleton for BirdMediumSkeleton {
type Attr = SkeletonAttr; type Attr = SkeletonAttr;
fn compute_matrices(&self) -> [FigureBoneData; 16] { fn compute_matrices(&self) -> [FigureBoneData; 18] {
let torso_mat = self.torso.compute_base_matrix(); let torso_mat = self.torso.compute_base_matrix();
[ [
@ -47,6 +47,8 @@ impl Skeleton for BirdMediumSkeleton {
FigureBoneData::default(), FigureBoneData::default(),
FigureBoneData::default(), FigureBoneData::default(),
FigureBoneData::default(), FigureBoneData::default(),
FigureBoneData::default(),
FigureBoneData::default(),
] ]
} }

View File

@ -31,7 +31,7 @@ impl BirdSmallSkeleton {
impl Skeleton for BirdSmallSkeleton { impl Skeleton for BirdSmallSkeleton {
type Attr = SkeletonAttr; type Attr = SkeletonAttr;
fn compute_matrices(&self) -> [FigureBoneData; 16] { fn compute_matrices(&self) -> [FigureBoneData; 18] {
let torso_mat = self.torso.compute_base_matrix(); let torso_mat = self.torso.compute_base_matrix();
[ [
@ -51,6 +51,8 @@ impl Skeleton for BirdSmallSkeleton {
FigureBoneData::default(), FigureBoneData::default(),
FigureBoneData::default(), FigureBoneData::default(),
FigureBoneData::default(), FigureBoneData::default(),
FigureBoneData::default(),
FigureBoneData::default(),
] ]
} }

View File

@ -21,60 +21,65 @@ impl Animation for AttackAnimation {
) -> Self::Skeleton { ) -> Self::Skeleton {
let mut next = (*skeleton).clone(); let mut next = (*skeleton).clone();
let slow = (anim_time as f32 * 9.0).sin(); let lab = 1.0;
let accel_med = 1.0 - (anim_time as f32 * 16.0).cos(); let accel_med = 1.0 - (anim_time as f32 * 16.0 * lab as f32).cos();
let accel_slow = 1.0 - (anim_time as f32 * 12.0).cos(); let accel_slow = 1.0 - (anim_time as f32 * 12.0 * lab as f32).cos();
let accel_fast = 1.0 - (anim_time as f32 * 24.0).cos(); let accel_fast = 1.0 - (anim_time as f32 * 24.0 * lab as f32).cos();
let decel = (anim_time as f32 * 16.0).min(PI / 2.0).sin(); let decel = (anim_time as f32 * 16.0 * lab as f32).min(PI / 2.0).sin();
let slow = (((5.0)
/ (1.1 + 3.9 * ((anim_time as f32 * lab as f32 * 12.4).sin()).powf(2.0 as f32)))
.sqrt())
* ((anim_time as f32 * lab as f32 * 12.4).sin());
next.head.offset = Vec3::new( next.head.offset = Vec3::new(
0.0 + skeleton_attr.neck_right, 0.0 + skeleton_attr.neck_right,
-2.0 + skeleton_attr.neck_forward, -2.0 + skeleton_attr.neck_forward + decel * 0.8,
skeleton_attr.neck_height + 21.0, skeleton_attr.neck_height + 21.0,
); );
next.head.ori = Quaternion::rotation_z(decel * -0.25) next.head.ori = Quaternion::rotation_z(decel * 0.25)
* Quaternion::rotation_x(0.0 + decel * -0.1) * Quaternion::rotation_x(0.0 + decel * 0.1)
* Quaternion::rotation_y(decel * 0.1); * Quaternion::rotation_y(decel * -0.1);
next.head.scale = Vec3::one() * skeleton_attr.head_scale; next.head.scale = Vec3::one() * skeleton_attr.head_scale;
next.chest.offset = Vec3::new(0.0, 0.0, 7.0); next.chest.offset = Vec3::new(0.0, 0.0, 7.0);
next.chest.ori = Quaternion::rotation_x(0.0); next.chest.ori = Quaternion::rotation_z(decel * -0.2)
* Quaternion::rotation_x(0.0 + decel * -0.2)
* Quaternion::rotation_y(decel * 0.2);
next.chest.scale = Vec3::one(); next.chest.scale = Vec3::one();
next.belt.offset = Vec3::new(0.0, 0.0, 5.0); next.belt.offset = Vec3::new(0.0, 0.0, 5.0);
next.belt.ori = Quaternion::rotation_x(0.0); next.belt.ori = Quaternion::rotation_z(decel * -0.1)
* Quaternion::rotation_x(0.0 + decel * -0.1)
* Quaternion::rotation_y(decel * 0.1);
next.belt.scale = Vec3::one(); next.belt.scale = Vec3::one();
next.shorts.offset = Vec3::new(0.0, 0.0, 2.0); next.shorts.offset = Vec3::new(0.0, 0.0, 2.0);
next.shorts.ori = Quaternion::rotation_x(0.0); next.belt.ori = Quaternion::rotation_z(decel * -0.08)
* Quaternion::rotation_x(0.0 + decel * -0.08)
* Quaternion::rotation_y(decel * 0.08);
next.shorts.scale = Vec3::one(); next.shorts.scale = Vec3::one();
match active_tool_kind { match active_tool_kind {
//TODO: Inventory //TODO: Inventory
Some(Tool::Sword) => { Some(Tool::Sword) => {
next.l_hand.offset = next.l_hand.offset = Vec3::new(0.0, 1.0, 0.0);
Vec3::new(-8.0 + accel_slow * 10.0, 8.0 + accel_fast * 3.0, 0.0); next.l_hand.ori = Quaternion::rotation_x(1.27);
next.l_hand.ori = Quaternion::rotation_z(-0.8) next.l_hand.scale = Vec3::one() * 1.04;
* Quaternion::rotation_x(0.0 + accel_med * -0.8) next.r_hand.offset = Vec3::new(0.0, 0.0, -3.0);
* Quaternion::rotation_y(0.0 + accel_med * -0.4); next.r_hand.ori = Quaternion::rotation_x(1.27);
next.l_hand.scale = Vec3::one() * 1.01; next.r_hand.scale = Vec3::one() * 1.05;
next.main.offset = Vec3::new(0.0, 6.0, -1.0);
next.r_hand.offset = next.main.ori = Quaternion::rotation_x(-0.3)
Vec3::new(-8.0 + accel_slow * 10.0, 8.0 + accel_fast * 3.0, -2.0); * Quaternion::rotation_y(0.0)
next.r_hand.ori = Quaternion::rotation_z(-0.8) * Quaternion::rotation_z(0.0);
* Quaternion::rotation_x(0.0 + accel_med * -0.8)
* Quaternion::rotation_y(0.0 + accel_med * -0.4);
next.r_hand.scale = Vec3::one() * 1.01;
next.main.offset = Vec3::new(
-8.0 + accel_slow * 10.0 + skeleton_attr.weapon_x,
8.0 + accel_fast * 3.0,
0.0,
);
next.main.ori = Quaternion::rotation_z(-0.8)
* Quaternion::rotation_x(0.0 + accel_med * -0.8)
* Quaternion::rotation_y(0.0 + accel_med * -0.4);
next.main.scale = Vec3::one(); next.main.scale = Vec3::one();
next.control.offset = Vec3::new(-8.0 - slow * 1.0, 3.0 - slow * 5.0, 0.0);
next.control.ori = Quaternion::rotation_x(-1.2)
* Quaternion::rotation_y(slow * 1.5)
* Quaternion::rotation_z(1.4 + slow * 0.5);
next.control.scale = Vec3::one();
}, },
Some(Tool::Axe) => { Some(Tool::Axe) => {
next.l_hand.offset = next.l_hand.offset =
@ -266,10 +271,17 @@ impl Animation for AttackAnimation {
next.lantern.scale = Vec3::one() * 0.0; next.lantern.scale = Vec3::one() * 0.0;
next.torso.offset = Vec3::new(0.0, -0.2, 0.1) * skeleton_attr.scaler; next.torso.offset = Vec3::new(0.0, -0.2, 0.1) * skeleton_attr.scaler;
next.torso.ori = Quaternion::rotation_z(decel * -0.2) next.torso.ori =
* Quaternion::rotation_x(0.0 + decel * -0.2) Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0) * Quaternion::rotation_y(0.0);
* Quaternion::rotation_y(decel * 0.2);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler; next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
next.l_control.offset = Vec3::new(0.0, 0.0, 0.0);
next.l_control.ori = Quaternion::rotation_x(0.0);
next.l_control.scale = Vec3::one();
next.r_control.offset = Vec3::new(0.0, 0.0, 0.0);
next.r_control.ori = Quaternion::rotation_x(0.0);
next.r_control.scale = Vec3::one();
next next
} }
} }

View File

@ -63,21 +63,23 @@ impl Animation for BlockAnimation {
match active_tool_kind { match active_tool_kind {
//TODO: Inventory //TODO: Inventory
Some(Tool::Sword) => { Some(Tool::Sword) => {
next.l_hand.offset = Vec3::new(-6.0, 3.5, 0.0 + wave_ultra_slow * 1.0); next.l_hand.offset = Vec3::new(0.0, -5.0, -5.0);
next.l_hand.ori = Quaternion::rotation_x(-0.3); next.l_hand.ori = Quaternion::rotation_x(1.27);
next.l_hand.scale = Vec3::one() * 1.01; next.l_hand.scale = Vec3::one() * 1.04;
next.r_hand.offset = Vec3::new(-6.0, 3.0, -2.0); next.r_hand.offset = Vec3::new(0.0, -6.0, -8.0);
next.r_hand.ori = Quaternion::rotation_x(-0.3); next.r_hand.ori = Quaternion::rotation_x(1.27);
next.r_hand.scale = Vec3::one() * 1.01; next.r_hand.scale = Vec3::one() * 1.05;
next.main.offset = Vec3::new( next.main.offset = Vec3::new(0.0, 0.0, -6.0);
-6.0 + skeleton_attr.weapon_x,
4.5 + skeleton_attr.weapon_y,
0.0,
);
next.main.ori = Quaternion::rotation_x(-0.3) next.main.ori = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(0.0) * Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0); * Quaternion::rotation_z(0.0);
next.main.scale = Vec3::one(); next.main.scale = Vec3::one();
next.control.offset = Vec3::new(-8.0, 13.0, 8.0);
next.control.ori = Quaternion::rotation_x(0.2)
* Quaternion::rotation_y(0.4)
* Quaternion::rotation_z(-1.57);
next.control.scale = Vec3::one();
}, },
Some(Tool::Axe) => { Some(Tool::Axe) => {
next.l_hand.offset = Vec3::new( next.l_hand.offset = Vec3::new(

View File

@ -62,21 +62,23 @@ impl Animation for BlockIdleAnimation {
match active_tool_kind { match active_tool_kind {
//TODO: Inventory //TODO: Inventory
Some(Tool::Sword) => { Some(Tool::Sword) => {
next.l_hand.offset = Vec3::new(-6.0, 3.5, 0.0 + wave_ultra_slow * 1.0); next.l_hand.offset = Vec3::new(0.0, -5.0, -5.0);
next.l_hand.ori = Quaternion::rotation_x(-0.3); next.l_hand.ori = Quaternion::rotation_x(1.27);
next.l_hand.scale = Vec3::one() * 1.01; next.l_hand.scale = Vec3::one() * 1.04;
next.r_hand.offset = Vec3::new(-6.0, 3.0, -2.0); next.r_hand.offset = Vec3::new(0.0, -6.0, -8.0);
next.r_hand.ori = Quaternion::rotation_x(-0.3); next.r_hand.ori = Quaternion::rotation_x(1.27);
next.r_hand.scale = Vec3::one() * 1.01; next.r_hand.scale = Vec3::one() * 1.05;
next.main.offset = Vec3::new( next.main.offset = Vec3::new(0.0, 0.0, -6.0);
-6.0 + skeleton_attr.weapon_x,
4.5 + skeleton_attr.weapon_y,
0.0,
);
next.main.ori = Quaternion::rotation_x(-0.3) next.main.ori = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(0.0) * Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0); * Quaternion::rotation_z(0.0);
next.main.scale = Vec3::one(); next.main.scale = Vec3::one();
next.control.offset = Vec3::new(-8.0, 13.0, 8.0);
next.control.ori = Quaternion::rotation_x(0.2)
* Quaternion::rotation_y(0.4)
* Quaternion::rotation_z(-1.57);
next.control.scale = Vec3::one();
}, },
Some(Tool::Axe) => { Some(Tool::Axe) => {
next.l_hand.offset = Vec3::new( next.l_hand.offset = Vec3::new(

View File

@ -103,6 +103,11 @@ impl Animation for ChargeAnimation {
next.torso.ori = next.torso.ori =
Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0) * Quaternion::rotation_y(0.0); Quaternion::rotation_z(0.0) * Quaternion::rotation_x(0.0) * Quaternion::rotation_y(0.0);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler; next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
next.control.offset = Vec3::new(0.0, 0.0, 0.0);
next.control.ori = Quaternion::rotation_x(0.0);
next.control.scale = Vec3::one();
next next
} }
} }

View File

@ -22,7 +22,7 @@ impl Animation for CidleAnimation {
) -> Self::Skeleton { ) -> Self::Skeleton {
let mut next = (*skeleton).clone(); let mut next = (*skeleton).clone();
let wave_ultra_slow = (anim_time as f32 * 3.0 + PI).sin(); let wave_ultra_slow = (anim_time as f32 * 0.5 + PI).sin();
let wave_ultra_slow_cos = (anim_time as f32 * 3.0 + PI).cos(); let wave_ultra_slow_cos = (anim_time as f32 * 3.0 + PI).cos();
let wave_slow_cos = (anim_time as f32 * 6.0 + PI).cos(); let wave_slow_cos = (anim_time as f32 * 6.0 + PI).cos();
let wave_slow = (anim_time as f32 * 6.0 + PI).sin(); let wave_slow = (anim_time as f32 * 6.0 + PI).sin();
@ -63,29 +63,23 @@ impl Animation for CidleAnimation {
match active_tool_kind { match active_tool_kind {
//TODO: Inventory //TODO: Inventory
Some(Tool::Sword) => { Some(Tool::Sword) => {
next.l_hand.offset = Vec3::new( next.l_hand.offset = Vec3::new(-0.25, -5.0, -5.0);
-6.0 + wave_ultra_slow_cos * 1.0, next.l_hand.ori = Quaternion::rotation_x(1.47) * Quaternion::rotation_y(-0.2);
-2.0 + wave_ultra_slow_cos * 0.5, next.l_hand.scale = Vec3::one() * 1.04;
1.0 + wave_ultra_slow * 1.0, next.r_hand.offset = Vec3::new(1.25, -5.5, -8.0);
); next.r_hand.ori = Quaternion::rotation_x(1.47) * Quaternion::rotation_y(0.3);
next.l_hand.ori = Quaternion::rotation_x(1.27); next.r_hand.scale = Vec3::one() * 1.05;
next.l_hand.scale = Vec3::one() * 1.0; next.main.offset = Vec3::new(0.0, 0.0, -6.0);
next.r_hand.offset = Vec3::new( next.main.ori = Quaternion::rotation_x(-0.1)
-6.0 + wave_ultra_slow_cos * 1.0,
-2.5 + wave_ultra_slow_cos * 0.5,
-1.0 + wave_ultra_slow * 1.0,
);
next.r_hand.ori = Quaternion::rotation_x(1.27);
next.r_hand.scale = Vec3::one() * 1.01;
next.main.offset = Vec3::new(
-6.0 + skeleton_attr.weapon_x + wave_ultra_slow_cos * 1.0,
5.5 + skeleton_attr.weapon_y + wave_ultra_slow_cos * 0.5,
1.0 + wave_ultra_slow * 1.0,
);
next.main.ori = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(0.0) * Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0); * Quaternion::rotation_z(0.0);
next.main.scale = Vec3::one(); next.main.scale = Vec3::one();
next.control.offset = Vec3::new(-7.0, 6.0, 6.0);
next.control.ori = Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.control.scale = Vec3::one();
}, },
Some(Tool::Axe) => { Some(Tool::Axe) => {
next.l_hand.offset = Vec3::new( next.l_hand.offset = Vec3::new(

View File

@ -59,11 +59,11 @@ impl Animation for ClimbAnimation {
* Quaternion::rotation_y(wave_test * 0.10); * Quaternion::rotation_y(wave_test * 0.10);
next.shorts.scale = Vec3::one(); next.shorts.scale = Vec3::one();
next.l_hand.offset = Vec3::new(-6.0, -0.25 + wave_testc * 1.5, 5.0 - wave_test * 4.0); next.l_hand.offset = Vec3::new(-6.0, -0.25 + wave_testc * 1.5, 6.0 - wave_test * 4.0);
next.l_hand.ori = Quaternion::rotation_x(2.2 + wave_testc * 0.5); next.l_hand.ori = Quaternion::rotation_x(2.2 + wave_testc * 0.5);
next.l_hand.scale = Vec3::one(); next.l_hand.scale = Vec3::one();
next.r_hand.offset = Vec3::new(6.0, -0.25 - wave_testc * 1.5, 5.0 + wave_test * 4.0); next.r_hand.offset = Vec3::new(6.0, -0.25 - wave_testc * 1.5, 6.0 + wave_test * 4.0);
next.r_hand.ori = Quaternion::rotation_x(2.2 - wave_testc * 0.5); next.r_hand.ori = Quaternion::rotation_x(2.2 - wave_testc * 0.5);
next.r_hand.scale = Vec3::one(); next.r_hand.scale = Vec3::one();
@ -75,15 +75,6 @@ impl Animation for ClimbAnimation {
next.r_foot.ori = Quaternion::rotation_x(0.2 + wave_testc * 0.5); next.r_foot.ori = Quaternion::rotation_x(0.2 + wave_testc * 0.5);
next.r_foot.scale = Vec3::one(); next.r_foot.scale = Vec3::one();
next.main.offset = Vec3::new(
-7.0 + skeleton_attr.weapon_x,
-5.0 + skeleton_attr.weapon_y,
15.0,
);
next.main.ori =
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57 + wave_cos * 0.25);
next.main.scale = Vec3::one();
next.l_shoulder.offset = Vec3::new(-5.0, 0.0, 4.7); next.l_shoulder.offset = Vec3::new(-5.0, 0.0, 4.7);
next.l_shoulder.ori = Quaternion::rotation_x(wave_cos * 0.15); next.l_shoulder.ori = Quaternion::rotation_x(wave_cos * 0.15);
next.l_shoulder.scale = Vec3::one() * 1.1; next.l_shoulder.scale = Vec3::one() * 1.1;
@ -96,6 +87,23 @@ impl Animation for ClimbAnimation {
next.glider.ori = Quaternion::rotation_y(0.0); next.glider.ori = Quaternion::rotation_y(0.0);
next.glider.scale = Vec3::one() * 0.0; next.glider.scale = Vec3::one() * 0.0;
next.main.offset = Vec3::new(
-7.0 + skeleton_attr.weapon_x,
-5.0 + skeleton_attr.weapon_y,
18.0,
);
next.main.ori =
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57 + wave_cos * 0.25);
next.main.scale = Vec3::one();
next.second.offset = Vec3::new(
0.0 + skeleton_attr.weapon_x,
0.0 + skeleton_attr.weapon_y,
0.0,
);
next.second.ori = Quaternion::rotation_y(0.0);
next.second.scale = Vec3::one() * 0.0;
next.lantern.offset = Vec3::new(0.0, 0.0, 0.0); next.lantern.offset = Vec3::new(0.0, 0.0, 0.0);
next.lantern.ori = Quaternion::rotation_x(0.0); next.lantern.ori = Quaternion::rotation_x(0.0);
next.lantern.scale = Vec3::one() * 0.0; next.lantern.scale = Vec3::one() * 0.0;
@ -104,6 +112,17 @@ impl Animation for ClimbAnimation {
next.torso.ori = Quaternion::rotation_x(0.0) * Quaternion::rotation_y(0.0); next.torso.ori = Quaternion::rotation_x(0.0) * Quaternion::rotation_y(0.0);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler; next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
next.control.offset = Vec3::new(0.0, 0.0, 0.0);
next.control.ori = Quaternion::rotation_x(0.0);
next.control.scale = Vec3::one();
next.l_control.offset = Vec3::new(0.0, 0.0, 0.0);
next.l_control.ori = Quaternion::rotation_x(0.0);
next.l_control.scale = Vec3::one();
next.r_control.offset = Vec3::new(0.0, 0.0, 0.0);
next.r_control.ori = Quaternion::rotation_x(0.0);
next.r_control.scale = Vec3::one();
next next
} }
} }

View File

@ -43,23 +43,33 @@ impl Animation for WieldAnimation {
match Tool::Bow { match Tool::Bow {
//TODO: Inventory //TODO: Inventory
Tool::Sword => { Some(Tool::Sword) => {
next.l_hand.offset = Vec3::new(-6.0, 3.75, 0.25); next.l_hand.offset = Vec3::new(0.0, -5.0, -5.0);
next.l_hand.ori = Quaternion::rotation_x(-0.3); next.l_hand.ori = Quaternion::rotation_x(1.27);
next.l_hand.scale = Vec3::one() * 1.01; next.l_hand.scale = Vec3::one() * 1.04;
next.r_hand.offset = Vec3::new(-6.0, 3.0, -2.0); next.r_hand.offset = Vec3::new(0.0, -6.0, -8.0);
next.r_hand.ori = Quaternion::rotation_x(-0.3); next.r_hand.ori = Quaternion::rotation_x(1.27);
next.r_hand.scale = Vec3::one() * 1.01; next.r_hand.scale = Vec3::one() * 1.05;
next.weapon.offset = Vec3::new( next.main.offset = Vec3::new(
-6.0 + skeleton_attr.weapon_x,
4.0 + skeleton_attr.weapon_y,
0.0, 0.0,
0.0,
-6.0,
); );
next.weapon.ori = Quaternion::rotation_x(-0.3) next.main.ori = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(0.0) * Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0); * Quaternion::rotation_z(0.0);
next.weapon.scale = Vec3::one(); next.main.scale = Vec3::one();
}
next.control.offset = Vec3::new(
-8.0,
4.0,
6.0,
);
next.control.ori = Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.control.scale = Vec3::one();
},
Tool::Axe => { Tool::Axe => {
next.l_hand.offset = Vec3::new(-6.0, 3.5, 0.0); next.l_hand.offset = Vec3::new(-6.0, 3.5, 0.0);
next.l_hand.ori = Quaternion::rotation_x(-0.3); next.l_hand.ori = Quaternion::rotation_x(-0.3);

View File

@ -105,14 +105,6 @@ impl Animation for GlidingAnimation {
); );
next.r_foot.scale = Vec3::one(); next.r_foot.scale = Vec3::one();
next.main.offset = Vec3::new(
-7.0 + skeleton_attr.weapon_x,
-5.0 + skeleton_attr.weapon_y,
15.0,
);
next.main.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
next.main.scale = Vec3::one();
next.l_shoulder.offset = Vec3::new(-5.0, 0.0, 4.7); next.l_shoulder.offset = Vec3::new(-5.0, 0.0, 4.7);
next.l_shoulder.ori = Quaternion::rotation_x(0.0); next.l_shoulder.ori = Quaternion::rotation_x(0.0);
next.l_shoulder.scale = Vec3::one() * 1.1; next.l_shoulder.scale = Vec3::one() * 1.1;
@ -126,6 +118,22 @@ impl Animation for GlidingAnimation {
Quaternion::rotation_x(1.0) * Quaternion::rotation_y(wave_very_slow_cos * 0.04); Quaternion::rotation_x(1.0) * Quaternion::rotation_y(wave_very_slow_cos * 0.04);
next.glider.scale = Vec3::one(); next.glider.scale = Vec3::one();
next.main.offset = Vec3::new(
-7.0 + skeleton_attr.weapon_x,
-5.0 + skeleton_attr.weapon_y,
15.0,
);
next.main.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
next.main.scale = Vec3::one();
next.second.offset = Vec3::new(
0.0 + skeleton_attr.weapon_x,
0.0 + skeleton_attr.weapon_y,
0.0,
);
next.second.ori = Quaternion::rotation_y(0.0);
next.second.scale = Vec3::one() * 0.0;
next.lantern.offset = Vec3::new(0.0, 0.0, 0.0); next.lantern.offset = Vec3::new(0.0, 0.0, 0.0);
next.lantern.ori = Quaternion::rotation_x(0.0); next.lantern.ori = Quaternion::rotation_x(0.0);
next.lantern.scale = Vec3::one() * 0.0; next.lantern.scale = Vec3::one() * 0.0;
@ -135,6 +143,17 @@ impl Animation for GlidingAnimation {
* Quaternion::rotation_y(tilt * 16.0); * Quaternion::rotation_y(tilt * 16.0);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler; next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
next.control.offset = Vec3::new(0.0, 0.0, 0.0);
next.control.ori = Quaternion::rotation_x(0.0);
next.control.scale = Vec3::one();
next.l_control.offset = Vec3::new(0.0, 0.0, 0.0);
next.l_control.ori = Quaternion::rotation_x(0.0);
next.l_control.scale = Vec3::one();
next.r_control.offset = Vec3::new(0.0, 0.0, 0.0);
next.r_control.ori = Quaternion::rotation_x(0.0);
next.r_control.scale = Vec3::one();
next next
} }
} }

View File

@ -56,7 +56,7 @@ impl Animation for IdleAnimation {
next.shorts.scale = Vec3::one(); next.shorts.scale = Vec3::one();
next.l_hand.offset = Vec3::new( next.l_hand.offset = Vec3::new(
-6.0, -7.0,
-0.25 + wave_ultra_slow_cos * 0.15, -0.25 + wave_ultra_slow_cos * 0.15,
5.0 + wave_ultra_slow * 0.5, 5.0 + wave_ultra_slow * 0.5,
); );
@ -65,7 +65,7 @@ impl Animation for IdleAnimation {
next.l_hand.scale = Vec3::one(); next.l_hand.scale = Vec3::one();
next.r_hand.offset = Vec3::new( next.r_hand.offset = Vec3::new(
6.0, 7.0,
-0.25 + wave_ultra_slow_cos * 0.15, -0.25 + wave_ultra_slow_cos * 0.15,
5.0 + wave_ultra_slow * 0.5 + wave_ultra_slow_abs * -0.05, 5.0 + wave_ultra_slow * 0.5 + wave_ultra_slow_abs * -0.05,
); );
@ -80,14 +80,6 @@ impl Animation for IdleAnimation {
next.r_foot.ori = Quaternion::identity(); next.r_foot.ori = Quaternion::identity();
next.r_foot.scale = Vec3::one(); next.r_foot.scale = Vec3::one();
next.main.offset = Vec3::new(
-7.0 + skeleton_attr.weapon_x,
-5.0 + skeleton_attr.weapon_y,
15.0,
);
next.main.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
next.main.scale = Vec3::one() + wave_ultra_slow_abs * -0.05;
next.l_shoulder.offset = Vec3::new(-5.0, 0.0, 5.0); next.l_shoulder.offset = Vec3::new(-5.0, 0.0, 5.0);
next.l_shoulder.ori = Quaternion::rotation_x(0.0); next.l_shoulder.ori = Quaternion::rotation_x(0.0);
next.l_shoulder.scale = (Vec3::one() + wave_ultra_slow_abs * -0.05) * 1.15; next.l_shoulder.scale = (Vec3::one() + wave_ultra_slow_abs * -0.05) * 1.15;
@ -100,6 +92,22 @@ impl Animation for IdleAnimation {
next.glider.ori = Quaternion::rotation_y(0.0); next.glider.ori = Quaternion::rotation_y(0.0);
next.glider.scale = Vec3::one() * 0.0; next.glider.scale = Vec3::one() * 0.0;
next.main.offset = Vec3::new(
-7.0 + skeleton_attr.weapon_x,
-5.0 + skeleton_attr.weapon_y,
18.0,
);
next.main.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
next.main.scale = Vec3::one() + wave_ultra_slow_abs * -0.05;
next.second.offset = Vec3::new(
0.0 + skeleton_attr.weapon_x,
0.0 + skeleton_attr.weapon_y,
0.0,
);
next.second.ori = Quaternion::rotation_y(0.0);
next.second.scale = Vec3::one() * 0.0;
next.lantern.offset = Vec3::new(0.0, 0.0, 0.0); next.lantern.offset = Vec3::new(0.0, 0.0, 0.0);
next.lantern.ori = Quaternion::rotation_x(0.0); next.lantern.ori = Quaternion::rotation_x(0.0);
next.lantern.scale = Vec3::one() * 0.0; next.lantern.scale = Vec3::one() * 0.0;
@ -108,6 +116,17 @@ impl Animation for IdleAnimation {
next.torso.ori = Quaternion::rotation_x(0.0); next.torso.ori = Quaternion::rotation_x(0.0);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler; next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
next.control.offset = Vec3::new(0.0, 0.0, 0.0);
next.control.ori = Quaternion::rotation_x(0.0);
next.control.scale = Vec3::one();
next.l_control.offset = Vec3::new(0.0, 0.0, 0.0);
next.l_control.ori = Quaternion::rotation_x(0.0);
next.l_control.scale = Vec3::one();
next.r_control.offset = Vec3::new(0.0, 0.0, 0.0);
next.r_control.ori = Quaternion::rotation_x(0.0);
next.r_control.scale = Vec3::one();
next next
} }
} }

View File

@ -68,14 +68,6 @@ impl Animation for JumpAnimation {
next.r_foot.ori = Quaternion::rotation_x(wave_stop * 1.2 + wave_slow * 0.2); next.r_foot.ori = Quaternion::rotation_x(wave_stop * 1.2 + wave_slow * 0.2);
next.r_foot.scale = Vec3::one(); next.r_foot.scale = Vec3::one();
next.main.offset = Vec3::new(
-7.0 + skeleton_attr.weapon_x,
-5.0 + skeleton_attr.weapon_y,
15.0,
);
next.main.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
next.main.scale = Vec3::one();
next.l_shoulder.offset = Vec3::new(-5.0, 0.0, 4.7); next.l_shoulder.offset = Vec3::new(-5.0, 0.0, 4.7);
next.l_shoulder.ori = Quaternion::rotation_x(wave_stop_alt * 0.3); next.l_shoulder.ori = Quaternion::rotation_x(wave_stop_alt * 0.3);
next.l_shoulder.scale = Vec3::one() * 1.1; next.l_shoulder.scale = Vec3::one() * 1.1;
@ -88,6 +80,22 @@ impl Animation for JumpAnimation {
next.glider.ori = Quaternion::rotation_y(0.0); next.glider.ori = Quaternion::rotation_y(0.0);
next.glider.scale = Vec3::one() * 0.0; next.glider.scale = Vec3::one() * 0.0;
next.main.offset = Vec3::new(
-7.0 + skeleton_attr.weapon_x,
-5.0 + skeleton_attr.weapon_y,
15.0,
);
next.main.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
next.main.scale = Vec3::one();
next.second.offset = Vec3::new(
0.0 + skeleton_attr.weapon_x,
0.0 + skeleton_attr.weapon_y,
0.0,
);
next.second.ori = Quaternion::rotation_y(0.0);
next.second.scale = Vec3::one() * 0.0;
next.lantern.offset = Vec3::new(0.0, 0.0, 0.0); next.lantern.offset = Vec3::new(0.0, 0.0, 0.0);
next.lantern.ori = Quaternion::rotation_x(0.0); next.lantern.ori = Quaternion::rotation_x(0.0);
next.lantern.scale = Vec3::one() * 0.0; next.lantern.scale = Vec3::one() * 0.0;
@ -96,6 +104,17 @@ impl Animation for JumpAnimation {
next.torso.ori = Quaternion::rotation_x(-0.2); next.torso.ori = Quaternion::rotation_x(-0.2);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler; next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
next.control.offset = Vec3::new(0.0, 0.0, 0.0);
next.control.ori = Quaternion::rotation_x(0.0);
next.control.scale = Vec3::one();
next.l_control.offset = Vec3::new(0.0, 0.0, 0.0);
next.l_control.ori = Quaternion::rotation_x(0.0);
next.l_control.scale = Vec3::one();
next.r_control.offset = Vec3::new(0.0, 0.0, 0.0);
next.r_control.ori = Quaternion::rotation_x(0.0);
next.r_control.scale = Vec3::one();
next next
} }
} }

View File

@ -37,12 +37,16 @@ pub struct CharacterSkeleton {
r_hand: Bone, r_hand: Bone,
l_foot: Bone, l_foot: Bone,
r_foot: Bone, r_foot: Bone,
main: Bone,
l_shoulder: Bone, l_shoulder: Bone,
r_shoulder: Bone, r_shoulder: Bone,
glider: Bone, glider: Bone,
main: Bone,
second: Bone,
lantern: Bone, lantern: Bone,
torso: Bone, torso: Bone,
control: Bone,
l_control: Bone,
r_control: Bone,
} }
impl CharacterSkeleton { impl CharacterSkeleton {
@ -52,11 +56,16 @@ impl CharacterSkeleton {
impl Skeleton for CharacterSkeleton { impl Skeleton for CharacterSkeleton {
type Attr = SkeletonAttr; type Attr = SkeletonAttr;
fn compute_matrices(&self) -> [FigureBoneData; 16] { fn compute_matrices(&self) -> [FigureBoneData; 18] {
let chest_mat = self.chest.compute_base_matrix(); let chest_mat = self.chest.compute_base_matrix();
let torso_mat = self.torso.compute_base_matrix(); let torso_mat = self.torso.compute_base_matrix();
let l_hand_mat = self.l_hand.compute_base_matrix(); let l_hand_mat = self.l_hand.compute_base_matrix();
let r_hand_mat = self.r_hand.compute_base_matrix();
let control_mat = self.control.compute_base_matrix();
let l_control_mat = self.l_control.compute_base_matrix();
let r_control_mat = self.r_control.compute_base_matrix();
let main_mat = self.main.compute_base_matrix(); let main_mat = self.main.compute_base_matrix();
let second_mat = self.second.compute_base_matrix();
let head_mat = self.head.compute_base_matrix(); let head_mat = self.head.compute_base_matrix();
[ [
@ -64,18 +73,20 @@ impl Skeleton for CharacterSkeleton {
FigureBoneData::new(torso_mat * chest_mat), FigureBoneData::new(torso_mat * chest_mat),
FigureBoneData::new(torso_mat * self.belt.compute_base_matrix()), FigureBoneData::new(torso_mat * self.belt.compute_base_matrix()),
FigureBoneData::new(torso_mat * self.shorts.compute_base_matrix()), FigureBoneData::new(torso_mat * self.shorts.compute_base_matrix()),
FigureBoneData::new(torso_mat * chest_mat * l_hand_mat), FigureBoneData::new(torso_mat * chest_mat * control_mat * l_control_mat * l_hand_mat),
FigureBoneData::new(torso_mat * chest_mat * self.r_hand.compute_base_matrix()), FigureBoneData::new(torso_mat * chest_mat * control_mat * r_control_mat * r_hand_mat),
FigureBoneData::new(torso_mat * self.l_foot.compute_base_matrix()), FigureBoneData::new(torso_mat * self.l_foot.compute_base_matrix()),
FigureBoneData::new(torso_mat * self.r_foot.compute_base_matrix()), FigureBoneData::new(torso_mat * self.r_foot.compute_base_matrix()),
FigureBoneData::new(torso_mat * chest_mat * main_mat),
FigureBoneData::new(torso_mat * chest_mat * self.l_shoulder.compute_base_matrix()), FigureBoneData::new(torso_mat * chest_mat * self.l_shoulder.compute_base_matrix()),
FigureBoneData::new(torso_mat * chest_mat * self.r_shoulder.compute_base_matrix()), FigureBoneData::new(torso_mat * chest_mat * self.r_shoulder.compute_base_matrix()),
FigureBoneData::new(torso_mat * self.glider.compute_base_matrix()), FigureBoneData::new(torso_mat * self.glider.compute_base_matrix()),
FigureBoneData::new(torso_mat * chest_mat * control_mat * l_control_mat * main_mat),
FigureBoneData::new(torso_mat * chest_mat * control_mat * r_control_mat * second_mat),
FigureBoneData::new(torso_mat * chest_mat * self.lantern.compute_base_matrix()), FigureBoneData::new(torso_mat * chest_mat * self.lantern.compute_base_matrix()),
FigureBoneData::new(torso_mat), FigureBoneData::new(torso_mat),
FigureBoneData::default(), FigureBoneData::new(control_mat),
FigureBoneData::default(), FigureBoneData::new(l_control_mat),
FigureBoneData::new(r_control_mat),
] ]
} }
@ -88,12 +99,16 @@ impl Skeleton for CharacterSkeleton {
self.r_hand.interpolate(&target.r_hand, dt); self.r_hand.interpolate(&target.r_hand, dt);
self.l_foot.interpolate(&target.l_foot, dt); self.l_foot.interpolate(&target.l_foot, dt);
self.r_foot.interpolate(&target.r_foot, dt); self.r_foot.interpolate(&target.r_foot, dt);
self.main.interpolate(&target.main, dt);
self.l_shoulder.interpolate(&target.l_shoulder, dt); self.l_shoulder.interpolate(&target.l_shoulder, dt);
self.r_shoulder.interpolate(&target.r_shoulder, dt); self.r_shoulder.interpolate(&target.r_shoulder, dt);
self.glider.interpolate(&target.glider, dt); self.glider.interpolate(&target.glider, dt);
self.main.interpolate(&target.main, dt);
self.second.interpolate(&target.second, dt);
self.lantern.interpolate(&target.lantern, dt); self.lantern.interpolate(&target.lantern, dt);
self.torso.interpolate(&target.torso, dt); self.torso.interpolate(&target.torso, dt);
self.control.interpolate(&target.control, dt);
self.l_control.interpolate(&target.l_control, dt);
self.r_control.interpolate(&target.r_control, dt);
} }
} }

View File

@ -85,16 +85,6 @@ impl Animation for RollAnimation {
next.r_foot.ori = Quaternion::rotation_x(wave * -0.4); next.r_foot.ori = Quaternion::rotation_x(wave * -0.4);
next.r_foot.scale = Vec3::one(); next.r_foot.scale = Vec3::one();
next.main.offset = Vec3::new(
-7.0 + skeleton_attr.weapon_x,
-5.0 + skeleton_attr.weapon_y,
15.0,
);
next.main.ori = Quaternion::rotation_y(2.5)
* Quaternion::rotation_z(1.57)
* Quaternion::rotation_x(0.0);
next.main.scale = Vec3::one();
next.l_shoulder.offset = Vec3::new(-5.0, 0.0, 4.7); next.l_shoulder.offset = Vec3::new(-5.0, 0.0, 4.7);
next.l_shoulder.ori = Quaternion::rotation_x(0.0); next.l_shoulder.ori = Quaternion::rotation_x(0.0);
next.l_shoulder.scale = Vec3::one() * 1.1; next.l_shoulder.scale = Vec3::one() * 1.1;
@ -107,6 +97,24 @@ impl Animation for RollAnimation {
next.glider.ori = Quaternion::rotation_y(0.0); next.glider.ori = Quaternion::rotation_y(0.0);
next.glider.scale = Vec3::one() * 0.0; next.glider.scale = Vec3::one() * 0.0;
next.main.offset = Vec3::new(
-7.0 + skeleton_attr.weapon_x,
-5.0 + skeleton_attr.weapon_y,
15.0,
);
next.main.ori = Quaternion::rotation_y(2.5)
* Quaternion::rotation_z(1.57)
* Quaternion::rotation_x(0.0);
next.main.scale = Vec3::one();
next.second.offset = Vec3::new(
0.0 + skeleton_attr.weapon_x,
0.0 + skeleton_attr.weapon_y,
0.0,
);
next.second.ori = Quaternion::rotation_y(0.0);
next.second.scale = Vec3::one() * 0.0;
next.lantern.offset = Vec3::new(0.0, 0.0, 0.0); next.lantern.offset = Vec3::new(0.0, 0.0, 0.0);
next.lantern.ori = Quaternion::rotation_x(0.0); next.lantern.ori = Quaternion::rotation_x(0.0);
next.lantern.scale = Vec3::one() * 0.0; next.lantern.scale = Vec3::one() * 0.0;
@ -115,6 +123,18 @@ impl Animation for RollAnimation {
Vec3::new(0.0, 0.0, 0.1 + wave_dub * 16.0) / 11.0 * skeleton_attr.scaler; Vec3::new(0.0, 0.0, 0.1 + wave_dub * 16.0) / 11.0 * skeleton_attr.scaler;
next.torso.ori = Quaternion::rotation_x(wave_slow * 6.5) * Quaternion::rotation_y(tilt); next.torso.ori = Quaternion::rotation_x(wave_slow * 6.5) * Quaternion::rotation_y(tilt);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler; next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
next.control.offset = Vec3::new(0.0, 0.0, 0.0);
next.control.ori = Quaternion::rotation_x(0.0);
next.control.scale = Vec3::one();
next.l_control.offset = Vec3::new(0.0, 0.0, 0.0);
next.l_control.ori = Quaternion::rotation_x(0.0);
next.l_control.scale = Vec3::one();
next.r_control.offset = Vec3::new(0.0, 0.0, 0.0);
next.r_control.ori = Quaternion::rotation_x(0.0);
next.r_control.scale = Vec3::one();
next next
} }
} }

View File

@ -23,23 +23,36 @@ impl Animation for RunAnimation {
let lab = 1.0; let lab = 1.0;
let long = (((5.0) let long = (((5.0)
/ (1.1 + 3.9 * ((anim_time as f32 * lab as f32 * 1.2).sin()).powf(2.0 as f32))) / (1.5 + 3.5 * ((anim_time as f32 * lab as f32 * 0.66).sin()).powf(2.0 as f32)))
.sqrt()) .sqrt())
* ((anim_time as f32 * lab as f32 * 1.2).sin()); * ((anim_time as f32 * lab as f32 * 0.66).sin());
let short = (((5.0)
/ (1.1 + 3.9 * ((anim_time as f32 * lab as f32 * 2.4).sin()).powf(2.0 as f32)))
.sqrt())
* ((anim_time as f32 * lab as f32 * 1.5).sin());
let wave_stop = (anim_time as f32 * 2.6).min(PI / 2.0).sin(); let short = (((5.0)
/ (1.5 + 3.5 * ((anim_time as f32 * lab as f32 * 1.32).sin()).powf(2.0 as f32)))
.sqrt())
* ((anim_time as f32 * lab as f32 * 1.32).sin());
let shortalt = (((5.0)
/ (1.5
+ 3.5
* ((anim_time as f32 * lab as f32 * 1.32 + PI / 2.0).sin()).powf(2.0 as f32)))
.sqrt())
* ((anim_time as f32 * lab as f32 * 1.32 + PI / 2.0).sin());
let foot = (((5.0)
/ (1.1 + 3.9 * ((anim_time as f32 * lab as f32 * 1.32).sin()).powf(2.0 as f32)))
.sqrt())
* ((anim_time as f32 * lab as f32 * 1.32).sin());
let wave_stop = (anim_time as f32 * 2.6).min(PI / 2.0 / 2.0).sin();
let head_look = Vec2::new( let head_look = Vec2::new(
((global_time + anim_time) as f32 / 4.0) ((global_time + anim_time) as f32 / 18.0)
.floor() .floor()
.mul(7331.0) .mul(7331.0)
.sin() .sin()
* 0.2, * 0.2,
((global_time + anim_time) as f32 / 4.0) ((global_time + anim_time) as f32 / 18.0)
.floor() .floor()
.mul(1337.0) .mul(1337.0)
.sin() .sin()
@ -70,21 +83,21 @@ impl Animation for RunAnimation {
next.head.scale = Vec3::one() * skeleton_attr.head_scale; next.head.scale = Vec3::one() * skeleton_attr.head_scale;
next.chest.offset = Vec3::new(0.0, 0.0, 7.0 + short * 1.1); next.chest.offset = Vec3::new(0.0, 0.0, 7.0 + short * 1.1);
next.chest.ori = Quaternion::rotation_z(long * 0.2); next.chest.ori = Quaternion::rotation_z(short * 0.2);
next.chest.scale = Vec3::one(); next.chest.scale = Vec3::one();
next.belt.offset = Vec3::new(0.0, 0.0, 5.0 + short * 1.1); next.belt.offset = Vec3::new(0.0, 0.0, 5.0 + short * 1.1);
next.belt.ori = Quaternion::rotation_z(long * 0.35); next.belt.ori = Quaternion::rotation_z(short * 0.35);
next.belt.scale = Vec3::one(); next.belt.scale = Vec3::one();
next.shorts.offset = Vec3::new(0.0, 0.0, 2.0 + short * 1.1); next.shorts.offset = Vec3::new(0.0, 0.0, 2.0 + short * 1.1);
next.shorts.ori = Quaternion::rotation_z(long * 0.6); next.shorts.ori = Quaternion::rotation_z(short * 0.6);
next.shorts.scale = Vec3::one(); next.shorts.scale = Vec3::one();
next.l_hand.offset = Vec3::new( next.l_hand.offset = Vec3::new(
-6.0 + wave_stop * -1.0, -6.0 + wave_stop * -1.0,
-0.25 + short * 2.0, -0.25 + short * 2.0,
5.0 - long * 1.5, 5.0 + short * -1.5,
); );
next.l_hand.ori = next.l_hand.ori =
Quaternion::rotation_x(0.8 + short * 1.2) * Quaternion::rotation_y(wave_stop * 0.1); Quaternion::rotation_x(0.8 + short * 1.2) * Quaternion::rotation_y(wave_stop * 0.1);
@ -93,20 +106,32 @@ impl Animation for RunAnimation {
next.r_hand.offset = Vec3::new( next.r_hand.offset = Vec3::new(
6.0 + wave_stop * 1.0, 6.0 + wave_stop * 1.0,
-0.25 + short * -2.0, -0.25 + short * -2.0,
5.0 + long * 1.5, 5.0 + short * 1.5,
); );
next.r_hand.ori = next.r_hand.ori =
Quaternion::rotation_x(0.8 + short * -1.2) * Quaternion::rotation_y(wave_stop * -0.1); Quaternion::rotation_x(0.8 + short * -1.2) * Quaternion::rotation_y(wave_stop * -0.1);
next.r_hand.scale = Vec3::one(); next.r_hand.scale = Vec3::one();
next.l_foot.offset = Vec3::new(-3.4, 0.0 + short * 1.0, 6.0); next.l_foot.offset = Vec3::new(-3.4, foot * 1.0, 6.0);
next.l_foot.ori = Quaternion::rotation_x(-0.0 - short * 1.2); next.l_foot.ori = Quaternion::rotation_x(foot * -1.2);
next.l_foot.scale = Vec3::one(); next.l_foot.scale = Vec3::one();
next.r_foot.offset = Vec3::new(3.4, short * -1.0, 6.0); next.r_foot.offset = Vec3::new(3.4, foot * -1.0, 6.0);
next.r_foot.ori = Quaternion::rotation_x(short * 1.2); next.r_foot.ori = Quaternion::rotation_x(foot * 1.2);
next.r_foot.scale = Vec3::one(); next.r_foot.scale = Vec3::one();
next.l_shoulder.offset = Vec3::new(-5.0, -1.0, 4.7);
next.l_shoulder.ori = Quaternion::rotation_x(short * 0.15);
next.l_shoulder.scale = Vec3::one() * 1.1;
next.r_shoulder.offset = Vec3::new(5.0, -1.0, 4.7);
next.r_shoulder.ori = Quaternion::rotation_x(short * -0.15);
next.r_shoulder.scale = Vec3::one() * 1.1;
next.glider.offset = Vec3::new(0.0, 5.0, 0.0);
next.glider.ori = Quaternion::rotation_y(0.0);
next.glider.scale = Vec3::one() * 0.0;
next.main.offset = Vec3::new( next.main.offset = Vec3::new(
-7.0 + skeleton_attr.weapon_x, -7.0 + skeleton_attr.weapon_x,
-5.0 + skeleton_attr.weapon_y, -5.0 + skeleton_attr.weapon_y,
@ -115,28 +140,36 @@ impl Animation for RunAnimation {
next.main.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57 + short * 0.25); next.main.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57 + short * 0.25);
next.main.scale = Vec3::one(); next.main.scale = Vec3::one();
next.l_shoulder.offset = Vec3::new(-5.0, -0.5, 4.7); next.second.offset = Vec3::new(
next.l_shoulder.ori = Quaternion::rotation_x(short * 0.15); 0.0 + skeleton_attr.weapon_x,
next.l_shoulder.scale = Vec3::one() * 1.1; 0.0 + skeleton_attr.weapon_y,
0.0,
next.r_shoulder.offset = Vec3::new(5.0, -0.5, 4.7); );
next.r_shoulder.ori = Quaternion::rotation_x(long * 0.15); next.second.ori = Quaternion::rotation_y(0.0);
next.r_shoulder.scale = Vec3::one() * 1.1; next.second.scale = Vec3::one() * 0.0;
next.glider.offset = Vec3::new(0.0, 5.0, 0.0);
next.glider.ori = Quaternion::rotation_y(0.0);
next.glider.scale = Vec3::one() * 0.0;
next.lantern.offset = Vec3::new(0.0, 5.0, 0.0); next.lantern.offset = Vec3::new(0.0, 5.0, 0.0);
next.lantern.ori = Quaternion::rotation_y(0.0); next.lantern.ori = Quaternion::rotation_y(0.0);
next.lantern.scale = Vec3::one() * 0.0; next.lantern.scale = Vec3::one() * 0.0;
next.torso.offset = Vec3::new(0.0, -0.3 + long * -0.08, 0.4) * skeleton_attr.scaler; next.torso.offset = Vec3::new(0.0, -0.3 + shortalt * -0.065, 0.4) * skeleton_attr.scaler;
next.torso.ori = next.torso.ori =
Quaternion::rotation_x(wave_stop * speed * -0.06 + wave_stop * speed * -0.005) Quaternion::rotation_x(wave_stop * speed * -0.05 + wave_stop * speed * -0.005)
* Quaternion::rotation_y(tilt); * Quaternion::rotation_y(tilt);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler; next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
next.control.offset = Vec3::new(0.0, 0.0, 0.0);
next.control.ori = Quaternion::rotation_x(0.0);
next.control.scale = Vec3::one();
next.l_control.offset = Vec3::new(0.0, 0.0, 0.0);
next.l_control.ori = Quaternion::rotation_x(0.0);
next.l_control.scale = Vec3::one();
next.r_control.offset = Vec3::new(0.0, 0.0, 0.0);
next.r_control.ori = Quaternion::rotation_x(0.0);
next.r_control.scale = Vec3::one();
next next
} }
} }

View File

@ -95,14 +95,6 @@ impl Animation for SitAnimation {
); );
next.r_foot.scale = Vec3::one(); next.r_foot.scale = Vec3::one();
next.main.offset = Vec3::new(
-7.0 + skeleton_attr.weapon_x,
-5.0 + skeleton_attr.weapon_y,
15.0,
);
next.main.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
next.main.scale = Vec3::one() + wave_slow_abs * -0.05;
next.l_shoulder.offset = Vec3::new(-5.0, 0.0, 4.7); next.l_shoulder.offset = Vec3::new(-5.0, 0.0, 4.7);
next.l_shoulder.ori = Quaternion::rotation_x(0.0); next.l_shoulder.ori = Quaternion::rotation_x(0.0);
next.l_shoulder.scale = (Vec3::one() + wave_slow_abs * -0.05) * 1.15; next.l_shoulder.scale = (Vec3::one() + wave_slow_abs * -0.05) * 1.15;
@ -115,6 +107,22 @@ impl Animation for SitAnimation {
next.glider.ori = Quaternion::rotation_y(0.0); next.glider.ori = Quaternion::rotation_y(0.0);
next.glider.scale = Vec3::one() * 0.0; next.glider.scale = Vec3::one() * 0.0;
next.main.offset = Vec3::new(
-7.0 + skeleton_attr.weapon_x,
-5.0 + skeleton_attr.weapon_y,
15.0,
);
next.main.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
next.main.scale = Vec3::one() + wave_slow_abs * -0.05;
next.second.offset = Vec3::new(
0.0 + skeleton_attr.weapon_x,
0.0 + skeleton_attr.weapon_y,
0.0,
);
next.second.ori = Quaternion::rotation_y(0.0);
next.second.scale = Vec3::one() * 0.0;
next.lantern.offset = Vec3::new(0.0, 0.0, 0.0); next.lantern.offset = Vec3::new(0.0, 0.0, 0.0);
next.lantern.ori = Quaternion::rotation_x(0.0); next.lantern.ori = Quaternion::rotation_x(0.0);
next.lantern.scale = Vec3::one() * 0.0; next.lantern.scale = Vec3::one() * 0.0;
@ -122,6 +130,18 @@ impl Animation for SitAnimation {
next.torso.offset = Vec3::new(0.0, -0.2, wave_stop * -0.16) * skeleton_attr.scaler; next.torso.offset = Vec3::new(0.0, -0.2, wave_stop * -0.16) * skeleton_attr.scaler;
next.torso.ori = Quaternion::rotation_x(0.0); next.torso.ori = Quaternion::rotation_x(0.0);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler; next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
next.control.offset = Vec3::new(0.0, 0.0, 0.0);
next.control.ori = Quaternion::rotation_x(0.0);
next.control.scale = Vec3::one();
next.l_control.offset = Vec3::new(0.0, 0.0, 0.0);
next.l_control.ori = Quaternion::rotation_x(0.0);
next.l_control.scale = Vec3::one();
next.r_control.offset = Vec3::new(0.0, 0.0, 0.0);
next.r_control.ori = Quaternion::rotation_x(0.0);
next.r_control.scale = Vec3::one();
next next
} }
} }

View File

@ -43,26 +43,25 @@ impl Animation for StandAnimation {
next.head.scale = Vec3::one() * skeleton_attr.head_scale; next.head.scale = Vec3::one() * skeleton_attr.head_scale;
next.chest.offset = Vec3::new(0.0, 0.0, 7.0 + slow * 0.3); next.chest.offset = Vec3::new(0.0, 0.0, 7.0 + slow * 0.3);
next.chest.ori = Quaternion::rotation_x(0.0); next.chest.ori = Quaternion::rotation_z(head_look.x * 0.6);
next.chest.scale = Vec3::one() * 1.01 + breathe * 0.05; next.chest.scale = Vec3::one() * 1.01;
next.belt.offset = Vec3::new(0.0, 0.0, 5.0 + slow * 0.3); next.belt.offset = Vec3::new(0.0, 0.0, 5.0 + slow * 0.3);
next.belt.ori = Quaternion::rotation_x(0.0); next.belt.ori = Quaternion::rotation_z(head_look.x * 0.4);
next.belt.scale = Vec3::one() + breathe * 0.05; next.belt.scale = Vec3::one() + breathe * 0.05;
next.shorts.offset = Vec3::new(0.0, 0.0, 2.0 + slow * 0.3); next.shorts.offset = Vec3::new(0.0, 0.0, 2.0 + slow * 0.3);
next.shorts.ori = Quaternion::rotation_x(0.0); next.shorts.ori = Quaternion::rotation_x(0.0);
next.shorts.scale = Vec3::one(); next.shorts.scale = Vec3::one();
next.l_hand.offset = Vec3::new(-6.0, -0.25 + slow * 0.15, 5.0 + slow * 0.5); next.l_hand.offset = Vec3::new(-7.0, -0.25 + slow * 0.15, 5.0 + slow * 0.5);
next.l_hand.ori = Quaternion::rotation_x(0.0 + slow * -0.06); next.l_hand.ori = Quaternion::rotation_x(0.0 + slow * -0.06);
next.l_hand.scale = Vec3::one(); next.l_hand.scale = Vec3::one();
next.r_hand.offset = next.r_hand.offset = Vec3::new(7.0, -0.25 + slow * 0.15, 5.0 + slow * 0.5);
Vec3::new(6.0, -0.25 + slow * 0.15, 5.0 + slow * 0.5 + breathe * -0.05);
next.r_hand.ori = Quaternion::rotation_x(0.0 + slow * -0.06); next.r_hand.ori = Quaternion::rotation_x(0.0 + slow * -0.06);
next.r_hand.scale = Vec3::one() + breathe * -0.05; next.r_hand.scale = Vec3::one();
next.l_foot.offset = Vec3::new(-3.4, -0.1, 8.0); next.l_foot.offset = Vec3::new(-3.4, -0.1, 8.0);
next.l_foot.ori = Quaternion::identity(); next.l_foot.ori = Quaternion::identity();
@ -72,14 +71,6 @@ impl Animation for StandAnimation {
next.r_foot.ori = Quaternion::identity(); next.r_foot.ori = Quaternion::identity();
next.r_foot.scale = Vec3::one(); next.r_foot.scale = Vec3::one();
next.main.offset = Vec3::new(
-7.0 + skeleton_attr.weapon_x,
-5.0 + skeleton_attr.weapon_y,
15.0,
);
next.main.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
next.main.scale = Vec3::one() + breathe * -0.05;
next.l_shoulder.offset = Vec3::new(-5.0, 0.0, 5.0); next.l_shoulder.offset = Vec3::new(-5.0, 0.0, 5.0);
next.l_shoulder.ori = Quaternion::rotation_x(0.0); next.l_shoulder.ori = Quaternion::rotation_x(0.0);
next.l_shoulder.scale = (Vec3::one() + breathe * -0.05) * 1.15; next.l_shoulder.scale = (Vec3::one() + breathe * -0.05) * 1.15;
@ -92,6 +83,22 @@ impl Animation for StandAnimation {
next.glider.ori = Quaternion::rotation_y(0.0); next.glider.ori = Quaternion::rotation_y(0.0);
next.glider.scale = Vec3::one() * 0.0; next.glider.scale = Vec3::one() * 0.0;
next.main.offset = Vec3::new(
-7.0 + skeleton_attr.weapon_x,
-5.0 + skeleton_attr.weapon_y,
18.0,
);
next.main.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
next.main.scale = Vec3::one();
next.second.offset = Vec3::new(
0.0 + skeleton_attr.weapon_x,
0.0 + skeleton_attr.weapon_y,
0.0,
);
next.second.ori = Quaternion::rotation_y(0.0);
next.second.scale = Vec3::one() * 0.0;
next.lantern.offset = Vec3::new(0.0, 0.0, 0.0); next.lantern.offset = Vec3::new(0.0, 0.0, 0.0);
next.lantern.ori = Quaternion::rotation_x(0.0); next.lantern.ori = Quaternion::rotation_x(0.0);
next.lantern.scale = Vec3::one() * 0.0; next.lantern.scale = Vec3::one() * 0.0;
@ -100,6 +107,17 @@ impl Animation for StandAnimation {
next.torso.ori = Quaternion::rotation_x(0.0); next.torso.ori = Quaternion::rotation_x(0.0);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler; next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
next.control.offset = Vec3::new(0.0, 0.0, 0.0);
next.control.ori = Quaternion::rotation_x(0.0);
next.control.scale = Vec3::one();
next.l_control.offset = Vec3::new(0.0, 0.0, 0.0);
next.l_control.ori = Quaternion::rotation_x(0.0);
next.l_control.scale = Vec3::one();
next.r_control.offset = Vec3::new(0.0, 0.0, 0.0);
next.r_control.ori = Quaternion::rotation_x(0.0);
next.r_control.scale = Vec3::one();
next next
} }
} }

View File

@ -95,15 +95,6 @@ impl Animation for SwimAnimation {
next.r_foot.ori = Quaternion::rotation_x(-0.0 + wave_cos * 1.5); next.r_foot.ori = Quaternion::rotation_x(-0.0 + wave_cos * 1.5);
next.r_foot.scale = Vec3::one(); next.r_foot.scale = Vec3::one();
next.main.offset = Vec3::new(
-7.0 + skeleton_attr.weapon_x,
-5.0 + skeleton_attr.weapon_y,
15.0,
);
next.main.ori =
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57 + wave_cos * 0.25);
next.main.scale = Vec3::one();
next.l_shoulder.offset = Vec3::new(-5.0, 0.0, 4.7); next.l_shoulder.offset = Vec3::new(-5.0, 0.0, 4.7);
next.l_shoulder.ori = Quaternion::rotation_x(wave_cos * 0.15); next.l_shoulder.ori = Quaternion::rotation_x(wave_cos * 0.15);
next.l_shoulder.scale = Vec3::one() * 1.1; next.l_shoulder.scale = Vec3::one() * 1.1;
@ -116,6 +107,23 @@ impl Animation for SwimAnimation {
next.glider.ori = Quaternion::rotation_y(0.0); next.glider.ori = Quaternion::rotation_y(0.0);
next.glider.scale = Vec3::one() * 0.0; next.glider.scale = Vec3::one() * 0.0;
next.main.offset = Vec3::new(
-7.0 + skeleton_attr.weapon_x,
-5.0 + skeleton_attr.weapon_y,
18.0,
);
next.main.ori =
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57 + wave_cos * 0.25);
next.main.scale = Vec3::one();
next.second.offset = Vec3::new(
0.0 + skeleton_attr.weapon_x,
0.0 + skeleton_attr.weapon_y,
0.0,
);
next.second.ori = Quaternion::rotation_y(0.0);
next.second.scale = Vec3::one() * 0.0;
next.lantern.offset = Vec3::new(0.0, 5.0, 0.0); next.lantern.offset = Vec3::new(0.0, 5.0, 0.0);
next.lantern.ori = Quaternion::rotation_y(0.0); next.lantern.ori = Quaternion::rotation_y(0.0);
next.lantern.scale = Vec3::one() * 0.0; next.lantern.scale = Vec3::one() * 0.0;
@ -126,6 +134,17 @@ impl Animation for SwimAnimation {
* Quaternion::rotation_y(0.0); * Quaternion::rotation_y(0.0);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler; next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
next.control.offset = Vec3::new(0.0, 0.0, 0.0);
next.control.ori = Quaternion::rotation_x(0.0);
next.control.scale = Vec3::one();
next.l_control.offset = Vec3::new(0.0, 0.0, 0.0);
next.l_control.ori = Quaternion::rotation_x(0.0);
next.l_control.scale = Vec3::one();
next.r_control.offset = Vec3::new(0.0, 0.0, 0.0);
next.r_control.ori = Quaternion::rotation_x(0.0);
next.r_control.scale = Vec3::one();
next next
} }
} }

View File

@ -30,21 +30,23 @@ impl Animation for WieldAnimation {
match active_tool_kind { match active_tool_kind {
//TODO: Inventory //TODO: Inventory
Some(Tool::Sword) => { Some(Tool::Sword) => {
next.l_hand.offset = Vec3::new(-6.0, -2.0, 1.0); next.l_hand.offset = Vec3::new(0.0, -5.0, -5.0);
next.l_hand.ori = Quaternion::rotation_x(1.27); next.l_hand.ori = Quaternion::rotation_x(1.27);
next.l_hand.scale = Vec3::one() * 1.00; next.l_hand.scale = Vec3::one() * 1.04;
next.r_hand.offset = Vec3::new(-6.0, -2.5, -1.0); next.r_hand.offset = Vec3::new(0.0, -6.0, -8.0);
next.r_hand.ori = Quaternion::rotation_x(1.27); next.r_hand.ori = Quaternion::rotation_x(1.27);
next.r_hand.scale = Vec3::one() * 1.01; next.r_hand.scale = Vec3::one() * 1.05;
next.main.offset = Vec3::new( next.main.offset = Vec3::new(0.0, 0.0, -6.0);
-6.0 + skeleton_attr.weapon_x,
5.5 + skeleton_attr.weapon_y,
1.0,
);
next.main.ori = Quaternion::rotation_x(-0.3) next.main.ori = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(0.0) * Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0); * Quaternion::rotation_z(0.0);
next.main.scale = Vec3::one(); next.main.scale = Vec3::one();
next.control.offset = Vec3::new(-8.0, 4.0, 6.0);
next.control.ori = Quaternion::rotation_x(0.0)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.control.scale = Vec3::one();
}, },
Some(Tool::Axe) => { Some(Tool::Axe) => {
next.l_hand.offset = Vec3::new(-6.5, -0.5, 6.0); next.l_hand.offset = Vec3::new(-6.5, -0.5, 6.0);
@ -200,6 +202,14 @@ impl Animation for WieldAnimation {
next.torso.offset = Vec3::new(0.0, 0.3 + wave * -0.08, 0.4) * skeleton_attr.scaler; next.torso.offset = Vec3::new(0.0, 0.3 + wave * -0.08, 0.4) * skeleton_attr.scaler;
next.torso.ori = Quaternion::rotation_x(wave_stop * -0.2); next.torso.ori = Quaternion::rotation_x(wave_stop * -0.2);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler; next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
next.l_control.offset = Vec3::new(0.0, 0.0, 0.0);
next.l_control.ori = Quaternion::rotation_x(0.0);
next.l_control.scale = Vec3::one();
next.r_control.offset = Vec3::new(0.0, 0.0, 0.0);
next.r_control.ori = Quaternion::rotation_x(0.0);
next.r_control.scale = Vec3::one();
next next
} }
} }

View File

@ -32,7 +32,7 @@ impl CritterSkeleton {
impl Skeleton for CritterSkeleton { impl Skeleton for CritterSkeleton {
type Attr = CritterAttr; type Attr = CritterAttr;
fn compute_matrices(&self) -> [FigureBoneData; 16] { fn compute_matrices(&self) -> [FigureBoneData; 18] {
[ [
FigureBoneData::new(self.head.compute_base_matrix()), FigureBoneData::new(self.head.compute_base_matrix()),
FigureBoneData::new(self.chest.compute_base_matrix()), FigureBoneData::new(self.chest.compute_base_matrix()),
@ -50,6 +50,8 @@ impl Skeleton for CritterSkeleton {
FigureBoneData::default(), FigureBoneData::default(),
FigureBoneData::default(), FigureBoneData::default(),
FigureBoneData::default(), FigureBoneData::default(),
FigureBoneData::default(),
FigureBoneData::default(),
] ]
} }

View File

@ -49,7 +49,7 @@ impl DragonSkeleton {
impl Skeleton for DragonSkeleton { impl Skeleton for DragonSkeleton {
type Attr = SkeletonAttr; type Attr = SkeletonAttr;
fn compute_matrices(&self) -> [FigureBoneData; 16] { fn compute_matrices(&self) -> [FigureBoneData; 18] {
let chest_front_mat = self.chest_front.compute_base_matrix(); let chest_front_mat = self.chest_front.compute_base_matrix();
let wing_in_l_mat = self.wing_in_l.compute_base_matrix(); let wing_in_l_mat = self.wing_in_l.compute_base_matrix();
let wing_in_r_mat = self.wing_in_r.compute_base_matrix(); let wing_in_r_mat = self.wing_in_r.compute_base_matrix();
@ -72,6 +72,8 @@ impl Skeleton for DragonSkeleton {
FigureBoneData::default(), FigureBoneData::default(),
FigureBoneData::default(), FigureBoneData::default(),
FigureBoneData::default(), FigureBoneData::default(),
FigureBoneData::default(),
FigureBoneData::default(),
] ]
} }

View File

@ -35,7 +35,7 @@ impl FishMediumSkeleton {
impl Skeleton for FishMediumSkeleton { impl Skeleton for FishMediumSkeleton {
type Attr = SkeletonAttr; type Attr = SkeletonAttr;
fn compute_matrices(&self) -> [FigureBoneData; 16] { fn compute_matrices(&self) -> [FigureBoneData; 18] {
let torso_mat = self.torso.compute_base_matrix(); let torso_mat = self.torso.compute_base_matrix();
let rear_mat = self.rear.compute_base_matrix(); let rear_mat = self.rear.compute_base_matrix();
@ -56,6 +56,8 @@ impl Skeleton for FishMediumSkeleton {
FigureBoneData::default(), FigureBoneData::default(),
FigureBoneData::default(), FigureBoneData::default(),
FigureBoneData::default(), FigureBoneData::default(),
FigureBoneData::default(),
FigureBoneData::default(),
] ]
} }

View File

@ -27,7 +27,7 @@ impl FishSmallSkeleton {
impl Skeleton for FishSmallSkeleton { impl Skeleton for FishSmallSkeleton {
type Attr = SkeletonAttr; type Attr = SkeletonAttr;
fn compute_matrices(&self) -> [FigureBoneData; 16] { fn compute_matrices(&self) -> [FigureBoneData; 18] {
let torso_mat = self.torso.compute_base_matrix(); let torso_mat = self.torso.compute_base_matrix();
[ [
@ -47,6 +47,8 @@ impl Skeleton for FishSmallSkeleton {
FigureBoneData::default(), FigureBoneData::default(),
FigureBoneData::default(), FigureBoneData::default(),
FigureBoneData::default(), FigureBoneData::default(),
FigureBoneData::default(),
FigureBoneData::default(),
] ]
} }

View File

@ -13,7 +13,7 @@ impl FixtureSkeleton {
impl Skeleton for FixtureSkeleton { impl Skeleton for FixtureSkeleton {
type Attr = SkeletonAttr; type Attr = SkeletonAttr;
fn compute_matrices(&self) -> [FigureBoneData; 16] { fn compute_matrices(&self) -> [FigureBoneData; 18] {
[ [
FigureBoneData::new(vek::Mat4::identity()), FigureBoneData::new(vek::Mat4::identity()),
FigureBoneData::new(vek::Mat4::identity()), FigureBoneData::new(vek::Mat4::identity()),
@ -31,6 +31,8 @@ impl Skeleton for FixtureSkeleton {
FigureBoneData::new(vek::Mat4::identity()), FigureBoneData::new(vek::Mat4::identity()),
FigureBoneData::new(vek::Mat4::identity()), FigureBoneData::new(vek::Mat4::identity()),
FigureBoneData::new(vek::Mat4::identity()), FigureBoneData::new(vek::Mat4::identity()),
FigureBoneData::new(vek::Mat4::identity()),
FigureBoneData::new(vek::Mat4::identity()),
] ]
} }

View File

@ -51,7 +51,7 @@ impl Bone {
pub trait Skeleton: Send + Sync + 'static { pub trait Skeleton: Send + Sync + 'static {
type Attr; type Attr;
fn compute_matrices(&self) -> [FigureBoneData; 16]; fn compute_matrices(&self) -> [FigureBoneData; 18];
/// Change the current skeleton to be more like `target`. /// Change the current skeleton to be more like `target`.
fn interpolate(&mut self, target: &Self, dt: f32); fn interpolate(&mut self, target: &Self, dt: f32);

View File

@ -15,7 +15,7 @@ const SCALE: f32 = 1.0 / 11.0;
impl Skeleton for ObjectSkeleton { impl Skeleton for ObjectSkeleton {
type Attr = SkeletonAttr; type Attr = SkeletonAttr;
fn compute_matrices(&self) -> [FigureBoneData; 16] { fn compute_matrices(&self) -> [FigureBoneData; 18] {
[ [
FigureBoneData::new(Mat4::scaling_3d(Vec3::broadcast(SCALE))), FigureBoneData::new(Mat4::scaling_3d(Vec3::broadcast(SCALE))),
FigureBoneData::new(Mat4::scaling_3d(Vec3::broadcast(SCALE))), FigureBoneData::new(Mat4::scaling_3d(Vec3::broadcast(SCALE))),
@ -33,6 +33,8 @@ impl Skeleton for ObjectSkeleton {
FigureBoneData::new(Mat4::scaling_3d(Vec3::broadcast(SCALE))), FigureBoneData::new(Mat4::scaling_3d(Vec3::broadcast(SCALE))),
FigureBoneData::new(Mat4::scaling_3d(Vec3::broadcast(SCALE))), FigureBoneData::new(Mat4::scaling_3d(Vec3::broadcast(SCALE))),
FigureBoneData::new(Mat4::scaling_3d(Vec3::broadcast(SCALE))), FigureBoneData::new(Mat4::scaling_3d(Vec3::broadcast(SCALE))),
FigureBoneData::new(Mat4::scaling_3d(Vec3::broadcast(SCALE))),
FigureBoneData::new(Mat4::scaling_3d(Vec3::broadcast(SCALE))),
] ]
} }

View File

@ -31,7 +31,7 @@ impl QuadrupedMediumSkeleton {
impl Skeleton for QuadrupedMediumSkeleton { impl Skeleton for QuadrupedMediumSkeleton {
type Attr = SkeletonAttr; type Attr = SkeletonAttr;
fn compute_matrices(&self) -> [FigureBoneData; 16] { fn compute_matrices(&self) -> [FigureBoneData; 18] {
let ears_mat = self.ears.compute_base_matrix(); let ears_mat = self.ears.compute_base_matrix();
let head_upper_mat = self.head_upper.compute_base_matrix(); let head_upper_mat = self.head_upper.compute_base_matrix();
let head_lower_mat = self.head_lower.compute_base_matrix(); let head_lower_mat = self.head_lower.compute_base_matrix();
@ -53,6 +53,8 @@ impl Skeleton for QuadrupedMediumSkeleton {
FigureBoneData::default(), FigureBoneData::default(),
FigureBoneData::default(), FigureBoneData::default(),
FigureBoneData::default(), FigureBoneData::default(),
FigureBoneData::default(),
FigureBoneData::default(),
] ]
} }

View File

@ -26,7 +26,7 @@ impl QuadrupedSmallSkeleton {
impl Skeleton for QuadrupedSmallSkeleton { impl Skeleton for QuadrupedSmallSkeleton {
type Attr = SkeletonAttr; type Attr = SkeletonAttr;
fn compute_matrices(&self) -> [FigureBoneData; 16] { fn compute_matrices(&self) -> [FigureBoneData; 18] {
[ [
FigureBoneData::new(self.head.compute_base_matrix()), FigureBoneData::new(self.head.compute_base_matrix()),
FigureBoneData::new(self.chest.compute_base_matrix()), FigureBoneData::new(self.chest.compute_base_matrix()),
@ -44,6 +44,8 @@ impl Skeleton for QuadrupedSmallSkeleton {
FigureBoneData::default(), FigureBoneData::default(),
FigureBoneData::default(), FigureBoneData::default(),
FigureBoneData::default(), FigureBoneData::default(),
FigureBoneData::default(),
FigureBoneData::default(),
] ]
} }

View File

@ -172,19 +172,6 @@ impl<Skel: Skeleton> FigureModelCache<Skel> {
}, },
CameraMode::FirstPerson => None, CameraMode::FirstPerson => None,
}, },
if camera_mode != CameraMode::FirstPerson
|| character_state
.map(|cs| {
cs.action.is_attack()
|| cs.action.is_block()
|| cs.action.is_wield()
})
.unwrap_or_default()
{
Some(mesh_main(equipment.and_then(|e| e.main.as_ref())))
} else {
None
},
match camera_mode { match camera_mode {
CameraMode::ThirdPerson => Some( CameraMode::ThirdPerson => Some(
humanoid_armor_shoulder_spec.mesh_left_shoulder(&body), humanoid_armor_shoulder_spec.mesh_left_shoulder(&body),
@ -198,6 +185,19 @@ impl<Skel: Skeleton> FigureModelCache<Skel> {
CameraMode::FirstPerson => None, CameraMode::FirstPerson => None,
}, },
Some(mesh_glider()), Some(mesh_glider()),
if camera_mode != CameraMode::FirstPerson
|| character_state
.map(|cs| {
cs.action.is_attack()
|| cs.action.is_block()
|| cs.action.is_wield()
})
.unwrap_or_default()
{
Some(mesh_main(equipment.and_then(|e| e.main.as_ref())))
} else {
None
},
Some(mesh_lantern()), Some(mesh_lantern()),
None, None,
None, None,