mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Better Admin Broom look & feel
+ Own animation + Add look_dir orientation + Boost particles only stay for 0.25 secs + Boost particles use ParticleMode::PortalFizz
This commit is contained in:
parent
ef5a9663ba
commit
a2119e3d00
@ -245,6 +245,10 @@ impl CharacterState {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn should_follow_look(&self) -> bool {
|
||||||
|
matches!(self, CharacterState::Boost(_)) || self.is_attack()
|
||||||
|
}
|
||||||
|
|
||||||
pub fn is_attack(&self) -> bool {
|
pub fn is_attack(&self) -> bool {
|
||||||
matches!(
|
matches!(
|
||||||
self,
|
self,
|
||||||
|
@ -31,6 +31,7 @@ impl CharacterBehavior for Data {
|
|||||||
fn behavior(&self, data: &JoinData, output_events: &mut OutputEvents) -> StateUpdate {
|
fn behavior(&self, data: &JoinData, output_events: &mut OutputEvents) -> StateUpdate {
|
||||||
let mut update = StateUpdate::from(data);
|
let mut update = StateUpdate::from(data);
|
||||||
|
|
||||||
|
handle_orientation(data, &mut update, 10.0, None);
|
||||||
handle_move(data, &mut update, 1.0);
|
handle_move(data, &mut update, 1.0);
|
||||||
|
|
||||||
if self.timer < self.static_data.movement_duration {
|
if self.timer < self.static_data.movement_duration {
|
||||||
|
@ -654,7 +654,7 @@ pub fn handle_orientation(
|
|||||||
// else the current horizontal movement direction is used
|
// else the current horizontal movement direction is used
|
||||||
let target_ori = if let Some(dir_override) = dir_override {
|
let target_ori = if let Some(dir_override) = dir_override {
|
||||||
dir_override.into()
|
dir_override.into()
|
||||||
} else if is_strafing(data, update) || update.character.is_attack() {
|
} else if is_strafing(data, update) || update.character.should_follow_look() {
|
||||||
data.inputs
|
data.inputs
|
||||||
.look_dir
|
.look_dir
|
||||||
.to_horizontal()
|
.to_horizontal()
|
||||||
|
62
voxygen/anim/src/character/boost.rs
Normal file
62
voxygen/anim/src/character/boost.rs
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
use super::{
|
||||||
|
super::{vek::*, Animation},
|
||||||
|
CharacterSkeleton, SkeletonAttr,
|
||||||
|
};
|
||||||
|
|
||||||
|
pub struct BoostAnimation;
|
||||||
|
|
||||||
|
type BoostAnimationDependency<'a> = ();
|
||||||
|
|
||||||
|
impl Animation for BoostAnimation {
|
||||||
|
type Dependency<'a> = BoostAnimationDependency<'a>;
|
||||||
|
type Skeleton = CharacterSkeleton;
|
||||||
|
|
||||||
|
#[cfg(feature = "use-dyn-lib")]
|
||||||
|
const UPDATE_FN: &'static [u8] = b"character_boost\0";
|
||||||
|
|
||||||
|
#[cfg_attr(feature = "be-dyn-lib", export_name = "character_boost")]
|
||||||
|
#[allow(clippy::single_match)] // TODO: Pending review in #587
|
||||||
|
fn update_skeleton_inner(
|
||||||
|
skeleton: &Self::Skeleton,
|
||||||
|
_dep: Self::Dependency<'_>,
|
||||||
|
anim_time: f32,
|
||||||
|
rate: &mut f32,
|
||||||
|
s_a: &SkeletonAttr,
|
||||||
|
) -> Self::Skeleton {
|
||||||
|
*rate = 1.0;
|
||||||
|
let mut next = (*skeleton).clone();
|
||||||
|
|
||||||
|
next.main.position = Vec3::new(10.0, -10.0, -10.0);
|
||||||
|
next.main.orientation = Quaternion::rotation_z(0.0);
|
||||||
|
next.second.position = Vec3::new(0.0, 0.0, 0.0);
|
||||||
|
next.second.orientation = Quaternion::rotation_z(0.0);
|
||||||
|
|
||||||
|
let (move1, move2, move3, tension) = (
|
||||||
|
anim_time.powf(0.25).min(1.0),
|
||||||
|
0.0,
|
||||||
|
0.0,
|
||||||
|
(anim_time * 20.0).sin() - 0.5,
|
||||||
|
);
|
||||||
|
let pullback = 1.0 - move3;
|
||||||
|
let move1 = move1 * pullback;
|
||||||
|
let move2 = move2 * pullback;
|
||||||
|
|
||||||
|
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(std::f32::consts::PI * 0.5);
|
||||||
|
next.control.position = Vec3::new(s_a.sc.0, s_a.sc.1, s_a.sc.2 + move2 * 5.0);
|
||||||
|
next.control.orientation = Quaternion::rotation_x(s_a.sc.3 + move1 * -0.9)
|
||||||
|
* Quaternion::rotation_y(move1 * 1.0 + move2 * -1.0)
|
||||||
|
* Quaternion::rotation_z(move1 * 1.3 + move2 * -1.3);
|
||||||
|
|
||||||
|
next.chest.orientation =
|
||||||
|
Quaternion::rotation_z(move1 * 1.0 + tension * 0.02 + move2 * -1.2);
|
||||||
|
next.head.orientation = Quaternion::rotation_z(move1 * -0.4 + move2 * 0.3);
|
||||||
|
next.belt.orientation = Quaternion::rotation_z(move1 * -0.25 + move2 * 0.2);
|
||||||
|
next.shorts.orientation = Quaternion::rotation_z(move1 * -0.5 + move2 * 0.4);
|
||||||
|
|
||||||
|
next
|
||||||
|
}
|
||||||
|
}
|
@ -2,6 +2,7 @@ pub mod alpha;
|
|||||||
pub mod beam;
|
pub mod beam;
|
||||||
pub mod beta;
|
pub mod beta;
|
||||||
pub mod block;
|
pub mod block;
|
||||||
|
pub mod boost;
|
||||||
pub mod chargeswing;
|
pub mod chargeswing;
|
||||||
pub mod climb;
|
pub mod climb;
|
||||||
pub mod collect;
|
pub mod collect;
|
||||||
@ -45,10 +46,10 @@ pub mod wield;
|
|||||||
// Reexports
|
// Reexports
|
||||||
pub use self::{
|
pub use self::{
|
||||||
alpha::AlphaAnimation, beam::BeamAnimation, beta::BetaAnimation, block::BlockAnimation,
|
alpha::AlphaAnimation, beam::BeamAnimation, beta::BetaAnimation, block::BlockAnimation,
|
||||||
chargeswing::ChargeswingAnimation, climb::ClimbAnimation, collect::CollectAnimation,
|
boost::BoostAnimation, chargeswing::ChargeswingAnimation, climb::ClimbAnimation,
|
||||||
combomelee::ComboAnimation, consume::ConsumeAnimation, dance::DanceAnimation,
|
collect::CollectAnimation, combomelee::ComboAnimation, consume::ConsumeAnimation,
|
||||||
dash::DashAnimation, divemelee::DiveMeleeAnimation, equip::EquipAnimation,
|
dance::DanceAnimation, dash::DashAnimation, divemelee::DiveMeleeAnimation,
|
||||||
finishermelee::FinisherMeleeAnimation, glidewield::GlideWieldAnimation,
|
equip::EquipAnimation, finishermelee::FinisherMeleeAnimation, glidewield::GlideWieldAnimation,
|
||||||
gliding::GlidingAnimation, idle::IdleAnimation, jump::JumpAnimation, leapmelee::LeapAnimation,
|
gliding::GlidingAnimation, idle::IdleAnimation, jump::JumpAnimation, leapmelee::LeapAnimation,
|
||||||
mount::MountAnimation, music::MusicAnimation, rapidmelee::RapidMeleeAnimation,
|
mount::MountAnimation, music::MusicAnimation, rapidmelee::RapidMeleeAnimation,
|
||||||
repeater::RepeaterAnimation, ripostemelee::RiposteMeleeAnimation, roll::RollAnimation,
|
repeater::RepeaterAnimation, ripostemelee::RiposteMeleeAnimation, roll::RollAnimation,
|
||||||
|
@ -1601,10 +1601,10 @@ impl FigureMgr {
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
CharacterState::Boost(_) => {
|
CharacterState::Boost(_) => {
|
||||||
anim::character::AlphaAnimation::update_skeleton(
|
anim::character::BoostAnimation::update_skeleton(
|
||||||
&target_base,
|
&target_base,
|
||||||
(hands, None, None),
|
(),
|
||||||
state.state_time,
|
0.5,
|
||||||
&mut state_animation_rate,
|
&mut state_animation_rate,
|
||||||
skeleton_attr,
|
skeleton_attr,
|
||||||
)
|
)
|
||||||
|
@ -946,9 +946,9 @@ impl ParticleMgr {
|
|||||||
+ usize::from(self.scheduler.heartbeats(Duration::from_millis(10))),
|
+ usize::from(self.scheduler.heartbeats(Duration::from_millis(10))),
|
||||||
|| {
|
|| {
|
||||||
Particle::new(
|
Particle::new(
|
||||||
Duration::from_secs(15),
|
Duration::from_millis(250),
|
||||||
time,
|
time,
|
||||||
ParticleMode::CampfireSmoke,
|
ParticleMode::PortalFizz,
|
||||||
interpolated.pos
|
interpolated.pos
|
||||||
+ vel.map_or(Vec3::zero(), |v| -v.0 * dt * rng.gen::<f32>()),
|
+ vel.map_or(Vec3::zero(), |v| -v.0 * dt * rng.gen::<f32>()),
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user