avbd-babylon 0.4.0 → 0.4.2

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.
@@ -240,12 +240,14 @@ export interface AvbdGpuParameters2D extends AvbdGpuParameters {
240
240
  vbd: boolean;
241
241
  vbdStiffness: number;
242
242
  }
243
- /** 3D can retain conservative connected groups between explicit world edits. */
243
+ /** 3D tracks current awake groups and retains sleeping support connections. */
244
244
  export interface AvbdSleepOptions {
245
245
  speedThreshold?: number;
246
246
  timeThreshold?: number;
247
- /** 3D: automatic for large jointless desktop worlds; false selects whole-world waking. */
247
+ /** 3D: automatic for large desktop worlds; false selects whole-world waking. */
248
248
  islands?: boolean;
249
+ /** 3D island mode: build contacts once and sleep stationary, supported groups at startup. */
250
+ startAsleep?: boolean;
249
251
  }
250
252
  export interface AvbdGpuOptions {
251
253
  bodyBuffer?: GPUBuffer;
@@ -147,15 +147,31 @@ reserve storage; `readContactEvents()` reports dropped events or a full pair
147
147
  table. End events do not retain an old position. Callbacks run asynchronously.
148
148
 
149
149
  `sleeping: true` or `{ speedThreshold: 0.03, timeThreshold: 0.5 }` enables an
150
- optional GPU policy. Supported quiet bodies sleep. Large jointless desktop 3D worlds
150
+ optional GPU policy. Supported quiet bodies sleep. Large desktop 3D worlds
151
151
  automatically wake conservative connected groups on impact, keeping unrelated
152
152
  piles asleep; the shared static floor does not join them. `islands:true` opts
153
153
  into group waking in smaller worlds, and `islands:false` selects whole-world
154
- waking. Explicit edits wake the world and reset group history. Unsupported bodies
154
+ waking. Awake groups rebuild their connections from current contacts; sleeping
155
+ groups retain the support connections omitted by collision detection. A group
156
+ settles together after its eligible members stay quiet, so sleeping one course
157
+ does not repeatedly disturb the courses above it. Contact waking checks closing
158
+ speed at each contact point, including rotation. Adding or removing constraints
159
+ and updating a grab anchor wake their endpoints and sleeping connected groups;
160
+ unrelated groups stay asleep. Ordinary body edits and changes to supports wake
161
+ the world. A connected group can stay awake while any member moves or loses support.
162
+ Unsupported bodies
155
163
  under gravity stay awake. `wakeAll()`, `body.wakeUp()` and `readSleepStats()` are
156
164
  available. Suspended jointed objects are not guaranteed to sleep. Defaults and
157
165
  paper-comparison benchmarks keep sleeping disabled.
158
166
 
167
+ For a 3D assembly placed at rest, use
168
+ `{ islands: true, startAsleep: true }`. Native solver initialization takes one
169
+ support-validation physics step and sleeps stationary groups connected to
170
+ stationary solid support. Moving, floating and sleep-excluded groups stay awake.
171
+ Babylon applies this check on its first physics step. This option is intended
172
+ for assembled stacks, rather than objects already in motion. Interactive
173
+ half-million walls use it; timing comparisons with the paper keep sleeping off.
174
+
159
175
  Closed jointless 3D worlds with at most 32 bodies automatically batch movement
160
176
  iterations in one GPU workgroup. Body poses stay in shared memory, with the
161
177
  same contact order, reductions and equations. Adding a joint or exceeding the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "avbd-babylon",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "description": "GPU AVBD rigid-body physics with a Babylon.js aggregate API",
5
5
  "main": "./dist/avbd.js",
6
6
  "types": "./dist/avbd.d.ts",
@@ -15,6 +15,7 @@
15
15
  "test": "node scripts/test-gpu.mjs",
16
16
  "test:reference": "node --experimental-transform-types --test reference/three-avbd/tests/*.test.ts",
17
17
  "test:gpu": "node scripts/test-gpu.mjs",
18
+ "test:sleeping": "node scripts/build.mjs && node scripts/check-lab-sleep.mjs && node scripts/check-sleep-stability.mjs --drag && node scripts/check-jointed-settling.mjs",
18
19
  "test:all": "node scripts/test-all.mjs",
19
20
  "test:complete": "node scripts/test-all.mjs --strict",
20
21
  "test:scenes": "node scripts/build.mjs && node scripts/check-scenes.mjs",
package/tests/README.md CHANGED
@@ -7,6 +7,7 @@ run on the host because they inspect files and JavaScript APIs.
7
7
  | Command | Scope |
8
8
  | ----------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
9
9
  | `npm test` | GPU numerical and stability regressions |
10
+ | `npm run test:sleeping` | Local grab waking, rotating impacts, startup sleeping, long 28K-ring settling and the 34K jointed drop through landing and settling |
10
11
  | `npm run test:complete` | GPU suite, shared pipeline contract, package, pinned-source integrity and live Babylon example |
11
12
  | `npm run test:pipelines` | Same 2D/3D package application calls on CPU and WebGPU: bulk edits, queries, joints, triggers, bounce, sleeping, scene attachment and disposal |
12
13
  | `npm run test:cpu` | CPU compatibility scene views, controls, screenshots and physics measurements |
@@ -37,7 +38,8 @@ Set `AVBD_TEST_BROWSER` to a Chromium executable if browser discovery fails.
37
38
 
38
39
  `node scripts/check-galton-startup.mjs` measures startup of the 40,000-marble
39
40
  playground and verifies default worker execution, an explicit main-thread choice,
40
- and automatic fallback when workers are unavailable. `test:playgrounds` also
41
+ and automatic fallback when workers are unavailable. It also checks that page
42
+ dependencies stay small before starting the worker. `test:playgrounds` also
41
43
  checks that at least 99.5% of marbles reach the bins, compares GPU counts with real
42
44
  body positions, and measures the shape of the distribution.
43
45
 
@@ -46,13 +48,25 @@ poses with direct drawing, Babylon, shared-input workers and CPU compatibility.
46
48
  `check-lab-timing.mjs` checks fixed-step clocks at 30–240 display frames per second
47
49
  and bounded catch-up under load. `check-lab-sleep.mjs` checks live sleeping
48
50
  toggles, large-scene defaults and bowling balls in all sixteen wall lanes.
49
- These checks run through `test:playgrounds` and `test:web`.
51
+ `check-sleep-stability.mjs --drag` follows the 28K brick ring for 900 steps and
52
+ checks that creating a grab and repeatedly updating its anchor leave a distant,
53
+ disconnected sleeper asleep with unchanged poses. GPU regressions also check
54
+ grab release and stale gravity predictions beside an awake resting body.
55
+ `check-jointed-settling.mjs` measures GPU collision and movement time while the
56
+ 34K jointed drop lands, comparing sleeping off, whole-world waking and automatic
57
+ group sleeping. It checks contact capacity and solve-group conflicts on every
58
+ step, then measures the rendered worker view separately. These longer checks run
59
+ through `test:sleeping` and `test:web`; the live toggle checks also run through
60
+ `test:playgrounds`.
50
61
 
51
62
  `check-lab-step-rate.mjs` checks live physics step-rate changes, retained poses,
52
63
  scene defaults and URL settings with CPU, WebGPU, Babylon and worker execution.
53
64
  The showcase exposes steps per second beside solving iterations. Both settings
54
65
  remain fixed while a benchmark measurement runs.
55
66
 
67
+ `check-runtime-efficiency.mjs` also checks that workers finish explicit GPU
68
+ cleanup before termination, with a bounded fallback for an unresponsive worker.
69
+
56
70
  `node scripts/check-demo-startup.mjs --all` initializes every scene in a paused
57
71
  worker and saves setup times separately from frame performance. Browser and driver
58
72
  caches can warm during the run. `node scripts/check-slingshot-input.mjs` uses real