mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
hammer keyframes
This commit is contained in:
parent
8fa7e246e9
commit
7aa3de35c9
@ -47,16 +47,11 @@ impl Animation for AlphaAnimation {
|
||||
* ((anim_time as f32 * lab as f32 * 2.0 * velocity).sin()).powf(2.0 as f32)))
|
||||
.sqrt())
|
||||
* ((anim_time as f32 * lab as f32 * 2.0 * velocity).sin());
|
||||
let slowersmooth = (anim_time as f32 * lab as f32 * 4.0).sin();
|
||||
let push = anim_time as f32 * lab as f32 * 4.0;
|
||||
let slow = (((5.0)
|
||||
/ (0.4 + 4.6 * ((anim_time as f32 * lab as f32 * 9.0).sin()).powf(2.0 as f32)))
|
||||
.sqrt())
|
||||
* ((anim_time as f32 * lab as f32 * 9.0).sin());
|
||||
let axe = (((1.0)
|
||||
/ (0.05 + 0.95 * ((anim_time as f32 * lab as f32 * 8.0).sin()).powf(2.0 as f32)))
|
||||
.sqrt())
|
||||
* ((anim_time as f32 * lab as f32 * 8.0).sin());
|
||||
let slower = (((1.0)
|
||||
/ (0.0001 + 0.999 * ((anim_time as f32 * lab as f32 * 4.0).sin()).powf(2.0 as f32)))
|
||||
.sqrt())
|
||||
@ -165,19 +160,32 @@ impl Animation for AlphaAnimation {
|
||||
next.hand_r.orientation =
|
||||
Quaternion::rotation_x(s_a.hhr.3) * Quaternion::rotation_y(s_a.hhr.4);
|
||||
|
||||
next.control.position = Vec3::new(s_a.hc.0 + movement1 * -13.0, s_a.hc.1, s_a.hc.2);
|
||||
next.control.position = Vec3::new(
|
||||
s_a.hc.0 + (movement1 * -13.0) * (1.0 - movement3),
|
||||
s_a.hc.1 + (movement2 * 5.0) * (1.0 - movement3),
|
||||
s_a.hc.2,
|
||||
);
|
||||
next.control.orientation =
|
||||
Quaternion::rotation_x(s_a.hc.3 + movement1 * 1.5 + movement2 * -2.8)
|
||||
* Quaternion::rotation_y(s_a.hc.4 + movement1 * 1.57)
|
||||
* Quaternion::rotation_z(s_a.hc.5 + movement1 * -0.5);
|
||||
Quaternion::rotation_x(s_a.hc.3 + (movement1 * 1.5 + movement2 * -2.5))
|
||||
* (1.0 - movement3)
|
||||
* Quaternion::rotation_y(s_a.hc.4 + (movement1 * 1.57))
|
||||
* (1.0 - movement3)
|
||||
* Quaternion::rotation_z(s_a.hc.5 + (movement2 * -0.5) * (1.0 - movement3));
|
||||
next.head.position = Vec3::new(0.0, s_a.head.0, s_a.head.1);
|
||||
next.head.orientation = Quaternion::rotation_x(0.0)
|
||||
* Quaternion::rotation_y(0.0)
|
||||
* Quaternion::rotation_z(0.0);
|
||||
next.head.orientation = Quaternion::rotation_x(
|
||||
(movement1 * 0.3 + movement2 * -0.5) * (1.0 - movement3),
|
||||
) * Quaternion::rotation_y(0.0)
|
||||
* Quaternion::rotation_z(
|
||||
(movement1 * 0.2 + movement2 * -0.5) * (1.0 - movement3),
|
||||
);
|
||||
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1);
|
||||
next.chest.orientation = Quaternion::rotation_x(movement1 * 0.8 + movement2 * -1.0)
|
||||
* Quaternion::rotation_y(0.0)
|
||||
* Quaternion::rotation_z(0.0);
|
||||
next.chest.orientation = Quaternion::rotation_x(
|
||||
(movement1 * 0.8 + movement2 * -1.2) * (1.0 - movement3),
|
||||
) * Quaternion::rotation_y(
|
||||
(movement1 * 0.3 + movement2 * -0.4) * (1.0 - movement3),
|
||||
) * Quaternion::rotation_z(
|
||||
(movement1 * 0.5 + movement2 * -0.5) * (1.0 - movement3),
|
||||
);
|
||||
|
||||
if velocity > 0.5 {
|
||||
next.foot_l.position = Vec3::new(-s_a.foot.0, foot * -6.0, s_a.foot.2);
|
||||
@ -197,6 +205,11 @@ impl Animation for AlphaAnimation {
|
||||
next.foot_r.position = Vec3::new(s_a.foot.0, 3.5 - slower * 2.0, s_a.foot.2);
|
||||
next.foot_r.orientation = Quaternion::rotation_x(slower * 0.1)
|
||||
* Quaternion::rotation_z((slower * 0.5).max(0.0));
|
||||
|
||||
next.belt.orientation =
|
||||
Quaternion::rotation_x(movement1 * -0.2 + movement2 * 0.2);
|
||||
next.shorts.orientation =
|
||||
Quaternion::rotation_x(movement1 * -0.3 + movement2 * 0.3);
|
||||
}
|
||||
},
|
||||
Some(ToolKind::Debug) => {
|
||||
|
@ -7,16 +7,17 @@ use std::f32::consts::PI;
|
||||
|
||||
pub struct ShootAnimation;
|
||||
|
||||
type ShootAnimationDependency = (
|
||||
Option<ToolKind>,
|
||||
Option<ToolKind>,
|
||||
f32,
|
||||
Vec3<f32>,
|
||||
Vec3<f32>,
|
||||
f64,
|
||||
Option<StageSection>,
|
||||
);
|
||||
impl Animation for ShootAnimation {
|
||||
type Dependency = (
|
||||
Option<ToolKind>,
|
||||
Option<ToolKind>,
|
||||
f32,
|
||||
Vec3<f32>,
|
||||
Vec3<f32>,
|
||||
f64,
|
||||
Option<StageSection>,
|
||||
);
|
||||
type Dependency = ShootAnimationDependency;
|
||||
type Skeleton = CharacterSkeleton;
|
||||
|
||||
#[cfg(feature = "use-dyn-lib")]
|
||||
@ -30,8 +31,8 @@ impl Animation for ShootAnimation {
|
||||
active_tool_kind,
|
||||
_second_tool_kind,
|
||||
velocity,
|
||||
orientation,
|
||||
last_ori,
|
||||
_orientation,
|
||||
_last_ori,
|
||||
_global_time,
|
||||
stage_section,
|
||||
): Self::Dependency,
|
||||
@ -45,16 +46,6 @@ impl Animation for ShootAnimation {
|
||||
let mut next = (*skeleton).clone();
|
||||
|
||||
let lab = 1.0;
|
||||
let foot = (((5.0)
|
||||
/ (0.2 + 4.8 * ((anim_time as f32 * lab as f32 * 8.0).sin()).powf(2.0 as f32)))
|
||||
.sqrt())
|
||||
* ((anim_time as f32 * lab as f32 * 8.0).sin());
|
||||
let foote = (((5.0)
|
||||
/ (0.5 + 4.5 * ((anim_time as f32 * lab as f32 * 8.0 + 1.57).sin()).powf(2.0 as f32)))
|
||||
.sqrt())
|
||||
* ((anim_time as f32 * lab as f32 * 8.0).sin());
|
||||
|
||||
let exp = ((anim_time as f32).powf(0.3 as f32)).min(1.2);
|
||||
|
||||
match active_tool_kind {
|
||||
Some(ToolKind::Staff) | Some(ToolKind::Sceptre) => {
|
||||
@ -112,7 +103,7 @@ impl Animation for ShootAnimation {
|
||||
};
|
||||
},
|
||||
Some(ToolKind::Bow) => {
|
||||
let (movement1, movement2, _movement3) = match stage_section {
|
||||
let (_movement1, movement2, _movement3) = match stage_section {
|
||||
Some(StageSection::Buildup) => ((anim_time as f32).powf(0.25), 0.0, 0.0),
|
||||
Some(StageSection::Swing) => (1.0, anim_time as f32, 0.0),
|
||||
Some(StageSection::Recover) => (1.0, 1.0, (anim_time as f32).powf(4.0)),
|
||||
@ -164,13 +155,10 @@ impl Animation for ShootAnimation {
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
if velocity > 0.5 {
|
||||
} else {
|
||||
}
|
||||
|
||||
next.back.orientation = Quaternion::rotation_x(-0.3);
|
||||
|
||||
next.lantern.orientation =
|
||||
Quaternion::rotation_x(exp * -0.7 + 0.4) * Quaternion::rotation_y(exp * 0.4);
|
||||
next.lantern.orientation = Quaternion::rotation_x(0.0) * Quaternion::rotation_y(0.0);
|
||||
|
||||
next
|
||||
}
|
||||
|
@ -156,7 +156,7 @@ impl Animation for SpinAnimation {
|
||||
* (1.0 - movement3),
|
||||
);
|
||||
next.torso.orientation = Quaternion::rotation_z(
|
||||
(movement1.powf(2.0) * -6.0 + movement2 * -1.7 + movement3 * 1.4),
|
||||
movement1.powf(2.0) * -6.0 + movement2 * -1.7 + movement3 * 1.4,
|
||||
);
|
||||
|
||||
next.foot_l.position = Vec3::new(
|
||||
|
Loading…
Reference in New Issue
Block a user