very basic (and broken) physics based movement
This commit is contained in:
parent
464df31d43
commit
88063a3fc9
4 changed files with 315 additions and 28 deletions
293
Cargo.lock
generated
293
Cargo.lock
generated
|
@ -270,7 +270,7 @@ dependencies = [
|
||||||
"bevy_reflect",
|
"bevy_reflect",
|
||||||
"bevy_tasks",
|
"bevy_tasks",
|
||||||
"bevy_utils",
|
"bevy_utils",
|
||||||
"crossbeam-channel",
|
"crossbeam-channel 0.4.4",
|
||||||
"downcast-rs",
|
"downcast-rs",
|
||||||
"js-sys",
|
"js-sys",
|
||||||
"ndk-glue",
|
"ndk-glue",
|
||||||
|
@ -363,7 +363,7 @@ dependencies = [
|
||||||
"bevy_utils",
|
"bevy_utils",
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"downcast-rs",
|
"downcast-rs",
|
||||||
"fixedbitset",
|
"fixedbitset 0.3.1",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"parking_lot",
|
"parking_lot",
|
||||||
"rand",
|
"rand",
|
||||||
|
@ -507,6 +507,18 @@ dependencies = [
|
||||||
"bevy_window",
|
"bevy_window",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bevy_rapier3d"
|
||||||
|
version = "0.7.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c11b4b13050eb907f824c92b598e418e75f710c50a3c35a2cd3f97f6f5afc0e1"
|
||||||
|
dependencies = [
|
||||||
|
"bevy",
|
||||||
|
"concurrent-queue",
|
||||||
|
"nalgebra",
|
||||||
|
"rapier3d",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bevy_reflect"
|
name = "bevy_reflect"
|
||||||
version = "0.4.0"
|
version = "0.4.0"
|
||||||
|
@ -714,8 +726,8 @@ dependencies = [
|
||||||
"bevy_utils",
|
"bevy_utils",
|
||||||
"bevy_window",
|
"bevy_window",
|
||||||
"bevy_winit",
|
"bevy_winit",
|
||||||
"crossbeam-channel",
|
"crossbeam-channel 0.4.4",
|
||||||
"crossbeam-utils",
|
"crossbeam-utils 0.7.2",
|
||||||
"futures-lite",
|
"futures-lite",
|
||||||
"parking_lot",
|
"parking_lot",
|
||||||
"wgpu",
|
"wgpu",
|
||||||
|
@ -1171,16 +1183,75 @@ dependencies = [
|
||||||
"cfg-if 1.0.0",
|
"cfg-if 1.0.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "crossbeam"
|
||||||
|
version = "0.8.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "fd01a6eb3daaafa260f6fc94c3a6c36390abc2080e38e3e34ced87393fb77d80"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if 1.0.0",
|
||||||
|
"crossbeam-channel 0.5.0",
|
||||||
|
"crossbeam-deque",
|
||||||
|
"crossbeam-epoch",
|
||||||
|
"crossbeam-queue",
|
||||||
|
"crossbeam-utils 0.8.1",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "crossbeam-channel"
|
name = "crossbeam-channel"
|
||||||
version = "0.4.4"
|
version = "0.4.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b153fe7cbef478c567df0f972e02e6d736db11affe43dfc9c56a9374d1adfb87"
|
checksum = "b153fe7cbef478c567df0f972e02e6d736db11affe43dfc9c56a9374d1adfb87"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"crossbeam-utils",
|
"crossbeam-utils 0.7.2",
|
||||||
"maybe-uninit",
|
"maybe-uninit",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "crossbeam-channel"
|
||||||
|
version = "0.5.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "dca26ee1f8d361640700bde38b2c37d8c22b3ce2d360e1fc1c74ea4b0aa7d775"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if 1.0.0",
|
||||||
|
"crossbeam-utils 0.8.1",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "crossbeam-deque"
|
||||||
|
version = "0.8.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "94af6efb46fef72616855b036a624cf27ba656ffc9be1b9a3c931cfc7749a9a9"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if 1.0.0",
|
||||||
|
"crossbeam-epoch",
|
||||||
|
"crossbeam-utils 0.8.1",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "crossbeam-epoch"
|
||||||
|
version = "0.9.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a1aaa739f95311c2c7887a76863f500026092fb1dce0161dab577e559ef3569d"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if 1.0.0",
|
||||||
|
"const_fn",
|
||||||
|
"crossbeam-utils 0.8.1",
|
||||||
|
"lazy_static",
|
||||||
|
"memoffset",
|
||||||
|
"scopeguard",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "crossbeam-queue"
|
||||||
|
version = "0.3.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0f6cb3c7f5b8e51bc3ebb73a2327ad4abdbd119dc13223f14f961d2f38486756"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if 1.0.0",
|
||||||
|
"crossbeam-utils 0.8.1",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "crossbeam-utils"
|
name = "crossbeam-utils"
|
||||||
version = "0.7.2"
|
version = "0.7.2"
|
||||||
|
@ -1192,6 +1263,17 @@ dependencies = [
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "crossbeam-utils"
|
||||||
|
version = "0.8.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "02d96d1e189ef58269ebe5b97953da3274d83a93af647c2ddd6f9dab28cedb8d"
|
||||||
|
dependencies = [
|
||||||
|
"autocfg",
|
||||||
|
"cfg-if 1.0.0",
|
||||||
|
"lazy_static",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "d3d12"
|
name = "d3d12"
|
||||||
version = "0.3.2"
|
version = "0.3.2"
|
||||||
|
@ -1361,13 +1443,19 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "find-crate"
|
name = "find-crate"
|
||||||
version = "0.6.1"
|
version = "0.6.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "057a1d48e8ff33649ee2d7c510b79ecf1f8a52b684d446a72de600ad7e2823b6"
|
checksum = "e82d9a3770cc1839f610f61f90bb1167c37581e97ed3400cfb6cf66fbd69a639"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"toml",
|
"toml",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "fixedbitset"
|
||||||
|
version = "0.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "37ab347416e802de484e4d03c7316c48f1ecb56574dfd4a46a80f173ce1de04d"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "fixedbitset"
|
name = "fixedbitset"
|
||||||
version = "0.3.1"
|
version = "0.3.1"
|
||||||
|
@ -1559,6 +1647,15 @@ dependencies = [
|
||||||
"byteorder",
|
"byteorder",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "generational-arena"
|
||||||
|
version = "0.2.8"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8e1d3b771574f62d0548cee0ad9057857e9fc25d7a3335f140c84f6acd0bf601"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if 0.1.10",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "generator"
|
name = "generator"
|
||||||
version = "0.6.23"
|
version = "0.6.23"
|
||||||
|
@ -1572,6 +1669,16 @@ dependencies = [
|
||||||
"winapi 0.3.9",
|
"winapi 0.3.9",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "generic-array"
|
||||||
|
version = "0.14.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817"
|
||||||
|
dependencies = [
|
||||||
|
"typenum",
|
||||||
|
"version_check",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "getrandom"
|
name = "getrandom"
|
||||||
version = "0.1.15"
|
version = "0.1.15"
|
||||||
|
@ -1854,6 +1961,12 @@ dependencies = [
|
||||||
"svg_fmt",
|
"svg_fmt",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "hashbrown"
|
||||||
|
version = "0.9.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hermit-abi"
|
name = "hermit-abi"
|
||||||
version = "0.1.17"
|
version = "0.1.17"
|
||||||
|
@ -1912,6 +2025,16 @@ dependencies = [
|
||||||
"scoped_threadpool",
|
"scoped_threadpool",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "indexmap"
|
||||||
|
version = "1.6.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4fb1fa934250de4de8aef298d81c729a7d33d8c239daa3a7575e6b92bfc7313b"
|
||||||
|
dependencies = [
|
||||||
|
"autocfg",
|
||||||
|
"hashbrown",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "inflections"
|
name = "inflections"
|
||||||
version = "1.1.1"
|
version = "1.1.1"
|
||||||
|
@ -1952,6 +2075,7 @@ checksum = "61124eeebbd69b8190558df225adf7e4caafce0d743919e5d6b19652314ec5ec"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if 1.0.0",
|
"cfg-if 1.0.0",
|
||||||
"js-sys",
|
"js-sys",
|
||||||
|
"time 0.2.23",
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
"web-sys",
|
"web-sys",
|
||||||
]
|
]
|
||||||
|
@ -2095,6 +2219,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.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c7d73b3f436185384286bd8098d17ec07c9a7d2388a6599f824d8502b529702a"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libudev-sys"
|
name = "libudev-sys"
|
||||||
version = "0.1.4"
|
version = "0.1.4"
|
||||||
|
@ -2178,6 +2308,15 @@ version = "0.1.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08"
|
checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "matrixmultiply"
|
||||||
|
version = "0.2.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "916806ba0031cd542105d916a97c8572e1fa6dd79c9c51e7eb43a09ec2dd84c1"
|
||||||
|
dependencies = [
|
||||||
|
"rawpointer",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "maybe-uninit"
|
name = "maybe-uninit"
|
||||||
version = "2.0.0"
|
version = "2.0.0"
|
||||||
|
@ -2190,6 +2329,15 @@ version = "2.3.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525"
|
checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "memoffset"
|
||||||
|
version = "0.6.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "157b4208e3059a8f9e78d559edc658e13df41410cb3ae03979c83130067fdd87"
|
||||||
|
dependencies = [
|
||||||
|
"autocfg",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "metal"
|
name = "metal"
|
||||||
version = "0.20.0"
|
version = "0.20.0"
|
||||||
|
@ -2299,6 +2447,43 @@ dependencies = [
|
||||||
"thiserror",
|
"thiserror",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "nalgebra"
|
||||||
|
version = "0.23.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c9bd52e9c9922d5702d5c2a105ceacc3c1206e781d3d130f4d2b7ad5f43c144b"
|
||||||
|
dependencies = [
|
||||||
|
"approx",
|
||||||
|
"generic-array",
|
||||||
|
"matrixmultiply",
|
||||||
|
"num-complex",
|
||||||
|
"num-rational",
|
||||||
|
"num-traits",
|
||||||
|
"rand",
|
||||||
|
"rand_distr",
|
||||||
|
"simba",
|
||||||
|
"typenum",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ncollide3d"
|
||||||
|
version = "0.26.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7fa86028ca1d3ac2ff5946c64e3f82fc6e9cdfaef2bef716f9fbf7e1559298ec"
|
||||||
|
dependencies = [
|
||||||
|
"approx",
|
||||||
|
"bitflags",
|
||||||
|
"downcast-rs",
|
||||||
|
"either",
|
||||||
|
"nalgebra",
|
||||||
|
"num-traits",
|
||||||
|
"petgraph",
|
||||||
|
"simba",
|
||||||
|
"slab",
|
||||||
|
"slotmap",
|
||||||
|
"smallvec",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ndk"
|
name = "ndk"
|
||||||
version = "0.2.1"
|
version = "0.2.1"
|
||||||
|
@ -2399,7 +2584,7 @@ checksum = "a8b946889dfdad884379cd56367d93b6d0ce8889cc027d26a69a3a31c0a03bb5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anymap",
|
"anymap",
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"crossbeam-channel",
|
"crossbeam-channel 0.4.4",
|
||||||
"filetime",
|
"filetime",
|
||||||
"fsevent",
|
"fsevent",
|
||||||
"fsevent-sys",
|
"fsevent-sys",
|
||||||
|
@ -2411,6 +2596,15 @@ dependencies = [
|
||||||
"winapi 0.3.9",
|
"winapi 0.3.9",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "num-complex"
|
||||||
|
version = "0.3.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "747d632c0c558b87dbabbe6a82f3b4ae03720d0646ac5b7b4dae89394be5f2c5"
|
||||||
|
dependencies = [
|
||||||
|
"num-traits",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "num-derive"
|
name = "num-derive"
|
||||||
version = "0.3.3"
|
version = "0.3.3"
|
||||||
|
@ -2461,6 +2655,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290"
|
checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"autocfg",
|
"autocfg",
|
||||||
|
"libm 0.2.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -2589,6 +2784,12 @@ dependencies = [
|
||||||
"winapi 0.3.9",
|
"winapi 0.3.9",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "paste"
|
||||||
|
version = "1.0.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c5d65c4d95931acda4498f675e332fcbdc9a06705cd07086c510e9b6009cd1c1"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "peeking_take_while"
|
name = "peeking_take_while"
|
||||||
version = "0.1.2"
|
version = "0.1.2"
|
||||||
|
@ -2601,6 +2802,16 @@ version = "2.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e"
|
checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "petgraph"
|
||||||
|
version = "0.5.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "467d164a6de56270bd7c4d070df81d07beace25012d5103ced4e9ff08d6afdb7"
|
||||||
|
dependencies = [
|
||||||
|
"fixedbitset 0.2.0",
|
||||||
|
"indexmap",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pin-project"
|
name = "pin-project"
|
||||||
version = "1.0.2"
|
version = "1.0.2"
|
||||||
|
@ -2723,6 +2934,7 @@ name = "rake"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bevy",
|
"bevy",
|
||||||
|
"bevy_rapier3d",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -2757,6 +2969,16 @@ dependencies = [
|
||||||
"getrandom 0.1.15",
|
"getrandom 0.1.15",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand_distr"
|
||||||
|
version = "0.3.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c9e9532ada3929fb8b2e9dbe28d1e06c9b2cc65813f074fcb6bd5fbefeff9d56"
|
||||||
|
dependencies = [
|
||||||
|
"num-traits",
|
||||||
|
"rand",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rand_hc"
|
name = "rand_hc"
|
||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
|
@ -2772,6 +2994,29 @@ version = "0.1.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a871f1e45a3a3f0c73fb60343c811238bb5143a81642e27c2ac7aac27ff01a63"
|
checksum = "a871f1e45a3a3f0c73fb60343c811238bb5143a81642e27c2ac7aac27ff01a63"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rapier3d"
|
||||||
|
version = "0.4.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c7f175c71f3c2b140f17fd4683097d1b166cd253b1d8dc4cdf3467bd6281b9ef"
|
||||||
|
dependencies = [
|
||||||
|
"approx",
|
||||||
|
"arrayvec",
|
||||||
|
"bit-vec",
|
||||||
|
"bitflags",
|
||||||
|
"crossbeam",
|
||||||
|
"downcast-rs",
|
||||||
|
"generational-arena",
|
||||||
|
"instant",
|
||||||
|
"nalgebra",
|
||||||
|
"ncollide3d",
|
||||||
|
"num-derive",
|
||||||
|
"num-traits",
|
||||||
|
"rustc-hash",
|
||||||
|
"simba",
|
||||||
|
"vec_map",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "raw-window-handle"
|
name = "raw-window-handle"
|
||||||
version = "0.3.3"
|
version = "0.3.3"
|
||||||
|
@ -2781,6 +3026,12 @@ dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rawpointer"
|
||||||
|
version = "0.2.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rectangle-pack"
|
name = "rectangle-pack"
|
||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
|
@ -3039,6 +3290,18 @@ version = "0.1.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7fdf1b9db47230893d76faad238fd6097fd6d6a9245cd7a4d90dbd639536bbd2"
|
checksum = "7fdf1b9db47230893d76faad238fd6097fd6d6a9245cd7a4d90dbd639536bbd2"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "simba"
|
||||||
|
version = "0.3.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "17bfe642b1728a6e89137ad428ef5d4738eca4efaba9590f9e110b8944028621"
|
||||||
|
dependencies = [
|
||||||
|
"approx",
|
||||||
|
"num-complex",
|
||||||
|
"num-traits",
|
||||||
|
"paste",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "slab"
|
name = "slab"
|
||||||
version = "0.4.2"
|
version = "0.4.2"
|
||||||
|
@ -3056,6 +3319,12 @@ dependencies = [
|
||||||
"winapi 0.3.9",
|
"winapi 0.3.9",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "slotmap"
|
||||||
|
version = "0.4.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c46a3482db8f247956e464d783693ece164ca056e6e67563ee5505bdb86452cd"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "smallvec"
|
name = "smallvec"
|
||||||
version = "1.5.1"
|
version = "1.5.1"
|
||||||
|
@ -3188,7 +3457,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]]
|
||||||
|
@ -3432,6 +3701,12 @@ version = "2.0.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0685c84d5d54d1c26f7d3eb96cd41550adb97baed141a761cf335d3d33bcd0ae"
|
checksum = "0685c84d5d54d1c26f7d3eb96cd41550adb97baed141a761cf335d3d33bcd0ae"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "typenum"
|
||||||
|
version = "1.12.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-bidi"
|
name = "unicode-bidi"
|
||||||
version = "0.3.4"
|
version = "0.3.4"
|
||||||
|
|
|
@ -5,3 +5,4 @@ edition = "2018"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bevy = "0.4"
|
bevy = "0.4"
|
||||||
|
bevy_rapier3d = "0.7.0"
|
||||||
|
|
23
src/main.rs
23
src/main.rs
|
@ -1,5 +1,9 @@
|
||||||
use bevy::prelude::*;
|
use bevy::prelude::*;
|
||||||
use rake::player::{Player, PlayerPlugin};
|
use rake::player::{Player, PlayerPlugin};
|
||||||
|
use bevy_rapier3d::rapier::dynamics::RigidBodyBuilder;
|
||||||
|
use bevy_rapier3d::rapier::geometry::ColliderBuilder;
|
||||||
|
use bevy_rapier3d::physics::RapierPhysicsPlugin;
|
||||||
|
use bevy::input::system::exit_on_esc_system;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
App::build()
|
App::build()
|
||||||
|
@ -11,11 +15,12 @@ fn main() {
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
.add_plugins(DefaultPlugins)
|
.add_plugins(DefaultPlugins)
|
||||||
|
.add_plugin(RapierPhysicsPlugin)
|
||||||
// note: debug renderer doesnt work for cylinder
|
// note: debug renderer doesnt work for cylinder
|
||||||
//.add_plugin(RapierRenderPlugin)
|
//.add_plugin(RapierRenderPlugin)
|
||||||
.add_plugin(PlayerPlugin)
|
.add_plugin(PlayerPlugin)
|
||||||
.add_startup_system(init.system())
|
.add_startup_system(init.system())
|
||||||
.add_system(exit_game_system.system())
|
.add_system(exit_on_esc_system.system())
|
||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +39,9 @@ fn init(
|
||||||
transform: Transform::from_translation(Vec3::new(0.0, 3.0, 3.0)),
|
transform: Transform::from_translation(Vec3::new(0.0, 3.0, 3.0)),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
.with(player);
|
.with(player)
|
||||||
|
.with(RigidBodyBuilder::new_dynamic().translation(0.0, 3.0, 0.0))
|
||||||
|
.with(ColliderBuilder::cylinder(1.0, 0.5).friction(0.0));
|
||||||
|
|
||||||
let box_mesh = meshes.add(Mesh::from(shape::Cube { size: 0.25 }));
|
let box_mesh = meshes.add(Mesh::from(shape::Cube { size: 0.25 }));
|
||||||
let box_material = materials.add(Color::rgb(1.0, 0.2, 0.3).into());
|
let box_material = materials.add(Color::rgb(1.0, 0.2, 0.3).into());
|
||||||
|
@ -54,6 +61,9 @@ fn init(
|
||||||
}
|
}
|
||||||
|
|
||||||
// create a floor
|
// create a floor
|
||||||
|
let rigid_body1 = RigidBodyBuilder::new_static();
|
||||||
|
let collider1 = ColliderBuilder::cuboid(10.0, 1.0, 10.0);
|
||||||
|
commands.spawn((rigid_body1, collider1));
|
||||||
commands.spawn(PbrBundle {
|
commands.spawn(PbrBundle {
|
||||||
mesh: meshes.add(Mesh::from(shape::Plane { size: 10. })),
|
mesh: meshes.add(Mesh::from(shape::Plane { size: 10. })),
|
||||||
material: materials.add(Color::rgb(0.5, 0.9, 0.9).into()),
|
material: materials.add(Color::rgb(0.5, 0.9, 0.9).into()),
|
||||||
|
@ -61,12 +71,3 @@ fn init(
|
||||||
..Default::default()
|
..Default::default()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
fn exit_game_system(
|
|
||||||
keyboard_input: Res<Input<KeyCode>>,
|
|
||||||
mut app_exit_events: ResMut<Events<bevy::app::AppExit>>,
|
|
||||||
) {
|
|
||||||
if keyboard_input.pressed(KeyCode::Escape) {
|
|
||||||
app_exit_events.send(bevy::app::AppExit);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
use bevy::{input::mouse::MouseMotion, math::clamp, prelude::*};
|
use bevy::{input::mouse::MouseMotion, math::clamp, prelude::*};
|
||||||
|
use bevy_rapier3d::rapier::dynamics::{RigidBody, RigidBodySet};
|
||||||
|
use bevy_rapier3d::physics::RigidBodyHandleComponent;
|
||||||
|
use bevy_rapier3d::na::{Matrix3x1};
|
||||||
|
|
||||||
pub struct Player {
|
pub struct Player {
|
||||||
/// The speed the FlyCamera moves at. Defaults to `1.0`
|
/// The speed the FlyCamera moves at. Defaults to `1.0`
|
||||||
|
@ -18,7 +21,7 @@ pub struct Player {
|
||||||
impl Player {
|
impl Player {
|
||||||
pub fn create() -> Self {
|
pub fn create() -> Self {
|
||||||
Self {
|
Self {
|
||||||
speed: 1.5,
|
speed: 15.,
|
||||||
sensitivity: 6.0,
|
sensitivity: 6.0,
|
||||||
friction: 1.0,
|
friction: 1.0,
|
||||||
pitch: 0.0,
|
pitch: 0.0,
|
||||||
|
@ -54,10 +57,12 @@ fn movement_axis(input: &Res<Input<KeyCode>>, plus: KeyCode, minus: KeyCode) ->
|
||||||
|
|
||||||
fn camera_movement_system(
|
fn camera_movement_system(
|
||||||
time: Res<Time>,
|
time: Res<Time>,
|
||||||
|
mut bodies: ResMut<RigidBodySet>,
|
||||||
keyboard_input: Res<Input<KeyCode>>,
|
keyboard_input: Res<Input<KeyCode>>,
|
||||||
mut query: Query<(&mut Player, &mut Transform)>,
|
mut query: Query<(&mut Player, &mut Transform, &RigidBodyHandleComponent)>,
|
||||||
) {
|
) {
|
||||||
for (mut player, mut transform) in query.iter_mut() {
|
for (mut player, transform, handle) in query.iter_mut() {
|
||||||
|
let body: &mut RigidBody = bodies.get_mut(handle.handle()).unwrap();
|
||||||
let (axis_h, axis_v, axis_float) = (
|
let (axis_h, axis_v, axis_float) = (
|
||||||
movement_axis(&keyboard_input, KeyCode::D, KeyCode::A),
|
movement_axis(&keyboard_input, KeyCode::D, KeyCode::A),
|
||||||
movement_axis(&keyboard_input, KeyCode::S, KeyCode::W),
|
movement_axis(&keyboard_input, KeyCode::S, KeyCode::W),
|
||||||
|
@ -82,6 +87,9 @@ fn camera_movement_system(
|
||||||
|
|
||||||
player.velocity += accel * time.delta_seconds();
|
player.velocity += accel * time.delta_seconds();
|
||||||
|
|
||||||
|
let vel = Matrix3x1::new(player.velocity.x, body.linvel().y, player.velocity.z);
|
||||||
|
body.set_linvel(vel, true);
|
||||||
|
|
||||||
let delta_friction = friction * time.delta_seconds();
|
let delta_friction = friction * time.delta_seconds();
|
||||||
|
|
||||||
player.velocity = if (player.velocity + delta_friction).signum() != player.velocity.signum() {
|
player.velocity = if (player.velocity + delta_friction).signum() != player.velocity.signum() {
|
||||||
|
@ -89,8 +97,6 @@ fn camera_movement_system(
|
||||||
} else {
|
} else {
|
||||||
player.velocity + delta_friction
|
player.velocity + delta_friction
|
||||||
};
|
};
|
||||||
|
|
||||||
transform.translation += player.velocity;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,8 +108,9 @@ struct State {
|
||||||
fn mouse_motion_system(
|
fn mouse_motion_system(
|
||||||
time: Res<Time>,
|
time: Res<Time>,
|
||||||
mut state: ResMut<State>,
|
mut state: ResMut<State>,
|
||||||
|
mut bodies: ResMut<RigidBodySet>,
|
||||||
mouse_motion_events: Res<Events<MouseMotion>>,
|
mouse_motion_events: Res<Events<MouseMotion>>,
|
||||||
mut query: Query<(&mut Player, &mut Transform)>,
|
mut query: Query<(&mut Player, &mut Transform, &RigidBodyHandleComponent)>,
|
||||||
) {
|
) {
|
||||||
let mut delta: Vec2 = Vec2::zero();
|
let mut delta: Vec2 = Vec2::zero();
|
||||||
for event in state.mouse_motion_event_reader.iter(&mouse_motion_events) {
|
for event in state.mouse_motion_event_reader.iter(&mouse_motion_events) {
|
||||||
|
@ -113,7 +120,8 @@ fn mouse_motion_system(
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (mut options, mut transform) in query.iter_mut() {
|
for (mut options, mut transform, handle) in query.iter_mut() {
|
||||||
|
let body: &mut RigidBody = bodies.get_mut(handle.handle()).unwrap();
|
||||||
options.yaw -= delta.x * options.sensitivity * time.delta_seconds();
|
options.yaw -= delta.x * options.sensitivity * time.delta_seconds();
|
||||||
options.pitch += delta.y * options.sensitivity * time.delta_seconds();
|
options.pitch += delta.y * options.sensitivity * time.delta_seconds();
|
||||||
|
|
||||||
|
@ -124,7 +132,9 @@ fn mouse_motion_system(
|
||||||
let pitch_radians = options.pitch.to_radians();
|
let pitch_radians = options.pitch.to_radians();
|
||||||
|
|
||||||
transform.rotation = Quat::from_axis_angle(Vec3::unit_y(), yaw_radians)
|
transform.rotation = Quat::from_axis_angle(Vec3::unit_y(), yaw_radians)
|
||||||
* Quat::from_axis_angle(-Vec3::unit_x(), pitch_radians);
|
* Quat::from_axis_angle(-Vec3::unit_x(), pitch_radians) * 10.;
|
||||||
|
|
||||||
|
body.set_angvel(Matrix3x1::new(pitch_radians, yaw_radians, 0.), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue