mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Animation for defensive combo
This commit is contained in:
parent
0dea91e57f
commit
19948ad6fd
@ -523,6 +523,65 @@ impl Animation for ComboAnimation {
|
||||
next.control.orientation.rotate_z(move2 * -1.8);
|
||||
next.control.position += Vec3::new(move2 * 14.0, 0.0, 0.0);
|
||||
},
|
||||
Some("common.abilities.sword.defensive_combo") => {
|
||||
let (move1, move2, move3) = if strike == current_strike {
|
||||
match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
|
||||
Some(StageSection::Action) => (1.0, anim_time.powf(0.5), 0.0),
|
||||
Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)),
|
||||
_ => (0.0, 0.0, 0.0),
|
||||
}
|
||||
} else {
|
||||
(1.0, 1.0, 0.0)
|
||||
};
|
||||
|
||||
match strike {
|
||||
0 => {
|
||||
let s1_move1_hack = if current_strike == 1 { move1 } else { 0.0 };
|
||||
next.hand_l.position = Vec3::new(s_a.shl.0, s_a.shl.1, s_a.shl.2);
|
||||
next.hand_l.orientation = Quaternion::rotation_x(s_a.shl.3)
|
||||
* Quaternion::rotation_y(s_a.shl.4);
|
||||
next.hand_r.position = Vec3::new(
|
||||
-s_a.sc.0 + 6.0 + move1 * -12.0,
|
||||
-4.0 + move1 * 3.0,
|
||||
-2.0,
|
||||
);
|
||||
next.hand_r.orientation = Quaternion::rotation_x(0.9 + move1 * 0.5);
|
||||
next.control.position = Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2);
|
||||
next.control.orientation = Quaternion::rotation_x(s_a.sc.3)
|
||||
* Quaternion::rotation_z(s1_move1_hack * PI);
|
||||
|
||||
next.chest.orientation = Quaternion::rotation_z(move1 * 0.8);
|
||||
next.head.orientation = Quaternion::rotation_z(move1 * -0.3);
|
||||
next.belt.orientation = Quaternion::rotation_z(move1 * -0.2);
|
||||
next.shorts.orientation = Quaternion::rotation_z(move1 * -0.6);
|
||||
next.control.position += Vec3::new(0.0, 0.0, move1 * 5.0);
|
||||
|
||||
next.chest.orientation.rotate_z(move2 * -1.9);
|
||||
next.head.orientation.rotate_z(move2 * 1.3);
|
||||
next.belt.orientation.rotate_z(move2 * 0.7);
|
||||
next.shorts.orientation.rotate_z(move2 * 1.5);
|
||||
next.control.orientation.rotate_y(move2 * -1.6);
|
||||
next.control.orientation.rotate_z(move2 * -1.1);
|
||||
next.control.position +=
|
||||
Vec3::new(move2 * 12.0, move2 * 5.0, move2 * -1.0);
|
||||
},
|
||||
1 => {
|
||||
next.belt.orientation.rotate_z(move1 * 0.2);
|
||||
next.shorts.orientation.rotate_z(move1 * 0.3);
|
||||
next.control.position += Vec3::new(0.0, move1 * -5.0, move1 * 1.0);
|
||||
|
||||
next.chest.orientation.rotate_z(move2 * 2.1);
|
||||
next.head.orientation.rotate_z(move2 * -1.2);
|
||||
next.belt.orientation.rotate_z(move2 * -1.0);
|
||||
next.shorts.orientation.rotate_z(move2 * -1.8);
|
||||
next.control.orientation.rotate_z(move2 * 0.9);
|
||||
next.control.position +=
|
||||
Vec3::new(move2 * -12.0, move2 * 2.0, move2 * -1.0);
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
}
|
||||
|
@ -38,7 +38,12 @@ impl Animation for DiveMeleeAnimation {
|
||||
match ability_id {
|
||||
Some("common.abilities.sword.cleaving_dive") => {
|
||||
let (move1, move2, move3, move4) = match stage_section {
|
||||
Some(StageSection::Movement) => (anim_time.min(1.0).powi(2), (1.0 - ground_dist).powi(2), 0.0, 0.0),
|
||||
Some(StageSection::Movement) => (
|
||||
anim_time.min(1.0).powi(2),
|
||||
(1.0 - ground_dist).powi(2),
|
||||
0.0,
|
||||
0.0,
|
||||
),
|
||||
Some(StageSection::Action) => (1.0, 1.0, anim_time.powf(0.25), 0.0),
|
||||
Some(StageSection::Recover) => (1.0, 1.0, 1.0, anim_time.powi(4)),
|
||||
_ => (0.0, 0.0, 0.0, 0.0),
|
||||
@ -50,13 +55,8 @@ impl Animation for DiveMeleeAnimation {
|
||||
next.hand_r.position =
|
||||
Vec3::new(-s_a.sc.0 + 6.0 + move1 * -12.0, -4.0 + move1 * 3.0, -2.0);
|
||||
next.hand_r.orientation = Quaternion::rotation_x(0.9 + move1 * 0.5);
|
||||
next.control.position = Vec3::new(
|
||||
s_a.sc.0,
|
||||
s_a.sc.1,
|
||||
s_a.sc.2,
|
||||
);
|
||||
next.control.orientation =
|
||||
Quaternion::rotation_x(s_a.sc.3);
|
||||
next.control.position = Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2);
|
||||
next.control.orientation = Quaternion::rotation_x(s_a.sc.3);
|
||||
|
||||
next.torso.orientation.rotate_x(move1 * -0.8);
|
||||
next.control.orientation.rotate_x(move1 * 1.5);
|
||||
|
@ -44,15 +44,16 @@ pub use self::{
|
||||
alpha::AlphaAnimation, beam::BeamAnimation, beta::BetaAnimation, block::BlockAnimation,
|
||||
chargeswing::ChargeswingAnimation, climb::ClimbAnimation, collect::CollectAnimation,
|
||||
combomelee::ComboAnimation, consume::ConsumeAnimation, dance::DanceAnimation,
|
||||
dash::DashAnimation, equip::EquipAnimation, finishermelee::FinisherMeleeAnimation,
|
||||
glidewield::GlideWieldAnimation, gliding::GlidingAnimation, idle::IdleAnimation,
|
||||
jump::JumpAnimation, leapmelee::LeapAnimation, mount::MountAnimation, music::MusicAnimation,
|
||||
repeater::RepeaterAnimation, roll::RollAnimation, run::RunAnimation,
|
||||
shockwave::ShockwaveAnimation, shoot::ShootAnimation, sit::SitAnimation, sneak::SneakAnimation,
|
||||
sneakequip::SneakEquipAnimation, sneakwield::SneakWieldAnimation, spin::SpinAnimation,
|
||||
spinmelee::SpinMeleeAnimation, staggered::StaggeredAnimation, stand::StandAnimation,
|
||||
stunned::StunnedAnimation, swim::SwimAnimation, swimwield::SwimWieldAnimation,
|
||||
talk::TalkAnimation, wallrun::WallrunAnimation, wield::WieldAnimation, divemelee::DiveMeleeAnimation,
|
||||
dash::DashAnimation, divemelee::DiveMeleeAnimation, equip::EquipAnimation,
|
||||
finishermelee::FinisherMeleeAnimation, glidewield::GlideWieldAnimation,
|
||||
gliding::GlidingAnimation, idle::IdleAnimation, jump::JumpAnimation, leapmelee::LeapAnimation,
|
||||
mount::MountAnimation, music::MusicAnimation, repeater::RepeaterAnimation, roll::RollAnimation,
|
||||
run::RunAnimation, shockwave::ShockwaveAnimation, shoot::ShootAnimation, sit::SitAnimation,
|
||||
sneak::SneakAnimation, sneakequip::SneakEquipAnimation, sneakwield::SneakWieldAnimation,
|
||||
spin::SpinAnimation, spinmelee::SpinMeleeAnimation, staggered::StaggeredAnimation,
|
||||
stand::StandAnimation, stunned::StunnedAnimation, swim::SwimAnimation,
|
||||
swimwield::SwimWieldAnimation, talk::TalkAnimation, wallrun::WallrunAnimation,
|
||||
wield::WieldAnimation,
|
||||
};
|
||||
use super::{make_bone, vek::*, FigureBoneData, Offsets, Skeleton, TrailSource};
|
||||
use common::comp;
|
||||
|
@ -40,9 +40,9 @@ use common::{
|
||||
mounting::Rider,
|
||||
resources::{DeltaTime, Time},
|
||||
states::{equipping, idle, utils::StageSection, wielding},
|
||||
terrain::{TerrainChunk, TerrainGrid, Block},
|
||||
terrain::{Block, TerrainChunk, TerrainGrid},
|
||||
uid::UidAllocator,
|
||||
vol::{RectRasterableVol, ReadVol},
|
||||
vol::{ReadVol, RectRasterableVol},
|
||||
};
|
||||
use common_base::span;
|
||||
use common_state::State;
|
||||
@ -1191,9 +1191,7 @@ impl FigureMgr {
|
||||
CharacterState::DiveMelee(s) => {
|
||||
let stage_time = s.timer.as_secs_f32();
|
||||
let stage_progress = match s.stage_section {
|
||||
StageSection::Movement => {
|
||||
stage_time
|
||||
},
|
||||
StageSection::Movement => stage_time,
|
||||
StageSection::Action => {
|
||||
stage_time / s.static_data.swing_duration.as_secs_f32()
|
||||
},
|
||||
@ -1202,9 +1200,8 @@ impl FigureMgr {
|
||||
},
|
||||
_ => 0.0,
|
||||
};
|
||||
let convert_vec3 = |vec3: anim::vek::Vec3<_>| {
|
||||
Vec3::new(vec3.x, vec3.y, vec3.z)
|
||||
};
|
||||
let convert_vec3 =
|
||||
|vec3: anim::vek::Vec3<_>| Vec3::new(vec3.x, vec3.y, vec3.z);
|
||||
let ground_dist = terrain_grid
|
||||
.ray(convert_vec3(pos.0), convert_vec3(pos.0 + vel.0))
|
||||
.until(Block::is_solid)
|
||||
|
Loading…
Reference in New Issue
Block a user