mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
combat run/jump/idle animation states
This commit is contained in:
parent
e4dc145f17
commit
2ce5c5881e
BIN
assets/voxygen/voxel/figure/head/head_danari_female.vox
(Stored with Git LFS)
BIN
assets/voxygen/voxel/figure/head/head_danari_female.vox
(Stored with Git LFS)
Binary file not shown.
@ -10,6 +10,7 @@ pub enum Animation {
|
|||||||
Roll,
|
Roll,
|
||||||
Crun,
|
Crun,
|
||||||
Cidle,
|
Cidle,
|
||||||
|
Cjump,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug, Serialize, Deserialize)]
|
#[derive(Copy, Clone, Debug, Serialize, Deserialize)]
|
||||||
|
@ -13,6 +13,12 @@ pub struct Attacking {
|
|||||||
pub applied: bool,
|
pub applied: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
|
||||||
|
pub struct Wielding {
|
||||||
|
pub time: f32,
|
||||||
|
pub applied: bool,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
|
||||||
pub struct Rolling {
|
pub struct Rolling {
|
||||||
pub time: f32,
|
pub time: f32,
|
||||||
@ -41,6 +47,15 @@ impl Attacking {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Wielding {
|
||||||
|
pub fn start() -> Self {
|
||||||
|
Self {
|
||||||
|
time: 0.0,
|
||||||
|
applied: false,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl Rolling {
|
impl Rolling {
|
||||||
pub fn start() -> Self {
|
pub fn start() -> Self {
|
||||||
Self {
|
Self {
|
||||||
@ -58,6 +73,10 @@ impl Component for Attacking {
|
|||||||
type Storage = FlaggedStorage<Self, VecStorage<Self>>;
|
type Storage = FlaggedStorage<Self, VecStorage<Self>>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Component for Wielding {
|
||||||
|
type Storage = FlaggedStorage<Self, VecStorage<Self>>;
|
||||||
|
}
|
||||||
|
|
||||||
impl Component for Rolling {
|
impl Component for Rolling {
|
||||||
type Storage = FlaggedStorage<Self, VecStorage<Self>>;
|
type Storage = FlaggedStorage<Self, VecStorage<Self>>;
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ pub use agent::Agent;
|
|||||||
pub use animation::{Animation, AnimationInfo};
|
pub use animation::{Animation, AnimationInfo};
|
||||||
pub use body::{humanoid, quadruped, quadruped_medium, Body};
|
pub use body::{humanoid, quadruped, quadruped_medium, Body};
|
||||||
pub use controller::Controller;
|
pub use controller::Controller;
|
||||||
pub use inputs::{Attacking, Gliding, Jumping, MoveDir, OnGround, Respawning, Rolling};
|
pub use inputs::{Attacking, Gliding, Jumping, MoveDir, Wielding, OnGround, Respawning, Rolling};
|
||||||
pub use inventory::{item, Inventory};
|
pub use inventory::{item, Inventory};
|
||||||
pub use phys::{ForceUpdate, Ori, Pos, Vel};
|
pub use phys::{ForceUpdate, Ori, Pos, Vel};
|
||||||
pub use player::Player;
|
pub use player::Player;
|
||||||
|
@ -111,6 +111,7 @@ impl State {
|
|||||||
ecs.register::<comp::OnGround>();
|
ecs.register::<comp::OnGround>();
|
||||||
ecs.register::<comp::Controller>();
|
ecs.register::<comp::Controller>();
|
||||||
ecs.register::<comp::Attacking>();
|
ecs.register::<comp::Attacking>();
|
||||||
|
ecs.register::<comp::Wielding>();
|
||||||
ecs.register::<comp::Rolling>();
|
ecs.register::<comp::Rolling>();
|
||||||
ecs.register::<comp::Gliding>();
|
ecs.register::<comp::Gliding>();
|
||||||
ecs.register::<comp::ActionState>();
|
ecs.register::<comp::ActionState>();
|
||||||
|
@ -21,6 +21,7 @@ impl<'a> System<'a> for Sys {
|
|||||||
Animation::Idle
|
Animation::Idle
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
let animation = match (a.on_ground, a.moving, a.attacking, a.gliding, a.rolling) {
|
let animation = match (a.on_ground, a.moving, a.attacking, a.gliding, a.rolling) {
|
||||||
(_, _, true, true, _) => impossible_animation("Attack while gliding"),
|
(_, _, true, true, _) => impossible_animation("Attack while gliding"),
|
||||||
(_, _, true, _, true) => impossible_animation("Roll while attacking"),
|
(_, _, true, _, true) => impossible_animation("Roll while attacking"),
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
comp::{
|
comp::{
|
||||||
Attacking, HealthSource, Stats, {ForceUpdate, Ori, Pos, Vel},
|
Attacking, Wielding, HealthSource, Stats, {ForceUpdate, Ori, Pos, Vel},
|
||||||
},
|
},
|
||||||
state::{DeltaTime, Uid},
|
state::{DeltaTime, Uid},
|
||||||
};
|
};
|
||||||
@ -18,6 +18,7 @@ impl<'a> System<'a> for Sys {
|
|||||||
ReadStorage<'a, Ori>,
|
ReadStorage<'a, Ori>,
|
||||||
WriteStorage<'a, Vel>,
|
WriteStorage<'a, Vel>,
|
||||||
WriteStorage<'a, Attacking>,
|
WriteStorage<'a, Attacking>,
|
||||||
|
WriteStorage<'a, Wielding>,
|
||||||
WriteStorage<'a, Stats>,
|
WriteStorage<'a, Stats>,
|
||||||
WriteStorage<'a, ForceUpdate>,
|
WriteStorage<'a, ForceUpdate>,
|
||||||
);
|
);
|
||||||
@ -32,6 +33,7 @@ impl<'a> System<'a> for Sys {
|
|||||||
orientations,
|
orientations,
|
||||||
mut velocities,
|
mut velocities,
|
||||||
mut attackings,
|
mut attackings,
|
||||||
|
mut wieldings,
|
||||||
mut stats,
|
mut stats,
|
||||||
mut force_updates,
|
mut force_updates,
|
||||||
): Self::SystemData,
|
): Self::SystemData,
|
||||||
@ -67,6 +69,7 @@ impl<'a> System<'a> for Sys {
|
|||||||
Some(entity)
|
Some(entity)
|
||||||
} else {
|
} else {
|
||||||
attacking.time += dt.0;
|
attacking.time += dt.0;
|
||||||
|
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -52,17 +52,23 @@ impl Animation for AttackAnimation {
|
|||||||
|
|
||||||
next.l_hand.offset = Vec3::new(
|
next.l_hand.offset = Vec3::new(
|
||||||
-8.0 + wave_quicken_slow * 10.0,
|
-8.0 + wave_quicken_slow * 10.0,
|
||||||
4.0 + wave_quicken_double * 3.0,
|
8.0 + wave_quicken_double * 3.0,
|
||||||
9.0,
|
0.0,
|
||||||
);
|
);
|
||||||
next.l_hand.ori = Quaternion::rotation_z(-0.8)
|
next.l_hand.ori = Quaternion::rotation_z(-0.8)
|
||||||
* Quaternion::rotation_x(0.0 + wave_quicken * -0.8)
|
* Quaternion::rotation_x(0.0 + wave_quicken * -0.8)
|
||||||
* Quaternion::rotation_y(0.0 + wave_quicken * -0.4);
|
* Quaternion::rotation_y(0.0 + wave_quicken * -0.4);
|
||||||
next.l_hand.scale = Vec3::one();
|
next.l_hand.scale = Vec3::one() * 1.01;
|
||||||
|
|
||||||
next.r_hand.offset = Vec3::new(0.0, -2.0, 6.5) / 11.0;
|
next.r_hand.offset = Vec3::new(
|
||||||
next.r_hand.ori = Quaternion::rotation_x(0.0);
|
-8.0 + wave_quicken_slow * 10.0,
|
||||||
next.r_hand.scale = Vec3::one() * 0.0;
|
8.0 + wave_quicken_double * 3.0,
|
||||||
|
-2.0,
|
||||||
|
);
|
||||||
|
next.r_hand.ori = Quaternion::rotation_z(-0.8)
|
||||||
|
* Quaternion::rotation_x(0.0 + wave_quicken * -0.8)
|
||||||
|
* Quaternion::rotation_y(0.0 + wave_quicken * -0.4);
|
||||||
|
next.r_hand.scale = Vec3::one() * 1.01;
|
||||||
|
|
||||||
next.l_foot.offset = Vec3::new(
|
next.l_foot.offset = Vec3::new(
|
||||||
-3.4,
|
-3.4,
|
||||||
@ -81,12 +87,14 @@ impl Animation for AttackAnimation {
|
|||||||
next.r_foot.scale = Vec3::one();
|
next.r_foot.scale = Vec3::one();
|
||||||
|
|
||||||
next.weapon.offset = Vec3::new(
|
next.weapon.offset = Vec3::new(
|
||||||
-7.0 + skeleton_attr.weapon_x,
|
-8.0 + wave_quicken_slow * 10.0 + skeleton_attr.weapon_x,
|
||||||
-2.0 + skeleton_attr.weapon_y,
|
8.0 + wave_quicken_double * 3.0,
|
||||||
5.0,
|
0.0,
|
||||||
);
|
);
|
||||||
next.weapon.ori = Quaternion::rotation_y(2.5);
|
next.weapon.ori = Quaternion::rotation_z(-0.8)
|
||||||
next.weapon.scale = Vec3::one() * 0.0;
|
* Quaternion::rotation_x(0.0 + wave_quicken * -0.8)
|
||||||
|
* Quaternion::rotation_y(0.0 + wave_quicken * -0.4);
|
||||||
|
next.weapon.scale = Vec3::one();
|
||||||
|
|
||||||
next.l_shoulder.offset = Vec3::new(-10.0, -3.2, 2.5);
|
next.l_shoulder.offset = Vec3::new(-10.0, -3.2, 2.5);
|
||||||
next.l_shoulder.ori = Quaternion::rotation_x(0.0);
|
next.l_shoulder.ori = Quaternion::rotation_x(0.0);
|
||||||
@ -100,28 +108,6 @@ impl Animation for AttackAnimation {
|
|||||||
next.draw.ori = Quaternion::rotation_y(0.0);
|
next.draw.ori = Quaternion::rotation_y(0.0);
|
||||||
next.draw.scale = Vec3::one() * 0.0;
|
next.draw.scale = Vec3::one() * 0.0;
|
||||||
|
|
||||||
next.left_equip.offset = Vec3::new(
|
|
||||||
-8.0 + wave_quicken_slow * 10.0 + skeleton_attr.weapon_x,
|
|
||||||
4.0 + wave_quicken_double * 3.0,
|
|
||||||
9.0,
|
|
||||||
) / 11.0
|
|
||||||
* skeleton_attr.scaler;
|
|
||||||
next.left_equip.ori = Quaternion::rotation_z(-0.8)
|
|
||||||
* Quaternion::rotation_x(0.0 + wave_quicken * -0.8)
|
|
||||||
* Quaternion::rotation_y(0.0 + wave_quicken * -0.4);
|
|
||||||
next.left_equip.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
|
|
||||||
|
|
||||||
next.right_equip.offset = Vec3::new(
|
|
||||||
-8.0 + wave_quicken_slow * 10.0,
|
|
||||||
4.0 + wave_quicken_double * 3.0,
|
|
||||||
9.0,
|
|
||||||
) / 11.0
|
|
||||||
* skeleton_attr.scaler;
|
|
||||||
next.right_equip.ori = Quaternion::rotation_z(-0.8)
|
|
||||||
* Quaternion::rotation_x(0.0 + wave_quicken * -0.8)
|
|
||||||
* Quaternion::rotation_y(0.0 + wave_quicken * -0.4);
|
|
||||||
next.right_equip.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
|
|
||||||
|
|
||||||
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(wave_stop_quick * -0.2)
|
next.torso.ori = Quaternion::rotation_z(wave_stop_quick * -0.2)
|
||||||
* Quaternion::rotation_x(0.0 + wave_stop_quick * -0.2)
|
* Quaternion::rotation_x(0.0 + wave_stop_quick * -0.2)
|
||||||
|
@ -5,6 +5,9 @@ use super::{
|
|||||||
use std::{f32::consts::PI, ops::Mul};
|
use std::{f32::consts::PI, ops::Mul};
|
||||||
use vek::*;
|
use vek::*;
|
||||||
|
|
||||||
|
pub struct Input {
|
||||||
|
pub attack: bool,
|
||||||
|
}
|
||||||
pub struct CidleAnimation;
|
pub struct CidleAnimation;
|
||||||
|
|
||||||
impl Animation for CidleAnimation {
|
impl Animation for CidleAnimation {
|
||||||
@ -19,65 +22,82 @@ 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 * 1.0 + PI).sin();
|
let wave = (anim_time as f32 * 4.0).sin();
|
||||||
let wave_ultra_slow_cos = (anim_time as f32 * 1.0 + PI).cos();
|
|
||||||
|
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 wave_slow = (anim_time as f32 * 6.0 + PI).sin();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
let head_look = Vec2::new(
|
let head_look = Vec2::new(
|
||||||
((global_time + anim_time) as f32 / 8.0)
|
((global_time + anim_time) as f32 / 1.5)
|
||||||
.floor()
|
.floor()
|
||||||
.mul(7331.0)
|
.mul(7331.0)
|
||||||
.sin()
|
.sin()
|
||||||
* 0.5,
|
* 0.3,
|
||||||
((global_time + anim_time) as f32 / 8.0)
|
((global_time + anim_time) as f32 / 1.5)
|
||||||
.floor()
|
.floor()
|
||||||
.mul(1337.0)
|
.mul(1337.0)
|
||||||
.sin()
|
.sin()
|
||||||
* 0.25,
|
* 0.15,
|
||||||
);
|
);
|
||||||
next.head.offset = Vec3::new(0.0, 2.0, 11.0 + wave_ultra_slow * 0.3);
|
next.head.offset = Vec3::new(
|
||||||
next.head.ori = Quaternion::rotation_z(head_look.x) * Quaternion::rotation_x(head_look.y);
|
0.0 + skeleton_attr.neck_right + wave_slow_cos * 0.5,
|
||||||
next.head.scale = Vec3::one();
|
0.0 + skeleton_attr.neck_forward,
|
||||||
|
skeleton_attr.neck_height + 15.0 + wave_ultra_slow * 0.6,
|
||||||
|
);
|
||||||
|
next.head.ori =
|
||||||
|
Quaternion::rotation_z(head_look.x) * Quaternion::rotation_x(head_look.y.abs());
|
||||||
|
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
|
||||||
|
|
||||||
next.chest.offset = Vec3::new(0.0, 0.0, 7.0 + wave_ultra_slow * 0.3);
|
next.chest.offset = Vec3::new(0.0 + wave_slow_cos * 0.5, 0.0, 7.0 + wave_ultra_slow * 0.5);
|
||||||
next.chest.ori = Quaternion::rotation_x(0.0);
|
next.chest.ori = Quaternion::rotation_y(wave_ultra_slow_cos * 0.04);
|
||||||
next.chest.scale = Vec3::one();
|
next.chest.scale = Vec3::one();
|
||||||
|
|
||||||
next.belt.offset = Vec3::new(0.0, 0.0, 5.0 + wave_ultra_slow * 0.3);
|
next.belt.offset = Vec3::new(0.0 + wave_slow_cos * 0.5, 0.0, 5.0 + wave_ultra_slow * 0.5);
|
||||||
next.belt.ori = Quaternion::rotation_x(0.0);
|
next.belt.ori = Quaternion::rotation_y(wave_ultra_slow_cos * 0.03);
|
||||||
next.belt.scale = Vec3::one();
|
next.belt.scale = Vec3::one();
|
||||||
|
|
||||||
next.shorts.offset = Vec3::new(0.0, 0.0, 2.0 + wave_ultra_slow * 0.3);
|
next.shorts.offset = Vec3::new(0.0 + wave_slow_cos * 0.5, 0.0, 2.0 + wave_ultra_slow * 0.5);
|
||||||
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(
|
next.l_hand.offset = Vec3::new(
|
||||||
-7.5,
|
-6.0 + wave_ultra_slow_cos * 1.0,
|
||||||
-2.0 + wave_ultra_slow_cos * 0.15,
|
3.5 + wave_ultra_slow_cos * 0.5,
|
||||||
8.0 + wave_ultra_slow * 0.5,
|
0.0 + wave_ultra_slow * 1.0,
|
||||||
) / 11.0;
|
);
|
||||||
|
|
||||||
next.l_hand.ori = Quaternion::rotation_x(0.0 + wave_ultra_slow * 0.06);
|
next.l_hand.ori = Quaternion::rotation_x(-0.3);
|
||||||
next.l_hand.scale = Vec3::one() / 11.0;
|
next.l_hand.scale = Vec3::one() * 1.01;
|
||||||
|
|
||||||
next.r_hand.offset = Vec3::new(
|
next.r_hand.offset = Vec3::new(
|
||||||
7.5,
|
-6.0 + wave_ultra_slow_cos * 1.0,
|
||||||
-2.0 + wave_ultra_slow_cos * 0.15,
|
3.0 + wave_ultra_slow_cos * 0.5,
|
||||||
8.0 + wave_ultra_slow * 0.5,
|
-2.0 + wave_ultra_slow * 1.0,
|
||||||
) / 11.0;
|
);
|
||||||
next.r_hand.ori = Quaternion::rotation_x(0.0 + wave_ultra_slow * 0.06);
|
next.r_hand.ori = Quaternion::rotation_x(-0.3);
|
||||||
next.r_hand.scale = Vec3::one() / 11.;
|
next.r_hand.scale = Vec3::one() * 1.01;
|
||||||
|
|
||||||
next.l_foot.offset = Vec3::new(-3.4, -0.1, 8.0);
|
next.l_foot.offset = Vec3::new(-3.4, -1.5, 8.0 + wave_slow * 0.2);
|
||||||
next.l_foot.ori = Quaternion::identity();
|
next.l_foot.ori = Quaternion::rotation_x(wave_ultra_slow_cos * 0.015);
|
||||||
next.l_foot.scale = Vec3::one();
|
next.l_foot.scale = Vec3::one();
|
||||||
|
|
||||||
next.r_foot.offset = Vec3::new(3.4, -0.1, 8.0);
|
next.r_foot.offset = Vec3::new(3.4, 3.0, 8.0 + wave_slow_cos * 0.2);
|
||||||
next.r_foot.ori = Quaternion::identity();
|
next.r_foot.ori = Quaternion::rotation_x(wave_ultra_slow * 0.015);
|
||||||
next.r_foot.scale = Vec3::one();
|
next.r_foot.scale = Vec3::one();
|
||||||
|
|
||||||
next.weapon.offset = Vec3::new(-7.0, -5.0, 15.0);
|
next.weapon.offset = Vec3::new(
|
||||||
next.weapon.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
|
-6.0 + skeleton_attr.weapon_x + wave_ultra_slow_cos * 1.0,
|
||||||
next.weapon.scale = Vec3::one() * 0.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();
|
||||||
|
|
||||||
next.l_shoulder.offset = Vec3::new(-10.0, -3.2, 2.5);
|
next.l_shoulder.offset = Vec3::new(-10.0, -3.2, 2.5);
|
||||||
next.l_shoulder.ori = Quaternion::rotation_x(0.0);
|
next.l_shoulder.ori = Quaternion::rotation_x(0.0);
|
||||||
@ -91,17 +111,9 @@ impl Animation for CidleAnimation {
|
|||||||
next.draw.ori = Quaternion::rotation_y(0.0);
|
next.draw.ori = Quaternion::rotation_y(0.0);
|
||||||
next.draw.scale = Vec3::one() * 0.0;
|
next.draw.scale = Vec3::one() * 0.0;
|
||||||
|
|
||||||
next.left_equip.offset = Vec3::new(0.0, 0.0, 5.0) / 11.0;
|
next.torso.offset = Vec3::new(0.0, -0.2, 0.1) * skeleton_attr.scaler;
|
||||||
next.left_equip.ori = Quaternion::rotation_x(0.0);;
|
|
||||||
next.left_equip.scale = Vec3::one() * 0.0;
|
|
||||||
|
|
||||||
next.right_equip.offset = Vec3::new(0.0, 0.0, 5.0) / 11.0;
|
|
||||||
next.right_equip.ori = Quaternion::rotation_x(0.0);;
|
|
||||||
next.right_equip.scale = Vec3::one() * 0.0;
|
|
||||||
|
|
||||||
next.torso.offset = Vec3::new(0.0, -0.2, 0.1);
|
|
||||||
next.torso.ori = Quaternion::rotation_x(0.0);
|
next.torso.ori = Quaternion::rotation_x(0.0);
|
||||||
next.torso.scale = Vec3::one() / 11.0;
|
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
|
||||||
|
|
||||||
next
|
next
|
||||||
}
|
}
|
||||||
|
98
voxygen/src/anim/character/cjump.rs
Normal file
98
voxygen/src/anim/character/cjump.rs
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
use super::{
|
||||||
|
super::{Animation, SkeletonAttr},
|
||||||
|
CharacterSkeleton,
|
||||||
|
};
|
||||||
|
use std::f32::consts::PI;
|
||||||
|
use vek::*;
|
||||||
|
|
||||||
|
pub struct CjumpAnimation;
|
||||||
|
|
||||||
|
impl Animation for CjumpAnimation {
|
||||||
|
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 = (anim_time as f32 * 14.0).sin();
|
||||||
|
let wave_slow = (anim_time as f32 * 7.0).sin();
|
||||||
|
let wave_stop = (anim_time as f32 * 4.5).min(PI / 2.0).sin();
|
||||||
|
let wave_stop_alt = (anim_time as f32 * 5.0).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();
|
||||||
|
|
||||||
|
next.l_hand.offset = Vec3::new(
|
||||||
|
-7.0,
|
||||||
|
4.0,
|
||||||
|
0.0 + wave_stop * 2.0,
|
||||||
|
);
|
||||||
|
next.l_hand.ori = Quaternion::rotation_x(-0.3);
|
||||||
|
next.l_hand.scale = Vec3::one();
|
||||||
|
|
||||||
|
next.r_hand.offset = Vec3::new(
|
||||||
|
-7.0,
|
||||||
|
3.0,
|
||||||
|
-2.0 + wave_stop * 2.0,
|
||||||
|
);
|
||||||
|
next.r_hand.ori = Quaternion::rotation_x(-0.3);
|
||||||
|
next.r_hand.scale = Vec3::one();
|
||||||
|
|
||||||
|
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.weapon.offset = Vec3::new(
|
||||||
|
-7.0 + skeleton_attr.weapon_x,
|
||||||
|
4.0 + skeleton_attr.weapon_y,
|
||||||
|
0.0 + wave_stop * 2.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_shoulder.offset = Vec3::new(-10.0, -3.2, 2.5);
|
||||||
|
next.l_shoulder.ori = Quaternion::rotation_x(0.0);
|
||||||
|
next.l_shoulder.scale = Vec3::one() * 1.04;
|
||||||
|
|
||||||
|
next.r_shoulder.offset = Vec3::new(0.0, -3.2, 2.5);
|
||||||
|
next.r_shoulder.ori = Quaternion::rotation_x(0.0);
|
||||||
|
next.r_shoulder.scale = Vec3::one() * 1.04;
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
@ -2,6 +2,7 @@ use super::{
|
|||||||
super::{Animation, SkeletonAttr},
|
super::{Animation, SkeletonAttr},
|
||||||
CharacterSkeleton,
|
CharacterSkeleton,
|
||||||
};
|
};
|
||||||
|
use std::f32::consts::PI;
|
||||||
use std::ops::Mul;
|
use std::ops::Mul;
|
||||||
use vek::*;
|
use vek::*;
|
||||||
|
|
||||||
@ -19,8 +20,11 @@ impl Animation for CrunAnimation {
|
|||||||
) -> Self::Skeleton {
|
) -> Self::Skeleton {
|
||||||
let mut next = (*skeleton).clone();
|
let mut next = (*skeleton).clone();
|
||||||
|
|
||||||
let wave = (anim_time as f32 * 14.0).sin();
|
let wave = (anim_time as f32 * 12.0).sin();
|
||||||
let wave_cos = (anim_time as f32 * 14.0).cos();
|
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(
|
let head_look = Vec2::new(
|
||||||
((global_time + anim_time) as f32 / 2.0)
|
((global_time + anim_time) as f32 / 2.0)
|
||||||
@ -35,10 +39,14 @@ impl Animation for CrunAnimation {
|
|||||||
* 0.1,
|
* 0.1,
|
||||||
);
|
);
|
||||||
|
|
||||||
next.head.offset = Vec3::new(0.0, 3.0, 12.0 + wave_cos * 1.3);
|
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)
|
next.head.ori = Quaternion::rotation_z(head_look.x + wave * 0.1)
|
||||||
* Quaternion::rotation_x(head_look.y + 0.35);
|
* Quaternion::rotation_x(head_look.y + 0.35);
|
||||||
next.head.scale = Vec3::one();
|
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.offset = Vec3::new(0.0, 0.0, 7.0 + wave_cos * 1.1);
|
||||||
next.chest.ori = Quaternion::rotation_z(wave * 0.1);
|
next.chest.ori = Quaternion::rotation_z(wave * 0.1);
|
||||||
@ -52,25 +60,39 @@ impl Animation for CrunAnimation {
|
|||||||
next.shorts.ori = Quaternion::rotation_z(wave * 0.6);
|
next.shorts.ori = Quaternion::rotation_z(wave * 0.6);
|
||||||
next.shorts.scale = Vec3::one();
|
next.shorts.scale = Vec3::one();
|
||||||
|
|
||||||
next.l_hand.offset = Vec3::new(-9.0, 3.0 + wave_cos * 8.0, 12.0 - wave * 1.0) / 11.0;
|
next.l_hand.offset = Vec3::new(
|
||||||
next.l_hand.ori = Quaternion::rotation_x(wave_cos * 1.1);
|
-6.0,
|
||||||
next.l_hand.scale = Vec3::one() / 11.0;
|
4.0,
|
||||||
|
0.0,
|
||||||
|
);
|
||||||
|
next.l_hand.ori = Quaternion::rotation_x(-0.3);
|
||||||
|
next.l_hand.scale = Vec3::one();
|
||||||
|
|
||||||
next.r_hand.offset = Vec3::new(9.0, 3.0 - wave_cos * 8.0, 12.0 + wave * 1.0) / 11.0;
|
next.r_hand.offset = Vec3::new(
|
||||||
next.r_hand.ori = Quaternion::rotation_x(wave_cos * -1.1);
|
-6.0,
|
||||||
next.r_hand.scale = Vec3::one() / 11.0;
|
3.0,
|
||||||
|
-2.0,
|
||||||
|
);
|
||||||
|
next.r_hand.ori = Quaternion::rotation_x(-0.3);
|
||||||
|
next.r_hand.scale = Vec3::one();
|
||||||
|
|
||||||
next.l_foot.offset = Vec3::new(-3.4, 0.0 + wave_cos * 1.0, 6.0);
|
next.l_foot.offset = Vec3::new(-3.4, 0.0 + wave_cos * 1.0, 6.0 - wave_cos_dub * 0.11);
|
||||||
next.l_foot.ori = Quaternion::rotation_x(-0.0 - wave_cos * 1.5);
|
next.l_foot.ori = Quaternion::rotation_x(-0.0 - wave_cos * 1.5);
|
||||||
next.l_foot.scale = Vec3::one();
|
next.l_foot.scale = Vec3::one();
|
||||||
|
|
||||||
next.r_foot.offset = Vec3::new(3.4, 0.0 - wave_cos * 1.0, 6.0);
|
next.r_foot.offset = Vec3::new(3.4, 0.0 - wave_cos * 1.0, 6.0 - wave_cos_dub * 0.11);
|
||||||
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.weapon.offset = Vec3::new(-7.0, -5.0, 15.0);
|
next.weapon.offset = Vec3::new(
|
||||||
next.weapon.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
|
-6.0 + skeleton_attr.weapon_x,
|
||||||
next.weapon.scale = Vec3::one() * 0.0;
|
4.0,
|
||||||
|
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_shoulder.offset = Vec3::new(-10.0, -3.2, 2.5);
|
next.l_shoulder.offset = Vec3::new(-10.0, -3.2, 2.5);
|
||||||
next.l_shoulder.ori = Quaternion::rotation_x(0.0);
|
next.l_shoulder.ori = Quaternion::rotation_x(0.0);
|
||||||
@ -84,17 +106,11 @@ impl Animation for CrunAnimation {
|
|||||||
next.draw.ori = Quaternion::rotation_y(0.0);
|
next.draw.ori = Quaternion::rotation_y(0.0);
|
||||||
next.draw.scale = Vec3::one() * 0.0;
|
next.draw.scale = Vec3::one() * 0.0;
|
||||||
|
|
||||||
next.left_equip.offset = Vec3::new(0.0, 0.0, 5.0) / 11.0;
|
next.torso.offset =
|
||||||
next.left_equip.ori = Quaternion::rotation_x(0.0);;
|
Vec3::new(0.0, -0.2 + wave * -0.08, 0.4 + wave_cos_dub * 0.11) * skeleton_attr.scaler;
|
||||||
next.left_equip.scale = Vec3::one() * 0.0;
|
next.torso.ori =
|
||||||
|
Quaternion::rotation_x(wave_stop * velocity * -0.06 + wave_diff * velocity * -0.005);
|
||||||
next.right_equip.offset = Vec3::new(0.0, 0.0, 5.0) / 11.0;
|
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
|
||||||
next.right_equip.ori = Quaternion::rotation_x(0.0);;
|
|
||||||
next.right_equip.scale = Vec3::one() * 0.0;
|
|
||||||
|
|
||||||
next.torso.offset = Vec3::new(0.0, -0.2, 0.4);
|
|
||||||
next.torso.ori = Quaternion::rotation_x(-velocity * 0.04 - wave_cos * 0.10);
|
|
||||||
next.torso.scale = Vec3::one() / 11.0;
|
|
||||||
|
|
||||||
next
|
next
|
||||||
}
|
}
|
||||||
|
@ -103,14 +103,6 @@ impl Animation for GlidingAnimation {
|
|||||||
* Quaternion::rotation_y(wave_very_slow_cos * 0.04);
|
* Quaternion::rotation_y(wave_very_slow_cos * 0.04);
|
||||||
next.draw.scale = Vec3::one();
|
next.draw.scale = Vec3::one();
|
||||||
|
|
||||||
next.left_equip.offset = Vec3::new(0.0, 0.0, -5.0) / 11.0;
|
|
||||||
next.left_equip.ori = Quaternion::rotation_x(0.0);;
|
|
||||||
next.left_equip.scale = Vec3::one() * 0.0;
|
|
||||||
|
|
||||||
next.right_equip.offset = Vec3::new(0.0, 0.0, -5.0) / 11.0;
|
|
||||||
next.right_equip.ori = Quaternion::rotation_x(0.0);
|
|
||||||
next.right_equip.scale = Vec3::one() * 0.0;
|
|
||||||
|
|
||||||
next.torso.offset = Vec3::new(0.0, 6.0, 15.0) / 11.0 * skeleton_attr.scaler;
|
next.torso.offset = Vec3::new(0.0, 6.0, 15.0) / 11.0 * skeleton_attr.scaler;
|
||||||
next.torso.ori = Quaternion::rotation_x(-0.05 * velocity + wave_very_slow * 0.10);
|
next.torso.ori = Quaternion::rotation_x(-0.05 * velocity + wave_very_slow * 0.10);
|
||||||
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
|
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
|
||||||
|
@ -63,7 +63,7 @@ impl Animation for IdleAnimation {
|
|||||||
next.l_hand.offset = Vec3::new(
|
next.l_hand.offset = Vec3::new(
|
||||||
-7.5,
|
-7.5,
|
||||||
0.0 + wave_ultra_slow_cos * 0.15,
|
0.0 + wave_ultra_slow_cos * 0.15,
|
||||||
7.0 + wave_ultra_slow * 0.5,
|
0.0 + wave_ultra_slow * 0.5,
|
||||||
);
|
);
|
||||||
|
|
||||||
next.l_hand.ori = Quaternion::rotation_x(0.0 + wave_ultra_slow * -0.06);
|
next.l_hand.ori = Quaternion::rotation_x(0.0 + wave_ultra_slow * -0.06);
|
||||||
@ -72,7 +72,7 @@ impl Animation for IdleAnimation {
|
|||||||
next.r_hand.offset = Vec3::new(
|
next.r_hand.offset = Vec3::new(
|
||||||
7.5,
|
7.5,
|
||||||
0.0 + wave_ultra_slow_cos * 0.15,
|
0.0 + wave_ultra_slow_cos * 0.15,
|
||||||
7.0 + wave_ultra_slow * 0.5,
|
0.0 + wave_ultra_slow * 0.5,
|
||||||
);
|
);
|
||||||
next.r_hand.ori = Quaternion::rotation_x(0.0 + wave_ultra_slow * -0.06);
|
next.r_hand.ori = Quaternion::rotation_x(0.0 + wave_ultra_slow * -0.06);
|
||||||
next.r_hand.scale = Vec3::one();
|
next.r_hand.scale = Vec3::one();
|
||||||
@ -105,14 +105,6 @@ impl Animation for IdleAnimation {
|
|||||||
next.draw.ori = Quaternion::rotation_y(0.0);
|
next.draw.ori = Quaternion::rotation_y(0.0);
|
||||||
next.draw.scale = Vec3::one() * 0.0;
|
next.draw.scale = Vec3::one() * 0.0;
|
||||||
|
|
||||||
next.left_equip.offset = Vec3::new(0.0, 0.0, 5.0) / 11.0;
|
|
||||||
next.left_equip.ori = Quaternion::rotation_x(0.0);;
|
|
||||||
next.left_equip.scale = Vec3::one() * 0.0;
|
|
||||||
|
|
||||||
next.right_equip.offset = Vec3::new(0.0, 0.0, 5.0) / 11.0;
|
|
||||||
next.right_equip.ori = Quaternion::rotation_x(0.0);;
|
|
||||||
next.right_equip.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_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;
|
||||||
|
@ -46,7 +46,7 @@ impl Animation for JumpAnimation {
|
|||||||
next.l_hand.offset = Vec3::new(
|
next.l_hand.offset = Vec3::new(
|
||||||
-8.0,
|
-8.0,
|
||||||
0.0 + wave_stop * 3.8,
|
0.0 + wave_stop * 3.8,
|
||||||
7.0 + wave_stop * 3.2 - wave * 0.4,
|
0.0 + wave_stop * 3.2 - wave * 0.4,
|
||||||
);
|
);
|
||||||
next.l_hand.ori = Quaternion::rotation_x(wave_stop_alt * 0.6);
|
next.l_hand.ori = Quaternion::rotation_x(wave_stop_alt * 0.6);
|
||||||
next.l_hand.scale = Vec3::one();
|
next.l_hand.scale = Vec3::one();
|
||||||
@ -54,7 +54,7 @@ impl Animation for JumpAnimation {
|
|||||||
next.r_hand.offset = Vec3::new(
|
next.r_hand.offset = Vec3::new(
|
||||||
8.0,
|
8.0,
|
||||||
0.0 + wave_stop * -3.8,
|
0.0 + wave_stop * -3.8,
|
||||||
7.0 + wave_stop * 3.2 - wave * 0.4,
|
0.0 + wave_stop * 3.2 - wave * 0.4,
|
||||||
);
|
);
|
||||||
next.r_hand.ori = Quaternion::rotation_x(-wave_stop_alt * 0.6);
|
next.r_hand.ori = Quaternion::rotation_x(-wave_stop_alt * 0.6);
|
||||||
next.r_hand.scale = Vec3::one();
|
next.r_hand.scale = Vec3::one();
|
||||||
@ -87,14 +87,6 @@ impl Animation for JumpAnimation {
|
|||||||
next.draw.ori = Quaternion::rotation_y(0.0);
|
next.draw.ori = Quaternion::rotation_y(0.0);
|
||||||
next.draw.scale = Vec3::one() * 0.0;
|
next.draw.scale = Vec3::one() * 0.0;
|
||||||
|
|
||||||
next.left_equip.offset = Vec3::new(0.0, 0.0, 5.0) / 11.0;
|
|
||||||
next.left_equip.ori = Quaternion::rotation_x(0.0);;
|
|
||||||
next.left_equip.scale = Vec3::one() * 0.0;
|
|
||||||
|
|
||||||
next.right_equip.offset = Vec3::new(0.0, 0.0, 5.0) / 11.0;
|
|
||||||
next.right_equip.ori = Quaternion::rotation_x(0.0);;
|
|
||||||
next.right_equip.scale = Vec3::one() * 0.0;
|
|
||||||
|
|
||||||
next.torso.offset = Vec3::new(0.0, -0.2, 0.0) * skeleton_attr.scaler;
|
next.torso.offset = Vec3::new(0.0, -0.2, 0.0) * skeleton_attr.scaler;
|
||||||
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;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
pub mod attack;
|
pub mod attack;
|
||||||
pub mod cidle;
|
pub mod cidle;
|
||||||
pub mod crun;
|
pub mod crun;
|
||||||
|
pub mod cjump;
|
||||||
pub mod gliding;
|
pub mod gliding;
|
||||||
pub mod idle;
|
pub mod idle;
|
||||||
pub mod jump;
|
pub mod jump;
|
||||||
@ -11,6 +12,7 @@ pub mod run;
|
|||||||
pub use self::attack::AttackAnimation;
|
pub use self::attack::AttackAnimation;
|
||||||
pub use self::cidle::CidleAnimation;
|
pub use self::cidle::CidleAnimation;
|
||||||
pub use self::crun::CrunAnimation;
|
pub use self::crun::CrunAnimation;
|
||||||
|
pub use self::cjump::CjumpAnimation;
|
||||||
pub use self::gliding::GlidingAnimation;
|
pub use self::gliding::GlidingAnimation;
|
||||||
pub use self::idle::IdleAnimation;
|
pub use self::idle::IdleAnimation;
|
||||||
pub use self::jump::JumpAnimation;
|
pub use self::jump::JumpAnimation;
|
||||||
@ -36,8 +38,6 @@ pub struct CharacterSkeleton {
|
|||||||
l_shoulder: Bone,
|
l_shoulder: Bone,
|
||||||
r_shoulder: Bone,
|
r_shoulder: Bone,
|
||||||
draw: Bone,
|
draw: Bone,
|
||||||
left_equip: Bone,
|
|
||||||
right_equip: Bone,
|
|
||||||
torso: Bone,
|
torso: Bone,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,8 +56,6 @@ impl CharacterSkeleton {
|
|||||||
l_shoulder: Bone::default(),
|
l_shoulder: Bone::default(),
|
||||||
r_shoulder: Bone::default(),
|
r_shoulder: Bone::default(),
|
||||||
draw: Bone::default(),
|
draw: Bone::default(),
|
||||||
left_equip: Bone::default(),
|
|
||||||
right_equip: Bone::default(),
|
|
||||||
torso: Bone::default(),
|
torso: Bone::default(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -75,18 +73,19 @@ 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 * l_hand_mat),
|
FigureBoneData::new(torso_mat * chest_mat * l_hand_mat),
|
||||||
FigureBoneData::new(torso_mat * self.r_hand.compute_base_matrix()),
|
FigureBoneData::new(torso_mat * chest_mat * self.r_hand.compute_base_matrix()),
|
||||||
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 * weapon_mat),
|
FigureBoneData::new(torso_mat * chest_mat * weapon_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.draw.compute_base_matrix()),
|
FigureBoneData::new(torso_mat * self.draw.compute_base_matrix()),
|
||||||
FigureBoneData::new(self.left_equip.compute_base_matrix()),
|
|
||||||
FigureBoneData::new(self.right_equip.compute_base_matrix()),
|
|
||||||
FigureBoneData::new(torso_mat),
|
FigureBoneData::new(torso_mat),
|
||||||
FigureBoneData::default(),
|
FigureBoneData::default(),
|
||||||
|
FigureBoneData::default(),
|
||||||
|
FigureBoneData::default(),
|
||||||
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,8 +102,6 @@ impl Skeleton for CharacterSkeleton {
|
|||||||
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.draw.interpolate(&target.draw, dt);
|
self.draw.interpolate(&target.draw, dt);
|
||||||
self.left_equip.interpolate(&target.left_equip, dt);
|
|
||||||
self.right_equip.interpolate(&target.right_equip, dt);
|
|
||||||
self.torso.interpolate(&target.torso, dt);
|
self.torso.interpolate(&target.torso, dt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ impl Animation for RollAnimation {
|
|||||||
next.l_hand.offset = Vec3::new(
|
next.l_hand.offset = Vec3::new(
|
||||||
-5.5 + wave * -0.5,
|
-5.5 + wave * -0.5,
|
||||||
-2.0 + wave_quick_cos * -5.5,
|
-2.0 + wave_quick_cos * -5.5,
|
||||||
8.0 + wave_quick * 0.5,
|
1.0 + wave_quick * 0.5,
|
||||||
);
|
);
|
||||||
|
|
||||||
next.l_hand.ori =
|
next.l_hand.ori =
|
||||||
@ -59,7 +59,7 @@ impl Animation for RollAnimation {
|
|||||||
next.r_hand.offset = Vec3::new(
|
next.r_hand.offset = Vec3::new(
|
||||||
5.5 + wave * 0.5,
|
5.5 + wave * 0.5,
|
||||||
-2.0 + wave_quick_cos * 2.5,
|
-2.0 + wave_quick_cos * 2.5,
|
||||||
8.0 + wave_quick * 3.0,
|
1.0 + wave_quick * 3.0,
|
||||||
);
|
);
|
||||||
next.r_hand.ori =
|
next.r_hand.ori =
|
||||||
Quaternion::rotation_x(wave_slow * 6.5) * Quaternion::rotation_y(wave * 0.3);
|
Quaternion::rotation_x(wave_slow * 6.5) * Quaternion::rotation_y(wave * 0.3);
|
||||||
@ -95,14 +95,6 @@ impl Animation for RollAnimation {
|
|||||||
next.draw.ori = Quaternion::rotation_y(0.0);
|
next.draw.ori = Quaternion::rotation_y(0.0);
|
||||||
next.draw.scale = Vec3::one() * 0.0;
|
next.draw.scale = Vec3::one() * 0.0;
|
||||||
|
|
||||||
next.left_equip.offset = Vec3::new(0.0, 0.0, 5.0) / 11.0;
|
|
||||||
next.left_equip.ori = Quaternion::rotation_x(0.0);;
|
|
||||||
next.left_equip.scale = Vec3::one() * 0.0;
|
|
||||||
|
|
||||||
next.right_equip.offset = Vec3::new(0.0, 0.0, 5.0) / 11.0;
|
|
||||||
next.right_equip.ori = Quaternion::rotation_x(0.0);;
|
|
||||||
next.right_equip.scale = Vec3::one() * 0.0;
|
|
||||||
|
|
||||||
next.torso.offset =
|
next.torso.offset =
|
||||||
Vec3::new(0.0, -2.2, 0.1 + wave_dub * 16.0) / 11.0 * skeleton_attr.scaler;
|
Vec3::new(0.0, -2.2, 0.1 + wave_dub * 16.0) / 11.0 * skeleton_attr.scaler;
|
||||||
next.torso.ori = Quaternion::rotation_x(wave_slow * 6.0);
|
next.torso.ori = Quaternion::rotation_x(wave_slow * 6.0);
|
||||||
|
@ -63,7 +63,7 @@ impl Animation for RunAnimation {
|
|||||||
next.l_hand.offset = Vec3::new(
|
next.l_hand.offset = Vec3::new(
|
||||||
-7.5 + wave_cos_dub * 1.0,
|
-7.5 + wave_cos_dub * 1.0,
|
||||||
2.0 + wave_cos * 5.0,
|
2.0 + wave_cos * 5.0,
|
||||||
7.0 - wave * 1.5,
|
0.0 - wave * 1.5,
|
||||||
);
|
);
|
||||||
next.l_hand.ori = Quaternion::rotation_x(wave_cos * 0.8);
|
next.l_hand.ori = Quaternion::rotation_x(wave_cos * 0.8);
|
||||||
next.l_hand.scale = Vec3::one();
|
next.l_hand.scale = Vec3::one();
|
||||||
@ -71,7 +71,7 @@ impl Animation for RunAnimation {
|
|||||||
next.r_hand.offset = Vec3::new(
|
next.r_hand.offset = Vec3::new(
|
||||||
7.5 - wave_cos_dub * 1.0,
|
7.5 - wave_cos_dub * 1.0,
|
||||||
2.0 - wave_cos * 5.0,
|
2.0 - wave_cos * 5.0,
|
||||||
7.0 + wave * 1.5,
|
0.0 + wave * 1.5,
|
||||||
);
|
);
|
||||||
next.r_hand.ori = Quaternion::rotation_x(wave_cos * -0.8);
|
next.r_hand.ori = Quaternion::rotation_x(wave_cos * -0.8);
|
||||||
next.r_hand.scale = Vec3::one();
|
next.r_hand.scale = Vec3::one();
|
||||||
@ -105,14 +105,6 @@ impl Animation for RunAnimation {
|
|||||||
next.draw.ori = Quaternion::rotation_y(0.0);
|
next.draw.ori = Quaternion::rotation_y(0.0);
|
||||||
next.draw.scale = Vec3::one() * 0.0;
|
next.draw.scale = Vec3::one() * 0.0;
|
||||||
|
|
||||||
next.left_equip.offset = Vec3::new(0.0, 0.0, 5.0) / 11.0;
|
|
||||||
next.left_equip.ori = Quaternion::rotation_x(0.0);;
|
|
||||||
next.left_equip.scale = Vec3::one() * 0.0;
|
|
||||||
|
|
||||||
next.right_equip.offset = Vec3::new(0.0, 0.0, 5.0) / 11.0;
|
|
||||||
next.right_equip.ori = Quaternion::rotation_x(0.0);;
|
|
||||||
next.right_equip.scale = Vec3::one() * 0.0;
|
|
||||||
|
|
||||||
next.torso.offset =
|
next.torso.offset =
|
||||||
Vec3::new(0.0, -0.2 + wave * -0.08, 0.4 + wave_cos_dub * 0.11) * skeleton_attr.scaler;
|
Vec3::new(0.0, -0.2 + wave * -0.08, 0.4 + wave_cos_dub * 0.11) * skeleton_attr.scaler;
|
||||||
next.torso.ori =
|
next.torso.ori =
|
||||||
|
@ -107,7 +107,7 @@ impl<'a> From<&'a comp::humanoid::Body> for SkeletonAttr {
|
|||||||
neck_height: match (body.race, body.body_type) {
|
neck_height: match (body.race, body.body_type) {
|
||||||
(Orc, Male) => -2.0,
|
(Orc, Male) => -2.0,
|
||||||
(Orc, Female) => -2.0,
|
(Orc, Female) => -2.0,
|
||||||
(Human, Male) => 6.0,
|
(Human, Male) => 0.0,
|
||||||
(Human, Female) => -2.0,
|
(Human, Female) => -2.0,
|
||||||
(Elf, Male) => 0.75,
|
(Elf, Male) => 0.75,
|
||||||
(Elf, Female) => -1.25,
|
(Elf, Female) => -1.25,
|
||||||
|
@ -61,12 +61,12 @@ impl FigureModelCache {
|
|||||||
Some(Self::load_right_hand(body.hand)),
|
Some(Self::load_right_hand(body.hand)),
|
||||||
Some(Self::load_left_foot(body.foot)),
|
Some(Self::load_left_foot(body.foot)),
|
||||||
Some(Self::load_right_foot(body.foot)),
|
Some(Self::load_right_foot(body.foot)),
|
||||||
Some(Self::load_weapon(Weapon::Axe)), // TODO: Inventory
|
Some(Self::load_weapon(Weapon::Sword)), // TODO: Inventory
|
||||||
Some(Self::load_left_shoulder(body.shoulder)),
|
Some(Self::load_left_shoulder(body.shoulder)),
|
||||||
Some(Self::load_right_shoulder(body.shoulder)),
|
Some(Self::load_right_shoulder(body.shoulder)),
|
||||||
Some(Self::load_draw()),
|
Some(Self::load_draw()),
|
||||||
Some(Self::load_left_equip(Weapon::Axe)), // TODO: Inventory
|
None,
|
||||||
Some(Self::load_right_equip(body.hand)),
|
None,
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
],
|
],
|
||||||
@ -154,7 +154,7 @@ impl FigureModelCache {
|
|||||||
let (name, offset) = match (race, body_type) {
|
let (name, offset) = match (race, body_type) {
|
||||||
(Human, Male) => (
|
(Human, Male) => (
|
||||||
"figure/head/head_human_male.vox",
|
"figure/head/head_human_male.vox",
|
||||||
Vec3::new(-7.0, -5.5, -9.25),
|
Vec3::new(-7.0, -5.5, -2.25),
|
||||||
),
|
),
|
||||||
(Human, Female) => (
|
(Human, Female) => (
|
||||||
"figure/head/head_human_female.vox",
|
"figure/head/head_human_female.vox",
|
||||||
@ -340,28 +340,14 @@ impl FigureModelCache {
|
|||||||
Self::load_mesh("object/glider.vox", Vec3::new(-26.0, -26.0, -5.0))
|
Self::load_mesh("object/glider.vox", Vec3::new(-26.0, -26.0, -5.0))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn load_left_equip(weapon: Weapon) -> Mesh<FigurePipeline> {
|
//fn load_right_equip(hand: humanoid::Hand) -> Mesh<FigurePipeline> {
|
||||||
let (name, offset) = match weapon {
|
// Self::load_mesh(
|
||||||
Weapon::Sword => ("weapon/sword/rusty_2h.vox", Vec3::new(-1.5, -6.5, -4.0)),
|
// match hand {
|
||||||
Weapon::Hammer => ("weapon/hammer/rusty_2h.vox", Vec3::new(-2.5, -5.5, -4.0)),
|
// humanoid::Hand::Default => "figure/body/hand.vox",
|
||||||
Weapon::Axe => ("weapon/axe/rusty_2h.vox", Vec3::new(-2.5, -6.5, -4.0)),
|
// },
|
||||||
Weapon::Sword => ("weapon/sword/wood_2h.vox", Vec3::new(-1.5, -6.5, -4.0)),
|
// Vec3::new(-2.0, -2.5, -5.0),
|
||||||
Weapon::Daggers => ("weapon/hammer/rusty_2h.vox", Vec3::new(-2.5, -5.5, -4.0)),
|
// )
|
||||||
Weapon::SwordShield => ("weapon/axe/rusty_2h.vox", Vec3::new(-2.5, -6.5, -2.0)),
|
//}
|
||||||
Weapon::Bow => ("weapon/hammer/rusty_2h.vox", Vec3::new(-2.5, -5.5, -4.0)),
|
|
||||||
Weapon::Staff => ("weapon/axe/rusty_2h.vox", Vec3::new(-2.5, -6.5, -2.0)),
|
|
||||||
};
|
|
||||||
Self::load_mesh(name, offset)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn load_right_equip(hand: humanoid::Hand) -> Mesh<FigurePipeline> {
|
|
||||||
Self::load_mesh(
|
|
||||||
match hand {
|
|
||||||
humanoid::Hand::Default => "figure/body/hand.vox",
|
|
||||||
},
|
|
||||||
Vec3::new(-2.0, -2.5, -5.0),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
/////////
|
/////////
|
||||||
fn load_pig_head(head: quadruped::Head) -> Mesh<FigurePipeline> {
|
fn load_pig_head(head: quadruped::Head) -> Mesh<FigurePipeline> {
|
||||||
@ -595,6 +581,7 @@ impl FigureMgr {
|
|||||||
})
|
})
|
||||||
.unwrap_or(Rgba::broadcast(1.0));
|
.unwrap_or(Rgba::broadcast(1.0));
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
let skeleton_attr = &self
|
let skeleton_attr = &self
|
||||||
.model_cache
|
.model_cache
|
||||||
.get_or_create_model(renderer, *body, tick)
|
.get_or_create_model(renderer, *body, tick)
|
||||||
@ -626,34 +613,38 @@ impl FigureMgr {
|
|||||||
animation_info.time,
|
animation_info.time,
|
||||||
skeleton_attr,
|
skeleton_attr,
|
||||||
),
|
),
|
||||||
comp::Animation::Attack => {
|
comp::Animation::Attack => anim::character::AttackAnimation::update_skeleton(
|
||||||
anim::character::AttackAnimation::update_skeleton(
|
|
||||||
state.skeleton_mut(),
|
state.skeleton_mut(),
|
||||||
time,
|
time,
|
||||||
animation_info.time,
|
animation_info.time,
|
||||||
skeleton_attr,
|
skeleton_attr,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
comp::Animation::Cjump => anim::character::CjumpAnimation::update_skeleton(
|
||||||
|
state.skeleton_mut(),
|
||||||
|
time,
|
||||||
|
animation_info.time,
|
||||||
|
skeleton_attr,
|
||||||
|
),
|
||||||
comp::Animation::Roll => anim::character::RollAnimation::update_skeleton(
|
comp::Animation::Roll => anim::character::RollAnimation::update_skeleton(
|
||||||
state.skeleton_mut(),
|
state.skeleton_mut(),
|
||||||
time,
|
time,
|
||||||
animation_info.time,
|
animation_info.time,
|
||||||
skeleton_attr,
|
skeleton_attr,
|
||||||
),
|
),
|
||||||
comp::Animation::Crun => anim::character::CrunAnimation::update_skeleton(
|
comp::Animation::Crun => anim::character::CrunAnimation::update_skeleton(
|
||||||
state.skeleton_mut(),
|
state.skeleton_mut(),
|
||||||
(vel.0.magnitude(), time),
|
(vel.0.magnitude(), time),
|
||||||
animation_info.time,
|
animation_info.time,
|
||||||
skeleton_attr,
|
skeleton_attr,
|
||||||
),
|
),
|
||||||
comp::Animation::Cidle => anim::character::CidleAnimation::update_skeleton(
|
comp::Animation::Cidle => anim::character::CidleAnimation::update_skeleton(
|
||||||
state.skeleton_mut(),
|
state.skeleton_mut(),
|
||||||
time,
|
time,
|
||||||
animation_info.time,
|
animation_info.time,
|
||||||
skeleton_attr,
|
skeleton_attr,
|
||||||
),
|
),
|
||||||
comp::Animation::Gliding => {
|
comp::Animation::Gliding => anim::character::GlidingAnimation::update_skeleton(
|
||||||
anim::character::GlidingAnimation::update_skeleton(
|
|
||||||
state.skeleton_mut(),
|
state.skeleton_mut(),
|
||||||
(vel.0.magnitude(), time),
|
(vel.0.magnitude(), time),
|
||||||
animation_info.time,
|
animation_info.time,
|
||||||
|
Loading…
Reference in New Issue
Block a user