babylon-box3d 0.2.0 → 0.4.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 CHANGED
@@ -69,6 +69,68 @@ export default defineConfig({
69
69
  });
70
70
  ```
71
71
 
72
+ ## Threads
73
+
74
+ Box3D can run one world step on several threads. The package ships a second build of the wasm for that, because
75
+ 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)
76
+ page - one served with:
77
+
78
+ ```
79
+ Cross-Origin-Opener-Policy: same-origin
80
+ Cross-Origin-Embedder-Policy: require-corp
81
+ ```
82
+
83
+ `LoadBox3D` picks the build and the plugin asks for the workers:
84
+
85
+ ```ts
86
+ import { Vector3 } from "@babylonjs/core/Maths/math.vector";
87
+ import { LoadBox3D, Box3DPlugin } from "babylon-box3d";
88
+
89
+ // "auto" uses the threaded build where the page allows it and the single threaded one everywhere else
90
+ const box3d = await LoadBox3D({ threads: "auto" });
91
+ scene.enablePhysics(new Vector3(0, -9.81, 0), new Box3DPlugin(true, box3d, { workerCount: "auto" }));
92
+ ```
93
+
94
+ `workerCount` counts the thread the step is called on, so 4 means this thread and 3 others. `"auto"` asks for half
95
+ of `navigator.hardwareConcurrency`: box3d gains little from the second thread of a core, and the renderer still needs
96
+ somewhere to run. The threaded module is imported dynamically, so a page that never asks for threads never downloads
97
+ it. `CanUseBox3DThreads()` reports whether this page can run them.
98
+
99
+ Everything degrades rather than breaking. On a page that is not isolated, `threads: "auto"` loads the single threaded
100
+ build, `workerCount` is clamped to 1 and the plugin says so once in the console. `threads: true` throws instead, for
101
+ an app that would rather find out than quietly run on one thread. Isolation is a hosting decision: a static host that
102
+ cannot add response headers (GitHub Pages, for one) can never run them, and the headers also block cross origin
103
+ resources that do not opt in with CORS or `Cross-Origin-Resource-Policy`, which is worth checking before turning them
104
+ on for a whole site. `npm run demo` sets both headers, so the showcase runs threads with `?workers=4`.
105
+
106
+ What the threads do and do not change:
107
+
108
+ - **Results do not change.** The same scene stepped the same number of times lands on bit identical positions at any
109
+ worker count, which is what `test/threads.test.ts` checks against the single threaded build.
110
+ - **The step still returns when it returns.** The calling thread does its share of the work and the step is over when
111
+ the last worker is done; nothing is deferred to the next frame, so there is no extra latency and no API change.
112
+ - **Other engines run on one thread.** Havok's Babylon plugin is single threaded, so this is cores nothing else in
113
+ Babylon is using.
114
+ - **Small scenes gain nothing.** Splitting a step costs something; under a few hundred awake bodies it is not worth
115
+ it. Ask for workers on the scenes that need them.
116
+ - **There is no threaded script tag build.** A Playground or CDN page is not isolated, so it could not start one.
117
+
118
+ The threads themselves belong to the module, not to a world: they are created once, shared by every world, and never
119
+ joined. That is deliberate. Box3D's own scheduler creates threads with a world and joins them when it is destroyed,
120
+ and joining is what deadlocks a browser - a worker that has not finished starting cannot finish while the main thread
121
+ waits for it in `pthread_join`, and disposing a scene and building the next one in the same function is enough to
122
+ reach that. The shim hands box3d its own task system instead (`wasm/box3d_shim.c`), so worlds come and go freely.
123
+
124
+ ### Tuning
125
+
126
+ - `subStepCount` (default 4, box3d's own) is the solver's sub steps per step: `new Box3DPlugin(true, box3d, {
127
+ subStepCount: 2 })`, or `plugin.subStepCount` at any time. Tall stacks need the 4; 2 roughly halves solver time for
128
+ scenes that are mostly loose bodies, 8 buys stiffness in exchange for time.
129
+ - `plugin.setSleepingEnabled(false)` measures raw throughput but costs a lot in a settled scene: sleeping is why a
130
+ standing pyramid is nearly free.
131
+ - Contact events cross into JavaScript one record per contact per step. A body nothing listens to should not be
132
+ asking for them: `body.setCollisionCallbackEnabled(false)`, which is the default.
133
+
72
134
  ## What is covered
73
135
 
74
136
  | Babylon v2 | Box3D |
@@ -119,6 +181,18 @@ const terrain = new PhysicsShape(
119
181
 
120
182
  A ray's `triangleIndex` is the height field triangle it hit, as it is for a mesh.
121
183
 
184
+ **Shapes from points.** `CONVEX_HULL` and `MESH` take their points straight from `positions`, as x, y, z triplets in the
185
+ body's space, when no `mesh` is given, so code with no meshes to read them from, like a headless simulation, can still
186
+ build them. A mesh also takes `positionIndices`, three per triangle, wound so the plain cross product of (b - a) and
187
+ (c - a) points out of the surface. That is Box3D's own winding, so nothing is flipped for a left handed scene:
188
+
189
+ ```ts
190
+ const hull = new PhysicsShape({ type: PhysicsShapeType.CONVEX_HULL, parameters: { positions } }, scene);
191
+ const road = new PhysicsShape({ type: PhysicsShapeType.MESH, parameters: { positions, positionIndices } }, scene);
192
+ ```
193
+
194
+ A `CYLINDER` runs from `pointA` to `pointB`. Before 0.3.0 it was built half its height further along its axis.
195
+
122
196
  `PhysicsMassProperties` follows Havok: `inertia` is the principal moments **per unit mass** (so setting only `mass`
123
197
  scales the shape's inertia with it), `inertiaOrientation` rotates those principal axes into body space, and a zero
124
198
  component means infinite inertia about that axis. Box3D needs an invertible tensor, so a locked axis gets a moment
@@ -169,10 +243,12 @@ and mesh winding is flipped, exactly like the Havok plugin.
169
243
  | path | what |
170
244
  | --- | --- |
171
245
  | `src/box3dPlugin.ts` | the plugin (`IPhysicsEnginePluginV2`) |
172
- | `src/index.ts` | package entry: `Box3DPlugin`, `Box3DWheelJoint`, `Box3D` (wasm factory) |
246
+ | `src/index.ts` | package entry: `Box3DPlugin`, `Box3DWheelJoint`, `Box3D` (wasm factory), `LoadBox3D` |
247
+ | `src/loadBox3D.ts` | picks the single threaded or threaded wasm build for the page |
173
248
  | `wasm/box3d_shim.c` | C shim: flat, handle based API over box3d (`bx_*` functions) |
174
- | `wasm/build.mjs` | emcc build for `lib/esm`, `lib/umd` (global `Box3D`) and `lib/node` |
249
+ | `wasm/build.mjs` | emcc build for `lib/esm`, `lib/umd` (global `Box3D`), `lib/node` and the threaded pair |
175
250
  | `lib/` | committed wasm builds and typings, `UPSTREAM_COMMIT` is the box3d commit |
251
+ | `lib/esm-threads`, `lib/node-threads` | the same module built with pthreads, see [Threads](#threads) |
176
252
  | `umd/` | plugin bundle for script tags (global `BABYLONBOX3D`), built by `npm run build:umd` |
177
253
  | `demo/` | vite showcase: `npm run demo`, then `http://localhost:5178/?demo=pyramid` |
