avbd-babylon 0.4.2 → 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 +35 -3
- package/dist/avbd.global.js +102 -59
- package/dist/avbd.js +95 -52
- package/dist/babylonAvbd.d.ts +4 -0
- package/dist/nativeScenes.d.ts +2 -0
- package/docs/BABYLON_API.md +13 -1
- package/package.json +3 -2
- package/tests/README.md +1 -0
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) |
|
|
@@ -320,7 +320,12 @@ scene selector and controls stay on the page. Choose Main thread, or add
|
|
|
320
320
|
are available through the scene editing link in the sidebar.
|
|
321
321
|
|
|
322
322
|
Every AVBD example has a Sleeping toggle for comparing the same scene with and
|
|
323
|
-
without sleeping.
|
|
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
|
|
324
329
|
`sleeping=0` to choose explicitly; moving water and wind still keep affected
|
|
325
330
|
bodies awake. The half-million wall demos keep the original two-ball benchmark
|
|
326
331
|
until you click **Bowl every row**, which launches balls into all sixteen lanes.
|
|
@@ -2208,6 +2213,31 @@ fallingBox.body.wakeUp();
|
|
|
2208
2213
|
console.log(await physics.readSleepStats());
|
|
2209
2214
|
```
|
|
2210
2215
|
|
|
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
|
+
|
|
2211
2241
|
Impulses, teleports, body-property edits, new bodies and removed supports wake
|
|
2212
2242
|
the world. Adding or removing constraints and updating grab anchors wake their
|
|
2213
2243
|
connected bodies. Desktop WebGPU worlds with at least 4,096 bodies automatically track connected
|
|
@@ -2216,7 +2246,9 @@ The static floor does not connect separate piles. Contact and joint connections
|
|
|
2216
2246
|
let eligible members settle together. Awake groups rebuild their connections
|
|
2217
2247
|
each step so separated debris can settle independently. Sleeping groups retain
|
|
2218
2248
|
their support history. Creating, moving or releasing a grab keeps unrelated
|
|
2219
|
-
sleeping groups asleep.
|
|
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
|
|
2220
2252
|
members are moving or losing support, even when most bricks look still.
|
|
2221
2253
|
Smaller worlds and mobile compatibility paths use
|
|
2222
2254
|
whole-world impact waking. Set `sleeping: { islands: true }` to opt into connected
|