mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Animation for mobility feint
This commit is contained in:
parent
09de0ec483
commit
73a36235fc
@ -16,8 +16,8 @@ ComboMelee2(
|
||||
hit_timing: 0.6,
|
||||
recover_duration: 0.4,
|
||||
movement: (
|
||||
buildup: Some(Sideways(2.0)),
|
||||
swing: None,
|
||||
buildup: None,
|
||||
swing: Some(Sideways(3.0)),
|
||||
recover: None,
|
||||
),
|
||||
ori_modifier: 0.6,
|
||||
|
@ -16,6 +16,7 @@ impl Animation for ComboAnimation {
|
||||
Option<StageSection>,
|
||||
Option<AbilityInfo>,
|
||||
usize,
|
||||
Vec2<f32>,
|
||||
);
|
||||
type Skeleton = CharacterSkeleton;
|
||||
|
||||
@ -25,7 +26,7 @@ impl Animation for ComboAnimation {
|
||||
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_combo")]
|
||||
fn update_skeleton_inner<'a>(
|
||||
skeleton: &Self::Skeleton,
|
||||
(hands, ability_id, stage_section, ability_info, current_strike): Self::Dependency<'a>,
|
||||
(hands, ability_id, stage_section, ability_info, current_strike, move_dir): Self::Dependency<'a>,
|
||||
anim_time: f32,
|
||||
rate: &mut f32,
|
||||
s_a: &SkeletonAttr,
|
||||
@ -908,6 +909,55 @@ impl Animation for ComboAnimation {
|
||||
_ => {},
|
||||
}
|
||||
},
|
||||
Some("common.abilities.sword.mobility_feint") => {
|
||||
let (move1, move2, move3) = match stage_section {
|
||||
Some(StageSection::Buildup) => (anim_time.powf(0.25), 0.0, 0.0),
|
||||
Some(StageSection::Action) => (1.0, anim_time.powi(2), 0.0),
|
||||
Some(StageSection::Recover) => (1.0, 1.0, anim_time.powi(4)),
|
||||
_ => (0.0, 0.0, 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);
|
||||
|
||||
next.control.position += Vec3::new(0.0, 0.0, move1 * 4.0);
|
||||
|
||||
// Right feint if x > 0, else left
|
||||
if move_dir.x > 0.0 {
|
||||
next.chest.orientation = Quaternion::rotation_z(move1 * -0.7);
|
||||
next.head.orientation = Quaternion::rotation_z(move1 * 0.3);
|
||||
next.shorts.orientation = Quaternion::rotation_z(move1 * 0.4);
|
||||
next.belt.orientation = Quaternion::rotation_z(move1 * 0.2);
|
||||
next.control.position += Vec3::new(move1 * 12.0, 0.0, 0.0);
|
||||
next.control.orientation.rotate_y(move1 * 1.5);
|
||||
|
||||
next.chest.orientation.rotate_z(move2 * 1.5);
|
||||
next.head.orientation.rotate_z(move2 * -0.9);
|
||||
next.shorts.orientation.rotate_z(move2 * -1.1);
|
||||
next.belt.orientation.rotate_z(move2 * -0.5);
|
||||
next.control.orientation.rotate_z(move2 * 1.5);
|
||||
next.control.position += Vec3::new(move2 * -10.0, move2 * 2.0, 0.0);
|
||||
} else {
|
||||
next.chest.orientation = Quaternion::rotation_z(move1 * 0.7);
|
||||
next.head.orientation = Quaternion::rotation_z(move1 * -0.3);
|
||||
next.shorts.orientation = Quaternion::rotation_z(move1 * -0.4);
|
||||
next.belt.orientation = Quaternion::rotation_z(move1 * -0.2);
|
||||
next.control.orientation.rotate_y(move1 * -1.5);
|
||||
|
||||
next.chest.orientation.rotate_z(move2 * -1.5);
|
||||
next.head.orientation.rotate_z(move2 * 0.9);
|
||||
next.shorts.orientation.rotate_z(move2 * 1.1);
|
||||
next.belt.orientation.rotate_z(move2 * 0.5);
|
||||
next.control.orientation.rotate_z(move2 * -1.5);
|
||||
next.control.position += Vec3::new(move2 * 10.0, move2 * 2.0, 0.0);
|
||||
}
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
}
|
||||
|
@ -42,6 +42,7 @@ use common::{
|
||||
states::{equipping, idle, utils::StageSection, wielding},
|
||||
terrain::{Block, TerrainChunk, TerrainGrid},
|
||||
uid::UidAllocator,
|
||||
util::Dir,
|
||||
vol::{ReadVol, RectRasterableVol},
|
||||
};
|
||||
use common_base::span;
|
||||
@ -922,6 +923,12 @@ impl FigureMgr {
|
||||
.and_then(|a| a.ability_id(inventory))
|
||||
});
|
||||
|
||||
let move_dir = {
|
||||
let ori = ori * *Dir::default();
|
||||
let theta = vel.0.y.atan2(vel.0.x) - ori.y.atan2(ori.x);
|
||||
anim::vek::Vec2::unit_y().rotated_z(theta)
|
||||
};
|
||||
|
||||
// If a mount exists, get its animated mounting transform and its position
|
||||
let mount_transform_pos = (|| -> Option<_> {
|
||||
let mount = is_rider?.mount;
|
||||
@ -1731,6 +1738,7 @@ impl FigureMgr {
|
||||
Some(stage_section),
|
||||
Some(s.static_data.ability_info),
|
||||
current_strike,
|
||||
move_dir,
|
||||
),
|
||||
progress,
|
||||
&mut state_animation_rate,
|
||||
|
Loading…
Reference in New Issue
Block a user