avbd-babylon 0.4.1 → 0.4.3

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
@@ -77,7 +77,7 @@ JavaScript examples. Run `npm start`, then open the
77
77
  | Main thread versus dedicated worker and shared memory | [Copyable worker example and commands](#worker-and-shared-memory-benchmarks), [worker page](tests/workers.html), [worker runner](scripts/benchmark-workers.mjs) |
78
78
  | Batched body edits, pose reads and queries | [Bulk-edit examples](#bulk-edits-and-gpu-dispatches), [measurement code](tests/native-edit-performance.js), [runner](scripts/check-native-performance.mjs) |
79
79
  | CPU compatibility versus WebGPU | [Settings and results](#backend-differences-and-benchmarks), [measurement code](tests/compatibility-performance.js), [runner](scripts/benchmark-backends.mjs) |
80
- | Sleeping and waking in large connected scenes | [Sleeping example](#queries-callbacks-and-sleeping), [connected-wall runner](scripts/benchmark-connected-sleep.mjs) |
80
+ | Sleeping and waking in large connected scenes | [Sleeping example](#queries-callbacks-and-sleeping), [per-scene on/off runner](scripts/benchmark-scene-sleep.mjs), [connected-wall runner](scripts/benchmark-connected-sleep.mjs) |
81
81
  | Sleeping stability while grabbing and settling | [28K ring check](scripts/check-sleep-stability.mjs), [jointed-drop timing and view check](scripts/check-jointed-settling.mjs), [saved jointed-drop results](test-results/jointed-settling.json) |
82
82
  | Ships, buoyancy and water | [Scene explanation](#ships-water-and-destruction), [scene builder](demo/naval/scene.js), [runner](scripts/benchmark-naval.mjs) |
83
83
  | Grid versus HPLOC++ collisions | [Collision guide](docs/HPLOC.md), [paired scene measurements](tests/performance.js), [tree refit runner](scripts/benchmark-hploc-refit.mjs) |
@@ -112,7 +112,11 @@ The [startup check](scripts/check-demo-startup.mjs) initializes every demo in a
112
112
  paused worker with `--all` and records setup times separately from simulation
113
113
  performance. Shader caches, device checks and scene size affect those times.
114
114
  The scene view shows loading messages during setup, even with its performance
115
- panel collapsed. Worker startup reports also list the time spent in each setup phase.
115
+ panel collapsed, and stays visible until the first GPU frame completes. Worker
116
+ startup reports also list the time spent in each setup phase.
117
+ The web demo loads the selected demo and renderer on demand. Worker controls use
118
+ a small generated scene catalogue; scene construction and physics stay in the
119
+ worker. First use still includes GPU device setup and shader compilation.
116
120
 
117
121
  ## Install
118
122
 
@@ -124,7 +128,7 @@ npm install avbd-babylon @babylonjs/core
124
128
 
125
129
  For local development, run `npm install` and `npm run build` in this repository,
126
130
  then run `npm install /absolute/path/to/avbd` in your Babylon project. `npm pack`
127
- creates an installable `avbd-babylon-0.2.0.tgz` archive too.
131
+ creates an installable archive named for the current package version too.
128
132
 
129
133
  The package includes ESM, TypeScript declarations and a browser global build.
130
134
  Babylon 9 is an optional peer dependency; integration examples are checked with
@@ -316,7 +320,12 @@ scene selector and controls stay on the page. Choose Main thread, or add
316
320
  are available through the scene editing link in the sidebar.
317
321
 
318
322
  Every AVBD example has a Sleeping toggle for comparing the same scene with and
319
- without sleeping. Large rigid scenes enable it by default. Add `sleeping=1` or
323
+ without sleeping. Demo defaults use paired measurements of sleeping on and off;
324
+ size alone does not mean sleeping is faster. The [per-scene results](test-results/solver-performance.html#scene-sleeping)
325
+ show active and later physics costs on an RTX 4070 Laptop GPU. Run
326
+ `npm run benchmark:scene-sleep` to repeat the comparison and regenerate the
327
+ demo presets. These defaults affect the demos; package callers choose their
328
+ world's sleeping policy. Add `sleeping=1` or
320
329
  `sleeping=0` to choose explicitly; moving water and wind still keep affected
321
330
  bodies awake. The half-million wall demos keep the original two-ball benchmark
322
331
  until you click **Bowl every row**, which launches balls into all sixteen lanes.
@@ -2204,13 +2213,44 @@ fallingBox.body.wakeUp();
2204
2213
  console.log(await physics.readSleepStats());
2205
2214
  ```
2206
2215
 
2207
- Impulses, teleports, constraint edits, new bodies and removed supports wake the
2208
- world. Desktop WebGPU worlds with at least 4,096 bodies automatically track connected
2216
+ `speedThreshold` is the maximum motion allowed before the quiet timer resets.
2217
+ In 3D it combines linear speed with rotational speed at the body's radius, so a
2218
+ large spinning body stays awake. With meters as world units, `0.03` means about
2219
+ 3 cm/second; `timeThreshold: 0.5` requires half a second of quiet motion.
2220
+ Choose a speed small enough to be visually negligible at your scene's scale.
2221
+ Contact forces can remain large: sleeping stacks still carry gravity and weight.
2222
+ Sleep permission, these thresholds and the demo Sleeping toggle stay manual;
2223
+ the demo presets only choose the initial on/off setting.
2224
+ Switching examples loads that example's preset. A manual toggle is remembered
2225
+ for that example during the visit; an explicit `sleeping=0` or `sleeping=1` URL
2226
+ overrides only the scene named in the URL. Automatic presets are not saved as
2227
+ URL overrides.
2228
+ The shared demo settings are in
2229
+ [sleepPolicy.js](demo/shared/runtime/sleepPolicy.js): `0.03` world units/second,
2230
+ with a `0.3` second quiet period in 3D and `0.5` seconds in 2D. Individual scenes
2231
+ can supply their own values; the 2D sleeping pile uses `0.25` seconds and the
2232
+ slingshot uses `0.3`. The rook's support-aware policy uses linear speed below
2233
+ `0.02`, angular speed below `0.04` radians/second and two seconds of quiet.
2234
+
2235
+ For dense Babylon piles, `minimumColors` and `minimumColorRounds` can reserve
2236
+ additional parallel-solve scheduling headroom when many bodies wake together.
2237
+ The [mixed collider gallery](demo/mixed-colliders/index.js) sets both to `32`
2238
+ through `AvbdPhysics.create()`. These options preserve the timestep, iterations
2239
+ and contact equations; native 3D solvers accept them too.
2240
+
2241
+ Impulses, teleports, body-property edits, new bodies and removed supports wake
2242
+ the world. Adding or removing constraints and updating grab anchors wake their
2243
+ connected bodies. Desktop WebGPU worlds with at least 4,096 bodies automatically track connected
2209
2244
  groups, so an impact wakes the touched group while unrelated piles stay asleep.
2210
2245
  The static floor does not connect separate piles. Contact and joint connections
2211
2246
  let eligible members settle together. Awake groups rebuild their connections
2212
2247
  each step so separated debris can settle independently. Sleeping groups retain
2213
- their support history. Moving a grab anchor wakes the held body. Smaller worlds and mobile compatibility paths use
2248
+ their support history. Creating, moving or releasing a grab keeps unrelated
2249
+ sleeping groups asleep. Grabbing one brick wakes its connected group, which can
2250
+ include most of a wall. Impacts restore the group's normal masses and contacts
2251
+ before solving that same step. A connected wall can remain awake while any of its
2252
+ members are moving or losing support, even when most bricks look still.
2253
+ Smaller worlds and mobile compatibility paths use
2214
2254
  whole-world impact waking. Set `sleeping: { islands: true }` to opt into connected
2215
2255
  groups in a smaller 3D world, or `islands: false` to use whole-world waking. Under
2216
2256
  gravity, unsupported slow-moving bodies stay awake; supports extend upward