mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
glider animation fix
This commit is contained in:
parent
b42c6dba61
commit
4e19e46a24
@ -7,6 +7,7 @@ pub struct ActionState {
|
|||||||
pub attacking: bool,
|
pub attacking: bool,
|
||||||
pub rolling: bool,
|
pub rolling: bool,
|
||||||
pub gliding: bool,
|
pub gliding: bool,
|
||||||
|
pub wielding: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for ActionState {
|
impl Default for ActionState {
|
||||||
@ -17,6 +18,7 @@ impl Default for ActionState {
|
|||||||
attacking: false,
|
attacking: false,
|
||||||
rolling: false,
|
rolling: false,
|
||||||
gliding: false,
|
gliding: false,
|
||||||
|
wielding: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ pub use agent::Agent;
|
|||||||
pub use animation::{Animation, AnimationInfo};
|
pub use animation::{Animation, AnimationInfo};
|
||||||
pub use body::{humanoid, quadruped, quadruped_medium, Body};
|
pub use body::{humanoid, quadruped, quadruped_medium, Body};
|
||||||
pub use controller::Controller;
|
pub use controller::Controller;
|
||||||
pub use inputs::{Attacking, Gliding, Jumping, MoveDir, Wielding, OnGround, Respawning, Rolling};
|
pub use inputs::{Attacking, Gliding, Jumping, MoveDir, OnGround, Respawning, Rolling, Wielding};
|
||||||
pub use inventory::{item, Inventory};
|
pub use inventory::{item, Inventory};
|
||||||
pub use phys::{ForceUpdate, Ori, Pos, Vel};
|
pub use phys::{ForceUpdate, Ori, Pos, Vel};
|
||||||
pub use player::Player;
|
pub use player::Player;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
comp::{
|
comp::{
|
||||||
ActionState, Animation, AnimationInfo, Attacking, Controller, ForceUpdate, Gliding,
|
ActionState, Animation, AnimationInfo, Attacking, Controller, ForceUpdate, Gliding,
|
||||||
Jumping, OnGround, Ori, Pos, Rolling, Vel,
|
Jumping, OnGround, Ori, Pos, Rolling, Vel, Wielding,
|
||||||
},
|
},
|
||||||
state::DeltaTime,
|
state::DeltaTime,
|
||||||
sys::phys::MOVEMENT_THRESHOLD_VEL,
|
sys::phys::MOVEMENT_THRESHOLD_VEL,
|
||||||
@ -20,6 +20,7 @@ impl<'a> System<'a> for Sys {
|
|||||||
ReadStorage<'a, Jumping>,
|
ReadStorage<'a, Jumping>,
|
||||||
ReadStorage<'a, Gliding>,
|
ReadStorage<'a, Gliding>,
|
||||||
ReadStorage<'a, Attacking>,
|
ReadStorage<'a, Attacking>,
|
||||||
|
ReadStorage<'a, Wielding>,
|
||||||
ReadStorage<'a, Rolling>,
|
ReadStorage<'a, Rolling>,
|
||||||
WriteStorage<'a, ActionState>,
|
WriteStorage<'a, ActionState>,
|
||||||
);
|
);
|
||||||
@ -35,6 +36,7 @@ impl<'a> System<'a> for Sys {
|
|||||||
jumpings,
|
jumpings,
|
||||||
glidings,
|
glidings,
|
||||||
attackings,
|
attackings,
|
||||||
|
wieldings,
|
||||||
rollings,
|
rollings,
|
||||||
mut action_states,
|
mut action_states,
|
||||||
): Self::SystemData,
|
): Self::SystemData,
|
||||||
@ -47,6 +49,7 @@ impl<'a> System<'a> for Sys {
|
|||||||
jumping,
|
jumping,
|
||||||
gliding,
|
gliding,
|
||||||
attacking,
|
attacking,
|
||||||
|
wielding,
|
||||||
rolling,
|
rolling,
|
||||||
mut action_state,
|
mut action_state,
|
||||||
) in (
|
) in (
|
||||||
@ -57,6 +60,7 @@ impl<'a> System<'a> for Sys {
|
|||||||
jumpings.maybe(),
|
jumpings.maybe(),
|
||||||
glidings.maybe(),
|
glidings.maybe(),
|
||||||
attackings.maybe(),
|
attackings.maybe(),
|
||||||
|
wieldings.maybe(),
|
||||||
rollings.maybe(),
|
rollings.maybe(),
|
||||||
&mut action_states,
|
&mut action_states,
|
||||||
)
|
)
|
||||||
@ -66,6 +70,7 @@ impl<'a> System<'a> for Sys {
|
|||||||
on_ground: on_ground.is_some(),
|
on_ground: on_ground.is_some(),
|
||||||
moving: vel.0.magnitude_squared() > MOVEMENT_THRESHOLD_VEL.powf(2.0),
|
moving: vel.0.magnitude_squared() > MOVEMENT_THRESHOLD_VEL.powf(2.0),
|
||||||
attacking: attacking.is_some(),
|
attacking: attacking.is_some(),
|
||||||
|
wielding: wielding.is_some(),
|
||||||
rolling: rolling.is_some(),
|
rolling: rolling.is_some(),
|
||||||
gliding: gliding.is_some(),
|
gliding: gliding.is_some(),
|
||||||
};
|
};
|
||||||
|
@ -20,17 +20,27 @@ impl<'a> System<'a> for Sys {
|
|||||||
warn!("{}", message);
|
warn!("{}", message);
|
||||||
Animation::Idle
|
Animation::Idle
|
||||||
}
|
}
|
||||||
let animation = match (a.on_ground, a.moving, a.attacking, a.gliding, a.rolling) {
|
let animation = match (
|
||||||
(_, _, true, true, _) => impossible_animation("Attack while gliding"),
|
a.on_ground,
|
||||||
(_, _, true, _, true) => impossible_animation("Roll while attacking"),
|
a.moving,
|
||||||
(_, _, _, true, true) => impossible_animation("Roll while gliding"),
|
a.attacking,
|
||||||
(_, false, _, _, true) => impossible_animation("Roll without moving"),
|
a.gliding,
|
||||||
(_, true, false, false, true) => Animation::Roll,
|
a.rolling,
|
||||||
(true, false, false, false, false) => Animation::Idle,
|
a.wielding,
|
||||||
(true, true, false, false, false) => Animation::Run,
|
) {
|
||||||
(false, _, false, false, false) => Animation::Jump,
|
(_, _, true, true, _, _) => impossible_animation("Attack while gliding"),
|
||||||
(_, _, false, true, false) => Animation::Gliding,
|
(_, _, true, _, true, _) => impossible_animation("Roll while attacking"),
|
||||||
(_, _, true, false, false) => Animation::Attack,
|
(_, _, _, true, true, _) => impossible_animation("Roll while gliding"),
|
||||||
|
(_, false, _, _, true, _) => impossible_animation("Roll without moving"),
|
||||||
|
(_, true, false, false, true, _) => Animation::Roll,
|
||||||
|
(true, false, false, false, false, false) => Animation::Idle,
|
||||||
|
(true, true, false, false, false, false) => Animation::Run,
|
||||||
|
(false, _, false, false, false, false) => Animation::Jump,
|
||||||
|
(true, false, false, false, false, true) => Animation::Cidle,
|
||||||
|
(true, true, false, false, false, true) => Animation::Crun,
|
||||||
|
(false, _, false, false, false, true) => Animation::Cjump,
|
||||||
|
(_, _, false, true, false, _) => Animation::Gliding,
|
||||||
|
(_, _, true, false, false, _) => Animation::Attack,
|
||||||
};
|
};
|
||||||
|
|
||||||
let new_time = animation_infos
|
let new_time = animation_infos
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
comp::{
|
comp::{
|
||||||
Attacking, Wielding, HealthSource, Stats, {ForceUpdate, Ori, Pos, Vel},
|
Attacking, HealthSource, Stats, Wielding, {ForceUpdate, Ori, Pos, Vel},
|
||||||
},
|
},
|
||||||
state::{DeltaTime, Uid},
|
state::{DeltaTime, Uid},
|
||||||
};
|
};
|
||||||
|
@ -29,8 +29,6 @@ impl Animation for CidleAnimation {
|
|||||||
let wave_slow_cos = (anim_time as f32 * 6.0 + PI).cos();
|
let wave_slow_cos = (anim_time as f32 * 6.0 + PI).cos();
|
||||||
let wave_slow = (anim_time as f32 * 6.0 + PI).sin();
|
let wave_slow = (anim_time as f32 * 6.0 + PI).sin();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
let head_look = Vec2::new(
|
let head_look = Vec2::new(
|
||||||
((global_time + anim_time) as f32 / 1.5)
|
((global_time + anim_time) as f32 / 1.5)
|
||||||
.floor()
|
.floor()
|
||||||
|
@ -43,19 +43,11 @@ impl Animation for CjumpAnimation {
|
|||||||
next.shorts.ori = Quaternion::rotation_z(0.0);
|
next.shorts.ori = Quaternion::rotation_z(0.0);
|
||||||
next.shorts.scale = Vec3::one();
|
next.shorts.scale = Vec3::one();
|
||||||
|
|
||||||
next.l_hand.offset = Vec3::new(
|
next.l_hand.offset = Vec3::new(-7.0, 4.0, 0.0 + wave_stop * 2.0);
|
||||||
-7.0,
|
|
||||||
4.0,
|
|
||||||
0.0 + wave_stop * 2.0,
|
|
||||||
);
|
|
||||||
next.l_hand.ori = Quaternion::rotation_x(-0.3);
|
next.l_hand.ori = Quaternion::rotation_x(-0.3);
|
||||||
next.l_hand.scale = Vec3::one();
|
next.l_hand.scale = Vec3::one();
|
||||||
|
|
||||||
next.r_hand.offset = Vec3::new(
|
next.r_hand.offset = Vec3::new(-7.0, 3.0, -2.0 + wave_stop * 2.0);
|
||||||
-7.0,
|
|
||||||
3.0,
|
|
||||||
-2.0 + wave_stop * 2.0,
|
|
||||||
);
|
|
||||||
next.r_hand.ori = Quaternion::rotation_x(-0.3);
|
next.r_hand.ori = Quaternion::rotation_x(-0.3);
|
||||||
next.r_hand.scale = Vec3::one();
|
next.r_hand.scale = Vec3::one();
|
||||||
|
|
||||||
|
@ -60,19 +60,11 @@ impl Animation for CrunAnimation {
|
|||||||
next.shorts.ori = Quaternion::rotation_z(wave * 0.6);
|
next.shorts.ori = Quaternion::rotation_z(wave * 0.6);
|
||||||
next.shorts.scale = Vec3::one();
|
next.shorts.scale = Vec3::one();
|
||||||
|
|
||||||
next.l_hand.offset = Vec3::new(
|
next.l_hand.offset = Vec3::new(-6.0, 4.0, 0.0);
|
||||||
-6.0,
|
|
||||||
4.0,
|
|
||||||
0.0,
|
|
||||||
);
|
|
||||||
next.l_hand.ori = Quaternion::rotation_x(-0.3);
|
next.l_hand.ori = Quaternion::rotation_x(-0.3);
|
||||||
next.l_hand.scale = Vec3::one();
|
next.l_hand.scale = Vec3::one();
|
||||||
|
|
||||||
next.r_hand.offset = Vec3::new(
|
next.r_hand.offset = Vec3::new(-6.0, 3.0, -2.0);
|
||||||
-6.0,
|
|
||||||
3.0,
|
|
||||||
-2.0,
|
|
||||||
);
|
|
||||||
next.r_hand.ori = Quaternion::rotation_x(-0.3);
|
next.r_hand.ori = Quaternion::rotation_x(-0.3);
|
||||||
next.r_hand.scale = Vec3::one();
|
next.r_hand.scale = Vec3::one();
|
||||||
|
|
||||||
@ -84,11 +76,7 @@ impl Animation for CrunAnimation {
|
|||||||
next.r_foot.ori = Quaternion::rotation_x(-0.0 + wave_cos * 1.5);
|
next.r_foot.ori = Quaternion::rotation_x(-0.0 + wave_cos * 1.5);
|
||||||
next.r_foot.scale = Vec3::one();
|
next.r_foot.scale = Vec3::one();
|
||||||
|
|
||||||
next.weapon.offset = Vec3::new(
|
next.weapon.offset = Vec3::new(-6.0 + skeleton_attr.weapon_x, 4.0, 0.0);
|
||||||
-6.0 + skeleton_attr.weapon_x,
|
|
||||||
4.0,
|
|
||||||
0.0,
|
|
||||||
);
|
|
||||||
next.weapon.ori = Quaternion::rotation_x(-0.3)
|
next.weapon.ori = Quaternion::rotation_x(-0.3)
|
||||||
* Quaternion::rotation_y(0.0)
|
* Quaternion::rotation_y(0.0)
|
||||||
* Quaternion::rotation_z(0.0);
|
* Quaternion::rotation_z(0.0);
|
||||||
|
@ -60,12 +60,19 @@ impl Animation for GlidingAnimation {
|
|||||||
next.shorts.ori = Quaternion::rotation_z(wave_very_slow_cos * 0.25);
|
next.shorts.ori = Quaternion::rotation_z(wave_very_slow_cos * 0.25);
|
||||||
next.shorts.scale = Vec3::one();
|
next.shorts.scale = Vec3::one();
|
||||||
|
|
||||||
next.l_hand.offset = Vec3::new(-10.0, -5.0 + wave_very_slow * 0.1, 8.5);
|
next.l_hand.offset = Vec3::new(
|
||||||
next.l_hand.ori =
|
-9.5 + wave_very_slow_cos * -1.5,
|
||||||
Quaternion::rotation_x(1.0 + wave_very_slow_cos * -0.1) * skeleton_attr.scaler;
|
-7.0 + wave_very_slow_cos * 1.5,
|
||||||
|
9.0,
|
||||||
|
);
|
||||||
|
next.l_hand.ori = Quaternion::rotation_x(1.0 + wave_very_slow_cos * -0.1);
|
||||||
next.l_hand.scale = Vec3::one();
|
next.l_hand.scale = Vec3::one();
|
||||||
|
|
||||||
next.r_hand.offset = Vec3::new(10.0, -5.0 + wave_very_slow * 0.1, 8.5);
|
next.r_hand.offset = Vec3::new(
|
||||||
|
9.5 + wave_very_slow_cos * -1.5,
|
||||||
|
-7.0 + wave_very_slow_cos * -1.5,
|
||||||
|
9.0,
|
||||||
|
);
|
||||||
next.r_hand.ori = Quaternion::rotation_x(1.0 + wave_very_slow_cos * -0.10);
|
next.r_hand.ori = Quaternion::rotation_x(1.0 + wave_very_slow_cos * -0.10);
|
||||||
next.r_hand.scale = Vec3::one();
|
next.r_hand.scale = Vec3::one();
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
pub mod attack;
|
pub mod attack;
|
||||||
pub mod cidle;
|
pub mod cidle;
|
||||||
pub mod crun;
|
|
||||||
pub mod cjump;
|
pub mod cjump;
|
||||||
|
pub mod crun;
|
||||||
pub mod gliding;
|
pub mod gliding;
|
||||||
pub mod idle;
|
pub mod idle;
|
||||||
pub mod jump;
|
pub mod jump;
|
||||||
@ -11,8 +11,8 @@ pub mod run;
|
|||||||
// Reexports
|
// Reexports
|
||||||
pub use self::attack::AttackAnimation;
|
pub use self::attack::AttackAnimation;
|
||||||
pub use self::cidle::CidleAnimation;
|
pub use self::cidle::CidleAnimation;
|
||||||
pub use self::crun::CrunAnimation;
|
|
||||||
pub use self::cjump::CjumpAnimation;
|
pub use self::cjump::CjumpAnimation;
|
||||||
|
pub use self::crun::CrunAnimation;
|
||||||
pub use self::gliding::GlidingAnimation;
|
pub use self::gliding::GlidingAnimation;
|
||||||
pub use self::idle::IdleAnimation;
|
pub use self::idle::IdleAnimation;
|
||||||
pub use self::jump::JumpAnimation;
|
pub use self::jump::JumpAnimation;
|
||||||
@ -85,7 +85,6 @@ impl Skeleton for CharacterSkeleton {
|
|||||||
FigureBoneData::default(),
|
FigureBoneData::default(),
|
||||||
FigureBoneData::default(),
|
FigureBoneData::default(),
|
||||||
FigureBoneData::default(),
|
FigureBoneData::default(),
|
||||||
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ impl<'a> From<&'a comp::humanoid::Body> for SkeletonAttr {
|
|||||||
neck_height: match (body.race, body.body_type) {
|
neck_height: match (body.race, body.body_type) {
|
||||||
(Orc, Male) => -2.0,
|
(Orc, Male) => -2.0,
|
||||||
(Orc, Female) => -2.0,
|
(Orc, Female) => -2.0,
|
||||||
(Human, Male) => 0.0,
|
(Human, Male) => -0.5,
|
||||||
(Human, Female) => -2.0,
|
(Human, Female) => -2.0,
|
||||||
(Elf, Male) => -0.5,
|
(Elf, Male) => -0.5,
|
||||||
(Elf, Female) => -1.25,
|
(Elf, Female) => -1.25,
|
||||||
|
@ -621,28 +621,28 @@ impl FigureMgr {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
comp::Animation::Cjump => anim::character::CjumpAnimation::update_skeleton(
|
comp::Animation::Cjump => anim::character::CjumpAnimation::update_skeleton(
|
||||||
state.skeleton_mut(),
|
state.skeleton_mut(),
|
||||||
time,
|
time,
|
||||||
animation_info.time,
|
animation_info.time,
|
||||||
skeleton_attr,
|
skeleton_attr,
|
||||||
),
|
),
|
||||||
comp::Animation::Roll => anim::character::RollAnimation::update_skeleton(
|
comp::Animation::Roll => anim::character::RollAnimation::update_skeleton(
|
||||||
state.skeleton_mut(),
|
state.skeleton_mut(),
|
||||||
time,
|
time,
|
||||||
animation_info.time,
|
animation_info.time,
|
||||||
skeleton_attr,
|
skeleton_attr,
|
||||||
),
|
),
|
||||||
comp::Animation::Crun => anim::character::CrunAnimation::update_skeleton(
|
comp::Animation::Crun => anim::character::CrunAnimation::update_skeleton(
|
||||||
state.skeleton_mut(),
|
state.skeleton_mut(),
|
||||||
(vel.0.magnitude(), time),
|
(vel.0.magnitude(), time),
|
||||||
animation_info.time,
|
animation_info.time,
|
||||||
skeleton_attr,
|
skeleton_attr,
|
||||||
),
|
),
|
||||||
comp::Animation::Cidle => anim::character::CidleAnimation::update_skeleton(
|
comp::Animation::Cidle => anim::character::CidleAnimation::update_skeleton(
|
||||||
state.skeleton_mut(),
|
state.skeleton_mut(),
|
||||||
time,
|
time,
|
||||||
animation_info.time,
|
animation_info.time,
|
||||||
skeleton_attr,
|
skeleton_attr,
|
||||||
),
|
),
|
||||||
comp::Animation::Gliding => {
|
comp::Animation::Gliding => {
|
||||||
anim::character::GlidingAnimation::update_skeleton(
|
anim::character::GlidingAnimation::update_skeleton(
|
||||||
|
Loading…
Reference in New Issue
Block a user