@flighthq/physics3d 0.4.0-edge.1908.751021c

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 (180) hide show
  1. package/dist/broadphase.d.ts +4 -0
  2. package/dist/broadphase.d.ts.map +1 -0
  3. package/dist/broadphase.js +158 -0
  4. package/dist/broadphase.js.map +1 -0
  5. package/dist/colliderCollision.d.ts +5 -0
  6. package/dist/colliderCollision.d.ts.map +1 -0
  7. package/dist/colliderCollision.js +55 -0
  8. package/dist/colliderCollision.js.map +1 -0
  9. package/dist/colliderTransform.d.ts +5 -0
  10. package/dist/colliderTransform.d.ts.map +1 -0
  11. package/dist/colliderTransform.js +424 -0
  12. package/dist/colliderTransform.js.map +1 -0
  13. package/dist/contactIntake.d.ts +5 -0
  14. package/dist/contactIntake.d.ts.map +1 -0
  15. package/dist/contactIntake.js +237 -0
  16. package/dist/contactIntake.js.map +1 -0
  17. package/dist/contacts.d.ts +4 -0
  18. package/dist/contacts.d.ts.map +1 -0
  19. package/dist/contacts.js +64 -0
  20. package/dist/contacts.js.map +1 -0
  21. package/dist/continuous.d.ts +5 -0
  22. package/dist/continuous.d.ts.map +1 -0
  23. package/dist/continuous.js +829 -0
  24. package/dist/continuous.js.map +1 -0
  25. package/dist/contract.d.ts +28 -0
  26. package/dist/contract.d.ts.map +1 -0
  27. package/dist/contract.js +28 -0
  28. package/dist/contract.js.map +1 -0
  29. package/dist/debugGeometry.d.ts +4 -0
  30. package/dist/debugGeometry.d.ts.map +1 -0
  31. package/dist/debugGeometry.js +333 -0
  32. package/dist/debugGeometry.js.map +1 -0
  33. package/dist/enablePhysics3DGuards.d.ts +4 -0
  34. package/dist/enablePhysics3DGuards.d.ts.map +1 -0
  35. package/dist/enablePhysics3DGuards.js +155 -0
  36. package/dist/enablePhysics3DGuards.js.map +1 -0
  37. package/dist/explainPhysics3DCollision.d.ts +3 -0
  38. package/dist/explainPhysics3DCollision.d.ts.map +1 -0
  39. package/dist/explainPhysics3DCollision.js +30 -0
  40. package/dist/explainPhysics3DCollision.js.map +1 -0
  41. package/dist/explainPhysics3DJoints.d.ts +3 -0
  42. package/dist/explainPhysics3DJoints.d.ts.map +1 -0
  43. package/dist/explainPhysics3DJoints.js +32 -0
  44. package/dist/explainPhysics3DJoints.js.map +1 -0
  45. package/dist/explainPhysics3DStep.d.ts +3 -0
  46. package/dist/explainPhysics3DStep.d.ts.map +1 -0
  47. package/dist/explainPhysics3DStep.js +51 -0
  48. package/dist/explainPhysics3DStep.js.map +1 -0
  49. package/dist/index.d.ts +22 -0
  50. package/dist/index.d.ts.map +1 -0
  51. package/dist/index.js +22 -0
  52. package/dist/index.js.map +1 -0
  53. package/dist/integrate.d.ts +6 -0
  54. package/dist/integrate.d.ts.map +1 -0
  55. package/dist/integrate.js +184 -0
  56. package/dist/integrate.js.map +1 -0
  57. package/dist/islands.d.ts +6 -0
  58. package/dist/islands.d.ts.map +1 -0
  59. package/dist/islands.js +333 -0
  60. package/dist/islands.js.map +1 -0
  61. package/dist/jointBreakage.d.ts +5 -0
  62. package/dist/jointBreakage.d.ts.map +1 -0
  63. package/dist/jointBreakage.js +44 -0
  64. package/dist/jointBreakage.js.map +1 -0
  65. package/dist/jointCollisionSuppression.d.ts +4 -0
  66. package/dist/jointCollisionSuppression.d.ts.map +1 -0
  67. package/dist/jointCollisionSuppression.js +40 -0
  68. package/dist/jointCollisionSuppression.js.map +1 -0
  69. package/dist/jointFactories.d.ts +9 -0
  70. package/dist/jointFactories.d.ts.map +1 -0
  71. package/dist/jointFactories.js +159 -0
  72. package/dist/jointFactories.js.map +1 -0
  73. package/dist/jointMath.d.ts +17 -0
  74. package/dist/jointMath.d.ts.map +1 -0
  75. package/dist/jointMath.js +361 -0
  76. package/dist/jointMath.js.map +1 -0
  77. package/dist/jointReaction.d.ts +8 -0
  78. package/dist/jointReaction.d.ts.map +1 -0
  79. package/dist/jointReaction.js +65 -0
  80. package/dist/jointReaction.js.map +1 -0
  81. package/dist/jointRegistry.d.ts +8 -0
  82. package/dist/jointRegistry.d.ts.map +1 -0
  83. package/dist/jointRegistry.js +144 -0
  84. package/dist/jointRegistry.js.map +1 -0
  85. package/dist/jointRows.d.ts +33 -0
  86. package/dist/jointRows.d.ts.map +1 -0
  87. package/dist/jointRows.js +352 -0
  88. package/dist/jointRows.js.map +1 -0
  89. package/dist/joints.d.ts +16 -0
  90. package/dist/joints.d.ts.map +1 -0
  91. package/dist/joints.js +1060 -0
  92. package/dist/joints.js.map +1 -0
  93. package/dist/massProperties.d.ts +13 -0
  94. package/dist/massProperties.d.ts.map +1 -0
  95. package/dist/massProperties.js +462 -0
  96. package/dist/massProperties.js.map +1 -0
  97. package/dist/material.d.ts +3 -0
  98. package/dist/material.d.ts.map +1 -0
  99. package/dist/material.js +13 -0
  100. package/dist/material.js.map +1 -0
  101. package/dist/nodeSync.d.ts +3 -0
  102. package/dist/nodeSync.d.ts.map +1 -0
  103. package/dist/nodeSync.js +16 -0
  104. package/dist/nodeSync.js.map +1 -0
  105. package/dist/ownership.d.ts +8 -0
  106. package/dist/ownership.d.ts.map +1 -0
  107. package/dist/ownership.js +26 -0
  108. package/dist/ownership.js.map +1 -0
  109. package/dist/physics3DBroadphasePublication.d.ts +5 -0
  110. package/dist/physics3DBroadphasePublication.d.ts.map +1 -0
  111. package/dist/physics3DBroadphasePublication.js +49 -0
  112. package/dist/physics3DBroadphasePublication.js.map +1 -0
  113. package/dist/physics3DSpatialIndexingGuards.d.ts +4 -0
  114. package/dist/physics3DSpatialIndexingGuards.d.ts.map +1 -0
  115. package/dist/physics3DSpatialIndexingGuards.js +11 -0
  116. package/dist/physics3DSpatialIndexingGuards.js.map +1 -0
  117. package/dist/registerBuiltInPhysics3DJointSolvers.d.ts +3 -0
  118. package/dist/registerBuiltInPhysics3DJointSolvers.d.ts.map +1 -0
  119. package/dist/registerBuiltInPhysics3DJointSolvers.js +15 -0
  120. package/dist/registerBuiltInPhysics3DJointSolvers.js.map +1 -0
  121. package/dist/solver.d.ts +8 -0
  122. package/dist/solver.d.ts.map +1 -0
  123. package/dist/solver.js +460 -0
  124. package/dist/solver.js.map +1 -0
  125. package/dist/step.d.ts +5 -0
  126. package/dist/step.d.ts.map +1 -0
  127. package/dist/step.js +302 -0
  128. package/dist/step.js.map +1 -0
  129. package/dist/stepValidation.d.ts +13 -0
  130. package/dist/stepValidation.d.ts.map +1 -0
  131. package/dist/stepValidation.js +284 -0
  132. package/dist/stepValidation.js.map +1 -0
  133. package/dist/symmetricTensor.d.ts +11 -0
  134. package/dist/symmetricTensor.d.ts.map +1 -0
  135. package/dist/symmetricTensor.js +150 -0
  136. package/dist/symmetricTensor.js.map +1 -0
  137. package/dist/world.d.ts +27 -0
  138. package/dist/world.d.ts.map +1 -0
  139. package/dist/world.js +762 -0
  140. package/dist/world.js.map +1 -0
  141. package/dist/worldQueries.d.ts +11 -0
  142. package/dist/worldQueries.d.ts.map +1 -0
  143. package/dist/worldQueries.js +409 -0
  144. package/dist/worldQueries.js.map +1 -0
  145. package/package.json +55 -0
  146. package/src/broadphase.test.ts +265 -0
  147. package/src/colliderCollision.test.ts +57 -0
  148. package/src/colliderTransform.test.ts +221 -0
  149. package/src/contactIntake.test.ts +370 -0
  150. package/src/contacts.test.ts +64 -0
  151. package/src/continuous.test.ts +679 -0
  152. package/src/debugGeometry.test.ts +288 -0
  153. package/src/enablePhysics3DGuards.test.ts +206 -0
  154. package/src/explainPhysics3DCollision.test.ts +78 -0
  155. package/src/explainPhysics3DJoints.test.ts +101 -0
  156. package/src/explainPhysics3DStep.test.ts +142 -0
  157. package/src/integrate.test.ts +279 -0
  158. package/src/islands.test.ts +384 -0
  159. package/src/jointBreakage.test.ts +143 -0
  160. package/src/jointCollisionSuppression.test.ts +94 -0
  161. package/src/jointFactories.test.ts +244 -0
  162. package/src/jointMath.test.ts +646 -0
  163. package/src/jointReaction.test.ts +241 -0
  164. package/src/jointRegistry.test.ts +229 -0
  165. package/src/jointRows.test.ts +548 -0
  166. package/src/joints.test.ts +1066 -0
  167. package/src/massProperties.test.ts +611 -0
  168. package/src/material.test.ts +40 -0
  169. package/src/nodeSync.test.ts +50 -0
  170. package/src/ownership.test.ts +61 -0
  171. package/src/physics3DBroadphasePublication.test.ts +63 -0
  172. package/src/physics3DSpatialIndexingGuards.test.ts +43 -0
  173. package/src/registerBuiltInPhysics3DJointSolvers.test.ts +51 -0
  174. package/src/solver.test.ts +567 -0
  175. package/src/step.test.ts +490 -0
  176. package/src/stepValidation.test.ts +346 -0
  177. package/src/stress.test.ts +526 -0
  178. package/src/symmetricTensor.test.ts +166 -0
  179. package/src/world.test.ts +1127 -0
  180. package/src/worldQueries.test.ts +565 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jointFactories.js","sourceRoot":"","sources":["../src/jointFactories.ts"],"names":[],"mappings":"AAqBA,OAAO,EACL,+BAA+B,EAC/B,2BAA2B,EAC3B,0BAA0B,EAC1B,uBAAuB,EACvB,6BAA6B,EAC7B,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,UAAU,CAAC;AAElB,0GAA0G;AAC1G,2GAA2G;AAC3G,wBAAwB;AACxB,EAAE;AACF,yGAAyG;AACzG,gFAAgF;AAChF,MAAM,UAAU,iCAAiC,CAC/C,OAAqD;IAErD,OAAO,EAAE,IAAI,EAAE,+BAA+B,EAAE,GAAG,eAAe,CAAC,OAAO,CAAC,EAAE,CAAC;AAChF,CAAC;AAED,8GAA8G;AAC9G,uGAAuG;AACvG,wCAAwC;AACxC,MAAM,UAAU,6BAA6B,CAC3C,OAAiD;IAEjD,OAAO;QACL,IAAI,EAAE,2BAA2B;QACjC,GAAG,eAAe,CAAC,OAAO,CAAC;QAC3B,GAAG,iBAAiB,CAAC,OAAO,CAAC;QAC7B,gBAAgB,EAAE,OAAO,CAAC,gBAAgB,IAAI,IAAI;QAClD,WAAW,EAAE,OAAO,CAAC,WAAW,IAAI,IAAI,CAAC,EAAE,GAAG,CAAC;QAC/C,WAAW,EAAE,OAAO,CAAC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AAe,IAAI,CAAC;QAC7C,eAAe,EAAE,OAAO,CAAC,eAAe,IAAI,CAAC;QAC7C,eAAe,EAAE,OAAO,CAAC,eAAe,IAAI,CAAC;QAC7C,eAAe,EAAE,OAAO,CAAC,eAAe,IAAI,CAAC;QAC7C,eAAe,EAAE,OAAO,CAAC,eAAe,IAAI,CAAC;QAC7C,eAAe,EAAE,OAAO,CAAC,eAAe,IAAI,CAAC;KAC9C,CAAC;AACJ,CAAC"}
