mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
hammer leap melee anim
This commit is contained in:
parent
e1634fa83a
commit
281155186f
@ -230,7 +230,7 @@ impl Tool {
|
||||
energy_cost: 450,
|
||||
buildup_duration: Duration::from_millis(100),
|
||||
movement_duration: Duration::from_millis(200),
|
||||
swing_duration: Duration::from_millis(100),
|
||||
swing_duration: Duration::from_millis(300),
|
||||
recover_duration: Duration::from_millis(600),
|
||||
base_damage: (160.0 * self.base_power()) as u32,
|
||||
knockback: 15.0,
|
||||
@ -264,10 +264,10 @@ impl Tool {
|
||||
recover_duration: Duration::from_millis(500),
|
||||
},
|
||||
LeapMelee {
|
||||
energy_cost: 700,
|
||||
buildup_duration: Duration::from_millis(100),
|
||||
energy_cost: 0,
|
||||
buildup_duration: Duration::from_millis(200),
|
||||
movement_duration: Duration::from_millis(500),
|
||||
swing_duration: Duration::from_millis(100),
|
||||
swing_duration: Duration::from_millis(150),
|
||||
recover_duration: Duration::from_millis(100),
|
||||
base_damage: (240.0 * self.base_power()) as u32,
|
||||
knockback: 25.0,
|
||||
@ -326,7 +326,7 @@ impl Tool {
|
||||
max_projectile_speed: 500.0,
|
||||
},
|
||||
RepeaterRanged {
|
||||
energy_cost: 450,
|
||||
energy_cost: 0,
|
||||
movement_duration: Duration::from_millis(200),
|
||||
buildup_duration: Duration::from_millis(100),
|
||||
shoot_duration: Duration::from_millis(100),
|
||||
|
@ -1,13 +1,22 @@
|
||||
use super::{super::Animation, CharacterSkeleton, SkeletonAttr};
|
||||
use common::comp::item::{Hands, ToolKind};
|
||||
/* use std::f32::consts::PI; */
|
||||
use super::super::vek::*;
|
||||
use super::{
|
||||
super::{vek::*, Animation},
|
||||
CharacterSkeleton, SkeletonAttr,
|
||||
};
|
||||
use common::{
|
||||
comp::item::{Hands, ToolKind},
|
||||
states::utils::StageSection,
|
||||
};
|
||||
use std::f32::consts::PI;
|
||||
|
||||
pub struct LeapAnimation;
|
||||
|
||||
impl Animation for LeapAnimation {
|
||||
type Dependency = (Option<ToolKind>, Option<ToolKind>, Vec3<f32>, f64);
|
||||
type Dependency = (
|
||||
Option<ToolKind>,
|
||||
Option<ToolKind>,
|
||||
Vec3<f32>,
|
||||
f64,
|
||||
Option<StageSection>,
|
||||
);
|
||||
type Skeleton = CharacterSkeleton;
|
||||
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
@ -17,7 +26,7 @@ impl Animation for LeapAnimation {
|
||||
#[allow(clippy::approx_constant)] // TODO: Pending review in #587
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
(active_tool_kind, second_tool_kind, _velocity, _global_time): Self::Dependency,
|
||||
(active_tool_kind, second_tool_kind, _velocity, _global_time, stage_section): Self::Dependency,
|
||||
anim_time: f64,
|
||||
rate: &mut f32,
|
||||
skeleton_attr: &SkeletonAttr,
|
||||
@ -26,11 +35,6 @@ impl Animation for LeapAnimation {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
let lab = 1.0;
|
||||
let slowersmooth = (anim_time as f32 * lab as f32 * 4.0).sin();
|
||||
let slower = (((1.0)
|
||||
/ (0.0001 + 0.999 * ((anim_time as f32 * lab as f32 * 4.0).sin()).powf(2.0 as f32)))
|
||||
.sqrt())
|
||||
* ((anim_time as f32 * lab as f32 * 4.0).sin());
|
||||
|
||||
// Spin stuff here
|
||||
let foot = (((5.0)
|
||||
@ -45,83 +49,197 @@ impl Animation for LeapAnimation {
|
||||
|
||||
// end spin stuff
|
||||
|
||||
let movement = (anim_time as f32 * 1.0).min(1.0);
|
||||
|
||||
if let Some(ToolKind::Hammer(_)) = active_tool_kind {
|
||||
next.l_hand.position = Vec3::new(-12.0, 0.0, 0.0);
|
||||
next.l_hand.orientation = Quaternion::rotation_x(-0.0) * Quaternion::rotation_y(0.0);
|
||||
next.l_hand.orientation = Quaternion::rotation_x(PI) * Quaternion::rotation_y(0.0);
|
||||
next.l_hand.scale = Vec3::one() * 1.08;
|
||||
next.r_hand.position = Vec3::new(3.0, 0.0, 0.0);
|
||||
next.r_hand.orientation = Quaternion::rotation_x(0.0) * Quaternion::rotation_y(0.0);
|
||||
next.r_hand.position = Vec3::new(2.0, 0.0, 0.0);
|
||||
next.r_hand.orientation = Quaternion::rotation_x(PI) * Quaternion::rotation_y(0.0);
|
||||
next.r_hand.scale = Vec3::one() * 1.06;
|
||||
next.main.position = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.main.orientation = Quaternion::rotation_x(0.0)
|
||||
* Quaternion::rotation_y(-1.57)
|
||||
* Quaternion::rotation_z(1.57);
|
||||
next.main.orientation = Quaternion::rotation_y(-1.57) * Quaternion::rotation_z(1.57);
|
||||
|
||||
next.head.position = Vec3::new(
|
||||
0.0,
|
||||
-2.0 + skeleton_attr.head.0 + slower * -1.0,
|
||||
skeleton_attr.head.1,
|
||||
);
|
||||
next.head.orientation = Quaternion::rotation_z(slower * 0.05)
|
||||
* Quaternion::rotation_x((slowersmooth * -0.25 + slower * 0.55).max(-0.2))
|
||||
* Quaternion::rotation_y(slower * 0.05);
|
||||
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
|
||||
|
||||
next.chest.position = Vec3::new(0.0, 0.0, 7.0);
|
||||
next.chest.orientation = Quaternion::rotation_z(slower * 0.08 + slowersmooth * 0.15)
|
||||
* Quaternion::rotation_x(-0.3 + slower * 0.45 + slowersmooth * 0.26)
|
||||
* Quaternion::rotation_y(slower * 0.18 + slowersmooth * 0.15);
|
||||
|
||||
next.belt.position = Vec3::new(0.0, 0.0, -2.0 + slower * -0.7);
|
||||
next.belt.orientation = Quaternion::rotation_z(slower * -0.16 + slowersmooth * -0.12)
|
||||
* Quaternion::rotation_x(0.0 + slower * -0.06)
|
||||
* Quaternion::rotation_y(slower * -0.05);
|
||||
|
||||
next.shorts.position = Vec3::new(0.0, 0.0, -5.0 + slower * -0.7);
|
||||
next.shorts.orientation = Quaternion::rotation_z(slower * -0.08 + slowersmooth * -0.08)
|
||||
* Quaternion::rotation_x(0.0 + slower * -0.08 + slowersmooth * -0.08)
|
||||
* Quaternion::rotation_y(slower * -0.07);
|
||||
|
||||
next.lantern.orientation =
|
||||
Quaternion::rotation_x(slower * -0.7 + 0.4) * Quaternion::rotation_y(slower * 0.4);
|
||||
next.hold.scale = Vec3::one() * 0.0;
|
||||
|
||||
next.l_foot.position = Vec3::new(
|
||||
-skeleton_attr.foot.0,
|
||||
slower * 3.0 + slowersmooth * -6.0 - 2.0,
|
||||
skeleton_attr.foot.2,
|
||||
);
|
||||
next.l_foot.orientation =
|
||||
Quaternion::rotation_x(slower * -0.2 + slowersmooth * -0.3 - 0.2);
|
||||
|
||||
next.r_foot.position = Vec3::new(
|
||||
skeleton_attr.foot.0,
|
||||
slower * 2.0 + slowersmooth * -4.0 - 1.0,
|
||||
-2.0 + skeleton_attr.foot.2,
|
||||
);
|
||||
next.r_foot.orientation =
|
||||
Quaternion::rotation_x(slower * -0.4 + slowersmooth * -0.6 - 1.0);
|
||||
|
||||
next.control.scale = Vec3::one();
|
||||
next.control.position = Vec3::new(-7.0, 7.0, 1.0);
|
||||
next.control.orientation = Quaternion::rotation_x(-0.7 + slower * 1.5)
|
||||
next.control.position = Vec3::new(6.0, 7.0, 1.0);
|
||||
next.control.orientation = Quaternion::rotation_x(0.3)
|
||||
* Quaternion::rotation_y(0.0)
|
||||
* Quaternion::rotation_z(1.4 + slowersmooth * -0.4 + slower * 0.2);
|
||||
* Quaternion::rotation_z(0.0);
|
||||
next.control.scale = Vec3::one();
|
||||
|
||||
next.lantern.position = Vec3::new(
|
||||
skeleton_attr.lantern.0,
|
||||
skeleton_attr.lantern.1,
|
||||
skeleton_attr.lantern.2,
|
||||
);
|
||||
next.glider.position = Vec3::new(0.0, 0.0, 10.0);
|
||||
next.glider.scale = Vec3::one() * 0.0;
|
||||
next.l_control.scale = Vec3::one();
|
||||
next.r_control.scale = Vec3::one();
|
||||
next.head.position = Vec3::new(0.0, -2.0 + skeleton_attr.head.0, skeleton_attr.head.1);
|
||||
|
||||
next.torso.position = Vec3::new(0.0, 0.0, 0.0) * skeleton_attr.scaler;
|
||||
next.torso.orientation = Quaternion::rotation_z(0.0);
|
||||
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
|
||||
if let Some(stage_section) = stage_section {
|
||||
match stage_section {
|
||||
StageSection::Buildup => {
|
||||
next.control.position = Vec3::new(6.0, 7.0, 1.0);
|
||||
next.control.orientation = Quaternion::rotation_x(0.3)
|
||||
* Quaternion::rotation_y(0.0)
|
||||
* Quaternion::rotation_z(movement * 0.5);
|
||||
next.chest.orientation = Quaternion::rotation_x(movement * 0.3)
|
||||
* Quaternion::rotation_y(0.0)
|
||||
* Quaternion::rotation_z(movement * 0.5);
|
||||
|
||||
next.head.orientation = Quaternion::rotation_x(0.0)
|
||||
* Quaternion::rotation_y(0.0)
|
||||
* Quaternion::rotation_z(movement * -0.4);
|
||||
},
|
||||
|
||||
StageSection::Movement => {
|
||||
next.control.position = Vec3::new(
|
||||
6.0 + movement * -10.0,
|
||||
7.0 + movement * 5.0,
|
||||
1.0 + movement * 5.0,
|
||||
);
|
||||
next.control.orientation = Quaternion::rotation_x(0.3)
|
||||
* Quaternion::rotation_y(0.0)
|
||||
* Quaternion::rotation_z(0.5 + movement * 0.5);
|
||||
next.chest.orientation = Quaternion::rotation_x(0.3 + movement * 0.3)
|
||||
* Quaternion::rotation_y(0.0)
|
||||
* Quaternion::rotation_z(0.5 + movement * 0.2);
|
||||
next.head.orientation = Quaternion::rotation_x(0.0)
|
||||
* Quaternion::rotation_y(movement * -0.1)
|
||||
* Quaternion::rotation_z(-0.4 + movement * -0.2);
|
||||
|
||||
next.l_foot.position = Vec3::new(
|
||||
-skeleton_attr.foot.0,
|
||||
skeleton_attr.foot.1 - 5.0,
|
||||
skeleton_attr.foot.2,
|
||||
);
|
||||
next.l_foot.orientation = Quaternion::rotation_x(-0.8);
|
||||
|
||||
next.r_foot.position = Vec3::new(
|
||||
skeleton_attr.foot.0,
|
||||
skeleton_attr.foot.1 + 8.0,
|
||||
skeleton_attr.foot.2 + 5.0,
|
||||
);
|
||||
next.r_foot.orientation = Quaternion::rotation_x(0.9);
|
||||
},
|
||||
StageSection::Swing => {
|
||||
next.control.position =
|
||||
Vec3::new(-4.0, 12.0 + movement * 13.0, 6.0 + movement * -7.0);
|
||||
next.control.orientation = Quaternion::rotation_x(0.3 + movement * -3.0)
|
||||
* Quaternion::rotation_y(0.0)
|
||||
* Quaternion::rotation_z(1.0 + movement * 0.5);
|
||||
next.chest.orientation = Quaternion::rotation_x(0.6 + movement * -0.9)
|
||||
* Quaternion::rotation_y(0.0)
|
||||
* Quaternion::rotation_z(0.7 + movement * -0.7);
|
||||
next.head.orientation = Quaternion::rotation_x(movement * 0.2)
|
||||
* Quaternion::rotation_y(-0.1)
|
||||
* Quaternion::rotation_z(-0.6 + movement * 0.6);
|
||||
|
||||
next.l_hand.position = Vec3::new(-12.0 + movement * 10.0, 0.0, 0.0);
|
||||
|
||||
next.l_foot.position = Vec3::new(
|
||||
-skeleton_attr.foot.0,
|
||||
skeleton_attr.foot.1 + 8.0,
|
||||
skeleton_attr.foot.2 - 5.0,
|
||||
);
|
||||
next.l_foot.orientation = Quaternion::rotation_x(0.9);
|
||||
|
||||
next.r_foot.position = Vec3::new(
|
||||
skeleton_attr.foot.0,
|
||||
skeleton_attr.foot.1 - 5.0,
|
||||
skeleton_attr.foot.2,
|
||||
);
|
||||
next.r_foot.orientation = Quaternion::rotation_x(-0.8);
|
||||
},
|
||||
StageSection::Recover => {
|
||||
next.control.position = Vec3::new(-4.0, 25.0, -1.0);
|
||||
next.control.orientation = Quaternion::rotation_x(-2.7)
|
||||
* Quaternion::rotation_y(0.0)
|
||||
* Quaternion::rotation_z(1.5);
|
||||
next.chest.orientation = Quaternion::rotation_x(-0.3 + movement * 0.3)
|
||||
* Quaternion::rotation_y(0.0)
|
||||
* Quaternion::rotation_z(0.0);
|
||||
next.head.orientation = Quaternion::rotation_x(0.2)
|
||||
* Quaternion::rotation_y(-0.1)
|
||||
* Quaternion::rotation_z(0.0);
|
||||
|
||||
next.l_hand.position = Vec3::new(-2.0, 0.0, 0.0);
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
}
|
||||
|
||||
/* if let Some(ToolKind::Hammer(_)) = active_tool_kind {
|
||||
next.l_hand.position = Vec3::new(-12.0, 0.0, 0.0);
|
||||
next.l_hand.orientation = Quaternion::rotation_x(-0.0) * Quaternion::rotation_y(0.0);
|
||||
next.l_hand.scale = Vec3::one() * 1.08;
|
||||
next.r_hand.position = Vec3::new(3.0, 0.0, 0.0);
|
||||
next.r_hand.orientation = Quaternion::rotation_x(0.0) * Quaternion::rotation_y(0.0);
|
||||
next.r_hand.scale = Vec3::one() * 1.06;
|
||||
next.main.position = Vec3::new(0.0, 0.0, 0.0);
|
||||
next.main.orientation = Quaternion::rotation_x(0.0)
|
||||
* Quaternion::rotation_y(-1.57)
|
||||
* Quaternion::rotation_z(1.57);
|
||||
|
||||
next.head.position = Vec3::new(
|
||||
0.0,
|
||||
-2.0 + skeleton_attr.head.0 + slower * -1.0,
|
||||
skeleton_attr.head.1,
|
||||
);
|
||||
next.head.orientation = Quaternion::rotation_z(slower * 0.05)
|
||||
* Quaternion::rotation_x((slowersmooth * -0.25 + slower * 0.55).max(-0.2))
|
||||
* Quaternion::rotation_y(slower * 0.05);
|
||||
next.head.scale = Vec3::one() * skeleton_attr.head_scale;
|
||||
|
||||
next.chest.position = Vec3::new(0.0, 0.0, 7.0);
|
||||
next.chest.orientation = Quaternion::rotation_z(slower * 0.08 + slowersmooth * 0.15)
|
||||
* Quaternion::rotation_x(-0.3 + slower * 0.45 + slowersmooth * 0.26)
|
||||
* Quaternion::rotation_y(slower * 0.18 + slowersmooth * 0.15);
|
||||
|
||||
next.belt.position = Vec3::new(0.0, 0.0, -2.0 + slower * -0.7);
|
||||
next.belt.orientation = Quaternion::rotation_z(slower * -0.16 + slowersmooth * -0.12)
|
||||
* Quaternion::rotation_x(0.0 + slower * -0.06)
|
||||
* Quaternion::rotation_y(slower * -0.05);
|
||||
|
||||
next.shorts.position = Vec3::new(0.0, 0.0, -5.0 + slower * -0.7);
|
||||
next.shorts.orientation = Quaternion::rotation_z(slower * -0.08 + slowersmooth * -0.08)
|
||||
* Quaternion::rotation_x(0.0 + slower * -0.08 + slowersmooth * -0.08)
|
||||
* Quaternion::rotation_y(slower * -0.07);
|
||||
|
||||
next.lantern.orientation =
|
||||
Quaternion::rotation_x(slower * -0.7 + 0.4) * Quaternion::rotation_y(slower * 0.4);
|
||||
next.hold.scale = Vec3::one() * 0.0;
|
||||
|
||||
next.l_foot.position = Vec3::new(
|
||||
-skeleton_attr.foot.0,
|
||||
slower * 3.0 + slowersmooth * -6.0 - 2.0,
|
||||
skeleton_attr.foot.2,
|
||||
);
|
||||
next.l_foot.orientation =
|
||||
Quaternion::rotation_x(slower * -0.2 + slowersmooth * -0.3 - 0.2);
|
||||
|
||||
next.r_foot.position = Vec3::new(
|
||||
skeleton_attr.foot.0,
|
||||
slower * 2.0 + slowersmooth * -4.0 - 1.0,
|
||||
-2.0 + skeleton_attr.foot.2,
|
||||
);
|
||||
next.r_foot.orientation =
|
||||
Quaternion::rotation_x(slower * -0.4 + slowersmooth * -0.6 - 1.0);
|
||||
|
||||
next.control.scale = Vec3::one();
|
||||
next.control.position = Vec3::new(-7.0, 7.0, 1.0);
|
||||
next.control.orientation = Quaternion::rotation_x(-0.7 + slower * 1.5)
|
||||
* Quaternion::rotation_y(0.0)
|
||||
* Quaternion::rotation_z(1.4 + slowersmooth * -0.4 + slower * 0.2);
|
||||
next.control.scale = Vec3::one();
|
||||
|
||||
next.lantern.position = Vec3::new(
|
||||
skeleton_attr.lantern.0,
|
||||
skeleton_attr.lantern.1,
|
||||
skeleton_attr.lantern.2,
|
||||
);
|
||||
next.glider.position = Vec3::new(0.0, 0.0, 10.0);
|
||||
next.glider.scale = Vec3::one() * 0.0;
|
||||
next.l_control.scale = Vec3::one();
|
||||
next.r_control.scale = Vec3::one();
|
||||
|
||||
next.torso.position = Vec3::new(0.0, 0.0, 0.0) * skeleton_attr.scaler;
|
||||
next.torso.orientation = Quaternion::rotation_z(0.0);
|
||||
next.torso.scale = Vec3::one() / 11.0 * skeleton_attr.scaler;
|
||||
*/
|
||||
} else if let Some(ToolKind::Axe(_)) = active_tool_kind {
|
||||
//INTENTION: SWORD
|
||||
next.l_hand.position = Vec3::new(-0.75, -1.0, -2.5);
|
||||
|
@ -986,11 +986,42 @@ impl FigureMgr {
|
||||
skeleton_attr,
|
||||
)
|
||||
},
|
||||
CharacterState::LeapMelee(_) => {
|
||||
CharacterState::LeapMelee(s) => {
|
||||
let stage_progress = match active_tool_kind {
|
||||
Some(ToolKind::Axe(_) | ToolKind::Hammer(_)) => {
|
||||
let stage_time = s.timer.as_secs_f64();
|
||||
match s.stage_section {
|
||||
StageSection::Buildup => {
|
||||
stage_time
|
||||
/ s.static_data.buildup_duration.as_secs_f64()
|
||||
},
|
||||
StageSection::Movement => {
|
||||
stage_time
|
||||
/ s.static_data.movement_duration.as_secs_f64()
|
||||
},
|
||||
StageSection::Swing => {
|
||||
stage_time / s.static_data.swing_duration.as_secs_f64()
|
||||
},
|
||||
StageSection::Recover => {
|
||||
stage_time
|
||||
/ s.static_data.recover_duration.as_secs_f64()
|
||||
},
|
||||
_ => 0.0,
|
||||
}
|
||||
},
|
||||
_ => state.state_time,
|
||||
};
|
||||
|
||||
anim::character::LeapAnimation::update_skeleton(
|
||||
&target_base,
|
||||
(active_tool_kind, second_tool_kind, vel.0, time),
|
||||
state.state_time,
|
||||
(
|
||||
active_tool_kind,
|
||||
second_tool_kind,
|
||||
vel.0,
|
||||
time,
|
||||
Some(s.stage_section),
|
||||
),
|
||||
stage_progress,
|
||||
&mut state_animation_rate,
|
||||
skeleton_attr,
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user