@absolutejs/rapier3d 0.17.0 → 0.18.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.
@@ -1,5 +1,12 @@
1
1
  import { RawIntegrationParameters } from "../raw";
2
2
  import { SoftRecoverySettings } from "./soft_body";
3
+ /** Numerical spring regularization, not a measured material elasticity model. */
4
+ export interface ContactSoftness {
5
+ /** Frequency in Hz. Setters require positive values; raw native snapshots may contain zero. */
6
+ naturalFrequency: number;
7
+ /** Nonnegative damping ratio. */
8
+ dampingRatio: number;
9
+ }
3
10
  export declare class IntegrationParameters {
4
11
  raw: RawIntegrationParameters;
5
12
  constructor(raw?: RawIntegrationParameters);
@@ -7,6 +14,14 @@ export declare class IntegrationParameters {
7
14
  * Free the WASM memory used by these integration parameters.
8
15
  */
9
16
  free(): void;
17
+ /** A copy of dynamic-contact softness. Native defaults are 30 Hz and damping ratio 10. */
18
+ get contactSoftness(): ContactSoftness;
19
+ /** Change between steps. Both coefficients are validated before either changes. */
20
+ set contactSoftness(value: ContactSoftness);
21
+ /** A copy of fixed-body contact softness. Native defaults are 60 Hz and damping ratio 10. */
22
+ get staticContactSoftness(): ContactSoftness;
23
+ /** Change between steps. Higher stiffness may reduce penetration but can increase jitter. */
24
+ set staticContactSoftness(value: ContactSoftness);
10
25
  /** Merge compatible contact manifolds into solver clusters. Upstream default: true. */
11
26
  get contactClustering(): boolean;
12
27
  /** Change between simulation steps; false may increase solver workload. */
@@ -1,6 +1,11 @@
1
+ import type { ContactSoftness } from "../dynamics/integration_parameters";
1
2
  import type { World, ContactConvergenceStats, FreeRotationStats, FreeAssemblyStats } from "./world";
2
3
  import type { EventQueue } from "./event_queue";
3
4
  import type { PhysicsHooks } from "./physics_hooks";
5
+ export interface PhysicsContactSettings {
6
+ contactSoftness: ContactSoftness;
7
+ staticContactSoftness: ContactSoftness;
8
+ }
4
9
  export interface PhysicsStepSample {
5
10
  /** Zero-based index among calls made through this recorder. */
6
11
  step: number;
@@ -12,6 +17,8 @@ export interface PhysicsStepSample {
12
17
  lengthUnit: number;
13
18
  timestep: number;
14
19
  solverIterations: number;
20
+ /** Index into the owning profile's bounded contactSettings table. */
21
+ contactSettingsIndex: number;
15
22
  ccdSubsteps: number;
16
23
  timings: {
17
24
  stepMs: number;
@@ -43,6 +50,8 @@ export interface PhysicsStepProfile {
43
50
  samplesOmittedForBudget: number;
44
51
  /** Owned bounded samples. They do not estimate all unsampled native phases. */
45
52
  samples: PhysicsStepSample[];
53
+ /** Distinct numerical settings, at most one entry per retained sample. */
54
+ contactSettings: PhysicsContactSettings[];
46
55
  }
47
56
  export interface PhysicsStepProfileOptions {
48
57
  /** Capture every Nth managed call, default 32; integer 1..1,000,000. */
@@ -704,7 +704,16 @@ export class RawImpulseJointSet {
704
704
  export class RawIntegrationParameters {
705
705
  free(): void;
706
706
  [Symbol.dispose](): void;
707
+ contactDampingRatio(fixed: boolean): number;
708
+ /**
709
+ * Existing native spring settings; static contacts have their own coefficients.
710
+ */
711
+ contactNaturalFrequency(fixed: boolean): number;
707
712
  constructor();
713
+ /**
714
+ * Validate both values before changing either coefficient.
715
+ */
716
+ setContactSoftness(fixed: boolean, frequency: number, damping: number): void;
708
717
  contactClustering: boolean;
709
718
  contactRecycling: boolean;
710
719
  readonly contact_erp: number;
@@ -2311,6 +2320,8 @@ export interface InitOutput {
2311
2320
  readonly rawimpulsejointset_new: () => number;
2312
2321
  readonly rawimpulsejointset_remove: (a: number, b: number, c: number) => void;
2313
2322
  readonly rawintegrationparameters_contactClustering: (a: number) => number;
2323
+ readonly rawintegrationparameters_contactDampingRatio: (a: number, b: number) => number;
2324
+ readonly rawintegrationparameters_contactNaturalFrequency: (a: number, b: number) => number;
2314
2325
  readonly rawintegrationparameters_contactRecycling: (a: number) => number;
2315
2326
  readonly rawintegrationparameters_contact_erp: (a: number) => number;
2316
2327
  readonly rawintegrationparameters_dt: (a: number) => number;
@@ -2323,6 +2334,7 @@ export interface InitOutput {
2323
2334
  readonly rawintegrationparameters_normalizedPredictionDistance: (a: number) => number;
2324
2335
  readonly rawintegrationparameters_numInternalPgsIterations: (a: number) => number;
2325
2336
  readonly rawintegrationparameters_numSolverIterations: (a: number) => number;
2337
+ readonly rawintegrationparameters_setContactSoftness: (a: number, b: number, c: number, d: number, e: number) => void;
2326
2338
  readonly rawintegrationparameters_set_contactClustering: (a: number, b: number) => void;
2327
2339
  readonly rawintegrationparameters_set_contactRecycling: (a: number, b: number) => void;
2328
2340
  readonly rawintegrationparameters_set_contact_natural_frequency: (a: number, b: number) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@absolutejs/rapier3d",
3
- "version": "0.17.0",
3
+ "version": "0.18.0",
4
4
  "description": "Rapier 3D with matched free-body rotation, corrected contact witnesses and solver diagnostics",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",