178
254
  | `docs/` | the community extension page for the Babylon.js documentation |
@@ -188,22 +264,41 @@ wrecking ball), plus `stack`, `joints`, `terrain`, `compound` feature tests. Add
188
264
  Box3D, Havok and Oimo build the same scenes through Babylon's regular physics API (v2 for Box3D and Havok, v1 for
189
265
  Oimo), with engine defaults, a fixed 1/60 s step and nothing rendered. "Step" is Babylon's whole physics step,
190
266
  "engine" is only the engine's own world step. Median of 3 interleaved runs after a warm up, AMD Ryzen 9 5900X,
191
- Babylon.js 8.56.2, @babylonjs/havok 1.3.14, oimo 1.0.9. Mean milliseconds per step, sleep on:
267
+ Babylon.js 9.26.1, @babylonjs/havok 1.3.14, oimo 1.0.9, node 24. Mean milliseconds per step, sleep on, every engine
268
+ on one thread (2026-09-17):
192
269
 
193
270
  | Scene | Box3D | Havok | Oimo |
194
271
  | --- | ---: | ---: | ---: |
195
- | Pyramid, 20 rows (210 boxes) | 0.09 | 0.47 | 5.94 |
196
- | Pyramid, 50 rows (1275 boxes) | 0.89 | 7.05, collapses | 69.4, collapses |
197
- | Pyramid, 100 rows (5050 boxes) | 31.7 | 29.9, collapses | 219, collapses |
198
- | Pile, 1000 boxes and spheres | 3.45 | 4.26 | 33.3 |
199
- | Pile, 4000 boxes and spheres | 22.0 | 23.8 | 196 |
272
+ | Pyramid, 20 rows (210 boxes) | 0.09 | 0.51 | 6.3 |
273
+ | Pyramid, 50 rows (1275 boxes) | 0.98 | 7.45, collapses | 68.2, collapses |
274
+ | Pyramid, 100 rows (5050 boxes) | 28.2 | 27.5, collapses | 174, collapses |
275
+ | Pile, 1000 boxes and spheres | 3.44 | 4.48 | 31.3 |
276
+ | Pile, 4000 boxes and spheres | 20.9 | 22.0 | 183 |
277
+
278
+ The same Box3D scenes on the threaded build. Havok and Oimo have no equivalent, so this is time the other two cannot
279
+ take back:
280
+
281
+ | Scene | 1 thread | 4 workers | 8 workers |
282
+ | --- | ---: | ---: | ---: |
283
+ | Pyramid, 20 rows (210 boxes) | 0.09 | 0.05 | 0.11 |
284
+ | Pyramid, 50 rows (1275 boxes) | 0.98 | 0.42 | 0.34 |
285
+ | Pyramid, 100 rows (5050 boxes) | 28.2 | 7.55 | 5.72 |
286
+ | Pile, 1000 boxes and spheres | 3.44 | 1.38 | 1.65 |
287
+ | Pile, 4000 boxes and spheres | 20.9 | 7.21 | 6.31 |
200
288
 
