slowed movement for block/attack, cleaned up code, made foot speed velocity dependent, tweaked blocking animation

This commit is contained in:
jshipsey 2019-08-28 22:17:08 -04:00
parent b99bac87db
commit 78bf7a0997
11 changed files with 322 additions and 206 deletions

View File

@ -20,6 +20,8 @@ const HUMANOID_AIR_SPEED: f32 = 100.0;
const ROLL_SPEED: f32 = 13.0;
const GLIDE_ACCEL: f32 = 15.0;
const GLIDE_SPEED: f32 = 45.0;
const BLOCK_ACCEL: f32 = 30.0;
const BLOCK_SPEED: f32 = 75.0;
// Gravity is 9.81 * 4, so this makes gravity equal to .15
const GLIDE_ANTIGRAV: f32 = 9.81 * 3.95;
@ -80,6 +82,21 @@ impl<'a> System<'a> for Sys {
.try_normalized()
.unwrap_or(Vec2::from(vel.0).try_normalized().unwrap_or_default())
* ROLL_SPEED
}
if character.action.is_block() {
vel.0 += Vec2::broadcast(dt.0)
* controller.move_dir
* match (physics.on_ground) {
(true) if vel.0.magnitude_squared() < BLOCK_SPEED.powf(2.0) => BLOCK_ACCEL,
_ => 0.0,
}
} else if character.action.is_attack() {
vel.0 += Vec2::broadcast(dt.0)
* controller.move_dir
* match (physics.on_ground) {
(true) if vel.0.magnitude_squared() < BLOCK_SPEED.powf(2.0) => BLOCK_ACCEL,
_ => 0.0,
}
} else {
// Move player according to move_dir
vel.0 += Vec2::broadcast(dt.0)

View File

@ -107,23 +107,23 @@ impl Animation for BlockAnimation {
next.weapon.scale = Vec3::one();
}
Tool::Hammer => {
next.l_hand.offset = Vec3::new(-5.5, 9.0, 5.5);
next.l_hand.offset = Vec3::new(-5.5, 10.0, 9.5);
next.l_hand.ori = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(-1.57)
* Quaternion::rotation_y(-1.35)
* Quaternion::rotation_z(0.5);
next.l_hand.scale = Vec3::one() * 1.01;
next.r_hand.offset = Vec3::new(8.4, 9.3, 5.5);
next.r_hand.offset = Vec3::new(8.4, 9.3, 7.5);
next.r_hand.ori = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(-1.57)
* Quaternion::rotation_y(-1.35)
* Quaternion::rotation_z(0.5);
next.r_hand.scale = Vec3::one() * 1.01;
next.weapon.offset = Vec3::new(
7.0 + skeleton_attr.weapon_x,
10.75 + skeleton_attr.weapon_y,
5.5,
7.5,
);
next.weapon.ori = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(-1.57)
* Quaternion::rotation_y(-1.35)
* Quaternion::rotation_z(0.5);
next.weapon.scale = Vec3::one();
}

View File

@ -0,0 +1,252 @@
use super::{
super::{Animation, SkeletonAttr},
CharacterSkeleton,
};
use common::comp::item::Tool;
use std::{f32::consts::PI, ops::Mul};
use vek::*;
pub struct Input {
pub attack: bool,
}
pub struct BlockIdleAnimation;
impl Animation for BlockIdleAnimation {
type Skeleton = CharacterSkeleton;
type Dependency = f64;
fn update_skeleton(
skeleton: &Self::Skeleton,
global_time: f64,
anim_time: f64,
skeleton_attr: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let wave_ultra_slow = (anim_time as f32 * 3.0 + PI).sin();
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 _head_look = Vec2::new(
((global_time + anim_time) as f32 / 1.5)
.floor()
.mul(7331.0)
.sin()
* 0.3,
((global_time + anim_time) as f32 / 1.5)
.floor()
.mul(1337.0)
.sin()
* 0.15,
);
next.head.offset = Vec3::new(
0.0 + skeleton_attr.neck_right + wave_slow_cos * 0.2,
1.0 + skeleton_attr.neck_forward,
skeleton_attr.neck_height + 13.5 + wave_ultra_slow * 0.2,
);
next.head.ori = Quaternion::rotation_x(-0.25);
next.head.scale = Vec3::one() * 1.01 * skeleton_attr.head_scale;
next.chest.offset = Vec3::new(0.0 + wave_slow_cos * 0.2, 0.0, 5.0 + wave_ultra_slow * 0.2);
next.chest.ori =
Quaternion::rotation_x(-0.15) * Quaternion::rotation_y(wave_ultra_slow_cos * 0.01);
next.chest.scale = Vec3::one();
next.belt.offset = Vec3::new(0.0 + wave_slow_cos * 0.2, 0.0, 3.0 + wave_ultra_slow * 0.2);
next.belt.ori =
Quaternion::rotation_x(0.0) * Quaternion::rotation_y(wave_ultra_slow_cos * 0.008);
next.belt.scale = Vec3::one() * 1.01;
next.shorts.offset = Vec3::new(0.0 + wave_slow_cos * 0.2, 0.0, 1.0 + wave_ultra_slow * 0.2);
next.shorts.ori = Quaternion::rotation_x(0.1);
next.shorts.scale = Vec3::one();
match Tool::Hammer {
//TODO: Inventory
Tool::Sword => {
next.l_hand.offset = Vec3::new(-6.0, 3.5, 0.0 + wave_ultra_slow * 1.0);
next.l_hand.ori = Quaternion::rotation_x(-0.3);
next.l_hand.scale = Vec3::one() * 1.01;
next.r_hand.offset = Vec3::new(-6.0, 3.0, -2.0);
next.r_hand.ori = Quaternion::rotation_x(-0.3);
next.r_hand.scale = Vec3::one() * 1.01;
next.weapon.offset = Vec3::new(
-6.0 + skeleton_attr.weapon_x,
4.5 + skeleton_attr.weapon_y,
0.0,
);
next.weapon.ori = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.weapon.scale = Vec3::one();
}
Tool::Axe => {
next.l_hand.offset = Vec3::new(
-6.0 + wave_ultra_slow_cos * 1.0,
3.5 + wave_ultra_slow_cos * 0.5,
0.0 + wave_ultra_slow * 1.0,
);
next.l_hand.ori = Quaternion::rotation_x(-0.3);
next.l_hand.scale = Vec3::one() * 1.01;
next.r_hand.offset = Vec3::new(
-6.0 + wave_ultra_slow_cos * 1.0,
3.0 + wave_ultra_slow_cos * 0.5,
-2.0 + wave_ultra_slow * 1.0,
);
next.r_hand.ori = Quaternion::rotation_x(-0.3);
next.r_hand.scale = Vec3::one() * 1.01;
next.weapon.offset = Vec3::new(
-6.0 + skeleton_attr.weapon_x,
4.5 + skeleton_attr.weapon_y,
0.0 + wave_ultra_slow * 1.0,
);
next.weapon.ori = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.weapon.scale = Vec3::one();
}
Tool::Hammer => {
next.l_hand.offset = Vec3::new(-5.5, 10.0 + wave_ultra_slow * 2.0, 9.5);
next.l_hand.ori = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(-1.35)
* Quaternion::rotation_z(0.5);
next.l_hand.scale = Vec3::one() * 1.01;
next.r_hand.offset = Vec3::new(8.4, 9.3 + wave_ultra_slow * 2.0, 7.5);
next.r_hand.ori = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(-1.35)
* Quaternion::rotation_z(0.5);
next.r_hand.scale = Vec3::one() * 1.01;
next.weapon.offset = Vec3::new(
7.0 + skeleton_attr.weapon_x,
10.75 + skeleton_attr.weapon_y + wave_ultra_slow * 2.0,
7.5,
);
next.weapon.ori = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(-1.35)
* Quaternion::rotation_z(0.5);
next.weapon.scale = Vec3::one();
}
Tool::Staff => {
next.l_hand.offset = Vec3::new(
-6.0 + wave_ultra_slow_cos * 1.0,
3.5 + wave_ultra_slow_cos * 0.5,
0.0 + wave_ultra_slow * 1.0,
);
next.l_hand.ori = Quaternion::rotation_x(-0.3);
next.l_hand.scale = Vec3::one() * 1.01;
next.r_hand.offset = Vec3::new(
-6.0 + wave_ultra_slow_cos * 1.0,
3.0 + wave_ultra_slow_cos * 0.5,
-2.0 + wave_ultra_slow * 1.0,
);
next.r_hand.ori = Quaternion::rotation_x(-0.3);
next.r_hand.scale = Vec3::one() * 1.01;
next.weapon.offset = Vec3::new(
-6.0 + skeleton_attr.weapon_x + wave_ultra_slow_cos * 1.0,
4.5 + skeleton_attr.weapon_y + wave_ultra_slow_cos * 0.5,
0.0 + wave_ultra_slow * 1.0,
);
next.weapon.ori = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.weapon.scale = Vec3::one();
}
Tool::SwordShield => {
next.l_hand.offset = Vec3::new(
-6.0 + wave_ultra_slow_cos * 1.0,
3.5 + wave_ultra_slow_cos * 0.5,
0.0 + wave_ultra_slow * 1.0,
);
next.l_hand.ori = Quaternion::rotation_x(-0.3);
next.l_hand.scale = Vec3::one() * 1.01;
next.r_hand.offset = Vec3::new(
-6.0 + wave_ultra_slow_cos * 1.0,
3.0 + wave_ultra_slow_cos * 0.5,
-2.0 + wave_ultra_slow * 1.0,
);
next.r_hand.ori = Quaternion::rotation_x(-0.3);
next.r_hand.scale = Vec3::one() * 1.01;
next.weapon.offset = Vec3::new(
-6.0 + skeleton_attr.weapon_x + wave_ultra_slow_cos * 1.0,
4.5 + skeleton_attr.weapon_y + wave_ultra_slow_cos * 0.5,
0.0 + wave_ultra_slow * 1.0,
);
next.weapon.ori = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.weapon.scale = Vec3::one();
}
Tool::Bow => {
next.l_hand.offset = Vec3::new(
-6.0 + wave_ultra_slow_cos * 1.0,
3.5 + wave_ultra_slow_cos * 0.5,
0.0 + wave_ultra_slow * 1.0,
);
next.l_hand.ori = Quaternion::rotation_x(-0.3);
next.l_hand.scale = Vec3::one() * 1.01;
next.r_hand.offset = Vec3::new(
-6.0 + wave_ultra_slow_cos * 1.0,
3.0 + wave_ultra_slow_cos * 0.5,
-2.0 + wave_ultra_slow * 1.0,
);
next.r_hand.ori = Quaternion::rotation_x(-0.3);
next.r_hand.scale = Vec3::one() * 1.01;
next.weapon.offset = Vec3::new(
-6.0 + skeleton_attr.weapon_x + wave_ultra_slow_cos * 1.0,
4.5 + skeleton_attr.weapon_y + wave_ultra_slow_cos * 0.5,
0.0 + wave_ultra_slow * 1.0,
);
next.weapon.ori = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.weapon.scale = Vec3::one();
}
Tool::Daggers => {
next.l_hand.offset = Vec3::new(
-6.0 + wave_ultra_slow_cos * 1.0,
3.5 + wave_ultra_slow_cos * 0.5,
0.0 + wave_ultra_slow * 1.0,
);
next.l_hand.ori = Quaternion::rotation_x(-0.3);
next.l_hand.scale = Vec3::one() * 1.01;
next.r_hand.offset = Vec3::new(-6.0, 3.0, -2.0);
next.r_hand.ori = Quaternion::rotation_x(-0.3);
next.r_hand.scale = Vec3::one() * 1.01;
next.weapon.offset = Vec3::new(
-6.0 + skeleton_attr.weapon_x,
4.5 + skeleton_attr.weapon_y,
0.0,
);
next.weapon.ori = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.weapon.scale = Vec3::one();
}
}
next.l_foot.offset = Vec3::new(-3.4, 0.3, 8.0 + wave_ultra_slow_cos * 0.1);
next.l_foot.ori = Quaternion::rotation_x(-0.3);
next.l_foot.scale = Vec3::one();
next.r_foot.offset = Vec3::new(3.4, 1.2, 8.0 + wave_ultra_slow * 0.1);
next.r_foot.ori = Quaternion::rotation_x(0.3);
next.r_foot.scale = Vec3::one();
next.l_shoulder.offset = Vec3::new(-5.0, 0.0, 4.7);
next.l_shoulder.ori = Quaternion::rotation_x(0.0);
next.l_shoulder.scale = Vec3::one() * 1.1;
next.r_shoulder.offset = Vec3::new(5.0, 0.0, 4.7);
next.r_shoulder.ori = Quaternion::rotation_x(0.0);
next.r_shoulder.scale = Vec3::one() * 1.1;
next.draw.offset = Vec3::new(0.0, 5.0, 0.0);
next.draw.ori = Quaternion::rotation_y(0.0);
next.draw.scale = Vec3::one() * 0.0;
next.torso.offset = Vec3::new(0.0, -0.2, 0.1) * skeleton_attr.scaler;
next.torso.ori = Quaternion::rotation_x(0.0);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
next
}
}

View File

@ -7,9 +7,9 @@ use std::f32::consts::PI;
use std::ops::Mul;
use vek::*;
pub struct CrunAnimation;
pub struct WieldAnimation;
impl Animation for CrunAnimation {
impl Animation for WieldAnimation {
type Skeleton = CharacterSkeleton;
type Dependency = (f32, f64);

View File

@ -82,7 +82,7 @@ impl Animation for IdleAnimation {
next.r_foot.offset = Vec3::new(3.4, -0.1, 8.0);
next.r_foot.ori = Quaternion::identity();
next.r_foot.scale = Vec3::one();
next.weapon.offset = Vec3::new(
-7.0 + skeleton_attr.weapon_x,
-5.0 + skeleton_attr.weapon_y,

View File

@ -1,107 +0,0 @@
use super::{
super::{Animation, SkeletonAttr},
CharacterSkeleton,
};
use std::f32::consts::PI;
use std::ops::Mul;
use vek::*;
pub struct LeanAnimation;
impl Animation for LeanAnimation {
type Skeleton = CharacterSkeleton;
type Dependency = (f32, f64);
fn update_skeleton(
skeleton: &Self::Skeleton,
(velocity, global_time): Self::Dependency,
anim_time: f64,
skeleton_attr: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let wave = (anim_time as f32 * 12.0).sin();
let wave_cos = (anim_time as f32 * 12.0).cos();
let wave_diff = (anim_time as f32 * 12.0 + PI / 2.0).sin();
let wave_cos_dub = (anim_time as f32 * 24.0).cos();
let wave_stop = (anim_time as f32 * 2.6).min(PI / 2.0).sin();
let head_look = Vec2::new(
((global_time + anim_time) as f32 / 2.0)
.floor()
.mul(7331.0)
.sin()
* 0.2,
((global_time + anim_time) as f32 / 2.0)
.floor()
.mul(1337.0)
.sin()
* 0.1,
);
next.head.offset = Vec3::new(
0.0,
-1.0 + skeleton_attr.neck_forward,
skeleton_attr.neck_height + 15.0 + wave_cos * 1.3,
);
next.head.ori = Quaternion::rotation_z(head_look.x + wave * 0.1)
* Quaternion::rotation_x(head_look.y + 0.35);
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
next.chest.offset = Vec3::new(0.0, 0.0, 7.0 + wave_cos * 1.1);
next.chest.ori = Quaternion::rotation_z(wave * 0.2);
next.chest.scale = Vec3::one();
next.belt.offset = Vec3::new(0.0, 0.0, 5.0 + wave_cos * 1.1);
next.belt.ori = Quaternion::rotation_z(wave * 0.35);
next.belt.scale = Vec3::one();
next.shorts.offset = Vec3::new(0.0, 0.0, 2.0 + wave_cos * 1.1);
next.shorts.ori = Quaternion::rotation_z(wave * 0.6);
next.shorts.scale = Vec3::one();
next.l_hand.offset = Vec3::new(
-7.5 + wave_cos_dub * 1.0,
2.0 + wave_cos * 5.0,
0.0 - wave * 1.5,
);
next.l_hand.ori = Quaternion::rotation_x(wave_cos * 0.8);
next.l_hand.scale = Vec3::one();
next.r_hand.offset = Vec3::new(
7.5 - wave_cos_dub * 1.0,
2.0 - wave_cos * 5.0,
0.0 + wave * 1.5,
);
next.r_hand.ori = Quaternion::rotation_x(wave_cos * -0.8);
next.r_hand.scale = Vec3::one();
next.weapon.offset = Vec3::new(
-7.0 + skeleton_attr.weapon_x,
-5.0 + skeleton_attr.weapon_y,
15.0,
);
next.weapon.ori =
Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57 + wave_cos * 0.25);
next.weapon.scale = Vec3::one();
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.scale = Vec3::one() * 1.1;
next.r_shoulder.offset = Vec3::new(5.0, 0.0, 4.7);
next.r_shoulder.ori = Quaternion::rotation_x(wave * 0.15);
next.r_shoulder.scale = Vec3::one() * 1.1;
next.draw.offset = Vec3::new(0.0, 5.0, 0.0);
next.draw.ori = Quaternion::rotation_y(0.0);
next.draw.scale = Vec3::one() * 0.0;
next.torso.offset = Vec3::new(0.0, -0.2 + wave * -0.08, 0.4) * skeleton_attr.scaler;
next.torso.ori =
Quaternion::rotation_x(wave_stop * velocity * -0.06 + wave_diff * velocity * -0.005);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
next
}
}

View File

@ -1,29 +1,27 @@
pub mod attack;
pub mod block;
pub mod blockidle;
pub mod cidle;
pub mod cjump;
pub mod crun;
pub mod gliding;
pub mod idle;
pub mod stand;
pub mod jump;
pub mod roll;
pub mod run;
pub mod lean;
pub mod stand;
pub mod wield;
// Reexports
pub use self::attack::AttackAnimation;
pub use self::block::BlockAnimation;
pub use self::blockidle::BlockIdleAnimation;
pub use self::cidle::CidleAnimation;
pub use self::cjump::CjumpAnimation;
pub use self::crun::CrunAnimation;
pub use self::gliding::GlidingAnimation;
pub use self::idle::IdleAnimation;
pub use self::stand::StandAnimation;
pub use self::jump::JumpAnimation;
pub use self::roll::RollAnimation;
pub use self::run::RunAnimation;
pub use self::lean::LeanAnimation;
pub use self::stand::StandAnimation;
pub use self::wield::WieldAnimation;
use super::{Bone, Skeleton};
use crate::render::FigureBoneData;

View File

@ -20,10 +20,11 @@ impl Animation for RunAnimation {
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let wave = (anim_time as f32 * 12.0).sin();
let wave_cos = (anim_time as f32 * 12.0).cos();
let wave_diff = (anim_time as f32 * 12.0 + PI / 2.0).sin();
let wave_cos_dub = (anim_time as f32 * 24.0).cos();
let wave = (anim_time as f32 * velocity * 1.2).sin();
let wave_cos = (anim_time as f32 * velocity * 1.2).cos();
let wave_diff = (anim_time as f32 * velocity * 0.6).sin();
let wave_cos_dub = (anim_time as f32 * velocity * 2.4).cos();
let wave_stop = (anim_time as f32 * 2.6).min(PI / 2.0).sin();
let head_look = Vec2::new(
((global_time + anim_time) as f32 / 2.0)
@ -108,7 +109,6 @@ impl Animation for RunAnimation {
Quaternion::rotation_x(wave_stop * velocity * -0.06 + wave_diff * velocity * -0.005);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
next
}
}

View File

@ -75,7 +75,6 @@ impl Animation for StandAnimation {
next.r_hand.ori = Quaternion::rotation_x(0.0 + wave_ultra_slow * -0.06);
next.r_hand.scale = Vec3::one();
next.l_foot.offset = Vec3::new(-3.4, -0.1, 8.0);
next.l_foot.ori = Quaternion::identity();
next.l_foot.scale = Vec3::one();
@ -108,7 +107,6 @@ impl Animation for StandAnimation {
next.torso.ori = Quaternion::rotation_x(0.0);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
next
}
}

View File

@ -3,59 +3,37 @@ use super::{
CharacterSkeleton,
};
use common::comp::item::Tool;
use std::f32::consts::PI;
use vek::*;
pub struct CjumpAnimation;
pub struct WieldAnimation;
impl Animation for CjumpAnimation {
impl Animation for WieldAnimation {
type Skeleton = CharacterSkeleton;
type Dependency = f64;
type Dependency = (f32, f64);
fn update_skeleton(
skeleton: &Self::Skeleton,
_global_time: f64,
(_velocity, _global_time): Self::Dependency,
anim_time: f64,
skeleton_attr: &SkeletonAttr,
) -> Self::Skeleton {
let mut next = (*skeleton).clone();
let wave_slow = (anim_time as f32 * 7.0).sin();
let wave_stop = (anim_time as f32 * 4.5).min(PI / 2.0).sin();
next.head.offset = Vec3::new(
0.0 + skeleton_attr.neck_right,
0.0 + skeleton_attr.neck_forward,
skeleton_attr.neck_height + 15.0,
);
next.head.ori = Quaternion::rotation_x(0.25 + wave_stop * 0.1 + wave_slow * 0.04);
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
next.chest.offset = Vec3::new(0.0, 0.0, 8.0);
next.chest.ori = Quaternion::rotation_z(0.0);
next.chest.scale = Vec3::one();
next.belt.offset = Vec3::new(0.0, 0.0, 6.0);
next.belt.ori = Quaternion::rotation_z(0.0);
next.belt.scale = Vec3::one();
next.shorts.offset = Vec3::new(0.0, 0.0, 3.0);
next.shorts.ori = Quaternion::rotation_z(0.0);
next.shorts.scale = Vec3::one();
let wave = (anim_time as f32 * 12.0).sin();
match Tool::Hammer {
//TODO: Inventory
Tool::Sword => {
next.l_hand.offset = Vec3::new(-7.0, 3.25, 0.25 + wave_stop * 2.0);
next.l_hand.offset = Vec3::new(-6.0, 3.75, 0.25);
next.l_hand.ori = Quaternion::rotation_x(-0.3);
next.l_hand.scale = Vec3::one() * 1.01;
next.r_hand.offset = Vec3::new(-7.0, 3.0, -2.0 + wave_stop * 2.0);
next.r_hand.offset = Vec3::new(-6.0, 3.0, -2.0);
next.r_hand.ori = Quaternion::rotation_x(-0.3);
next.r_hand.scale = Vec3::one() * 1.01;
next.weapon.offset = Vec3::new(
-7.0 + skeleton_attr.weapon_x,
-6.0 + skeleton_attr.weapon_x,
4.0 + skeleton_attr.weapon_y,
0.0 + wave_stop * 2.0,
0.0,
);
next.weapon.ori = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(0.0)
@ -80,45 +58,41 @@ impl Animation for CjumpAnimation {
next.weapon.scale = Vec3::one();
}
Tool::Hammer => {
next.l_hand.offset = Vec3::new(-7.0, 8.25, 2.0 + wave_stop * 2.0);
next.l_hand.offset = Vec3::new(-7.0, 8.25, 3.0);
next.l_hand.ori = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(-1.2)
* Quaternion::rotation_z(0.0);
* Quaternion::rotation_z(wave * -0.25);
next.l_hand.scale = Vec3::one() * 1.01;
next.r_hand.offset = Vec3::new(7.0, 7.0, -3.0 + wave_stop * 2.0);
next.r_hand.offset = Vec3::new(7.0, 7.0, -1.5);
next.r_hand.ori = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(-1.2)
* Quaternion::rotation_z(0.0);
* Quaternion::rotation_z(wave * -0.25);
next.r_hand.scale = Vec3::one() * 1.01;
next.weapon.offset = Vec3::new(
5.0 + skeleton_attr.weapon_x,
8.75 + skeleton_attr.weapon_y,
-2.5 + wave_stop * 2.0,
-2.0,
);
next.weapon.ori = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(-1.2)
* Quaternion::rotation_z(0.0);
* Quaternion::rotation_z(wave * -0.25);
next.weapon.scale = Vec3::one();
}
Tool::Staff => {
next.l_hand.offset = Vec3::new(-7.0, 7.5, 0.0);
next.l_hand.ori = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(-1.7)
* Quaternion::rotation_z(1.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.scale = Vec3::one() * 1.01;
next.r_hand.offset = Vec3::new(7.0, 6.25, 1.5);
next.r_hand.ori = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(-1.7)
* Quaternion::rotation_z(1.0);
next.r_hand.offset = Vec3::new(-6.0, 3.0, -2.0);
next.r_hand.ori = Quaternion::rotation_x(-0.3);
next.r_hand.scale = Vec3::one() * 1.01;
next.weapon.offset = Vec3::new(
5.0 + skeleton_attr.weapon_x,
8.0 + skeleton_attr.weapon_y,
1.0,
-6.0 + skeleton_attr.weapon_x,
4.5 + skeleton_attr.weapon_y,
0.0,
);
next.weapon.ori = Quaternion::rotation_x(-0.3)
* Quaternion::rotation_y(-1.7)
* Quaternion::rotation_z(1.0);
* Quaternion::rotation_y(0.0)
* Quaternion::rotation_z(0.0);
next.weapon.scale = Vec3::one();
}
Tool::SwordShield => {
@ -174,30 +148,6 @@ impl Animation for CjumpAnimation {
}
}
next.l_foot.offset = Vec3::new(-3.4, 1.0, 6.0);
next.l_foot.ori = Quaternion::rotation_x(wave_stop * -1.2 - wave_slow * 0.2);
next.l_foot.scale = Vec3::one();
next.r_foot.offset = Vec3::new(3.4, -1.0, 6.0);
next.r_foot.ori = Quaternion::rotation_x(wave_stop * 1.2 + wave_slow * 0.2);
next.r_foot.scale = Vec3::one();
next.l_shoulder.offset = Vec3::new(-5.0, 0.0, 4.7);
next.l_shoulder.ori = Quaternion::rotation_x(0.0);
next.l_shoulder.scale = Vec3::one() * 1.1;
next.r_shoulder.offset = Vec3::new(5.0, 0.0, 4.7);
next.r_shoulder.ori = Quaternion::rotation_x(0.0);
next.r_shoulder.scale = Vec3::one() * 1.1;
next.draw.offset = Vec3::new(0.0, 5.0, 0.0);
next.draw.ori = Quaternion::rotation_y(0.0);
next.draw.scale = Vec3::one() * 0.0;
next.torso.offset = Vec3::new(0.0, -0.2, 0.0) * skeleton_attr.scaler;
next.torso.ori = Quaternion::rotation_x(-0.2);
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
next
}
}

View File

@ -747,13 +747,21 @@ impl FigureMgr {
time_since_action_change,
skeleton_attr,
),
(Stand, Block { .. }) => {
anim::character::BlockIdleAnimation::update_skeleton(
&target_base,
time,
time_since_action_change,
skeleton_attr,
)
}
(_, Attack { .. }) => anim::character::AttackAnimation::update_skeleton(
&target_base,
time,
time_since_action_change,
skeleton_attr,
),
(_, Wield { .. }) => anim::character::CrunAnimation::update_skeleton(
(_, Wield { .. }) => anim::character::WieldAnimation::update_skeleton(
&target_base,
(vel.0.magnitude(), time),
time_since_action_change,