diff --git a/CHANGELOG.md b/CHANGELOG.md index fba6c0e8..f0ee7625 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,15 @@ -### Unreleased +### 0.12.0 (2024-01-28) + +The main highlight of this release is the implementation of a new non-linear constraints solver for better stability +and increased convergence rates. See [#579](https://github.com/dimforge/rapier/pull/579) for additional information. + +In order to adjust the number of iterations of the new solver, simply adjust `World.numSolverIterations`. +If recovering the old solver behavior is useful to you, call `World.switchToStandardPgsSolver()`. + +It is now possible to specify some additional solver iteration for specific rigid-bodies (and everything interacting +with it directly or indirectly through contacts and joints): `RigidBodyDesc.additionalSolverIterations` and +`RigidBody::setAdditionalSolverIterations`. This allows for higher-accuracy on subsets of the physics scene +without affecting performance of the other parts of the simulation. #### Modified @@ -9,6 +20,7 @@ #### Added - Added `DynamicRayCastVehicleController` to simulate vehicles based on ray-casting. +- Added `JointData.generic` (3D only) to create a generic 6-dof joint and manually specify the locked axes. ### 0.11.2 @@ -22,9 +34,17 @@ #### Added +- Add `JointData.spring` and `JointData.rope` joints. - Add access to the mass-properties of a rigid-body: `RigidBody.effectiveInvMass`, `.invMass()`, `.localCom()`, `.worldCom()`, `.invPrincipalInertiaSqrt()`, `.principalInertia()`, `.principalInertiaLocalFrame()`, `.effectiveWorldInvInertiaSqrt()`, `.effectiveAngularInertia()`. +- Add `DynamicRayCastVehicleController.siteFrictionStiffness` to customize the side friction applied to the vehicle + controller’s wheel. + +#### Modified + +- Rename `World.contactsWith` to `World.contactPairsWith`. +- Rename `World.intersectionsWith` to `World.intersectionPairsWith`. ### 0.11.1 (2023-01-16) diff --git a/Cargo.lock b/Cargo.lock index 0b913b15..18af67af 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -137,7 +137,7 @@ dependencies = [ [[package]] name = "dimforge_rapier2d" -version = "0.11.2" +version = "0.12.0" dependencies = [ "bincode", "crossbeam-channel", @@ -153,7 +153,7 @@ dependencies = [ [[package]] name = "dimforge_rapier3d" -version = "0.11.2" +version = "0.12.0" dependencies = [ "bincode", "crossbeam-channel", @@ -307,9 +307,9 @@ dependencies = [ [[package]] name = "num-derive" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e6a0fd4f737c707bd9086cc16c925f294943eb62eb71499e9fd4cf71f8b9f4e" +checksum = "cfb77679af88f8b125209d354a202862602672222e7f2313fdd6dc349bad4712" dependencies = [ "proc-macro2", "quote", @@ -512,8 +512,7 @@ checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" [[package]] name = "rapier2d" -version = "0.17.2" -source = "git+https://github.com/dimforge/rapier?rev=82416e3ca66dcdc34c0f350cec570ef1019a199f#82416e3ca66dcdc34c0f350cec570ef1019a199f" +version = "0.18.0" dependencies = [ "approx", "arrayvec", @@ -523,7 +522,7 @@ dependencies = [ "downcast-rs", "instant", "nalgebra", - "num-derive 0.4.0", + "num-derive 0.4.1", "num-traits", "parry2d", "rustc-hash", @@ -533,8 +532,7 @@ dependencies = [ [[package]] name = "rapier3d" -version = "0.17.2" -source = "git+https://github.com/dimforge/rapier?rev=82416e3ca66dcdc34c0f350cec570ef1019a199f#82416e3ca66dcdc34c0f350cec570ef1019a199f" +version = "0.18.0" dependencies = [ "approx", "arrayvec", @@ -544,7 +542,7 @@ dependencies = [ "downcast-rs", "instant", "nalgebra", - "num-derive 0.4.0", + "num-derive 0.4.1", "num-traits", "parry3d", "rustc-hash", @@ -717,9 +715,9 @@ checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "wasm-bindgen" -version = "0.2.87" +version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" +checksum = "b1223296a201415c7fad14792dbefaace9bd52b62d33453ade1c5b5f07555406" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -727,9 +725,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.87" +version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" +checksum = "fcdc935b63408d58a32f8cc9738a0bffd8f05cc7c002086c6ef20b7312ad9dcd" dependencies = [ "bumpalo", "log", @@ -742,9 +740,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.87" +version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" +checksum = "3e4c238561b2d428924c49815533a8b9121c664599558a5d9ec51f8a1740a999" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -752,9 +750,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.87" +version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" +checksum = "bae1abb6806dc1ad9e560ed242107c0f6c84335f1749dd4e8ddb012ebd5e25a7" dependencies = [ "proc-macro2", "quote", @@ -765,9 +763,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.87" +version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" +checksum = "4d91413b1c31d7539ba5ef2451af3f0b833a005eb27a631cec32bc0635a8602b" [[package]] name = "web-sys" diff --git a/Cargo.toml b/Cargo.toml index aa3064fe..5ba3dc1d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,7 +15,7 @@ codegen-units = 1 #simba = { path = "../simba" } #nalgebra = { git = "https://github.com/dimforge/nalgebra", branch = "dev" } -rapier2d = { git = "https://github.com/dimforge/rapier", rev = "82416e3ca66dcdc34c0f350cec570ef1019a199f" } -rapier3d = { git = "https://github.com/dimforge/rapier", rev = "82416e3ca66dcdc34c0f350cec570ef1019a199f" } +#rapier2d = { git = "https://github.com/dimforge/rapier", rev = "82416e3ca66dcdc34c0f350cec570ef1019a199f" } +#rapier3d = { git = "https://github.com/dimforge/rapier", rev = "82416e3ca66dcdc34c0f350cec570ef1019a199f" } #parry2d = { git = "https://github.com/dimforge/parry" } #parry3d = { git = "https://github.com/dimforge/parry" } diff --git a/README.md b/README.md index 454d60da..c4c638cd 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,9 @@

- Website | Documentation + Website | Documentation | + 2D examples (sources) | + 3D examples (sources)