@@ -0,0 +1,17 @@
1
+ import type { Physics3DJoint, Physics3DJointFrames, RigidBody3D } from '@flighthq/types/contract';
2
+ export declare function applyPhysics3DJointAngularImpulse(bodyA: RigidBody3D, bodyB: RigidBody3D, impulseX: number, impulseY: number, impulseZ: number): void;
3
+ export declare function applyPhysics3DJointImpulse(bodyA: RigidBody3D, bodyB: RigidBody3D, rAX: number, rAY: number, rAZ: number, rBX: number, rBY: number, rBZ: number, impulseX: number, impulseY: number, impulseZ: number): void;
4
+ export declare function applyPhysics3DJointRowImpulse(bodyA: RigidBody3D, bodyB: RigidBody3D, directionX: number, directionY: number, directionZ: number, armAX: number, armAY: number, armAZ: number, armBX: number, armBY: number, armBZ: number, impulse: number): void;
5
+ export declare function getPhysics3DJointRowMass(bodyA: Readonly<RigidBody3D>, bodyB: Readonly<RigidBody3D>, directionX: number, directionY: number, directionZ: number, armAX: number, armAY: number, armAZ: number, armBX: number, armBY: number, armBZ: number): number;
6
+ export declare function getPhysics3DJointRowVelocity(bodyA: Readonly<RigidBody3D>, bodyB: Readonly<RigidBody3D>, directionX: number, directionY: number, directionZ: number, armAX: number, armAY: number, armAZ: number, armBX: number, armBY: number, armBZ: number): number;
7
+ export declare function swapPhysics3DJointFrames(frames: Physics3DJointFrames): void;
8
+ export declare function writePhysics3DJointAnchors(bodyA: Readonly<RigidBody3D>, bodyB: Readonly<RigidBody3D>, joint: Physics3DJoint): void;
9
+ export declare function writePhysics3DJointAnchorVelocity(bodyA: Readonly<RigidBody3D>, bodyB: Readonly<RigidBody3D>, joint: Readonly<Physics3DJoint>, out: number[]): void;
10
+ export declare function writePhysics3DJointAngularMass(bodyA: Readonly<RigidBody3D>, bodyB: Readonly<RigidBody3D>, out: number[]): void;
11
+ export declare function writePhysics3DJointFrameBasis(body: Readonly<RigidBody3D>, localRotationX: number, localRotationY: number, localRotationZ: number, localRotationW: number, out: number[]): void;
12
+ export declare function writePhysics3DJointFrameRotation(body: Readonly<RigidBody3D>, localRotationX: number, localRotationY: number, localRotationZ: number, localRotationW: number, out: number[]): void;
13
+ export declare function writePhysics3DJointPointMass(bodyA: Readonly<RigidBody3D>, bodyB: Readonly<RigidBody3D>, rAX: number, rAY: number, rAZ: number, rBX: number, rBY: number, rBZ: number, out: number[]): void;
14
+ export declare function writePhysics3DJointRelativeRotation(frameAX: number, frameAY: number, frameAZ: number, frameAW: number, frameBX: number, frameBY: number, frameBZ: number, frameBW: number, out: number[]): void;
15
+ export declare function writePhysics3DJointRotationError(frameAX: number, frameAY: number, frameAZ: number, frameAW: number, frameBX: number, frameBY: number, frameBZ: number, frameBW: number, out: number[]): void;
16
+ export declare function writePhysics3DJointSeparation(bodyA: Readonly<RigidBody3D>, bodyB: Readonly<RigidBody3D>, joint: Readonly<Physics3DJoint>, out: number[]): void;
17
+ //# sourceMappingURL=jointMath.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jointMath.d.ts","sourceRoot":"","sources":["../src/jointMath.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AA+BlG,wBAAgB,iCAAiC,CAC/C,KAAK,EAAE,WAAW,EAClB,KAAK,EAAE,WAAW,EAClB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,GACf,IAAI,CAYN;AAQD,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,WAAW,EAClB,KAAK,EAAE,WAAW,EAClB,GAAG,E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,EACX,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EAAE,GACZ,IAAI,CAaN;AAaD,wBAAgB,mCAAmC,CACjD,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,GAAG,EAAE,MAAM,EAAE,GACZ,IAAI,CAQN;AAaD,wBAAgB,gCAAgC,CAC9C,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,GAAG,EAAE,MAAM,EAAE,GACZ,IAAI,CA0BN;AASD,wBAAgB,6BAA6B,CAC3C,KAAK,EAAE,QAAQ,CAAC,WAAW,CAAC,EAC5B,KAAK,EAAE,QAAQ,CAAC,WAAW,CAAC,EAC5B,KAAK,EAAE,QAAQ,CAAC,cAAc,CAAC,EAC/B,GAAG,EAAE,MAAM,EAAE,GACZ,IAAI,CAUN"}
@@ -0,0 +1,361 @@
1
+ import { applySymmetricTensor, TENSOR_XX, TENSOR_XY, TENSOR_XZ, TENSOR_YY, TENSOR_YZ, TENSOR_ZZ, } from './symmetricTensor';
2
+ // The constraint arithmetic every 3D joint kind is assembled from: lever arms, effective-mass blocks,
3
+ // frame extraction, and the two impulse appliers.
4
+ //
5
+ // Package-internal, like `symmetricTensor`. These take and return loose numbers rather than
6
+ // `@flighthq/geometry`'s `Quaternion` and `Vector3`, which are `Entity` types over a `Float32Array` — both
7
+ // an indirection in a per-iteration loop and a precision step down from what a solver's accumulators need.
8
+ // That is also why the quaternion helpers here are private rather than reaching for
9
+ // `multiplyQuaternion`/`rotateVector3ByQuaternion`: those operate on the entity form.
10
+ //
11
+ // ONE SIGN CONVENTION HOLDS THROUGHOUT: every impulse is applied POSITIVE TO B and NEGATIVE TO A, and every
12
+ // relative quantity is measured B RELATIVE TO A. So a positive impulse along a direction increases the
13
+ // relative velocity along it, and `impulse = -mass * (velocity + bias)` drives the constraint to rest. The
14
+ // contact solver uses the opposite sense, because a contact normal points out of B and resolving pushes A
15
+ // away; mixing the two is not a small error, because the correction then adds to the violation and
16
+ // compounds every iteration.
17
+ // Applies an equal and opposite PURE angular impulse: B gains it, A loses it. No linear velocity changes,
18
+ // which is what makes it usable for a hinge's axis rows without disturbing the point constraint holding the
19
+ // same joint together.
20
+ export function applyPhysics3DJointAngularImpulse(bodyA, bodyB, impulseX, impulseY, impulseZ) {
21
+ readWorldInverseInertia(bodyA, angularImpulseTensor);
22
+ applySymmetricTensor(angularImpulseTensor, impulseX, impulseY, impulseZ, angularImpulseVector);
23
+ bodyA.angularVelocityX -= angularImpulseVector[0];
24
+ bodyA.angularVelocityY -= angularImpulseVector[1];
25
+ bodyA.angularVelocityZ -= angularImpulseVector[2];
26
+ readWorldInverseInertia(bodyB, angularImpulseTensor);
27
+ applySymmetricTensor(angularImpulseTensor, impulseX, impulseY, impulseZ, angularImpulseVector);
28
+ bodyB.angularVelocityX += angularImpulseVector[0];
29
+ bodyB.angularVelocityY += angularImpulseVector[1];
30
+ bodyB.angularVelocityZ += angularImpulseVector[2];
31
+ }
32
+ // Applies an equal and opposite linear impulse at the two anchors: B gains it, A loses it. Each body also
33
+ // picks up the torque of the impulse about its own lever arm, which is the term that lets a joint spin a
34
+ // body it is only pulling on.
35
+ //
36
+ // A static or fixed-rotation body's zero inverse mass and zero inverse inertia make this a no-op with no
37
+ // branch, which is the whole reason infinite mass is a zero inverse rather than a flag.
38
+ export function applyPhysics3DJointImpulse(bodyA, bodyB, rAX, rAY, rAZ, rBX, rBY, rBZ, impulseX, impulseY, impulseZ) {
39
+ applyBodyJointImpulse(bodyA, rAX, rAY, rAZ, -impulseX, -impulseY, -impulseZ);
40
+ applyBodyJointImpulse(bodyB, rBX, rBY, rBZ, impulseX, impulseY, impulseZ);
41
+ }
42
+ // Applies one scalar constraint row's impulse — the counterpart of `getPhysics3DJointRowMass`, acting
43
+ // through the same linear direction and the same two angular arms, so a row's mass and its impulse can
44
+ // never describe different constraints.
45
+ //
46
+ // The arms are given rather than derived because they are NOT always `r x direction`. A slider's
47
+ // perpendicular row acts through `(rA + separation) x direction` on A, since its axis is carried by A and
48
+ // rotates with it; using A's bare lever arm there leaks motion sideways whenever the rail body turns.
49
+ export function applyPhysics3DJointRowImpulse(bodyA, bodyB, directionX, directionY, directionZ, armAX, armAY, armAZ, armBX, armBY, armBZ, impulse) {
50
+ bodyA.velocityX -= impulse * directionX * bodyA.inverseMass;
51
+ bodyA.velocityY -= impulse * directionY * bodyA.inverseMass;
52
+ bodyA.velocityZ -= impulse * directionZ * bodyA.inverseMass;
53
+ readWorldInverseInertia(bodyA, rowImpulseTensor);
54
+ applySymmetricTensor(rowImpulseTensor, armAX * impulse, armAY * impulse, armAZ * impulse, rowImpulseVector);
55
+ bodyA.angularVelocityX -= rowImpulseVector[0];
56
+ bodyA.angularVelocityY -= rowImpulseVector[1];
57
+ bodyA.angularVelocityZ -= rowImpulseVector[2];
58
+ bodyB.velocityX += impulse * directionX * bodyB.inverseMass;
59
+ bodyB.velocityY += impulse * directionY * bodyB.inverseMass;
60
+ bodyB.velocityZ += impulse * directionZ * bodyB.inverseMass;
61
+ readWorldInverseInertia(bodyB, rowImpulseTensor);
62
+ applySymmetricTensor(rowImpulseTensor, armBX * impulse, armBY * impulse, armBZ * impulse, rowImpulseVector);
63
+ bodyB.angularVelocityX += rowImpulseVector[0];
64
+ bodyB.angularVelocityY += rowImpulseVector[1];
65
+ bodyB.angularVelocityZ += rowImpulseVector[2];
66
+ }
67
+ // The scalar effective mass of one constraint row, given its linear direction and the two angular arms the
68
+ // row acts through. Returns 0 when the pair cannot move along the row at all, so the impulse computed from
69
+ // it is zero rather than infinite.
70
+ //
71
+ // The linear term is scaled by the direction's own squared length, so a PURELY ANGULAR row — a hinge's
72
+ // motor, a twist limit — passes a zero direction and the two bodies' translational masses drop out on their
73
+ // own. Without that scaling the caller would have to choose between two nearly identical functions, and the
74
+ // one place that picked wrong would report a hinge motor as heavier than it is by the pair's whole mass.
75
+ export function getPhysics3DJointRowMass(bodyA, bodyB, directionX, directionY, directionZ, armAX, armAY, armAZ, armBX, armBY, armBZ) {
76
+ const linear = directionX * directionX + directionY * directionY + directionZ * directionZ;
77
+ let denominator = (bodyA.inverseMass + bodyB.inverseMass) * linear;
78
+ readWorldInverseInertia(bodyA, rowMassTensor);
79
+ applySymmetricTensor(rowMassTensor, armAX, armAY, armAZ, rowMassVector);
80
+ denominator += armAX * rowMassVector[0] + armAY * rowMassVector[1] + armAZ * rowMassVector[2];
81
+ readWorldInverseInertia(bodyB, rowMassTensor);
82
+ applySymmetricTensor(rowMassTensor, armBX, armBY, armBZ, rowMassVector);
83
+ denominator += armBX * rowMassVector[0] + armBY * rowMassVector[1] + armBZ * rowMassVector[2];
84
+ return denominator > 0 ? 1 / denominator : 0;
85
+ }
86
+ // The rate at which one constraint row's coordinate is changing — B relative to A, so a positive value means
87
+ // the row's error is growing. The third member of the row triple, and the one every solve reads before
88
+ // deciding an impulse.
89
+ export function getPhysics3DJointRowVelocity(bodyA, bodyB, directionX, directionY, directionZ, armAX, armAY, armAZ, armBX, armBY, armBZ) {
90
+ return ((bodyB.velocityX - bodyA.velocityX) * directionX +
91
+ (bodyB.velocityY - bodyA.velocityY) * directionY +
92
+ (bodyB.velocityZ - bodyA.velocityZ) * directionZ +
93
+ bodyB.angularVelocityX * armBX +
94
+ bodyB.angularVelocityY * armBY +
95
+ bodyB.angularVelocityZ * armBZ -
96
+ bodyA.angularVelocityX * armAX -
97
+ bodyA.angularVelocityY * armAY -
98
+ bodyA.angularVelocityZ * armAZ);
99
+ }
100
+ // Exchanges a frame-bearing joint's two local rotations, so the generic end swap the registry performs
101
+ // stays consistent for every kind that carries a frame. Each rotation belongs to its body and travels with
102
+ // it; nothing about a frame reverses sign, unlike the direction-bearing scalars a kind may also hold.
103
+ export function swapPhysics3DJointFrames(frames) {
104
+ const x = frames.localRotationAX;
105
+ const y = frames.localRotationAY;
106
+ const z = frames.localRotationAZ;
107
+ const w = frames.localRotationAW;
108
+ frames.localRotationAX = frames.localRotationBX;
109
+ frames.localRotationAY = frames.localRotationBY;
110
+ frames.localRotationAZ = frames.localRotationBZ;
111
+ frames.localRotationAW = frames.localRotationBW;
112
+ frames.localRotationBX = x;
113
+ frames.localRotationBY = y;
114
+ frames.localRotationBZ = z;
115
+ frames.localRotationBW = w;
116
+ }
117
+ // Rotates each body's local anchor into world space, relative to that body's CENTRE OF MASS, and writes the
118
+ // two lever arms onto the joint.
119
+ //
120
+ // Measured from the centre of mass rather than from the body's origin, because that is the point a body
121
+ // rotates about: an impulse at an anchor produces the torque of its arm about the centre, and an arm taken
122
+ // from the origin gives an offset body the swing of a shape it does not have. The two coincide only when a
123
+ // body's centre of mass sits at its origin, which is why the error survives every test built from centred
124
+ // primitives.
125
+ export function writePhysics3DJointAnchors(bodyA, bodyB, joint) {
126
+ rotateByQuaternion(joint.localAnchorAX - bodyA.centerX, joint.localAnchorAY - bodyA.centerY, joint.localAnchorAZ - bodyA.centerZ, bodyA.orientationX, bodyA.orientationY, bodyA.orientationZ, bodyA.orientationW, anchorVector);
127
+ joint.rAX = anchorVector[0];
128
+ joint.rAY = anchorVector[1];
129
+ joint.rAZ = anchorVector[2];
130
+ rotateByQuaternion(joint.localAnchorBX - bodyB.centerX, joint.localAnchorBY - bodyB.centerY, joint.localAnchorBZ - bodyB.centerZ, bodyB.orientationX, bodyB.orientationY, bodyB.orientationZ, bodyB.orientationW, anchorVector);
131
+ joint.rBX = anchorVector[0];
132
+ joint.rBY = anchorVector[1];
133
+ joint.rBZ = anchorVector[2];
134
+ }
135
+ // The velocity of B's anchor relative to A's, written into `out` as three world-space components. Each
136
+ // anchor's velocity is its body's linear velocity plus the rotational contribution at its lever arm — the
137
+ // term that makes an anchor move even when the body's centre is still.
138
+ export function writePhysics3DJointAnchorVelocity(bodyA, bodyB, joint, out) {
139
+ const anchorAX = bodyA.velocityX + (bodyA.angularVelocityY * joint.rAZ - bodyA.angularVelocityZ * joint.rAY);
140
+ const anchorAY = bodyA.velocityY + (bodyA.angularVelocityZ * joint.rAX - bodyA.angularVelocityX * joint.rAZ);
141
+ const anchorAZ = bodyA.velocityZ + (bodyA.angularVelocityX * joint.rAY - bodyA.angularVelocityY * joint.rAX);
142
+ out[0] = bodyB.velocityX + (bodyB.angularVelocityY * joint.rBZ - bodyB.angularVelocityZ * joint.rBY) - anchorAX;
143
+ out[1] = bodyB.velocityY + (bodyB.angularVelocityZ * joint.rBX - bodyB.angularVelocityX * joint.rBZ) - anchorAY;
144
+ out[2] = bodyB.velocityZ + (bodyB.angularVelocityX * joint.rBY - bodyB.angularVelocityY * joint.rBX) - anchorAZ;
145
+ }
146
+ // The pair's angular effective-mass block — the sum of the two world inverse inertia tensors — written into
147
+ // `out` in the six-component symmetric form. Invert it with `inverseSymmetricTensor` to solve a three-row
148
+ // angular constraint; project it onto an axis with `getPhysics3DJointRowMass` to solve a single row.
149
+ export function writePhysics3DJointAngularMass(bodyA, bodyB, out) {
150
+ out[TENSOR_XX] = bodyA.inverseInertiaWorldXX + bodyB.inverseInertiaWorldXX;
151
+ out[TENSOR_YY] = bodyA.inverseInertiaWorldYY + bodyB.inverseInertiaWorldYY;
152
+ out[TENSOR_ZZ] = bodyA.inverseInertiaWorldZZ + bodyB.inverseInertiaWorldZZ;
153
+ out[TENSOR_XY] = bodyA.inverseInertiaWorldXY + bodyB.inverseInertiaWorldXY;
154
+ out[TENSOR_XZ] = bodyA.inverseInertiaWorldXZ + bodyB.inverseInertiaWorldXZ;
155
+ out[TENSOR_YZ] = bodyA.inverseInertiaWorldYZ + bodyB.inverseInertiaWorldYZ;
156
+ }
157
+ // The world-space axes of one body's joint frame, written into `out` as nine numbers in COLUMN-MAJOR order:
158
+ // `out[0..2]` is the frame's X axis, `out[3..5]` its Y, `out[6..8]` its Z.
159
+ //
160
+ // X first is the convention every axis-bearing kind shares — a hinge spins about it, a slider translates
161
+ // along it, a cone-twist twists about it — so a caller that needs only the primary axis reads the first
162
+ // three numbers and stops.
163
+ export function writePhysics3DJointFrameBasis(body, localRotationX, localRotationY, localRotationZ, localRotationW, out) {
164
+ multiplyQuaternions(body.orientationX, body.orientationY, body.orientationZ, body.orientationW, localRotationX, localRotationY, localRotationZ, localRotationW, basisRotation);
165
+ const x = basisRotation[0];
166
+ const y = basisRotation[1];
167
+ const z = basisRotation[2];
168
+ const w = basisRotation[3];
169
+ const x2 = x + x;
170
+ const y2 = y + y;
171
+ const z2 = z + z;
172
+ const xx2 = x * x2;
173
+ const yy2 = y * y2;
174
+ const zz2 = z * z2;
175
+ const xy2 = x * y2;
176
+ const xz2 = x * z2;
177
+ const yz2 = y * z2;
178
+ const wx2 = w * x2;
179
+ const wy2 = w * y2;
180
+ const wz2 = w * z2;
181
+ out[0] = 1 - yy2 - zz2;
182
+ out[1] = xy2 + wz2;
183
+ out[2] = xz2 - wy2;
184
+ out[3] = xy2 - wz2;
185
+ out[4] = 1 - xx2 - zz2;
186
+ out[5] = yz2 + wx2;
187
+ out[6] = xz2 + wy2;
188
+ out[7] = yz2 - wx2;
189
+ out[8] = 1 - xx2 - yy2;
190
+ }
191
+ // One body's joint frame as a world-space unit quaternion, written into `out` as `[x, y, z, w]`. The
192
+ // rotation half of the frame `writePhysics3DJointFrameBasis` expands into axes; kinds that measure an angle
193
+ // rather than project onto an axis want this form.
194
+ export function writePhysics3DJointFrameRotation(body, localRotationX, localRotationY, localRotationZ, localRotationW, out) {
195
+ multiplyQuaternions(body.orientationX, body.orientationY, body.orientationZ, body.orientationW, localRotationX, localRotationY, localRotationZ, localRotationW, out);
196
+ }
197
+ // The 3x3 effective-mass block of a point-to-point constraint, written into `out` in the six-component
198
+ // symmetric form.
199
+ //
200
+ // `K = (invMassA + invMassB) * identity + skew(rA) * invInertiaA * transpose(skew(rA)) + (same for B)`, and
201
+ // it is symmetric by construction because each term is. Invert it with `inverseSymmetricTensor` and the
202
+ // three rows are solved as one coupled block; solving x, then y, then z instead lets each axis undo part of
203
+ // the previous correction, which presents as a loaded joint that visibly creeps.
204
+ export function writePhysics3DJointPointMass(bodyA, bodyB, rAX, rAY, rAZ, rBX, rBY, rBZ, out) {
205
+ const diagonal = bodyA.inverseMass + bodyB.inverseMass;
206
+ out[TENSOR_XX] = diagonal;
207
+ out[TENSOR_YY] = diagonal;
208
+ out[TENSOR_ZZ] = diagonal;
209
+ out[TENSOR_XY] = 0;
210
+ out[TENSOR_XZ] = 0;
211
+ out[TENSOR_YZ] = 0;
212
+ readWorldInverseInertia(bodyA, pointMassTensor);
213
+ addSkewSandwich(pointMassTensor, rAX, rAY, rAZ, out);
214
+ readWorldInverseInertia(bodyB, pointMassTensor);
215
+ addSkewSandwich(pointMassTensor, rBX, rBY, rBZ, out);
216
+ }
217
+ // The rotation taking frame A onto frame B, written into `out` as `[x, y, z, w]` and expressed IN A'S OWN
218
+ // FRAME rather than in world space. `conjugate(frameA) * frameB`.
219
+ //
220
+ // A's frame is the useful one for a kind that has to take the rotation apart — a cone-twist reads its twist
221
+ // straight off the X component here, because A's X is what twist is defined about. A kind that only needs
222
+ // the error as one vector wants `writePhysics3DJointRotationError` instead, which is this rotated out to
223
+ // world space where the inverse inertia tensors live.
224
+ //
225
+ // `w` is always non-negative on return. A unit quaternion and its negation name the same rotation, so
226
+ // without that fix half of all inputs would decompose as the long way round: a frame a degree from aligned
227
+ // would read as 359 degrees out, and every limit built on it would fire against the wrong bound.
228
+ export function writePhysics3DJointRelativeRotation(frameAX, frameAY, frameAZ, frameAW, frameBX, frameBY, frameBZ, frameBW, out) {
229
+ multiplyQuaternions(-frameAX, -frameAY, -frameAZ, frameAW, frameBX, frameBY, frameBZ, frameBW, out);
230
+ if (out[3] < 0) {
231
+ out[0] = -out[0];
232
+ out[1] = -out[1];
233
+ out[2] = -out[2];
234
+ out[3] = -out[3];
235
+ }
236
+ }
237
+ // The rotation taking frame A onto frame B, written into `out` as a world-space vector whose direction is
238
+ // the axis and whose magnitude is the angle in radians. Zero exactly when the two frames coincide, which is
239
+ // what makes it usable directly as the positional error of an angular constraint.
240
+ //
241
+ // The angle comes from `2 * atan2(|v|, w)` rather than from the small-angle shortcut `2 * v`. The shortcut
242
+ // is `2 * sin(angle/2) * axis`, which agrees near zero and is 10% short by a quarter turn — invisible on a
243
+ // locked axis, and a limit that stops progressively early as it opens up.
244
+ //
245
+ // The shorter of the two arcs is always chosen. A unit quaternion and its negation name the same rotation,
246
+ // so without the sign fix half of all inputs would report the long way round: a frame a degree from aligned
247
+ // would read as 359 degrees out and the constraint would drive it the wrong way.
248
+ export function writePhysics3DJointRotationError(frameAX, frameAY, frameAZ, frameAW, frameBX, frameBY, frameBZ, frameBW, out) {
249
+ writePhysics3DJointRelativeRotation(frameAX, frameAY, frameAZ, frameAW, frameBX, frameBY, frameBZ, frameBW, rotationErrorRelative);
250
+ const x = rotationErrorRelative[0];
251
+ const y = rotationErrorRelative[1];
252
+ const z = rotationErrorRelative[2];
253
+ const sine = Math.sqrt(x * x + y * y + z * z);
254
+ if (sine < QUATERNION_EPSILON) {
255
+ out[0] = 0;
256
+ out[1] = 0;
257
+ out[2] = 0;
258
+ return;
259
+ }
260
+ const scale = (2 * Math.atan2(sine, rotationErrorRelative[3])) / sine;
261
+ rotateByQuaternion(x * scale, y * scale, z * scale, frameAX, frameAY, frameAZ, frameAW, out);
262
+ }
263
+ // The world-space offset from A's anchor to B's, written into `out` — the positional error of a
264
+ // point-to-point constraint, and the vector every axis-bearing kind projects onto its frame.
265
+ //
266
+ // Built as `worldCenter + leverArm` rather than `bodyOrigin + leverArm`. The lever arm is measured from the
267
+ // centre of mass, so adding it to the origin lands on the anchor only when the two coincide; for a body
268
+ // whose centre is offset, the two anchors are each wrong by their own rotated offset and the difference
269
+ // does not cancel.
270
+ export function writePhysics3DJointSeparation(bodyA, bodyB, joint, out) {
271
+ writeWorldCenter(bodyA, separationCenter);
272
+ const anchorAX = separationCenter[0] + joint.rAX;
273
+ const anchorAY = separationCenter[1] + joint.rAY;
274
+ const anchorAZ = separationCenter[2] + joint.rAZ;
275
+ writeWorldCenter(bodyB, separationCenter);
276
+ out[0] = separationCenter[0] + joint.rBX - anchorAX;
277
+ out[1] = separationCenter[1] + joint.rBY - anchorAY;
278
+ out[2] = separationCenter[2] + joint.rBZ - anchorAZ;
279
+ }
280
+ // Adds `skew(r) * tensor * transpose(skew(r))` into an accumulating symmetric block. The rows of `skew(r)`
281
+ // are the three vectors below, and entry (i,j) of the product is `row_i . tensor . row_j` — six distinct
282
+ // entries for a symmetric result, which is why only six are computed.
283
+ function addSkewSandwich(tensor, rX, rY, rZ, out) {
284
+ applySymmetricTensor(tensor, 0, -rZ, rY, skewRow0);
285
+ applySymmetricTensor(tensor, rZ, 0, -rX, skewRow1);
286
+ applySymmetricTensor(tensor, -rY, rX, 0, skewRow2);
287
+ out[TENSOR_XX] += -rZ * skewRow0[1] + rY * skewRow0[2];
288
+ out[TENSOR_YY] += rZ * skewRow1[0] - rX * skewRow1[2];
289
+ out[TENSOR_ZZ] += -rY * skewRow2[0] + rX * skewRow2[1];
290
+ out[TENSOR_XY] += -rZ * skewRow1[1] + rY * skewRow1[2];
291
+ out[TENSOR_XZ] += -rZ * skewRow2[1] + rY * skewRow2[2];
292
+ out[TENSOR_YZ] += rZ * skewRow2[0] - rX * skewRow2[2];
293
+ }
294
+ function applyBodyJointImpulse(body, rX, rY, rZ, impulseX, impulseY, impulseZ) {
295
+ body.velocityX += impulseX * body.inverseMass;
296
+ body.velocityY += impulseY * body.inverseMass;
297
+ body.velocityZ += impulseZ * body.inverseMass;
298
+ const torqueX = rY * impulseZ - rZ * impulseY;
299
+ const torqueY = rZ * impulseX - rX * impulseZ;
300
+ const torqueZ = rX * impulseY - rY * impulseX;
301
+ readWorldInverseInertia(body, bodyImpulseTensor);
302
+ applySymmetricTensor(bodyImpulseTensor, torqueX, torqueY, torqueZ, bodyImpulseVector);
303
+ body.angularVelocityX += bodyImpulseVector[0];
304
+ body.angularVelocityY += bodyImpulseVector[1];
305
+ body.angularVelocityZ += bodyImpulseVector[2];
306
+ }
307
+ // `out = a * b`, the Hamilton product, in the order that composes b's rotation FIRST and then a's. Frames
308
+ // are built as `bodyOrientation * localRotation` for exactly that reason: the local rotation is expressed in
309
+ // body space and the body's orientation carries it out to the world.
310
+ function multiplyQuaternions(aX, aY, aZ, aW, bX, bY, bZ, bW, out) {
311
+ out[0] = aW * bX + aX * bW + aY * bZ - aZ * bY;
312
+ out[1] = aW * bY - aX * bZ + aY * bW + aZ * bX;
313
+ out[2] = aW * bZ + aX * bY - aY * bX + aZ * bW;
314
+ out[3] = aW * bW - aX * bX - aY * bY - aZ * bZ;
315
+ }
316
+ function readWorldInverseInertia(body, out) {
317
+ out[TENSOR_XX] = body.inverseInertiaWorldXX;
318
+ out[TENSOR_YY] = body.inverseInertiaWorldYY;
319
+ out[TENSOR_ZZ] = body.inverseInertiaWorldZZ;
320
+ out[TENSOR_XY] = body.inverseInertiaWorldXY;
321
+ out[TENSOR_XZ] = body.inverseInertiaWorldXZ;
322
+ out[TENSOR_YZ] = body.inverseInertiaWorldYZ;
323
+ }
324
+ // `v + 2 * q.xyz x (q.xyz x v + q.w * v)`, the standard reduction of `q * v * conjugate(q)` for a unit
325
+ // quaternion. Safe when `out` is one of the inputs, since every component is read into a local first.
326
+ function rotateByQuaternion(vX, vY, vZ, qX, qY, qZ, qW, out) {
327
+ const tX = qY * vZ - qZ * vY + qW * vX;
328
+ const tY = qZ * vX - qX * vZ + qW * vY;
329
+ const tZ = qX * vY - qY * vX + qW * vZ;
330
+ out[0] = vX + 2 * (qY * tZ - qZ * tY);
331
+ out[1] = vY + 2 * (qZ * tX - qX * tZ);
332
+ out[2] = vZ + 2 * (qX * tY - qY * tX);
333
+ }
334
+ function writeWorldCenter(body, out) {
335
+ rotateByQuaternion(body.centerX, body.centerY, body.centerZ, body.orientationX, body.orientationY, body.orientationZ, body.orientationW, out);
336
+ out[0] += body.x;
337
+ out[1] += body.y;
338
+ out[2] += body.z;
339
+ }
340
+ // Below the tolerance the rotation error is genuinely zero and the axis is undefined; returning a zero
341
+ // vector is correct there, where dividing by the vanishing sine would seed NaN into both bodies.
342
+ const QUATERNION_EPSILON = 1e-12;
343
+ // Per-function scratch, never shared between two functions that can be live at once. One shared pool would
344
+ // be smaller and would corrupt the outer call the first time one of these grew a nested use.
345
+ const angularImpulseTensor = [0, 0, 0, 0, 0, 0];
346
+ const angularImpulseVector = [0, 0, 0];
347
+ const anchorVector = [0, 0, 0];
348
+ const basisRotation = [0, 0, 0, 0];
349
+ const bodyImpulseTensor = [0, 0, 0, 0, 0, 0];
350
+ const bodyImpulseVector = [0, 0, 0];
351
+ const pointMassTensor = [0, 0, 0, 0, 0, 0];
352
+ const rotationErrorRelative = [0, 0, 0, 0];
353
+ const rowImpulseTensor = [0, 0, 0, 0, 0, 0];
354
+ const rowImpulseVector = [0, 0, 0];
355
+ const rowMassTensor = [0, 0, 0, 0, 0, 0];
356
+ const rowMassVector = [0, 0, 0];
357
+ const separationCenter = [0, 0, 0];
358
+ const skewRow0 = [0, 0, 0];
359
+ const skewRow1 = [0, 0, 0];
360
+ const skewRow2 = [0, 0, 0];
361
+ //# sourceMappingURL=jointMath.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jointMath.js","sourceRoot":"","sources":["../src/jointMath.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,oBAAoB,EACpB,SAAS,EACT,SAAS,EACT,SAAS,EACT,SAAS,EACT,SAAS,EACT,SAAS,GACV,MAAM,mBAAmB,CAAC;AAE3B,sGAAsG;AACtG,kDAAkD;AAClD,EAAE;AACF,4FAA4F;AAC5F,2GAA2G;AAC3G,2GAA2G;AAC3G,oFAAoF;AACpF,sFAAsF;AACtF,EAAE;AACF,4GAA4G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C,MAAM,gBAAgB,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AACnC,MAAM,aAAa,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AACzC,MAAM,aAAa,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAChC,MAAM,gBAAgB,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AACnC,MAAM,QAAQ,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAC3B,MAAM,QAAQ,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAC3B,MAAM,QAAQ,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { Physics3DJoint, Physics3DJointReaction, Physics3DWorld } from '@flighthq/types/contract';
2
+ export declare function accumulatePhysics3DJointRowReaction(joint: Readonly<Physics3DJoint>, state: readonly number[], offset: number, impulse: number, out: Physics3DJointReaction): void;
3
+ export declare function clearPhysics3DJointReaction(out: Physics3DJointReaction): void;
4
+ export declare function createPhysics3DJointReaction(): Physics3DJointReaction;
5
+ export declare function getPhysics3DJointReactionForce(reaction: Readonly<Physics3DJointReaction>): number;
6
+ export declare function getPhysics3DJointReactionTorque(reaction: Readonly<Physics3DJointReaction>): number;
7
+ export declare function writePhysics3DJointReaction(world: Readonly<Physics3DWorld>, joint: Readonly<Physics3DJoint>, dt: number, out: Physics3DJointReaction): boolean;
8
+ //# sourceMappingURL=jointReaction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jointReaction.d.ts","sourceRoot":"","sources":["../src/jointReaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAiBvG,wBAAgB,mCAAmC,CACjD,KAAK,EAAE,QAAQ,CAAC,cAAc,CAAC,EAC/B,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,GAAG,EAAE,sBAAsB,GAC1B,IAAI,CAeN;AAED,wBAAgB,2BAA2B,CAAC,GAAG,EAAE,sBAAsB,GAAG,IAAI,CAO7E;AAED,wBAAgB,4BAA4B,IAAI,sBAAsB,CAErE;AAED,wBAAgB,8BAA8B,CAAC,QAAQ,EAAE,QAAQ,CAAC,sBAAsB,CAAC,GAAG,MAAM,CAIjG;AAED,wBAAgB,+BAA+B,CAAC,QAAQ,EAAE,QAAQ,CAAC,sBAAsB,CAAC,GAAG,MAAM,CAIlG;AAUD,wBAAgB,2BAA2B,CACzC,KAAK,EAAE,QAAQ,CAAC,cAAc,CAAC,EAC/B,KAAK,EAAE,QAAQ,CAAC,cAAc,CAAC,EAC/B,EAAE,EAAE,MAAM,EACV,GAAG,EAAE,sBAAsB,GAC1B,OAAO,CAMT"}
@@ -0,0 +1,65 @@
1
+ // What a joint is CARRYING — the force and torque its constraint applied over the sub-interval just
2
+ // solved. A stress readout, a break threshold, a gameplay trigger for a rope about to snap.
3
+ //
4
+ // The reading is per SUB-INTERVAL, not per step. A world running substeps solves several sub-intervals
5
+ // per step and each converges its own impulses, so this reports the most recent one. That is the right
6
+ // grain for a threshold — a joint that momentarily carried ten times its average load did carry it — and
7
+ // the wrong grain for an average, which a caller wanting one should accumulate itself.
8
+ // Adds one constraint row's contribution to a reaction.
9
+ //
10
+ // The torque term is `armB - rB x direction`, and the subtraction is what makes force and torque
11
+ // INDEPENDENT readings. A row's angular arm already contains `rB x direction` for a linear row, which is
12
+ // the torque that row exerts about the centre of mass purely by acting at an offset anchor. Leaving it in
13
+ // would make a weight hung off a joint register as twist, and a `breakTorque` fire on hanging load. The
14
+ // subtraction cancels it exactly for a linear row and leaves a purely angular row untouched.
15
+ export function accumulatePhysics3DJointRowReaction(joint, state, offset, impulse, out) {
16
+ if (impulse === 0)
17
+ return;
18
+ const directionX = state[offset];
19
+ const directionY = state[offset + 1];
20
+ const directionZ = state[offset + 2];
21
+ out.forceX += directionX * impulse;
22
+ out.forceY += directionY * impulse;
23
+ out.forceZ += directionZ * impulse;
24
+ const leverX = joint.rBY * directionZ - joint.rBZ * directionY;
25
+ const leverY = joint.rBZ * directionX - joint.rBX * directionZ;
26
+ const leverZ = joint.rBX * directionY - joint.rBY * directionX;
27
+ out.torqueX += (state[offset + 6] - leverX) * impulse;
28
+ out.torqueY += (state[offset + 7] - leverY) * impulse;
29
+ out.torqueZ += (state[offset + 8] - leverZ) * impulse;
30
+ }
31
+ export function clearPhysics3DJointReaction(out) {
32
+ out.forceX = 0;
33
+ out.forceY = 0;
34
+ out.forceZ = 0;
35
+ out.torqueX = 0;
36
+ out.torqueY = 0;
37
+ out.torqueZ = 0;
38
+ }
39
+ export function createPhysics3DJointReaction() {
40
+ return { forceX: 0, forceY: 0, forceZ: 0, torqueX: 0, torqueY: 0, torqueZ: 0 };
41
+ }
42
+ export function getPhysics3DJointReactionForce(reaction) {
43
+ return Math.sqrt(reaction.forceX * reaction.forceX + reaction.forceY * reaction.forceY + reaction.forceZ * reaction.forceZ);
44
+ }
45
+ export function getPhysics3DJointReactionTorque(reaction) {
46
+ return Math.sqrt(reaction.torqueX * reaction.torqueX + reaction.torqueY * reaction.torqueY + reaction.torqueZ * reaction.torqueZ);
47
+ }
48
+ // Writes the load `joint` carried over the most recent sub-interval, and returns whether there was one to
49
+ // read. False leaves the reaction zeroed, and means one of: the kind has no registered solver, the kind
50
+ // does not report a reaction, the joint has not been solved since it was added, or `dt` was not positive.
51
+ //
52
+ // `dt` is the SUB-INTERVAL the world solved, which is `dt / substeps` for a stepped world — not the frame
53
+ // time. Passing the frame time understates the force by the substep count. It is a parameter rather than
54
+ // something read back off the world because the world does not retain it, and a remembered timestep is a
55
+ // second source of truth that goes stale the first time a caller varies its step.
56
+ export function writePhysics3DJointReaction(world, joint, dt, out) {
57
+ clearPhysics3DJointReaction(out);
58
+ if (!(dt > 0))
59
+ return false;
60
+ const solver = world.jointSolvers.get(joint.kind);
61
+ if (solver?.writeReaction === undefined)
62
+ return false;
63
+ return solver.writeReaction(joint, 1 / dt, out);
64
+ }
65
+ //# sourceMappingURL=jointReaction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jointReaction.js","sourceRoot":"","sources":["../src/jointReaction.ts"],"names":[],"mappings":"AAEA,oGAAoG;AACpG,4FAA4F;AAC5F,EAAE;AACF,uGAAuG;AACvG,uGAAuG;AACvG,yGAAyG;AACzG,uFAAuF;AAEvF,wDAAwD;AACxD,EAAE;AACF,iGAAiG;AACjG,yGAAyG;AACzG,0GAA0G;AAC1G,wGAAwG;AACxG,6FAA6F;AAC7F,MAAM,UAAU,mCAAmC,CACjD,KAA+B,EAC/B,KAAwB,EACxB,MAAc,EACd,OAAe,EACf,GAA2B;IAE3B,IAAI,OAAO,KAAK,CAAC;QAAE,OAAO;IAC1B,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;IACjC,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACrC,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACrC,GAAG,CAAC,MAAM,IAAI,UAAU,GAAG,OAAO,CAAC;IACnC,GAAG,CAAC,MAAM,IAAI,UAAU,GAAG,OAAO,CAAC;IACnC,GAAG,CAAC,MAAM,IAAI,UAAU,GAAG,OAAO,CAAC;IAEnC,MAAM,MAAM,GAAG,KAAK,CAAC,GAAG,GAAG,UAAU,GAAG,KAAK,CAAC,GAAG,GAAG,UAAU,CAAC;IAC/D,MAAM,MAAM,GAAG,KAAK,CAAC,GAAG,GAAG,UAAU,GAAG,KAAK,CAAC,GAAG,GAAG,UAAU,CAAC;IAC/D,MAAM,MAAM,GAAG,KAAK,CAAC,GAAG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AAO,GAAG,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,OAAO,CAChH,CAAC;AACJ,CAAC;AAED,0GAA0G;AAC1G,wGAAwG;AACxG,0GAA0G;AAC1G,EAAE;AACF,0GAA0G;AAC1G,yGAAyG;AACzG,yGAAyG;AACzG,kFAAkF;AAClF,MAAM,UAAU,2BAA2B,CACzC,KAA+B,EAC/B,KAA+B,EAC/B,EAAU,EACV,GAA2B;IAE3B,2BAA2B,CAAC,GAAG,CAAC,CAAC;IACjC,IAAI,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;QAAE,OAAO,KAAK,CAAC;IAC5B,MAAM,MAAM,GAAG,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAClD,IAAI,MAAM,EAAE,aAAa,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IACtD,OAAO,MAAM,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC,GAAG,EAAE,EAAE,GAAG,CAAC,CAAC;AAClD,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { Physics3DJoint, Physics3DJointKind, Physics3DJointSolver, Physics3DWorld } from '@flighthq/types/contract';
2
+ export declare function addPhysics3DJoint<T extends Physics3DJoint>(world: Physics3DWorld, joint: T): T;
3
+ export declare function getPhysics3DJointSolver(world: Readonly<Physics3DWorld>, kind: Physics3DJointKind): Physics3DJointSolver | null;
4
+ export declare function invalidatePhysics3DJoint(world: Physics3DWorld, joint: Physics3DJoint): boolean;
5
+ export declare function isPhysics3DPairOrdered(a: number, b: number): boolean;
6
+ export declare function registerPhysics3DJointSolver(world: Physics3DWorld, kind: Physics3DJointKind, solver: Physics3DJointSolver): void;
7
+ export declare function removePhysics3DJoint(world: Physics3DWorld, joint: Physics3DJoint): boolean;
8
+ //# sourceMappingURL=jointRegistry.d.ts.map
@@ -0,0 +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;AAalC,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,cAAc,EAAE,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAqB9F;AAKD,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,QAAQ,CAAC,cAAc,CAAC,EAC/B,IAAI,EAAE,kBAAkB,GACvB,oBAAoB,GAAG,IAAI,CAE7B;AASD,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,cAAc,GAAG,OAAO,CAa9F;AAOD,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAEpE;AASD,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,cAAc,EACrB,IAAI,EAAE,kBAAkB,EACxB,MAAM,EAAE,oBAAoB,GAC3B,IAAI,CAcN;AAGD,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,cAAc,GAAG,OAAO,CAS1F"}