@aura3d/physics 1.0.6

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.
Files changed (147) hide show
  1. package/README.md +26 -0
  2. package/dist/CharacterController.d.ts +52 -0
  3. package/dist/CharacterController.d.ts.map +1 -0
  4. package/dist/CharacterController.js +146 -0
  5. package/dist/CharacterController.js.map +1 -0
  6. package/dist/ClothFixtures.d.ts +87 -0
  7. package/dist/ClothFixtures.d.ts.map +1 -0
  8. package/dist/ClothFixtures.js +264 -0
  9. package/dist/ClothFixtures.js.map +1 -0
  10. package/dist/Collider.d.ts +27 -0
  11. package/dist/Collider.d.ts.map +1 -0
  12. package/dist/Collider.js +45 -0
  13. package/dist/Collider.js.map +1 -0
  14. package/dist/CollisionEvents.d.ts +26 -0
  15. package/dist/CollisionEvents.d.ts.map +1 -0
  16. package/dist/CollisionEvents.js +46 -0
  17. package/dist/CollisionEvents.js.map +1 -0
  18. package/dist/CollisionVolumes.d.ts +57 -0
  19. package/dist/CollisionVolumes.d.ts.map +1 -0
  20. package/dist/CollisionVolumes.js +159 -0
  21. package/dist/CollisionVolumes.js.map +1 -0
  22. package/dist/Constraint.d.ts +31 -0
  23. package/dist/Constraint.d.ts.map +1 -0
  24. package/dist/Constraint.js +103 -0
  25. package/dist/Constraint.js.map +1 -0
  26. package/dist/Constraints.d.ts +2 -0
  27. package/dist/Constraints.d.ts.map +1 -0
  28. package/dist/Constraints.js +2 -0
  29. package/dist/Constraints.js.map +1 -0
  30. package/dist/Crowd.d.ts +64 -0
  31. package/dist/Crowd.d.ts.map +1 -0
  32. package/dist/Crowd.js +209 -0
  33. package/dist/Crowd.js.map +1 -0
  34. package/dist/ECSPhysicsBridge.d.ts +17 -0
  35. package/dist/ECSPhysicsBridge.d.ts.map +1 -0
  36. package/dist/ECSPhysicsBridge.js +37 -0
  37. package/dist/ECSPhysicsBridge.js.map +1 -0
  38. package/dist/FireSmokeFixtures.d.ts +103 -0
  39. package/dist/FireSmokeFixtures.d.ts.map +1 -0
  40. package/dist/FireSmokeFixtures.js +271 -0
  41. package/dist/FireSmokeFixtures.js.map +1 -0
  42. package/dist/FluidFixtures.d.ts +75 -0
  43. package/dist/FluidFixtures.d.ts.map +1 -0
  44. package/dist/FluidFixtures.js +219 -0
  45. package/dist/FluidFixtures.js.map +1 -0
  46. package/dist/FractureFixtures.d.ts +68 -0
  47. package/dist/FractureFixtures.d.ts.map +1 -0
  48. package/dist/FractureFixtures.js +199 -0
  49. package/dist/FractureFixtures.js.map +1 -0
  50. package/dist/HitboxWorld.d.ts +250 -0
  51. package/dist/HitboxWorld.d.ts.map +1 -0
  52. package/dist/HitboxWorld.js +771 -0
  53. package/dist/HitboxWorld.js.map +1 -0
  54. package/dist/KinematicBody.d.ts +157 -0
  55. package/dist/KinematicBody.d.ts.map +1 -0
  56. package/dist/KinematicBody.js +405 -0
  57. package/dist/KinematicBody.js.map +1 -0
  58. package/dist/KinematicWorld.d.ts +58 -0
  59. package/dist/KinematicWorld.d.ts.map +1 -0
  60. package/dist/KinematicWorld.js +246 -0
  61. package/dist/KinematicWorld.js.map +1 -0
  62. package/dist/Navigation.d.ts +67 -0
  63. package/dist/Navigation.d.ts.map +1 -0
  64. package/dist/Navigation.js +261 -0
  65. package/dist/Navigation.js.map +1 -0
  66. package/dist/PhysicsDebugDraw.d.ts +11 -0
  67. package/dist/PhysicsDebugDraw.d.ts.map +1 -0
  68. package/dist/PhysicsDebugDraw.js +64 -0
  69. package/dist/PhysicsDebugDraw.js.map +1 -0
  70. package/dist/PhysicsSandboxFixtures.d.ts +53 -0
  71. package/dist/PhysicsSandboxFixtures.d.ts.map +1 -0
  72. package/dist/PhysicsSandboxFixtures.js +280 -0
  73. package/dist/PhysicsSandboxFixtures.js.map +1 -0
  74. package/dist/PhysicsStepper.d.ts +15 -0
  75. package/dist/PhysicsStepper.d.ts.map +1 -0
  76. package/dist/PhysicsStepper.js +37 -0
  77. package/dist/PhysicsStepper.js.map +1 -0
  78. package/dist/PhysicsWorld.d.ts +101 -0
  79. package/dist/PhysicsWorld.d.ts.map +1 -0
  80. package/dist/PhysicsWorld.js +868 -0
  81. package/dist/PhysicsWorld.js.map +1 -0
  82. package/dist/PlatformerFixtures.d.ts +70 -0
  83. package/dist/PlatformerFixtures.d.ts.map +1 -0
  84. package/dist/PlatformerFixtures.js +120 -0
  85. package/dist/PlatformerFixtures.js.map +1 -0
  86. package/dist/Raycast.d.ts +23 -0
  87. package/dist/Raycast.d.ts.map +1 -0
  88. package/dist/Raycast.js +271 -0
  89. package/dist/Raycast.js.map +1 -0
  90. package/dist/RigidBody.d.ts +69 -0
  91. package/dist/RigidBody.d.ts.map +1 -0
  92. package/dist/RigidBody.js +255 -0
  93. package/dist/RigidBody.js.map +1 -0
  94. package/dist/ScenePhysicsBridge.d.ts +42 -0
  95. package/dist/ScenePhysicsBridge.d.ts.map +1 -0
  96. package/dist/ScenePhysicsBridge.js +168 -0
  97. package/dist/ScenePhysicsBridge.js.map +1 -0
  98. package/dist/Shape.d.ts +50 -0
  99. package/dist/Shape.d.ts.map +1 -0
  100. package/dist/Shape.js +128 -0
  101. package/dist/Shape.js.map +1 -0
  102. package/dist/SoftBodyFixtures.d.ts +70 -0
  103. package/dist/SoftBodyFixtures.d.ts.map +1 -0
  104. package/dist/SoftBodyFixtures.js +272 -0
  105. package/dist/SoftBodyFixtures.js.map +1 -0
  106. package/dist/Steering.d.ts +161 -0
  107. package/dist/Steering.d.ts.map +1 -0
  108. package/dist/Steering.js +347 -0
  109. package/dist/Steering.js.map +1 -0
  110. package/dist/VehicleDynamics.d.ts +152 -0
  111. package/dist/VehicleDynamics.d.ts.map +1 -0
  112. package/dist/VehicleDynamics.js +335 -0
  113. package/dist/VehicleDynamics.js.map +1 -0
  114. package/dist/index.d.ts +29 -0
  115. package/dist/index.d.ts.map +1 -0
  116. package/dist/index.js +29 -0
  117. package/dist/index.js.map +1 -0
  118. package/package.json +17 -0
  119. package/src/CharacterController.ts +184 -0
  120. package/src/ClothFixtures.ts +359 -0
  121. package/src/Collider.ts +67 -0
  122. package/src/CollisionEvents.ts +70 -0
  123. package/src/CollisionVolumes.ts +218 -0
  124. package/src/Constraint.ts +120 -0
  125. package/src/Constraints.ts +1 -0
  126. package/src/Crowd.ts +283 -0
  127. package/src/ECSPhysicsBridge.ts +53 -0
  128. package/src/FireSmokeFixtures.ts +382 -0
  129. package/src/FluidFixtures.ts +301 -0
  130. package/src/FractureFixtures.ts +277 -0
  131. package/src/HitboxWorld.ts +1179 -0
  132. package/src/KinematicBody.ts +553 -0
  133. package/src/KinematicWorld.ts +310 -0
  134. package/src/Navigation.ts +321 -0
  135. package/src/PhysicsDebugDraw.ts +71 -0
  136. package/src/PhysicsSandboxFixtures.ts +394 -0
  137. package/src/PhysicsStepper.ts +47 -0
  138. package/src/PhysicsWorld.ts +986 -0
  139. package/src/PlatformerFixtures.ts +205 -0
  140. package/src/Raycast.ts +315 -0
  141. package/src/RigidBody.ts +311 -0
  142. package/src/ScenePhysicsBridge.ts +207 -0
  143. package/src/Shape.ts +182 -0
  144. package/src/SoftBodyFixtures.ts +363 -0
  145. package/src/Steering.ts +531 -0
  146. package/src/VehicleDynamics.ts +524 -0
  147. package/src/index.ts +28 -0