201
289
  - Box3D keeps every pyramid standing for 30 s of simulated time, up to 100 rows. With Babylon's default Havok setup
202
290
  a 30 row pyramid is flat within 30 s and a 50 row one within 10 s (`bench/results/pyramid-stability-*.md`).
203
- - In the piles Havok's own world step is faster (17.7 ms vs 20.8 ms at 4000 bodies). Box3D's full Babylon step is
204
- faster because the plugin only syncs bodies that Box3D reports as moved.
205
- - Chrome gives the same picture as node (`bench/results/chrome-*.md`). Full tables, including sleep off, p95 and
206
- max step times, are in `bench/results`. Run `npm run bench` or open `bench.html` from `npm run demo` to reproduce.
291
+ - 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
292
+ Babylon step is faster because the plugin only syncs bodies that Box3D reports as moved.
293
+ - The 210 box pyramid is slower with 8 workers than with none, and the 1000 body pile is better at 4 than at 8:
294
+ splitting a step is not free, and the scenes that pay for it are the big ones.
295
+ - Every threaded run ends in the same state as the single threaded one. The result column in all three tables is
296
+ identical, drift and pile height included, which is the determinism claim holding at 5050 bodies.
297
+ - 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
298
+ 4000 body pile at 8 workers. The one place it differs is that pile on one thread, where Chrome puts Havok's full
299
+ step ahead of Box3D's (20.6 ms against 23.6 ms) while node has them the other way round (`bench/results/chrome-*.md`).
300
+ - Full tables, including sleep off, p95 and max step times, are in `bench/results`. Run `npm run bench`,
301
+ `npm run bench -- --workers 4`, or open `bench.html` from `npm run demo` and set the worker count there.
207
302
 
208
303
  ## Building
209
304
 
@@ -219,8 +314,10 @@ plugin through Babylon's own classes against the real wasm: constraints, events,
219
314
  activation and a zombie ragdoll (18 jointed boxes dropped and stepped for 10 s). Several of them build the same scene
220
315
  with Havok and compare, which is what pins the Havok compatible behaviour down.
221
316
 
222
- The wasm build is single threaded with wasm SIMD128. Box3D's task scheduler could run on wasm threads later, that
223
- needs `SharedArrayBuffer` and cross origin isolation.
317
+ `npm run build:wasm` produces both builds: the single threaded one in `lib/esm`, `lib/umd` and `lib/node`, and the
318
+ threaded one in `lib/esm-threads` and `lib/node-threads`. Add `--no-threads` to skip the second while iterating on the
319
+ shim. Both are wasm SIMD128; the threaded one adds `-pthread` and a pool of 8 workers, which is the cap the shim
320
+ clamps `workerCount` to. `npm run bench -- --workers 4` runs the benchmark on it.
224
321
 
