Merge branch 'rapier'

This commit is contained in:
Joe Ardent 2022-02-08 22:01:30 -08:00
commit 8dc2f91fcf
6 changed files with 224 additions and 295 deletions

255
Cargo.lock generated
View file

@ -134,9 +134,9 @@ checksum = "677d306121baf53310a3fd342d88dc0824f6bbeace68347593658525565abee8"
[[package]] [[package]]
name = "autocfg" name = "autocfg"
version = "1.0.1" version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]] [[package]]
name = "base-x" name = "base-x"
@ -449,15 +449,26 @@ dependencies = [
[[package]] [[package]]
name = "bevy_polyline" name = "bevy_polyline"
version = "0.1.3" version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c5c82e6ea20642e4d8aa120bcf0ae09d7cae067825d7f954228c246bb8c948b" checksum = "0973d599ae862049333b74cb5216de1be07cf7db675b6dcc0e055006ab41be26"
dependencies = [ dependencies = [
"bevy", "bevy",
"bitflags", "bitflags",
"naga", "naga",
] ]
[[package]]
name = "bevy_rapier3d"
version = "0.12.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5186c735d7aa202e982f93c71b444d34bf15fed44aca942f9b5f2940e3d06764"
dependencies = [
"bevy",
"nalgebra",
"rapier3d",
]
[[package]] [[package]]
name = "bevy_reflect" name = "bevy_reflect"
version = "0.6.0" version = "0.6.0"
@ -804,7 +815,7 @@ dependencies = [
"bitflags", "bitflags",
"block", "block",
"cocoa-foundation", "cocoa-foundation",
"core-foundation 0.9.2", "core-foundation 0.9.3",
"core-graphics 0.22.3", "core-graphics 0.22.3",
"foreign-types", "foreign-types",
"libc", "libc",
@ -819,7 +830,7 @@ checksum = "7ade49b65d560ca58c403a479bb396592b155c0185eada742ee323d1d68d6318"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"block", "block",
"core-foundation 0.9.2", "core-foundation 0.9.3",
"core-graphics-types", "core-graphics-types",
"foreign-types", "foreign-types",
"libc", "libc",
@ -889,9 +900,9 @@ dependencies = [
[[package]] [[package]]
name = "core-foundation" name = "core-foundation"
version = "0.9.2" version = "0.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6888e10551bb93e424d8df1d07f1a8b4fceb0001a3a4b048bfc47554946f47b3" checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146"
dependencies = [ dependencies = [
"core-foundation-sys 0.8.3", "core-foundation-sys 0.8.3",
"libc", "libc",
@ -934,7 +945,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2581bbab3b8ffc6fcbd550bf46c355135d16e9ff2a6ea032ad6b9bf1d7efe4fb" checksum = "2581bbab3b8ffc6fcbd550bf46c355135d16e9ff2a6ea032ad6b9bf1d7efe4fb"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"core-foundation 0.9.2", "core-foundation 0.9.3",
"core-graphics-types", "core-graphics-types",
"foreign-types", "foreign-types",
"libc", "libc",
@ -947,7 +958,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3a68b68b3446082644c91ac778bf50cd4104bfb002b5a6a7c44cca5a2c70788b" checksum = "3a68b68b3446082644c91ac778bf50cd4104bfb002b5a6a7c44cca5a2c70788b"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"core-foundation 0.9.2", "core-foundation 0.9.3",
"foreign-types", "foreign-types",
"libc", "libc",
] ]
@ -967,9 +978,9 @@ dependencies = [
[[package]] [[package]]
name = "crc32fast" name = "crc32fast"
version = "1.3.1" version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2209c310e29876f7f0b2721e7e26b84aff178aa3da5d091f9bfbf47669e60e3" checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if 1.0.0",
] ]
@ -1011,9 +1022,9 @@ dependencies = [
[[package]] [[package]]
name = "crossbeam-epoch" name = "crossbeam-epoch"
version = "0.9.6" version = "0.9.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "97242a70df9b89a65d0b6df3c4bf5b9ce03c5b7309019777fbde37e7537f8762" checksum = "c00d6d2ea26e8b151d99093005cb442fb9a37aeaca582a03ec70946f49ab5ed9"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if 1.0.0",
"crossbeam-utils", "crossbeam-utils",
@ -1024,9 +1035,9 @@ dependencies = [
[[package]] [[package]]
name = "crossbeam-queue" name = "crossbeam-queue"
version = "0.3.3" version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b979d76c9fcb84dffc80a73f7290da0f83e4c95773494674cb44b76d13a7a110" checksum = "4dd435b205a4842da59efd07628f921c096bc1cc0a156835b4fa0bcb9a19bcce"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if 1.0.0",
"crossbeam-utils", "crossbeam-utils",
@ -1034,9 +1045,9 @@ dependencies = [
[[package]] [[package]]
name = "crossbeam-utils" name = "crossbeam-utils"
version = "0.8.6" version = "0.8.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cfcae03edb34f947e64acdb1c33ec169824e20657e9ecb61cef6c8c74dcb8120" checksum = "b5e5bed1f1c269533fa816a0a5492b3545209a205ca1a54842be180eb63a16a6"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if 1.0.0",
"lazy_static", "lazy_static",
@ -1054,7 +1065,7 @@ version = "0.1.0"
dependencies = [ dependencies = [
"bevy", "bevy",
"bevy_polyline", "bevy_polyline",
"heron", "bevy_rapier3d",
"rand", "rand",
] ]
@ -1132,16 +1143,6 @@ version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650"
[[package]]
name = "duplicate"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3cdaf23abc9bcc47fda1ae3af68425a22b4dfbd745f9077be0eaad5320f75f52"
dependencies = [
"heck",
"proc-macro-error",
]
[[package]] [[package]]
name = "either" name = "either"
version = "1.6.1" version = "1.6.1"
@ -1220,15 +1221,15 @@ checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b"
[[package]] [[package]]
name = "futures-core" name = "futures-core"
version = "0.3.19" version = "0.3.21"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d0c8ff0461b82559810cdccfde3215c3f373807f5e5232b71479bff7bb2583d7" checksum = "0c09fd04b7e4073ac7156a9539b57a484a8ea920f79c7c675d05d289ab6110d3"
[[package]] [[package]]
name = "futures-io" name = "futures-io"
version = "0.3.19" version = "0.3.21"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b1f9d34af5a1aac6fb380f735fe510746c38067c5bf16c7fd250280503c971b2" checksum = "fc4045962a5a5e935ee2fdedaa4e08284547402885ab326734432bed5d12966b"
[[package]] [[package]]
name = "futures-lite" name = "futures-lite"
@ -1428,15 +1429,6 @@ dependencies = [
"ahash", "ahash",
] ]
[[package]]
name = "heck"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87cbf45460356b7deeb5e3415b5563308c0a9b057c85e12b06ad551f98d0a6ac"
dependencies = [
"unicode-segmentation",
]
[[package]] [[package]]
name = "hermit-abi" name = "hermit-abi"
version = "0.1.19" version = "0.1.19"
@ -1446,54 +1438,6 @@ dependencies = [
"libc", "libc",
] ]
[[package]]
name = "heron"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "54579e36436e33827e21f046ea6752b3a93dbd0b05884bffe982568af7b3bebd"
dependencies = [
"bevy",
"cfg_aliases",
"heron_core",
"heron_macros",
"heron_rapier",
]
[[package]]
name = "heron_core"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7099a07736abf70026b1e474fff8d74a8fa88a834cfd33e974541e6b056abb41"
dependencies = [
"bevy",
"cfg_aliases",
"duplicate",
]
[[package]]
name = "heron_macros"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a09c1e02655f04faf8d6b485f6c27422f3769343c30c39e51a2cd25f3f2869c3"
dependencies = [
"quote",
"syn",
]
[[package]]
name = "heron_rapier"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4bf94fface67dce71dfd0ab2c0a8b211cacf7b1d02532669671892350765b340"
dependencies = [
"bevy",
"cfg_aliases",
"crossbeam",
"fnv",
"heron_core",
"rapier3d",
]
[[package]] [[package]]
name = "hex" name = "hex"
version = "0.4.3" version = "0.4.3"
@ -1621,9 +1565,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.114" version = "0.2.117"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b0005d08a8f7b65fb8073cb697aa0b12b631ed251ce73d862ce50eeb52ce3b50" checksum = "e74d72e0f9b65b5b4ca49a346af3976df0f9c61d550727f349ecd559f251a26c"
[[package]] [[package]]
name = "libloading" name = "libloading"
@ -1641,6 +1585,12 @@ version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7fc7aa29613bd6a620df431842069224d8bc9011086b1db4c0e0cd47fa03ec9a" checksum = "7fc7aa29613bd6a620df431842069224d8bc9011086b1db4c0e0cd47fa03ec9a"
[[package]]
name = "libm"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "33a33a362ce288760ec6a508b94caaec573ae7d3bbbd91b87aa0bad4456839db"
[[package]] [[package]]
name = "libudev-sys" name = "libudev-sys"
version = "0.1.4" version = "0.1.4"
@ -1653,9 +1603,9 @@ dependencies = [
[[package]] [[package]]
name = "lock_api" name = "lock_api"
version = "0.4.5" version = "0.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712a4d093c9976e24e7dbca41db895dabcbac38eb5f4045393d17a95bdfb1109" checksum = "88943dd7ef4a2e5a4bfa2753aaab3013e34ce2533d1996fb18ef591e315e2b3b"
dependencies = [ dependencies = [
"scopeguard", "scopeguard",
] ]
@ -1745,9 +1695,9 @@ dependencies = [
[[package]] [[package]]
name = "mint" name = "mint"
version = "0.5.8" version = "0.5.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "162e591484b4b8fe9e1ca16ebf07ab584fdc3334508d76a788cd54d89cfc20dc" checksum = "e53debba6bda7a793e5f99b8dacf19e626084f525f7829104ba9898f367d85ff"
[[package]] [[package]]
name = "mio" name = "mio"
@ -1793,11 +1743,12 @@ dependencies = [
[[package]] [[package]]
name = "nalgebra" name = "nalgebra"
version = "0.29.0" version = "0.30.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d506eb7e08d6329505faa8a3a00a5dcc6de9f76e0c77e4b75763ae3c770831ff" checksum = "4fb2d0de08694bed883320212c18ee3008576bfe8c306f4c3c4a58b4876998be"
dependencies = [ dependencies = [
"approx", "approx",
"glam",
"matrixmultiply", "matrixmultiply",
"nalgebra-macros", "nalgebra-macros",
"num-complex", "num-complex",
@ -1957,6 +1908,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290"
dependencies = [ dependencies = [
"autocfg", "autocfg",
"libm 0.2.2",
] ]
[[package]] [[package]]
@ -2024,6 +1976,16 @@ dependencies = [
"ttf-parser", "ttf-parser",
] ]
[[package]]
name = "packed_simd_2"
version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "defdcfef86dcc44ad208f71d9ff4ce28df6537a4e0d6b0e8e845cb8ca10059a6"
dependencies = [
"cfg-if 1.0.0",
"libm 0.1.4",
]
[[package]] [[package]]
name = "parking" name = "parking"
version = "2.0.0" version = "2.0.0"
@ -2057,9 +2019,9 @@ dependencies = [
[[package]] [[package]]
name = "parry3d" name = "parry3d"
version = "0.7.1" version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "067fa44bf7f7cc4022756ef9796c5f8d67c7a63041df71e6eeb09ad08ab1ece8" checksum = "c418a03e2ba297c931c530a690b305ce3b3dcc675caf16777f4f8565c8e84732"
dependencies = [ dependencies = [
"approx", "approx",
"bitflags", "bitflags",
@ -2145,30 +2107,6 @@ dependencies = [
"toml", "toml",
] ]
[[package]]
name = "proc-macro-error"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
dependencies = [
"proc-macro-error-attr",
"proc-macro2",
"quote",
"syn",
"version_check",
]
[[package]]
name = "proc-macro-error-attr"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
dependencies = [
"proc-macro2",
"quote",
"version_check",
]
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "1.0.36" version = "1.0.36"
@ -2241,9 +2179,9 @@ checksum = "63e935c45e09cc6dcf00d2f0b2d630a58f4095320223d47fc68918722f0538b6"
[[package]] [[package]]
name = "rapier3d" name = "rapier3d"
version = "0.11.1" version = "0.12.0-alpha.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cfc8dde2352efdbc0813938fcc41d12651b4bb05211e81d2b44ff6c09d39b2ac" checksum = "3f0590e74514004c7313934d092ed071302146323124efde9d30d6aa517186bf"
dependencies = [ dependencies = [
"approx", "approx",
"arrayvec", "arrayvec",
@ -2256,8 +2194,10 @@ dependencies = [
"num-derive", "num-derive",
"num-traits", "num-traits",
"parry3d", "parry3d",
"rayon",
"rustc-hash", "rustc-hash",
"simba", "simba",
"vec_map",
] ]
[[package]] [[package]]
@ -2275,6 +2215,31 @@ version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3" checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3"
[[package]]
name = "rayon"
version = "1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c06aca804d41dbc8ba42dfd964f0d01334eceb64314b9ecf7c5fad5188a06d90"
dependencies = [
"autocfg",
"crossbeam-deque",
"either",
"rayon-core",
]
[[package]]
name = "rayon-core"
version = "1.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d78120e2c850279833f1dd3582f730c4ab53ed95aeaaaa862a2a5c71b1656d8e"
dependencies = [
"crossbeam-channel",
"crossbeam-deque",
"crossbeam-utils",
"lazy_static",
"num_cpus",
]
[[package]] [[package]]
name = "rectangle-pack" name = "rectangle-pack"
version = "0.4.2" version = "0.4.2"
@ -2458,13 +2423,14 @@ dependencies = [
[[package]] [[package]]
name = "simba" name = "simba"
version = "0.6.0" version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f0b7840f121a46d63066ee7a99fc81dcabbc6105e437cae43528cea199b5a05f" checksum = "13a2609e876d4f77f6ab7ff5254fc39b4f1927ba8e6db3d18be7c32534d3725e"
dependencies = [ dependencies = [
"approx", "approx",
"num-complex", "num-complex",
"num-traits", "num-traits",
"packed_simd_2",
"paste", "paste",
"wide", "wide",
] ]
@ -2561,7 +2527,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b0dc6d20ce137f302edf90f9cd3d278866fd7fb139efca6f246161222ad6d87" checksum = "7b0dc6d20ce137f302edf90f9cd3d278866fd7fb139efca6f246161222ad6d87"
dependencies = [ dependencies = [
"lazy_static", "lazy_static",
"libm", "libm 0.1.4",
] ]
[[package]] [[package]]
@ -2637,9 +2603,9 @@ dependencies = [
[[package]] [[package]]
name = "tracing" name = "tracing"
version = "0.1.29" version = "0.1.30"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "375a639232caf30edfc78e8d89b2d4c375515393e7af7e16f01cd96917fb2105" checksum = "2d8d93354fe2a8e50d5953f5ae2e47a3fc2ef03292e7ea46e3cc38f549525fb9"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if 1.0.0",
"pin-project-lite", "pin-project-lite",
@ -2649,9 +2615,9 @@ dependencies = [
[[package]] [[package]]
name = "tracing-attributes" name = "tracing-attributes"
version = "0.1.18" version = "0.1.19"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f4f480b8f81512e825f337ad51e94c1eb5d3bbdf2b363dcd01e2b19a9ffe3f8e" checksum = "8276d9a4a3a558d7b7ad5303ad50b53d58264641b82914b7ada36bd762e7a716"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -2660,11 +2626,12 @@ dependencies = [
[[package]] [[package]]
name = "tracing-core" name = "tracing-core"
version = "0.1.21" version = "0.1.22"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1f4ed65637b8390770814083d20756f87bfa2c21bf2f110babdc5438351746e4" checksum = "03cfcb51380632a72d3111cb8d3447a8d908e577d31beeac006f836383d29a23"
dependencies = [ dependencies = [
"lazy_static", "lazy_static",
"valuable",
] ]
[[package]] [[package]]
@ -2680,9 +2647,9 @@ dependencies = [
[[package]] [[package]]
name = "tracing-subscriber" name = "tracing-subscriber"
version = "0.3.7" version = "0.3.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5312f325fe3588e277415f5a6cca1f4ccad0f248c4cd5a4bd33032d7286abc22" checksum = "74786ce43333fcf51efe947aed9718fbe46d5c7328ec3f1029e818083966d9aa"
dependencies = [ dependencies = [
"ansi_term", "ansi_term",
"lazy_static", "lazy_static",
@ -2719,12 +2686,6 @@ version = "1.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987"
[[package]]
name = "unicode-segmentation"
version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8895849a949e7845e06bd6dc1aa51731a103c42707010a5b591c0038fb73385b"
[[package]] [[package]]
name = "unicode-width" name = "unicode-width"
version = "0.1.9" version = "0.1.9"
@ -2747,6 +2708,12 @@ dependencies = [
"serde", "serde",
] ]
[[package]]
name = "valuable"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d"
[[package]] [[package]]
name = "vec_map" name = "vec_map"
version = "0.8.2" version = "0.8.2"
@ -2987,7 +2954,7 @@ checksum = "9b43cc931d58b99461188607efd7acb2a093e65fc621f54cad78517a6063e73a"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"cocoa", "cocoa",
"core-foundation 0.9.2", "core-foundation 0.9.3",
"core-graphics 0.22.3", "core-graphics 0.22.3",
"core-video-sys", "core-video-sys",
"dispatch", "dispatch",

View file

@ -19,9 +19,9 @@ features = [
"x11", "x11",
] ]
[dependencies.heron] [dependencies.bevy_rapier3d]
version = "1.1" version = "0.12"
features = ["3d"] features = ["parallel", "simd-nightly"]
# Enable optimizations for dependencies (incl. Bevy), but not for our code: # Enable optimizations for dependencies (incl. Bevy), but not for our code:
[profile.dev.package."*"] [profile.dev.package."*"]

View file

@ -1,14 +1,15 @@
use bevy::prelude::*; use bevy::prelude::*;
use heron::prelude::*; use bevy_rapier3d::{na::Vector3, prelude::*};
use crate::{geometry::CyberBike, input::InputState}; use crate::{
geometry::{CyberBike, CyberSphere, PLANET_RADIUS},
input::InputState,
};
/// Mouse sensitivity and movement speed /// Mouse sensitivity and movement speed
pub struct MovementSettings { pub struct MovementSettings {
pub sensitivity: f32, pub sensitivity: f32,
pub accel: f32, pub accel: f32,
pub drag: f32,
pub gravity: f32,
} }
impl Default for MovementSettings { impl Default for MovementSettings {
@ -16,151 +17,119 @@ impl Default for MovementSettings {
Self { Self {
sensitivity: 1.0, sensitivity: 1.0,
accel: 40., accel: 40.,
drag: 0.0005,
gravity: 10.0,
} }
} }
} }
#[derive(Component, Default)] fn setup_colliders(
pub(crate) struct CyberBikeState { mut commands: Commands,
pub velocity: Vec3, planet_query: Query<Entity, With<CyberSphere>>,
pub colliding: bool, bike_query: Query<(Entity, &Transform), With<CyberBike>>,
) {
let planet = planet_query.single();
let pbody = RigidBodyBundle {
body_type: RigidBodyType::Static.into(),
..Default::default()
};
let pcollide = ColliderBundle {
shape: ColliderShape::ball(PLANET_RADIUS).into(),
material: ColliderMaterial {
friction: 0.0,
restitution: 0.3,
..Default::default()
}
.into(),
..Default::default()
};
commands
.entity(planet)
.insert_bundle(pbody)
.insert_bundle(pcollide);
let (bike, xform) = bike_query.single();
let mut bbody = RigidBodyBundle::default();
bbody.damping.angular_damping = 0.8;
bbody.damping.linear_damping = 0.5;
let isometry = Isometry::from_parts(xform.translation.into(), xform.rotation.into());
bbody.position = isometry.into();
// collider
let shape = ColliderShape::capsule(
Vec3::new(0.0, 0.0, -1.25).into(),
Vec3::new(0.0, 0.0, 1.2).into(),
0.4,
);
let bcollide = ColliderBundle {
shape: shape.into(),
mass_properties: ColliderMassProps::Density(0.3).into(),
material: ColliderMaterial {
friction: 0.0,
restitution: 0.3,
..Default::default()
}
.into(),
..Default::default()
};
commands
.entity(bike)
.insert_bundle(bbody)
.insert_bundle(bcollide)
.insert(ColliderPositionSync::Discrete);
} }
fn falling_cat(time: Res<Time>, mut bike_query: Query<&mut Transform, With<CyberBike>>) { fn gravity(xform: Query<&Transform, With<CyberBike>>, mut config: ResMut<RapierConfiguration>) {
let dt = time.delta_seconds(); let gravity = xform.single().translation.normalize() * -8.0;
config.gravity = gravity.into();
}
let mut bike_xform = bike_query.single_mut(); fn falling_cat(
mut bike_query: Query<(&Transform, &mut RigidBodyForcesComponent), With<CyberBike>>,
) {
let (bike_xform, mut forces) = bike_query.single_mut();
let up = bike_xform.translation.normalize(); let up = bike_xform.translation.normalize();
let cam_up = bike_xform.up(); let cam_up = bike_xform.up();
let cos = up.dot(cam_up); let cos = up.dot(cam_up);
let theta = cos.acos(); let theta = cos.acos();
let rate = if !theta.is_normal() { let force_mag = if !theta.is_normal() { 0.0 } else { theta * 5.0 };
0.0 let torque = cam_up.cross(up).normalize() * force_mag;
} else if theta.is_sign_negative() {
-0.4
} else {
0.4
} * dt;
let angle = if rate.is_sign_negative() {
rate.max(theta)
} else {
rate.min(theta)
};
let rot = Quat::from_axis_angle(cam_up.cross(up).normalize(), angle); forces.torque = torque.into();
if rot.is_finite() && theta.abs() > 1.0f32.to_radians() {
bike_xform.rotate(rot);
}
} }
fn update_velocity( fn update_forces(
time: Res<Time>,
settings: Res<MovementSettings>, settings: Res<MovementSettings>,
input: Res<InputState>, input: Res<InputState>,
mut query: Query<(&Transform, &mut CyberBikeState)>, mut query: Query<
(
&Transform,
&mut RigidBodyForcesComponent,
&mut ColliderMaterialComponent,
),
With<CyberBike>,
>,
) { ) {
let dt = time.delta_seconds(); let (xform, mut forces, mut cmat) = query.single_mut();
let (xform, mut state) = query.single_mut();
// first gravity // thrust
let down = -xform.translation.normalize(); let thrust: Vector3<f32> = (xform.forward() * input.throttle * settings.accel).into();
let dvel = down * settings.gravity * dt; forces.force += thrust;
let mut vel = if state.velocity.is_finite() {
state.velocity + dvel
} else {
dvel
};
// thrust or brake
vel += xform.forward() * input.throttle * dt * settings.accel;
// brake // brake
if input.brake { cmat.friction = if input.brake { 2.0 } else { 0.0 };
let s = vel.length_squared();
if s < 0.05 { // steering
vel = Vec3::ZERO; let torque: Vector3<f32> = (xform.up() * input.yaw * settings.sensitivity).into();
} else { forces.torque += torque;
vel -= vel.normalize() * settings.accel * dt;
}
} }
// drag pub struct CyberActionPlugin;
let v2 = vel.length_squared().min(100_000.0); impl Plugin for CyberActionPlugin {
let drag = vel * settings.drag * v2 * dt;
vel -= drag;
if vel.length_squared() < 0.0001 {
vel = Vec3::ZERO;
}
state.velocity = vel;
}
fn apply_velocity(time: Res<Time>, mut bike_query: Query<(&mut Transform, &CyberBikeState)>) {
let dt = time.delta_seconds();
let (mut bike_xform, state) = bike_query.single_mut();
if state.velocity.is_finite() {
bike_xform.translation += state.velocity * dt;
}
}
fn steer_cyberbike(
settings: Res<MovementSettings>,
windows: Res<Windows>,
time: Res<Time>,
istate: Res<InputState>,
mut query: Query<&mut Transform, With<CyberBike>>,
) {
let window = windows.get_primary().unwrap();
let window_scale = window.height().min(window.width());
let dt = time.delta_seconds();
let mut transform = query.single_mut();
let d_yaw = (settings.sensitivity * dt * window_scale * istate.yaw).to_radians();
let rotation = Quat::from_axis_angle(transform.local_y(), d_yaw);
transform.rotate(rotation);
}
fn collisions(
mut events: EventReader<CollisionEvent>,
mut query: Query<(&Transform, &mut CyberBikeState)>,
) {
let (xform, mut state) = query.single_mut();
for event in events.iter() {
if let CollisionEvent::Started(_, _) = event {
state.colliding = true;
} else {
state.colliding = false;
}
}
// now see if we're currently colliding
if state.colliding {
let down = -xform.translation.normalize();
let vel = state.velocity;
let dvel = down * vel.dot(down);
state.velocity -= dvel;
}
}
pub struct CyberPhysicsPlugin;
impl Plugin for CyberPhysicsPlugin {
fn build(&self, app: &mut App) { fn build(&self, app: &mut App) {
app.init_resource::<CyberBikeState>() app.init_resource::<MovementSettings>()
.init_resource::<MovementSettings>() .add_plugin(RapierPhysicsPlugin::<NoUserData>::default())
.add_plugin(PhysicsPlugin::default()) .add_startup_system_to_stage(StartupStage::PostStartup, setup_colliders)
.add_system(collisions) .add_system(gravity)
.add_system(falling_cat) .add_system(falling_cat)
.add_system(update_velocity) .add_system(update_forces);
.add_system(steer_cyberbike)
.add_system(apply_velocity);
} }
} }

View file

@ -1,5 +1,4 @@
use bevy::prelude::*; use bevy::prelude::*;
use heron::prelude::{CollisionShape, RigidBody};
use crate::Label; use crate::Label;
@ -17,6 +16,8 @@ fn spawn_giant_sphere(
mut meshes: ResMut<Assets<Mesh>>, mut meshes: ResMut<Assets<Mesh>>,
mut materials: ResMut<Assets<StandardMaterial>>, mut materials: ResMut<Assets<StandardMaterial>>,
) { ) {
let mut color = Color::DARK_GRAY;
color.set_a(0.0);
commands commands
.spawn_bundle(PbrBundle { .spawn_bundle(PbrBundle {
mesh: meshes.add(Mesh::from(shape::Icosphere { mesh: meshes.add(Mesh::from(shape::Icosphere {
@ -24,23 +25,19 @@ fn spawn_giant_sphere(
subdivisions: 24, subdivisions: 24,
})), })),
material: materials.add(StandardMaterial { material: materials.add(StandardMaterial {
base_color: Color::DARK_GRAY, base_color: color,
metallic: 0.6, metallic: 0.6,
perceptual_roughness: 0.4, perceptual_roughness: 0.4,
alpha_mode: AlphaMode::Mask(0.5),
..Default::default() ..Default::default()
}), }),
..Default::default() ..Default::default()
}) })
.insert(CyberSphere) .insert(CyberSphere);
.insert(RigidBody::Static)
.insert(CollisionShape::Sphere {
radius: PLANET_RADIUS,
});
} }
fn spawn_cyberbike(mut commands: Commands, asset_server: Res<AssetServer>) { fn spawn_cyberbike(mut commands: Commands, asset_server: Res<AssetServer>) {
use crate::action::CyberBikeState;
commands commands
.spawn_bundle(( .spawn_bundle((
Transform { Transform {
@ -53,13 +50,7 @@ fn spawn_cyberbike(mut commands: Commands, asset_server: Res<AssetServer>) {
.with_children(|rider| { .with_children(|rider| {
rider.spawn_scene(asset_server.load("cyber-bike_no_y_up.glb#Scene0")); rider.spawn_scene(asset_server.load("cyber-bike_no_y_up.glb#Scene0"));
}) })
.insert(CyberBike) .insert(CyberBike);
.insert(RigidBody::Dynamic)
.insert(CollisionShape::Capsule {
half_segment: 2.0,
radius: 0.8,
})
.insert(CyberBikeState::default());
} }
pub struct CyberGeomPlugin; pub struct CyberGeomPlugin;

View file

@ -1,6 +1,6 @@
use bevy::prelude::*; use bevy::prelude::*;
use cyber_rider::{ use cyber_rider::{
action::{CyberPhysicsPlugin, MovementSettings}, action::{CyberActionPlugin, MovementSettings},
camera::CyberCamPlugin, camera::CyberCamPlugin,
disable_mouse_trap, disable_mouse_trap,
geometry::CyberGeomPlugin, geometry::CyberGeomPlugin,
@ -11,10 +11,8 @@ use cyber_rider::{
}; };
const MOVEMENT_SETTINGS: MovementSettings = MovementSettings { const MOVEMENT_SETTINGS: MovementSettings = MovementSettings {
sensitivity: 0.3, // default: 1.0 sensitivity: 4.0, // default: 1.0
accel: 20.0, // default: 40.0 accel: 15.0, // default: 40.0
drag: 0.0001, // default: 0.0005
gravity: 10.0, // default: 10.0
}; };
fn main() { fn main() {
@ -24,7 +22,7 @@ fn main() {
.add_plugin(CyberGeomPlugin) .add_plugin(CyberGeomPlugin)
.add_plugin(CyberGlamorPlugin) .add_plugin(CyberGlamorPlugin)
.add_plugin(CyberInputPlugin) .add_plugin(CyberInputPlugin)
.add_plugin(CyberPhysicsPlugin) .add_plugin(CyberActionPlugin)
.insert_resource(MOVEMENT_SETTINGS) .insert_resource(MOVEMENT_SETTINGS)
.add_plugin(CyberCamPlugin) .add_plugin(CyberCamPlugin)
.add_plugin(CyberSpaceLightsPlugin) .add_plugin(CyberSpaceLightsPlugin)

View file

@ -1,6 +1,7 @@
use bevy::prelude::*; use bevy::prelude::*;
use bevy_rapier3d::prelude::*;
use crate::action::CyberBikeState; use crate::geometry::CyberBike;
#[derive(Component)] #[derive(Component)]
struct UpText; struct UpText;
@ -32,10 +33,13 @@ fn setup_ui(mut commands: Commands, asset_server: Res<AssetServer>) {
.insert(UpText); .insert(UpText);
} }
fn update_ui(state_query: Query<&CyberBikeState>, mut text_query: Query<&mut Text, With<UpText>>) { fn update_ui(
state_query: Query<&RigidBodyVelocityComponent, With<CyberBike>>,
mut text_query: Query<&mut Text, With<UpText>>,
) {
let mut text = text_query.single_mut(); let mut text = text_query.single_mut();
let state = state_query.single(); let state = state_query.single();
text.sections[0].value = format!("spd: {:.2}", state.velocity.length(),); text.sections[0].value = format!("spd: {:.2}", state.linvel.magnitude());
} }
pub struct CyberUIPlugin; pub struct CyberUIPlugin;