@absolutejs/rapier3d 0.18.0 → 0.21.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 +109 -0
- package/absolutejs/README.md +109 -0
- package/dist/build-info.mjs +1 -1
- package/dist/provenance.json +6 -5
- package/dist/rapier.mjs +1 -1
- package/dist/types/build-info.d.ts +2 -0
- package/dist/types/dynamics/index.d.ts +2 -0
- package/dist/types/dynamics/quadratic_drag.d.ts +26 -0
- package/dist/types/dynamics/quadratic_drag_patches.d.ts +38 -0
- package/dist/types/geometry/collider.d.ts +10 -0
- package/dist/types/pipeline/index.d.ts +2 -0
- package/dist/types/pipeline/solver_schedule.d.ts +5 -0
- package/dist/types/pipeline/step_profile.d.ts +6 -1
- package/dist/types/pipeline/step_profile_packet.d.ts +18 -0
- package/dist/types/pipeline/world.d.ts +17 -0
- package/dist/types/rapier_wasm3d.d.ts +8 -0
- package/package.json +1 -1
|
@@ -10,6 +10,8 @@ export interface PhysicsBuildInfo {
|
|
|
10
10
|
/** Collision library version and exact Cargo source identity used by this build. */
|
|
11
11
|
readonly collisionLibraryVersion: string;
|
|
12
12
|
readonly collisionSource: string;
|
|
13
|
+
/** Arithmetic used to reconstruct public convex boundaries; contact storage stays f32. */
|
|
14
|
+
readonly convexExportPrecision: 'float64';
|
|
13
15
|
readonly bindings: string;
|
|
14
16
|
readonly bindgen: string;
|
|
15
17
|
readonly wasmSha256: string;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** One scalar velocity-dependent resistance channel. Use one consistent length
|
|
2
|
+
* unit for speed, impulse, resistance and energy; mass remains kg. */
|
|
3
|
+
export type QuadraticDragInput = {
|
|
4
|
+
/** Body-point speed minus fluid speed along the impulse direction. */
|
|
5
|
+
relativeSpeed: number;
|
|
6
|
+
/** Fluid speed along the same direction, for reservoir-work accounting. */
|
|
7
|
+
fluidSpeed: number;
|
|
8
|
+
/** Positive effective inverse mass including the point's angular response. */
|
|
9
|
+
inverseEffectiveMass: number;
|
|
10
|
+
/** Nonnegative coefficient k in resistance = -k |v| v. No default Cd. */
|
|
11
|
+
quadraticResistance: number;
|
|
12
|
+
dt: number;
|
|
13
|
+
};
|
|
14
|
+
/** Backward-Euler quadratic resistance, solved analytically without reversal.
|
|
15
|
+
* Pure calculation: does not change a body, infer exposure, or choose drag
|
|
16
|
+
* coefficients. For point impulses the caller supplies the complete effective
|
|
17
|
+
* inverse mass, including rotational/coupled response. Returned work is the
|
|
18
|
+
* exact frozen-mass impulse work, not a time-continuous CFD energy estimate.
|
|
19
|
+
* Native application precision must be checked independently by the caller. */
|
|
20
|
+
export declare function solveQuadraticDragImpulse(input: QuadraticDragInput): {
|
|
21
|
+
impulse: number;
|
|
22
|
+
relativeSpeedAfter: number;
|
|
23
|
+
dissipatedEnergy: number;
|
|
24
|
+
bodyWork: number;
|
|
25
|
+
reservoirWork: number;
|
|
26
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { Vector } from '../math';
|
|
2
|
+
export type QuadraticDragPatch = {
|
|
3
|
+
/** World-space offset from the mass centre, in the chosen length unit. */
|
|
4
|
+
offset: Vector;
|
|
5
|
+
/** Nonzero direction; normalized by the solver without changing the input. */
|
|
6
|
+
direction: Vector;
|
|
7
|
+
fluidVelocity: Vector;
|
|
8
|
+
quadraticResistance: number;
|
|
9
|
+
/** Skip nonpositive relative speed, for a caller-selected exposed side. */
|
|
10
|
+
oneSided: boolean;
|
|
11
|
+
};
|
|
12
|
+
export type QuadraticDragPatchesInput = {
|
|
13
|
+
linearVelocity: Vector;
|
|
14
|
+
angularVelocity: Vector;
|
|
15
|
+
/** Diagonal translational inverse mass, including locked axes. */
|
|
16
|
+
inverseMass: Vector;
|
|
17
|
+
/** Symmetric world inverse inertia: xx, xy, xz, yy, yz, zz. */
|
|
18
|
+
inverseInertia: readonly [number, number, number, number, number, number];
|
|
19
|
+
patches: readonly QuadraticDragPatch[];
|
|
20
|
+
dt: number;
|
|
21
|
+
};
|
|
22
|
+
/** Sequential frozen-pose patch solve in JS double precision, returning one
|
|
23
|
+
* accumulated linear/angular impulse. This avoids repeated native Float32
|
|
24
|
+
* velocity rounding. Patch order is explicit and finite-step convergence must
|
|
25
|
+
* be measured; no fluid exposure or coefficients are inferred. Free rigid-body
|
|
26
|
+
* response only: articulated/constraint-coupled response is not represented by
|
|
27
|
+
* this block-diagonal inverse mass. Inputs are borrowed; outputs are owned. */
|
|
28
|
+
export declare function solveQuadraticDragPatches(input: QuadraticDragPatchesInput): {
|
|
29
|
+
impulse: Vector;
|
|
30
|
+
angularImpulse: Vector;
|
|
31
|
+
linearVelocity: Vector;
|
|
32
|
+
angularVelocity: Vector;
|
|
33
|
+
dissipatedEnergy: number;
|
|
34
|
+
reservoirWork: number;
|
|
35
|
+
bodyWork: number;
|
|
36
|
+
activePatches: number;
|
|
37
|
+
lockedPatches: number;
|
|
38
|
+
};
|
|
@@ -478,6 +478,16 @@ export declare class Collider {
|
|
|
478
478
|
* this returns the index buffer of said shape.
|
|
479
479
|
*/
|
|
480
480
|
indices(): Uint32Array | undefined;
|
|
481
|
+
/**
|
|
482
|
+
* Owned vertices and indices of the current convex core, computed together.
|
|
483
|
+
* Reconstructs the boundary once instead of once per separate buffer query.
|
|
484
|
+
* Rounded convex shapes exclude their border radius. Other shapes return
|
|
485
|
+
* undefined. Mutating returned arrays does not change this collider.
|
|
486
|
+
*/
|
|
487
|
+
convexMeshData(): {
|
|
488
|
+
vertices: Float32Array;
|
|
489
|
+
indices: Uint32Array;
|
|
490
|
+
} | undefined;
|
|
481
491
|
/**
|
|
482
492
|
* If this collider has a heightfield shape, this returns the heights buffer of
|
|
483
493
|
* the heightfield.
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { SolverScheduleStats } from './world';
|
|
2
|
+
/** Validate a copied schedule without coercion, property getters or mutation.
|
|
3
|
+
* Extra application metadata is ignored. This checks internal scalar consistency,
|
|
4
|
+
* not provenance, freshness, per-body identity or physical solver correctness. */
|
|
5
|
+
export declare function isSolverScheduleStats(value: unknown): value is SolverScheduleStats;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ContactSoftness } from "../dynamics/integration_parameters";
|
|
2
|
-
import type { World, ContactConvergenceStats, FreeRotationStats, FreeAssemblyStats } from "./world";
|
|
2
|
+
import type { World, ContactConvergenceStats, FreeRotationStats, FreeAssemblyStats, SolverScheduleStats } from "./world";
|
|
3
3
|
import type { EventQueue } from "./event_queue";
|
|
4
4
|
import type { PhysicsHooks } from "./physics_hooks";
|
|
5
5
|
export interface PhysicsContactSettings {
|
|
@@ -31,6 +31,9 @@ export interface PhysicsStepSample {
|
|
|
31
31
|
convergence: ContactConvergenceStats;
|
|
32
32
|
freeRotation: FreeRotationStats;
|
|
33
33
|
freeAssembly: FreeAssemblyStats;
|
|
34
|
+
/** Index into the owning profile's bounded solverSchedules table. */
|
|
35
|
+
/** Omitted means table entry 0; the table is always present. */
|
|
36
|
+
solverScheduleIndex?: number;
|
|
34
37
|
} | null;
|
|
35
38
|
}
|
|
36
39
|
export interface PhysicsStepProfile {
|
|
@@ -52,6 +55,8 @@ export interface PhysicsStepProfile {
|
|
|
52
55
|
samples: PhysicsStepSample[];
|
|
53
56
|
/** Distinct numerical settings, at most one entry per retained sample. */
|
|
54
57
|
contactSettings: PhysicsContactSettings[];
|
|
58
|
+
/** Distinct owned schedules, at most one per retained sample. */
|
|
59
|
+
solverSchedules: SolverScheduleStats[];
|
|
55
60
|
}
|
|
56
61
|
export interface PhysicsStepProfileOptions {
|
|
57
62
|
/** Capture every Nth managed call, default 32; integer 1..1,000,000. */
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { PhysicsStepProfile } from './step_profile';
|
|
2
|
+
type Cell = number | null | '-0';
|
|
3
|
+
/** Versioned numeric transport. The single '-0' tag preserves signed zero in JSON.
|
|
4
|
+
* No user strings or arbitrary application metadata are encoded. */
|
|
5
|
+
export interface PhysicsStepProfilePacket {
|
|
6
|
+
format: 'absolutejs-physics-step-profile/1';
|
|
7
|
+
header: Cell[];
|
|
8
|
+
contactSettings: Cell[][];
|
|
9
|
+
solverSchedules: Cell[][];
|
|
10
|
+
samples: Array<[Cell, 0 | 1, Cell, 0 | 1 | 2, Cell[] | null]>;
|
|
11
|
+
}
|
|
12
|
+
/** Decode bounded, owned readable observations. This validates encoding and
|
|
13
|
+
* internal scalar consistency, not native provenance or physical correctness. */
|
|
14
|
+
export declare function decodePhysicsStepProfile(value: unknown): PhysicsStepProfile;
|
|
15
|
+
/** Encode the defined profile fields without rounding or losing observations.
|
|
16
|
+
* Arrays are bounded before traversal. Decode to recover human-readable labels. */
|
|
17
|
+
export declare function encodePhysicsStepProfile(profile: PhysicsStepProfile): PhysicsStepProfilePacket;
|
|
18
|
+
export {};
|
|
@@ -14,6 +14,17 @@ import { DynamicRayCastVehicleController } from "../control";
|
|
|
14
14
|
* Counts describe solve groups/phases, not individual contacts or physical islands.
|
|
15
15
|
* Residuals are projected normal velocity errors in world units per second.
|
|
16
16
|
*/
|
|
17
|
+
/** Prepared rigid-body schedules, summed across CCD passes. Counts are not unique
|
|
18
|
+
* bodies or iterations of the internal PGS loop. Empty groups are omitted. */
|
|
19
|
+
export interface SolverScheduleStats {
|
|
20
|
+
groupVisits: number;
|
|
21
|
+
rigidBodyVisits: number;
|
|
22
|
+
rigidBodySubsteps: number;
|
|
23
|
+
minSubsteps: number | null;
|
|
24
|
+
maxSubsteps: number | null;
|
|
25
|
+
minSubstepDt: number | null;
|
|
26
|
+
maxSubstepDt: number | null;
|
|
27
|
+
}
|
|
17
28
|
export interface ContactConvergenceStats {
|
|
18
29
|
compressionSolves: number;
|
|
19
30
|
compressionIterations: number;
|
|
@@ -620,6 +631,12 @@ export declare class World {
|
|
|
620
631
|
* Reading or modifying the result never changes simulation.
|
|
621
632
|
*/
|
|
622
633
|
freeRotationStats(): FreeRotationStats | null;
|
|
634
|
+
/** Owned schedule observations from the last completed profiled step. Null
|
|
635
|
+
* before completion, with profiling disabled/toggled, or after restore.
|
|
636
|
+
* Min/max values are null when no nonempty rigid group was prepared. This
|
|
637
|
+
* reports prepared groups, not per-body identities, solver CPU time or a
|
|
638
|
+
* forecast for the next step; it must not select gameplay force timing. */
|
|
639
|
+
solverSchedule(): SolverScheduleStats | null;
|
|
623
640
|
/** Owned observations from the last completed profiled step; null before
|
|
624
641
|
* that step, after toggling profiling, when disabled, or after restoration.
|
|
625
642
|
* Zero solves means no eligible adaptive path, not proof of convergence.
|
|
@@ -70,6 +70,11 @@ export class RawColliderSet {
|
|
|
70
70
|
coContactShape(handle: number, shape2: RawShape, shapePos2: RawVector, shapeRot2: RawRotation, prediction: number): RawShapeContact | undefined;
|
|
71
71
|
coContactSkin(handle: number): number;
|
|
72
72
|
coContainsPoint(handle: number, point: RawVector): boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Owned core boundary of a convex collider, reconstructed only once.
|
|
75
|
+
* Rounded shapes exclude their border radius from this core mesh.
|
|
76
|
+
*/
|
|
77
|
+
coConvexMeshData(handle: number): RawConvexMeshData | undefined;
|
|
73
78
|
/**
|
|
74
79
|
* The density of this collider.
|
|
75
80
|
*/
|
|
@@ -910,6 +915,7 @@ export class RawPhysicsPipeline {
|
|
|
910
915
|
is_profiler_enabled(): boolean;
|
|
911
916
|
constructor();
|
|
912
917
|
set_profiler_enabled(enabled: boolean): void;
|
|
918
|
+
solver_schedule(): Float64Array | undefined;
|
|
913
919
|
stepWithEvents(gravity: RawVector, integrationParameters: RawIntegrationParameters, islands: RawIslandManager, broadPhase: RawBroadPhase, narrowPhase: RawNarrowPhase, bodies: RawRigidBodySet, colliders: RawColliderSet, softBodies: RawSoftBodySet, joints: RawImpulseJointSet, articulations: RawMultibodyJointSet, ccd_solver: RawCCDSolver, eventQueue: RawEventQueue, hookObject: object, hookFilterContactPair: Function, hookFilterIntersectionPair: Function): void;
|
|
914
920
|
step(gravity: RawVector, integrationParameters: RawIntegrationParameters, islands: RawIslandManager, broadPhase: RawBroadPhase, narrowPhase: RawNarrowPhase, bodies: RawRigidBodySet, colliders: RawColliderSet, softBodies: RawSoftBodySet, joints: RawImpulseJointSet, articulations: RawMultibodyJointSet, ccd_solver: RawCCDSolver): void;
|
|
915
921
|
timing_broad_phase(): number;
|
|
@@ -2101,6 +2107,7 @@ export interface InitOutput {
|
|
|
2101
2107
|
readonly rawcolliderset_coContactShape: (a: number, b: number, c: number, d: number, e: number, f: number) => number;
|
|
2102
2108
|
readonly rawcolliderset_coContactSkin: (a: number, b: number) => number;
|
|
2103
2109
|
readonly rawcolliderset_coContainsPoint: (a: number, b: number, c: number) => number;
|
|
2110
|
+
readonly rawcolliderset_coConvexMeshData: (a: number, b: number) => number;
|
|
2104
2111
|
readonly rawcolliderset_coDensity: (a: number, b: number) => number;
|
|
2105
2112
|
readonly rawcolliderset_coFriction: (a: number, b: number) => number;
|
|
2106
2113
|
readonly rawcolliderset_coFrictionCombineRule: (a: number, b: number) => number;
|
|
@@ -2423,6 +2430,7 @@ export interface InitOutput {
|
|
|
2423
2430
|
readonly rawphysicspipeline_is_profiler_enabled: (a: number) => number;
|
|
2424
2431
|
readonly rawphysicspipeline_new: () => number;
|
|
2425
2432
|
readonly rawphysicspipeline_set_profiler_enabled: (a: number, b: number) => void;
|
|
2433
|
+
readonly rawphysicspipeline_solver_schedule: (a: number, b: number) => void;
|
|
2426
2434
|
readonly rawphysicspipeline_step: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number) => void;
|
|
2427
2435
|
readonly rawphysicspipeline_stepWithEvents: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number) => void;
|
|
2428
2436
|
readonly rawphysicspipeline_timing_broad_phase: (a: number) => number;
|
package/package.json
CHANGED