225
322
  ## License
226
323
 
@@ -22,6 +22,17 @@ declare module "@babylonjs/core/Physics/v2/IPhysicsEnginePlugin.js" {
22
22
  * keep it below 255 for solid ground.
23
23
  */
24
24
  heightFieldMaterials?: ArrayLike<number>;
25
+ /**
26
+ * `CONVEX_HULL` and `MESH` without a `mesh`: the points as x, y, z triplets in the body's space, for code that
27
+ * builds shapes with no meshes to read them from, like a headless simulation.
28
+ */
29
+ positions?: ArrayLike<number>;
30
+ /**
31
+ * `MESH` with `positions`: three indices into the points per triangle, wound so the plain cross product of
32
+ * (b - a) and (c - a) points out of the surface. That is Box3D's own winding, and it is used as given: no
33
+ * flip for a left handed scene, which only applies to winding read from a Babylon mesh.
34
+ */
35
+ positionIndices?: ArrayLike<number>;
25
36
  }
26
37
  }
27
38
  /**
@@ -103,6 +114,26 @@ export declare class Box3DWheelJoint {
103
114
  */
104
115
  dispose(): void;
105
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
+ }
106
137
  /**
107
138
  * Box3D physics plugin for Babylon.js physics v2.
108
139
  * Box3D is Erin Catto's 3D rigid body engine (https://github.com/erincatto/box3d). This plugin drives the
@@ -113,6 +144,12 @@ export declare class Box3DWheelJoint {
113
144
  * const box3d = await Box3D();
114
145
  * scene.enablePhysics(new Vector3(0, -9.81, 0), new Box3DPlugin(true, box3d));
115
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
+ * ```
116
153
  */
