mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Implement unstoppable rolling
This commit is contained in:
parent
01410569a4
commit
a715a84ea7
14
Cargo.lock
generated
14
Cargo.lock
generated
@ -832,7 +832,7 @@ name = "euc"
|
|||||||
version = "0.3.0"
|
version = "0.3.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"vek 0.9.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"vek 0.9.8",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -3026,7 +3026,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "vek"
|
name = "vek"
|
||||||
version = "0.9.8"
|
version = "0.9.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"approx 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"approx 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)",
|
"num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@ -3055,7 +3054,7 @@ dependencies = [
|
|||||||
"num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"specs 0.14.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"specs 0.14.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"uvth 3.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"uvth 3.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"vek 0.9.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"vek 0.9.8",
|
||||||
"veloren-common 0.3.0",
|
"veloren-common 0.3.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -3084,7 +3083,7 @@ dependencies = [
|
|||||||
"specs 0.14.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"specs 0.14.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"specs-idvs 0.1.0 (git+https://gitlab.com/veloren/specs-idvs.git)",
|
"specs-idvs 0.1.0 (git+https://gitlab.com/veloren/specs-idvs.git)",
|
||||||
"sphynx 0.1.0 (git+https://gitlab.com/veloren/sphynx.git?rev=11cdc7422568aaabd376c87242a60f636e68b40d)",
|
"sphynx 0.1.0 (git+https://gitlab.com/veloren/sphynx.git?rev=11cdc7422568aaabd376c87242a60f636e68b40d)",
|
||||||
"vek 0.9.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"vek 0.9.8",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -3103,7 +3102,7 @@ dependencies = [
|
|||||||
"serde_derive 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde_derive 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"specs 0.14.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"specs 0.14.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"uvth 3.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"uvth 3.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"vek 0.9.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"vek 0.9.8",
|
||||||
"veloren-common 0.3.0",
|
"veloren-common 0.3.0",
|
||||||
"veloren-world 0.3.0",
|
"veloren-world 0.3.0",
|
||||||
]
|
]
|
||||||
@ -3155,7 +3154,7 @@ dependencies = [
|
|||||||
"serde_derive 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde_derive 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"simplelog 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"simplelog 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"specs 0.14.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"specs 0.14.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"vek 0.9.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"vek 0.9.8",
|
||||||
"veloren-client 0.3.0",
|
"veloren-client 0.3.0",
|
||||||
"veloren-common 0.3.0",
|
"veloren-common 0.3.0",
|
||||||
"veloren-server 0.3.0",
|
"veloren-server 0.3.0",
|
||||||
@ -3172,7 +3171,7 @@ dependencies = [
|
|||||||
"noise 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"noise 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rand 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rand 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rand_chacha 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rand_chacha 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"vek 0.9.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"vek 0.9.8",
|
||||||
"veloren-common 0.3.0",
|
"veloren-common 0.3.0",
|
||||||
"zerocopy 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"zerocopy 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
@ -3722,7 +3721,6 @@ dependencies = [
|
|||||||
"checksum utf8-ranges 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b4ae116fef2b7fea257ed6440d3cfcff7f190865f170cdad00bb6465bf18ecba"
|
"checksum utf8-ranges 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b4ae116fef2b7fea257ed6440d3cfcff7f190865f170cdad00bb6465bf18ecba"
|
||||||
"checksum uvth 3.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e59a167890d173eb0fcd7a1b99b84dc05c521ae8d76599130b8e19bef287abbf"
|
"checksum uvth 3.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e59a167890d173eb0fcd7a1b99b84dc05c521ae8d76599130b8e19bef287abbf"
|
||||||
"checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a"
|
"checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a"
|
||||||
"checksum vek 0.9.8 (registry+https://github.com/rust-lang/crates.io-index)" = "1c95e5c5c123ecdb4a1a27a590f053a6c6de4b6ea696f4f0ef99054ead450258"
|
|
||||||
"checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd"
|
"checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd"
|
||||||
"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
|
"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
|
||||||
"checksum walkdir 2.2.9 (registry+https://github.com/rust-lang/crates.io-index)" = "9658c94fa8b940eab2250bd5a457f9c48b748420d71293b165c8cdbe2f55f71e"
|
"checksum walkdir 2.2.9 (registry+https://github.com/rust-lang/crates.io-index)" = "9658c94fa8b940eab2250bd5a457f9c48b748420d71293b165c8cdbe2f55f71e"
|
||||||
|
@ -17,3 +17,6 @@ overflow-checks = false
|
|||||||
debug = true
|
debug = true
|
||||||
codegen-units = 1
|
codegen-units = 1
|
||||||
lto = true
|
lto = true
|
||||||
|
|
||||||
|
[patch.crates-io]
|
||||||
|
vek = { path = "../vek" }
|
||||||
|
@ -11,5 +11,5 @@ uvth = "3.1.1"
|
|||||||
num_cpus = "1.10.1"
|
num_cpus = "1.10.1"
|
||||||
log = "0.4.8"
|
log = "0.4.8"
|
||||||
specs = "0.14.2"
|
specs = "0.14.2"
|
||||||
vek = "0.9.8"
|
vek = { path = "../../vek", features=["serde"] }
|
||||||
hashbrown = { version = "0.5.0", features = ["serde", "nightly"] }
|
hashbrown = { version = "0.5.0", features = ["serde", "nightly"] }
|
||||||
|
@ -73,13 +73,10 @@ impl<'a> System<'a> for Sys {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Look
|
// Look
|
||||||
if controller
|
controller.look_dir = controller
|
||||||
.look_dir
|
.look_dir
|
||||||
.map(|n| !n.is_normal() || n.abs() < std::f32::EPSILON)
|
.try_normalized()
|
||||||
.reduce_or()
|
.unwrap_or(controller.move_dir.into());
|
||||||
{
|
|
||||||
controller.look_dir = controller.move_dir.into();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Glide
|
// Glide
|
||||||
if controller.glide
|
if controller.glide
|
||||||
|
@ -17,8 +17,7 @@ const WIELD_ACCEL: f32 = 70.0;
|
|||||||
const WIELD_SPEED: f32 = 120.0;
|
const WIELD_SPEED: f32 = 120.0;
|
||||||
const HUMANOID_AIR_ACCEL: f32 = 10.0;
|
const HUMANOID_AIR_ACCEL: f32 = 10.0;
|
||||||
const HUMANOID_AIR_SPEED: f32 = 100.0;
|
const HUMANOID_AIR_SPEED: f32 = 100.0;
|
||||||
const ROLL_ACCEL: f32 = 160.0;
|
const ROLL_SPEED: f32 = 13.0;
|
||||||
const ROLL_SPEED: f32 = 550.0;
|
|
||||||
const GLIDE_ACCEL: f32 = 15.0;
|
const GLIDE_ACCEL: f32 = 15.0;
|
||||||
const GLIDE_SPEED: f32 = 45.0;
|
const GLIDE_SPEED: f32 = 45.0;
|
||||||
// Gravity is 9.81 * 4, so this makes gravity equal to .15
|
// Gravity is 9.81 * 4, so this makes gravity equal to .15
|
||||||
@ -74,24 +73,32 @@ impl<'a> System<'a> for Sys {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Move player according to move_dir
|
if character.movement.is_roll() {
|
||||||
vel.0 += Vec2::broadcast(dt.0)
|
vel.0 = controller
|
||||||
* controller.move_dir
|
.move_dir
|
||||||
* match (physics.on_ground, &character.movement) {
|
.try_normalized()
|
||||||
(true, Run) if vel.0.magnitude_squared() < HUMANOID_SPEED.powf(2.0) => {
|
.map(Vec3::from)
|
||||||
HUMANOID_ACCEL
|
.unwrap_or(vel.0.normalized())
|
||||||
}
|
* ROLL_SPEED;
|
||||||
(false, Glide) if vel.0.magnitude_squared() < GLIDE_SPEED.powf(2.0) => {
|
} else {
|
||||||
GLIDE_ACCEL
|
// Move player according to move_dir
|
||||||
}
|
vel.0 += Vec2::broadcast(dt.0)
|
||||||
(false, Jump) if vel.0.magnitude_squared() < HUMANOID_AIR_SPEED.powf(2.0) => {
|
* controller.move_dir
|
||||||
HUMANOID_AIR_ACCEL
|
* match (physics.on_ground, &character.movement) {
|
||||||
}
|
(true, Run) if vel.0.magnitude_squared() < HUMANOID_SPEED.powf(2.0) => {
|
||||||
(true, Roll { .. }) if vel.0.magnitude_squared() < ROLL_SPEED.powf(2.0) => {
|
HUMANOID_ACCEL
|
||||||
ROLL_ACCEL
|
}
|
||||||
}
|
(false, Glide) if vel.0.magnitude_squared() < GLIDE_SPEED.powf(2.0) => {
|
||||||
_ => 0.0,
|
GLIDE_ACCEL
|
||||||
};
|
}
|
||||||
|
(false, Jump)
|
||||||
|
if vel.0.magnitude_squared() < HUMANOID_AIR_SPEED.powf(2.0) =>
|
||||||
|
{
|
||||||
|
HUMANOID_AIR_ACCEL
|
||||||
|
}
|
||||||
|
_ => 0.0,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
// Set direction based on move direction when on the ground
|
// Set direction based on move direction when on the ground
|
||||||
let ori_dir = if character.action.is_wield()
|
let ori_dir = if character.action.is_wield()
|
||||||
|
@ -30,7 +30,7 @@ euc = "0.3.0"
|
|||||||
specs = "0.14.2"
|
specs = "0.14.2"
|
||||||
|
|
||||||
# Mathematics
|
# Mathematics
|
||||||
vek = "0.9.8"
|
vek = { path = "../../vek", features=["serde"] }
|
||||||
|
|
||||||
# discord
|
# discord
|
||||||
discord-rpc-sdk = { git = "https://github.com/Songtronix/rust-discord-rpc.git", optional = true }
|
discord-rpc-sdk = { git = "https://github.com/Songtronix/rust-discord-rpc.git", optional = true }
|
||||||
|
Loading…
Reference in New Issue
Block a user