--- diff --git a/package-lock.json b/package-lock.json index f4775614..b61a7977 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,17 +8,17 @@ "prettier": "2.7.1", "typedoc": "0.23.19", "typescript": "4.8.4", - "wasm-opt": "1.3.0", - "wasm-pack": "0.10.3" + "wasm-opt": "1.4.0", + "wasm-pack": "0.12.1" } }, "node_modules/axios": { - "version": "0.21.4", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz", - "integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==", + "version": "0.26.1", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.26.1.tgz", + "integrity": "sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==", "dev": true, "dependencies": { - "follow-redirects": "^1.14.0" + "follow-redirects": "^1.14.8" } }, "node_modules/balanced-match": { @@ -28,14 +28,14 @@ "dev": true }, "node_modules/binary-install": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/binary-install/-/binary-install-0.1.1.tgz", - "integrity": "sha512-DqED0D/6LrS+BHDkKn34vhRqOGjy5gTMgvYZsGK2TpNbdPuz4h+MRlNgGv5QBRd7pWq/jylM4eKNCizgAq3kNQ==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/binary-install/-/binary-install-1.1.0.tgz", + "integrity": "sha512-rkwNGW+3aQVSZoD0/o3mfPN6Yxh3Id0R/xzTVBVVpGNlVz8EGwusksxRlbk/A5iKTZt9zkMn3qIqmAt3vpfbzg==", "dev": true, "dependencies": { - "axios": "^0.21.1", + "axios": "^0.26.1", "rimraf": "^3.0.2", - "tar": "^6.1.0" + "tar": "^6.1.11" }, "engines": { "node": ">=10" @@ -63,13 +63,13 @@ "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", "dev": true }, "node_modules/follow-redirects": { - "version": "1.15.1", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.1.tgz", - "integrity": "sha512-yLAMQs+k0b2m7cVxpS1VKJVvoz7SS9Td1zss3XRwXj+ZDH00RJgnuLx7E44wx02kQLrdM3aOOy+FpzS7+8OizA==", + "version": "1.15.5", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.5.tgz", + "integrity": "sha512-vSFWUON1B+yAw1VN4xMfxgn5fTUiaOzAJCKBwIIgT/+7CuGy9+r+5gITvP62j3RmaD5Ph65UaERdOSRGUzZtgw==", "dev": true, "funding": [ { @@ -101,19 +101,19 @@ "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", "dev": true }, "node_modules/glob": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", - "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", "dev": true, "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", - "minimatch": "^3.0.4", + "minimatch": "^3.1.1", "once": "^1.3.0", "path-is-absolute": "^1.0.0" }, @@ -127,7 +127,7 @@ "node_modules/inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", "dev": true, "dependencies": { "once": "^1.3.0", @@ -214,9 +214,9 @@ } }, "node_modules/node-fetch": { - "version": "2.6.7", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", - "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", "dev": true, "dependencies": { "whatwg-url": "^5.0.0" @@ -236,7 +236,7 @@ "node_modules/once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", "dev": true, "dependencies": { "wrappy": "1" @@ -245,7 +245,7 @@ "node_modules/path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", "dev": true, "engines": { "node": ">=0.10.0" @@ -293,26 +293,35 @@ } }, "node_modules/tar": { - "version": "6.1.11", - "resolved": "https://registry.npmjs.org/tar/-/tar-6.1.11.tgz", - "integrity": "sha512-an/KZQzQUkZCkuoAA64hM92X0Urb6VpRhAFllDzz44U2mcD5scmT3zBc4VgVpkugF580+DQn8eAFSyoQt0tznA==", + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/tar/-/tar-6.2.0.tgz", + "integrity": "sha512-/Wo7DcT0u5HUV486xg675HtjNd3BXZ6xDbzsCUZPt5iw8bTQ63bP0Raut3mvro9u+CUyq7YQd8Cx55fsZXxqLQ==", "dev": true, "dependencies": { "chownr": "^2.0.0", "fs-minipass": "^2.0.0", - "minipass": "^3.0.0", + "minipass": "^5.0.0", "minizlib": "^2.1.1", "mkdirp": "^1.0.3", "yallist": "^4.0.0" }, "engines": { - "node": ">= 10" + "node": ">=10" + } + }, + "node_modules/tar/node_modules/minipass": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz", + "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==", + "dev": true, + "engines": { + "node": ">=8" } }, "node_modules/tr46": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", "dev": true }, "node_modules/typedoc": { @@ -383,27 +392,27 @@ "dev": true }, "node_modules/wasm-opt": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/wasm-opt/-/wasm-opt-1.3.0.tgz", - "integrity": "sha512-24+IOboX4Sav0bI8Krwf0Y6dnpN4KxYtqpl0qWt86qVLsmayUqx1KMBrJTlQWNC+/dsqzQJjK6QvxNJsZYOgJg==", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/wasm-opt/-/wasm-opt-1.4.0.tgz", + "integrity": "sha512-wIsxxp0/FOSphokH4VOONy1zPkVREQfALN+/JTvJPK8gFSKbsmrcfECu2hT7OowqPfb4WEMSMceHgNL0ipFRyw==", "dev": true, "hasInstallScript": true, "dependencies": { - "node-fetch": "^2.6.7", - "tar": "^6.1.11" + "node-fetch": "^2.6.9", + "tar": "^6.1.13" }, "bin": { "wasm-opt": "bin/wasm-opt.js" } }, "node_modules/wasm-pack": { - "version": "0.10.3", - "resolved": "https://registry.npmjs.org/wasm-pack/-/wasm-pack-0.10.3.tgz", - "integrity": "sha512-dg1PPyp+QwWrhfHsgG12K/y5xzwfaAoK1yuVC/DUAuQsDy5JywWDuA7Y/ionGwQz+JBZVw8jknaKBnaxaJfwTA==", + "version": "0.12.1", + "resolved": "https://registry.npmjs.org/wasm-pack/-/wasm-pack-0.12.1.tgz", + "integrity": "sha512-dIyKWUumPFsGohdndZjDXRFaokUT/kQS+SavbbiXVAvA/eN4riX5QNdB6AhXQx37zNxluxQkuixZUgJ8adKjOg==", "dev": true, "hasInstallScript": true, "dependencies": { - "binary-install": "^0.1.0" + "binary-install": "^1.0.1" }, "bin": { "wasm-pack": "run.js" @@ -412,13 +421,13 @@ "node_modules/webidl-conversions": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", "dev": true }, "node_modules/whatwg-url": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", - "integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0=", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", "dev": true, "dependencies": { "tr46": "~0.0.3", @@ -428,7 +437,7 @@ "node_modules/wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", "dev": true }, "node_modules/yallist": { @@ -440,12 +449,12 @@ }, "dependencies": { "axios": { - "version": "0.21.4", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz", - "integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==", + "version": "0.26.1", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.26.1.tgz", + "integrity": "sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==", "dev": true, "requires": { - "follow-redirects": "^1.14.0" + "follow-redirects": "^1.14.8" } }, "balanced-match": { @@ -455,14 +464,14 @@ "dev": true }, "binary-install": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/binary-install/-/binary-install-0.1.1.tgz", - "integrity": "sha512-DqED0D/6LrS+BHDkKn34vhRqOGjy5gTMgvYZsGK2TpNbdPuz4h+MRlNgGv5QBRd7pWq/jylM4eKNCizgAq3kNQ==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/binary-install/-/binary-install-1.1.0.tgz", + "integrity": "sha512-rkwNGW+3aQVSZoD0/o3mfPN6Yxh3Id0R/xzTVBVVpGNlVz8EGwusksxRlbk/A5iKTZt9zkMn3qIqmAt3vpfbzg==", "dev": true, "requires": { - "axios": "^0.21.1", + "axios": "^0.26.1", "rimraf": "^3.0.2", - "tar": "^6.1.0" + "tar": "^6.1.11" } }, "brace-expansion": { @@ -484,13 +493,13 @@ "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", "dev": true }, "follow-redirects": { - "version": "1.15.1", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.1.tgz", - "integrity": "sha512-yLAMQs+k0b2m7cVxpS1VKJVvoz7SS9Td1zss3XRwXj+ZDH00RJgnuLx7E44wx02kQLrdM3aOOy+FpzS7+8OizA==", + "version": "1.15.5", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.5.tgz", + "integrity": "sha512-vSFWUON1B+yAw1VN4xMfxgn5fTUiaOzAJCKBwIIgT/+7CuGy9+r+5gITvP62j3RmaD5Ph65UaERdOSRGUzZtgw==", "dev": true }, "fs-minipass": { @@ -505,19 +514,19 @@ "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", "dev": true }, "glob": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", - "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", "dev": true, "requires": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", - "minimatch": "^3.0.4", + "minimatch": "^3.1.1", "once": "^1.3.0", "path-is-absolute": "^1.0.0" } @@ -525,7 +534,7 @@ "inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", "dev": true, "requires": { "once": "^1.3.0", @@ -591,9 +600,9 @@ "dev": true }, "node-fetch": { - "version": "2.6.7", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", - "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", "dev": true, "requires": { "whatwg-url": "^5.0.0" @@ -602,7 +611,7 @@ "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", "dev": true, "requires": { "wrappy": "1" @@ -611,7 +620,7 @@ "path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", "dev": true }, "prettier": { @@ -641,23 +650,31 @@ } }, "tar": { - "version": "6.1.11", - "resolved": "https://registry.npmjs.org/tar/-/tar-6.1.11.tgz", - "integrity": "sha512-an/KZQzQUkZCkuoAA64hM92X0Urb6VpRhAFllDzz44U2mcD5scmT3zBc4VgVpkugF580+DQn8eAFSyoQt0tznA==", + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/tar/-/tar-6.2.0.tgz", + "integrity": "sha512-/Wo7DcT0u5HUV486xg675HtjNd3BXZ6xDbzsCUZPt5iw8bTQ63bP0Raut3mvro9u+CUyq7YQd8Cx55fsZXxqLQ==", "dev": true, "requires": { "chownr": "^2.0.0", "fs-minipass": "^2.0.0", - "minipass": "^3.0.0", + "minipass": "^5.0.0", "minizlib": "^2.1.1", "mkdirp": "^1.0.3", "yallist": "^4.0.0" + }, + "dependencies": { + "minipass": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz", + "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==", + "dev": true + } } }, "tr46": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=", + "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", "dev": true }, "typedoc": { @@ -711,34 +728,34 @@ "dev": true }, "wasm-opt": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/wasm-opt/-/wasm-opt-1.3.0.tgz", - "integrity": "sha512-24+IOboX4Sav0bI8Krwf0Y6dnpN4KxYtqpl0qWt86qVLsmayUqx1KMBrJTlQWNC+/dsqzQJjK6QvxNJsZYOgJg==", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/wasm-opt/-/wasm-opt-1.4.0.tgz", + "integrity": "sha512-wIsxxp0/FOSphokH4VOONy1zPkVREQfALN+/JTvJPK8gFSKbsmrcfECu2hT7OowqPfb4WEMSMceHgNL0ipFRyw==", "dev": true, "requires": { - "node-fetch": "^2.6.7", - "tar": "^6.1.11" + "node-fetch": "^2.6.9", + "tar": "^6.1.13" } }, "wasm-pack": { - "version": "0.10.3", - "resolved": "https://registry.npmjs.org/wasm-pack/-/wasm-pack-0.10.3.tgz", - "integrity": "sha512-dg1PPyp+QwWrhfHsgG12K/y5xzwfaAoK1yuVC/DUAuQsDy5JywWDuA7Y/ionGwQz+JBZVw8jknaKBnaxaJfwTA==", + "version": "0.12.1", + "resolved": "https://registry.npmjs.org/wasm-pack/-/wasm-pack-0.12.1.tgz", + "integrity": "sha512-dIyKWUumPFsGohdndZjDXRFaokUT/kQS+SavbbiXVAvA/eN4riX5QNdB6AhXQx37zNxluxQkuixZUgJ8adKjOg==", "dev": true, "requires": { - "binary-install": "^0.1.0" + "binary-install": "^1.0.1" } }, "webidl-conversions": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=", + "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", "dev": true }, "whatwg-url": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", - "integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0=", + "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", "dev": true, "requires": { "tr46": "~0.0.3", @@ -748,7 +765,7 @@ "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", "dev": true }, "yallist": { diff --git a/package.json b/package.json index 72b08162..ce0eec04 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "prettier": "2.7.1", "typedoc": "0.23.19", "typescript": "4.8.4", - "wasm-opt": "1.3.0", - "wasm-pack": "0.10.3" + "wasm-opt": "1.4.0", + "wasm-pack": "0.12.1" } } diff --git a/rapier2d/Cargo.toml b/rapier2d/Cargo.toml index de00dc3e..3cf58e52 100644 --- a/rapier2d/Cargo.toml +++ b/rapier2d/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "dimforge_rapier2d" # Can't be named rapier2d which conflicts with the dependency. -version = "0.11.2" +version = "0.12.0" authors = ["Sébastien Crozet "] description = "2-dimensional physics engine in Rust - official JS bindings." documentation = "https://rapier.rs/rustdoc/rapier2d/index.html" @@ -23,9 +23,9 @@ required-features = ["dim2"] [dependencies] -rapier2d = { version = "^0.17.2", features = ["wasm-bindgen", "serde-serialize", "enhanced-determinism", "debug-render"] } +rapier2d = { version = "0.18.0", features = ["wasm-bindgen", "serde-serialize", "enhanced-determinism", "debug-render"] } ref-cast = "1" -wasm-bindgen = "^0.2.82" +wasm-bindgen = "0.2.90" js-sys = "0.3" nalgebra = "0.32" serde = { version = "1", features = ["derive", "rc"] } diff --git a/rapier2d/package-lock.json b/rapier2d/package-lock.json index 9867d021..96682827 100644 --- a/rapier2d/package-lock.json +++ b/rapier2d/package-lock.json @@ -5,43 +5,111 @@ "packages": { "": { "name": "@dimforge/rapier2d", + "dependencies": { + "wasm-pack": "^0.12.1" + }, "devDependencies": { "rimraf": "^3.0.2" } }, + "node_modules/axios": { + "version": "0.26.1", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.26.1.tgz", + "integrity": "sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==", + "dependencies": { + "follow-redirects": "^1.14.8" + } + }, "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + }, + "node_modules/binary-install": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/binary-install/-/binary-install-1.1.0.tgz", + "integrity": "sha512-rkwNGW+3aQVSZoD0/o3mfPN6Yxh3Id0R/xzTVBVVpGNlVz8EGwusksxRlbk/A5iKTZt9zkMn3qIqmAt3vpfbzg==", + "dependencies": { + "axios": "^0.26.1", + "rimraf": "^3.0.2", + "tar": "^6.1.11" + }, + "engines": { + "node": ">=10" + } }, "node_modules/brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, + "node_modules/chownr": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz", + "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==", + "engines": { + "node": ">=10" + } + }, "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", - "dev": true + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" + }, + "node_modules/follow-redirects": { + "version": "1.15.5", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.5.tgz", + "integrity": "sha512-vSFWUON1B+yAw1VN4xMfxgn5fTUiaOzAJCKBwIIgT/+7CuGy9+r+5gITvP62j3RmaD5Ph65UaERdOSRGUzZtgw==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, + "node_modules/fs-minipass": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz", + "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==", + "dependencies": { + "minipass": "^3.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/fs-minipass/node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } }, "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", - "dev": true + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" }, "node_modules/glob": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "dev": true, "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -61,7 +129,6 @@ "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", - "dev": true, "dependencies": { "once": "^1.3.0", "wrappy": "1" @@ -70,14 +137,12 @@ "node_modules/inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, "node_modules/minimatch": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, "dependencies": { "brace-expansion": "^1.1.7" }, @@ -85,11 +150,52 @@ "node": "*" } }, + "node_modules/minipass": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz", + "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/minizlib": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz", + "integrity": "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==", + "dependencies": { + "minipass": "^3.0.0", + "yallist": "^4.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/minizlib/node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "bin": { + "mkdirp": "bin/cmd.js" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", - "dev": true, "dependencies": { "wrappy": "1" } @@ -98,7 +204,6 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", - "dev": true, "engines": { "node": ">=0.10.0" } @@ -107,7 +212,6 @@ "version": "3.0.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", - "dev": true, "dependencies": { "glob": "^7.1.3" }, @@ -118,47 +222,120 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/tar": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/tar/-/tar-6.2.0.tgz", + "integrity": "sha512-/Wo7DcT0u5HUV486xg675HtjNd3BXZ6xDbzsCUZPt5iw8bTQ63bP0Raut3mvro9u+CUyq7YQd8Cx55fsZXxqLQ==", + "dependencies": { + "chownr": "^2.0.0", + "fs-minipass": "^2.0.0", + "minipass": "^5.0.0", + "minizlib": "^2.1.1", + "mkdirp": "^1.0.3", + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/wasm-pack": { + "version": "0.12.1", + "resolved": "https://registry.npmjs.org/wasm-pack/-/wasm-pack-0.12.1.tgz", + "integrity": "sha512-dIyKWUumPFsGohdndZjDXRFaokUT/kQS+SavbbiXVAvA/eN4riX5QNdB6AhXQx37zNxluxQkuixZUgJ8adKjOg==", + "hasInstallScript": true, + "dependencies": { + "binary-install": "^1.0.1" + }, + "bin": { + "wasm-pack": "run.js" + } + }, "node_modules/wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", - "dev": true + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" + }, + "node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" } }, "dependencies": { + "axios": { + "version": "0.26.1", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.26.1.tgz", + "integrity": "sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==", + "requires": { + "follow-redirects": "^1.14.8" + } + }, "balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + }, + "binary-install": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/binary-install/-/binary-install-1.1.0.tgz", + "integrity": "sha512-rkwNGW+3aQVSZoD0/o3mfPN6Yxh3Id0R/xzTVBVVpGNlVz8EGwusksxRlbk/A5iKTZt9zkMn3qIqmAt3vpfbzg==", + "requires": { + "axios": "^0.26.1", + "rimraf": "^3.0.2", + "tar": "^6.1.11" + } }, "brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, + "chownr": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz", + "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==" + }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", - "dev": true + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" + }, + "follow-redirects": { + "version": "1.15.5", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.5.tgz", + "integrity": "sha512-vSFWUON1B+yAw1VN4xMfxgn5fTUiaOzAJCKBwIIgT/+7CuGy9+r+5gITvP62j3RmaD5Ph65UaERdOSRGUzZtgw==" + }, + "fs-minipass": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz", + "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==", + "requires": { + "minipass": "^3.0.0" + }, + "dependencies": { + "minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "requires": { + "yallist": "^4.0.0" + } + } + } }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", - "dev": true + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" }, "glob": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "dev": true, "requires": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -172,7 +349,6 @@ "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", - "dev": true, "requires": { "once": "^1.3.0", "wrappy": "1" @@ -181,23 +357,49 @@ "inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, "minimatch": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, "requires": { "brace-expansion": "^1.1.7" } }, + "minipass": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz", + "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==" + }, + "minizlib": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz", + "integrity": "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==", + "requires": { + "minipass": "^3.0.0", + "yallist": "^4.0.0" + }, + "dependencies": { + "minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "requires": { + "yallist": "^4.0.0" + } + } + } + }, + "mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==" + }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", - "dev": true, "requires": { "wrappy": "1" } @@ -205,23 +407,46 @@ "path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", - "dev": true + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==" }, "rimraf": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", - "dev": true, "requires": { "glob": "^7.1.3" } }, + "tar": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/tar/-/tar-6.2.0.tgz", + "integrity": "sha512-/Wo7DcT0u5HUV486xg675HtjNd3BXZ6xDbzsCUZPt5iw8bTQ63bP0Raut3mvro9u+CUyq7YQd8Cx55fsZXxqLQ==", + "requires": { + "chownr": "^2.0.0", + "fs-minipass": "^2.0.0", + "minipass": "^5.0.0", + "minizlib": "^2.1.1", + "mkdirp": "^1.0.3", + "yallist": "^4.0.0" + } + }, + "wasm-pack": { + "version": "0.12.1", + "resolved": "https://registry.npmjs.org/wasm-pack/-/wasm-pack-0.12.1.tgz", + "integrity": "sha512-dIyKWUumPFsGohdndZjDXRFaokUT/kQS+SavbbiXVAvA/eN4riX5QNdB6AhXQx37zNxluxQkuixZUgJ8adKjOg==", + "requires": { + "binary-install": "^1.0.1" + } + }, "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", - "dev": true + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" + }, + "yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" } } } diff --git a/rapier2d/package.json b/rapier2d/package.json index 7baaae5d..f8b7e9eb 100644 --- a/rapier2d/package.json +++ b/rapier2d/package.json @@ -13,5 +13,8 @@ }, "devDependencies": { "rimraf": "^3.0.2" + }, + "dependencies": { + "wasm-pack": "^0.12.1" } } diff --git a/rapier3d/Cargo.toml b/rapier3d/Cargo.toml index dc2ddb8b..0d8bae1b 100644 --- a/rapier3d/Cargo.toml +++ b/rapier3d/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "dimforge_rapier3d" # Can't be named rapier3d which conflicts with the dependency. -version = "0.11.2" +version = "0.12.0" authors = ["Sébastien Crozet "] description = "3-dimensional physics engine in Rust - official JS bindings." documentation = "https://rapier.rs/rustdoc/rapier2d/index.html" @@ -23,9 +23,9 @@ required-features = ["dim3"] [dependencies] -rapier3d = { version = "^0.17.2", features = ["wasm-bindgen", "serde-serialize", "enhanced-determinism", "debug-render"] } +rapier3d = { version = "0.18.0", features = ["wasm-bindgen", "serde-serialize", "enhanced-determinism", "debug-render"] } ref-cast = "1" -wasm-bindgen = "^0.2.82" +wasm-bindgen = "^0.2.90" js-sys = "0.3" nalgebra = "0.32" serde = { version = "1", features = ["derive", "rc"] } diff --git a/rapier3d/package-lock.json b/rapier3d/package-lock.json index de8bd027..66ccbf0f 100644 --- a/rapier3d/package-lock.json +++ b/rapier3d/package-lock.json @@ -5,43 +5,111 @@ "packages": { "": { "name": "@dimforge/rapier3d", + "dependencies": { + "wasm-pack": "^0.12.1" + }, "devDependencies": { "rimraf": "^3.0.2" } }, + "node_modules/axios": { + "version": "0.26.1", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.26.1.tgz", + "integrity": "sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==", + "dependencies": { + "follow-redirects": "^1.14.8" + } + }, "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + }, + "node_modules/binary-install": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/binary-install/-/binary-install-1.1.0.tgz", + "integrity": "sha512-rkwNGW+3aQVSZoD0/o3mfPN6Yxh3Id0R/xzTVBVVpGNlVz8EGwusksxRlbk/A5iKTZt9zkMn3qIqmAt3vpfbzg==", + "dependencies": { + "axios": "^0.26.1", + "rimraf": "^3.0.2", + "tar": "^6.1.11" + }, + "engines": { + "node": ">=10" + } }, "node_modules/brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, + "node_modules/chownr": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz", + "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==", + "engines": { + "node": ">=10" + } + }, "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", - "dev": true + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" + }, + "node_modules/follow-redirects": { + "version": "1.15.5", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.5.tgz", + "integrity": "sha512-vSFWUON1B+yAw1VN4xMfxgn5fTUiaOzAJCKBwIIgT/+7CuGy9+r+5gITvP62j3RmaD5Ph65UaERdOSRGUzZtgw==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/RubenVerborgh" + } + ], + "engines": { + "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } + } + }, + "node_modules/fs-minipass": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz", + "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==", + "dependencies": { + "minipass": "^3.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/fs-minipass/node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } }, "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", - "dev": true + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" }, "node_modules/glob": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "dev": true, "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -61,7 +129,6 @@ "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", - "dev": true, "dependencies": { "once": "^1.3.0", "wrappy": "1" @@ -70,14 +137,12 @@ "node_modules/inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, "node_modules/minimatch": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, "dependencies": { "brace-expansion": "^1.1.7" }, @@ -85,11 +150,52 @@ "node": "*" } }, + "node_modules/minipass": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz", + "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/minizlib": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz", + "integrity": "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==", + "dependencies": { + "minipass": "^3.0.0", + "yallist": "^4.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/minizlib/node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "bin": { + "mkdirp": "bin/cmd.js" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", - "dev": true, "dependencies": { "wrappy": "1" } @@ -98,7 +204,6 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", - "dev": true, "engines": { "node": ">=0.10.0" } @@ -107,7 +212,6 @@ "version": "3.0.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", - "dev": true, "dependencies": { "glob": "^7.1.3" }, @@ -118,47 +222,120 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/tar": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/tar/-/tar-6.2.0.tgz", + "integrity": "sha512-/Wo7DcT0u5HUV486xg675HtjNd3BXZ6xDbzsCUZPt5iw8bTQ63bP0Raut3mvro9u+CUyq7YQd8Cx55fsZXxqLQ==", + "dependencies": { + "chownr": "^2.0.0", + "fs-minipass": "^2.0.0", + "minipass": "^5.0.0", + "minizlib": "^2.1.1", + "mkdirp": "^1.0.3", + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/wasm-pack": { + "version": "0.12.1", + "resolved": "https://registry.npmjs.org/wasm-pack/-/wasm-pack-0.12.1.tgz", + "integrity": "sha512-dIyKWUumPFsGohdndZjDXRFaokUT/kQS+SavbbiXVAvA/eN4riX5QNdB6AhXQx37zNxluxQkuixZUgJ8adKjOg==", + "hasInstallScript": true, + "dependencies": { + "binary-install": "^1.0.1" + }, + "bin": { + "wasm-pack": "run.js" + } + }, "node_modules/wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", - "dev": true + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" + }, + "node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" } }, "dependencies": { + "axios": { + "version": "0.26.1", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.26.1.tgz", + "integrity": "sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA==", + "requires": { + "follow-redirects": "^1.14.8" + } + }, "balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + }, + "binary-install": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/binary-install/-/binary-install-1.1.0.tgz", + "integrity": "sha512-rkwNGW+3aQVSZoD0/o3mfPN6Yxh3Id0R/xzTVBVVpGNlVz8EGwusksxRlbk/A5iKTZt9zkMn3qIqmAt3vpfbzg==", + "requires": { + "axios": "^0.26.1", + "rimraf": "^3.0.2", + "tar": "^6.1.11" + } }, "brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, + "chownr": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz", + "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==" + }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", - "dev": true + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" + }, + "follow-redirects": { + "version": "1.15.5", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.5.tgz", + "integrity": "sha512-vSFWUON1B+yAw1VN4xMfxgn5fTUiaOzAJCKBwIIgT/+7CuGy9+r+5gITvP62j3RmaD5Ph65UaERdOSRGUzZtgw==" + }, + "fs-minipass": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz", + "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==", + "requires": { + "minipass": "^3.0.0" + }, + "dependencies": { + "minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "requires": { + "yallist": "^4.0.0" + } + } + } }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", - "dev": true + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" }, "glob": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "dev": true, "requires": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -172,7 +349,6 @@ "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", - "dev": true, "requires": { "once": "^1.3.0", "wrappy": "1" @@ -181,23 +357,49 @@ "inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, "minimatch": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, "requires": { "brace-expansion": "^1.1.7" } }, + "minipass": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz", + "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==" + }, + "minizlib": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz", + "integrity": "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==", + "requires": { + "minipass": "^3.0.0", + "yallist": "^4.0.0" + }, + "dependencies": { + "minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "requires": { + "yallist": "^4.0.0" + } + } + } + }, + "mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==" + }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", - "dev": true, "requires": { "wrappy": "1" } @@ -205,23 +407,46 @@ "path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", - "dev": true + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==" }, "rimraf": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", - "dev": true, "requires": { "glob": "^7.1.3" } }, + "tar": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/tar/-/tar-6.2.0.tgz", + "integrity": "sha512-/Wo7DcT0u5HUV486xg675HtjNd3BXZ6xDbzsCUZPt5iw8bTQ63bP0Raut3mvro9u+CUyq7YQd8Cx55fsZXxqLQ==", + "requires": { + "chownr": "^2.0.0", + "fs-minipass": "^2.0.0", + "minipass": "^5.0.0", + "minizlib": "^2.1.1", + "mkdirp": "^1.0.3", + "yallist": "^4.0.0" + } + }, + "wasm-pack": { + "version": "0.12.1", + "resolved": "https://registry.npmjs.org/wasm-pack/-/wasm-pack-0.12.1.tgz", + "integrity": "sha512-dIyKWUumPFsGohdndZjDXRFaokUT/kQS+SavbbiXVAvA/eN4riX5QNdB6AhXQx37zNxluxQkuixZUgJ8adKjOg==", + "requires": { + "binary-install": "^1.0.1" + } + }, "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", - "dev": true + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" + }, + "yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" } } } diff --git a/rapier3d/package.json b/rapier3d/package.json index fbecdfbf..132a8c86 100644 --- a/rapier3d/package.json +++ b/rapier3d/package.json @@ -13,5 +13,8 @@ }, "devDependencies": { "rimraf": "^3.0.2" + }, + "dependencies": { + "wasm-pack": "^0.12.1" } } diff --git a/src.ts/control/ray_cast_vehicle_controller.ts b/src.ts/control/ray_cast_vehicle_controller.ts index a2c5d2e9..2b88e060 100644 --- a/src.ts/control/ray_cast_vehicle_controller.ts +++ b/src.ts/control/ray_cast_vehicle_controller.ts @@ -377,6 +377,24 @@ export class DynamicRayCastVehicleController { this.raw.set_wheel_friction_slip(i, value); } + /** + * The multiplier of friction between a tire and the collider it’s on top of. + * + * The larger the value, the stronger side friction will be. + */ + public wheelSideFrictionStiffness(i: number): number | null { + return this.raw.wheel_side_friction_stiffness(i); + } + + /** + * The multiplier of friction between a tire and the collider it’s on top of. + * + * The larger the value, the stronger side friction will be. + */ + public setWheelSideFrictionStiffness(i: number, value: number) { + this.raw.set_wheel_side_friction_stiffness(i, value); + } + /* * Getters only. */ diff --git a/src.ts/dynamics/impulse_joint.ts b/src.ts/dynamics/impulse_joint.ts index 0a2e60f8..e343657a 100644 --- a/src.ts/dynamics/impulse_joint.ts +++ b/src.ts/dynamics/impulse_joint.ts @@ -4,6 +4,8 @@ import { RawImpulseJointSet, RawRigidBodySet, RawJointAxis, + RawJointType, + RawMotorModel, } from "../raw"; import {RigidBody, RigidBodyHandle} from "./rigid_body"; import {RigidBodySet} from "./rigid_body_set"; @@ -31,6 +33,8 @@ export enum JointType { Revolute, Fixed, Prismatic, + Rope, + Spring, // #if DIM3 Spherical, Generic, @@ -87,16 +91,20 @@ export class ImpulseJoint { handle: ImpulseJointHandle, ): ImpulseJoint { switch (rawSet.jointType(handle)) { - case JointType.Revolute: + case RawJointType.Revolute: return new RevoluteImpulseJoint(rawSet, bodySet, handle); - case JointType.Prismatic: + case RawJointType.Prismatic: return new PrismaticImpulseJoint(rawSet, bodySet, handle); - case JointType.Fixed: + case RawJointType.Fixed: return new FixedImpulseJoint(rawSet, bodySet, handle); + case RawJointType.Spring: + return new SpringImpulseJoint(rawSet, bodySet, handle); + case RawJointType.Rope: + return new RopeImpulseJoint(rawSet, bodySet, handle); // #if DIM3 - case JointType.Spherical: + case RawJointType.Spherical: return new SphericalImpulseJoint(rawSet, bodySet, handle); - case JointType.Generic: + case RawJointType.Generic: return new GenericImpulseJoint(rawSet, bodySet, handle); // #endif default: @@ -135,7 +143,7 @@ export class ImpulseJoint { * The type of this joint given as a string. */ public type(): JointType { - return this.rawSet.jointType(this.handle); + return this.rawSet.jointType(this.handle) as number as JointType; } // #if DIM3 @@ -260,7 +268,7 @@ export class UnitImpulseJoint extends ImpulseJoint { this.rawSet.jointConfigureMotorModel( this.handle, this.rawAxis(), - model, + model as number as RawMotorModel, ); } @@ -306,6 +314,10 @@ export class UnitImpulseJoint extends ImpulseJoint { export class FixedImpulseJoint extends ImpulseJoint {} +export class RopeImpulseJoint extends ImpulseJoint {} + +export class SpringImpulseJoint extends ImpulseJoint {} + export class PrismaticImpulseJoint extends UnitImpulseJoint { public rawAxis(): RawJointAxis { return RawJointAxis.X; @@ -355,6 +367,9 @@ export class JointData { limitsEnabled: boolean; limits: Array; axesMask: JointAxesMask; + stiffness: number; + damping: number; + length: number; private constructor() {} @@ -386,6 +401,36 @@ export class JointData { return res; } + public static spring( + rest_length: number, + stiffness: number, + damping: number, + anchor1: Vector, + anchor2: Vector, + ): JointData { + let res = new JointData(); + res.anchor1 = anchor1; + res.anchor2 = anchor2; + res.length = rest_length; + res.stiffness = stiffness; + res.damping = damping; + res.jointType = JointType.Spring; + return res; + } + + public static rope( + length: number, + anchor1: Vector, + anchor2: Vector, + ): JointData { + let res = new JointData(); + res.anchor1 = anchor1; + res.anchor2 = anchor2; + res.length = length; + res.jointType = JointType.Rope; + return res; + } + // #if DIM2 /** @@ -554,6 +599,18 @@ export class JointData { rawFra1.free(); rawFra2.free(); break; + case JointType.Spring: + result = RawGenericJoint.spring( + this.length, + this.stiffness, + this.damping, + rawA1, + rawA2, + ); + break; + case JointType.Rope: + result = RawGenericJoint.rope(this.length, rawA1, rawA2); + break; case JointType.Prismatic: rawAx = VectorOps.intoRaw(this.axis); diff --git a/src.ts/dynamics/integration_parameters.ts b/src.ts/dynamics/integration_parameters.ts index 15b4623c..e6d539b5 100644 --- a/src.ts/dynamics/integration_parameters.ts +++ b/src.ts/dynamics/integration_parameters.ts @@ -47,24 +47,24 @@ export class IntegrationParameters { } /** - * Maximum number of iterations performed by the velocity constraints solver (default: `4`). + * The number of solver iterations run by the constraints solver for calculating forces (default: `4`). */ - get maxVelocityIterations(): number { - return this.raw.maxVelocityIterations; + get numSolverIterations(): number { + return this.raw.numSolverIterations; } /** - * Maximum number of friction iterations performed by the position-based constraints solver (default: `1`). + * Number of addition friction resolution iteration run during the last solver sub-step (default: `4`). */ - get maxVelocityFrictionIterations(): number { - return this.raw.maxVelocityFrictionIterations; + get numAdditionalFrictionIterations(): number { + return this.raw.numAdditionalFrictionIterations; } /** - * Maximum number of stabilization iterations performed by the position-based constraints solver (default: `1`). + * Number of internal Project Gauss Seidel (PGS) iterations run at each solver iteration (default: `1`). */ - get maxStabilizationIterations(): number { - return this.raw.maxStabilizationIterations; + get numInternalPgsIterations(): number { + return this.raw.numInternalPgsIterations; } /** @@ -97,16 +97,24 @@ export class IntegrationParameters { this.raw.predictionDistance = value; } - set maxVelocityIterations(value: number) { - this.raw.maxVelocityIterations = value; + /** + * Sets the number of solver iterations run by the constraints solver for calculating forces (default: `4`). + */ + set numSolverIterations(value: number) { + this.raw.numSolverIterations = value; } - - set maxVelocityFrictionIterations(value: number) { - this.raw.maxVelocityFrictionIterations = value; + /** + * Sets the number of addition friction resolution iteration run during the last solver sub-step (default: `4`). + */ + set numAdditionalFrictionIterations(value: number) { + this.raw.numAdditionalFrictionIterations = value; } - set maxStabilizationIterations(value: number) { - this.raw.maxStabilizationIterations = value; + /** + * Sets the number of internal Project Gauss Seidel (PGS) iterations run at each solver iteration (default: `1`). + */ + set numInternalPgsIterations(value: number) { + this.raw.numInternalPgsIterations = value; } set minIslandSize(value: number) { @@ -116,4 +124,12 @@ export class IntegrationParameters { set maxCcdSubsteps(value: number) { this.raw.maxCcdSubsteps = value; } + + public switchToStandardPgsSolver() { + this.raw.switchToStandardPgsSolver(); + } + + public switchToSmallStepsPgsSolver() { + this.raw.switchToSmallStepsPgsSolver(); + } } diff --git a/src.ts/dynamics/multibody_joint.ts b/src.ts/dynamics/multibody_joint.ts index 146caaad..718339a9 100644 --- a/src.ts/dynamics/multibody_joint.ts +++ b/src.ts/dynamics/multibody_joint.ts @@ -1,4 +1,9 @@ -import {RawImpulseJointSet, RawJointAxis, RawMultibodyJointSet} from "../raw"; +import { + RawImpulseJointSet, + RawJointAxis, + RawJointType, + RawMultibodyJointSet, +} from "../raw"; import { FixedImpulseJoint, ImpulseJointHandle, @@ -32,14 +37,14 @@ export class MultibodyJoint { handle: MultibodyJointHandle, ): MultibodyJoint { switch (rawSet.jointType(handle)) { - case JointType.Revolute: + case RawJointType.Revolute: return new RevoluteMultibodyJoint(rawSet, handle); - case JointType.Prismatic: + case RawJointType.Prismatic: return new PrismaticMultibodyJoint(rawSet, handle); - case JointType.Fixed: + case RawJointType.Fixed: return new FixedMultibodyJoint(rawSet, handle); // #if DIM3 - case JointType.Spherical: + case RawJointType.Spherical: return new SphericalMultibodyJoint(rawSet, handle); // #endif default: diff --git a/src.ts/dynamics/rigid_body.ts b/src.ts/dynamics/rigid_body.ts index 8ee83441..55b1a444 100644 --- a/src.ts/dynamics/rigid_body.ts +++ b/src.ts/dynamics/rigid_body.ts @@ -1,4 +1,4 @@ -import {RawRigidBodySet} from "../raw"; +import {RawRigidBodySet, RawRigidBodyType} from "../raw"; import {Rotation, RotationOps, Vector, VectorOps} from "../math"; // #if DIM3 import {SdpMatrix3, SdpMatrix3Ops} from "../math"; @@ -236,6 +236,30 @@ export class RigidBody { this.rawSet.rbSetDominanceGroup(this.handle, group); } + /** + * The number of additional solver iterations that will be run for this + * rigid-body and everything that interacts with it directly or indirectly + * through contacts or joints. + */ + public additionalSolverIterations(): number { + return this.rawSet.rbAdditionalSolverIterations(this.handle); + } + + /** + * Sets the number of additional solver iterations that will be run for this + * rigid-body and everything that interacts with it directly or indirectly + * through contacts or joints. + * + * Compared to increasing the global `World.numSolverIteration`, setting this + * value lets you increase accuracy on only a subset of the scene, resulting in reduced + * performance loss. + * + * @param iters - The new number of additional solver iterations (default: 0). + */ + public setAdditionalSolverIterations(iters: number) { + this.rawSet.rbSetAdditionalSolverIterations(this.handle, iters); + } + /** * Enable or disable CCD (Continuous Collision Detection) for this rigid-body. * @@ -683,14 +707,18 @@ export class RigidBody { * The status of this rigid-body: static, dynamic, or kinematic. */ public bodyType(): RigidBodyType { - return this.rawSet.rbBodyType(this.handle); + return this.rawSet.rbBodyType(this.handle) as number as RigidBodyType; } /** * Set a new status for this rigid-body: static, dynamic, or kinematic. */ public setBodyType(type: RigidBodyType, wakeUp: boolean) { - return this.rawSet.rbSetBodyType(this.handle, type, wakeUp); + return this.rawSet.rbSetBodyType( + this.handle, + type as number as RawRigidBodyType, + wakeUp, + ); } /** @@ -1041,6 +1069,7 @@ export class RigidBodyDesc { sleeping: boolean; ccdEnabled: boolean; dominanceGroup: number; + additionalSolverIterations: number; userData?: unknown; constructor(status: RigidBodyType) { @@ -1075,6 +1104,7 @@ export class RigidBodyDesc { this.sleeping = false; this.ccdEnabled = false; this.dominanceGroup = 0; + this.additionalSolverIterations = 0; } /** @@ -1146,6 +1176,22 @@ export class RigidBodyDesc { return this; } + /** + * Sets the number of additional solver iterations that will be run for this + * rigid-body and everything that interacts with it directly or indirectly + * through contacts or joints. + * + * Compared to increasing the global `World.numSolverIteration`, setting this + * value lets you increase accuracy on only a subset of the scene, resulting in reduced + * performance loss. + * + * @param iters - The new number of additional solver iterations (default: 0). + */ + public setAdditionalSolverIterations(iters: number): RigidBodyDesc { + this.additionalSolverIterations = iters; + return this; + } + /** * Sets whether the created rigid-body will be enabled or disabled. * @param enabled − If set to `false` the rigid-body will be disabled at creation. diff --git a/src.ts/dynamics/rigid_body_set.ts b/src.ts/dynamics/rigid_body_set.ts index 12e9123b..1a68660f 100644 --- a/src.ts/dynamics/rigid_body_set.ts +++ b/src.ts/dynamics/rigid_body_set.ts @@ -1,7 +1,12 @@ -import {RawRigidBodySet} from "../raw"; +import {RawRigidBodySet, RawRigidBodyType} from "../raw"; import {Coarena} from "../coarena"; import {VectorOps, RotationOps} from "../math"; -import {RigidBody, RigidBodyDesc, RigidBodyHandle} from "./rigid_body"; +import { + RigidBody, + RigidBodyDesc, + RigidBodyHandle, + RigidBodyType, +} from "./rigid_body"; import {ColliderSet} from "../geometry"; import {ImpulseJointSet} from "./impulse_joint_set"; import {MultibodyJointSet} from "./multibody_joint_set"; @@ -103,11 +108,12 @@ export class RigidBodySet { // #endif desc.linearDamping, desc.angularDamping, - desc.status, + desc.status as number as RawRigidBodyType, desc.canSleep, desc.sleeping, desc.ccdEnabled, desc.dominanceGroup, + desc.additionalSolverIterations, ); rawTra.free(); diff --git a/src.ts/geometry/collider.ts b/src.ts/geometry/collider.ts index 87eaa1f8..ce4494ef 100644 --- a/src.ts/geometry/collider.ts +++ b/src.ts/geometry/collider.ts @@ -555,7 +555,9 @@ export class Collider { * @deprecated this field will be removed in the future, please access this field on `shape` member instead. */ public shapeType(): ShapeType { - return this.colliderSet.raw.coShapeType(this.handle); + return this.colliderSet.raw.coShapeType( + this.handle, + ) as number as ShapeType; } /** diff --git a/src.ts/geometry/narrow_phase.ts b/src.ts/geometry/narrow_phase.ts index 133e60ec..af04a227 100644 --- a/src.ts/geometry/narrow_phase.ts +++ b/src.ts/geometry/narrow_phase.ts @@ -33,22 +33,22 @@ export class NarrowPhase { * @param collider1 - The second collider involved in the contact. * @param f - Closure that will be called on each collider that is in contact with `collider1`. */ - public contactsWith( + public contactPairsWith( collider1: ColliderHandle, f: (collider2: ColliderHandle) => void, ) { - this.raw.contacts_with(collider1, f); + this.raw.contact_pairs_with(collider1, f); } /** * Enumerates all the colliders intersecting the given colliders, assuming one of them * is a sensor. */ - public intersectionsWith( + public intersectionPairsWith( collider1: ColliderHandle, f: (collider2: ColliderHandle) => void, ) { - this.raw.intersections_with(collider1, f); + this.raw.intersection_pairs_with(collider1, f); } /** diff --git a/src.ts/geometry/point.ts b/src.ts/geometry/point.ts index 0cd12283..d272b7e8 100644 --- a/src.ts/geometry/point.ts +++ b/src.ts/geometry/point.ts @@ -1,6 +1,10 @@ import {Collider, ColliderHandle} from "./collider"; import {Vector, VectorOps} from "../math"; -import {RawPointColliderProjection, RawPointProjection} from "../raw"; +import { + RawFeatureType, + RawPointColliderProjection, + RawPointProjection, +} from "../raw"; import {FeatureType} from "./feature"; import {ColliderSet} from "./collider_set"; @@ -85,7 +89,7 @@ export class PointColliderProjection { colliderSet.get(raw.colliderHandle()), VectorOps.fromRaw(raw.point()), raw.isInside(), - raw.featureType(), + raw.featureType() as number as FeatureType, raw.featureId(), ); raw.free(); diff --git a/src.ts/geometry/ray.ts b/src.ts/geometry/ray.ts index 0949e911..b9744eff 100644 --- a/src.ts/geometry/ray.ts +++ b/src.ts/geometry/ray.ts @@ -1,5 +1,6 @@ import {Vector, VectorOps} from "../math"; import { + RawFeatureType, RawRayColliderIntersection, RawRayColliderToi, RawRayIntersection, @@ -86,7 +87,7 @@ export class RayIntersection { const result = new RayIntersection( raw.toi(), VectorOps.fromRaw(raw.normal()), - raw.featureType(), + raw.featureType() as number as FeatureType, raw.featureId(), ); raw.free(); @@ -147,7 +148,7 @@ export class RayColliderIntersection { colliderSet.get(raw.colliderHandle()), raw.toi(), VectorOps.fromRaw(raw.normal()), - raw.featureType(), + raw.featureType() as number as FeatureType, raw.featureId(), ); raw.free(); diff --git a/src.ts/geometry/shape.ts b/src.ts/geometry/shape.ts index 87f19951..af5f8ae2 100644 --- a/src.ts/geometry/shape.ts +++ b/src.ts/geometry/shape.ts @@ -1,5 +1,5 @@ import {Vector, VectorOps, Rotation, RotationOps} from "../math"; -import {RawColliderSet, RawShape} from "../raw"; +import {RawColliderSet, RawShape, RawShapeType} from "../raw"; import {ShapeContact} from "./contact"; import {PointProjection} from "./point"; import {Ray, RayIntersection} from "./ray"; @@ -32,9 +32,9 @@ export abstract class Shape { let normal: Vector; switch (rawType) { - case ShapeType.Ball: + case RawShapeType.Ball: return new Ball(rawSet.coRadius(handle)); - case ShapeType.Cuboid: + case RawShapeType.Cuboid: extents = rawSet.coHalfExtents(handle); // #if DIM2 return new Cuboid(extents.x, extents.y); @@ -44,7 +44,7 @@ export abstract class Shape { return new Cuboid(extents.x, extents.y, extents.z); // #endif - case ShapeType.RoundCuboid: + case RawShapeType.RoundCuboid: extents = rawSet.coHalfExtents(handle); borderRadius = rawSet.coRoundRadius(handle); @@ -61,11 +61,11 @@ export abstract class Shape { ); // #endif - case ShapeType.Capsule: + case RawShapeType.Capsule: halfHeight = rawSet.coHalfHeight(handle); radius = rawSet.coRadius(handle); return new Capsule(halfHeight, radius); - case ShapeType.Segment: + case RawShapeType.Segment: vs = rawSet.coVertices(handle); // #if DIM2 @@ -82,11 +82,11 @@ export abstract class Shape { ); // #endif - case ShapeType.Polyline: + case RawShapeType.Polyline: vs = rawSet.coVertices(handle); indices = rawSet.coIndices(handle); return new Polyline(vs, indices); - case ShapeType.Triangle: + case RawShapeType.Triangle: vs = rawSet.coVertices(handle); // #if DIM2 @@ -105,7 +105,7 @@ export abstract class Shape { ); // #endif - case ShapeType.RoundTriangle: + case RawShapeType.RoundTriangle: vs = rawSet.coVertices(handle); borderRadius = rawSet.coRoundRadius(handle); @@ -127,16 +127,16 @@ export abstract class Shape { ); // #endif - case ShapeType.HalfSpace: + case RawShapeType.HalfSpace: normal = VectorOps.fromRaw(rawSet.coHalfspaceNormal(handle)); return new HalfSpace(normal); - case ShapeType.TriMesh: + case RawShapeType.TriMesh: vs = rawSet.coVertices(handle); indices = rawSet.coIndices(handle); return new TriMesh(vs, indices); - case ShapeType.HeightField: + case RawShapeType.HeightField: const scale = rawSet.coHeightfieldScale(handle); const heights = rawSet.coHeightfieldHeights(handle); @@ -151,39 +151,39 @@ export abstract class Shape { // #endif // #if DIM2 - case ShapeType.ConvexPolygon: + case RawShapeType.ConvexPolygon: vs = rawSet.coVertices(handle); return new ConvexPolygon(vs, false); - case ShapeType.RoundConvexPolygon: + case RawShapeType.RoundConvexPolygon: vs = rawSet.coVertices(handle); borderRadius = rawSet.coRoundRadius(handle); return new RoundConvexPolygon(vs, borderRadius, false); // #endif // #if DIM3 - case ShapeType.ConvexPolyhedron: + case RawShapeType.ConvexPolyhedron: vs = rawSet.coVertices(handle); indices = rawSet.coIndices(handle); return new ConvexPolyhedron(vs, indices); - case ShapeType.RoundConvexPolyhedron: + case RawShapeType.RoundConvexPolyhedron: vs = rawSet.coVertices(handle); indices = rawSet.coIndices(handle); borderRadius = rawSet.coRoundRadius(handle); return new RoundConvexPolyhedron(vs, indices, borderRadius); - case ShapeType.Cylinder: + case RawShapeType.Cylinder: halfHeight = rawSet.coHalfHeight(handle); radius = rawSet.coRadius(handle); return new Cylinder(halfHeight, radius); - case ShapeType.RoundCylinder: + case RawShapeType.RoundCylinder: halfHeight = rawSet.coHalfHeight(handle); radius = rawSet.coRadius(handle); borderRadius = rawSet.coRoundRadius(handle); return new RoundCylinder(halfHeight, radius, borderRadius); - case ShapeType.Cone: + case RawShapeType.Cone: halfHeight = rawSet.coHalfHeight(handle); radius = rawSet.coRadius(handle); return new Cone(halfHeight, radius); - case ShapeType.RoundCone: + case RawShapeType.RoundCone: halfHeight = rawSet.coHalfHeight(handle); radius = rawSet.coRadius(handle); borderRadius = rawSet.coRoundRadius(handle); diff --git a/src.ts/pipeline/world.ts b/src.ts/pipeline/world.ts index f04ff534..03ded2cb 100644 --- a/src.ts/pipeline/world.ts +++ b/src.ts/pipeline/world.ts @@ -317,62 +317,92 @@ export class World { } /** - * The maximum velocity iterations the velocity-based force constraint solver can make. + * The number of solver iterations run by the constraints solver for calculating forces (default: `4`). */ - get maxVelocityIterations(): number { - return this.integrationParameters.maxVelocityIterations; + get numSolverIterations(): number { + return this.integrationParameters.numSolverIterations; } /** - * Sets the maximum number of velocity iterations (default: 4). + * Sets the number of solver iterations run by the constraints solver for calculating forces (default: `4`). * * The greater this value is, the most rigid and realistic the physics simulation will be. * However a greater number of iterations is more computationally intensive. * - * @param niter - The new maximum number of velocity iterations. + * @param niter - The new number of solver iterations. */ - set maxVelocityIterations(niter: number) { - this.integrationParameters.maxVelocityIterations = niter; + set numSolverIterations(niter: number) { + this.integrationParameters.numSolverIterations = niter; } /** - * The maximum velocity iterations the velocity-based friction constraint solver can make. + * Number of addition friction resolution iteration run during the last solver sub-step (default: `4`). */ - get maxVelocityFrictionIterations(): number { - return this.integrationParameters.maxVelocityFrictionIterations; + get numAdditionalFrictionIterations(): number { + return this.integrationParameters.numAdditionalFrictionIterations; } /** - * Sets the maximum number of velocity iterations for friction (default: 8). + * Sets the number of addition friction resolution iteration run during the last solver sub-step (default: `4`). * * The greater this value is, the most realistic friction will be. * However a greater number of iterations is more computationally intensive. * - * @param niter - The new maximum number of velocity iterations. + * @param niter - The new number of additional friction iterations. */ - set maxVelocityFrictionIterations(niter: number) { - this.integrationParameters.maxVelocityFrictionIterations = niter; + set numAdditionalFrictionIterations(niter: number) { + this.integrationParameters.numAdditionalFrictionIterations = niter; } /** - * The maximum velocity iterations the velocity-based constraint solver can make to attempt to remove - * the energy introduced by constraint stabilization. + * Number of internal Project Gauss Seidel (PGS) iterations run at each solver iteration (default: `1`). */ - get maxStabilizationIterations(): number { - return this.integrationParameters.maxStabilizationIterations; + get numInternalPgsIterations(): number { + return this.integrationParameters.numInternalPgsIterations; } /** - * Sets the maximum number of velocity iterations for stabilization (default: 1). + * Sets the Number of internal Project Gauss Seidel (PGS) iterations run at each solver iteration (default: `1`). * - * @param niter - The new maximum number of velocity iterations. + * Increasing this parameter will improve stability of the simulation. It will have a lesser effect than + * increasing `numSolverIterations` but is also less computationally expensive. + * + * @param niter - The new number of internal PGS iterations. */ - set maxStabilizationIterations(niter: number) { - this.integrationParameters.maxStabilizationIterations = niter; + set numInternalPgsIterations(niter: number) { + this.integrationParameters.numInternalPgsIterations = niter; + } + + /// Configures the integration parameters to match the old PGS solver + /// from Rapier JS version <= 0.11. + /// + /// This solver was slightly faster than the new one but resulted + /// in less stable joints and worse convergence rates. + /// + /// This should only be used for comparison purpose or if you are + /// experiencing problems with the new solver. + /// + /// NOTE: this does not affect any `RigidBody.additional_solver_iterations` that will + /// still create solver iterations based on the new "small-steps" PGS solver. + public switchToStandardPgsSolver() { + this.integrationParameters.switchToStandardPgsSolver(); + } + + /// Configures the integration parameters to match the new "small-steps" PGS solver + /// from Rapier version >= 0.12. + /// + /// The "small-steps" PGS solver is the default one when creating the physics world. So + /// calling this function is generally not needed unless `World.switch_to_standard_pgs_solver` + /// was called. + /// + /// This solver results in more stable joints and significantly better convergence + /// rates but is slightly slower in its default settings. + public switchToSmallStepsPgsSolver() { + this.integrationParameters.switchToSmallStepsPgsSolver(); } /** - * Creates a new rigid-body from the given rigd-body descriptior. + * Creates a new rigid-body from the given rigid-body descriptor. * * @param body - The description of the rigid-body to create. */ @@ -973,8 +1003,11 @@ export class World { * @param collider1 - The second collider involved in the contact. * @param f - Closure that will be called on each collider that is in contact with `collider1`. */ - public contactsWith(collider1: Collider, f: (collider2: Collider) => void) { - this.narrowPhase.contactsWith( + public contactPairsWith( + collider1: Collider, + f: (collider2: Collider) => void, + ) { + this.narrowPhase.contactPairsWith( collider1.handle, this.colliders.castClosure(f), ); @@ -984,11 +1017,11 @@ export class World { * Enumerates all the colliders intersecting the given colliders, assuming one of them * is a sensor. */ - public intersectionsWith( + public intersectionPairsWith( collider1: Collider, f: (collider2: Collider) => void, ) { - this.narrowPhase.intersectionsWith( + this.narrowPhase.intersectionPairsWith( collider1.handle, this.colliders.castClosure(f), ); diff --git a/src/control/ray_cast_vehicle_controller.rs b/src/control/ray_cast_vehicle_controller.rs index 436b45e6..e8002bc1 100644 --- a/src/control/ray_cast_vehicle_controller.rs +++ b/src/control/ray_cast_vehicle_controller.rs @@ -254,6 +254,19 @@ impl RawDynamicRayCastVehicleController { } } + pub fn wheel_side_friction_stiffness(&self, i: usize) -> Option { + self.controller + .wheels() + .get(i) + .map(|w| w.side_friction_stiffness) + } + + pub fn set_wheel_side_friction_stiffness(&mut self, i: usize, stiffness: f32) { + if let Some(wheel) = self.controller.wheels_mut().get_mut(i) { + wheel.side_friction_stiffness = stiffness; + } + } + /* * Getters only. */ diff --git a/src/dynamics/integration_parameters.rs b/src/dynamics/integration_parameters.rs index f7d61e31..af478435 100644 --- a/src/dynamics/integration_parameters.rs +++ b/src/dynamics/integration_parameters.rs @@ -1,4 +1,5 @@ use rapier::dynamics::IntegrationParameters; +use std::num::NonZeroUsize; use wasm_bindgen::prelude::*; #[wasm_bindgen] @@ -32,18 +33,18 @@ impl RawIntegrationParameters { } #[wasm_bindgen(getter)] - pub fn maxVelocityIterations(&self) -> usize { - self.0.max_velocity_iterations + pub fn numSolverIterations(&self) -> usize { + self.0.num_solver_iterations.get() } #[wasm_bindgen(getter)] - pub fn maxVelocityFrictionIterations(&self) -> usize { - self.0.max_velocity_friction_iterations + pub fn numAdditionalFrictionIterations(&self) -> usize { + self.0.num_additional_friction_iterations } #[wasm_bindgen(getter)] - pub fn maxStabilizationIterations(&self) -> usize { - self.0.max_stabilization_iterations + pub fn numInternalPgsIterations(&self) -> usize { + self.0.num_internal_pgs_iterations } #[wasm_bindgen(getter)] @@ -77,16 +78,16 @@ impl RawIntegrationParameters { } #[wasm_bindgen(setter)] - pub fn set_maxVelocityIterations(&mut self, value: usize) { - self.0.max_velocity_iterations = value + pub fn set_numSolverIterations(&mut self, value: usize) { + self.0.num_solver_iterations = NonZeroUsize::new(value.max(1)).unwrap() } #[wasm_bindgen(setter)] - pub fn set_maxVelocityFrictionIterations(&mut self, value: usize) { - self.0.max_velocity_friction_iterations = value + pub fn set_numAdditionalFrictionIterations(&mut self, value: usize) { + self.0.num_additional_friction_iterations = value } #[wasm_bindgen(setter)] - pub fn set_maxStabilizationIterations(&mut self, value: usize) { - self.0.max_stabilization_iterations = value + pub fn set_numInternalPgsIterations(&mut self, value: usize) { + self.0.num_internal_pgs_iterations = value } #[wasm_bindgen(setter)] pub fn set_minIslandSize(&mut self, value: usize) { @@ -97,4 +98,12 @@ impl RawIntegrationParameters { pub fn set_maxCcdSubsteps(&mut self, value: usize) { self.0.max_ccd_substeps = value } + + pub fn switchToStandardPgsSolver(&mut self) { + self.0.switch_to_standard_pgs_solver() + } + + pub fn switchToSmallStepsPgsSolver(&mut self) { + self.0.switch_to_small_steps_pgs_solver() + } } diff --git a/src/dynamics/joint.rs b/src/dynamics/joint.rs index f4cbeb81..bf38bbf4 100644 --- a/src/dynamics/joint.rs +++ b/src/dynamics/joint.rs @@ -2,7 +2,7 @@ use crate::math::{RawRotation, RawVector}; use na::Unit; use rapier::dynamics::{ FixedJointBuilder, GenericJoint, JointAxesMask, JointAxis, MotorModel, PrismaticJointBuilder, - RevoluteJointBuilder, + RevoluteJointBuilder, RopeJointBuilder, SpringJointBuilder, }; #[cfg(feature = "dim3")] use rapier::dynamics::{GenericJointBuilder, SphericalJointBuilder}; @@ -15,6 +15,8 @@ pub enum RawJointType { Revolute, Fixed, Prismatic, + Rope, + Spring, Generic, } @@ -24,6 +26,8 @@ pub enum RawJointType { Revolute, Fixed, Prismatic, + Rope, + Spring, Spherical, Generic, } @@ -163,7 +167,31 @@ impl RawGenericJoint { Some(Self(joint)) } - /// Create a new joint descriptor that builds spehrical joints. + pub fn spring( + rest_length: f32, + stiffness: f32, + damping: f32, + anchor1: &RawVector, + anchor2: &RawVector, + ) -> Self { + Self( + SpringJointBuilder::new(rest_length, stiffness, damping) + .local_anchor1(anchor1.0.into()) + .local_anchor2(anchor2.0.into()) + .into(), + ) + } + + pub fn rope(length: f32, anchor1: &RawVector, anchor2: &RawVector) -> Self { + Self( + RopeJointBuilder::new(length) + .local_anchor1(anchor1.0.into()) + .local_anchor2(anchor2.0.into()) + .into(), + ) + } + + /// Create a new joint descriptor that builds spherical joints. /// /// A spherical joints allows three relative rotational degrees of freedom /// by preventing any relative translation between the anchors of the diff --git a/src/dynamics/mod.rs b/src/dynamics/mod.rs index 7214addf..36cc7eaa 100644 --- a/src/dynamics/mod.rs +++ b/src/dynamics/mod.rs @@ -6,7 +6,6 @@ pub use self::integration_parameters::*; pub use self::island_manager::*; pub use self::joint::*; pub use self::multibody_joint_set::*; -pub use self::rigid_body::*; pub use self::rigid_body_set::*; mod ccd_solver; diff --git a/src/dynamics/multibody_joint_set.rs b/src/dynamics/multibody_joint_set.rs index a49688c6..c7f4839e 100644 --- a/src/dynamics/multibody_joint_set.rs +++ b/src/dynamics/multibody_joint_set.rs @@ -67,7 +67,7 @@ impl RawMultibodyJointSet { /// - `f(handle)`: the function to apply to the integer handle of each joint managed by this set. Called as `f(collider)`. pub fn forEachJointHandle(&self, f: &js_sys::Function) { let this = JsValue::null(); - for (handle, _, _) in self.0.iter() { + for (handle, _, _, _) in self.0.iter() { let _ = f.call1(&this, &JsValue::from(utils::flat_handle(handle.0))); } } diff --git a/src/dynamics/rigid_body.rs b/src/dynamics/rigid_body.rs index 71d650ca..2dd0add1 100644 --- a/src/dynamics/rigid_body.rs +++ b/src/dynamics/rigid_body.rs @@ -691,6 +691,16 @@ impl RawRigidBodySet { }) } + pub fn rbAdditionalSolverIterations(&self, handle: FlatHandle) -> usize { + self.map(handle, |rb| rb.additional_solver_iterations()) + } + + pub fn rbSetAdditionalSolverIterations(&mut self, handle: FlatHandle, iters: usize) { + self.map_mut(handle, |rb| { + rb.set_additional_solver_iterations(iters as usize); + }) + } + /// An arbitrary user-defined 32-bit integer pub fn rbUserData(&self, handle: FlatHandle) -> u32 { self.map(handle, |rb| rb.user_data as u32) diff --git a/src/dynamics/rigid_body_set.rs b/src/dynamics/rigid_body_set.rs index 0e87a616..4d91ff56 100644 --- a/src/dynamics/rigid_body_set.rs +++ b/src/dynamics/rigid_body_set.rs @@ -92,6 +92,7 @@ impl RawRigidBodySet { sleeping: bool, ccdEnabled: bool, dominanceGroup: i8, + additional_solver_iterations: usize, ) -> FlatHandle { let pos = na::Isometry3::from_parts(translation.0.into(), rotation.0); @@ -112,7 +113,8 @@ impl RawRigidBodySet { .can_sleep(canSleep) .sleeping(sleeping) .ccd_enabled(ccdEnabled) - .dominance_group(dominanceGroup); + .dominance_group(dominanceGroup) + .additional_solver_iterations(additional_solver_iterations); rigid_body = if massOnly { rigid_body.additional_mass(mass) @@ -152,6 +154,7 @@ impl RawRigidBodySet { sleeping: bool, ccdEnabled: bool, dominanceGroup: i8, + additional_solver_iterations: usize, ) -> FlatHandle { let pos = na::Isometry2::from_parts(translation.0.into(), rotation.0); let mut rigid_body = RigidBodyBuilder::new(rb_type.into()) @@ -166,7 +169,8 @@ impl RawRigidBodySet { .can_sleep(canSleep) .sleeping(sleeping) .ccd_enabled(ccdEnabled) - .dominance_group(dominanceGroup); + .dominance_group(dominanceGroup) + .additional_solver_iterations(additional_solver_iterations); rigid_body = if massOnly { rigid_body.additional_mass(mass) diff --git a/src/geometry/mod.rs b/src/geometry/mod.rs index 51ce3007..f9fe78f6 100644 --- a/src/geometry/mod.rs +++ b/src/geometry/mod.rs @@ -1,7 +1,6 @@ //! Structures related to geometry: colliders, shapes, etc. pub use self::broad_phase::*; -pub use self::collider::*; pub use self::collider_set::*; pub use self::contact::*; pub use self::feature::*; diff --git a/src/geometry/narrow_phase.rs b/src/geometry/narrow_phase.rs index adfbf90d..c469991a 100644 --- a/src/geometry/narrow_phase.rs +++ b/src/geometry/narrow_phase.rs @@ -14,10 +14,10 @@ impl RawNarrowPhase { RawNarrowPhase(NarrowPhase::new()) } - pub fn contacts_with(&self, handle1: FlatHandle, f: js_sys::Function) { + pub fn contact_pairs_with(&self, handle1: FlatHandle, f: js_sys::Function) { let this = JsValue::null(); let handle1 = utils::collider_handle(handle1); - for pair in self.0.contacts_with(handle1) { + for pair in self.0.contact_pairs_with(handle1) { let handle2 = if pair.collider1 == handle1 { utils::flat_handle(pair.collider2.0) } else { @@ -36,10 +36,10 @@ impl RawNarrowPhase { .map(|p| RawContactPair(p as *const ContactPair)) } - pub fn intersections_with(&self, handle1: FlatHandle, f: js_sys::Function) { + pub fn intersection_pairs_with(&self, handle1: FlatHandle, f: js_sys::Function) { let this = JsValue::null(); let handle1 = utils::collider_handle(handle1); - for (h1, h2, inter) in self.0.intersections_with(handle1) { + for (h1, h2, inter) in self.0.intersection_pairs_with(handle1) { if inter { let handle2 = if h1 == handle1 { utils::flat_handle(h2.0) diff --git a/testbed2d/src/Gui.ts b/testbed2d/src/Gui.ts index e1206b6c..8727b5ba 100644 --- a/testbed2d/src/Gui.ts +++ b/testbed2d/src/Gui.ts @@ -43,11 +43,7 @@ export class Gui { testbed.switchToDemo(demo); }); this.gui - .add(simulationParameters, "numVelocityIter", 0, 20) - .step(1) - .listen(); - this.gui - .add(simulationParameters, "numPositionIter", 0, 20) + .add(simulationParameters, "numSolverIters", 0, 20) .step(1) .listen(); this.gui diff --git a/testbed2d/src/Testbed.ts b/testbed2d/src/Testbed.ts index 9bff7785..ee286ccc 100644 --- a/testbed2d/src/Testbed.ts +++ b/testbed2d/src/Testbed.ts @@ -12,8 +12,7 @@ class SimulationParameters { backend: string; prevBackend: string; demo: string; - numVelocityIter: number; - numPositionIter: number; + numSolverIters: number; running: boolean; stepping: boolean; debugRender: boolean; @@ -29,8 +28,7 @@ class SimulationParameters { this.backend = "rapier"; this.prevBackend = "rapier"; this.demo = "collision groups"; - this.numVelocityIter = 4; - this.numPositionIter = 1; + this.numSolverIters = 4; this.running = true; this.stepping = false; this.debugRender = false; @@ -89,8 +87,7 @@ export class Testbed { document.onkeydown = null; this.preTimestepAction = null; this.world = world; - this.world.maxVelocityIterations = this.parameters.numVelocityIter; - // this.world.maxPositionIterations = this.parameters.numPositionIter; + this.world.numSolverIterations = this.parameters.numSolverIters; this.demoToken += 1; this.stepId = 0; this.gui.resetTiming(); @@ -142,9 +139,7 @@ export class Testbed { run() { if (this.parameters.running || this.parameters.stepping) { - this.world.maxVelocityIterations = this.parameters.numVelocityIter; - this.world.maxVelocityFrictionIterations = - this.parameters.numVelocityIter * 2; + this.world.numSolverIterations = this.parameters.numSolverIters; if (!!this.preTimestepAction) { this.preTimestepAction(this.graphics); diff --git a/testbed3d/src/Gui.ts b/testbed3d/src/Gui.ts index e1206b6c..8727b5ba 100644 --- a/testbed3d/src/Gui.ts +++ b/testbed3d/src/Gui.ts @@ -43,11 +43,7 @@ export class Gui { testbed.switchToDemo(demo); }); this.gui - .add(simulationParameters, "numVelocityIter", 0, 20) - .step(1) - .listen(); - this.gui - .add(simulationParameters, "numPositionIter", 0, 20) + .add(simulationParameters, "numSolverIters", 0, 20) .step(1) .listen(); this.gui diff --git a/testbed3d/src/Testbed.ts b/testbed3d/src/Testbed.ts index 1dbf05d2..75d71745 100644 --- a/testbed3d/src/Testbed.ts +++ b/testbed3d/src/Testbed.ts @@ -12,8 +12,7 @@ class SimulationParameters { backend: string; prevBackend: string; demo: string; - numVelocityIter: number; - numPositionIter: number; + numSolverIters: number; running: boolean; stepping: boolean; debugInfos: boolean; @@ -29,8 +28,7 @@ class SimulationParameters { this.backend = "rapier"; this.prevBackend = "rapier"; this.demo = "collision groups"; - this.numVelocityIter = 4; - this.numPositionIter = 1; + this.numSolverIters = 4; this.running = true; this.stepping = false; this.debugRender = false; @@ -91,8 +89,7 @@ export class Testbed { this.preTimestepAction = null; this.world = world; - this.world.maxVelocityIterations = this.parameters.numVelocityIter; - // this.world.maxPositionIterations = this.parameters.numPositionIter; + this.world.numSolverIterations = this.parameters.numSolverIters; this.demoToken += 1; this.stepId = 0; this.gui.resetTiming(); @@ -143,8 +140,7 @@ export class Testbed { run() { if (this.parameters.running || this.parameters.stepping) { - this.world.maxVelocityIterations = this.parameters.numVelocityIter; - // this.world.maxPositionIterations = this.parameters.numPositionIter; + this.world.numSolverIterations = this.parameters.numSolverIters; if (!!this.preTimestepAction) { this.preTimestepAction(this.graphics);