117
154
  export declare class Box3DPlugin implements IPhysicsEnginePluginV2 {
118
155
  private _useDeltaForWorldStep;
@@ -122,6 +159,8 @@ export declare class Box3DPlugin implements IPhysicsEnginePluginV2 {
122
159
  name: string;
123
160
  /** Number of solver sub steps per world step. Box3D recommends 4. */
124
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;
125
164
  /** Wall clock time of the last world step in milliseconds (JavaScript side, includes the event sync). */
126
165
  lastStepTimeMs: number;
127
166
  private _b3;
@@ -151,8 +190,16 @@ export declare class Box3DPlugin implements IPhysicsEnginePluginV2 {
151
190
  * Creates a Box3D plugin.
152
191
  * @param _useDeltaForWorldStep step the world with the frame delta (true) or a fixed time step (false)
153
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
154
201
  */
155
- constructor(_useDeltaForWorldStep: boolean | undefined, box3dModule: any);
202
+ private _resolveWorkerCount;
156
203
  private _scratch;
157
204
  private _warnOnce;
158
205
  private _getPluginReference;
@@ -283,6 +330,7 @@ export declare class Box3DPlugin implements IPhysicsEnginePluginV2 {
283
330
  private _withIntBuffer;
284
331
  private _createOptionsFromGroundMesh;
285
332
  initShape(shape: PhysicsShape, type: PhysicsShapeType, options: PhysicsShapeParameters): void;
333
+ private _initShapeFromPositions;
286
334
  private _refreshShapeUsers;
287
335
  /**
288
336
  * Pushes changed description properties into the Box3D shapes that are already on the bodies using this shape,
@@ -1 +1 @@
1
- {"version":3,"file":"box3dPlugin.d.ts","sourceRoot":"","sources":["../src/box3dPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,UAAU,EAAc,OAAO,EAAE,MAAM,sCAAsC,CAAC;AAC/F,OAAO,EACH,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,0BAA0B,EAC/B,gBAAgB,EAEhB,iBAAiB,EACjB,qBAAqB,EACrB,8BAA8B,EAC9B,0BAA0B,EAG1B,wBAAwB,EAC3B,MAAM,oDAAoD,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,i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AAE,MAAM,GAAG,IAAI;IAM1E;;;;;OAKG;IACI,oBAAoB,CAAC,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,OAAO,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI;IAI5F;;;;;;OAMG;IACI,gBAAgB,CAAC,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,uBAAuB,GAAG,eAAe;IA8CpH;;;;;;;;;;;OAWG;IACI,mBAAmB,CAAC,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,SAAI,EAAE,YAAY,SAAI,EAAE,SAAS,SAAS,GAAG,MAAM;IAY3J;;;OAGG;IACI,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAI5C;;OAEG;IACI,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAM7C;;OAEG;IACI,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI;IAU7D,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"}
@@ -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", "_bx_GetRejectedSlotCount", "_bx_Joint_EnableLimit", "_bx_Joint_EnableMotor", "_bx_Joint_EnableSpring", "_bx_Joint_IsValid",
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", "_bx_World_SetGravity", "_bx_World_SetMaximumLinearSpeed", "_bx_World_Step"
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
- this._worldSlot = this._b3._bx_CreateWorld(0, -9.81, 0);
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
@@ -1181,7 +1225,6 @@ export class Box3DPlugin {
1181
1225
  const b = options.pointB ?? Vector3.UpReadOnly;
1182
1226
  const axis = b.subtract(a);
1183
1227
  const height = axis.length();
1184
- const mid = a.add(b).scaleInPlace(0.5);
1185
1228
  const q = this._tmpQuat[0];
1186
1229
  if (height > 1e-6) {
1187
1230
  axis.scaleInPlace(1 / height);
@@ -1190,11 +1233,16 @@ export class Box3DPlugin {
1190
1233
  else {
1191
1234
  q.set(0, 0, 0, 1);
1192
1235
  }
1193
- this._registerShape(shape, b3._bx_ShapeDesc_CreateCylinder(height, options.radius ?? 0, 16, mid.x, mid.y, mid.z, q.x, q.y, q.z, q.w), type);
1236
+ // Box3D's cylinder runs from 0 to height along its local Y, so it goes at pointA, not at the middle.
1237
+ this._registerShape(shape, b3._bx_ShapeDesc_CreateCylinder(height, options.radius ?? 0, 16, a.x, a.y, a.z, q.x, q.y, q.z, q.w), type);
1194
1238
  break;
1195
1239
  }
1196
1240
  case PhysicsShapeType.CONVEX_HULL:
1197
1241
  case PhysicsShapeType.MESH: {
1242
+ if (!options.mesh && options.positions) {
1243
+ this._initShapeFromPositions(shape, type, options.positions, options.positionIndices);
1244
+ break;
1245
+ }
1198
1246
  const mesh = options.mesh;
1199
1247
  if (!mesh) {
1200
1248
  throw new Error("No mesh provided to create physics shape.");
@@ -1258,6 +1306,26 @@ export class Box3DPlugin {
1258
1306
  throw new Error("Unsupported Shape Type.");
1259
1307
  }
1260
1308
  }
1309
+ _initShapeFromPositions(shape, type, positions, indices) {
1310
+ const b3 = this._b3;
1311
+ if (positions.length % 3 !== 0) {
1312
+ throw new Error(`positions needs x, y, z triplets, got ${positions.length} numbers`);
1313
+ }
1314
+ const vertexCount = positions.length / 3;
1315
+ if (type === PhysicsShapeType.CONVEX_HULL) {
1316
+ this._registerShape(shape, this._withFloatBuffer(positions, (ptr) => b3._bx_ShapeDesc_CreateHull(ptr, vertexCount)), type);
1317
+ return;
1318
+ }
1319
+ if (!indices || indices.length % 3 !== 0) {
1320
+ throw new Error("a MESH shape from positions needs positionIndices, three per triangle");
1321
+ }
1322
+ for (let i = 0; i < indices.length; i++) {
1323
+ if (indices[i] < 0 || indices[i] >= vertexCount || !Number.isInteger(indices[i])) {
1324
+ throw new Error(`positionIndices[${i}] is ${indices[i]}, but there are ${vertexCount} points`);
1325
+ }
1326
+ }
1327
+ this._registerShape(shape, this._withFloatBuffer(positions, (vptr) => this._withIntBuffer(indices, (iptr) => b3._bx_ShapeDesc_CreateMesh(vptr, vertexCount, iptr, indices.length / 3, 1, 1, 1, 0, 0))), type);
1328
+ }
1261
1329
  // Re-instantiates the shape on every body that uses it (or uses a container holding it). Only needed for geometry
1262
1330
  // and child changes; filters, materials and density are applied in place, see _syncShapeUsers.
1263
1331
  _refreshShapeUsers(data, visited = new Set()) {