@flighthq/physics2d 0.3.0-next.1595.4d49b41 → 0.3.0-next.1665.6235922

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 (75) hide show
  1. package/dist/broadphase.d.ts +1 -0
  2. package/dist/broadphase.d.ts.map +1 -1
  3. package/dist/broadphase.js +39 -0
  4. package/dist/broadphase.js.map +1 -1
  5. package/dist/contract.d.ts +3 -2
  6. package/dist/contract.d.ts.map +1 -1
  7. package/dist/contract.js +3 -2
  8. package/dist/contract.js.map +1 -1
  9. package/dist/explainPhysics2DStep.d.ts.map +1 -1
  10. package/dist/explainPhysics2DStep.js +24 -2
  11. package/dist/explainPhysics2DStep.js.map +1 -1
  12. package/dist/index.d.ts +4 -3
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js +4 -3
  15. package/dist/index.js.map +1 -1
  16. package/dist/islands.d.ts +8 -0
  17. package/dist/islands.d.ts.map +1 -1
  18. package/dist/islands.js +143 -16
  19. package/dist/islands.js.map +1 -1
  20. package/dist/jointCollisionSuppression.d.ts +4 -0
  21. package/dist/jointCollisionSuppression.d.ts.map +1 -0
  22. package/dist/jointCollisionSuppression.js +30 -0
  23. package/dist/jointCollisionSuppression.js.map +1 -0
  24. package/dist/jointRegistry.d.ts +1 -0
  25. package/dist/jointRegistry.d.ts.map +1 -1
  26. package/dist/jointRegistry.js +29 -0
  27. package/dist/jointRegistry.js.map +1 -1
  28. package/dist/joints.d.ts +3 -0
  29. package/dist/joints.d.ts.map +1 -1
  30. package/dist/joints.js +12 -0
  31. package/dist/joints.js.map +1 -1
  32. package/dist/massProperties.js +1 -1
  33. package/dist/massProperties.js.map +1 -1
  34. package/dist/material.d.ts +3 -0
  35. package/dist/material.d.ts.map +1 -0
  36. package/dist/material.js +13 -0
  37. package/dist/material.js.map +1 -0
  38. package/dist/ownership.d.ts +8 -0
  39. package/dist/ownership.d.ts.map +1 -0
  40. package/dist/ownership.js +23 -0
  41. package/dist/ownership.js.map +1 -0
  42. package/dist/solver.d.ts +2 -0
  43. package/dist/solver.d.ts.map +1 -1
  44. package/dist/solver.js +45 -30
  45. package/dist/solver.js.map +1 -1
  46. package/dist/step.d.ts.map +1 -1
  47. package/dist/step.js +492 -97
  48. package/dist/step.js.map +1 -1
  49. package/dist/stepValidation.d.ts +10 -0
  50. package/dist/stepValidation.d.ts.map +1 -0
  51. package/dist/stepValidation.js +197 -0
  52. package/dist/stepValidation.js.map +1 -0
  53. package/dist/world.d.ts +5 -0
  54. package/dist/world.d.ts.map +1 -1
  55. package/dist/world.js +186 -7
  56. package/dist/world.js.map +1 -1
  57. package/dist/worldQueries.d.ts +6 -4
  58. package/dist/worldQueries.d.ts.map +1 -1
  59. package/dist/worldQueries.js +85 -8
  60. package/dist/worldQueries.js.map +1 -1
  61. package/package.json +5 -5
  62. package/src/broadphase.test.ts +44 -1
  63. package/src/explainPhysics2DStep.test.ts +36 -1
  64. package/src/islands.test.ts +82 -1
  65. package/src/jointCollisionSuppression.test.ts +38 -0
  66. package/src/jointRegistry.test.ts +103 -0
  67. package/src/massProperties.test.ts +11 -0
  68. package/src/material.test.ts +28 -0
  69. package/src/ownership.test.ts +35 -0
  70. package/src/solver.test.ts +59 -1
  71. package/src/step.test.ts +392 -2
  72. package/src/stepValidation.test.ts +151 -0
  73. package/src/stress.test.ts +186 -0
  74. package/src/world.test.ts +232 -0
  75. package/src/worldQueries.test.ts +93 -0
@@ -1,3 +1,4 @@
1
1
  import type { Physics2DWorld } from '@flighthq/types/contract';
2
2
  export declare function synchronizePhysics2DBroadphase(world: Physics2DWorld): void;
3
+ export declare function synchronizePhysics2DSweptBroadphase(world: Physics2DWorld, dt: number): void;
3
4
  //# sourceMappingURL=broadphase.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"broadphase.d.ts","sourceRoot":"","sources":["../src/broadphase.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAe,MAAM,0BAA0B,CAAC;AAO5E,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI,CA4C1E"}
