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 rolling: bool,
|
||||
pub gliding: bool,
|
||||
pub wielding: bool,
|
||||
}
|
||||
|
||||
impl Default for ActionState {
|
||||
@ -17,6 +18,7 @@ impl Default for ActionState {
|
||||
attacking: false,
|
||||
rolling: false,
|
||||
gliding: false,
|
||||
wielding: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ pub use agent::Agent;
|
||||
pub use animation::{Animation, AnimationInfo};
|
||||
pub use body::{humanoid, quadruped, quadruped_medium, Body};
|
||||
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 phys::{ForceUpdate, Ori, Pos, Vel};
|
||||
pub use player::Player;
|
||||
|
@ -1,7 +1,7 @@
|
||||
use crate::{
|
||||
comp::{
|
||||
ActionState, Animation, AnimationInfo, Attacking, Controller, ForceUpdate, Gliding,
|
||||
Jumping, OnGround, Ori, Pos, Rolling, Vel,
|
||||
Jumping, OnGround, Ori, Pos, Rolling, Vel, Wielding,
|
||||
},
|
||||
state::DeltaTime,
|
||||
sys::phys::MOVEMENT_THRESHOLD_VEL,
|
||||
@ -20,6 +20,7 @@ impl<'a> System<'a> for Sys {
|
||||
ReadStorage<'a, Jumping>,
|
||||
ReadStorage<'a, Gliding>,
|
||||
ReadStorage<'a, Attacking>,
|
||||
ReadStorage<'a, Wielding>,
|
||||
ReadStorage<'a, Rolling>,
|
||||
WriteStorage<'a, ActionState>,
|
||||
);
|
||||
@ -35,6 +36,7 @@ impl<'a> System<'a> for Sys {
|
||||
jumpings,
|
||||
glidings,
|
||||
attackings,
|
||||
wieldings,
|
||||
rollings,
|
||||
mut action_states,
|
||||
): Self::SystemData,
|
||||
@ -47,6 +49,7 @@ impl<'a> System<'a> for Sys {
|
||||
jumping,
|
||||
gliding,
|
||||
attacking,
|
||||
wielding,
|
||||
rolling,
|
||||
mut action_state,
|
||||
) in (
|
||||
@ -57,6 +60,7 @@ impl<'a> System<'a> for Sys {
|
||||
jumpings.maybe(),
|
||||
glidings.maybe(),
|
||||
attackings.maybe(),
|
||||
wieldings.maybe(),
|
||||
rollings.maybe(),
|
||||
&mut action_states,
|
||||
)
|
||||
@ -66,6 +70,7 @@ impl<'a> System<'a> for Sys {
|
||||
on_ground: on_ground.is_some(),
|
||||
moving: vel.0.magnitude_squared() > MOVEMENT_THRESHOLD_VEL.powf(2.0),
|
||||
attacking: attacking.is_some(),
|
||||
wielding: wielding.is_some(),
|
||||
rolling: rolling.is_some(),
|
||||
gliding: gliding.is_some(),
|
||||
};
|
||||
|
@ -20,17 +20,27 @@ impl<'a> System<'a> for Sys {
|
||||
warn!("{}", message);
|
||||
Animation::Idle
|
||||
}
|
||||
let animation = match (a.on_ground, a.moving, a.attacking, a.gliding, a.rolling) {
|
||||
(_, _, true, true, _) => impossible_animation("Attack while gliding"),
|
||||
(_, _, true, _, true) => impossible_animation("Roll while attacking"),
|
||||
(_, _, _, 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) => Animation::Idle,
|
||||
(true, true, false, false, false) => Animation::Run,
|
||||
(false, _, false, false, false) => Animation::Jump,
|
||||
(_, _, false, true, false) => Animation::Gliding,
|
||||
(_, _, true, false, false) => Animation::Attack,
|
||||
let animation = match (
|
||||
a.on_ground,
|
||||
a.moving,
|
||||
a.attacking,
|
||||
a.gliding,
|
||||
a.rolling,
|
||||
a.wielding,
|
||||
) {
|
||||
(_, _, true, true, _, _) => impossible_animation("Attack while gliding"),
|
||||
(_, _, true, _, true, _) => impossible_animation("Roll while attacking"),
|
||||
(_, _, _, 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
|
||||
|
@ -1,6 +1,6 @@
|
||||
use crate::{
|
||||
comp::{
|
||||
Attacking, Wielding, HealthSource, Stats, {ForceUpdate, Ori, Pos, Vel},
|
||||
Attacking, HealthSource, Stats, Wielding, {ForceUpdate, Ori, Pos, Vel},
|
||||
},
|
||||
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 = (anim_time as f32 * 6.0 + PI).sin();
|
||||
|
||||
|
||||
|
||||
let head_look = Vec2::new(
|
||||
((global_time + anim_time) as f32 / 1.5)
|
||||
.floor()
|
||||
|
@ -43,19 +43,11 @@ impl Animation for CjumpAnimation {
|
||||
next.shorts.ori = Quaternion::rotation_z(0.0);
|
||||
next.shorts.scale = Vec3::one();
|
||||
|
||||
next.l_hand.offset = Vec3::new(
|
||||
-7.0,
|
||||
4.0,
|
||||
0.0 + wave_stop * 2.0,
|
||||
);
|
||||
next.l_hand.offset = Vec3::new(-7.0, 4.0, 0.0 + wave_stop * 2.0);
|
||||
next.l_hand.ori = Quaternion::rotation_x(-0.3);
|
||||
next.l_hand.scale = Vec3::one();
|
||||
|
||||
next.r_hand.offset = Vec3::new(
|
||||
-7.0,
|
||||
3.0,
|
||||
-2.0 + wave_stop * 2.0,
|
||||
);
|
||||
next.r_hand.offset = Vec3::new(-7.0, 3.0, -2.0 + wave_stop * 2.0);
|
||||
next.r_hand.ori = Quaternion::rotation_x(-0.3);
|
||||
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.scale = Vec3::one();
|
||||
|
||||
next.l_hand.offset = Vec3::new(
|
||||
-6.0,
|
||||
4.0,
|
||||
0.0,
|
||||
);
|
||||
next.l_hand.offset = Vec3::new(-6.0, 4.0, 0.0);
|
||||
next.l_hand.ori = Quaternion::rotation_x(-0.3);
|
||||
next.l_hand.scale = Vec3::one();
|
||||
|
||||
next.r_hand.offset = Vec3::new(
|
||||
-6.0,
|
||||
3.0,
|
||||
-2.0,
|
||||
);
|
||||
next.r_hand.offset = Vec3::new(-6.0, 3.0, -2.0);
|
||||
next.r_hand.ori = Quaternion::rotation_x(-0.3);
|
||||
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.scale = Vec3::one();
|
||||
|
||||
next.weapon.offset = Vec3::new(
|
||||
-6.0 + skeleton_attr.weapon_x,
|
||||
4.0,
|
||||
0.0,
|
||||
);
|
||||
next.weapon.offset = Vec3::new(-6.0 + skeleton_attr.weapon_x, 4.0, 0.0);
|
||||
next.weapon.ori = Quaternion::rotation_x(-0.3)
|
||||
* Quaternion::rotation_y(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.scale = Vec3::one();
|
||||
|
||||
next.l_hand.offset = Vec3::new(-10.0, -5.0 + wave_very_slow * 0.1, 8.5);
|
||||
next.l_hand.ori =
|
||||
Quaternion::rotation_x(1.0 + wave_very_slow_cos * -0.1) * skeleton_attr.scaler;
|
||||
next.l_hand.offset = Vec3::new(
|
||||
-9.5 + wave_very_slow_cos * -1.5,
|
||||
-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.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.scale = Vec3::one();
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
pub mod attack;
|
||||
pub mod cidle;
|
||||
pub mod crun;
|
||||
pub mod cjump;
|
||||
pub mod crun;
|
||||
pub mod gliding;
|
||||
pub mod idle;
|
||||
pub mod jump;
|
||||
@ -11,8 +11,8 @@ pub mod run;
|
||||
// Reexports
|
||||
pub use self::attack::AttackAnimation;
|
||||
pub use self::cidle::CidleAnimation;
|
||||
pub use self::crun::CrunAnimation;
|
||||
pub use self::cjump::CjumpAnimation;
|
||||
pub use self::crun::CrunAnimation;
|
||||
pub use self::gliding::GlidingAnimation;
|
||||
pub use self::idle::IdleAnimation;
|
||||
pub use self::jump::JumpAnimation;
|
||||
@ -85,7 +85,6 @@ impl Skeleton for CharacterSkeleton {
|
||||
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) {
|
||||
(Orc, Male) => -2.0,
|
||||
(Orc, Female) => -2.0,
|
||||
(Human, Male) => 0.0,
|
||||
(Human, Male) => -0.5,
|
||||
(Human, Female) => -2.0,
|
||||
(Elf, Male) => -0.5,
|
||||
(Elf, Female) => -1.25,
|
||||
|
Loading…
Reference in New Issue
Block a user