mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
proper bow animation
This commit is contained in:
parent
7d1f779c28
commit
49ba196671
@ -40,6 +40,7 @@ impl Animation for BetaAnimation {
|
||||
match active_tool_kind {
|
||||
//TODO: Inventory
|
||||
Some(ToolKind::Axe(_)) | Some(ToolKind::Hammer(_)) | Some(ToolKind::Sword(_)) => {
|
||||
//INTENTION: SWORD
|
||||
next.head.offset = Vec3::new(
|
||||
0.0 + skeleton_attr.neck_right,
|
||||
-2.0 + skeleton_attr.neck_forward,
|
||||
|
@ -2,100 +2,151 @@ use super::{super::Animation, CharacterSkeleton, SkeletonAttr};
|
||||
use common::comp::item::ToolKind;
|
||||
use vek::*;
|
||||
|
||||
pub struct Input {
|
||||
pub attack: bool,
|
||||
}
|
||||
pub struct ChargeAnimation;
|
||||
|
||||
impl Animation for ChargeAnimation {
|
||||
type Dependency = (Option<ToolKind>, f64);
|
||||
type Dependency = (Option<ToolKind>, f32, f64);
|
||||
type Skeleton = CharacterSkeleton;
|
||||
|
||||
fn update_skeleton(
|
||||
skeleton: &Self::Skeleton,
|
||||
(active_tool_kind, _global_time): Self::Dependency,
|
||||
(active_tool_kind, velocity, _global_time): Self::Dependency,
|
||||
anim_time: f64,
|
||||
rate: &mut f32,
|
||||
skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
*rate = 1.0;
|
||||
|
||||
let mut next = (*skeleton).clone();
|
||||
let constant = 8.0;
|
||||
|
||||
let lab = 1.0;
|
||||
|
||||
let foot = (((5.0)
|
||||
/ (1.1 + 3.9 * ((anim_time as f32 * lab as f32 * 25.0).sin()).powf(2.0 as f32)))
|
||||
/ (0.2 + 4.8 * ((anim_time as f32 * lab as f32 * 8.0).sin()).powf(2.0 as f32)))
|
||||
.sqrt())
|
||||
* ((anim_time as f32 * lab as f32 * 25.0).sin());
|
||||
* ((anim_time as f32 * lab as f32 * 8.0).sin());
|
||||
let foote = (((5.0)
|
||||
/ (0.5 + 4.5 * ((anim_time as f32 * lab as f32 * 8.0 + 1.57).sin()).powf(2.0 as f32)))
|
||||
.sqrt())
|
||||
* ((anim_time as f32 * lab as f32 * 8.0).sin());
|
||||
let stress = (((5.0)
|
||||
/ (0.5 + 4.5 * ((anim_time as f32 * lab as f32 * 10.0).cos()).powf(2.0 as f32)))
|
||||
.sqrt())
|
||||
* ((anim_time as f32 * lab as f32 * 20.0).cos());
|
||||
let quick = (((5.0)
|
||||
/ (0.5 + 4.5 * ((anim_time as f32 * lab as f32 * 2.0).cos()).powf(2.0 as f32)))
|
||||
.sqrt())
|
||||
* ((anim_time as f32 * lab as f32 * 2.0).cos());
|
||||
|
||||
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());
|
||||
let stop = ((anim_time as f32).powf(0.3 as f32)).min(1.2);
|
||||
|
||||
let wave_cos = (((5.0)
|
||||
/ (1.1 + 3.9 * ((anim_time as f32 * constant as f32 * 2.4).sin()).powf(2.0 as f32)))
|
||||
.sqrt())
|
||||
* ((anim_time as f32 * constant as f32 * 1.5).sin());
|
||||
next.head.offset = Vec3::new(
|
||||
0.0 + stop * -2.0 + skeleton_attr.neck_right,
|
||||
-2.0 + stop * 2.5 + skeleton_attr.neck_forward,
|
||||
skeleton_attr.neck_height + 14.0,
|
||||
);
|
||||
next.head.ori = Quaternion::rotation_z(stop * -1.0)
|
||||
* Quaternion::rotation_x(0.0)
|
||||
* Quaternion::rotation_y(stop * -0.3);
|
||||
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
|
||||
|
||||
next.chest.offset = Vec3::new(0.0, 0.0, 7.0);
|
||||
next.chest.ori = Quaternion::rotation_z(stop * 1.2 + stress * stop * 0.02)
|
||||
* Quaternion::rotation_x(0.0)
|
||||
* Quaternion::rotation_y(0.0);
|
||||
next.chest.scale = Vec3::one();
|
||||
|
||||
next.belt.offset = Vec3::new(0.0, 0.0, -2.0);
|
||||
next.belt.ori = Quaternion::rotation_z(stop * -0.5);
|
||||
next.belt.scale = Vec3::one();
|
||||
|
||||
next.shorts.offset = Vec3::new(0.0, 0.0, -5.0);
|
||||
next.shorts.ori = Quaternion::rotation_z(stop * -0.7);
|
||||
next.shorts.scale = Vec3::one();
|
||||
|
||||
match active_tool_kind {
|
||||
//TODO: Inventory
|
||||
Some(ToolKind::Sword(_)) => {
|
||||
next.head.offset = Vec3::new(
|
||||
0.0 + skeleton_attr.neck_right,
|
||||
-2.0 + skeleton_attr.neck_forward,
|
||||
skeleton_attr.neck_height + 12.0,
|
||||
);
|
||||
next.head.ori = Quaternion::rotation_z(0.0)
|
||||
* Quaternion::rotation_x(0.0)
|
||||
* Quaternion::rotation_y(0.0);
|
||||
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
|
||||
|
||||
next.chest.offset = Vec3::new(0.0, 0.0, 7.0 + wave_cos * 2.0);
|
||||
next.chest.ori = Quaternion::rotation_x(-0.5) * Quaternion::rotation_z(-0.7);
|
||||
next.chest.scale = Vec3::one();
|
||||
|
||||
next.belt.offset = Vec3::new(0.0, 1.0, -1.0);
|
||||
next.belt.ori = Quaternion::rotation_x(0.2) * Quaternion::rotation_z(0.2);
|
||||
next.belt.scale = Vec3::one();
|
||||
|
||||
next.shorts.offset = Vec3::new(0.0, 3.0, -3.0);
|
||||
next.shorts.ori = Quaternion::rotation_x(0.4) * Quaternion::rotation_z(0.3);
|
||||
next.shorts.scale = Vec3::one();
|
||||
|
||||
next.l_hand.offset = Vec3::new(0.0, 1.0, 0.0);
|
||||
next.l_hand.ori = Quaternion::rotation_x(1.27);
|
||||
next.l_hand.scale = Vec3::one() * 1.04;
|
||||
next.r_hand.offset = Vec3::new(0.0, 0.0, -3.0);
|
||||
next.r_hand.ori = Quaternion::rotation_x(1.27);
|
||||
Some(ToolKind::Staff(_)) => {
|
||||
next.l_hand.offset = Vec3::new(1.0, -2.0, -5.0);
|
||||
next.l_hand.ori = Quaternion::rotation_x(1.47) * Quaternion::rotation_y(-0.3);
|
||||
next.l_hand.scale = Vec3::one() * 1.05;
|
||||
next.r_hand.offset = Vec3::new(9.0, 1.0, 0.0);
|
||||
next.r_hand.ori = Quaternion::rotation_x(1.8)
|
||||
* Quaternion::rotation_y(0.5)
|
||||
* Quaternion::rotation_z(-0.27);
|
||||
next.r_hand.scale = Vec3::one() * 1.05;
|
||||
next.main.offset = Vec3::new(0.0, 6.0, -1.0);
|
||||
next.main.offset = Vec3::new(11.0, 9.0, 10.0);
|
||||
next.main.ori = Quaternion::rotation_x(-0.3)
|
||||
* Quaternion::rotation_y(0.0)
|
||||
* Quaternion::rotation_z(0.0);
|
||||
* Quaternion::rotation_y(3.14 + 0.3)
|
||||
* Quaternion::rotation_z(0.9);
|
||||
next.main.scale = Vec3::one();
|
||||
|
||||
next.control.offset = Vec3::new(-8.0 - slow * 0.5, 3.0 - foot * 0.6, 3.0);
|
||||
next.control.ori = Quaternion::rotation_x(-0.3)
|
||||
next.control.offset = Vec3::new(-7.0, 6.0, 6.0 - quick * 5.0);
|
||||
next.control.ori = Quaternion::rotation_x(quick * 1.3)
|
||||
* Quaternion::rotation_y(0.0)
|
||||
* Quaternion::rotation_z(1.1 + slow * 0.2);
|
||||
* Quaternion::rotation_z(quick * 1.5);
|
||||
next.control.scale = Vec3::one();
|
||||
next.l_foot.offset = Vec3::new(-1.4, foot * 3.0 + 2.0, 8.0);
|
||||
next.l_foot.ori = Quaternion::rotation_x(foot * -0.4 - 0.8);
|
||||
next.l_foot.scale = Vec3::one();
|
||||
},
|
||||
Some(ToolKind::Bow(_)) => {
|
||||
next.l_hand.offset = Vec3::new(1.0, -4.0 + stop * -1.0, 0.0);
|
||||
next.l_hand.ori = Quaternion::rotation_x(1.20)
|
||||
* Quaternion::rotation_y(-0.6)
|
||||
* Quaternion::rotation_z(-0.3);
|
||||
next.l_hand.scale = Vec3::one() * 1.05;
|
||||
next.r_hand.offset = Vec3::new(3.0, -1.0, -5.0);
|
||||
next.r_hand.ori = Quaternion::rotation_x(1.20)
|
||||
* Quaternion::rotation_y(-0.6)
|
||||
* Quaternion::rotation_z(-0.3);
|
||||
next.r_hand.scale = Vec3::one() * 1.05;
|
||||
next.main.offset = Vec3::new(3.0, 2.0, -13.0);
|
||||
next.main.ori = Quaternion::rotation_x(-0.3)
|
||||
* Quaternion::rotation_y(0.3)
|
||||
* Quaternion::rotation_z(-0.6);
|
||||
next.main.scale = Vec3::one();
|
||||
|
||||
next.r_foot.offset = Vec3::new(5.4, foot * -3.0 - 1.0, 8.0);
|
||||
next.r_foot.ori = Quaternion::rotation_x(foot * 0.4 - 0.8);
|
||||
next.r_foot.scale = Vec3::one();
|
||||
next.control.offset = Vec3::new(-9.0 + stop * 13.0, 6.0 + stop * 4.0, 8.0);
|
||||
next.control.ori = Quaternion::rotation_x(0.0)
|
||||
* Quaternion::rotation_y(stop * -0.5)
|
||||
* Quaternion::rotation_z(stop * -0.9);
|
||||
next.control.scale = Vec3::one();
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
next.head.offset = Vec3::new(
|
||||
0.0 + skeleton_attr.neck_right,
|
||||
-2.0 + skeleton_attr.neck_forward,
|
||||
skeleton_attr.neck_height + 12.0,
|
||||
);
|
||||
next.head.ori = Quaternion::rotation_x(0.5);
|
||||
if velocity > 0.5 {
|
||||
next.l_foot.offset = Vec3::new(-3.4 - foot * 1.5, foote * 2.0, 8.0);
|
||||
next.l_foot.ori = Quaternion::rotation_x(foote * -0.1)
|
||||
* Quaternion::rotation_z(0.4)
|
||||
* Quaternion::rotation_y(0.15);
|
||||
next.l_foot.scale = Vec3::one();
|
||||
|
||||
next.r_foot.offset = Vec3::new(3.4 + foot * 1.5, foote * -1.5, 8.0);
|
||||
next.r_foot.ori = Quaternion::rotation_x(0.0)
|
||||
* Quaternion::rotation_z(0.4)
|
||||
* Quaternion::rotation_y(0.0);
|
||||
next.r_foot.scale = Vec3::one();
|
||||
next.torso.offset =
|
||||
Vec3::new(0.0 + foot * 0.03, foote * 0.05, 0.1) * skeleton_attr.scaler;
|
||||
next.torso.ori = 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;
|
||||
} else {
|
||||
next.l_foot.offset = Vec3::new(-3.4, -2.5 + stop * -1.3, 8.0);
|
||||
next.l_foot.ori = Quaternion::rotation_x(stop * -0.2 - 0.2 + stop * stress * 0.02)
|
||||
* Quaternion::rotation_z(stop * 0.1)
|
||||
* Quaternion::rotation_y(stop * 0.08);
|
||||
next.l_foot.scale = Vec3::one();
|
||||
|
||||
next.r_foot.offset = Vec3::new(3.4, 3.5 + stop * 1.5, 8.0);
|
||||
next.r_foot.ori =
|
||||
Quaternion::rotation_x(stop * 0.1) * Quaternion::rotation_z(stop * 0.1);
|
||||
next.r_foot.scale = Vec3::one();
|
||||
next.torso.offset = Vec3::new(0.0, 0.0, 0.1) * skeleton_attr.scaler;
|
||||
next.torso.ori = 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.l_shoulder.offset = Vec3::new(-5.0, 0.0, 4.7);
|
||||
next.l_shoulder.ori = Quaternion::rotation_x(0.0);
|
||||
@ -113,11 +164,6 @@ impl Animation for ChargeAnimation {
|
||||
next.lantern.ori = Quaternion::rotation_x(0.0);
|
||||
next.lantern.scale = Vec3::one() * 0.0;
|
||||
|
||||
next.torso.offset = Vec3::new(0.0, 0.0, 0.1) * skeleton_attr.scaler;
|
||||
next.torso.ori =
|
||||
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.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();
|
||||
|
130
voxygen/src/anim/character/dash.rs
Normal file
130
voxygen/src/anim/character/dash.rs
Normal file
@ -0,0 +1,130 @@
|
||||
use super::{super::Animation, CharacterSkeleton, SkeletonAttr};
|
||||
use common::comp::item::ToolKind;
|
||||
use vek::*;
|
||||
|
||||
pub struct Input {
|
||||
pub attack: bool,
|
||||
}
|
||||
pub struct DashAnimation;
|
||||
|
||||
impl Animation for DashAnimation {
|
||||
type Dependency = (Option<ToolKind>, f64);
|
||||
type Skeleton = CharacterSkeleton;
|
||||
|
||||
fn update_skeleton(
|
||||
skeleton: &Self::Skeleton,
|
||||
(active_tool_kind, _global_time): Self::Dependency,
|
||||
anim_time: f64,
|
||||
rate: &mut f32,
|
||||
skeleton_attr: &SkeletonAttr,
|
||||
) -> Self::Skeleton {
|
||||
*rate = 1.0;
|
||||
let mut next = (*skeleton).clone();
|
||||
let constant = 8.0;
|
||||
let lab = 1.0;
|
||||
|
||||
let foot = (((5.0)
|
||||
/ (1.1 + 3.9 * ((anim_time as f32 * lab as f32 * 25.0).sin()).powf(2.0 as f32)))
|
||||
.sqrt())
|
||||
* ((anim_time as f32 * lab as f32 * 25.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());
|
||||
|
||||
let wave_cos = (((5.0)
|
||||
/ (1.1 + 3.9 * ((anim_time as f32 * constant as f32 * 2.4).sin()).powf(2.0 as f32)))
|
||||
.sqrt())
|
||||
* ((anim_time as f32 * constant as f32 * 1.5).sin());
|
||||
|
||||
match active_tool_kind {
|
||||
//TODO: Inventory
|
||||
Some(ToolKind::Sword(_)) => {
|
||||
next.head.offset = Vec3::new(
|
||||
0.0 + skeleton_attr.neck_right,
|
||||
-2.0 + skeleton_attr.neck_forward,
|
||||
skeleton_attr.neck_height + 12.0,
|
||||
);
|
||||
next.head.ori = Quaternion::rotation_z(0.0)
|
||||
* Quaternion::rotation_x(0.0)
|
||||
* Quaternion::rotation_y(0.0);
|
||||
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
|
||||
|
||||
next.chest.offset = Vec3::new(0.0, 0.0, 7.0 + wave_cos * 2.0);
|
||||
next.chest.ori = Quaternion::rotation_x(-0.5) * Quaternion::rotation_z(-0.7);
|
||||
next.chest.scale = Vec3::one();
|
||||
|
||||
next.belt.offset = Vec3::new(0.0, 1.0, -1.0);
|
||||
next.belt.ori = Quaternion::rotation_x(0.2) * Quaternion::rotation_z(0.2);
|
||||
next.belt.scale = Vec3::one();
|
||||
|
||||
next.shorts.offset = Vec3::new(0.0, 3.0, -3.0);
|
||||
next.shorts.ori = Quaternion::rotation_x(0.4) * Quaternion::rotation_z(0.3);
|
||||
next.shorts.scale = Vec3::one();
|
||||
|
||||
next.l_hand.offset = Vec3::new(0.0, 1.0, 0.0);
|
||||
next.l_hand.ori = Quaternion::rotation_x(1.27);
|
||||
next.l_hand.scale = Vec3::one() * 1.04;
|
||||
next.r_hand.offset = Vec3::new(0.0, 0.0, -3.0);
|
||||
next.r_hand.ori = Quaternion::rotation_x(1.27);
|
||||
next.r_hand.scale = Vec3::one() * 1.05;
|
||||
next.main.offset = Vec3::new(0.0, 6.0, -1.0);
|
||||
next.main.ori = Quaternion::rotation_x(-0.3)
|
||||
* Quaternion::rotation_y(0.0)
|
||||
* Quaternion::rotation_z(0.0);
|
||||
next.main.scale = Vec3::one();
|
||||
|
||||
next.control.offset = Vec3::new(-8.0 - slow * 0.5, 3.0 - foot * 0.6, 3.0);
|
||||
next.control.ori = Quaternion::rotation_x(-0.3)
|
||||
* Quaternion::rotation_y(0.0)
|
||||
* Quaternion::rotation_z(1.1 + slow * 0.2);
|
||||
next.control.scale = Vec3::one();
|
||||
next.l_foot.offset = Vec3::new(-1.4, foot * 3.0 + 2.0, 8.0);
|
||||
next.l_foot.ori = Quaternion::rotation_x(foot * -0.4 - 0.8);
|
||||
next.l_foot.scale = Vec3::one();
|
||||
|
||||
next.r_foot.offset = Vec3::new(5.4, foot * -3.0 - 1.0, 8.0);
|
||||
next.r_foot.ori = Quaternion::rotation_x(foot * 0.4 - 0.8);
|
||||
next.r_foot.scale = Vec3::one();
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
next.head.offset = Vec3::new(
|
||||
0.0 + skeleton_attr.neck_right,
|
||||
-2.0 + skeleton_attr.neck_forward,
|
||||
skeleton_attr.neck_height + 12.0,
|
||||
);
|
||||
next.head.ori = Quaternion::rotation_x(0.5);
|
||||
|
||||
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.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, 0.0, 0.0);
|
||||
next.lantern.ori = Quaternion::rotation_x(0.0);
|
||||
next.lantern.scale = Vec3::one() * 0.0;
|
||||
|
||||
next.torso.offset = Vec3::new(0.0, 0.0, 0.1) * skeleton_attr.scaler;
|
||||
next.torso.ori =
|
||||
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.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
|
||||
}
|
||||
}
|
@ -4,6 +4,7 @@ pub mod block;
|
||||
pub mod blockidle;
|
||||
pub mod charge;
|
||||
pub mod climb;
|
||||
pub mod dash;
|
||||
pub mod equip;
|
||||
pub mod gliding;
|
||||
pub mod idle;
|
||||
@ -21,9 +22,10 @@ pub mod wield;
|
||||
pub use self::{
|
||||
alpha::AlphaAnimation, beta::BetaAnimation, block::BlockAnimation,
|
||||
blockidle::BlockIdleAnimation, charge::ChargeAnimation, climb::ClimbAnimation,
|
||||
equip::EquipAnimation, gliding::GlidingAnimation, idle::IdleAnimation, jump::JumpAnimation,
|
||||
roll::RollAnimation, run::RunAnimation, shoot::ShootAnimation, sit::SitAnimation,
|
||||
spin::SpinAnimation, stand::StandAnimation, swim::SwimAnimation, wield::WieldAnimation,
|
||||
dash::DashAnimation, equip::EquipAnimation, gliding::GlidingAnimation, idle::IdleAnimation,
|
||||
jump::JumpAnimation, roll::RollAnimation, run::RunAnimation, shoot::ShootAnimation,
|
||||
sit::SitAnimation, spin::SpinAnimation, stand::StandAnimation, swim::SwimAnimation,
|
||||
wield::WieldAnimation,
|
||||
};
|
||||
|
||||
use super::{Bone, Skeleton};
|
||||
|
@ -22,41 +22,38 @@ impl Animation for ShootAnimation {
|
||||
let lab = 1.0;
|
||||
|
||||
let foot = (((5.0)
|
||||
/ (1.1 + 3.9 * ((anim_time as f32 * lab as f32 * 15.0).sin()).powf(2.0 as f32)))
|
||||
/ (0.2 + 4.8 * ((anim_time as f32 * lab as f32 * 8.0).sin()).powf(2.0 as f32)))
|
||||
.sqrt())
|
||||
* ((anim_time as f32 * lab as f32 * 15.0).sin());
|
||||
* ((anim_time as f32 * lab as f32 * 8.0).sin());
|
||||
let foote = (((5.0)
|
||||
/ (0.5 + 4.5 * ((anim_time as f32 * lab as f32 * 8.0 + 1.57).sin()).powf(2.0 as f32)))
|
||||
.sqrt())
|
||||
* ((anim_time as f32 * lab as f32 * 8.0).sin());
|
||||
|
||||
let quick = (((5.0)
|
||||
/ (0.5 + 4.5 * ((anim_time as f32 * lab as f32 * 2.0).cos()).powf(2.0 as f32)))
|
||||
.sqrt())
|
||||
* ((anim_time as f32 * lab as f32 * 2.0).cos());
|
||||
let sloweralt = (((5.0)
|
||||
/ (0.1 + 4.9 * ((anim_time as f32 * lab as f32 * 4.0).cos()).powf(2.0 as f32)))
|
||||
.sqrt())
|
||||
* ((anim_time as f32 * lab as f32 * 4.0).cos());
|
||||
let exp = ((anim_time as f32).powf(0.3 as f32)).min(1.2);
|
||||
|
||||
next.head.offset = Vec3::new(
|
||||
0.0 + skeleton_attr.neck_right,
|
||||
-2.0 + skeleton_attr.neck_forward - quick * 1.5,
|
||||
-2.0 + skeleton_attr.neck_forward,
|
||||
skeleton_attr.neck_height + 14.0,
|
||||
);
|
||||
next.head.ori = Quaternion::rotation_z(quick * 0.15)
|
||||
* Quaternion::rotation_x(quick * 0.09)
|
||||
* Quaternion::rotation_y(0.0);
|
||||
next.head.ori = Quaternion::rotation_z(exp * -0.4)
|
||||
* Quaternion::rotation_x(0.0)
|
||||
* Quaternion::rotation_y(exp * 0.1);
|
||||
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
|
||||
|
||||
next.chest.offset = Vec3::new(0.0, 0.0 - quick * 1.5, 7.0);
|
||||
next.chest.ori = Quaternion::rotation_z(quick * 0.35)
|
||||
* Quaternion::rotation_x(quick * 0.09)
|
||||
* Quaternion::rotation_y(0.0);
|
||||
next.chest.offset = Vec3::new(0.0, 0.0 - exp * 1.5, 7.0);
|
||||
next.chest.ori = Quaternion::rotation_z(0.4 + exp * 1.0)
|
||||
* Quaternion::rotation_x(0.0 + exp * 0.2)
|
||||
* Quaternion::rotation_y(exp * -0.08);
|
||||
next.chest.scale = Vec3::one();
|
||||
|
||||
next.belt.offset = Vec3::new(0.0, 0.0 + quick * 1.0, -2.0);
|
||||
next.belt.ori = next.chest.ori;
|
||||
next.belt.offset = Vec3::new(0.0, 0.0 + exp * 1.0, -2.0);
|
||||
next.belt.ori = next.chest.ori * -0.1;
|
||||
next.belt.scale = Vec3::one();
|
||||
|
||||
next.shorts.offset = Vec3::new(0.0, quick * 1.0, -5.0);
|
||||
next.shorts.ori = next.chest.ori;
|
||||
next.shorts.offset = Vec3::new(0.0, exp * 1.0, -5.0);
|
||||
next.shorts.ori = next.chest.ori * -0.08;
|
||||
next.shorts.scale = Vec3::one();
|
||||
|
||||
match active_tool_kind {
|
||||
@ -76,21 +73,17 @@ impl Animation for ShootAnimation {
|
||||
* Quaternion::rotation_z(0.9);
|
||||
next.main.scale = Vec3::one();
|
||||
|
||||
next.control.offset = Vec3::new(-7.0, 6.0, 6.0 - quick * 5.0);
|
||||
next.control.ori = Quaternion::rotation_x(quick * 1.3)
|
||||
next.control.offset = Vec3::new(-7.0, 6.0, 6.0 - exp * 5.0);
|
||||
next.control.ori = Quaternion::rotation_x(exp * 1.3)
|
||||
* Quaternion::rotation_y(0.0)
|
||||
* Quaternion::rotation_z(quick * 1.5);
|
||||
* Quaternion::rotation_z(exp * 1.5);
|
||||
next.control.scale = Vec3::one();
|
||||
},
|
||||
Some(ToolKind::Bow(_)) => {
|
||||
next.l_hand.offset = Vec3::new(
|
||||
1.0 - sloweralt * 2.0,
|
||||
-4.0 - sloweralt * 7.0,
|
||||
-1.0 + sloweralt * 6.0,
|
||||
);
|
||||
next.l_hand.offset = Vec3::new(1.0 - exp * 2.0, -4.0 - exp * 7.0, -1.0 + exp * 6.0);
|
||||
next.l_hand.ori = Quaternion::rotation_x(1.20)
|
||||
* Quaternion::rotation_y(-0.6 + sloweralt * 0.8)
|
||||
* Quaternion::rotation_z(-0.3 + sloweralt * 0.9);
|
||||
* Quaternion::rotation_y(-0.6 + exp * 0.8)
|
||||
* Quaternion::rotation_z(-0.3 + exp * 0.9);
|
||||
next.l_hand.scale = Vec3::one() * 1.05;
|
||||
next.r_hand.offset = Vec3::new(3.0, -1.0, -5.0);
|
||||
next.r_hand.ori = Quaternion::rotation_x(1.20)
|
||||
@ -104,7 +97,7 @@ impl Animation for ShootAnimation {
|
||||
next.main.scale = Vec3::one();
|
||||
|
||||
next.control.offset = Vec3::new(-9.0, 6.0, 8.0);
|
||||
next.control.ori = Quaternion::rotation_x((sloweralt * 0.4).max(0.4))
|
||||
next.control.ori = Quaternion::rotation_x(exp * 0.4)
|
||||
* Quaternion::rotation_y(0.0)
|
||||
* Quaternion::rotation_z(0.0);
|
||||
next.control.scale = Vec3::one();
|
||||
@ -112,12 +105,18 @@ impl Animation for ShootAnimation {
|
||||
_ => {},
|
||||
}
|
||||
if velocity > 0.5 {
|
||||
next.l_foot.offset = Vec3::new(-3.4, foot * -2.0, 8.0);
|
||||
next.l_foot.ori = Quaternion::rotation_x(foot * -0.4);
|
||||
next.l_foot.offset =
|
||||
Vec3::new(-3.4 - foot * 1.0 + exp * -1.0, foote * 0.8 + exp * 1.5, 8.0);
|
||||
next.l_foot.ori = Quaternion::rotation_x(exp * 0.5)
|
||||
* Quaternion::rotation_z(exp * 0.4)
|
||||
* Quaternion::rotation_y(0.15);
|
||||
next.l_foot.scale = Vec3::one();
|
||||
|
||||
next.r_foot.offset = Vec3::new(3.4, foot * 2.0, 8.0);
|
||||
next.r_foot.ori = Quaternion::rotation_x(foot * 0.4);
|
||||
next.r_foot.offset =
|
||||
Vec3::new(3.4 + foot * 1.0 + exp * 1.0, foote * -0.8 + exp * -1.0, 8.0);
|
||||
next.r_foot.ori = Quaternion::rotation_x(exp * -0.5)
|
||||
* Quaternion::rotation_z(exp * 0.4)
|
||||
* Quaternion::rotation_y(0.0);
|
||||
next.r_foot.scale = Vec3::one();
|
||||
next.torso.offset = Vec3::new(0.0, 0.0, 0.1) * skeleton_attr.scaler;
|
||||
next.torso.ori = Quaternion::rotation_z(0.0)
|
||||
@ -125,14 +124,13 @@ impl Animation for ShootAnimation {
|
||||
* Quaternion::rotation_y(0.0);
|
||||
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
|
||||
} else {
|
||||
next.l_foot.offset = Vec3::new(-3.4, -2.5, 8.0 + (quick * 2.5).max(0.0));
|
||||
next.l_foot.ori = Quaternion::rotation_x(quick * -0.2 - 0.2)
|
||||
* Quaternion::rotation_z((quick * 1.0).max(0.0));
|
||||
next.l_foot.offset = Vec3::new(-3.4, -2.5, 8.0 + exp * 2.5);
|
||||
next.l_foot.ori =
|
||||
Quaternion::rotation_x(exp * -0.2 - 0.2) * Quaternion::rotation_z(exp * 1.0);
|
||||
next.l_foot.scale = Vec3::one();
|
||||
|
||||
next.r_foot.offset = Vec3::new(3.4, 3.5 - quick * 2.0, 8.0);
|
||||
next.r_foot.ori = Quaternion::rotation_x(quick * 0.1)
|
||||
* Quaternion::rotation_z((quick * 0.5).max(0.0));
|
||||
next.r_foot.offset = Vec3::new(3.4, 3.5 - exp * 2.0, 8.0);
|
||||
next.r_foot.ori = Quaternion::rotation_x(exp * 0.1) * Quaternion::rotation_z(exp * 0.5);
|
||||
next.r_foot.scale = Vec3::one();
|
||||
next.torso.offset = Vec3::new(0.0, 0.0, 0.1) * skeleton_attr.scaler;
|
||||
next.torso.ori = Quaternion::rotation_z(0.0)
|
||||
|
@ -37,6 +37,7 @@ impl Animation for SpinAnimation {
|
||||
match active_tool_kind {
|
||||
//TODO: Inventory
|
||||
Some(ToolKind::Axe(_)) | Some(ToolKind::Hammer(_)) | Some(ToolKind::Sword(_)) => {
|
||||
//INTENTION: SWORD
|
||||
next.l_hand.offset = Vec3::new(0.0, 1.0, 0.0);
|
||||
next.l_hand.ori = Quaternion::rotation_x(1.27);
|
||||
next.l_hand.scale = Vec3::one() * 1.04;
|
||||
|
@ -480,14 +480,24 @@ impl FigureMgr {
|
||||
skeleton_attr,
|
||||
)
|
||||
},
|
||||
CharacterState::BasicRanged(_) => {
|
||||
anim::character::ShootAnimation::update_skeleton(
|
||||
&target_base,
|
||||
(active_tool_kind, vel.0.magnitude(), time),
|
||||
state.state_time,
|
||||
&mut state_animation_rate,
|
||||
skeleton_attr,
|
||||
)
|
||||
CharacterState::BasicRanged(data) => {
|
||||
if data.exhausted {
|
||||
anim::character::ShootAnimation::update_skeleton(
|
||||
&target_base,
|
||||
(active_tool_kind, vel.0.magnitude(), time),
|
||||
state.state_time,
|
||||
&mut state_animation_rate,
|
||||
skeleton_attr,
|
||||
)
|
||||
} else {
|
||||
anim::character::ChargeAnimation::update_skeleton(
|
||||
&target_base,
|
||||
(active_tool_kind, vel.0.magnitude(), time),
|
||||
state.state_time,
|
||||
&mut state_animation_rate,
|
||||
skeleton_attr,
|
||||
)
|
||||
}
|
||||
},
|
||||
CharacterState::Boost(_) => {
|
||||
anim::character::AlphaAnimation::update_skeleton(
|
||||
@ -499,7 +509,7 @@ impl FigureMgr {
|
||||
)
|
||||
},
|
||||
CharacterState::DashMelee(_) => {
|
||||
anim::character::ChargeAnimation::update_skeleton(
|
||||
anim::character::DashAnimation::update_skeleton(
|
||||
&target_base,
|
||||
(active_tool_kind, time),
|
||||
state.state_time,
|
||||
@ -544,7 +554,7 @@ impl FigureMgr {
|
||||
&mut state_animation_rate,
|
||||
skeleton_attr,
|
||||
),
|
||||
_ => anim::character::ChargeAnimation::update_skeleton(
|
||||
_ => anim::character::DashAnimation::update_skeleton(
|
||||
&target_base,
|
||||
(active_tool_kind, time),
|
||||
state.state_time,
|
||||
|
Loading…
Reference in New Issue
Block a user