diff --git a/CHANGELOG.md b/CHANGELOG.md index e2e4f1df..15111455 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,16 @@ +### 0.18.0 (24 July 2025) + +### Added + +- Add `World.timing*` functions to access the internal performances measurements if the internal + profiler is enabled with `World.profilerEnabled = true`. +- Add `World.maxCcdSubsteps` to get/set the max number of CCD substeps run by the engine. + +### Fix + +- Fixed crash that would happen when removing colliders in a particular order (e.g. in the same order + as their insertion). + ### 0.18.0-beta.0 (12 July 2025) #### Modified diff --git a/Cargo.lock b/Cargo.lock index b2595e35..fb5c36d4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -34,9 +34,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.18" +version = "0.6.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8acc5369981196006228e28809f761875c0327210a891e941f4c683b3a99529b" +checksum = "301af1932e46185686725e0fad2f8f2aa7da69dd70bf6ecc44d6b703844a3933" dependencies = [ "anstyle", "anstyle-parse", @@ -49,36 +49,36 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.10" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9" +checksum = "862ed96ca487e809f1c8e5a8447f6ee2cf102f846893800b20cebdf541fc6bbd" [[package]] name = "anstyle-parse" -version = "0.2.6" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9" +checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c" +checksum = "6c8bdeb6047d8983be085bab0ba1472e6dc604e7041dbf6fcd5e71523014fae9" dependencies = [ "windows-sys", ] [[package]] name = "anstyle-wincon" -version = "3.0.7" +version = "3.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3534e77181a9cc07539ad51f2141fe32f6c3ffd4df76db8ad92346b003ae4e" +checksum = "403f75924867bb1033c59fbf0797484329750cfbe3c4325cd33127941fabc882" dependencies = [ "anstyle", - "once_cell", + "once_cell_polyfill", "windows-sys", ] @@ -102,9 +102,9 @@ dependencies = [ [[package]] name = "autocfg" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" +checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" [[package]] name = "bincode" @@ -126,9 +126,9 @@ dependencies = [ [[package]] name = "bitflags" -version = "2.9.0" +version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd" +checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967" dependencies = [ "serde", ] @@ -154,9 +154,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.17.0" +version = "3.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1628fb46dfa0b37568d12e5edd512553eccf6a22a78e8bde00bb4aed84d5bdbf" +checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" [[package]] name = "by_address" @@ -166,9 +166,9 @@ checksum = "64fa3c856b712db6612c019f14756e64e4bcea13337a6b33b696333a9eaa2d06" [[package]] name = "bytemuck" -version = "1.23.0" +version = "1.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9134a6ef01ce4b366b50689c94f82c14bc72bc5d0386829828a2e2752ef7958c" +checksum = "5c76a5792e44e4abe34d3abf15636779261d45a7450612059293d1d2cfc63422" [[package]] name = "byteorder" @@ -178,18 +178,18 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "cc" -version = "1.2.21" +version = "1.2.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8691782945451c1c383942c4874dbe63814f61cb57ef773cda2972682b7bb3c0" +checksum = "deec109607ca693028562ed836a5f1c4b8bd77755c4e132fc5ce11b0b6211ae7" dependencies = [ "shlex", ] [[package]] name = "cfg-if" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268" [[package]] name = "chrono" @@ -227,18 +227,18 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.37" +version = "4.5.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eccb054f56cbd38340b380d4a8e69ef1f02f1af43db2f0cc817a4774d80ae071" +checksum = "be92d32e80243a54711e5d7ce823c35c41c9d929dc4ab58e1276f625841aadf9" dependencies = [ "clap_builder", ] [[package]] name = "clap_builder" -version = "4.5.37" +version = "4.5.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efd9466fac8543255d3b1fcad4762c5e116ffe808c8a3043d4263cd4fd4862a2" +checksum = "707eab41e9622f9139419d573eca0900137718000c517d47da73045f54331c3d" dependencies = [ "anstream", "anstyle", @@ -248,9 +248,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.32" +version = "4.5.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09176aae279615badda0765c0c0b3f6ed53f4709118af73cf4655d85d1530cd7" +checksum = "ef4f52386a59ca4c860f7393bcf8abd8dfd91ecccc0f774635ff68e92eeef491" dependencies = [ "heck", "proc-macro2", @@ -260,15 +260,15 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.7.4" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6" +checksum = "b94f61472cee1439c0b966b47e3aca9ae07e45d070759512cd390ea2bebc6675" [[package]] name = "colorchoice" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" +checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" [[package]] name = "core-foundation-sys" @@ -285,28 +285,6 @@ dependencies = [ "libc", ] -[[package]] -name = "crossbeam" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1137cd7e7fc0fb5d3c5a8678be38ec56e819125d8d7907411fe24ccb943faca8" -dependencies = [ - "crossbeam-channel", - "crossbeam-deque", - "crossbeam-epoch", - "crossbeam-queue", - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-channel" -version = "0.5.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82b8f8f868b36967f9606790d1903570de9ceaf870a7bf9fbbd3016d636a2cb2" -dependencies = [ - "crossbeam-utils", -] - [[package]] name = "crossbeam-deque" version = "0.8.6" @@ -326,15 +304,6 @@ dependencies = [ "crossbeam-utils", ] -[[package]] -name = "crossbeam-queue" -version = "0.3.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f58bbc28f91df819d0aa2a2c00cd19754769c2fad90579b3592b1c9ba7a3115" -dependencies = [ - "crossbeam-utils", -] - [[package]] name = "crossbeam-utils" version = "0.8.21" @@ -369,7 +338,7 @@ dependencies = [ [[package]] name = "dimforge_rapier2d" -version = "0.18.0-beta.0" +version = "0.18.0" dependencies = [ "bincode", "js-sys", @@ -383,7 +352,7 @@ dependencies = [ [[package]] name = "dimforge_rapier2d-deterministic" -version = "0.18.0-beta.0" +version = "0.18.0" dependencies = [ "bincode", "js-sys", @@ -397,7 +366,7 @@ dependencies = [ [[package]] name = "dimforge_rapier2d-simd" -version = "0.18.0-beta.0" +version = "0.18.0" dependencies = [ "bincode", "js-sys", @@ -411,7 +380,7 @@ dependencies = [ [[package]] name = "dimforge_rapier3d" -version = "0.18.0-beta.0" +version = "0.18.0" dependencies = [ "bincode", "js-sys", @@ -425,7 +394,7 @@ dependencies = [ [[package]] name = "dimforge_rapier3d-deterministic" -version = "0.18.0-beta.0" +version = "0.18.0" dependencies = [ "bincode", "js-sys", @@ -439,7 +408,7 @@ dependencies = [ [[package]] name = "dimforge_rapier3d-simd" -version = "0.18.0-beta.0" +version = "0.18.0" dependencies = [ "bincode", "js-sys", @@ -558,9 +527,9 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.15.3" +version = "0.15.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84b26c544d002229e640969970a2e74021aadf6e2f96372b9c58eff97de08eb3" +checksum = "5971ac85611da7067dbfcabef3c70ebb5606018acd9e2a3903a0da507521e0d5" dependencies = [ "allocator-api2", "equivalent", @@ -635,9 +604,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.9.0" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cea70ddb795996207ad57735b50c5982d8844f38ba9ee5f1aedcfb708a2aa11e" +checksum = "fe4cd85333e22411419a0bcae1297d25e58c9443848b11dc6a86fefe8c78a661" dependencies = [ "equivalent", "hashbrown", @@ -674,15 +643,15 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.172" +version = "0.2.174" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa" +checksum = "1171693293099992e19cddea4e8b849964e9846f4acee11b3948bcc337be8776" [[package]] name = "libm" -version = "0.2.14" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a25169bd5913a4b437588a7e3d127cd6e90127b60e0ffbd834a38f1599e016b8" +checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de" [[package]] name = "log" @@ -692,9 +661,9 @@ checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" [[package]] name = "matrixmultiply" -version = "0.3.9" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9380b911e3e96d10c1f415da0876389aaf1b56759054eeb0de7df940c456ba1a" +checksum = "a06de3016e9fae57a36fd14dba131fccf49f74b40b7fbdb472f96e361ec71a08" dependencies = [ "autocfg", "rawpointer", @@ -702,9 +671,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.7.4" +version = "2.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" +checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "nalgebra" @@ -801,6 +770,12 @@ version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" +[[package]] +name = "once_cell_polyfill" +version = "1.70.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4895175b425cb1f87721b59f0f286c2092bd4af812243672510e1ac53e2e0ad" + [[package]] name = "ordered-float" version = "5.0.0" @@ -836,9 +811,9 @@ dependencies = [ [[package]] name = "parry2d" -version = "0.22.0-beta.1" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6826172689f7365694e8c3123b57065709869c13f1b686e8294a2a0f9a8e4bec" +checksum = "5d40099b76410e5e8ff51c0cda21e1ecb877fa07070d2d72eb089f58671a30a3" dependencies = [ "approx", "arrayvec", @@ -863,9 +838,9 @@ dependencies = [ [[package]] name = "parry3d" -version = "0.22.0-beta.1" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1d866b7e9e63a05780111b13f275e1a398a60f34b6749392b53369fe4eb5520" +checksum = "7a9be495902125240bc361a233a3d3e0fe279f87b91f0fb34942be9eefced64e" dependencies = [ "approx", "arrayvec", @@ -914,9 +889,9 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pest" -version = "2.8.0" +version = "2.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "198db74531d58c70a361c42201efde7e2591e976d518caf7662a47dc5720e7b6" +checksum = "1db05f56d34358a8b1066f67cbb203ee3e7ed2ba674a6263a1d5ec6db2204323" dependencies = [ "memchr", "thiserror", @@ -925,9 +900,9 @@ dependencies = [ [[package]] name = "pest_derive" -version = "2.8.0" +version = "2.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d725d9cfd79e87dccc9341a2ef39d1b6f6353d68c4b33c177febbe1a402c97c5" +checksum = "bb056d9e8ea77922845ec74a1c4e8fb17e7c218cc4fc11a15c5d25e189aa40bc" dependencies = [ "pest", "pest_generator", @@ -935,9 +910,9 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.8.0" +version = "2.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db7d01726be8ab66ab32f9df467ae8b1148906685bbe75c82d1e65d7f5b3f841" +checksum = "87e404e638f781eb3202dc82db6760c8ae8a1eeef7fb3fa8264b2ef280504966" dependencies = [ "pest", "pest_meta", @@ -948,11 +923,10 @@ dependencies = [ [[package]] name = "pest_meta" -version = "2.8.0" +version = "2.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f9f832470494906d1fca5329f8ab5791cc60beb230c74815dff541cbd2b5ca0" +checksum = "edd1101f170f5903fde0914f899bb503d9ff5271d7ba76bbb70bea63690cc0d5" dependencies = [ - "once_cell", "pest", "sha2", ] @@ -1050,18 +1024,18 @@ dependencies = [ [[package]] name = "profiling" -version = "1.0.16" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afbdc74edc00b6f6a218ca6a5364d6226a259d4b8ea1af4a0ea063f27e179f4d" +checksum = "3eb8486b569e12e2c32ad3e204dbaba5e4b5b216e9367044f25f1dba42341773" dependencies = [ "profiling-procmacros", ] [[package]] name = "profiling-procmacros" -version = "1.0.16" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a65f2e60fbf1063868558d69c6beacf412dc755f9fc020f514b7955fc914fe30" +checksum = "52717f9a02b6965224f95ca2a81e2e0c5c43baacd28ca057577988930b6c3d5b" dependencies = [ "quote", "syn", @@ -1108,15 +1082,14 @@ dependencies = [ [[package]] name = "rapier2d" -version = "0.27.0-beta.0" +version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e89e01890c583fe4258cd12f03664ad5dbc0cf4cda37aac790681e2b4f627778" +checksum = "7a9d86e53d2e6d33d3e4f1f28e72ec819cfabb8a1cc276391a6e43e3b002ab9c" dependencies = [ "approx", "arrayvec", "bit-vec", "bitflags", - "crossbeam", "downcast-rs", "log", "nalgebra", @@ -1130,19 +1103,19 @@ dependencies = [ "simba", "thiserror", "vec_map", + "web-time", ] [[package]] name = "rapier3d" -version = "0.27.0-beta.0" +version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ab3ba62d1788a880b297e5c56612c68cfa18db3ad0413e80704729820378577" +checksum = "b274764d058e242961750c11aff7433255321f621bb98220bb0a82beff1f9897" dependencies = [ "approx", "arrayvec", "bit-vec", "bitflags", - "crossbeam", "downcast-rs", "log", "nalgebra", @@ -1158,6 +1131,7 @@ dependencies = [ "smallvec", "thiserror", "vec_map", + "web-time", "wide", ] @@ -1218,9 +1192,9 @@ checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "robust" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbf4a6aa5f6d6888f39e980649f3ad6b666acdce1d78e95b8a2cb076e687ae30" +checksum = "4e27ee8bb91ca0adcf0ecb116293afa12d393f9c2b9b9cd54d33e8078fe19839" [[package]] name = "rstar" @@ -1241,9 +1215,9 @@ checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" [[package]] name = "rustversion" -version = "1.0.20" +version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eded382c5f5f786b989652c49544c4877d9f015cc22e145a5ea8ea66c2921cd2" +checksum = "8a0d197bd2c9dc6e53b84da9556a69ba4cdfab8619eb41a8bd1cc2027a0f6b1d" [[package]] name = "ryu" @@ -1291,9 +1265,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.140" +version = "1.0.141" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373" +checksum = "30b9eff21ebe718216c6ec64e1d9ac57087aad11efc64e32002bce4a0d4c03d3" dependencies = [ "itoa", "memchr", @@ -1340,12 +1314,9 @@ checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d" [[package]] name = "slab" -version = "0.4.9" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" -dependencies = [ - "autocfg", -] +checksum = "04dc19736151f35336d325007ac991178d504a119863a2fcb3758cdb5e52c50d" [[package]] name = "slug" @@ -1359,15 +1330,15 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.15.0" +version = "1.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8917285742e9f3e1683f0a9c4e6b57960b7314d0b08d30d1ecd426713ee2eee9" +checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" [[package]] name = "spade" -version = "2.13.1" +version = "2.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ece03ff43cd2a9b57ebf776ea5e78bd30b3b4185a619f041079f4109f385034" +checksum = "a14e31a007e9f85c32784b04f89e6e194bb252a4d41b4a8ccd9e77245d901c8c" dependencies = [ "hashbrown", "num-traits", @@ -1396,9 +1367,9 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "syn" -version = "2.0.101" +version = "2.0.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ce2b7fc941b3a24138a0a7cf8e858bfc6a992e7978a068a5c760deb0ed43caf" +checksum = "17b6f705963418cdb9927482fa304bc562ece2fdd4f616084c50b7023b435a40" dependencies = [ "proc-macro2", "quote", @@ -1545,9 +1516,9 @@ dependencies = [ [[package]] name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" +version = "0.11.1+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" [[package]] name = "wasm-bindgen" @@ -1607,11 +1578,21 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "web-time" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + [[package]] name = "wide" -version = "0.7.32" +version = "0.7.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41b5576b9a81633f3e8df296ce0063042a73507636cbe956c61133dd7034ab22" +checksum = "0ce5da8ecb62bcd8ec8b7ea19f69a51275e91299be594ea5cc6ef7819e16cd03" dependencies = [ "bytemuck", "safe_arch", @@ -1628,9 +1609,9 @@ dependencies = [ [[package]] name = "windows-core" -version = "0.61.0" +version = "0.61.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4763c1de310c86d75a878046489e2e5ba02c649d185f21c67d4cf8a56d098980" +checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" dependencies = [ "windows-implement", "windows-interface", @@ -1663,24 +1644,24 @@ dependencies = [ [[package]] name = "windows-link" -version = "0.1.1" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76840935b766e1b0a05c0066835fb9ec80071d4c09a16f6bd5f7e655e3c14c38" +checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" [[package]] name = "windows-result" -version = "0.3.2" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c64fd11a4fd95df68efcfee5f44a294fe71b8bc6a91993e2791938abcc712252" +checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" dependencies = [ "windows-link", ] [[package]] name = "windows-strings" -version = "0.4.0" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a2ba9642430ee452d5a7aa78d72907ebe8cfda358e8cb7918a2050581322f97" +checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" dependencies = [ "windows-link", ] @@ -1760,18 +1741,18 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "zerocopy" -version = "0.8.25" +version = "0.8.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1702d9583232ddb9174e01bb7c15a2ab8fb1bc6f227aa1233858c351a3ba0cb" +checksum = "1039dd0d3c310cf05de012d8a39ff557cb0d23087fd44cad61df08fc31907a2f" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.8.25" +version = "0.8.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28a6e20d751156648aa063f3800b706ee209a32c0b4d9f24be3d980b01be55ef" +checksum = "9ecf5b4cc5364572d7f4c329661bcc82724222973f2cab6f050a4e5c22f75181" dependencies = [ "proc-macro2", "quote", diff --git a/builds/prepare_builds/templates/Cargo.toml.tera b/builds/prepare_builds/templates/Cargo.toml.tera index af35c195..2e7f1410 100644 --- a/builds/prepare_builds/templates/Cargo.toml.tera +++ b/builds/prepare_builds/templates/Cargo.toml.tera @@ -1,6 +1,6 @@ [package] name = "dimforge_{{ js_package_name }}" # Can't be named rapier{{ dimension }}d which conflicts with the dependency. -version = "0.18.0-beta.0" +version = "0.18.0" authors = ["Sébastien Crozet "] description = "{{ dimension }}-dimensional physics engine in Rust - official JS bindings." documentation = "https://rapier.rs/rustdoc/rapier{{ dimension }}d/index.html" @@ -27,9 +27,10 @@ rust.unexpected_cfgs = { level = "warn", check-cfg = [ ] } [dependencies] -rapier{{ dimension }}d = { version = "0.27.0-beta.0", features = [ +rapier{{ dimension }}d = { version = "0.27.0", features = [ "serde-serialize", "debug-render", + "profiler", {%- for feature in additional_features %} "{{ feature }}", {%- endfor %} diff --git a/src.ts/pipeline/world.ts b/src.ts/pipeline/world.ts index fc5c9644..b8f7b030 100644 --- a/src.ts/pipeline/world.ts +++ b/src.ts/pipeline/world.ts @@ -414,6 +414,27 @@ export class World { this.integrationParameters.numInternalPgsIterations = niter; } + /** + * The number of substeps continuous collision-detection can run (default: `1`). + */ + get maxCcdSubsteps(): number { + return this.integrationParameters.maxCcdSubsteps; + } + + /** + * Sets the number of substeps continuous collision-detection can run (default: `1`). + * + * CCD operates using a "motion clamping" mechanism where all fast-moving object trajectories will + * be truncated to their first impact on their path. The number of CCD substeps beyond 1 indicate how + * many times that trajectory will be updated and continued after a hit. This can results in smoother + * paths, but at a significant computational cost. + * + * @param niter - The new maximum number of CCD substeps. Setting to `0` disables CCD entirely. + */ + set maxCcdSubsteps(substeps: number) { + this.integrationParameters.maxCcdSubsteps = substeps; + } + /// Configures the integration parameters to match the old PGS solver /// from Rapier JS version <= 0.11. /// @@ -1171,4 +1192,181 @@ export class World { collider2.handle, ); } + + /** + * Sets whether internal performance profiling is enabled (default: false). + * + * Only works if the internal profiler is enabled with `World.profilerEnabled = true`. + */ + set profilerEnabled(enabled: boolean) { + this.physicsPipeline.raw.set_profiler_enabled(enabled); + } + + /** + * Indicates if the internal performance profiling is enabled. + * + * Only works if the internal profiler is enabled with `World.profilerEnabled = true`. + */ + get profilerEnabled(): boolean { + return this.physicsPipeline.raw.is_profiler_enabled(); + } + + /** + * The time spent in milliseconds by the last step to run the entire simulation step. + * + * Only works if the internal profiler is enabled with `World.profilerEnabled = true`. + */ + public timingStep(): number { + return this.physicsPipeline.raw.timing_step(); + } + + /** + * The time spent in milliseconds by the last step to run the collision-detection + * (broad-phase + narrow-phase). + * + * Only works if the internal profiler is enabled with `World.profilerEnabled = true`. + */ + public timingCollisionDetection(): number { + return this.physicsPipeline.raw.timing_collision_detection(); + } + + /** + * The time spent in milliseconds by the last step to run the broad-phase. + * + * This timing is included in `timingCollisionDetection`. + * Only works if the internal profiler is enabled with `World.profilerEnabled = true`. + */ + public timingBroadPhase(): number { + return this.physicsPipeline.raw.timing_broad_phase(); + } + + /** + * The time spent in milliseconds by the last step to run the narrow-phase. + * + * This timing is included in `timingCollisionDetection`. + * Only works if the internal profiler is enabled with `World.profilerEnabled = true`. + */ + public timingNarrowPhase(): number { + return this.physicsPipeline.raw.timing_narrow_phase(); + } + + /** + * The time spent in milliseconds by the last step to run the constraint solver. + * + * Only works if the internal profiler is enabled with `World.profilerEnabled = true`. + */ + public timingSolver(): number { + return this.physicsPipeline.raw.timing_solver(); + } + + /** + * The time spent in milliseconds by the last step to run the constraint + * initialization. + * + * This timing is included in `timingSolver`. + * Only works if the internal profiler is enabled with `World.profilerEnabled = true`. + */ + public timingVelocityAssembly(): number { + return this.physicsPipeline.raw.timing_velocity_assembly(); + } + + /** + * The time spent in milliseconds by the last step to run the constraint + * resolution. + * + * This timing is included in `timingSolver`. + * Only works if the internal profiler is enabled with `World.profilerEnabled = true`. + */ + public timingVelocityResolution(): number { + return this.physicsPipeline.raw.timing_velocity_resolution(); + } + + /** + * The time spent in milliseconds by the last step to run the rigid-body + * velocity update. + * + * This timing is included in `timingSolver`. + * Only works if the internal profiler is enabled with `World.profilerEnabled = true`. + */ + public timingVelocityUpdate(): number { + return this.physicsPipeline.raw.timing_velocity_update(); + } + + /** + * The time spent in milliseconds by writing rigid-body velocities + * calculated by the solver back into the rigid-bodies. + * + * This timing is included in `timingSolver`. + * Only works if the internal profiler is enabled with `World.profilerEnabled = true`. + */ + public timingVelocityWriteback(): number { + return this.physicsPipeline.raw.timing_velocity_writeback(); + } + + /** + * The total time spent in CCD detection and resolution. + * + * Only works if the internal profiler is enabled with `World.profilerEnabled = true`. + */ + public timingCcd(): number { + return this.physicsPipeline.raw.timing_ccd(); + } + + /** + * The total time spent searching for the continuous hits during CCD. + * + * This timing is included in `timingCcd`. + * Only works if the internal profiler is enabled with `World.profilerEnabled = true`. + */ + public timingCcdToiComputation(): number { + return this.physicsPipeline.raw.timing_ccd_toi_computation(); + } + + /** + * The total time spent in the broad-phase during CCD. + * + * This timing is included in `timingCcd`. + * Only works if the internal profiler is enabled with `World.profilerEnabled = true`. + */ + public timingCcdBroadPhase(): number { + return this.physicsPipeline.raw.timing_ccd_broad_phase(); + } + + /** + * The total time spent in the narrow-phase during CCD. + * + * This timing is included in `timingCcd`. + * Only works if the internal profiler is enabled with `World.profilerEnabled = true`. + */ + public timingCcdNarrowPhase(): number { + return this.physicsPipeline.raw.timing_ccd_narrow_phase(); + } + + /** + * The total time spent in the constraints resolution during CCD. + * + * This timing is included in `timingCcd`. + * Only works if the internal profiler is enabled with `World.profilerEnabled = true`. + */ + public timingCcdSolver(): number { + return this.physicsPipeline.raw.timing_ccd_solver(); + } + + /** + * The total time spent in the islands calculation during CCD. + * + * Only works if the internal profiler is enabled with `World.profilerEnabled = true`. + */ + public timingIslandConstruction(): number { + return this.physicsPipeline.raw.timing_island_construction(); + } + + /** + * The total time spent propagating detected user changes. + * + * Only works if the internal profiler is enabled with `World.profilerEnabled = true`. + */ + public timingUserChanges(): number { + return this.physicsPipeline.raw.timing_user_changes(); + } } diff --git a/src/control/character_controller.rs b/src/control/character_controller.rs index 9ced7db8..03cbdc5d 100644 --- a/src/control/character_controller.rs +++ b/src/control/character_controller.rs @@ -179,7 +179,7 @@ impl RawKinematicCharacterController { }) .unwrap_or(0.0); - let query_pipeline = broad_phase.0.as_query_pipeline_mut( + let mut query_pipeline = broad_phase.0.as_query_pipeline_mut( narrow_phase.0.query_dispatcher(), &mut bodies.0, &mut colliders.0, @@ -200,7 +200,7 @@ impl RawKinematicCharacterController { if apply_impulses_to_dynamic_bodies { self.controller.solve_character_collision_impulses( dt, - query_pipeline, + &mut query_pipeline, &*collider_shape, character_mass, self.events.iter(), diff --git a/src/geometry/broad_phase.rs b/src/geometry/broad_phase.rs index 218a1cde..6f81a862 100644 --- a/src/geometry/broad_phase.rs +++ b/src/geometry/broad_phase.rs @@ -147,7 +147,7 @@ impl RawBroadPhase { query_filter, ); - for (handle, _, inter) in query_pipeline.intersect_ray(&ray, maxToi, solid) { + for (handle, _, inter) in query_pipeline.intersect_ray(ray, maxToi, solid) { if !rcallback(handle, inter) { break; } @@ -189,7 +189,7 @@ impl RawBroadPhase { let pos = Isometry::from_parts(shapePos.0.into(), shapeRot.0); // TODO: take a callback as argument so we can yield all the intersecting shapes? - for (handle, _) in query_pipeline.intersect_shape(&pos, &*shape.0) { + for (handle, _) in query_pipeline.intersect_shape(pos, &*shape.0) { // Return the first intersection we find. return Some(utils::flat_handle(handle.0)); } @@ -316,7 +316,7 @@ impl RawBroadPhase { Ok(val) => val.as_bool().unwrap_or(true), }; - for (handle, _) in query_pipeline.intersect_point(&point.0.into()) { + for (handle, _) in query_pipeline.intersect_point(point.0.into()) { if !rcallback(handle) { break; } @@ -418,7 +418,7 @@ impl RawBroadPhase { }; let pos = Isometry::from_parts(shapePos.0.into(), shapeRot.0); - for (handle, _) in query_pipeline.intersect_shape(&pos, &*shape.0) { + for (handle, _) in query_pipeline.intersect_shape(pos, &*shape.0) { if !rcallback(handle) { break; } @@ -453,7 +453,7 @@ impl RawBroadPhase { let center = Point::from(aabbCenter.0); let aabb = Aabb::new(center - aabbHalfExtents.0, center + aabbHalfExtents.0); - for (handle, _) in query_pipeline.intersect_aabb_conservative(&aabb) { + for (handle, _) in query_pipeline.intersect_aabb_conservative(aabb) { if !rcallback(&handle) { break; } diff --git a/src/pipeline/event_queue.rs b/src/pipeline/event_queue.rs index 5f647cc9..fb6034d9 100644 --- a/src/pipeline/event_queue.rs +++ b/src/pipeline/event_queue.rs @@ -1,9 +1,9 @@ use crate::math::RawVector; use crate::utils; use crate::utils::FlatHandle; -use rapier::crossbeam::channel::Receiver; use rapier::geometry::{CollisionEvent, ContactForceEvent}; use rapier::pipeline::ChannelEventCollector; +use std::sync::mpsc::Receiver; use wasm_bindgen::prelude::*; /// A structure responsible for collecting events generated @@ -78,8 +78,8 @@ impl RawEventQueue { /// RAM if no drain is performed. #[wasm_bindgen(constructor)] pub fn new(autoDrain: bool) -> Self { - let collision_channel = rapier::crossbeam::channel::unbounded(); - let contact_force_channel = rapier::crossbeam::channel::unbounded(); + let collision_channel = std::sync::mpsc::channel(); + let contact_force_channel = std::sync::mpsc::channel(); let collector = ChannelEventCollector::new(collision_channel.0, contact_force_channel.0); Self { diff --git a/src/pipeline/physics_pipeline.rs b/src/pipeline/physics_pipeline.rs index 81b492f4..287cfeea 100644 --- a/src/pipeline/physics_pipeline.rs +++ b/src/pipeline/physics_pipeline.rs @@ -15,7 +15,85 @@ pub struct RawPhysicsPipeline(pub(crate) PhysicsPipeline); impl RawPhysicsPipeline { #[wasm_bindgen(constructor)] pub fn new() -> Self { - RawPhysicsPipeline(PhysicsPipeline::new()) + let mut pipeline = PhysicsPipeline::new(); + pipeline.counters.disable(); // Disable perf counters by default. + RawPhysicsPipeline(pipeline) + } + + pub fn set_profiler_enabled(&mut self, enabled: bool) { + if enabled { + self.0.counters.enable(); + } else { + self.0.counters.disable(); + } + } + + pub fn is_profiler_enabled(&self) -> bool { + self.0.counters.enabled() + } + + pub fn timing_step(&self) -> f64 { + self.0.counters.step_time_ms() + } + + pub fn timing_collision_detection(&self) -> f64 { + self.0.counters.collision_detection_time_ms() + } + + pub fn timing_broad_phase(&self) -> f64 { + self.0.counters.broad_phase_time_ms() + } + + pub fn timing_narrow_phase(&self) -> f64 { + self.0.counters.narrow_phase_time_ms() + } + + pub fn timing_solver(&self) -> f64 { + self.0.counters.solver_time_ms() + } + + pub fn timing_velocity_assembly(&self) -> f64 { + self.0.counters.solver.velocity_assembly_time.time_ms() + } + + pub fn timing_velocity_resolution(&self) -> f64 { + self.0.counters.velocity_resolution_time_ms() + } + + pub fn timing_velocity_update(&self) -> f64 { + self.0.counters.velocity_update_time_ms() + } + + pub fn timing_velocity_writeback(&self) -> f64 { + self.0.counters.solver.velocity_writeback_time.time_ms() + } + + pub fn timing_ccd(&self) -> f64 { + self.0.counters.ccd_time_ms() + } + + pub fn timing_ccd_toi_computation(&self) -> f64 { + self.0.counters.ccd.toi_computation_time.time_ms() + } + + pub fn timing_ccd_broad_phase(&self) -> f64 { + self.0.counters.ccd.broad_phase_time.time_ms() + } + + pub fn timing_ccd_narrow_phase(&self) -> f64 { + self.0.counters.ccd.narrow_phase_time.time_ms() + } + + pub fn timing_ccd_solver(&self) -> f64 { + self.0.counters.ccd.solver_time.time_ms() + } + + pub fn timing_island_construction(&self) -> f64 { + self.0.counters.island_construction_time_ms() + } + + pub fn timing_user_changes(&self) -> f64 { + self.0.counters.stages.user_changes.time_ms() } pub fn step( diff --git a/testbed3d/src/Gui.ts b/testbed3d/src/Gui.ts index a410607e..e89b2f47 100644 --- a/testbed3d/src/Gui.ts +++ b/testbed3d/src/Gui.ts @@ -8,6 +8,23 @@ export interface DebugInfos { worldHash: string; worldHashTime: number; snapshotTime: number; + + timingStep: number; + timingCollisionDetection: number; + timingBroadPhase: number; + timingNarrowPhase: number; + timingSolver: number; + timingVelocityAssembly: number; + timingVelocityResolution: number; + timingVelocityUpdate: number; + timingVelocityWriteback: number; + timingCcd: number; + timingCcdToiComputation: number; + timingCcdBroadPhase: number; + timingCcdNarrowPhase: number; + timingCcdSolver: number; + timingIslandConstruction: number; + timingUserChanges: number; } export class Gui { @@ -96,6 +113,43 @@ export class Gui { "ms"; text += "
Snapshot time: " + infos.snapshotTime + "ms"; } + + text += "
timingStep: " + infos.timingStep + "ms"; + text += + "
timingCollisionDetection: " + + infos.timingCollisionDetection + + "ms"; + text += "
timingBroadPhase: " + infos.timingBroadPhase + "ms"; + text += "
timingNarrowPhase: " + infos.timingNarrowPhase + "ms"; + text += "
timingSolver: " + infos.timingSolver + "ms"; + text += + "
timingVelocityAssembly: " + + infos.timingVelocityAssembly + + "ms"; + text += + "
timingVelocityResolution: " + + infos.timingVelocityResolution + + "ms"; + text += + "
timingVelocityUpdate: " + infos.timingVelocityUpdate + "ms"; + text += + "
timingVelocityWriteback: " + + infos.timingVelocityWriteback + + "ms"; + text += "
timingCcd: " + infos.timingCcd + "ms"; + text += + "
timingCcdToiComputation: " + + infos.timingCcdToiComputation + + "ms"; + text += "
timingCcdBroadPhase: " + infos.timingCcdBroadPhase + "ms"; + text += + "
timingCcdNarrowPhase: " + infos.timingCcdNarrowPhase + "ms"; + text += "
timingCcdSolver: " + infos.timingCcdSolver + "ms"; + text += + "
timingIslandConstruction: " + + infos.timingIslandConstruction + + "ms"; + text += "
timingUserChanges: " + infos.timingUserChanges + "ms"; this.debugText.innerHTML = text; } diff --git a/testbed3d/src/Testbed.ts b/testbed3d/src/Testbed.ts index 7e7f40f6..5d3afd88 100644 --- a/testbed3d/src/Testbed.ts +++ b/testbed3d/src/Testbed.ts @@ -163,6 +163,27 @@ export class Testbed { worldHash: "", worldHashTime: 0, snapshotTime: 0, + timingStep: this.world.timingStep(), + timingCollisionDetection: + this.world.timingCollisionDetection(), + timingBroadPhase: this.world.timingBroadPhase(), + timingNarrowPhase: this.world.timingNarrowPhase(), + timingSolver: this.world.timingSolver(), + timingVelocityAssembly: this.world.timingVelocityAssembly(), + timingVelocityResolution: + this.world.timingVelocityResolution(), + timingVelocityUpdate: this.world.timingVelocityUpdate(), + timingVelocityWriteback: + this.world.timingVelocityWriteback(), + timingCcd: this.world.timingCcd(), + timingCcdToiComputation: + this.world.timingCcdToiComputation(), + timingCcdBroadPhase: this.world.timingCcdBroadPhase(), + timingCcdNarrowPhase: this.world.timingCcdNarrowPhase(), + timingCcdSolver: this.world.timingCcdSolver(), + timingIslandConstruction: + this.world.timingIslandConstruction(), + timingUserChanges: this.world.timingUserChanges(), }; t0 = performance.now(); xxhash128(snapshot).then((hash) => {