From 198da2c8500eb6113e4a0b9ab4c376f50b0c4eeb Mon Sep 17 00:00:00 2001 From: hut Date: Fri, 29 Mar 2024 16:14:57 +0100 Subject: [PATCH 01/28] Let's try out bevy_xpbd_3d. Added it as dependency. --- Cargo.lock | 280 ++++++++++++++++++++++++++++++++++++++++++++++++++++ Cargo.toml | 1 + src/main.rs | 1 + 3 files changed, 282 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index 48436ee..10bc1ca 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1059,6 +1059,34 @@ dependencies = [ "winit", ] +[[package]] +name = "bevy_xpbd_3d" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0425ea7361b9b27c2a382e0663deb42f41147eee60fb2b3d5fa7e42d363ea848" +dependencies = [ + "bevy", + "bevy_math", + "bevy_xpbd_derive", + "derive_more", + "fxhash", + "indexmap", + "itertools", + "nalgebra", + "parry3d", + "parry3d-f64", +] + +[[package]] +name = "bevy_xpbd_derive" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e1ef1d5e328abe1b76df974245f78e17fd17867583883d5e77444c6a8223a64" +dependencies = [ + "quote", + "syn 2.0.52", +] + [[package]] name = "bindgen" version = "0.69.4" @@ -1397,6 +1425,12 @@ dependencies = [ "const_soft_float", ] +[[package]] +name = "convert_case" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" + [[package]] name = "core-foundation" version = "0.9.4" @@ -1498,6 +1532,25 @@ dependencies = [ "crossbeam-utils", ] +[[package]] +name = "crossbeam-deque" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + [[package]] name = "crossbeam-utils" version = "0.8.19" @@ -1539,8 +1592,10 @@ version = "0.99.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" dependencies = [ + "convert_case", "proc-macro2", "quote", + "rustc_version", "syn 1.0.109", ] @@ -1774,6 +1829,15 @@ dependencies = [ "pin-project-lite", ] +[[package]] +name = "fxhash" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" +dependencies = [ + "byteorder", +] + [[package]] name = "gethostname" version = "0.4.3" @@ -2243,6 +2307,12 @@ dependencies = [ "windows-targets 0.52.4", ] +[[package]] +name = "libm" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" + [[package]] name = "libredox" version = "0.0.2" @@ -2313,6 +2383,16 @@ dependencies = [ "regex-automata 0.1.10", ] +[[package]] +name = "matrixmultiply" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7574c1cf36da4798ab73da5b215bbf444f50718207754cb522201d78d1cd0ff2" +dependencies = [ + "autocfg", + "rawpointer", +] + [[package]] name = "memchr" version = "2.7.1" @@ -2411,6 +2491,34 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "nalgebra" +version = "0.32.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ea4908d4f23254adda3daa60ffef0f1ac7b8c3e9a864cf3cc154b251908a2ef" +dependencies = [ + "approx", + "glam", + "matrixmultiply", + "nalgebra-macros", + "num-complex", + "num-rational", + "num-traits", + "simba", + "typenum", +] + +[[package]] +name = "nalgebra-macros" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91761aed67d03ad966ef783ae962ef9bbaca728d2dd7ceb7939ec110fffad998" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "ndk" version = "0.8.0" @@ -2488,6 +2596,15 @@ dependencies = [ "winapi", ] +[[package]] +name = "num-complex" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23c6602fda94a57c990fe0df199a035d83576b496aa29f4e634a8ac6004e68a6" +dependencies = [ + "num-traits", +] + [[package]] name = "num-derive" version = "0.3.3" @@ -2510,6 +2627,26 @@ dependencies = [ "syn 2.0.52", ] +[[package]] +name = "num-integer" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-rational" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + [[package]] name = "num-traits" version = "0.2.18" @@ -2517,6 +2654,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" dependencies = [ "autocfg", + "libm", ] [[package]] @@ -2680,6 +2818,7 @@ version = "0.3.0" dependencies = [ "bevy", "bevy_embedded_assets", + "bevy_xpbd_3d", "regex", ] @@ -2727,6 +2866,50 @@ dependencies = [ "windows-targets 0.48.5", ] +[[package]] +name = "parry3d" +version = "0.13.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ccba18a65dba56c08dadfa936e0c9efbc883b3a26dc77d2685f78be10f7667c" +dependencies = [ + "approx", + "arrayvec", + "bitflags 1.3.2", + "downcast-rs", + "either", + "nalgebra", + "num-derive 0.4.2", + "num-traits", + "rayon", + "rustc-hash", + "simba", + "slab", + "smallvec", + "spade", +] + +[[package]] +name = "parry3d-f64" +version = "0.13.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d259245abcc09379798e4d373d9019e0df4dc6f7f128ecd68700a5927dc32034" +dependencies = [ + "approx", + "arrayvec", + "bitflags 1.3.2", + "downcast-rs", + "either", + "nalgebra", + "num-derive 0.4.2", + "num-traits", + "rayon", + "rustc-hash", + "simba", + "slab", + "smallvec", + "spade", +] + [[package]] name = "paste" version = "1.0.14" @@ -2865,6 +3048,32 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42a9830a0e1b9fb145ebb365b8bc4ccd75f290f98c0247deafbbe2c75cefb544" +[[package]] +name = "rawpointer" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3" + +[[package]] +name = "rayon" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + [[package]] name = "rectangle-pack" version = "0.4.2" @@ -2939,6 +3148,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "19b30a45b0cd0bcca8037f3d0dc3421eaf95327a17cad11964fb8179b4fc4832" +[[package]] +name = "robust" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cbf4a6aa5f6d6888f39e980649f3ad6b666acdce1d78e95b8a2cb076e687ae30" + [[package]] name = "rodio" version = "0.17.3" @@ -2968,6 +3183,15 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" +[[package]] +name = "rustc_version" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +dependencies = [ + "semver", +] + [[package]] name = "rustix" version = "0.38.31" @@ -2998,6 +3222,15 @@ version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" +[[package]] +name = "safe_arch" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f398075ce1e6a179b46f51bd88d0598b92b00d3551f1a2d4ac49e771b56ac354" +dependencies = [ + "bytemuck", +] + [[package]] name = "same-file" version = "1.0.6" @@ -3013,6 +3246,12 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "semver" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92d43fe69e652f3df9bdc2b85b2854a0825b86e4fb76bc44d945137d053639ca" + [[package]] name = "serde" version = "1.0.197" @@ -3059,6 +3298,19 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" +[[package]] +name = "simba" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "061507c94fc6ab4ba1c9a0305018408e312e17c041eb63bef8aa726fa33aceae" +dependencies = [ + "approx", + "num-complex", + "num-traits", + "paste", + "wide", +] + [[package]] name = "simd-adler32" version = "0.3.7" @@ -3112,6 +3364,18 @@ dependencies = [ "serde", ] +[[package]] +name = "spade" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61addf9117b11d1f5b4bf6fe94242ba25f59d2d4b2080544b771bd647024fd00" +dependencies = [ + "hashbrown", + "num-traits", + "robust", + "smallvec", +] + [[package]] name = "spirv" version = "0.3.0+sdk-1.3.268.0" @@ -3351,6 +3615,12 @@ dependencies = [ "static_assertions", ] +[[package]] +name = "typenum" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" + [[package]] name = "unicode-ident" version = "1.0.12" @@ -3612,6 +3882,16 @@ dependencies = [ "web-sys", ] +[[package]] +name = "wide" +version = "0.7.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89beec544f246e679fc25490e3f8e08003bc4bf612068f325120dad4cea02c1c" +dependencies = [ + "bytemuck", + "safe_arch", +] + [[package]] name = "widestring" version = "1.0.2" diff --git a/Cargo.toml b/Cargo.toml index 1b63932..26eb291 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,6 +12,7 @@ rust-version = "1.76.0" [dependencies] regex = "1" bevy_embedded_assets = "0.10.2" +bevy_xpbd_3d = "0.4" [dependencies."bevy"] version = "0.13.0" diff --git a/src/main.rs b/src/main.rs index 0a3b8b8..b59b972 100644 --- a/src/main.rs +++ b/src/main.rs @@ -32,6 +32,7 @@ fn main() { OutFlyPlugin, )).run(); } else { + // In release builds, embed assets into the binary App::new().add_plugins(( EmbeddedAssetPlugin { mode: PluginMode::ReplaceDefault }, OutFlyPlugin, From 25db91f39e2ea67be6abde461bc8befc650f7389 Mon Sep 17 00:00:00 2001 From: hut Date: Fri, 29 Mar 2024 16:33:12 +0100 Subject: [PATCH 02/28] implement controls and basic collisions --- src/actor.rs | 14 -------------- src/camera.rs | 21 +++++++++++++-------- src/main.rs | 4 +--- src/world.rs | 15 +++++++++++++++ 4 files changed, 29 insertions(+), 25 deletions(-) diff --git a/src/actor.rs b/src/actor.rs index 80e8823..067d7dd 100644 --- a/src/actor.rs +++ b/src/actor.rs @@ -11,7 +11,6 @@ impl Plugin for ActorPlugin { app.register_type::(); app.add_systems(FixedUpdate, ( update_physics_lifeforms, - update_physics_actors, )); app.add_systems(Update, ( handle_new_conversations, @@ -187,19 +186,6 @@ const SUIT_SIMPLE: Suit = Suit { integrity: 1e5, }; -pub fn update_physics_actors( - time: Res