mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
swing animation
Former-commit-id: 19e2c32aa36e3890e35df87f01bb0aec4cc8cf9c
This commit is contained in:
parent
7582714edc
commit
5f22c4e26f
BIN
assets/voxygen/voxel/weapon/sword/sword_rusty_2h.vox
(Stored with Git LFS)
BIN
assets/voxygen/voxel/weapon/sword/sword_rusty_2h.vox
(Stored with Git LFS)
Binary file not shown.
@ -115,11 +115,14 @@ impl<'a> System<'a> for Sys {
|
|||||||
let animation = if on_ground {
|
let animation = if on_ground {
|
||||||
if control.move_dir.magnitude() > 0.01 {
|
if control.move_dir.magnitude() > 0.01 {
|
||||||
Animation::Run
|
Animation::Run
|
||||||
|
} else if attackings.get(entity).is_some(){
|
||||||
|
Animation::Attack
|
||||||
} else {
|
} else {
|
||||||
Animation::Idle
|
Animation::Idle
|
||||||
}
|
}
|
||||||
} else if glidings.get(entity).is_some() {
|
} else if glidings.get(entity).is_some() {
|
||||||
Animation::Gliding
|
Animation::Gliding
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Animation::Jump
|
Animation::Jump
|
||||||
};
|
};
|
||||||
|
@ -23,9 +23,13 @@ impl Animation for AttackAnimation {
|
|||||||
) -> Self::Skeleton {
|
) -> Self::Skeleton {
|
||||||
let mut next = (*skeleton).clone();
|
let mut next = (*skeleton).clone();
|
||||||
|
|
||||||
let wave = (anim_time as f32 * 1.0).sin();
|
let wave = (anim_time as f32 * 4.0).sin();
|
||||||
|
let wave_quicken = (1.0 - (anim_time as f32 * 8.0).cos());
|
||||||
|
let wave_quicken_slow = (1.0 - (anim_time as f32 * 6.0).cos());
|
||||||
|
let wave_quicken_double = (1.0 - (anim_time as f32 * 12.0).cos());
|
||||||
|
let wave_quick =(anim_time as f32 * 0.5).sin();
|
||||||
let wave_cos = (anim_time as f32 * 12.0).cos();
|
let wave_cos = (anim_time as f32 * 12.0).cos();
|
||||||
let wave_slow = (anim_time as f32 * 6.0 + PI).sin();
|
let wave_slow = (anim_time as f32 * 5.0 + PI).cos();
|
||||||
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_ultra_slow = (anim_time as f32 * 1.0 + PI).sin();
|
let wave_ultra_slow = (anim_time as f32 * 1.0 + PI).sin();
|
||||||
let wave_ultra_slow_cos = (anim_time as f32 * 1.0 + PI).cos();
|
let wave_ultra_slow_cos = (anim_time as f32 * 1.0 + PI).cos();
|
||||||
@ -47,7 +51,7 @@ impl Animation for AttackAnimation {
|
|||||||
* 0.25,
|
* 0.25,
|
||||||
);
|
);
|
||||||
next.head.offset = Vec3::new(0.0, 2.0, 11.0);
|
next.head.offset = Vec3::new(0.0, 2.0, 11.0);
|
||||||
next.head.ori = Quaternion::rotation_z(0.0);
|
next.head.ori = Quaternion::rotation_z(wave_stop_quick * -0.25) * Quaternion::rotation_x(0.0 + wave_stop_quick * -0.1) * Quaternion::rotation_y(wave_stop_quick * 0.1);
|
||||||
next.head.scale = Vec3::one();
|
next.head.scale = Vec3::one();
|
||||||
|
|
||||||
next.chest.offset = Vec3::new(0.0, 0.0, 7.0);
|
next.chest.offset = Vec3::new(0.0, 0.0, 7.0);
|
||||||
@ -62,26 +66,26 @@ impl Animation for AttackAnimation {
|
|||||||
next.shorts.ori = Quaternion::rotation_x(0.0);
|
next.shorts.ori = Quaternion::rotation_x(0.0);
|
||||||
next.shorts.scale = Vec3::one();
|
next.shorts.scale = Vec3::one();
|
||||||
|
|
||||||
next.l_hand.offset = Vec3::new(-8.0, 4.0, 9.0) / 11.0;
|
next.l_hand.offset = Vec3::new(-8.0 + wave_quicken_slow * 10.0, 4.0 + wave_quicken_double * 3.0, 9.0) / 11.0;
|
||||||
next.l_hand.ori =
|
next.l_hand.ori =
|
||||||
Quaternion::rotation_x(0.0 + wave * 2.0) * Quaternion::rotation_z(wave * 2.0);
|
Quaternion::rotation_z(-0.8) * Quaternion::rotation_x(0.0 + wave_quicken * -0.8) * Quaternion::rotation_y(0.0 + wave_quicken * -0.4);
|
||||||
next.l_hand.scale = Vec3::one() / 11.0;
|
next.l_hand.scale = Vec3::one() / 11.0;
|
||||||
|
|
||||||
next.r_hand.offset = Vec3::new(8.0, 4.0, 6.5) / 11.0;
|
next.r_hand.offset = Vec3::new(0.0, -2.0, 6.5) / 11.0;
|
||||||
next.r_hand.ori = Quaternion::rotation_x(0.0);
|
next.r_hand.ori = Quaternion::rotation_x(0.0);
|
||||||
next.r_hand.scale = Vec3::one() / 11.0;
|
next.r_hand.scale = Vec3::one() *0.0;
|
||||||
|
|
||||||
next.l_foot.offset = Vec3::new(-3.3, -0.1, 8.0);
|
next.l_foot.offset = Vec3::new(-3.4, -0.1, 8.0 + wave_quicken * -2.0);
|
||||||
next.l_foot.ori = Quaternion::identity();
|
next.l_foot.ori = Quaternion::rotation_x(wave_quicken * -0.6);
|
||||||
next.l_foot.scale = Vec3::one();
|
next.l_foot.scale = Vec3::one();
|
||||||
|
|
||||||
next.r_foot.offset = Vec3::new(4.1, -0.1, 8.0);
|
next.r_foot.offset = Vec3::new(3.4, -0.1, 8.0 + wave_quick * -2.0);
|
||||||
next.r_foot.ori = Quaternion::identity();
|
next.r_foot.ori = Quaternion::rotation_x(wave_quicken * 0.6);
|
||||||
next.r_foot.scale = Vec3::one();
|
next.r_foot.scale = Vec3::one();
|
||||||
|
|
||||||
next.weapon.offset = Vec3::new(-7.0, -5.0, 15.0);
|
next.weapon.offset = Vec3::new(-7.0, -2.0, 5.0);
|
||||||
next.weapon.ori = Quaternion::rotation_y(2.5);
|
next.weapon.ori = Quaternion::rotation_y(2.5);
|
||||||
next.weapon.scale = Vec3::one();
|
next.weapon.scale = Vec3::one() * 0.0;
|
||||||
|
|
||||||
next.l_shoulder.offset = Vec3::new(-10.0, -3.2, 2.5);
|
next.l_shoulder.offset = Vec3::new(-10.0, -3.2, 2.5);
|
||||||
next.l_shoulder.ori = Quaternion::rotation_x(0.0);
|
next.l_shoulder.ori = Quaternion::rotation_x(0.0);
|
||||||
@ -95,17 +99,17 @@ impl Animation for AttackAnimation {
|
|||||||
next.draw.ori = Quaternion::rotation_y(0.0);
|
next.draw.ori = Quaternion::rotation_y(0.0);
|
||||||
next.draw.scale = Vec3::one() * 0.0;
|
next.draw.scale = Vec3::one() * 0.0;
|
||||||
|
|
||||||
next.left_equip.offset = Vec3::new(-8.0, 4.0, 9.0) / 11.0;
|
next.left_equip.offset = Vec3::new(-8.0 + wave_quicken_slow * 10.0, 4.0 + wave_quicken_double * 3.0, 9.0) / 11.0;
|
||||||
next.left_equip.ori =
|
next.left_equip.ori =
|
||||||
Quaternion::rotation_x(0.0 + wave * 2.0) * Quaternion::rotation_z(1.57 + wave * 2.0);
|
Quaternion::rotation_z(-0.8) * Quaternion::rotation_x(0.0 + wave_quicken * -0.8) * Quaternion::rotation_y(0.0 + wave_quicken * -0.4);
|
||||||
next.left_equip.scale = Vec3::one() / 11.0;
|
next.left_equip.scale = Vec3::one() / 11.0;
|
||||||
|
|
||||||
next.right_equip.offset = Vec3::new(0.0, 0.0, 5.0) / 11.0;
|
next.right_equip.offset =Vec3::new(-8.0 + wave_quicken_slow * 10.0, 4.0 + wave_quicken_double * 3.0, 9.0) / 11.0;
|
||||||
next.right_equip.ori = Quaternion::rotation_x(0.0);;
|
next.right_equip.ori = Quaternion::rotation_z(-0.8) * Quaternion::rotation_x(0.0 + wave_quicken * -0.8) * Quaternion::rotation_y(0.0 + wave_quicken * -0.4);
|
||||||
next.right_equip.scale = Vec3::one() * 0.0;
|
next.right_equip.scale = Vec3::one() / 11.0;
|
||||||
|
|
||||||
next.torso.offset = Vec3::new(0.0, -0.2, 0.1);
|
next.torso.offset = Vec3::new(0.0, -0.2, 0.1);
|
||||||
next.torso.ori = Quaternion::rotation_x(0.0);
|
next.torso.ori = Quaternion::rotation_z(wave_stop_quick * -0.2) * Quaternion::rotation_x(0.0 + wave_stop_quick * -0.2) * Quaternion::rotation_y(wave_stop_quick * 0.2);
|
||||||
next.torso.scale = Vec3::one() / 11.0;
|
next.torso.scale = Vec3::one() / 11.0;
|
||||||
next
|
next
|
||||||
}
|
}
|
||||||
|
@ -92,7 +92,7 @@ impl Animation for GlidingAnimation {
|
|||||||
next.r_foot.scale = Vec3::one();
|
next.r_foot.scale = Vec3::one();
|
||||||
|
|
||||||
next.weapon.offset = Vec3::new(-7.0, -5.0, 15.0);
|
next.weapon.offset = Vec3::new(-7.0, -5.0, 15.0);
|
||||||
next.weapon.ori = Quaternion::rotation_y(2.5);
|
next.weapon.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
|
||||||
next.weapon.scale = Vec3::one();
|
next.weapon.scale = Vec3::one();
|
||||||
|
|
||||||
next.l_shoulder.offset = Vec3::new(-10.0, -3.2, 2.5);
|
next.l_shoulder.offset = Vec3::new(-10.0, -3.2, 2.5);
|
||||||
|
@ -80,7 +80,7 @@ impl Animation for IdleAnimation {
|
|||||||
next.r_foot.scale = Vec3::one();
|
next.r_foot.scale = Vec3::one();
|
||||||
|
|
||||||
next.weapon.offset = Vec3::new(-7.0, -5.0, 15.0);
|
next.weapon.offset = Vec3::new(-7.0, -5.0, 15.0);
|
||||||
next.weapon.ori = Quaternion::rotation_y(2.5);
|
next.weapon.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
|
||||||
next.weapon.scale = Vec3::one();
|
next.weapon.scale = Vec3::one();
|
||||||
|
|
||||||
next.l_shoulder.offset = Vec3::new(-10.0, -3.2, 2.5);
|
next.l_shoulder.offset = Vec3::new(-10.0, -3.2, 2.5);
|
||||||
|
@ -65,7 +65,7 @@ impl Animation for JumpAnimation {
|
|||||||
next.r_foot.scale = Vec3::one();
|
next.r_foot.scale = Vec3::one();
|
||||||
|
|
||||||
next.weapon.offset = Vec3::new(-7.0, -5.0, 15.0);
|
next.weapon.offset = Vec3::new(-7.0, -5.0, 15.0);
|
||||||
next.weapon.ori = Quaternion::rotation_y(2.5);
|
next.weapon.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
|
||||||
next.weapon.scale = Vec3::one();
|
next.weapon.scale = Vec3::one();
|
||||||
|
|
||||||
next.l_shoulder.offset = Vec3::new(-10.0, -3.2, 2.5);
|
next.l_shoulder.offset = Vec3::new(-10.0, -3.2, 2.5);
|
||||||
|
@ -70,7 +70,7 @@ impl Animation for RunAnimation {
|
|||||||
next.r_foot.scale = Vec3::one();
|
next.r_foot.scale = Vec3::one();
|
||||||
|
|
||||||
next.weapon.offset = Vec3::new(-7.0, -5.0, 15.0);
|
next.weapon.offset = Vec3::new(-7.0, -5.0, 15.0);
|
||||||
next.weapon.ori = Quaternion::rotation_y(2.5);
|
next.weapon.ori = Quaternion::rotation_y(2.5) * Quaternion::rotation_z(1.57);
|
||||||
next.weapon.scale = Vec3::one();
|
next.weapon.scale = Vec3::one();
|
||||||
|
|
||||||
next.l_shoulder.offset = Vec3::new(-10.0, -3.2, 2.5);
|
next.l_shoulder.offset = Vec3::new(-10.0, -3.2, 2.5);
|
||||||
|
@ -244,7 +244,7 @@ impl FigureModelCache {
|
|||||||
// TODO actually match against other weapons and set the right model
|
// TODO actually match against other weapons and set the right model
|
||||||
_ => "weapon/sword/sword_rusty_2h.vox",
|
_ => "weapon/sword/sword_rusty_2h.vox",
|
||||||
},
|
},
|
||||||
Vec3::new(-6.5, -1.5, -4.0),
|
Vec3::new(-1.5, -6.5, -4.0),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -281,7 +281,7 @@ impl FigureModelCache {
|
|||||||
Weapon::Sword => "weapon/sword/sword_rusty_2h.vox",
|
Weapon::Sword => "weapon/sword/sword_rusty_2h.vox",
|
||||||
_ => "weapon/sword/sword_rusty_2h.vox",
|
_ => "weapon/sword/sword_rusty_2h.vox",
|
||||||
},
|
},
|
||||||
Vec3::new(-6.5, -1.5, -5.0),
|
Vec3::new(-1.5, -6.5, -4.5),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
fn load_right_equip(hand: Hand) -> Mesh<FigurePipeline> {
|
fn load_right_equip(hand: Hand) -> Mesh<FigurePipeline> {
|
||||||
@ -289,7 +289,7 @@ impl FigureModelCache {
|
|||||||
match hand {
|
match hand {
|
||||||
Hand::Default => "figure/body/hand.vox",
|
Hand::Default => "figure/body/hand.vox",
|
||||||
},
|
},
|
||||||
Vec3::new(-2.0, -2.5, -2.0),
|
Vec3::new(-2.0, -2.5, -5.0),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
/////////
|
/////////
|
||||||
|
Loading…
Reference in New Issue
Block a user