mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Better backward strafing
This commit is contained in:
parent
adf77c48df
commit
f29e7846f2
@ -70,9 +70,19 @@ impl Animation for RunAnimation {
|
||||
let shorte = ((1.0 / (0.8 + 0.2 * ((acc_vel * lab * 1.6).sin()).powi(2))).sqrt())
|
||||
* ((acc_vel * lab * 1.6).sin());
|
||||
|
||||
let back_speed = 2.6;
|
||||
|
||||
let dirside = orientation.xy().dot(velocity.xy()).signum();
|
||||
let foothoril = (acc_vel * 1.6 * lab + PI * 1.45).sin() * dirside;
|
||||
let foothorir = (acc_vel * 1.6 * lab + PI * (0.45)).sin() * dirside;
|
||||
let foothoril = if dirside > 0.0 {
|
||||
(acc_vel * 1.6 * lab + PI * 1.45).sin() * dirside
|
||||
} else {
|
||||
(acc_vel * back_speed * lab + PI * 1.45).sin() * dirside
|
||||
};
|
||||
let foothorir = if dirside > 0.0 {
|
||||
(acc_vel * 1.6 * lab + PI * (0.45)).sin() * dirside
|
||||
} else {
|
||||
(acc_vel * back_speed * lab + PI * (0.45)).sin() * dirside
|
||||
};
|
||||
let strafeside = orientation
|
||||
.xy()
|
||||
.dot(velocity.xy().rotated_z(PI * -0.5))
|
||||
@ -80,8 +90,16 @@ impl Animation for RunAnimation {
|
||||
let footstrafel = (acc_vel * 1.6 * lab + PI * 1.5).sin() * strafeside;
|
||||
let footstrafer = (acc_vel * 1.6 * lab + PI).sin() * -strafeside;
|
||||
|
||||
let footvertl = (acc_vel * 1.6 * lab).sin();
|
||||
let footvertr = (acc_vel * 1.6 * lab + PI).sin();
|
||||
let footvertl = if dirside > 0.0 {
|
||||
(acc_vel * 1.6 * lab).sin()
|
||||
} else {
|
||||
(acc_vel * back_speed * lab).sin()
|
||||
};
|
||||
let footvertr = if dirside > 0.0 {
|
||||
(acc_vel * 1.6 * lab + PI).sin()
|
||||
} else {
|
||||
(acc_vel * back_speed * lab + PI).sin()
|
||||
};
|
||||
let footvertsl = (acc_vel * 1.6 * lab).sin();
|
||||
let footvertsr = (acc_vel * 1.6 * lab + PI * 0.5).sin();
|
||||
|
||||
|
@ -167,21 +167,21 @@ impl Animation for RunAnimation {
|
||||
|
||||
next.leg_bl.position = Vec3::new(
|
||||
-s_a.leg_b.0,
|
||||
s_a.leg_b.1 + amplitude3 * foot3b * -1.1,
|
||||
s_a.leg_b.2 + amplitude3 * foot3a * 1.1,
|
||||
s_a.leg_b.1 + amplitude3 * foot3a * -4.5,
|
||||
s_a.leg_b.2 + amplitude3 * foot3b * -2.2,
|
||||
);
|
||||
next.leg_bl.orientation =
|
||||
Quaternion::rotation_x(canceler * -0.2 + amplitude3 * foot3b * -0.55)
|
||||
Quaternion::rotation_x(canceler * -0.1 + amplitude3 * foot3a * -1.2)
|
||||
* Quaternion::rotation_y(tilt * 1.5)
|
||||
* Quaternion::rotation_z(tilt * -1.5);
|
||||
|
||||
next.leg_br.position = Vec3::new(
|
||||
s_a.leg_b.0,
|
||||
s_a.leg_b.1 + amplitude3 * foot4b * -1.1,
|
||||
s_a.leg_b.2 + amplitude3 * foot4a * 1.1,
|
||||
s_a.leg_b.1 + amplitude3 * foot4a * -4.5,
|
||||
s_a.leg_b.2 + amplitude3 * foot4b * -2.2,
|
||||
);
|
||||
next.leg_br.orientation =
|
||||
Quaternion::rotation_x(canceler * -0.2 + amplitude3 * foot4b * -0.55)
|
||||
Quaternion::rotation_x(canceler * -0.1 + amplitude3 * foot4a * -1.2)
|
||||
* Quaternion::rotation_y(tilt * 1.5)
|
||||
* Quaternion::rotation_z(tilt * -1.5);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user