@newkrok/nape-js 3.15.9 → 3.16.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
@@ -63,7 +63,7 @@ function update() {
63
63
 
64
64
  | Class | Description |
65
65
  |-------|-------------|
66
- | `Space` | Physics world — add bodies, step simulation |
66
+ | `Space` | Physics world — add bodies, step simulation, `deterministic` mode for rollback/prediction |
67
67
  | `Body` | Rigid body with position, velocity, mass |
68
68
  | `Vec2` | 2D vector — pooling, `clone()`, `equals()`, `lerp()`, `fromAngle()` |
69
69
  | `Vec3` | 3D vector for constraint impulses — `clone()`, `equals()` |
@@ -179,7 +179,7 @@ present, with automatic `postMessage` fallback otherwise.
179
179
  ```bash
180
180
  npm install
181
181
  npm run build # tsup → dist/ (ESM + CJS + DTS)
182
- npm test # vitest — 4461 tests across 195 files
182
+ npm test # vitest — 4591 tests across 201 files
183
183
  npm run benchmark # Performance benchmarks
184
184
  ```
185
185
 
@@ -1854,6 +1854,18 @@ declare class Space {
1854
1854
  /** If true, contact points are sorted for determinism. Default: true. */
1855
1855
  get sortContacts(): boolean;
1856
1856
  set sortContacts(value: boolean);
1857
+ /**
1858
+ * If true, the simulation produces identical results across runs on the same
1859
+ * platform given the same inputs (same-platform "soft" determinism).
1860
+ *
1861
+ * When enabled, all internal iteration orders (bodies, constraints, arbiters,
1862
+ * islands) are sorted by stable IDs before processing. `sortContacts` is also
1863
+ * forced to `true`.
1864
+ *
1865
+ * **Performance:** adds ~1-5% overhead to `step()` due to sorting. Default: `false`.
1866
+ */
1867
+ get deterministic(): boolean;
1868
+ set deterministic(value: boolean);
1857
1869
  /**
1858
1870
  * Global angular drag coefficient applied to all bodies.
1859
1871
  * @throws If set to NaN.
@@ -1854,6 +1854,18 @@ declare class Space {
1854
1854
  /** If true, contact points are sorted for determinism. Default: true. */
1855
1855
  get sortContacts(): boolean;
1856
1856
  set sortContacts(value: boolean);
1857
+ /**
1858
+ * If true, the simulation produces identical results across runs on the same
1859
+ * platform given the same inputs (same-platform "soft" determinism).
1860
+ *
1861
+ * When enabled, all internal iteration orders (bodies, constraints, arbiters,
1862
+ * islands) are sorted by stable IDs before processing. `sortContacts` is also
1863
+ * forced to `true`.
1864
+ *
1865
+ * **Performance:** adds ~1-5% overhead to `step()` due to sorting. Default: `false`.
1866
+ */
1867
+ get deterministic(): boolean;
1868
+ set deterministic(value: boolean);
1857
1869
  /**
1858
1870
  * Global angular drag coefficient applied to all bodies.
1859
1871
  * @throws If set to NaN.