package/README.md ADDED
@@ -0,0 +1,26 @@
1
+ # @aura3d/physics
2
+
3
+ `@aura3d/physics` owns deterministic rigid-body simulation, collision shapes, colliders, contacts, constraints, raycasts, fixed stepping, scene/ECS bridges, and debug draw extraction.
4
+
5
+ ## Public API
6
+
7
+ - `Shape`: box, sphere, capsule, plane, and indexed triangle-mesh shape descriptors plus bounds helpers.
8
+ - `RigidBody`, `Collider`: body state, forces, impulses, filters, sensors, material data, and snapshots.
9
+ - `CollisionEventQueue`, `Contact`: begin/stay/end event state and contact data.
10
+ - `Constraint`: fixed, hinge, slider, and spring-style constraint contracts.
11
+ - `PhysicsWorld`: body/collider/constraint ownership, deterministic stepping, contact solving, sleeping, raycasts, snapshots, and removal events.
12
+ - `PhysicsStepper`: fixed-step accumulator for simulation ticks.
13
+ - `ScenePhysicsBridge`, `ECSPhysicsBridge`: kinematic push and dynamic pull adapters.
14
+ - `PhysicsDebugDraw`: stable debug line extraction.
15
+
16
+ ## Verification
17
+
18
+ Deterministic replay, repeated fixed-input simulation comparison, broadphase pairs and profiling counters, shape validation, mesh bounds and backface-aware raycasts, sleeping/waking, begin/stay/end contacts, removal during contact, sensors, filters, raycasts, fixed/hinge/slider/spring constraints, bridge ordering, debug draw, browser physics pixels, and performance baselines are covered by `tests/unit/workstream4.physics-animation.test.ts`, `tests/unit/physics/broadphase.test.ts`, `tests/browser/physics-browser.spec.ts`, and `tests/performance/system-baselines.ts`. Export and import consistency is covered by `pnpm verify:exports` and `pnpm verify:imports`.
19
+
20
+ ## Current Limits
21
+
22
+ - Supported collision shape descriptors are box, sphere, capsule, plane, and indexed triangle mesh.
23
+ - Supported constraint contracts are fixed, hinge, slider, and spring-style constraints.
24
+ - Continuous collision detection is not currently supported; fast-moving bodies use discrete fixed-step collision checks.
25
+ - The built-in broadphase is deterministic sweep-and-prune with exposed profile counters, a faster browser-first workflow than a mature native physics backend.
26
+ - The package does not claim vehicle dynamics, cloth, soft bodies, fluids, destructible simulation, or large-world streaming physics.
@@ -0,0 +1,52 @@
1
+ import type { Collider } from "./Collider.js";
2
+ import type { PhysicsWorld } from "./PhysicsWorld.js";
3
+ import type { RigidBody } from "./RigidBody.js";
4
+ import { type Vec3 } from "./Shape.js";
5
+ export type CharacterControllerDescriptor = {
6
+ readonly position?: Vec3;
7
+ readonly radius?: number;
8
+ readonly halfHeight?: number;
9
+ readonly maxSpeed?: number;
10
+ readonly acceleration?: number;
11
+ readonly jumpSpeed?: number;
12
+ readonly groundProbeDistance?: number;
13
+ readonly maxSlopeAngleRadians?: number;
14
+ readonly collisionMask?: number;
15
+ };
16
+ export type CharacterControllerMoveInput = {
17
+ readonly x: number;
18
+ readonly z?: number;
19
+ };
20
+ export type CharacterControllerState = {
21
+ readonly grounded: boolean;
22
+ readonly groundNormal: Vec3;
23
+ readonly groundColliderId: number | null;
24
+ readonly desiredVelocity: Vec3;
25
+ readonly velocity: Vec3;
26
+ readonly speed: number;
27
+ readonly jumpedThisFrame: boolean;
28
+ };
29
+ export declare class CharacterController {
30
+ private readonly world;
31
+ readonly body: RigidBody;
32
+ readonly collider: Collider;
33
+ readonly radius: number;
34
+ readonly halfHeight: number;
35
+ readonly maxSpeed: number;
36
+ readonly acceleration: number;
37
+ readonly jumpSpeed: number;
38
+ readonly groundProbeDistance: number;
39
+ readonly maxSlopeAngleRadians: number;
40
+ private readonly collisionMask;
41
+ private moveInput;
42
+ private jumpQueued;
43
+ private state;
44
+ constructor(world: PhysicsWorld, descriptor?: CharacterControllerDescriptor);
45
+ setMoveInput(input: CharacterControllerMoveInput): void;
46
+ jump(): void;
47
+ teleport(position: Vec3): void;
48
+ step(dt: number): CharacterControllerState;
49
+ snapshot(): CharacterControllerState;
50
+ private probeGround;
51
+ }
52
+ //# sourceMappingURL=CharacterController.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CharacterController.d.ts","sourceRoot":"","sources":["../../../../packages/physics/src/CharacterController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAwB,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAE7D,MAAM,MAAM,6BAA6B,GAAG;IAC1C,QAAQ,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAC;IACzB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,YAAY,CAAC,EAAE,M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aAAa,CAAqB;IACnD,OAAO,CAAC,SAAS,CAA4B;IAC7C,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,KAAK,CAQX;gBAE2B,KAAK,EAAE,YAAY,EAAE,UAAU,GAAE,6BAAkC;IAsBhG,YAAY,CAAC,KAAK,EAAE,4BAA4B,GAAG,IAAI;IAOvD,IAAI,IAAI,IAAI;IAIZ,QAAQ,CAAC,QAAQ,EAAE,IAAI,GAAG,IAAI;IAa9B,IAAI,CAAC,EAAE,EAAE,MAAM,GAAG,wBAAwB;IAqC1C,QAAQ,IAAI,wBAAwB;IASpC,OAAO,CAAC,WAAW;CAiBpB"}
@@ -0,0 +1,146 @@
1
+ import { Shape, normalizeVec3 } from "./Shape.js";
2
+ export class CharacterController {
3
+ world;
4
+ body;
5
+ collider;
6
+ radius;
7
+ halfHeight;
8
+ maxSpeed;
9
+ acceleration;
10
+ jumpSpeed;
11
+ groundProbeDistance;
12
+ maxSlopeAngleRadians;
13
+ collisionMask;
14
+ moveInput = [0, 0];
15
+ jumpQueued = false;
16
+ state = {
17
+ grounded: false,
18
+ groundNormal: [0, 1, 0],
19
+ groundColliderId: null,
20
+ desiredVelocity: [0, 0, 0],
21
+ velocity: [0, 0, 0],
22
+ speed: 0,
23
+ jumpedThisFrame: false
24
+ };
25
+ constructor(world, descriptor = {}) {
26
+ this.world = world;
27
+ this.radius = positiveFinite(descriptor.radius ?? 0.24, "character radius");
28
+ this.halfHeight = positiveFinite(descriptor.halfHeight ?? 0.38, "character halfHeight");
29
+ this.maxSpeed = positiveFinite(descriptor.maxSpeed ?? 3.5, "character maxSpeed");
30
+ this.acceleration = positiveFinite(descriptor.acceleration ?? 32, "character acceleration");
31
+ this.jumpSpeed = positiveFinite(descriptor.jumpSpeed ?? 4.2, "character jumpSpeed");
32
+ this.groundProbeDistance = positiveFinite(descriptor.groundProbeDistance ?? 0.12, "character groundProbeDistance");
33
+ this.maxSlopeAngleRadians = positiveFinite(descriptor.maxSlopeAngleRadians ?? Math.PI / 3, "character maxSlopeAngleRadians");
34
+ this.collisionMask = descriptor.collisionMask;
35
+ this.body = world.createRigidBody({
36
+ type: "dynamic",
37
+ position: descriptor.position ?? [0, this.halfHeight + this.radius, 0],
38
+ mass: 1,
39
+ linearDamping: 0.02,
40
+ angularDamping: 1
41
+ });
42
+ this.collider = world.createCollider(this.body, {
43
+ shape: Shape.capsule(this.radius, this.halfHeight),
44
+ material: { friction: 0.05, restitution: 0 }
45
+ });
46
+ }
47
+ setMoveInput(input) {
48
+ const x = finiteOrZero(input.x);
49
+ const z = finiteOrZero(input.z ?? 0);
50
+ const length = Math.hypot(x, z);
51
+ this.moveInput = length > 1 ? [x / length, z / length] : [x, z];
52
+ }
53
+ jump() {
54
+ this.jumpQueued = true;
55
+ }
56
+ teleport(position) {
57
+ this.body.setPosition(position);
58
+ this.body.setVelocity([0, 0, 0]);
59
+ this.state = {
60
+ ...this.state,
61
+ grounded: false,
62
+ groundColliderId: null,
63
+ velocity: [0, 0, 0],
64
+ speed: 0,
65
+ jumpedThisFrame: false
66
+ };
67
+ }
68
+ step(dt) {
69
+ if (!Number.isFinite(dt) || dt <= 0) {
70
+ throw new Error("CharacterController.step dt must be finite and positive.");
71
+ }
72
+ const ground = this.probeGround();
73
+ const desiredVelocity = [
74
+ this.moveInput[0] * this.maxSpeed,
75
+ this.body.velocity[1],
76
+ this.moveInput[1] * this.maxSpeed
77
+ ];
78
+ const nextVelocity = [
79
+ moveToward(this.body.velocity[0], desiredVelocity[0], this.acceleration * dt),
80
+ this.body.velocity[1],
81
+ moveToward(this.body.velocity[2], desiredVelocity[2], this.acceleration * dt)
82
+ ];
83
+ let jumpedThisFrame = false;
84
+ if (ground.grounded && nextVelocity[1] < 0) {
85
+ nextVelocity[1] = 0;
86
+ }
87
+ if (this.jumpQueued && ground.grounded) {
88
+ nextVelocity[1] = this.jumpSpeed;
89
+ jumpedThisFrame = true;
90
+ }
91
+ this.jumpQueued = false;
92
+ this.body.setVelocity(nextVelocity);
93
+ this.state = {
94
+ grounded: ground.grounded && !jumpedThisFrame,
95
+ groundNormal: ground.normal,
96
+ groundColliderId: ground.colliderId,
97
+ desiredVelocity,
98
+ velocity: [...nextVelocity],
99
+ speed: Math.hypot(nextVelocity[0], nextVelocity[2]),
100
+ jumpedThisFrame
101
+ };
102
+ return this.state;
103
+ }
104
+ snapshot() {
105
+ return {
106
+ ...this.state,
107
+ groundNormal: [...this.state.groundNormal],
108
+ desiredVelocity: [...this.state.desiredVelocity],
109
+ velocity: [...this.state.velocity]
110
+ };
111
+ }
112
+ probeGround() {
113
+ const origin = [
114
+ this.body.position[0],
115
+ this.body.position[1] - this.halfHeight + this.groundProbeDistance,
116
+ this.body.position[2]
117
+ ];
118
+ const hit = this.world.sphereCast(origin, this.radius * 0.92, [0, -1, 0], {
119
+ maxDistance: this.groundProbeDistance + this.radius * 0.35,
120
+ includeSensors: false,
121
+ ...(this.collisionMask === undefined ? {} : { mask: this.collisionMask })
122
+ });
123
+ const minGroundNormalY = Math.cos(this.maxSlopeAngleRadians);
124
+ if (!hit || hit.normal[1] < minGroundNormalY) {
125
+ return { grounded: false, normal: [0, 1, 0], colliderId: null };
126
+ }
127
+ return { grounded: true, normal: normalizeVec3(hit.normal), colliderId: hit.colliderId };
128
+ }
129
+ }
130
+ function positiveFinite(value, name) {
131
+ if (!Number.isFinite(value) || value <= 0) {
132
+ throw new Error(`${name} must be a finite positive number.`);
133
+ }
134
+ return value;
135
+ }
136
+ function finiteOrZero(value) {
137
+ return Number.isFinite(value) ? value : 0;
138
+ }
139
+ function moveToward(current, target, maxDelta) {
140
+ const delta = target - current;
141
+ if (Math.abs(delta) <= maxDelta) {
142
+ return target;
143
+ }
144
+ return current + Math.sign(delta) * maxDelta;
145
+ }
146
+ //# sourceMappingURL=CharacterController.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CharacterController.js","sourceRoot":"","sources":["../../../../packages/physics/src/CharacterController.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE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AAY;IACjD,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,EAAE,CAAC;QAC1C,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,oCAAoC,CAAC,CAAC;IAC/D,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,YAAY,CAAC,KAAa;IACjC,OAAO,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AAC5C,CAAC;AAED,SAAS,UAAU,CAAC,OAAe,EAAE,MAAc,EAAE,QAAgB;IACnE,MAAM,KAAK,GAAG,MAAM,GAAG,OAAO,CAAC;IAC/B,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,QAAQ,EAAE,CAAC;QAChC,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,OAAO,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAC;AAC/C,CAAC"}
@@ -0,0 +1,87 @@
1
+ export interface ClothSimulationFixtureOptions {
2
+ readonly seed?: number;
3
+ readonly elapsedSeconds?: number;
4
+ readonly segmentsX?: number;
5
+ readonly segmentsY?: number;
6
+ }
7
+ export interface ClothSampleParticle {
8
+ readonly index: number;
9
+ readonly grid: readonly [number, number];
10
+ readonly pinned: boolean;
11
+ readonly position: readonly [number, number, number];
12
+ readonly uv: readonly [number, number];
13
+ }
14
+ export interface ClothSimulationFixture {
15
+ readonly id: "external-parity-old-branch-cloth-simulation-fixture";
16
+ readonly source: "origin-master-cloth-pbd-material-adapted";
17
+ readonly sourceFiles: readonly [
18
+ "origin/master:src/simulation/cloth/ClothSimulation.ts",
19
+ "origin/master:src/simulation/cloth/ClothCollisionSystem.ts",
20
+ "origin/master:src/simulation/cloth/ClothTearingSystem.ts",
21
+ "origin/master:src/materials/ClothMaterial.ts"
22
+ ];
23
+ readonly config: {
24
+ readonly width: number;
25
+ readonly height: number;
26
+ readonly segmentsX: number;
27
+ readonly segmentsY: number;
28
+ readonly particleMass: number;
29
+ readonly structuralStiffness: number;
30
+ readonly shearStiffness: number;
31
+ readonly bendingStiffness: number;
32
+ readonly solverIterations: number;
33
+ readonly damping: number;
34
+ };
35
+ readonly mesh: {
36
+ readonly particleCount: number;
37
+ readonly triangleCount: number;
38
+ readonly normalCount: number;
39
+ readonly uvCount: number;
40
+ readonly indexCount: number;
41
+ readonly pinnedCount: number;
42
+ readonly pinnedPattern: "top-edge";
43
+ readonly sampleParticles: readonly ClothSampleParticle[];
44
+ };
45
+ readonly constraints: {
46
+ readonly structural: number;
47
+ readonly shear: number;
48
+ readonly bending: number;
49
+ readonly total: number;
50
+ readonly maxStrain: number;
51
+ readonly tearThreshold: number;
52
+ readonly tearCandidates: number;
53
+ readonly cutPlaneConstraintCandidates: number;
54
+ };
55
+ readonly wind: {
56
+ readonly direction: readonly [number, number, number];
57
+ readonly turbulence: number;
58
+ readonly frequency: number;
59
+ readonly maxOffset: number;
60
+ readonly affectedParticles: number;
61
+ };
62
+ readonly collision: {
63
+ readonly shape: "sphere";
64
+ readonly center: readonly [number, number, number];
65
+ readonly radius: number;
66
+ readonly penetrationCount: number;
67
+ readonly resolvedParticles: number;
68
+ readonly maxPenetration: number;
69
+ readonly friction: number;
70
+ readonly restitution: number;
71
+ };
72
+ readonly material: {
73
+ readonly preset: "coarse-wool-flag";
74
+ readonly sheenIntensity: number;
75
+ readonly sheenRoughness: number;
76
+ readonly subsurfaceIntensity: number;
77
+ readonly anisotropyStrength: number;
78
+ readonly fuzzIntensity: number;
79
+ readonly roughness: number;
80
+ readonly tiling: readonly [number, number];
81
+ };
82
+ readonly blockedClaims: readonly string[];
83
+ readonly hash: string;
84
+ readonly claimBoundary: string;
85
+ }
86
+ export declare function sampleClothSimulationFixture(options?: ClothSimulationFixtureOptions): ClothSimulationFixture;
87
+ //# sourceMappingURL=ClothFixtures.d.ts.map
@@ -0,0 +1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loth/ClothCollisionSystem.ts",
4
+ "origin/master:src/simulation/cloth/ClothTearingSystem.ts",
5
+ "origin/master:src/materials/ClothMaterial.ts"
6
+ ];
7
+ const blockedClaims = [
8
+ "GPU cloth compute parity",
9
+ "100k particle cloth performance",
10
+ "production PBD solver parity",
11
+ "cloth self-collision",
12
+ "mesh-splitting topology tearing",
13
+ "fabric shader parity",
14
+ "Unity Cloth parity",
15
+ "Unreal Chaos Cloth parity"
16
+ ];
17
+ export function sampleClothSimulationFixture(options = {}) {
18
+ const seed = integer(options.seed ?? 0x3d2025, "seed");
19
+ const elapsedSeconds = finiteNonNegative(options.elapsedSeconds ?? 0.4, "elapsedSeconds");
20
+ const segmentsX = integerInRange(options.segmentsX ?? 12, "segmentsX", 2, 64);
21
+ const segmentsY = integerInRange(options.segmentsY ?? 8, "segmentsY", 2, 64);
22
+ const width = 2.4;
23
+ const height = 1.5;
24
+ const particleCount = (segmentsX + 1) * (segmentsY + 1);
25
+ const triangleCount = segmentsX * segmentsY * 2;
26
+ const structural = segmentsX * (segmentsY + 1) + (segmentsX + 1) * segmentsY;
27
+ const shear = segmentsX * segmentsY * 2;
28
+ const bending = Math.max(0, (segmentsX - 1) * (segmentsY + 1) + (segmentsY - 1) * (segmentsX + 1));
29
+ const pinnedCount = segmentsX + 1;
30
+ const windDirection = [3.2, 0.35, 1.15];
31
+ const turbulence = 0.35;
32
+ const frequency = 1.8;
33
+ const collisionCenter = [0.08, -0.18, 0.06];
34
+ const collisionRadius = 0.34;
35
+ let maxOffset = 0;
36
+ let affectedParticles = 0;
37
+ let penetrationCount = 0;
38
+ let resolvedParticles = 0;
39
+ let maxPenetration = 0;
40
+ let maxStrain = 1;
41
+ let tearCandidates = 0;
42
+ let cutPlaneConstraintCandidates = 0;
43
+ const positions = new Map();
44
+ const sampleParticles = [];
45
+ const sampleKeys = new Set([
46
+ particleIndex(0, 0, segmentsX),
47
+ particleIndex(Math.floor(segmentsX / 2), 0, segmentsX),
48
+ particleIndex(segmentsX, 0, segmentsX),
49
+ particleIndex(0, Math.floor(segmentsY / 2), segmentsX),
50
+ particleIndex(Math.floor(segmentsX / 2), Math.floor(segmentsY / 2), segmentsX),
51
+ particleIndex(segmentsX, Math.floor(segmentsY / 2), segmentsX),
52
+ particleIndex(0, segmentsY, segmentsX),
53
+ particleIndex(Math.floor(segmentsX / 2), segmentsY, segmentsX),
54
+ particleIndex(segmentsX, segmentsY, segmentsX)
55
+ ]);
56
+ for (let y = 0; y <= segmentsY; y += 1) {
57
+ for (let x = 0; x <= segmentsX; x += 1) {
58
+ const index = particleIndex(x, y, segmentsX);
59
+ const vertical = y / segmentsY;
60
+ const horizontal = x / segmentsX;
61
+ const pinned = y === 0;
62
+ const baseX = (horizontal - 0.5) * width;
63
+ const sag = pinned ? 0 : Math.pow(vertical, 1.42) * (0.28 + hash01(seed, 7) * 0.08 + elapsedSeconds * 0.045);
64
+ const gust = pinned ? 0 : Math.sin(elapsedSeconds * frequency + x * 0.73 + y * 0.41 + hash01(seed, x + y + 11) * 2) * turbulence * vertical;
65
+ const xOffset = pinned ? 0 : windDirection[0] * 0.018 * vertical + gust * 0.06;
66
+ const zOffset = pinned ? 0 : windDirection[2] * 0.035 * vertical + gust * 0.1;
67
+ let position = [
68
+ round4(baseX + xOffset),
69
+ round4(height * 0.5 - vertical * height - sag),
70
+ round4(zOffset)
71
+ ];
72
+ const penetration = spherePenetration(position, collisionCenter, collisionRadius);
73
+ if (penetration > 0) {
74
+ penetrationCount += 1;
75
+ resolvedParticles += 1;
76
+ maxPenetration = Math.max(maxPenetration, penetration);
77
+ position = resolveSphere(position, collisionCenter, collisionRadius);
78
+ }
79
+ const offset = Math.hypot(position[0] - baseX, position[2]);
80
+ if (offset > 0.002 && !pinned)
81
+ affectedParticles += 1;
82
+ maxOffset = Math.max(maxOffset, offset);
83
+ positions.set(index, position);
84
+ if (sampleKeys.has(index)) {
85
+ sampleParticles.push({
86
+ index,
87
+ grid: [x, y],
88
+ pinned,
89
+ position,
90
+ uv: [round4(horizontal), round4(vertical)]
91
+ });
92
+ }
93
+ }
94
+ }
95
+ for (let y = 0; y <= segmentsY; y += 1) {
96
+ for (let x = 0; x <= segmentsX; x += 1) {
97
+ const current = positions.get(particleIndex(x, y, segmentsX));
98
+ if (!current)
99
+ continue;
100
+ if (x < segmentsX) {
101
+ const strain = constraintStrain(current, positions.get(particleIndex(x + 1, y, segmentsX)), width / segmentsX);
102
+ maxStrain = Math.max(maxStrain, strain);
103
+ if (strain >= 1.035 && y >= segmentsY - 2)
104
+ tearCandidates += 1;
105
+ if (x < segmentsX / 2 && x + 1 >= segmentsX / 2 && y > 0)
106
+ cutPlaneConstraintCandidates += 1;
107
+ }
108
+ if (y < segmentsY) {
109
+ const strain = constraintStrain(current, positions.get(particleIndex(x, y + 1, segmentsX)), height / segmentsY);
110
+ maxStrain = Math.max(maxStrain, strain);
111
+ if (strain >= 1.05 && y >= segmentsY - 3)
112
+ tearCandidates += 1;
113
+ }
114
+ }
115
+ }
116
+ const metricsForHash = [
117
+ seed,
118
+ elapsedSeconds,
119
+ segmentsX,
120
+ segmentsY,
121
+ particleCount,
122
+ triangleCount,
123
+ structural,
124
+ shear,
125
+ bending,
126
+ pinnedCount,
127
+ maxOffset,
128
+ affectedParticles,
129
+ penetrationCount,
130
+ maxPenetration,
131
+ maxStrain,
132
+ tearCandidates,
133
+ cutPlaneConstraintCandidates
134
+ ];
135
+ return {
136
+ id: "external-parity-old-branch-cloth-simulation-fixture",
137
+ source: "origin-master-cloth-pbd-material-adapted",
138
+ sourceFiles,
139
+ config: {
140
+ width,
141
+ height,
142
+ segmentsX,
143
+ segmentsY,
144
+ particleMass: 0.1,
145
+ structuralStiffness: 0.9,
146
+ shearStiffness: 0.8,
147
+ bendingStiffness: 0.12,
148
+ solverIterations: 6,
149
+ damping: 0.01
150
+ },
151
+ mesh: {
152
+ particleCount,
153
+ triangleCount,
154
+ normalCount: particleCount,
155
+ uvCount: particleCount,
156
+ indexCount: triangleCount * 3,
157
+ pinnedCount,
158
+ pinnedPattern: "top-edge",
159
+ sampleParticles
160
+ },
161
+ constraints: {
162
+ structural,
163
+ shear,
164
+ bending,
165
+ total: structural + shear + bending,
166
+ maxStrain: round4(maxStrain),
167
+ tearThreshold: 1.035,
168
+ tearCandidates,
169
+ cutPlaneConstraintCandidates
170
+ },
171
+ wind: {
172
+ direction: windDirection,
173
+ turbulence,
174
+ frequency,
175
+ maxOffset: round4(maxOffset),
176
+ affectedParticles
177
+ },
178
+ collision: {
179
+ shape: "sphere",
180
+ center: collisionCenter,
181
+ radius: collisionRadius,
182
+ penetrationCount,
183
+ resolvedParticles,
184
+ maxPenetration: round4(maxPenetration),
185
+ friction: 0.42,
186
+ restitution: 0.04
187
+ },
188
+ material: {
189
+ preset: "coarse-wool-flag",
190
+ sheenIntensity: 0.56,
191
+ sheenRoughness: 0.34,
192
+ subsurfaceIntensity: 0.24,
193
+ anisotropyStrength: 0.42,
194
+ fuzzIntensity: 0.22,
195
+ roughness: 0.74,
196
+ tiling: [3, 2]
197
+ },
198
+ blockedClaims,
199
+ hash: hashNumbers(metricsForHash),
200
+ claimBoundary: "Deterministic bounded cloth telemetry adapted from old PBD cloth, collision, tearing, and cloth-material concepts. It proves a pinned cloth grid, structural/shear/bending constraint counts, wind displacement, sphere-collision response, tear-candidate metrics, and fabric material parameters; it does not claim GPU cloth, self-collision, topology tearing, fabric shader parity, Unity Cloth parity, or Unreal Chaos Cloth parity."
201
+ };
202
+ }
203
+ function particleIndex(x, y, segmentsX) {
204
+ return y * (segmentsX + 1) + x;
205
+ }
206
+ function constraintStrain(left, right, restLength) {
207
+ if (!right)
208
+ return 1;
209
+ const length = Math.hypot(left[0] - right[0], left[1] - right[1], left[2] - right[2]);
210
+ return restLength > 0 ? length / restLength : 1;
211
+ }
212
+ function spherePenetration(position, center, radius) {
213
+ const distance = Math.hypot(position[0] - center[0], position[1] - center[1], position[2] - center[2]);
214
+ return Math.max(0, radius - distance);
215
+ }
216
+ function resolveSphere(position, center, radius) {
217
+ const dx = position[0] - center[0];
218
+ const dy = position[1] - center[1];
219
+ const dz = position[2] - center[2];
220
+ const length = Math.max(0.0001, Math.hypot(dx, dy, dz));
221
+ return [
222
+ round4(center[0] + dx / length * radius),
223
+ round4(center[1] + dy / length * radius),
224
+ round4(center[2] + dz / length * radius)
225
+ ];
226
+ }
227
+ function hash01(seed, salt) {
228
+ let value = Math.imul(seed + salt * 1013904223, 1664525) + 1013904223;
229
+ value = Math.imul(value ^ (value >>> 13), 1274126177);
230
+ return ((value ^ (value >>> 16)) >>> 0) / 4294967296;
231
+ }
232
+ function hashNumbers(values) {
233
+ let hash = 0x811c9dc5;
234
+ for (const value of values) {
235
+ const scaled = Math.round(value * 10_000);
236
+ hash ^= scaled & 0xff;
237
+ hash = Math.imul(hash, 0x01000193) >>> 0;
238
+ hash ^= (scaled >>> 8) & 0xff;
239
+ hash = Math.imul(hash, 0x01000193) >>> 0;
240
+ hash ^= (scaled >>> 16) & 0xff;
241
+ hash = Math.imul(hash, 0x01000193) >>> 0;
242
+ }
243
+ return hash.toString(16).padStart(8, "0");
244
+ }
245
+ function round4(value) {
246
+ return Number(value.toFixed(4));
247
+ }
248
+ function finiteNonNegative(value, label) {
249
+ if (!Number.isFinite(value) || value < 0)
250
+ throw new RangeError(`Cloth fixture ${label} must be finite and non-negative.`);
251
+ return value;
252
+ }
253
+ function integer(value, label) {
254
+ if (!Number.isInteger(value))
255
+ throw new RangeError(`Cloth fixture ${label} must be an integer.`);
256
+ return value;
257
+ }
258
+ function integerInRange(value, label, min, max) {
259
+ const parsed = integer(value, label);
260
+ if (parsed < min || parsed > max)
261
+ throw new RangeError(`Cloth fixture ${label} must be in the [${min}, ${max}] range.`);
262
+ return parsed;
263
+ }
264
+ //# sourceMappingURL=ClothFixtures.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ClothFixtures.js","sourceRoot":"","sources":["../../../../packages/physics/src/ClothFixtures.ts"],"names":[],"mappings":"AAwFA,MAAM,WAAW,GAAG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AAS,MAAM,CAAC,KAAa;IAC3B,OAAO,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;AAClC,CAAC;AAED,SAAS,iBAAiB,CAAC,KAAa,EAAE,KAAa;IACrD,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC;QAAE,MAAM,IAAI,UAAU,CAAC,iBAAiB,KAAK,mCAAmC,CAAC,CAAC;IAC1H,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,OAAO,CAAC,KAAa,EAAE,KAAa;IAC3C,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC;QAAE,MAAM,IAAI,UAAU,CAAC,iBAAiB,KAAK,sBAAsB,CAAC,CAAC;IACjG,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,cAAc,CAAC,KAAa,EAAE,KAAa,EAAE,GAAW,EAAE,GAAW;IAC5E,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACrC,IAAI,MAAM,GAAG,GAAG,IAAI,MAAM,GAAG,GAAG;QAAE,MAAM,IAAI,UAAU,CAAC,iBAAiB,KAAK,oBAAoB,GAAG,KAAK,GAAG,UAAU,CAAC,CAAC;IACxH,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,27 @@
1
+ import { type Bounds, type PhysicsShape, type Vec3 } from "./Shape.js";
2
+ export type CollisionFilter = {
3
+ readonly layer: number;
4
+ readonly mask: number;
5
+ };
6
+ export type ColliderMaterial = {
7
+ readonly restitution: number;
8
+ readonly friction: number;
9
+ };
10
+ export type ColliderDescriptor = {
11
+ readonly shape: PhysicsShape;
12
+ readonly sensor?: boolean;
13
+ readonly filter?: Partial<CollisionFilter>;
14
+ readonly material?: Partial<ColliderMaterial>;
15
+ };
16
+ export declare class Collider {
17
+ readonly id: number;
18
+ readonly bodyId: number;
19
+ readonly shape: PhysicsShape;
20
+ readonly sensor: boolean;
21
+ readonly filter: CollisionFilter;
22
+ readonly material: ColliderMaterial;
23
+ constructor(id: number, bodyId: number, descriptor: ColliderDescriptor);
24
+ canCollideWith(other: Collider): boolean;
25
+ bounds(position: Vec3): Bounds;
26
+ }
27
+ //# sourceMappingURL=Collider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Collider.d.ts","sourceRoot":"","sources":["../../../../packages/physics/src/Collider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,KAAK,MAAM,EAAE,KAAK,YAAY,EAAE,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAE9E,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;IAC7B,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;IAC3C,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAC;CAC/C,CAAC;AAEF,qBAAa,QAAQ;IACnB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAC;IACjC,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;gBAExB,EAAE,EAA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