mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
dash, spin, jump changes
This commit is contained in:
parent
1b9815dc34
commit
30af3a4493
13
assets/common/items/debug/lantern.ron
Normal file
13
assets/common/items/debug/lantern.ron
Normal file
@ -0,0 +1,13 @@
|
||||
ItemDef(
|
||||
name: "Magic Lantern",
|
||||
description: "Illuminates even the darkest dungeon\nA great monster was slain for this item",
|
||||
kind: Lantern(
|
||||
(
|
||||
kind: "Blue0",
|
||||
color: (r: 128, g: 26, b: 255),
|
||||
strength_thousandths: 8500,
|
||||
flicker_thousandths: 300,
|
||||
),
|
||||
),
|
||||
quality: High,
|
||||
)
|
@ -34,7 +34,7 @@ impl Animation for DashAnimation {
|
||||
let (movement1, movement2, movement3, movement4) = match stage_section {
|
||||
Some(StageSection::Buildup) => ((anim_time as f32).powf(0.25), 0.0, 0.0, 0.0),
|
||||
Some(StageSection::Charge) => (1.0, anim_time as f32, 0.0, 0.0),
|
||||
Some(StageSection::Swing) => (1.0, 1.0, anim_time as f32, 0.0),
|
||||
Some(StageSection::Swing) => (1.0, 1.0, (anim_time as f32).powf(0.01), 0.0),
|
||||
Some(StageSection::Recover) => (1.1, 1.0, 1.0, (anim_time as f32).powi(4)),
|
||||
_ => (0.0, 0.0, 0.0, 0.0),
|
||||
};
|
||||
@ -46,21 +46,6 @@ impl Animation for DashAnimation {
|
||||
fn short(x: f32) -> f32 {
|
||||
(((5.0) / (1.5 + 3.5 * ((x * 5.0).sin()).powi(2))).sqrt()) * ((x * 5.0).sin())
|
||||
}
|
||||
fn foothoril(x: f32) -> f32 { (x * 5.0 + PI * 1.45).sin() }
|
||||
fn foothorir(x: f32) -> f32 { (x * 5.0 + PI * (0.45)).sin() }
|
||||
|
||||
fn footvertl(x: f32) -> f32 { (x * 5.0).sin() }
|
||||
fn footvertr(x: f32) -> f32 { (x * 5.0 + PI).sin() }
|
||||
|
||||
fn footrotl(x: f32) -> f32 {
|
||||
(((1.0) / (0.05 + (0.95) * ((x * 5.0 + PI * 1.4).sin()).powi(2))).sqrt())
|
||||
* ((x * 5.0 + PI * 1.4).sin())
|
||||
}
|
||||
|
||||
fn footrotr(x: f32) -> f32 {
|
||||
(((1.0) / (0.05 + (0.95) * ((x * 5.0 + PI * 0.4).sin()).powi(2))).sqrt())
|
||||
* ((x * 5.0 + PI * 0.4).sin())
|
||||
}
|
||||
|
||||
fn shortalt(x: f32) -> f32 { (x * 5.0 + PI / 2.0).sin() }
|
||||
|
||||
@ -115,22 +100,6 @@ impl Animation for DashAnimation {
|
||||
|
||||
next.belt.orientation =
|
||||
Quaternion::rotation_z((short(movement2).min(1.0) * 0.1) * (1.0 - movement4));
|
||||
|
||||
next.foot_l.position = Vec3::new(
|
||||
-s_a.foot.0,
|
||||
s_a.foot.1 + movement1 * -12.0 + foothoril(movement2) * -7.5,
|
||||
s_a.foot.2 + ((footvertl(movement2) * -4.0).max(-1.0)),
|
||||
);
|
||||
next.foot_l.orientation =
|
||||
Quaternion::rotation_x(movement1 * -1.0 + footrotl(movement2) * -0.6);
|
||||
|
||||
next.foot_r.position = Vec3::new(
|
||||
s_a.foot.0,
|
||||
s_a.foot.1 + foothorir(movement2) * -7.5,
|
||||
s_a.foot.2 + ((footvertr(movement2) * -4.0).max(-1.0)),
|
||||
);
|
||||
next.foot_r.orientation = Quaternion::rotation_x(-0.6 + footrotr(movement2) * -0.6)
|
||||
* Quaternion::rotation_z(-0.2);
|
||||
},
|
||||
_ => {},
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ impl Animation for JumpAnimation {
|
||||
(Option<Hands>, Option<Hands>),
|
||||
Vec3<f32>,
|
||||
Vec3<f32>,
|
||||
Vec3<f32>,
|
||||
f64,
|
||||
);
|
||||
type Skeleton = CharacterSkeleton;
|
||||
@ -25,7 +26,7 @@ impl Animation for JumpAnimation {
|
||||
|
||||
fn update_skeleton_inner(
|
||||
skeleton: &Self::Skeleton,
|
||||
(active_tool_kind, second_tool_kind, hands, orientation, last_ori, global_time): Self::Dependency,
|
||||
(active_tool_kind, second_tool_kind, hands, velocity, orientation, last_ori, global_time): Self::Dependency,
|
||||
anim_time: f64,
|
||||
_rate: &mut f32,
|
||||
s_a: &SkeletonAttr,
|
||||
@ -43,6 +44,9 @@ impl Animation for JumpAnimation {
|
||||
|
||||
let switch = if random > 0.5 { 1.0 } else { -1.0 };
|
||||
|
||||
let speed = Vec2::<f32>::from(velocity).magnitude();
|
||||
let speednorm = speed / 10.0;
|
||||
|
||||
let ori: Vec2<f32> = Vec2::from(orientation);
|
||||
let last_ori = Vec2::from(last_ori);
|
||||
let tilt = if ::vek::Vec2::new(ori, last_ori)
|
||||
@ -66,16 +70,27 @@ impl Animation for JumpAnimation {
|
||||
Quaternion::rotation_x(0.25 + slow * 0.04) * Quaternion::rotation_z(tilt * -2.5);
|
||||
|
||||
next.chest.position = Vec3::new(0.0, s_a.chest.0, s_a.chest.1 + 1.0);
|
||||
next.chest.orientation = Quaternion::rotation_z(tilt * -2.0);
|
||||
next.chest.orientation =
|
||||
Quaternion::rotation_x(speednorm * -0.3) * Quaternion::rotation_z(tilt * -2.0);
|
||||
|
||||
next.belt.position = Vec3::new(0.0, s_a.belt.0, s_a.belt.1);
|
||||
next.belt.orientation = Quaternion::rotation_z(tilt * 2.0);
|
||||
next.belt.position = Vec3::new(
|
||||
0.0,
|
||||
s_a.belt.0 + speednorm * 1.2,
|
||||
s_a.belt.1 + speednorm * 1.0,
|
||||
);
|
||||
next.belt.orientation =
|
||||
Quaternion::rotation_x(speednorm * 0.3) * Quaternion::rotation_z(tilt * 2.0);
|
||||
|
||||
next.back.position = Vec3::new(0.0, s_a.back.0, s_a.back.1);
|
||||
next.back.orientation = Quaternion::rotation_z(0.0);
|
||||
|
||||
next.shorts.position = Vec3::new(0.0, s_a.shorts.0, s_a.shorts.1);
|
||||
next.shorts.orientation = Quaternion::rotation_z(tilt * 3.0);
|
||||
next.shorts.position = Vec3::new(
|
||||
0.0,
|
||||
s_a.shorts.0 + speednorm * 3.0,
|
||||
s_a.shorts.1 + speednorm * 2.0,
|
||||
);
|
||||
next.shorts.orientation =
|
||||
Quaternion::rotation_x(speednorm * 0.5) * Quaternion::rotation_z(tilt * 3.0);
|
||||
|
||||
if random > 0.5 {
|
||||
next.hand_l.position = Vec3::new(
|
||||
@ -106,17 +121,17 @@ impl Animation for JumpAnimation {
|
||||
|
||||
next.foot_l.position = Vec3::new(
|
||||
-s_a.foot.0,
|
||||
s_a.foot.1 - 6.0 * switch,
|
||||
1.0 + s_a.foot.2 + slow * 1.5,
|
||||
s_a.foot.1 - 5.0 * switch,
|
||||
2.0 + s_a.foot.2 + slow * 1.5,
|
||||
);
|
||||
next.foot_l.orientation = Quaternion::rotation_x(-1.2 * switch + slow * -0.2 * switch);
|
||||
next.foot_l.orientation = Quaternion::rotation_x(-0.8 * switch + slow * -0.2 * switch);
|
||||
|
||||
next.foot_r.position = Vec3::new(
|
||||
s_a.foot.0,
|
||||
s_a.foot.1 + 6.0 * switch,
|
||||
1.0 + s_a.foot.2 + slow * 1.5,
|
||||
s_a.foot.1 + 5.0 * switch,
|
||||
2.0 + s_a.foot.2 + slow * 1.5,
|
||||
);
|
||||
next.foot_r.orientation = Quaternion::rotation_x(1.2 * switch + slow * 0.2 * switch);
|
||||
next.foot_r.orientation = Quaternion::rotation_x(0.8 * switch + slow * 0.2 * switch);
|
||||
|
||||
next.shoulder_l.position = Vec3::new(-s_a.shoulder.0, s_a.shoulder.1, s_a.shoulder.2);
|
||||
next.shoulder_l.orientation = Quaternion::rotation_x(0.4 * switch);
|
||||
@ -178,7 +193,7 @@ impl Animation for JumpAnimation {
|
||||
next.hold.scale = Vec3::one() * 0.0;
|
||||
|
||||
next.torso.position = Vec3::new(0.0, 0.0, 0.0) * s_a.scaler;
|
||||
next.torso.orientation = Quaternion::rotation_x(-0.2);
|
||||
next.torso.orientation = Quaternion::rotation_x(0.0);
|
||||
next.torso.scale = Vec3::one() / 11.0 * s_a.scaler;
|
||||
|
||||
next.second.scale = match hands {
|
||||
|
@ -50,7 +50,7 @@ impl Animation for RunAnimation {
|
||||
let speed = Vec2::<f32>::from(velocity).magnitude();
|
||||
*rate = 1.0;
|
||||
let impact = (avg_vel.z).max(-8.0);
|
||||
let speednorm = speed / 9.4;
|
||||
let speednorm = (speed / 9.4).min(1.5);
|
||||
|
||||
let lab = 1.0;
|
||||
|
||||
|
@ -57,13 +57,13 @@ impl Animation for SpinAnimation {
|
||||
|
||||
next.control.position = Vec3::new(
|
||||
s_a.sc.0 + movement1 * 2.0 + movement2 * -12.0 + movement3 * -7.0,
|
||||
s_a.sc.1 + 8.0 + movement1 * 0.6 + movement2 * -9.0 + movement3 * -10.0,
|
||||
s_a.sc.1 + 8.0 + movement1 * 0.6 + movement2 * -15.0 + movement3 * -10.0,
|
||||
s_a.sc.2 + 1.0 + movement1 * 0.6 + movement2 * 1.5 + movement3 * -4.0,
|
||||
);
|
||||
next.control.orientation =
|
||||
Quaternion::rotation_x(-0.5 + s_a.sc.3 + movement1 * -1.2)
|
||||
* Quaternion::rotation_y(
|
||||
s_a.sc.4 - 0.6 + movement1 * 0.0 + movement2 * -1.3,
|
||||
s_a.sc.4 - 0.6 + movement1 * 0.0 + movement2 * -1.7,
|
||||
)
|
||||
* Quaternion::rotation_z(s_a.sc.5 + 0.1 + movement1 * -1.57);
|
||||
next.head.position = Vec3::new(
|
||||
@ -73,9 +73,11 @@ impl Animation for SpinAnimation {
|
||||
);
|
||||
|
||||
next.chest.orientation = Quaternion::rotation_x(movement2 * 0.15)
|
||||
* Quaternion::rotation_y(movement1 * -0.1 + movement2 * 0.3 + movement3 * -0.1)
|
||||
* Quaternion::rotation_y(
|
||||
movement1 * -0.1 + movement2 * 0.15 + movement3 * -0.1,
|
||||
)
|
||||
* Quaternion::rotation_z(
|
||||
-1.0 + movement1 * -0.6 + movement2 * 1.5 + movement3 * 0.5,
|
||||
-1.0 + movement1 * -0.6 + movement2 * 1.0 + movement3 * 0.5,
|
||||
);
|
||||
|
||||
next.belt.orientation = Quaternion::rotation_x(movement1 * 0.1)
|
||||
|
@ -807,6 +807,7 @@ impl FigureMgr {
|
||||
active_tool_kind,
|
||||
second_tool_kind,
|
||||
hands,
|
||||
vel.0,
|
||||
// TODO: Update to use the quaternion.
|
||||
ori * anim::vek::Vec3::<f32>::unit_y(),
|
||||
state.last_ori * anim::vek::Vec3::<f32>::unit_y(),
|
||||
|
Loading…
Reference in New Issue
Block a user