@absolutejs/rapier3d 0.1.0 → 0.2.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.
@@ -7,6 +7,14 @@ export declare class IntegrationParameters {
7
7
  * Free the WASM memory used by these integration parameters.
8
8
  */
9
9
  free(): void;
10
+ /** Merge compatible contact manifolds into solver clusters. Upstream default: true. */
11
+ get contactClustering(): boolean;
12
+ /** Change between simulation steps; false may increase solver workload. */
13
+ set contactClustering(value: boolean);
14
+ /** Minimum CCD substep duration in seconds; upstream default is 1/60/100. */
15
+ get minCcdDt(): number;
16
+ /** Change between steps. Very small values may introduce numerical instability. */
17
+ set minCcdDt(value: number);
10
18
  /**
11
19
  * The timestep length (default: `1.0 / 60.0`)
12
20
  */
@@ -116,6 +116,17 @@ export declare class TempContactManifold {
116
116
  * the function returns this object instead of creating a new one.
117
117
  */
118
118
  solverContactPoint(i: number, target?: Vector): Vector | null;
119
+ /** Current world-space solver anchor on side 1; includes skin/hook offsets. */
120
+ solverContactPoint1(i: number, target?: Vector): Vector | null;
121
+ /** Current world-space solver anchor on side 2; includes skin/hook offsets. */
122
+ solverContactPoint2(i: number, target?: Vector): Vector | null;
123
+ /**
124
+ * Current anchor separation along the stored solver normal (negative means overlap).
125
+ * This is not a fresh collision query or a bound on unsampled material surfaces.
126
+ * Returns null for an invalid index. Unlike solverContactDist, uses current poses.
127
+ */
128
+ solverContactSeparation(i: number): number | null;
129
+ /** Cached distance at the last contact update; does not track subsequent motion. */
119
130
  solverContactDist(i: number): number;
120
131
  /**
121
132
  * The friction coefficient applied to this manifold's solver contacts. It is combined
@@ -137,4 +148,4 @@ export declare class TempContactManifold {
137
148
  solverContactTangentVelocity(i: number, target?: Vector): Vector;
138
149
  }
139
150
  /** Read-only solver view; geometric subshape and local-surface queries are excluded. */
140
- export type SolverContactManifold = Pick<TempContactManifold, 'normal' | 'numSolverContacts' | 'solverContactPoint' | 'solverContactDist' | 'friction' | 'restitution' | 'solverContactTangentVelocity'>;
151
+ export type SolverContactManifold = Pick<TempContactManifold, 'normal' | 'numSolverContacts' | 'solverContactPoint' | 'solverContactDist' | 'friction' | 'restitution' | 'solverContactTangentVelocity' | 'solverContactPoint1' | 'solverContactPoint2' | 'solverContactSeparation'>;
@@ -365,7 +365,19 @@ export class RawContactManifold {
365
365
  num_solver_contacts(): number;
366
366
  restitution(): number;
367
367
  solver_contact_dist(i: number): number;
368
+ /**
369
+ * Current world-space solver anchor; includes solver skin/hook offsets.
370
+ */
371
+ solver_contact_point1(bodies: RawRigidBodySet, i: number, scratch_buffer: Float32Array): boolean;
372
+ /**
373
+ * Current world-space solver anchor; includes solver skin/hook offsets.
374
+ */
375
+ solver_contact_point2(bodies: RawRigidBodySet, i: number, scratch_buffer: Float32Array): boolean;
368
376
  solver_contact_point(bodies: RawRigidBodySet, i: number, scratch_buffer: Float32Array): boolean;
377
+ /**
378
+ * Current anchor separation along the stored world-space solver normal.
379
+ */
380
+ solver_contact_separation(bodies: RawRigidBodySet, i: number): number | undefined;
369
381
  solver_contact_tangent_velocity(i: number, scratch_buffer: Float32Array): void;
370
382
  subshape1(): number;
371
383
  subshape2(): number;
@@ -693,10 +705,12 @@ export class RawIntegrationParameters {
693
705
  free(): void;
694
706
  [Symbol.dispose](): void;
695
707
  constructor();
708
+ contactClustering: boolean;
696
709
  readonly contact_erp: number;
697
710
  dt: number;
698
711
  lengthUnit: number;
699
712
  maxCcdSubsteps: number;
713
+ minCcdDt: number;
700
714
  normalizedAllowedLinearError: number;
701
715
  normalizedPredictionDistance: number;
702
716
  numInternalPgsIterations: number;
@@ -2161,6 +2175,9 @@ export interface InitOutput {
2161
2175
  readonly rawcontactmanifold_restitution: (a: number) => number;
2162
2176
  readonly rawcontactmanifold_solver_contact_dist: (a: number, b: number) => number;
2163
2177
  readonly rawcontactmanifold_solver_contact_point: (a: number, b: number, c: number, d: number) => number;
2178
+ readonly rawcontactmanifold_solver_contact_point1: (a: number, b: number, c: number, d: number) => number;
2179
+ readonly rawcontactmanifold_solver_contact_point2: (a: number, b: number, c: number, d: number) => number;
2180
+ readonly rawcontactmanifold_solver_contact_separation: (a: number, b: number, c: number) => number;
2164
2181
  readonly rawcontactmanifold_solver_contact_tangent_velocity: (a: number, b: number, c: number) => void;
2165
2182
  readonly rawcontactmanifold_subshape1: (a: number) => number;
2166
2183
  readonly rawcontactmanifold_subshape2: (a: number) => number;
@@ -2278,19 +2295,23 @@ export interface InitOutput {
2278
2295
  readonly rawimpulsejointset_len: (a: number) => number;
2279
2296
  readonly rawimpulsejointset_new: () => number;
2280
2297
  readonly rawimpulsejointset_remove: (a: number, b: number, c: number) => void;
2298
+ readonly rawintegrationparameters_contactClustering: (a: number) => number;
2281
2299
  readonly rawintegrationparameters_contact_erp: (a: number) => number;
2282
2300
  readonly rawintegrationparameters_dt: (a: number) => number;
2283
2301
  readonly rawintegrationparameters_lengthUnit: (a: number) => number;
2284
2302
  readonly rawintegrationparameters_maxCcdSubsteps: (a: number) => number;
2303
+ readonly rawintegrationparameters_minCcdDt: (a: number) => number;
2285
2304
  readonly rawintegrationparameters_new: () => number;
2286
2305
  readonly rawintegrationparameters_normalizedAllowedLinearError: (a: number) => number;
2287
2306
  readonly rawintegrationparameters_normalizedPredictionDistance: (a: number) => number;
2288
2307
  readonly rawintegrationparameters_numInternalPgsIterations: (a: number) => number;
2289
2308
  readonly rawintegrationparameters_numSolverIterations: (a: number) => number;
2309
+ readonly rawintegrationparameters_set_contactClustering: (a: number, b: number) => void;
2290
2310
  readonly rawintegrationparameters_set_contact_natural_frequency: (a: number, b: number) => void;
2291
2311
  readonly rawintegrationparameters_set_dt: (a: number, b: number) => void;
2292
2312
  readonly rawintegrationparameters_set_lengthUnit: (a: number, b: number) => void;
2293
2313
  readonly rawintegrationparameters_set_maxCcdSubsteps: (a: number, b: number) => void;
2314
+ readonly rawintegrationparameters_set_minCcdDt: (a: number, b: number) => void;
2294
2315
  readonly rawintegrationparameters_set_normalizedAllowedLinearError: (a: number, b: number) => void;
2295
2316
  readonly rawintegrationparameters_set_normalizedPredictionDistance: (a: number, b: number) => void;
2296
2317
  readonly rawintegrationparameters_set_numInternalPgsIterations: (a: number, b: number) => void;
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@absolutejs/rapier3d",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Rapier 3D with separate geometric and clustered solver-contact inspection",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
7
7
  "repository": {
8
8
  "type": "git",
9
- "url": "https://github.com/absolutejs/rapier3d.git"
9
+ "url": "git+https://github.com/absolutejs/rapier3d.git"
10
10
  },
11
11
  "files": [
12
12
  "dist",
@@ -1,57 +0,0 @@
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 distance = manifold.solverContactDist(i);
16
- // Copy values here. The callback view expires when the callback returns.
17
- }
18
- });
19
- ```
20
-
21
- The callback receives a restricted solver view: normal, count, point, distance,
22
- friction, restitution, and tangent velocity. It does not promise original subshape
23
- identifiers or geometric surface normals. The `flipped` convention matches
24
- `contactPair`. Do not step, free, or mutate the world inside either callback.
25
- Nested read-only solver queries are supported; callback exceptions release query
26
- wrappers before propagating. Solver distances are the engine's cached contact
27
- update distances, not a continuous or post-step exact penetration guarantee.
28
-
29
- `contactPair` retains its existing geometric behavior. No collision, integration,
30
- clustering, mass, or solver parameters are changed. This is a diagnostic API
31
- improvement, not a fix for the physical overlap reproduced in the game. Runtime
32
- motion must still pass independent geometric and energy checks.
33
-
34
- The ESM package includes WASM initialization and requires no separate asset URL.
35
- Concurrent `init()` calls share initialization. This first release targets 3D f32
36
- web/Node/Bun; it does not claim a 2D, f64, CommonJS or SIMD distribution.
37
-
38
- ## Build and provenance
39
-
40
- Source base: dimforge/rapier commit
41
- `b716d375efc0201003f0cd9ef7168eee0b62c177`. Upstream Apache-2.0 licensing is retained.
42
- All engine source remains upstream; changes are confined to binding queries and
43
- this package's build/test tooling.
44
-
45
- Use Bun 1.4.4+absolute.1, Rust 1.94.0 with `wasm32-unknown-unknown`, and Python 3.12.
46
- Run `bun install --frozen-lockfile`, then `bash absolutejs/scripts/build-native.sh`.
47
- Cargo's exact lockfile is versioned, compilation is limited to two jobs, and the
48
- wasm-bindgen 0.2.129 CLI archive is checksum verified before extraction. Caches and
49
- generated build output are reproducible; modified source and selected test
50
- receipts are committed. `dist/provenance.json` records the resulting WASM hash.
51
-
52
- Run `bun test absolutejs/tests` after building. Tests compare the official pinned
53
- release's motion against this build, exercise actual clustered contacts, nested
54
- queries and exception cleanup. Browser-worker validation is separate from native
55
- GPU performance testing; no GPU is required by the engine.
56
-
57
- This is a maintained AbsoluteJS distribution, not an official Dimforge release.