babylon-box3d 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +143 -18
- package/dist/box3dPlugin.d.ts +37 -1
- package/dist/box3dPlugin.d.ts.map +1 -1
- package/dist/box3dPlugin.js +48 -4
- package/dist/box3dPlugin.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/loadBox3D.d.ts +28 -0
- package/dist/loadBox3D.d.ts.map +1 -0
- package/dist/loadBox3D.js +48 -0
- package/dist/loadBox3D.js.map +1 -0
- package/lib/esm/box3d.d.ts +11 -3
- package/lib/esm/box3d.js +1 -1
- package/lib/esm/box3d.wasm +0 -0
- package/lib/esm-threads/box3d.d.ts +229 -0
- package/lib/esm-threads/box3d.js +2 -0
- package/lib/esm-threads/box3d.wasm +0 -0
- package/lib/node/box3d.d.ts +11 -3
- package/lib/node/box3d.mjs +1 -1
- package/lib/node/box3d.wasm +0 -0
- package/lib/node-threads/box3d.d.ts +229 -0
- package/lib/node-threads/box3d.mjs +2 -0
- package/lib/node-threads/box3d.wasm +0 -0
- package/lib/umd/box3d.umd.js +1 -1
- package/lib/umd/box3d.umd.wasm +0 -0
- package/package.json +9 -1
- package/umd/babylon.box3d.js +97 -8
- package/umd/babylon.box3d.js.map +3 -3
- package/umd/babylon.box3d.min.js +2 -2
- package/umd/babylon.box3d.min.js.map +4 -4
- package/wasm/box3d_shim.c +224 -1
package/README.md
CHANGED
|
@@ -3,28 +3,48 @@
|
|
|
3
3
|
[Box3D](https://github.com/erincatto/box3d) physics for Babylon.js. Box3D is Erin Catto's 3D successor to Box2D v3:
|
|
4
4
|
an MIT licensed rigid body engine with a soft step solver, continuous collision, cross platform determinism and
|
|
5
5
|
SIMD. This extension ships the engine compiled to WebAssembly plus `Box3DPlugin`, an implementation of Babylon's
|
|
6
|
-
physics v2 plugin interface, so
|
|
6
|
+
physics v2 plugin interface. It supports most of the Physics V2 API, so scenes written for the Havok plugin generally
|
|
7
|
+
run on it unchanged; [What is covered](#what-is-covered) lists where it differs.
|
|
7
8
|
|
|
8
9
|
```ts
|
|
9
10
|
import { Vector3 } from "@babylonjs/core/Maths/math.vector";
|
|
11
|
+
import "@babylonjs/core/Physics/joinedPhysicsEngineComponent"; // adds scene.enablePhysics
|
|
10
12
|
import { Box3D, Box3DPlugin } from "babylon-box3d";
|
|
11
13
|
|
|
12
14
|
const box3d = await Box3D();
|
|
13
15
|
scene.enablePhysics(new Vector3(0, -9.81, 0), new Box3DPlugin(true, box3d));
|
|
14
16
|
```
|
|
15
17
|
|
|
16
|
-
Script tags (Playground, plain HTML)
|
|
18
|
+
Script tags (Playground, plain HTML). A complete Playground scene is in
|
|
19
|
+
[the documentation page](docs/communityExtensions/box3dPhysics.md#playground):
|
|
17
20
|
|
|
18
21
|
```html
|
|
19
22
|
<script src="https://cdn.babylonjs.com/babylon.js"></script>
|
|
20
23
|
<script src="https://unpkg.com/babylon-box3d/lib/umd/box3d.umd.js"></script>
|
|
21
24
|
<script src="https://unpkg.com/babylon-box3d/umd/babylon.box3d.min.js"></script>
|
|
22
25
|
<script>
|
|
23
|
-
|
|
24
|
-
|
|
26
|
+
// a classic script cannot use await at the top level, so the setup runs in an async function
|
|
27
|
+
(async () => {
|
|
28
|
+
const box3d = await Box3D();
|
|
29
|
+
scene.enablePhysics(new BABYLON.Vector3(0, -9.81, 0), new BABYLONBOX3D.Box3DPlugin(true, box3d));
|
|
30
|
+
// create physics bodies from here on
|
|
31
|
+
})();
|
|
25
32
|
</script>
|
|
26
33
|
```
|
|
27
34
|
|
|
35
|
+
### Without npm or a build step
|
|
36
|
+
|
|
37
|
+
Like Havok's UMD build, this runs from plain files in a folder. Download these three and put them next to your page:
|
|
38
|
+
|
|
39
|
+
- [box3d.umd.js](https://unpkg.com/babylon-box3d@0.4.0/lib/umd/box3d.umd.js), the WebAssembly loader (global `Box3D`)
|
|
40
|
+
- [box3d.umd.wasm](https://unpkg.com/babylon-box3d@0.4.0/lib/umd/box3d.umd.wasm), the engine, found next to the loader
|
|
41
|
+
- [babylon.box3d.min.js](https://unpkg.com/babylon-box3d@0.4.0/umd/babylon.box3d.min.js), the plugin (global `BABYLONBOX3D`)
|
|
42
|
+
|
|
43
|
+
Then load them after `babylon.js` with the same three script tags as above, pointing at the local files. The folder
|
|
44
|
+
has to be opened through a web server rather than by double clicking the page: browsers refuse to load a `.wasm` from
|
|
45
|
+
`file://`, and Havok's wasm has the same limit. Any static server works, VS Code's Live Server or
|
|
46
|
+
`python -m http.server` in that folder among them; nothing runs on Node.
|
|
47
|
+
|
|
28
48
|
The wasm is fetched next to the loader script. With a bundler pass `locateFile`, for example with vite:
|
|
29
49
|
|
|
30
50
|
```ts
|
|
@@ -69,6 +89,70 @@ export default defineConfig({
|
|
|
69
89
|
});
|
|
70
90
|
```
|
|
71
91
|
|
|
92
|
+
## Threads
|
|
93
|
+
|
|
94
|
+
Box3D can run one world step on several threads. The package ships a second build of the wasm for that, because
|
|
95
|
+
threads need `SharedArrayBuffer`, and a browser only hands that out to a [cross origin isolated](https://developer.mozilla.org/en-US/docs/Web/API/Window/crossOriginIsolated)
|
|
96
|
+
page - one served with:
|
|
97
|
+
|
|
98
|
+
```
|
|
99
|
+
Cross-Origin-Opener-Policy: same-origin
|
|
100
|
+
Cross-Origin-Embedder-Policy: require-corp
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
`LoadBox3D` picks the build and the plugin asks for the workers:
|
|
104
|
+
|
|
105
|
+
```ts
|
|
106
|
+
import { Vector3 } from "@babylonjs/core/Maths/math.vector";
|
|
107
|
+
import "@babylonjs/core/Physics/joinedPhysicsEngineComponent";
|
|
108
|
+
import { LoadBox3D, Box3DPlugin } from "babylon-box3d";
|
|
109
|
+
|
|
110
|
+
// "auto" uses the threaded build where the page allows it and the single threaded one everywhere else
|
|
111
|
+
const box3d = await LoadBox3D({ threads: "auto" });
|
|
112
|
+
scene.enablePhysics(new Vector3(0, -9.81, 0), new Box3DPlugin(true, box3d, { workerCount: "auto" }));
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
`workerCount` counts the thread the step is called on, so 4 means this thread and 3 others. `"auto"` asks for half
|
|
116
|
+
of `navigator.hardwareConcurrency`: box3d gains little from the second thread of a core, and the renderer still needs
|
|
117
|
+
somewhere to run. The threaded module is imported dynamically, so a page that never asks for threads never downloads
|
|
118
|
+
it. `CanUseBox3DThreads()` reports whether this page can run them.
|
|
119
|
+
|
|
120
|
+
Everything degrades rather than breaking. On a page that is not isolated, `threads: "auto"` loads the single threaded
|
|
121
|
+
build, `workerCount` is clamped to 1 and the plugin says so once in the console. `threads: true` throws instead, for
|
|
122
|
+
an app that would rather find out than quietly run on one thread. Isolation is a hosting decision: a static host that
|
|
123
|
+
cannot add response headers (GitHub Pages, for one) needs a service worker to add them, the way the hosted demo does
|
|
124
|
+
(`demo/public/coi-serviceworker.js`), and the headers also block cross origin
|
|
125
|
+
resources that do not opt in with CORS or `Cross-Origin-Resource-Policy`, which is worth checking before turning them
|
|
126
|
+
on for a whole site. `npm run demo` sets both headers, so the showcase runs threads with `?workers=4`.
|
|
127
|
+
|
|
128
|
+
What the threads do and do not change:
|
|
129
|
+
|
|
130
|
+
- **Results do not change.** The same scene stepped the same number of times lands on bit identical positions at any
|
|
131
|
+
worker count, which is what `test/threads.test.ts` checks against the single threaded build.
|
|
132
|
+
- **The step still returns when it returns.** The calling thread does its share of the work and the step is over when
|
|
133
|
+
the last worker is done; nothing is deferred to the next frame, so there is no extra latency and no API change.
|
|
134
|
+
- **Other engines run on one thread.** Havok's Babylon plugin is single threaded, so this is cores nothing else in
|
|
135
|
+
Babylon is using.
|
|
136
|
+
- **Small scenes gain nothing.** Splitting a step costs something; under a few hundred awake bodies it is not worth
|
|
137
|
+
it. Ask for workers on the scenes that need them.
|
|
138
|
+
- **There is no threaded script tag build.** A Playground or CDN page is not isolated, so it could not start one.
|
|
139
|
+
|
|
140
|
+
The threads themselves belong to the module, not to a world: they are created once, shared by every world, and never
|
|
141
|
+
joined. That is deliberate. Box3D's own scheduler creates threads with a world and joins them when it is destroyed,
|
|
142
|
+
and joining is what deadlocks a browser - a worker that has not finished starting cannot finish while the main thread
|
|
143
|
+
waits for it in `pthread_join`, and disposing a scene and building the next one in the same function is enough to
|
|
144
|
+
reach that. The shim hands box3d its own task system instead (`wasm/box3d_shim.c`), so worlds come and go freely.
|
|
145
|
+
|
|
146
|
+
### Tuning
|
|
147
|
+
|
|
148
|
+
- `subStepCount` (default 4, box3d's own) is the solver's sub steps per step: `new Box3DPlugin(true, box3d, {
|
|
149
|
+
subStepCount: 2 })`, or `plugin.subStepCount` at any time. Tall stacks need the 4; 2 roughly halves solver time for
|
|
150
|
+
scenes that are mostly loose bodies, 8 buys stiffness in exchange for time.
|
|
151
|
+
- `plugin.setSleepingEnabled(false)` measures raw throughput but costs a lot in a settled scene: sleeping is why a
|
|
152
|
+
standing pyramid is nearly free.
|
|
153
|
+
- Contact events cross into JavaScript one record per contact per step. A body nothing listens to should not be
|
|
154
|
+
asking for them: `body.setCollisionCallbackEnabled(false)`, which is the default.
|
|
155
|
+
|
|
72
156
|
## What is covered
|
|
73
157
|
|
|
74
158
|
| Babylon v2 | Box3D |
|
|
@@ -181,16 +265,23 @@ and mesh winding is flipped, exactly like the Havok plugin.
|
|
|
181
265
|
| path | what |
|
|
182
266
|
| --- | --- |
|
|
183
267
|
| `src/box3dPlugin.ts` | the plugin (`IPhysicsEnginePluginV2`) |
|
|
184
|
-
| `src/index.ts` | package entry: `Box3DPlugin`, `Box3DWheelJoint`, `Box3D` (wasm factory) |
|
|
268
|
+
| `src/index.ts` | package entry: `Box3DPlugin`, `Box3DWheelJoint`, `Box3D` (wasm factory), `LoadBox3D` |
|
|
269
|
+
| `src/loadBox3D.ts` | picks the single threaded or threaded wasm build for the page |
|
|
185
270
|
| `wasm/box3d_shim.c` | C shim: flat, handle based API over box3d (`bx_*` functions) |
|
|
186
|
-
| `wasm/build.mjs` | emcc build for `lib/esm`, `lib/umd` (global `Box3D`)
|
|
271
|
+
| `wasm/build.mjs` | emcc build for `lib/esm`, `lib/umd` (global `Box3D`), `lib/node` and the threaded pair |
|
|
187
272
|
| `lib/` | committed wasm builds and typings, `UPSTREAM_COMMIT` is the box3d commit |
|
|
273
|
+
| `wasm/patches/` | changes to Box3D itself, applied in name order to a copy of the box3d checkout at build time, see [Patches to Box3D](#patches-to-box3d) |
|
|
274
|
+
| `lib/esm-threads`, `lib/node-threads` | the same module built with pthreads, see [Threads](#threads) |
|
|
188
275
|
| `umd/` | plugin bundle for script tags (global `BABYLONBOX3D`), built by `npm run build:umd` |
|
|
189
276
|
| `demo/` | vite showcase: `npm run demo`, then `http://localhost:5178/?demo=pyramid` |
|
|
190
277
|
| `docs/` | the community extension page for the Babylon.js documentation |
|
|
191
278
|
| `test/` | vitest unit tests with a mocked wasm module, tests against the real wasm, node smoke test, and `packaged.test.ts` over the built `dist` and every loader in `lib` |
|
|
192
279
|
| `bench/` | Box3D vs Havok vs Oimo benchmark: `npm run bench` (node) or `demo/bench.html` (browser), results in `bench/results` |
|
|
193
280
|
|
|
281
|
+
The demo is published to GitHub Pages at https://pryme8.github.io/babylon-box3d/ by `.github/workflows/pages.yml`.
|
|
282
|
+
Pages cannot send the isolation headers threads need, so `demo/public/coi-serviceworker.js` adds them from a service
|
|
283
|
+
worker; that is only needed because of the host, and an app that controls its own headers does not want it.
|
|
284
|
+
|
|
194
285
|
Demos: `pyramid` (Box3D's Large Pyramid benchmark, thin instances, `&rows=100` for 5050 boxes, click to explode),
|
|
195
286
|
`ragdolls` (Erin's human ragdoll sliding down a chute), `car` (wheel joints, WASD), `destruction` (brick tower and
|
|
196
287
|
wrecking ball), plus `stack`, `joints`, `terrain`, `compound` feature tests. Add `&ui=0` to hide the overlay.
|
|
@@ -200,22 +291,41 @@ wrecking ball), plus `stack`, `joints`, `terrain`, `compound` feature tests. Add
|
|
|
200
291
|
Box3D, Havok and Oimo build the same scenes through Babylon's regular physics API (v2 for Box3D and Havok, v1 for
|
|
201
292
|
Oimo), with engine defaults, a fixed 1/60 s step and nothing rendered. "Step" is Babylon's whole physics step,
|
|
202
293
|
"engine" is only the engine's own world step. Median of 3 interleaved runs after a warm up, AMD Ryzen 9 5900X,
|
|
203
|
-
Babylon.js
|
|
294
|
+
Babylon.js 9.26.1, @babylonjs/havok 1.3.14, oimo 1.0.9, node 24. Mean milliseconds per step, sleep on, every engine
|
|
295
|
+
on one thread (2026-09-17):
|
|
204
296
|
|
|
205
297
|
| Scene | Box3D | Havok | Oimo |
|
|
206
298
|
| --- | ---: | ---: | ---: |
|
|
207
|
-
| Pyramid, 20 rows (210 boxes) | 0.09 | 0.
|
|
208
|
-
| Pyramid, 50 rows (1275 boxes) | 0.
|
|
209
|
-
| Pyramid, 100 rows (5050 boxes) |
|
|
210
|
-
| Pile, 1000 boxes and spheres | 3.
|
|
211
|
-
| Pile, 4000 boxes and spheres |
|
|
299
|
+
| Pyramid, 20 rows (210 boxes) | 0.09 | 0.51 | 6.3 |
|
|
300
|
+
| Pyramid, 50 rows (1275 boxes) | 0.98 | 7.45, collapses | 68.2, collapses |
|
|
301
|
+
| Pyramid, 100 rows (5050 boxes) | 28.2 | 27.5, collapses | 174, collapses |
|
|
302
|
+
| Pile, 1000 boxes and spheres | 3.44 | 4.48 | 31.3 |
|
|
303
|
+
| Pile, 4000 boxes and spheres | 20.9 | 22.0 | 183 |
|
|
304
|
+
|
|
305
|
+
The same Box3D scenes on the threaded build. Havok and Oimo have no equivalent, so this is time the other two cannot
|
|
306
|
+
take back:
|
|
307
|
+
|
|
308
|
+
| Scene | 1 thread | 4 workers | 8 workers |
|
|
309
|
+
| --- | ---: | ---: | ---: |
|
|
310
|
+
| Pyramid, 20 rows (210 boxes) | 0.09 | 0.05 | 0.11 |
|
|
311
|
+
| Pyramid, 50 rows (1275 boxes) | 0.98 | 0.42 | 0.34 |
|
|
312
|
+
| Pyramid, 100 rows (5050 boxes) | 28.2 | 7.55 | 5.72 |
|
|
313
|
+
| Pile, 1000 boxes and spheres | 3.44 | 1.38 | 1.65 |
|
|
314
|
+
| Pile, 4000 boxes and spheres | 20.9 | 7.21 | 6.31 |
|
|
212
315
|
|
|
213
316
|
- Box3D keeps every pyramid standing for 30 s of simulated time, up to 100 rows. With Babylon's default Havok setup
|
|
214
317
|
a 30 row pyramid is flat within 30 s and a 50 row one within 10 s (`bench/results/pyramid-stability-*.md`).
|
|
215
|
-
- In the piles Havok's own world step is faster (
|
|
216
|
-
faster because the plugin only syncs bodies that Box3D reports as moved.
|
|
217
|
-
-
|
|
218
|
-
|
|
318
|
+
- In the piles Havok's own world step is faster on one thread (15.7 ms vs 19.5 ms at 4000 bodies). Box3D's full
|
|
319
|
+
Babylon step is faster because the plugin only syncs bodies that Box3D reports as moved.
|
|
320
|
+
- The 210 box pyramid is slower with 8 workers than with none, and the 1000 body pile is better at 4 than at 8:
|
|
321
|
+
splitting a step is not free, and the scenes that pay for it are the big ones.
|
|
322
|
+
- Every threaded run ends in the same state as the single threaded one. The result column in all three tables is
|
|
323
|
+
identical, drift and pile height included, which is the determinism claim holding at 5050 bodies.
|
|
324
|
+
- Chrome tells the same story, threads included: 23.6 ms to 7.5 ms on the 100 row pyramid, 23.6 ms to 6.8 ms on the
|
|
325
|
+
4000 body pile at 8 workers. The one place it differs is that pile on one thread, where Chrome puts Havok's full
|
|
326
|
+
step ahead of Box3D's (20.6 ms against 23.6 ms) while node has them the other way round (`bench/results/chrome-*.md`).
|
|
327
|
+
- Full tables, including sleep off, p95 and max step times, are in `bench/results`. Run `npm run bench`,
|
|
328
|
+
`npm run bench -- --workers 4`, or open `bench.html` from `npm run demo` and set the worker count there.
|
|
219
329
|
|
|
220
330
|
## Building
|
|
221
331
|
|
|
@@ -231,8 +341,23 @@ plugin through Babylon's own classes against the real wasm: constraints, events,
|
|
|
231
341
|
activation and a zombie ragdoll (18 jointed boxes dropped and stepped for 10 s). Several of them build the same scene
|
|
232
342
|
with Havok and compare, which is what pins the Havok compatible behaviour down.
|
|
233
343
|
|
|
234
|
-
|
|
235
|
-
|
|
344
|
+
`npm run build:wasm` produces both builds: the single threaded one in `lib/esm`, `lib/umd` and `lib/node`, and the
|
|
345
|
+
threaded one in `lib/esm-threads` and `lib/node-threads`. Add `--no-threads` to skip the second while iterating on the
|
|
346
|
+
shim. Both are wasm SIMD128; the threaded one adds `-pthread` and a pool of 8 workers, which is the cap the shim
|
|
347
|
+
clamps `workerCount` to. `npm run bench -- --workers 4` runs the benchmark on it.
|
|
348
|
+
|
|
349
|
+
## Patches to Box3D
|
|
350
|
+
|
|
351
|
+
The wasm is built from the box3d commit in `UPSTREAM_COMMIT` plus the patches in `wasm/patches`. `npm run build:wasm`
|
|
352
|
+
copies the checkout's `src` and `include` into `build/box3d-src` and applies the patches there, so the checkout itself
|
|
353
|
+
stays exactly upstream's commit, and a change to the patch set rebuilds every object.
|
|
354
|
+
|
|
355
|
+
| patch | what it changes |
|
|
356
|
+
| --- | --- |
|
|
357
|
+
| `0001-broad-phase-prunes-by-mask.patch` | A shape that moved queries the broad phase with its own mask bits instead of every category (unless it is in a positive group, which overrides masks). A body whose shapes are filtered against each other then skips its own subtree instead of visiting every sibling shape before rejecting it. Which pairs collide does not change. |
|
|
358
|
+
| `0002-continuous-per-body.patch` | `b3Body_EnableContinuous` and `b3Body_IsContinuousEnabled` (shim: `bx_Body_EnableContinuous`, `bx_Body_IsContinuousEnabled`): continuous collision switched for one body. The world's switch still applies. A body made of many small shapes is swept shape by shape whenever its smallest shape moves fast enough, which can cost more than the rest of the step. |
|
|
359
|
+
|
|
360
|
+
`test/wasm.patches.test.ts` covers both. Neither has been offered upstream.
|
|
236
361
|
|
|
237
362
|
## License
|
|
238
363
|
|
package/dist/box3dPlugin.d.ts
CHANGED
|
@@ -114,6 +114,26 @@ export declare class Box3DWheelJoint {
|
|
|
114
114
|
*/
|
|
115
115
|
dispose(): void;
|
|
116
116
|
}
|
|
117
|
+
/**
|
|
118
|
+
* Options for the Box3D plugin, passed to the constructor after the module.
|
|
119
|
+
*/
|
|
120
|
+
export interface IBox3DPluginOptions {
|
|
121
|
+
/**
|
|
122
|
+
* Workers box3d may put on a world step, counting the thread the step is called on. 1 (the default) keeps
|
|
123
|
+
* everything on the calling thread. Anything above 1 needs the threaded build of the module
|
|
124
|
+
* (`LoadBox3D({ threads: true })` or `babylon-box3d/wasm/threads`), which in turn needs a cross origin isolated
|
|
125
|
+
* page; on the single threaded module the request is clamped to 1 and a warning explains why.
|
|
126
|
+
* "auto" asks for half of `navigator.hardwareConcurrency`, capped at what the build supports: box3d gains little
|
|
127
|
+
* from the second thread of a core, and leaving room for rendering matters more than the last worker.
|
|
128
|
+
* The world is created in the constructor and box3d builds its threads with it, so this cannot change later.
|
|
129
|
+
*/
|
|
130
|
+
workerCount?: number | "auto";
|
|
131
|
+
/**
|
|
132
|
+
* Solver sub steps per world step. Box3D's default of 4 is what keeps tall stacks standing; 2 roughly halves
|
|
133
|
+
* solver time and is worth trying for scenes that are mostly loose bodies, 8 buys stiffness in exchange for time.
|
|
134
|
+
*/
|
|
135
|
+
subStepCount?: number;
|
|
136
|
+
}
|
|
117
137
|
/**
|
|
118
138
|
* Box3D physics plugin for Babylon.js physics v2.
|
|
119
139
|
* Box3D is Erin Catto's 3D rigid body engine (https://github.com/erincatto/box3d). This plugin drives the
|
|
@@ -124,6 +144,12 @@ export declare class Box3DWheelJoint {
|
|
|
124
144
|
* const box3d = await Box3D();
|
|
125
145
|
* scene.enablePhysics(new Vector3(0, -9.81, 0), new Box3DPlugin(true, box3d));
|
|
126
146
|
* ```
|
|
147
|
+
* On a cross origin isolated page the threaded module can spread a step over several workers:
|
|
148
|
+
* ```ts
|
|
149
|
+
* import { LoadBox3D, Box3DPlugin } from "babylon-box3d";
|
|
150
|
+
* const box3d = await LoadBox3D({ threads: "auto" });
|
|
151
|
+
* scene.enablePhysics(new Vector3(0, -9.81, 0), new Box3DPlugin(true, box3d, { workerCount: "auto" }));
|
|
152
|
+
* ```
|
|
127
153
|
*/
|
|
128
154
|
export declare class Box3DPlugin implements IPhysicsEnginePluginV2 {
|
|
129
155
|
private _useDeltaForWorldStep;
|
|
@@ -133,6 +159,8 @@ export declare class Box3DPlugin implements IPhysicsEnginePluginV2 {
|
|
|
133
159
|
name: string;
|
|
134
160
|
/** Number of solver sub steps per world step. Box3D recommends 4. */
|
|
135
161
|
subStepCount: number;
|
|
162
|
+
/** Workers box3d puts on a world step, counting the calling thread. 1 unless the threaded module asked for more. */
|
|
163
|
+
readonly workerCount: number;
|
|
136
164
|
/** Wall clock time of the last world step in milliseconds (JavaScript side, includes the event sync). */
|
|
137
165
|
lastStepTimeMs: number;
|
|
138
166
|
private _b3;
|
|
@@ -162,8 +190,16 @@ export declare class Box3DPlugin implements IPhysicsEnginePluginV2 {
|
|
|
162
190
|
* Creates a Box3D plugin.
|
|
163
191
|
* @param _useDeltaForWorldStep step the world with the frame delta (true) or a fixed time step (false)
|
|
164
192
|
* @param box3dModule the resolved Box3D WASM module (await Box3DModule())
|
|
193
|
+
* @param options worker count and sub steps, see IBox3DPluginOptions
|
|
194
|
+
*/
|
|
195
|
+
constructor(_useDeltaForWorldStep: boolean | undefined, box3dModule: any, options?: IBox3DPluginOptions);
|
|
196
|
+
/**
|
|
197
|
+
* Turns the requested worker count into one this module can honour. Only the threaded build reports more than one,
|
|
198
|
+
* and asking a single threaded build for workers is quiet enough to look like it worked, so say so once.
|
|
199
|
+
* @param requested the constructor option
|
|
200
|
+
* @returns the count to create the world with
|
|
165
201
|
*/
|
|
166
|
-
|
|
202
|
+
private _resolveWorkerCount;
|
|
167
203
|
private _scratch;
|
|
168
204
|
private _warnOnce;
|
|
169
205
|
private _getPluginReference;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"box3dPlugin.d.ts","sourceRoot":"","sources":["../src/box3dPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,UAAU,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,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,oBAAoB,GAAG,KAAK,CAAC,oBAAoB,CAAC,EAAE,KAAK,CAAC,EAAE,aAAa,GAAG,IAAI;IAwDnI;;;;;OAKG;IACH,OAAO,CAAC,WAAW;IAUnB,OAAO,CAAC,iBAAiB;IAqEzB,OAAO,CAAC,eAAe;IAuBhB,OAAO,IAAI,IAAI;CAmBzB"}
|
package/dist/box3dPlugin.js
CHANGED
|
@@ -317,7 +317,8 @@ const RequiredNativeExports = [
|
|
|
317
317
|
"_bx_Body_SetMassDataFull", "_bx_Body_SetMotionLocks", "_bx_Body_SetShape", "_bx_Body_SetTargetTransform", "_bx_Body_SetTransform",
|
|
318
318
|
"_bx_Body_SetType", "_bx_Body_SyncShapeDesc", "_bx_ComputeAlignedFrameB", "_bx_ContactEventsPtr", "_bx_CreateBody", "_bx_CreateJoint",
|
|
319
319
|
"_bx_CreateWorld", "_bx_DebugIndexCount", "_bx_DebugIndicesPtr", "_bx_DebugPositionsPtr", "_bx_DestroyBody", "_bx_DestroyJoint",
|
|
320
|
-
"_bx_DestroyWorld", "
|
|
320
|
+
"_bx_DestroyWorld", "_bx_GetMaxWorkers", "_bx_GetRejectedSlotCount", "_bx_Joint_EnableLimit", "_bx_Joint_EnableMotor",
|
|
321
|
+
"_bx_Joint_EnableSpring", "_bx_Joint_IsValid",
|
|
321
322
|
"_bx_Joint_SetCollideConnected", "_bx_Joint_SetConstraintTuning", "_bx_Joint_SetLimits", "_bx_Joint_SetMaxMotorForce",
|
|
322
323
|
"_bx_Joint_SetMotorSpeed", "_bx_Joint_SetSphericalMotor", "_bx_Joint_SetSphericalTarget", "_bx_Joint_SetSpring", "_bx_Joint_SetTarget",
|
|
323
324
|
"_bx_Joint_SetTwistLimits", "_bx_Joint_UpdateMotorFrame", "_bx_Joint_WakeBodies", "_bx_MoveEventsPtr", "_bx_RayHitsPtr", "_bx_Scratch",
|
|
@@ -328,7 +329,8 @@ const RequiredNativeExports = [
|
|
|
328
329
|
"_bx_ShapeDesc_GetRestitution", "_bx_ShapeDesc_RemoveChild", "_bx_ShapeDesc_SetDensity", "_bx_ShapeDesc_SetFilter", "_bx_ShapeDesc_SetGroup",
|
|
329
330
|
"_bx_ShapeDesc_SetMaterial", "_bx_ShapeDesc_SetRollingResistance", "_bx_ShapeDesc_SetSensor", "_bx_World_CastRay", "_bx_World_EnableContinuous",
|
|
330
331
|
"_bx_World_EnableSleeping", "_bx_World_Explode", "_bx_World_GetContactEvents", "_bx_World_GetMaximumLinearSpeed", "_bx_World_GetMoveEvents",
|
|
331
|
-
"_bx_World_GetSensorEvents", "_bx_World_GetStats", "
|
|
332
|
+
"_bx_World_GetSensorEvents", "_bx_World_GetStats", "_bx_World_GetWorkerCount", "_bx_World_SetGravity", "_bx_World_SetMaximumLinearSpeed",
|
|
333
|
+
"_bx_World_Step"
|
|
332
334
|
];
|
|
333
335
|
/**
|
|
334
336
|
* Box3D physics plugin for Babylon.js physics v2.
|
|
@@ -340,19 +342,28 @@ const RequiredNativeExports = [
|
|
|
340
342
|
* const box3d = await Box3D();
|
|
341
343
|
* scene.enablePhysics(new Vector3(0, -9.81, 0), new Box3DPlugin(true, box3d));
|
|
342
344
|
* ```
|
|
345
|
+
* On a cross origin isolated page the threaded module can spread a step over several workers:
|
|
346
|
+
* ```ts
|
|
347
|
+
* import { LoadBox3D, Box3DPlugin } from "babylon-box3d";
|
|
348
|
+
* const box3d = await LoadBox3D({ threads: "auto" });
|
|
349
|
+
* scene.enablePhysics(new Vector3(0, -9.81, 0), new Box3DPlugin(true, box3d, { workerCount: "auto" }));
|
|
350
|
+
* ```
|
|
343
351
|
*/
|
|
344
352
|
export class Box3DPlugin {
|
|
345
353
|
/**
|
|
346
354
|
* Creates a Box3D plugin.
|
|
347
355
|
* @param _useDeltaForWorldStep step the world with the frame delta (true) or a fixed time step (false)
|
|
348
356
|
* @param box3dModule the resolved Box3D WASM module (await Box3DModule())
|
|
357
|
+
* @param options worker count and sub steps, see IBox3DPluginOptions
|
|
349
358
|
*/
|
|
350
|
-
constructor(_useDeltaForWorldStep = true, box3dModule) {
|
|
359
|
+
constructor(_useDeltaForWorldStep = true, box3dModule, options) {
|
|
351
360
|
this._useDeltaForWorldStep = _useDeltaForWorldStep;
|
|
352
361
|
/** Name of the plugin */
|
|
353
362
|
this.name = "Box3DPlugin";
|
|
354
363
|
/** Number of solver sub steps per world step. Box3D recommends 4. */
|
|
355
364
|
this.subStepCount = 4;
|
|
365
|
+
/** Workers box3d puts on a world step, counting the calling thread. 1 unless the threaded module asked for more. */
|
|
366
|
+
this.workerCount = 1;
|
|
356
367
|
/** Wall clock time of the last world step in milliseconds (JavaScript side, includes the event sync). */
|
|
357
368
|
this.lastStepTimeMs = 0;
|
|
358
369
|
this._worldSlot = 0;
|
|
@@ -388,10 +399,43 @@ export class Box3DPlugin {
|
|
|
388
399
|
}
|
|
389
400
|
this._b3 = box3dModule;
|
|
390
401
|
this.world = box3dModule;
|
|
391
|
-
|
|
402
|
+
if (options?.subStepCount !== undefined) {
|
|
403
|
+
this.subStepCount = Math.max(1, Math.round(options.subStepCount));
|
|
404
|
+
}
|
|
405
|
+
this._worldSlot = this._b3._bx_CreateWorld(0, -9.81, 0, this._resolveWorkerCount(options?.workerCount));
|
|
392
406
|
if (!this._worldSlot) {
|
|
393
407
|
throw new Error("Box3D: could not create a world (max worlds reached?)");
|
|
394
408
|
}
|
|
409
|
+
// what box3d settled on, which is the request clamped to what this build of the module can run
|
|
410
|
+
this.workerCount = Math.max(1, this._b3._bx_World_GetWorkerCount(this._worldSlot));
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* Turns the requested worker count into one this module can honour. Only the threaded build reports more than one,
|
|
414
|
+
* and asking a single threaded build for workers is quiet enough to look like it worked, so say so once.
|
|
415
|
+
* @param requested the constructor option
|
|
416
|
+
* @returns the count to create the world with
|
|
417
|
+
*/
|
|
418
|
+
_resolveWorkerCount(requested) {
|
|
419
|
+
const supported = Math.max(1, this._b3._bx_GetMaxWorkers());
|
|
420
|
+
if (requested === undefined) {
|
|
421
|
+
return 1;
|
|
422
|
+
}
|
|
423
|
+
let wanted;
|
|
424
|
+
if (requested === "auto") {
|
|
425
|
+
const cores = (typeof navigator !== "undefined" && navigator.hardwareConcurrency) || 4;
|
|
426
|
+
// half the reported cores: the other half is usually the second thread of each core, and box3d gains
|
|
427
|
+
// little from those, while the renderer still needs somewhere to run
|
|
428
|
+
wanted = Math.max(1, Math.floor(cores / 2));
|
|
429
|
+
}
|
|
430
|
+
else {
|
|
431
|
+
wanted = Math.max(1, Math.round(requested));
|
|
432
|
+
}
|
|
433
|
+
if (wanted > 1 && supported === 1) {
|
|
434
|
+
this._warnOnce("single-threaded-module", `${wanted} workers were requested, but this Box3D module was built without threads, so the step stays on the calling ` +
|
|
435
|
+
"thread. Load the threaded build (LoadBox3D({ threads: true }), or babylon-box3d/wasm/threads) from a cross origin " +
|
|
436
|
+
"isolated page: it needs SharedArrayBuffer, which browsers only allow with the COOP and COEP headers set.");
|
|
437
|
+
}
|
|
438
|
+
return Math.min(wanted, supported);
|
|
395
439
|
}
|
|
396
440
|
// ----------------------------------------------------------------------------------------
|
|
397
441
|
// helpers
|