1
+ {"version":3,"file":"broadphase.d.ts","sourceRoot":"","sources":["../src/broadphase.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAe,MAAM,0BAA0B,CAAC;AAO5E,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI,CAE1E;AAKD,wBAAgB,mCAAmC,CAAC,KAAK,EAAE,cAAc,EAAE,EAAE,EAAE,MAAM,GAAG,IAAI,CAE3F"}
@@ -3,11 +3,21 @@ import { updatePhysics2DColliderWorldShape, writePhysics2DColliderBounds } from
3
3
  // and public world queries share this path so a query observes the body's current authored pose, not
4
4
  // the pre-integration snapshot used to build the most recent contact set.
5
5
  export function synchronizePhysics2DBroadphase(world) {
6
+ synchronizePhysics2DBroadphaseBounds(world, 0);
7
+ }
8
+ // Publishes the union of every body's current and linearly translated bounds for one CCD interval.
9
+ // The ordinary index is reused deliberately: a step queries the candidate pairs immediately and then
10
+ // restores current bounds, avoiding a second hidden index while retaining the backend swap point.
11
+ export function synchronizePhysics2DSweptBroadphase(world, dt) {
12
+ synchronizePhysics2DBroadphaseBounds(world, dt);
13
+ }
14
+ function synchronizePhysics2DBroadphaseBounds(world, dt) {
6
15
  for (const body of world.bodies) {
7
16
  let minX = Infinity;
8
17
  let minY = Infinity;
9
18
  let maxX = -Infinity;
10
19
  let maxY = -Infinity;
20
+ let rotationRadiusSquared = 0;
11
21
  for (const collider of body.colliders) {
12
22
  updatePhysics2DColliderWorldShape(collider, body);
13
23
  writePhysics2DColliderBounds(collider, boundsScratch);
@@ -19,6 +29,11 @@ export function synchronizePhysics2DBroadphase(world) {
19
29
  maxX = boundsScratch.maxX;
20
30
  if (boundsScratch.maxY > maxY)
21
31
  maxY = boundsScratch.maxY;
32
+ const radiusX = Math.max(Math.abs(boundsScratch.minX - body.x), Math.abs(boundsScratch.maxX - body.x));
33
+ const radiusY = Math.max(Math.abs(boundsScratch.minY - body.y), Math.abs(boundsScratch.maxY - body.y));
34
+ const radiusSquared = radiusX * radiusX + radiusY * radiusY;
35
+ if (radiusSquared > rotationRadiusSquared)
36
+ rotationRadiusSquared = radiusSquared;
22
37
  }
23
38
  if (minX > maxX) {
24
39
  // No collider produced bounds, so there is nothing to index. Withdraw rather than skip: the id
@@ -26,6 +41,30 @@ export function synchronizePhysics2DBroadphase(world) {
26
41
  world.index.removeSpatialObject(body.index);
27
42
  continue;
28
43
  }
44
+ if (dt > 0 && body.type !== 'static' && !body.sleeping) {
45
+ const translationX = body.velocityX * dt;
46
+ const translationY = body.velocityY * dt;
47
+ if (body.angularVelocity !== 0) {
48
+ // A circle around the body origin encloses every orientation of every collider. Sweeping that
49
+ // circle along the origin's translation is conservative for arbitrary rotation, including an
50
+ // offset circle whose centre follows an arc rather than the linear path used by shape sweep.
51
+ const radius = Math.sqrt(rotationRadiusSquared);
52
+ minX = Math.min(minX, body.x - radius, body.x + translationX - radius);
53
+ minY = Math.min(minY, body.y - radius, body.y + translationY - radius);
54
+ maxX = Math.max(maxX, body.x + radius, body.x + translationX + radius);
55
+ maxY = Math.max(maxY, body.y + radius, body.y + translationY + radius);
56
+ }
57
+ else {
58
+ if (translationX < 0)
59
+ minX += translationX;
60
+ else
61
+ maxX += translationX;
62
+ if (translationY < 0)
63
+ minY += translationY;
64
+ else
65
+ maxY += translationY;
66
+ }
67
+ }
29
68
  // The spatial package bounds its own indexing cost. This second limit expresses the physics
30
69
  // world's stricter judgement that a non-finite or ten-million-unit body has diverged and should no
31
70
  // longer participate in collision or queries.
@@ -1 +1 @@
1
- {"version":3,"file":"broadphase.js","sourceRoot":"","sources":["../src/broadphase.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iCAAiC,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AAEtG,sGAAsG;AACtG,qGAAqG;AACrG,0EAA0E;AAC1E,MAAM,UAAU,8BAA8B,CAAC,KAAqB;I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E,UAAU,CAAC,IAAI,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC;QACzC,UAAU,CAAC,IAAI,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC;QACzC,KAAK,CAAC,KAAK,CAAC,mBAAmB,CAAC,IAAI,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;IAC1D,CAAC;AACH,CAAC;AAED,SAAS,gBAAgB,CAAC,KAAa;IACrC,MAAM,MAAM,GAAG,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,GAAG,MAAM,CAAC,OAAO,GAAG,CAAC,CAAC;IACzE,OAAO,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC;AAClD,CAAC;AAED,qGAAqG;AACrG,gGAAgG;AAChG,MAAM,oBAAoB,GAAG,GAAG,CAAC;AACjC,MAAM,aAAa,GAAgB,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;AAC1E,MAAM,UAAU,GAAgB,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC"}
@@ -1,13 +1,14 @@
1
1
  export * from './colliderTransform';
2
2
  export * from './explainPhysics2DJoints';
3
3
  export * from './explainPhysics2DStep';
4
- export * from './islands';
4
+ export { isRigidBody2DPairAwake, updatePhysics2DSleep, wakePhysics2DBody } from './islands';
5
5
  export * from './jointFactories';
6
6
  export * from './jointRegistry';
7
7
  export * from './joints';
8
8
  export * from './massProperties';
9
+ export * from './material';
9
10
  export * from './registerBuiltInPhysics2DJointSolvers';
10
- export * from './solver';
11
+ export { applyPhysics2DImpulse, relativeNormalVelocity, solvePhysics2DContacts, solvePhysics2DContactsOnce, warmStartPhysics2DContacts, } from './solver';
11
12
  export * from './step';
12
13
  export * from './world';
13
14
  export * from './worldQueries';
@@ -1 +1 @@
1
- {"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC;AACjC,cAAc,wCAAwC,CAAC;AACvD,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC"}
1
+ {"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC5F,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,wCAAwC,CAAC;AACvD,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,sBAAsB,EACtB,0BAA0B,EAC1B,0BAA0B,GAC3B,MAAM,UAAU,CAAC;AAClB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC"}
package/dist/contract.js CHANGED
@@ -1,13 +1,14 @@
1
1
  export * from './colliderTransform';
2
2
  export * from './explainPhysics2DJoints';
3
3
  export * from './explainPhysics2DStep';
4
- export * from './islands';
4
+ export { isRigidBody2DPairAwake, updatePhysics2DSleep, wakePhysics2DBody } from './islands';
5
5
  export * from './jointFactories';
6
6
  export * from './jointRegistry';
7
7
  export * from './joints';
8
8
  export * from './massProperties';
9
+ export * from './material';
9
10
  export * from './registerBuiltInPhysics2DJointSolvers';
10
- export * from './solver';
11
+ export { applyPhysics2DImpulse, relativeNormalVelocity, solvePhysics2DContacts, solvePhysics2DContactsOnce, warmStartPhysics2DContacts, } from './solver';
11
12
  export * from './step';
12
13
  export * from './world';
13
14
  export * from './worldQueries';
@@ -1 +1 @@
1
- {"version":3,"file":"contract.js","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC;AACjC,cAAc,wCAAwC,CAAC;AACvD,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC"}
1
+ {"version":3,"file":"contract.js","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC5F,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,wCAAwC,CAAC;AACvD,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,sBAAsB,EACtB,0BAA0B,EAC1B,0BAA0B,GAC3B,MAAM,UAAU,CAAC;AAClB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"explainPhysics2DStep.d.ts","sourceRoot":"","sources":["../src/explainPhysics2DStep.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAKzF,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,QAAQ,CAAC,cAAc,CAAC,EAAE,EAAE,EAAE,MAAM,GAAG,wBAAwB,CAY1G"}
1
+ {"version":3,"file":"explainPhysics2DStep.d.ts","sourceRoot":"","sources":["../src/explainPhysics2DStep.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAezF,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,QAAQ,CAAC,cAAc,CAAC,EAAE,EAAE,EAAE,MAAM,GAAG,wBAAwB,CAkC1G"}
@@ -1,15 +1,37 @@
1
+ import { isPhysics2DBodyStateValid, isPhysics2DContactStateValid, isPhysics2DGravityValid, isPhysics2DJointStateValid, isPhysics2DPreviousTimestepValid, isPhysics2DSolverConfigValid, isPhysics2DTimestepValid, } from './stepValidation';
1
2
  // Pure diagnostic twin of stepPhysics2D's early return. Invalid input rejects the whole step rather than
2
3
  // integrating only the phases that happen to tolerate it: a partial step would be harder to recover from
3
4
  // than a no-op and could poison persistent contacts or body state before the invalid loop count is read.
4
5
  export function explainPhysics2DStep(world, dt) {
5
- const timestepValid = Number.isFinite(dt) && dt > 0;
6
+ const bodyStateValid = isPhysics2DBodyStateValid(world);
7
+ const contactStateValid = isPhysics2DContactStateValid(world);
8
+ const gravityValid = isPhysics2DGravityValid(world);
9
+ const jointStateValid = isPhysics2DJointStateValid(world);
10
+ const previousTimestepValid = isPhysics2DPreviousTimestepValid(world);
11
+ const solverConfigValid = isPhysics2DSolverConfigValid(world.config);
12
+ const timestepValid = isPhysics2DTimestepValid(dt);
6
13
  const velocityIterationsValid = Number.isSafeInteger(world.config.velocityIterations) && world.config.velocityIterations >= 0;
7
14
  const positionIterationsValid = Number.isSafeInteger(world.config.positionIterations) && world.config.positionIterations >= 0;
15
+ const ready = bodyStateValid &&
16
+ contactStateValid &&
17
+ gravityValid &&
18
+ jointStateValid &&
19
+ previousTimestepValid &&
20
+ solverConfigValid &&
21
+ timestepValid &&
22
+ velocityIterationsValid &&
23
+ positionIterationsValid;
8
24
  return {
25
+ bodyStateValid,
26
+ contactStateValid,
27
+ gravityValid,
28
+ jointStateValid,
9
29
  timestepValid,
10
30
  velocityIterationsValid,
11
31
  positionIterationsValid,
12
- status: timestepValid && velocityIterationsValid && positionIterationsValid ? 'ready' : 'invalid-step',
32
+ previousTimestepValid,
33
+ solverConfigValid,
34
+ status: ready ? 'ready' : 'invalid-step',
13
35
  };
14
36
  }
15
37
  //# sourceMappingURL=explainPhysics2DStep.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"explainPhysics2DStep.js","sourceRoot":"","sources":["../src/explainPhysics2DStep.ts"],"names":[],"mappings":"AAEA,yGAAyG;AACzG,yGAAyG;AACzG,yGAAyG;AACzG,MAAM,UAAU,oBAAoB,CAAC,KAA+B,EAAE,EAAU;IAC9E,MAAM,aAAa,GAAG,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IACpD,MAAM,uBAAuB,GAC3B,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC,kBAAkB,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,kBAAkB,IAAI,CAAC,CAAC;IAChG,MAAM,uBAAuB,GAC3B,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC,kBAAkB,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,kBAAkB,IAAI,CAAC,CAAC;IAChG,OAAO;QACL,aAAa;QACb,uBAAuB;QACvB,uBAAuB;QACvB,MAAM,EAAE,aAAa,IAAI,u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Aa;QACb,uBAAuB;QACvB,uBAAuB,CAAC;IAC1B,OAAO;QACL,cAAc;QACd,iBAAiB;QACjB,YAAY;QACZ,eAAe;QACf,aAAa;QACb,uBAAuB;QACvB,uBAAuB;QACvB,qBAAqB;QACrB,iBAAiB;QACjB,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,cAAc;KACzC,CAAC;AACJ,CAAC"}
package/dist/index.d.ts CHANGED
@@ -5,11 +5,12 @@ export { explainPhysics2DStep } from './explainPhysics2DStep';
5
5
  export { isRigidBody2DPairAwake, updatePhysics2DSleep, wakePhysics2DBody } from './islands';
6
6
  export { createPhysics2DDistanceJoint, createPhysics2DGearJoint, createPhysics2DMouseJoint, createPhysics2DPrismaticJoint, createPhysics2DPulleyJoint, createPhysics2DRevoluteJoint, createPhysics2DRopeJoint, createPhysics2DWeldJoint, createPhysics2DWheelJoint, } from './jointFactories';
7
7
  export { Physics2DDistanceJointKind, Physics2DGearJointKind, Physics2DMouseJointKind, Physics2DPrismaticJointKind, Physics2DPulleyJointKind, Physics2DRevoluteJointKind, Physics2DRopeJointKind, Physics2DWheelJointKind, Physics2DWeldJointKind, physics2DDistanceJointSolver, physics2DGearJointSolver, physics2DMouseJointSolver, physics2DPrismaticJointSolver, physics2DPulleyJointSolver, physics2DRevoluteJointSolver, physics2DRopeJointSolver, physics2DWheelJointSolver, physics2DWeldJointSolver, } from './joints';
8
- export { addPhysics2DJoint, getPhysics2DJointSolver, registerPhysics2DJointSolver, removePhysics2DJoint, } from './jointRegistry';
8
+ export { addPhysics2DJoint, getPhysics2DJointSolver, invalidatePhysics2DJoint, registerPhysics2DJointSolver, removePhysics2DJoint, } from './jointRegistry';
9
9
  export { computePhysics2DColliderMassData, updateRigidBody2DMassData } from './massProperties';
10
+ export { mixPhysics2DFriction, mixPhysics2DRestitution } from './material';
10
11
  export { registerBuiltInPhysics2DJointSolvers } from './registerBuiltInPhysics2DJointSolvers';
11
12
  export { applyPhysics2DImpulse, relativeNormalVelocity, solvePhysics2DContacts, solvePhysics2DContactsOnce, warmStartPhysics2DContacts, } from './solver';
12
13
  export { stepPhysics2D } from './step';
13
- export { addPhysics2DBody, addPhysics2DCollider, applyPhysics2DForce, applyPhysics2DForceAtPoint, applyPhysics2DLinearImpulse, applyPhysics2DLinearImpulseAtPoint, applyPhysics2DTorque, findPhysics2DBody, createPhysics2DCollider, createPhysics2DSolverConfig, createPhysics2DWorld, createRigidBody2D, invalidatePhysics2DCollider, isPhysics2DPairOrdered, removePhysics2DBody, removePhysics2DCollider, setPhysics2DBodyTransform, setPhysics2DBodyType, } from './world';
14
- export { createPhysics2DQueryResult, createPhysics2DRayResult, queryPhysics2DPoint, queryPhysics2DRay, queryPhysics2DRegion, } from './worldQueries';
14
+ export { addPhysics2DBody, addPhysics2DCollider, applyPhysics2DForce, applyPhysics2DForceAtPoint, applyPhysics2DLinearImpulse, applyPhysics2DLinearImpulseAtPoint, applyPhysics2DTorque, findPhysics2DBody, createPhysics2DCollider, createPhysics2DSolverConfig, createPhysics2DWorld, createRigidBody2D, hydratePhysics2DWorld, invalidatePhysics2DCollider, isPhysics2DPairOrdered, removePhysics2DBody, removePhysics2DCollider, setPhysics2DBodyTransform, setPhysics2DBodyFixedRotation, setPhysics2DBodyBullet, setPhysics2DBodySleepEnabled, setPhysics2DBodyType, Physics2DWorldVersion, } from './world';
15
+ export { createPhysics2DQueryFilter, createPhysics2DQueryResult, createPhysics2DRayResult, queryPhysics2DPoint, queryPhysics2DRay, queryPhysics2DRayClosest, queryPhysics2DRegion, } from './worldQueries';
15
16
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iCAAiC,EACjC,iCAAiC,EACjC,4BAA4B,GAC7B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,4BAA4B,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,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AO,EAAE,gCAAgC,EAAE,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AAC/F,OAAO,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAC3E,OAAO,EAAE,oCAAoC,EAAE,MAAM,wCAAwC,CAAC;AAC9F,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,sBAAsB,EACtB,0BAA0B,EAC1B,0BAA0B,GAC3B,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,mBAAmB,EACnB,0BAA0B,EAC1B,2BAA2B,EAC3B,kCAAkC,EAClC,oBAAoB,EACpB,iBAAiB,EACjB,uBAAuB,EACvB,2BAA2B,EAC3B,oBAAoB,EACpB,iBAAiB,EACjB,qBAAqB,EACrB,2BAA2B,EAC3B,sBAAsB,EACtB,mBAAmB,EACnB,uBAAuB,EACvB,yBAAyB,EACzB,6BAA6B,EAC7B,sBAAsB,EACtB,4BAA4B,EAC5B,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,0BAA0B,EAC1B,0BAA0B,EAC1B,wBAAwB,EACxB,mBAAmB,EACnB,iBAAiB,EACjB,wBAAwB,EACxB,oBAAoB,GACrB,MAAM,gBAAgB,CAAC"}
package/dist/index.js CHANGED
@@ -5,11 +5,12 @@ export { explainPhysics2DStep } from './explainPhysics2DStep';
5
5
  export { isRigidBody2DPairAwake, updatePhysics2DSleep, wakePhysics2DBody } from './islands';
6
6
  export { createPhysics2DDistanceJoint, createPhysics2DGearJoint, createPhysics2DMouseJoint, createPhysics2DPrismaticJoint, createPhysics2DPulleyJoint, createPhysics2DRevoluteJoint, createPhysics2DRopeJoint, createPhysics2DWeldJoint, createPhysics2DWheelJoint, } from './jointFactories';
7
7
  export { Physics2DDistanceJointKind, Physics2DGearJointKind, Physics2DMouseJointKind, Physics2DPrismaticJointKind, Physics2DPulleyJointKind, Physics2DRevoluteJointKind, Physics2DRopeJointKind, Physics2DWheelJointKind, Physics2DWeldJointKind, physics2DDistanceJointSolver, physics2DGearJointSolver, physics2DMouseJointSolver, physics2DPrismaticJointSolver, physics2DPulleyJointSolver, physics2DRevoluteJointSolver, physics2DRopeJointSolver, physics2DWheelJointSolver, physics2DWeldJointSolver, } from './joints';
8
- export { addPhysics2DJoint, getPhysics2DJointSolver, registerPhysics2DJointSolver, removePhysics2DJoint, } from './jointRegistry';
8
+ export { addPhysics2DJoint, getPhysics2DJointSolver, invalidatePhysics2DJoint, registerPhysics2DJointSolver, removePhysics2DJoint, } from './jointRegistry';
9
9
  export { computePhysics2DColliderMassData, updateRigidBody2DMassData } from './massProperties';
10
+ export { mixPhysics2DFriction, mixPhysics2DRestitution } from './material';
10
11
  export { registerBuiltInPhysics2DJointSolvers } from './registerBuiltInPhysics2DJointSolvers';
11
12
  export { applyPhysics2DImpulse, relativeNormalVelocity, solvePhysics2DContacts, solvePhysics2DContactsOnce, warmStartPhysics2DContacts, } from './solver';
12
13
  export { stepPhysics2D } from './step';
13
- export { addPhysics2DBody, addPhysics2DCollider, applyPhysics2DForce, applyPhysics2DForceAtPoint, applyPhysics2DLinearImpulse, applyPhysics2DLinearImpulseAtPoint, applyPhysics2DTorque, findPhysics2DBody, createPhysics2DCollider, createPhysics2DSolverConfig, createPhysics2DWorld, createRigidBody2D, invalidatePhysics2DCollider, isPhysics2DPairOrdered, removePhysics2DBody, removePhysics2DCollider, setPhysics2DBodyTransform, setPhysics2DBodyType, } from './world';
14
- export { createPhysics2DQueryResult, createPhysics2DRayResult, queryPhysics2DPoint, queryPhysics2DRay, queryPhysics2DRegion, } from './worldQueries';
14
+ export { addPhysics2DBody, addPhysics2DCollider, applyPhysics2DForce, applyPhysics2DForceAtPoint, applyPhysics2DLinearImpulse, applyPhysics2DLinearImpulseAtPoint, applyPhysics2DTorque, findPhysics2DBody, createPhysics2DCollider, createPhysics2DSolverConfig, createPhysics2DWorld, createRigidBody2D, hydratePhysics2DWorld, invalidatePhysics2DCollider, isPhysics2DPairOrdered, removePhysics2DBody, removePhysics2DCollider, setPhysics2DBodyTransform, setPhysics2DBodyFixedRotation, setPhysics2DBodyBullet, setPhysics2DBodySleepEnabled, setPhysics2DBodyType, Physics2DWorldVersion, } from './world';
15
+ export { createPhysics2DQueryFilter, createPhysics2DQueryResult, createPhysics2DRayResult, queryPhysics2DPoint, queryPhysics2DRay, queryPhysics2DRayClosest, queryPhysics2DRegion, } from './worldQueries';
15
16
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iCAAiC,EACjC,iCAAiC,EACjC,4BAA4B,GAC7B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,4BAA4B,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AAC5F,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC5F,OAAO,EACL,4BAA4B,EAC5B,wBAAwB,EACxB,yBAAyB,EACzB,6BAA6B,EAC7B,0BAA0B,EAC1B,4BAA4B,EAC5B,wBAAwB,EACxB,wBAAwB,EACxB,yBAAyB,GAC1B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,0BAA0B,EAC1B,sBAAsB,EACtB,uBAAuB,EACvB,2BAA2B,EAC3B,wBAAwB,EACxB,0BAA0B,EAC1B,sBAAsB,EACtB,uBAAuB,EACvB,sBAAsB,EACtB,4BAA4B,EAC5B,wBAAwB,EACxB,yBAAyB,EACzB,6BAA6B,EAC7B,0BAA0B,EAC1B,4BAA4B,EAC5B,wBAAwB,EACxB,yBAAy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,sBAAsB,EACtB,4BAA4B,EAC5B,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,0BAA0B,EAC1B,0BAA0B,EAC1B,wBAAwB,EACxB,mBAAmB,EACnB,iBAAiB,EACjB,wBAAwB,EACxB,oBAAoB,GACrB,MAAM,gBAAgB,CAAC"}
package/dist/islands.d.ts CHANGED
@@ -1,4 +1,12 @@
1
1
  import type { Physics2DWorld, RigidBody2D } from '@flighthq/types/contract';
2
+ /** Rebuilds deterministic contiguous lists for the awake solve islands.
3
+ *
4
+ * The sleep reduction already owns the union-find graph, so solving consumes that same graph rather
5
+ * than discovering connectivity a second way. Roots are admitted in body order, and bodies,
6
+ * contacts, and joints retain their canonical world-list order inside each root. Disconnected islands
7
+ * therefore cannot perturb one another's iteration order, and sleeping constraints cost no solver
8
+ * scans. Every array and map is world-owned high-water workspace and is cleared/refilled in place. */
9
+ export declare function buildPhysics2DSolveIslands(world: Physics2DWorld): void;
2
10
  /** Whether a constraint between these two bodies still has anything to solve.
3
11
  *
4
12
  * A constraint is live only while at least one of its ends can still move this step. Two sleeping
@@ -1 +1 @@
1
- {"version":3,"file":"islands.d.ts","sourceRoot":"","sources":["../src/islands.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAI5E;;;;;;;;;;uCAUuC;AACvC,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC,EAAE,QAAQ,CAAC,WAAW,CAAC,GAAG,OAAO,CAElG;AAED;;;;;;;;;;;;;;;uFAeuF;AACvF,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,cAAc,EAAE,EAAE,EAAE,MAAM,GAAG,IAAI,CA4E5E;AAED;;;;;sGAKsG;AACtG,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,CAGzD"}
1
+ {"version":3,"file":"islands.d.ts","sourceRoot":"","sources":["../src/islands.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAK5E;;;;;;uGAMuG;AACvG,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI,CA6EtE;AAED;;;;;;;;;;uCAUuC;AACvC,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC,EAAE,QAAQ,CAAC,WAAW,CAAC,GAAG,OAAO,CAElG;AAED;;;;;;;;;;;;;;;uFAeuF;AACvF,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,cAAc,EAAE,EAAE,EAAE,MAAM,GAAG,IAAI,CAoF5E;AAED;;;;;sGAKsG;AACtG,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,CAIzD"}
package/dist/islands.js CHANGED
@@ -1,4 +1,92 @@
1
+ import { assertPhysics2DBodyNotStepping } from './ownership';
1
2
  import { findPhysics2DBody } from './world';
3
+ /** Rebuilds deterministic contiguous lists for the awake solve islands.
4
+ *
5
+ * The sleep reduction already owns the union-find graph, so solving consumes that same graph rather
6
+ * than discovering connectivity a second way. Roots are admitted in body order, and bodies,
7
+ * contacts, and joints retain their canonical world-list order inside each root. Disconnected islands
8
+ * therefore cannot perturb one another's iteration order, and sleeping constraints cost no solver
9
+ * scans. Every array and map is world-owned high-water workspace and is cleared/refilled in place. */
10
+ export function buildPhysics2DSolveIslands(world) {
11
+ const roots = world.solveIslandRoots;
12
+ const byRoot = world.solveIslandByRoot;
13
+ const bodyCounts = world.solveIslandBodyCounts;
14
+ const contactCounts = world.solveIslandContactCounts;
15
+ const jointCounts = world.solveIslandJointCounts;
16
+ roots.length = 0;
17
+ byRoot.clear();
18
+ bodyCounts.length = 0;
19
+ contactCounts.length = 0;
20
+ jointCounts.length = 0;
21
+ for (const body of world.bodies) {
22
+ if (body.type === 'static' || body.sleeping)
23
+ continue;
24
+ const root = _islandRootOf(world.islandParents, body.index);
25
+ let island = byRoot.get(root);
26
+ if (island === undefined) {
27
+ island = roots.length;
28
+ roots.push(root);
29
+ byRoot.set(root, island);
30
+ bodyCounts.push(0);
31
+ contactCounts.push(0);
32
+ jointCounts.push(0);
33
+ }
34
+ bodyCounts[island]++;
35
+ }
36
+ for (const contact of world.contacts) {
37
+ if (!contact.enabled || contact.sensor)
38
+ continue;
39
+ const island = _physics2DSolveIslandForPair(world, contact.bodyA, contact.bodyB);
40
+ if (island >= 0)
41
+ contactCounts[island]++;
42
+ }
43
+ for (const joint of world.joints) {
44
+ const solver = world.jointSolvers.get(joint.kind);
45
+ if (solver === undefined)
46
+ continue;
47
+ const island = solver.usesBodyA === false
48
+ ? _physics2DSolveIslandForBody(world, joint.bodyB)
49
+ : _physics2DSolveIslandForPair(world, joint.bodyA, joint.bodyB);
50
+ if (island >= 0)
51
+ jointCounts[island]++;
52
+ }
53
+ _preparePhysics2DIslandSlices(world.solveIslandBodyStarts, bodyCounts, world.solveIslandCursors);
54
+ _preparePhysics2DIslandSlices(world.solveIslandContactStarts, contactCounts, world.solveIslandCursors);
55
+ _preparePhysics2DIslandSlices(world.solveIslandJointStarts, jointCounts, world.solveIslandCursors);
56
+ world.solveIslandBodyIndices.length = _physics2DIslandItemCount(world.solveIslandBodyStarts, bodyCounts);
57
+ world.solveIslandContactIndices.length = _physics2DIslandItemCount(world.solveIslandContactStarts, contactCounts);
58
+ world.solveIslandJointIndices.length = _physics2DIslandItemCount(world.solveIslandJointStarts, jointCounts);
59
+ _copyPhysics2DIslandStarts(world.solveIslandCursors, world.solveIslandBodyStarts);
60
+ for (let i = 0; i < world.bodies.length; i++) {
61
+ const body = world.bodies[i];
62
+ if (body.type === 'static' || body.sleeping)
63
+ continue;
64
+ const island = byRoot.get(_islandRootOf(world.islandParents, body.index));
65
+ if (island !== undefined)
66
+ world.solveIslandBodyIndices[world.solveIslandCursors[island]++] = i;
67
+ }
68
+ _copyPhysics2DIslandStarts(world.solveIslandCursors, world.solveIslandContactStarts);
69
+ for (let i = 0; i < world.contacts.length; i++) {
70
+ const contact = world.contacts[i];
71
+ if (!contact.enabled || contact.sensor)
72
+ continue;
73
+ const island = _physics2DSolveIslandForPair(world, contact.bodyA, contact.bodyB);
74
+ if (island >= 0)
75
+ world.solveIslandContactIndices[world.solveIslandCursors[island]++] = i;
76
+ }
77
+ _copyPhysics2DIslandStarts(world.solveIslandCursors, world.solveIslandJointStarts);
78
+ for (let i = 0; i < world.joints.length; i++) {
79
+ const joint = world.joints[i];
80
+ const solver = world.jointSolvers.get(joint.kind);
81
+ if (solver === undefined)
82
+ continue;
83
+ const island = solver.usesBodyA === false
84
+ ? _physics2DSolveIslandForBody(world, joint.bodyB)
85
+ : _physics2DSolveIslandForPair(world, joint.bodyA, joint.bodyB);
86
+ if (island >= 0)
87
+ world.solveIslandJointIndices[world.solveIslandCursors[island]++] = i;
88
+ }
89
+ }
2
90
  /** Whether a constraint between these two bodies still has anything to solve.
3
91
  *
4
92
  * A constraint is live only while at least one of its ends can still move this step. Two sleeping
@@ -32,6 +120,24 @@ export function isRigidBody2DPairAwake(a, b) {
32
120
  export function updatePhysics2DSleep(world, dt) {
33
121
  const config = world.config;
34
122
  const bodies = world.bodies;
123
+ const parents = world.islandParents;
124
+ const islandTimers = world.islandSleepTimers;
125
+ parents.clear();
126
+ islandTimers.clear();
127
+ // Build the active constraint graph even when sleeping is disabled. The same union-find owns the
128
+ // solve islands below; clearing it and returning here would split every awake body into a singleton
129
+ // and assign a multi-body constraint to only the first of those artificial components.
130
+ for (const contact of world.contacts) {
131
+ if (!contact.enabled || contact.sensor)
132
+ continue;
133
+ _unionDynamicPair(world, parents, contact.bodyA, contact.bodyB);
134
+ }
135
+ for (const joint of world.joints) {
136
+ const solver = world.jointSolvers.get(joint.kind);
137
+ if (solver === undefined || solver.usesBodyA === false)
138
+ continue;
139
+ _unionDynamicPair(world, parents, joint.bodyA, joint.bodyB);
140
+ }
35
141
  if (!config.allowSleeping) {
36
142
  // The mechanism is off, so nothing may be left asleep from when it was on — a body that stayed
37
143
  // asleep here would never be integrated again and would look frozen for the rest of the session.
@@ -45,6 +151,11 @@ export function updatePhysics2DSleep(world, dt) {
45
151
  for (const body of bodies) {
46
152
  if (body.type === 'static')
47
153
  continue;
154
+ if (!body.sleepEnabled) {
155
+ body.sleeping = false;
156
+ body.sleepTimer = 0;
157
+ continue;
158
+ }
48
159
  if (_isBodyStill(body, config.sleepLinearThreshold, config.sleepAngularThreshold)) {
49
160
  body.sleepTimer += dt;
50
161
  }
@@ -63,22 +174,7 @@ export function updatePhysics2DSleep(world, dt) {
63
174
  _keepPhysics2DBodyAwake(world, joint.bodyA);
64
175
  _keepPhysics2DBodyAwake(world, joint.bodyB);
65
176
  }
66
- // Then the island reduction. `_islandRootOf` is union-find over the contact and joint graph, so the
67
- // root is a stable representative for the connected component.
68
- const parents = new Map();
69
- for (const contact of world.contacts) {
70
- if (!contact.enabled || contact.sensor)
71
- continue;
72
- _unionDynamicPair(world, parents, contact.bodyA, contact.bodyB);
73
- }
74
- for (const joint of world.joints) {
75
- const solver = world.jointSolvers.get(joint.kind);
76
- if (solver === undefined || solver.usesBodyA === false)
77
- continue;
78
- _unionDynamicPair(world, parents, joint.bodyA, joint.bodyB);
79
- }
80
177
  // The island's timer is the MINIMUM across its members: the least-settled body decides.
81
- const islandTimers = new Map();
82
178
  for (const body of bodies) {
83
179
  if (body.type === 'static')
84
180
  continue;
@@ -90,7 +186,7 @@ export function updatePhysics2DSleep(world, dt) {
90
186
  if (body.type === 'static')
91
187
  continue;
92
188
  const islandTimer = islandTimers.get(_islandRootOf(parents, body.index)) ?? body.sleepTimer;
93
- const shouldSleep = islandTimer >= config.timeToSleep;
189
+ const shouldSleep = body.sleepEnabled && islandTimer >= config.timeToSleep;
94
190
  if (!shouldSleep && body.sleeping) {
95
191
  // Waking clears the timer so a woken island must earn its rest again from zero rather than
96
192
  // falling straight back asleep on the next step.
@@ -115,6 +211,7 @@ export function updatePhysics2DSleep(world, dt) {
115
211
  * change to a sleeping body must do — applying a force, teleporting it, or removing what it rested on —
116
212
  * since a sleeping body is skipped by integration and would otherwise ignore the change entirely. */
117
213
  export function wakePhysics2DBody(body) {
214
+ assertPhysics2DBodyNotStepping(body);
118
215
  body.sleeping = false;
119
216
  body.sleepTimer = 0;
120
217
  }
@@ -140,6 +237,36 @@ function _keepPhysics2DBodyAwake(world, bodyIndex) {
140
237
  if (body !== null && body.type !== 'static')
141
238
  body.sleepTimer = 0;
142
239
  }
240
+ function _physics2DSolveIslandForBody(world, bodyIndex) {
241
+ const body = findPhysics2DBody(world, bodyIndex);
242
+ if (body === null || body.type === 'static' || body.sleeping)
243
+ return -1;
244
+ return world.solveIslandByRoot.get(_islandRootOf(world.islandParents, body.index)) ?? -1;
245
+ }
246
+ function _physics2DSolveIslandForPair(world, bodyA, bodyB) {
247
+ const islandA = _physics2DSolveIslandForBody(world, bodyA);
248
+ if (islandA >= 0)
249
+ return islandA;
250
+ return _physics2DSolveIslandForBody(world, bodyB);
251
+ }
252
+ function _preparePhysics2DIslandSlices(starts, counts, cursors) {
253
+ starts.length = counts.length;
254
+ cursors.length = counts.length;
255
+ let start = 0;
256
+ for (let i = 0; i < counts.length; i++) {
257
+ starts[i] = start;
258
+ start += counts[i];
259
+ }
260
+ }
261
+ function _copyPhysics2DIslandStarts(cursors, starts) {
262
+ cursors.length = starts.length;
263
+ for (let i = 0; i < starts.length; i++)
264
+ cursors[i] = starts[i];
265
+ }
266
+ function _physics2DIslandItemCount(starts, counts) {
267
+ const last = counts.length - 1;
268
+ return last < 0 ? 0 : starts[last] + counts[last];
269
+ }
143
270
  // Joins two bodies into one island, but only when BOTH are dynamic. A static body is not a member of
144
271
  // any island, so it cannot act as a bridge — otherwise the ground would merge every stack in the level
145
272
  // into a single island that sleeps only when nothing anywhere is moving.
@@ -1 +1 @@
1
- {"version":3,"file":"islands.js","sourceRoot":"","sources":["../src/islands.ts"],"names":[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IAAI,KAAK,KAAK,KAAK;QAAE,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AACjD,CAAC;AAED,uGAAuG;AACvG,4DAA4D;AAC5D,SAAS,aAAa,CAAC,OAA4B,EAAE,KAAa;IAChE,IAAI,IAAI,GAAG,KAAK,CAAC;IACjB,SAAS,CAAC;QACR,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACjC,IAAI,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,IAAI;YAAE,MAAM;QACnD,IAAI,GAAG,MAAM,CAAC;IAChB,CAAC;IACD,IAAI,IAAI,GAAG,KAAK,CAAC;IACjB,SAAS,CAAC;QACR,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACjC,IAAI,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,IAAI;YAAE,MAAM;QACnD,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACxB,IAAI,GAAG,MAAM,CAAC;IAChB,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { Physics2DWorld } from '@flighthq/types/contract';
2
+ export declare function isPhysics2DPairJointSuppressed(world: Readonly<Physics2DWorld>, bodyA: number, bodyB: number): boolean;
3
+ export declare function rebuildPhysics2DJointCollisionSuppressions(world: Physics2DWorld): void;
4
+ //# sourceMappingURL=jointCollisionSuppression.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jointCollisionSuppression.d.ts","sourceRoot":"","sources":["../src/jointCollisionSuppression.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAG/D,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,QAAQ,CAAC,cAAc,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAIrH;AAMD,wBAAgB,0CAA0C,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI,CAgBtF"}
@@ -0,0 +1,30 @@
1
+ // Constant-time broadphase lookup for whether any active joint suppresses this body pair.
2
+ export function isPhysics2DPairJointSuppressed(world, bodyA, bodyB) {
3
+ const first = Math.min(bodyA, bodyB);
4
+ const second = Math.max(bodyA, bodyB);
5
+ return (world.jointCollisionSuppressions.get(first)?.get(second) ?? 0) > 0;
6
+ }
7
+ // Rebuilds the authored-joint suppression index at lifecycle/invalidation boundaries. This work is
8
+ // intentionally O(joints) there so broadphase pair filtering is O(1) per candidate during every step.
9
+ // Rebuilding also makes explicit invalidation sufficient after callers edit endpoints or
10
+ // collideConnected directly: the index never needs hidden per-joint shadow state.
11
+ export function rebuildPhysics2DJointCollisionSuppressions(world) {
12
+ const suppressions = world.jointCollisionSuppressions;
13
+ suppressions.clear();
14
+ for (const joint of world.joints) {
15
+ if (joint.collideConnected)
16
+ continue;
17
+ const solver = world.jointSolvers.get(joint.kind);
18
+ if (solver === undefined || solver.usesBodyA === false)
19
+ continue;
20
+ const first = Math.min(joint.bodyA, joint.bodyB);
21
+ const second = Math.max(joint.bodyA, joint.bodyB);
22
+ let seconds = suppressions.get(first);
23
+ if (seconds === undefined) {
24
+ seconds = new Map();
25
+ suppressions.set(first, seconds);
26
+ }
27
+ seconds.set(second, (seconds.get(second) ?? 0) + 1);
28
+ }
29
+ }
30
+ //# sourceMappingURL=jointCollisionSuppression.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jointCollisionSuppression.js","sourceRoot":"","sources":["../src/jointCollisionSuppression.ts"],"names":[],"mappings":"AAEA,0FAA0F;AAC1F,MAAM,UAAU,8BAA8B,CAAC,KAA+B,EAAE,KAAa,EAAE,KAAa;IAC1G,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACrC,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,EA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type { Physics2DJoint, Physics2DJointKind, Physics2DJointSolver, Physics2DWorld } from '@flighthq/types/contract';
2
2
  export declare function addPhysics2DJoint(world: Physics2DWorld, joint: Physics2DJoint): Physics2DJoint;
3
3
  export declare function getPhysics2DJointSolver(world: Readonly<Physics2DWorld>, kind: Physics2DJointKind): Physics2DJointSolver | null;
4
+ export declare function invalidatePhysics2DJoint(world: Physics2DWorld, joint: Physics2DJoint): boolean;
4
5
  export declare function registerPhysics2DJointSolver(world: Physics2DWorld, kind: Physics2DJointKind, solver: Physics2DJointSolver): void;
5
6
  export declare function removePhysics2DJoint(world: Physics2DWorld, joint: Readonly<Physics2DJoint>): boolean;
6
7
  //# sourceMappingURL=jointRegistry.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"jointRegistry.d.ts","sourceRoot":"","sources":["../src/jointRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,kBAAkB,EAClB,oBAAoB,EACpB,cAAc,EACf,MAAM,0BAA0B,CAAC;AAclC,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,cAAc,GAAG,cAAc,CAiB9F;AA0BD,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,QAAQ,CAAC,cAAc,CAAC,EAC/B,IAAI,EAAE,kBAAkB,GACvB,oBAAoB,GAAG,IAAI,CAE7B;AASD,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,cAAc,EACrB,IAAI,EAAE,kBAAkB,EACxB,MAAM,EAAE,oBAAoB,GAC3B,IAAI,CAaN;AAGD,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,QAAQ,CAAC,cAAc,CAAC,GAAG,OAAO,CAMpG"}
1
+ {"version":3,"file":"jointRegistry.d.ts","sourceRoot":"","sources":["../src/jointRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,kBAAkB,EAClB,oBAAoB,EACpB,cAAc,EACf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