@absolutejs/rapier3d 0.2.0 → 0.2.1

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
@@ -84,3 +84,11 @@ upstream default stays `1/60/100`, even when the outer timestep is changed.
84
84
  The setter rejects negative, non-finite and f32-overflowing values. Smaller values
85
85
  can introduce instability; changing it is an explicit experiment, not an automatic
86
86
  quality preset. Both controls are retained through native snapshot serialization.
87
+
88
+ ## Restored collider ownership (0.2.1)
89
+
90
+ Snapshot restoration now preserves `null` for an unowned collider's `parent()`.
91
+ Previously an absent native handle could be coerced to body zero during JavaScript
92
+ wrapper reconstruction. Real body-zero and fixed-body attachments remain intact.
93
+ This changes wrapper metadata only; native ownership, WASM and solver behavior are
94
+ unchanged. Repeated snapshot restoration and browser workers are regression tested.
@@ -0,0 +1,94 @@
1
+ # AbsoluteJS Rapier 3D
2
+
3
+ A focused distribution of Rapier 0.21.0 / engine 0.36.0 with an additive
4
+ `World.solverContactPair` query. The engine's original geometric manifolds and its
5
+ clustered solver manifolds are distinct. The upstream JavaScript contact query
6
+ only exposes the former, which can have no solver-contact entries even when the
7
+ solver is resolving contact. This package exposes the latter separately.
8
+
9
+ ```ts
10
+ import RAPIER from '@absolutejs/rapier3d';
11
+ await RAPIER.init();
12
+ world.solverContactPair(firstCollider, secondCollider, (manifold, flipped) => {
13
+ for (let i = 0; i < manifold.numSolverContacts(); i++) {
14
+ const point = manifold.solverContactPoint(i);
15
+ const cachedDistance = manifold.solverContactDist(i);
16
+ const separation = manifold.solverContactSeparation(i);
17
+ const anchor1 = manifold.solverContactPoint1(i);
18
+ const anchor2 = manifold.solverContactPoint2(i);
19
+ // Copy values here. The callback view expires when the callback returns.
20
+ }
21
+ });
22
+ ```
23
+
24
+ The callback receives a restricted solver view: normal, count, point, distance,
25
+ friction, restitution, and tangent velocity. It does not promise original subshape
26
+ identifiers or geometric surface normals. The `flipped` convention matches
27
+ `contactPair`. Do not step, free, or mutate the world inside either callback.
28
+ Nested read-only solver queries are supported; callback exceptions release query
29
+ wrappers before propagating. Solver distances are the engine's cached contact
30
+ update distances, not a continuous or post-step exact penetration guarantee.
31
+
32
+ `contactPair` retains its existing geometric behavior. No collision, integration,
33
+ clustering, mass, or solver parameters are changed. This is a diagnostic API
34
+ improvement, not a fix for the physical overlap reproduced in the game. Runtime
35
+ motion must still pass independent geometric and energy checks.
36
+
37
+ The ESM package includes WASM initialization and requires no separate asset URL.
38
+ Concurrent `init()` calls share initialization. This first release targets 3D f32
39
+ web/Node/Bun; it does not claim a 2D, f64, CommonJS or SIMD distribution.
40
+
41
+ ## Build and provenance
42
+
43
+ Source base: dimforge/rapier commit
44
+ `b716d375efc0201003f0cd9ef7168eee0b62c177`. Upstream Apache-2.0 licensing is retained.
45
+ All engine source remains upstream; changes are confined to binding queries and
46
+ this package's build/test tooling.
47
+
48
+ Use Bun 1.4.4+absolute.1, Rust 1.94.0 with `wasm32-unknown-unknown`, and Python 3.12.
49
+ Run `bun install --frozen-lockfile`, then `bash absolutejs/scripts/build-native.sh`.
50
+ Cargo's exact lockfile is versioned, compilation is limited to two jobs, and the
51
+ wasm-bindgen 0.2.129 CLI archive is checksum verified before extraction. Caches and
52
+ generated build output are reproducible; modified source and selected test
53
+ receipts are committed. `dist/provenance.json` records the resulting WASM hash.
54
+
55
+ Run `bun test absolutejs/tests` after building. Tests compare the official pinned
56
+ release's motion against this build, exercise actual clustered contacts, nested
57
+ queries and exception cleanup. Browser-worker validation is separate from native
58
+ GPU performance testing; no GPU is required by the engine.
59
+
60
+ This is a maintained AbsoluteJS distribution, not an official Dimforge release.
61
+
62
+ ## Live anchors and explicit clustering control (0.2)
63
+
64
+ `solverContactPoint1/2` return the native solver anchors transformed by current body
65
+ poses. `solverContactSeparation` projects their difference onto the stored world
66
+ solver normal. Negative means overlapping anchors; invalid indices return null.
67
+ Anchor values include contact skin and hook offsets, so they are not necessarily
68
+ points on the visible material surface. The normal is from the contact update;
69
+ this is not a new narrow-phase query or a continuous material penetration bound.
70
+ The old cached `solverContactDist` remains explicitly separate.
71
+
72
+ `world.integrationParameters.contactClustering` exposes the existing engine switch.
73
+ It defaults to true, exactly as upstream. Set it only between steps; disabling it
74
+ may increase solver workload and is not a general penetration fix. Snapshot restore
75
+ preserves the setting. The game is not instructed to turn it off by this release.
76
+
77
+ The independent every-step cube/cavity audit demonstrates the distinction: about
78
+ 0.459mm current penetration is visible in live anchors when the cached distance is
79
+ zero. Disabling clustering retains about 0.469mm peak penetration in that case.
80
+ Neither extra telemetry nor changing clustering is presented as a physics cure.
81
+
82
+ `minCcdDt` exposes the engine's minimum CCD substep duration in seconds. Its
83
+ upstream default stays `1/60/100`, even when the outer timestep is changed.
84
+ The setter rejects negative, non-finite and f32-overflowing values. Smaller values
85
+ can introduce instability; changing it is an explicit experiment, not an automatic
86
+ quality preset. Both controls are retained through native snapshot serialization.
87
+
88
+ ## Restored collider ownership (0.2.1)
89
+
90
+ Snapshot restoration now preserves `null` for an unowned collider's `parent()`.
91
+ Previously an absent native handle could be coerced to body zero during JavaScript
92
+ wrapper reconstruction. Real body-zero and fixed-body attachments remain intact.
93
+ This changes wrapper metadata only; native ownership, WASM and solver behavior are
94
+ unchanged. Repeated snapshot restoration and browser workers are regression tested.
@@ -6,5 +6,5 @@
6
6
  "wasmSha256": "91d68ed4f46fa1febbaf82abb7e8018150a3ad982560381df700e009997e6721",
7
7
  "wasmBytes": 3297510,
8
8
  "solverChanges": false,
9
- "addition": "Live solver anchors, clustered query, and explicit clustering/CCD minimum controls"
9
+ "addition": "Live solver anchors, explicit diagnostic controls, and correct restored collider ownership"
10
10
  }