@vworlds/vecs-physics 1.0.37 → 1.0.39

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 (183) hide show
  1. package/adapter/engine.d.ts +14 -4
  2. package/adapter/engine.js +9 -11
  3. package/adapter/engine.js.map +1 -1
  4. package/adapter/queries.d.ts +1 -1
  5. package/adapter/queries.js +1 -1
  6. package/adapter/queries.js.map +1 -1
  7. package/adapter/runtime.js +1 -1
  8. package/adapter/runtime.js.map +1 -1
  9. package/{components/body.js → body/components.js} +2 -2
  10. package/body/components.js.map +1 -0
  11. package/body/lifecycle.d.ts +4 -0
  12. package/body/lifecycle.js +153 -0
  13. package/body/lifecycle.js.map +1 -0
  14. package/body/mass.d.ts +4 -0
  15. package/body/mass.js +45 -0
  16. package/body/mass.js.map +1 -0
  17. package/body/module.d.ts +4 -0
  18. package/body/module.js +22 -0
  19. package/body/module.js.map +1 -0
  20. package/body/pose_in.d.ts +4 -0
  21. package/body/pose_in.js +90 -0
  22. package/body/pose_in.js.map +1 -0
  23. package/body/pose_out.d.ts +4 -0
  24. package/body/pose_out.js +59 -0
  25. package/body/pose_out.js.map +1 -0
  26. package/{components/body_tuning.js → body/tuning.js} +1 -1
  27. package/body/tuning.js.map +1 -0
  28. package/core/module.d.ts +30 -0
  29. package/core/module.js +77 -0
  30. package/core/module.js.map +1 -0
  31. package/core/reaper.d.ts +4 -0
  32. package/core/reaper.js +45 -0
  33. package/core/reaper.js.map +1 -0
  34. package/core/step.d.ts +4 -0
  35. package/core/step.js +22 -0
  36. package/core/step.js.map +1 -0
  37. package/debug/validation.d.ts +4 -0
  38. package/{systems/debug.js → debug/validation.js} +51 -35
  39. package/debug/validation.js.map +1 -0
  40. package/{components/events.js → events/components.js} +1 -1
  41. package/events/components.js.map +1 -0
  42. package/events/module.d.ts +4 -0
  43. package/events/module.js +13 -0
  44. package/events/module.js.map +1 -0
  45. package/events/opt_in.d.ts +4 -0
  46. package/events/opt_in.js +86 -0
  47. package/events/opt_in.js.map +1 -0
  48. package/events/publish.d.ts +4 -0
  49. package/{systems/events.js → events/publish.js} +43 -34
  50. package/events/publish.js.map +1 -0
  51. package/{components/force.js → forces/components.js} +1 -1
  52. package/forces/components.js.map +1 -0
  53. package/forces/gather.d.ts +4 -0
  54. package/forces/gather.js +42 -0
  55. package/forces/gather.js.map +1 -0
  56. package/forces/impulses.d.ts +4 -0
  57. package/forces/impulses.js +79 -0
  58. package/forces/impulses.js.map +1 -0
  59. package/forces/module.d.ts +4 -0
  60. package/forces/module.js +20 -0
  61. package/forces/module.js.map +1 -0
  62. package/forces/zero.d.ts +4 -0
  63. package/forces/zero.js +34 -0
  64. package/forces/zero.js.map +1 -0
  65. package/index.d.ts +9 -8
  66. package/index.js +10 -8
  67. package/index.js.map +1 -1
  68. package/joints/components.d.ts +116 -0
  69. package/joints/components.js +150 -0
  70. package/joints/components.js.map +1 -0
  71. package/joints/features.d.ts +4 -0
  72. package/joints/features.js +158 -0
  73. package/joints/features.js.map +1 -0
  74. package/joints/lifecycle.d.ts +4 -0
  75. package/joints/lifecycle.js +191 -0
  76. package/joints/lifecycle.js.map +1 -0
  77. package/joints/module.d.ts +4 -0
  78. package/joints/module.js +33 -0
  79. package/joints/module.js.map +1 -0
  80. package/joints/predicates.d.ts +9 -0
  81. package/joints/predicates.js +10 -0
  82. package/joints/predicates.js.map +1 -0
  83. package/{components/target.js → kinematic/components.js} +1 -1
  84. package/kinematic/components.js.map +1 -0
  85. package/kinematic/module.d.ts +4 -0
  86. package/kinematic/module.js +16 -0
  87. package/kinematic/module.js.map +1 -0
  88. package/kinematic/targets.d.ts +4 -0
  89. package/{systems/kinematic.js → kinematic/targets.js} +27 -20
  90. package/kinematic/targets.js.map +1 -0
  91. package/{components/material.js → materials/components.js} +1 -1
  92. package/materials/components.js.map +1 -0
  93. package/materials/module.d.ts +4 -0
  94. package/materials/module.js +18 -0
  95. package/materials/module.js.map +1 -0
  96. package/materials/sync.d.ts +4 -0
  97. package/materials/sync.js +136 -0
  98. package/materials/sync.js.map +1 -0
  99. package/module.d.ts +3 -27
  100. package/module.js +45 -141
  101. package/module.js.map +1 -1
  102. package/package.json +2 -2
  103. package/shapes/chain.d.ts +8 -0
  104. package/{systems/chain_lifecycle.js → shapes/chain.js} +41 -31
  105. package/shapes/chain.js.map +1 -0
  106. package/{components/geometry.js → shapes/components.js} +2 -2
  107. package/{components/geometry.js.map → shapes/components.js.map} +1 -1
  108. package/{systems/shape_lifecycle.d.ts → shapes/lifecycle.d.ts} +7 -5
  109. package/{systems/shape_lifecycle.js → shapes/lifecycle.js} +53 -42
  110. package/shapes/lifecycle.js.map +1 -0
  111. package/shapes/module.d.ts +4 -0
  112. package/shapes/module.js +34 -0
  113. package/shapes/module.js.map +1 -0
  114. package/{components/shape_pose.js → shapes/pose_components.js} +1 -1
  115. package/shapes/pose_components.js.map +1 -0
  116. package/shapes/pose_sync.d.ts +4 -0
  117. package/shapes/pose_sync.js +70 -0
  118. package/shapes/pose_sync.js.map +1 -0
  119. package/{systems/shape_predicates.d.ts → shapes/predicates.d.ts} +2 -2
  120. package/{systems/shape_predicates.js → shapes/predicates.js} +3 -3
  121. package/shapes/predicates.js.map +1 -0
  122. package/util/resolve_body.js +1 -1
  123. package/components/body.js.map +0 -1
  124. package/components/body_tuning.js.map +0 -1
  125. package/components/events.js.map +0 -1
  126. package/components/force.js.map +0 -1
  127. package/components/material.js.map +0 -1
  128. package/components/shape_pose.js.map +0 -1
  129. package/components/target.js.map +0 -1
  130. package/systems/chain_lifecycle.d.ts +0 -6
  131. package/systems/chain_lifecycle.js.map +0 -1
  132. package/systems/debug.d.ts +0 -4
  133. package/systems/debug.js.map +0 -1
  134. package/systems/event_opt_in_sync.d.ts +0 -3
  135. package/systems/event_opt_in_sync.js +0 -73
  136. package/systems/event_opt_in_sync.js.map +0 -1
  137. package/systems/events.d.ts +0 -3
  138. package/systems/events.js.map +0 -1
  139. package/systems/forces.d.ts +0 -3
  140. package/systems/forces.js +0 -35
  141. package/systems/forces.js.map +0 -1
  142. package/systems/impulse_accumulate.d.ts +0 -4
  143. package/systems/impulse_accumulate.js +0 -74
  144. package/systems/impulse_accumulate.js.map +0 -1
  145. package/systems/impulse_zero.d.ts +0 -3
  146. package/systems/impulse_zero.js +0 -27
  147. package/systems/impulse_zero.js.map +0 -1
  148. package/systems/index.d.ts +0 -15
  149. package/systems/index.js +0 -80
  150. package/systems/index.js.map +0 -1
  151. package/systems/kinematic.d.ts +0 -3
  152. package/systems/kinematic.js.map +0 -1
  153. package/systems/lifecycle.d.ts +0 -4
  154. package/systems/lifecycle.js +0 -177
  155. package/systems/lifecycle.js.map +0 -1
  156. package/systems/mass_recompute.d.ts +0 -3
  157. package/systems/mass_recompute.js +0 -38
  158. package/systems/mass_recompute.js.map +0 -1
  159. package/systems/material_filter_sync.d.ts +0 -3
  160. package/systems/material_filter_sync.js +0 -129
  161. package/systems/material_filter_sync.js.map +0 -1
  162. package/systems/pose_sync_in.d.ts +0 -3
  163. package/systems/pose_sync_in.js +0 -79
  164. package/systems/pose_sync_in.js.map +0 -1
  165. package/systems/pose_sync_out.d.ts +0 -3
  166. package/systems/pose_sync_out.js +0 -52
  167. package/systems/pose_sync_out.js.map +0 -1
  168. package/systems/shape_lifecycle.js.map +0 -1
  169. package/systems/shape_pose_sync.d.ts +0 -3
  170. package/systems/shape_pose_sync.js +0 -63
  171. package/systems/shape_pose_sync.js.map +0 -1
  172. package/systems/shape_predicates.js.map +0 -1
  173. package/systems/step.d.ts +0 -3
  174. package/systems/step.js +0 -15
  175. package/systems/step.js.map +0 -1
  176. /package/{components/body.d.ts → body/components.d.ts} +0 -0
  177. /package/{components/body_tuning.d.ts → body/tuning.d.ts} +0 -0
  178. /package/{components/events.d.ts → events/components.d.ts} +0 -0
  179. /package/{components/force.d.ts → forces/components.d.ts} +0 -0
  180. /package/{components/target.d.ts → kinematic/components.d.ts} +0 -0
  181. /package/{components/material.d.ts → materials/components.d.ts} +0 -0
  182. /package/{components/geometry.d.ts → shapes/components.d.ts} +0 -0
  183. /package/{components/shape_pose.d.ts → shapes/pose_components.d.ts} +0 -0
@@ -1,36 +1,45 @@
1
- import { ContactEvents, HitEvents, SensorEvents } from "../components/events.js";
2
- import { PhysicsSystemTag } from "../adapter/engine.js";
3
- export function installEvents(world, engine, phase) {
4
- const system = world
5
- .system("PhysicsEvents")
6
- .phase(phase)
7
- .run(() => {
8
- const touchedContact = new Set();
9
- const touchedSensor = new Set();
10
- const touchedHit = new Set();
11
- publishContactAndHitEvents(world, engine, touchedContact, touchedHit);
12
- publishSensorEvents(world, engine, touchedSensor);
13
- markModified(world, touchedContact, ContactEvents);
14
- markModified(world, touchedSensor, SensorEvents);
15
- markModified(world, touchedHit, HitEvents);
16
- clearUntouchedContactEvents(world, engine.prevTouchedContact, touchedContact);
17
- clearUntouchedSensorEvents(world, engine.prevTouchedSensor, touchedSensor);
18
- clearUntouchedHitEvents(world, engine.prevTouchedHit, touchedHit);
19
- // Store touched sets on engine for the next step's clear pass.
20
- engine.prevTouchedContact.clear();
21
- for (const eid of touchedContact) {
22
- engine.prevTouchedContact.add(eid);
23
- }
24
- engine.prevTouchedSensor.clear();
25
- for (const eid of touchedSensor) {
26
- engine.prevTouchedSensor.add(eid);
27
- }
28
- engine.prevTouchedHit.clear();
29
- for (const eid of touchedHit) {
30
- engine.prevTouchedHit.add(eid);
31
- }
32
- });
33
- system.entity.add(PhysicsSystemTag);
1
+ import { Module } from "@vworlds/vecs";
2
+ import { ContactEvents, HitEvents, SensorEvents } from "./components.js";
3
+ import { getPhysicsEngine, PhysicsSystemTag } from "../adapter/engine.js";
4
+ import { PhysicsCoreModule } from "../core/module.js";
5
+ import { EventsModule } from "./module.js";
6
+ export class EventPublishModule extends Module {
7
+ init() {
8
+ const world = this.world;
9
+ world.module(PhysicsCoreModule);
10
+ world.module(EventsModule);
11
+ const engine = getPhysicsEngine(world);
12
+ world
13
+ .system("PhysicsEvents")
14
+ .phase(engine.phases.postStep)
15
+ .run(() => {
16
+ const touchedContact = new Set();
17
+ const touchedSensor = new Set();
18
+ const touchedHit = new Set();
19
+ publishContactAndHitEvents(world, engine, touchedContact, touchedHit);
20
+ publishSensorEvents(world, engine, touchedSensor);
21
+ markModified(world, touchedContact, ContactEvents);
22
+ markModified(world, touchedSensor, SensorEvents);
23
+ markModified(world, touchedHit, HitEvents);
24
+ clearUntouchedContactEvents(world, engine.prevTouchedContact, touchedContact);
25
+ clearUntouchedSensorEvents(world, engine.prevTouchedSensor, touchedSensor);
26
+ clearUntouchedHitEvents(world, engine.prevTouchedHit, touchedHit);
27
+ // Store touched sets on engine for the next step's clear pass.
28
+ engine.prevTouchedContact.clear();
29
+ for (const eid of touchedContact) {
30
+ engine.prevTouchedContact.add(eid);
31
+ }
32
+ engine.prevTouchedSensor.clear();
33
+ for (const eid of touchedSensor) {
34
+ engine.prevTouchedSensor.add(eid);
35
+ }
36
+ engine.prevTouchedHit.clear();
37
+ for (const eid of touchedHit) {
38
+ engine.prevTouchedHit.add(eid);
39
+ }
40
+ })
41
+ .add(PhysicsSystemTag);
42
+ }
34
43
  }
35
44
  // Contact begin/end and hit events all come from a single
36
45
  // `b2World_GetContactEvents` poll, so fetch the event block once per step and
@@ -211,4 +220,4 @@ function deleteIfPresent(value) {
211
220
  function isDestroyed(entity) {
212
221
  return entity.destroyed;
213
222
  }
214
- //# sourceMappingURL=events.js.map
223
+ //# sourceMappingURL=publish.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"publish.js","sourceRoot":"","sources":["../../../../src/events/publish.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAqC,MAAM,eAAe,CAAC;AAE1E,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAsB,MAAM,sBAAsB,CAAC;AAE9F,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD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,SAAS;QACX,CAAC;QACD,MAAM,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,GAAG,CAAC,YAAY,CAA6B,CAAC;QACxF,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YACzB,MAAM,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;YACxB,MAAM,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC;QACxB,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAAS,uBAAuB,CAC9B,KAAY,EACZ,iBAA2B,EAC3B,OAAiB;IAEjB,KAAK,MAAM,QAAQ,IAAI,iBAAiB,EAAE,CAAC;QACzC,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC1B,SAAS;QACX,CAAC;QACD,MAAM,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,GAAG,CAAC,SAAS,CAA0B,CAAC;QAClF,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YACzB,MAAM,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;QACzB,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAAS,eAAe,CAAC,KAA8B;IACrD,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC;AACnB,CAAC;AAED,SAAS,WAAW,CAAC,MAAc;IACjC,OAAO,MAAM,CAAC,SAAS,CAAC;AAC1B,CAAC"}
@@ -32,4 +32,4 @@ export class AngularImpulse {
32
32
  this.wake = true;
33
33
  }
34
34
  }
35
- //# sourceMappingURL=force.js.map
35
+ //# sourceMappingURL=components.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"components.js","sourceRoot":"","sources":["../../../../src/forces/components.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,+EAA+E;AAC/E,iFAAiF;AACjF,8DAA8D;AAE9D,mCAAmC;AACnC,MAAM,OAAO,KAAK;IAAlB;QACE,MAAC,GAAG,CAAC,CAAC;QACN,MAAC,GAAG,CAAC,CAAC;QACN,SAAI,GAAG,IAAI,CAAC;IACd,CAAC;CAAA;AAED,yCAAyC;AACzC,MAAM,OAAO,MAAM;IAAnB;QACE,UAAK,GAAG,CAAC,CAAC;QACV,SAAI,GAAG,IAAI,CAAC;IACd,CAAC;CAAA;AAED,gFAAgF;AAChF,MAAM,OAAO,OAAO;IAApB;QACE,MAAC,GAAG,CAAC,CAAC;QACN,MAAC,GAAG,CAAC,CAAC;QACN,SAAI,GAAG,IAAI,CAAC;IACd,CAAC;CAAA;AAED,+DAA+D;AAC/D,MAAM,OAAO,cAAc;IAA3B;QACE,UAAK,GAAG,CAAC,CAAC;QACV,SAAI,GAAG,IAAI,CAAC;IACd,CAAC;CAAA"}
@@ -0,0 +1,4 @@
1
+ import { Module } from "@vworlds/vecs";
2
+ export declare class ForceGatherModule extends Module {
3
+ init(): void;
4
+ }
@@ -0,0 +1,42 @@
1
+ import { ChildOf, Module } from "@vworlds/vecs";
2
+ import { getPhysicsEngine, PhysicsSystemTag } from "../adapter/engine.js";
3
+ import { Body } from "../body/components.js";
4
+ import { Force, Torque } from "./components.js";
5
+ import { scr_b2Vec2 } from "../adapter/runtime.js";
6
+ import { PhysicsCoreModule } from "../core/module.js";
7
+ const forceTargetPredicate = { any: [Body, { parent: Body }] };
8
+ export class ForceGatherModule extends Module {
9
+ init() {
10
+ const world = this.world;
11
+ world.module(PhysicsCoreModule);
12
+ const engine = getPhysicsEngine(world);
13
+ const phase = engine.phases.preStep;
14
+ world
15
+ .system("PhysicsForceGather:Force")
16
+ .with(Force, forceTargetPredicate)
17
+ .phase(phase)
18
+ .each([Force, Body, { target: [ChildOf, [Body]] }], (_entity, [force, body, parentBody]) => {
19
+ const bodyId = body?._bodyId ?? parentBody?._bodyId;
20
+ if (bodyId === undefined) {
21
+ return;
22
+ }
23
+ const vec = scr_b2Vec2[0];
24
+ vec.Set(force.x, force.y);
25
+ engine.box2d.b2Body_ApplyForceToCenter(bodyId, vec, force.wake);
26
+ })
27
+ .add(PhysicsSystemTag);
28
+ world
29
+ .system("PhysicsForceGather:Torque")
30
+ .with(Torque, forceTargetPredicate)
31
+ .phase(phase)
32
+ .each([Torque, Body, { target: [ChildOf, [Body]] }], (_entity, [torque, body, parentBody]) => {
33
+ const bodyId = body?._bodyId ?? parentBody?._bodyId;
34
+ if (bodyId === undefined) {
35
+ return;
36
+ }
37
+ engine.box2d.b2Body_ApplyTorque(bodyId, torque.value, torque.wake);
38
+ })
39
+ .add(PhysicsSystemTag);
40
+ }
41
+ }
42
+ //# sourceMappingURL=gather.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gather.js","sourceRoot":"","sources":["../../../../src/forces/gather.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEhD,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,MAAM,oBAAoB,GAAG,EAAE,GAAG,EAAE,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAW,CAAC;AAExE,MAAM,OAAO,iBAAkB,SAAQ,MAAM;IACpC,IAAI;QACT,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACzB,KAAK,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;QAEhC,MAAM,MAAM,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC;QACvC,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC;QACpC,KAAK;aACF,MAAM,CAAC,0BAA0B,CAAC;aAClC,IAAI,CA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CAAC,IAAI,CAAC,CAAC;QACrE,CAAC,CACF;aACA,GAAG,CAAC,gBAAgB,CAAC,CAAC;IAC3B,CAAC;CACF"}
@@ -0,0 +1,4 @@
1
+ import { Module } from "@vworlds/vecs";
2
+ export declare class ImpulseAccumulateModule extends Module {
3
+ init(): void;
4
+ }
@@ -0,0 +1,79 @@
1
+ import { Module } from "@vworlds/vecs";
2
+ import { AngularImpulse, Impulse } from "./components.js";
3
+ import { scr_b2Vec2 } from "../adapter/runtime.js";
4
+ import { getPhysicsEngine, PhysicsSystemTag, } from "../adapter/engine.js";
5
+ import { PhysicsCoreModule } from "../core/module.js";
6
+ import { resolveBodyId } from "../util/resolve_body.js";
7
+ export class ImpulseAccumulateModule extends Module {
8
+ init() {
9
+ const world = this.world;
10
+ world.module(PhysicsCoreModule);
11
+ const engine = getPhysicsEngine(world);
12
+ world.component(Impulse).onSet((entity, impulse) => {
13
+ const bodyId = resolveBodyId(entity);
14
+ if (bodyId === undefined) {
15
+ return;
16
+ }
17
+ engine.impulseEntitiesThisStep.add(entity.eid);
18
+ const accumulator = getLinearAccumulator(engine, bodyId);
19
+ accumulator.x += impulse.x;
20
+ accumulator.y += impulse.y;
21
+ accumulator.wake || (accumulator.wake = impulse.wake);
22
+ });
23
+ world.component(AngularImpulse).onSet((entity, impulse) => {
24
+ const bodyId = resolveBodyId(entity);
25
+ if (bodyId === undefined) {
26
+ return;
27
+ }
28
+ engine.impulseEntitiesThisStep.add(entity.eid);
29
+ const accumulator = getAngularAccumulator(engine, bodyId);
30
+ accumulator.value += impulse.value;
31
+ accumulator.wake || (accumulator.wake = impulse.wake);
32
+ });
33
+ world
34
+ .system("PhysicsImpulseAccumulate")
35
+ .phase(engine.phases.preStep)
36
+ .run(() => {
37
+ drainLinearImpulses(engine);
38
+ drainAngularImpulses(engine);
39
+ })
40
+ .add(PhysicsSystemTag);
41
+ }
42
+ }
43
+ function drainLinearImpulses(engine) {
44
+ for (const [bodyId, impulse] of engine.pendingLinearImpulse) {
45
+ if (!engine.entityByBodyIndex.has(bodyId.index1)) {
46
+ continue;
47
+ }
48
+ const vec = scr_b2Vec2[0];
49
+ vec.Set(impulse.x, impulse.y);
50
+ engine.box2d.b2Body_ApplyLinearImpulseToCenter(bodyId, vec, impulse.wake);
51
+ }
52
+ engine.pendingLinearImpulse.clear();
53
+ }
54
+ function drainAngularImpulses(engine) {
55
+ for (const [bodyId, impulse] of engine.pendingAngularImpulse) {
56
+ if (!engine.entityByBodyIndex.has(bodyId.index1)) {
57
+ continue;
58
+ }
59
+ engine.box2d.b2Body_ApplyAngularImpulse(bodyId, impulse.value, impulse.wake);
60
+ }
61
+ engine.pendingAngularImpulse.clear();
62
+ }
63
+ function getLinearAccumulator(engine, bodyId) {
64
+ let accumulator = engine.pendingLinearImpulse.get(bodyId);
65
+ if (accumulator === undefined) {
66
+ accumulator = { x: 0, y: 0, wake: false };
67
+ engine.pendingLinearImpulse.set(bodyId, accumulator);
68
+ }
69
+ return accumulator;
70
+ }
71
+ function getAngularAccumulator(engine, bodyId) {
72
+ let accumulator = engine.pendingAngularImpulse.get(bodyId);
73
+ if (accumulator === undefined) {
74
+ accumulator = { value: 0, wake: false };
75
+ engine.pendingAngularImpulse.set(bodyId, accumulator);
76
+ }
77
+ return accumulator;
78
+ }
79
+ //# sourceMappingURL=impulses.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"impulses.js","sourceRoot":"","sources":["../../../../src/forces/impulses.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EACL,gBAAgB,EAChB,gBAAgB,GAGjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM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AO,CAAC,IAAI,CAAC,CAAC;IAC/E,CAAC;IACD,MAAM,CAAC,qBAAqB,CAAC,KAAK,EAAE,CAAC;AACvC,CAAC;AAED,SAAS,oBAAoB,CAAC,MAAqB,EAAE,MAAgB;IACnE,IAAI,WAAW,GAAG,MAAM,CAAC,oBAAoB,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC1D,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;QAC9B,WAAW,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;QAC1C,MAAM,CAAC,oBAAoB,CAAC,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IACvD,CAAC;IACD,OAAO,WAAW,CAAC;AACrB,CAAC;AAED,SAAS,qBAAqB,CAAC,MAAqB,EAAE,MAAgB;IACpE,IAAI,WAAW,GAAG,MAAM,CAAC,qBAAqB,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC3D,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;QAC9B,WAAW,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;QACxC,MAAM,CAAC,qBAAqB,CAAC,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IACxD,CAAC;IACD,OAAO,WAAW,CAAC;AACrB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { Module } from "@vworlds/vecs";
2
+ export declare class ForcesModule extends Module {
3
+ init(): void;
4
+ }
@@ -0,0 +1,20 @@
1
+ import { Module } from "@vworlds/vecs";
2
+ import { BodyModule } from "../body/module.js";
3
+ import { PhysicsCoreModule } from "../core/module.js";
4
+ import { AngularImpulse, Force, Impulse, Torque } from "./components.js";
5
+ import { ForceGatherModule } from "./gather.js";
6
+ import { ImpulseAccumulateModule } from "./impulses.js";
7
+ export class ForcesModule extends Module {
8
+ init() {
9
+ const world = this.world;
10
+ world.module(PhysicsCoreModule);
11
+ world.module(BodyModule);
12
+ world.component(Force);
13
+ world.component(Torque);
14
+ world.component(Impulse);
15
+ world.component(AngularImpulse);
16
+ world.module(ForceGatherModule);
17
+ world.module(ImpulseAccumulateModule);
18
+ }
19
+ }
20
+ //# sourceMappingURL=module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"module.js","sourceRoot":"","sources":["../../../../src/forces/module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAExD,MAAM,OAAO,YAAa,SAAQ,MAAM;IAC/B,IAAI;QACT,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACzB,KAAK,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;QAChC,KAAK,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAEzB,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QACvB,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QACxB,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QACzB,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;QAEhC,KAAK,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;QAChC,KAAK,CAAC,MAAM,CAAC,uBAAuB,CAAC,CAAC;IACxC,CAAC;CACF"}
@@ -0,0 +1,4 @@
1
+ import { Module } from "@vworlds/vecs";
2
+ export declare class ImpulseZeroModule extends Module {
3
+ init(): void;
4
+ }
package/forces/zero.js ADDED
@@ -0,0 +1,34 @@
1
+ import { Module } from "@vworlds/vecs";
2
+ import { getPhysicsEngine, PhysicsSystemTag } from "../adapter/engine.js";
3
+ import { PhysicsCoreModule } from "../core/module.js";
4
+ import { AngularImpulse, Impulse } from "./components.js";
5
+ export class ImpulseZeroModule extends Module {
6
+ init() {
7
+ const world = this.world;
8
+ world.module(PhysicsCoreModule);
9
+ const engine = getPhysicsEngine(world);
10
+ world
11
+ .system("PhysicsImpulseZero")
12
+ .phase(engine.phases.postStep)
13
+ .run(() => {
14
+ for (const eid of engine.impulseEntitiesThisStep) {
15
+ const entity = world.getEntity(eid);
16
+ if (entity === undefined) {
17
+ continue;
18
+ }
19
+ const imp = entity.get(Impulse);
20
+ if (imp !== undefined) {
21
+ imp.x = 0;
22
+ imp.y = 0;
23
+ }
24
+ const ai = entity.get(AngularImpulse);
25
+ if (ai !== undefined) {
26
+ ai.value = 0;
27
+ }
28
+ }
29
+ engine.impulseEntitiesThisStep.clear();
30
+ })
31
+ .add(PhysicsSystemTag);
32
+ }
33
+ }
34
+ //# sourceMappingURL=zero.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zero.js","sourceRoot":"","sources":["../../../../src/forces/zero.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE1D,MAAM,OAAO,iBAAkB,SAAQ,MAAM;IACpC,IAAI;QACT,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACzB,KAAK,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;QAEhC,MAAM,MAAM,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC;QACvC,KAAK;aACF,MAAM,CAAC,oBAAoB,CAAC;aAC5B,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC;aAC7B,GAAG,CAAC,GAAG,EAAE;YACR,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,uBAAuB,EAAE,CAAC;gBACjD,MAAM,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;gBACpC,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;oBACzB,SAAS;gBACX,CAAC;gBAED,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,OAAO,CAAwB,CAAC;gBACvD,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;oBACtB,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;oBACV,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;gBACZ,CAAC;gBAED,MAAM,EAAE,GAAG,MAAM,CAAC,GAAG,CAAC,cAAc,CAA+B,CAAC;gBACpE,IAAI,EAAE,KAAK,SAAS,EAAE,CAAC;oBACrB,EAAE,CAAC,KAAK,GAAG,CAAC,CAAC;gBACf,CAAC;YACH,CAAC;YAED,MAAM,CAAC,uBAAuB,CAAC,KAAK,EAAE,CAAC;QACzC,CAAC,CAAC;aACD,GAAG,CAAC,gBAAgB,CAAC,CAAC;IAC3B,CAAC;CACF"}
package/index.d.ts CHANGED
@@ -1,12 +1,13 @@
1
1
  export { PhysicsModule, type PhysicsOptions } from "./module.js";
2
2
  export { preloadPhysics } from "./adapter/runtime.js";
3
- export { Body, BodyType, Position, Rotation, LinearVelocity, AngularVelocity, } from "./components/body.js";
4
- export { Damping, GravityScale, MotionLocks, Sleep } from "./components/body_tuning.js";
5
- export { ShapePosition, ShapeRotation } from "./components/shape_pose.js";
6
- export { Shape, Box, Circle, Capsule, Segment, Polygon, Chain, type Vec2, } from "./components/geometry.js";
7
- export { Material, CollisionFilter, Sensor, Detectable } from "./components/material.js";
8
- export { Force, Torque, Impulse, AngularImpulse } from "./components/force.js";
9
- export { KinematicTargetPosition, KinematicTargetRotation } from "./components/target.js";
10
- export { ContactEvents, type ContactEvent, SensorEvents, type SensorEvent, HitEvents, type HitEvent, } from "./components/events.js";
3
+ export { Body, BodyType, Position, Rotation, LinearVelocity, AngularVelocity, } from "./body/components.js";
4
+ export { Damping, GravityScale, MotionLocks, Sleep } from "./body/tuning.js";
5
+ export { ShapePosition, ShapeRotation } from "./shapes/pose_components.js";
6
+ export { Shape, Box, Circle, Capsule, Segment, Polygon, Chain, type Vec2, } from "./shapes/components.js";
7
+ export { Material, CollisionFilter, Sensor, Detectable } from "./materials/components.js";
8
+ export { Force, Torque, Impulse, AngularImpulse } from "./forces/components.js";
9
+ export { KinematicTargetPosition, KinematicTargetRotation } from "./kinematic/components.js";
10
+ export { Joint, JointBodyA, JointBodyB, JointFrame, RevoluteJoint, DistanceJoint, WeldJoint, FilterJoint, JointMotor, JointLimit, JointLinearSpring, JointAngularSpring, JointSettings, } from "./joints/components.js";
11
+ export { ContactEvents, type ContactEvent, SensorEvents, type SensorEvent, HitEvents, type HitEvent, } from "./events/components.js";
11
12
  export { physics } from "./adapter/queries.js";
12
13
  export type { PhysicsQueries, QueryFilter, RayHit } from "./adapter/queries.js";
package/index.js CHANGED
@@ -5,21 +5,23 @@
5
5
  export { PhysicsModule } from "./module.js";
6
6
  export { preloadPhysics } from "./adapter/runtime.js";
7
7
  // Body
8
- export { Body, BodyType, Position, Rotation, LinearVelocity, AngularVelocity, } from "./components/body.js";
8
+ export { Body, BodyType, Position, Rotation, LinearVelocity, AngularVelocity, } from "./body/components.js";
9
9
  // Body tunables
10
- export { Damping, GravityScale, MotionLocks, Sleep } from "./components/body_tuning.js";
10
+ export { Damping, GravityScale, MotionLocks, Sleep } from "./body/tuning.js";
11
11
  // Shape pose
12
- export { ShapePosition, ShapeRotation } from "./components/shape_pose.js";
12
+ export { ShapePosition, ShapeRotation } from "./shapes/pose_components.js";
13
13
  // Geometry
14
- export { Shape, Box, Circle, Capsule, Segment, Polygon, Chain, } from "./components/geometry.js";
14
+ export { Shape, Box, Circle, Capsule, Segment, Polygon, Chain, } from "./shapes/components.js";
15
15
  // Material / filter / sensor
16
- export { Material, CollisionFilter, Sensor, Detectable } from "./components/material.js";
16
+ export { Material, CollisionFilter, Sensor, Detectable } from "./materials/components.js";
17
17
  // Forces & impulses
18
- export { Force, Torque, Impulse, AngularImpulse } from "./components/force.js";
18
+ export { Force, Torque, Impulse, AngularImpulse } from "./forces/components.js";
19
19
  // Kinematic targets
20
- export { KinematicTargetPosition, KinematicTargetRotation } from "./components/target.js";
20
+ export { KinematicTargetPosition, KinematicTargetRotation } from "./kinematic/components.js";
21
+ // Joints
22
+ export { Joint, JointBodyA, JointBodyB, JointFrame, RevoluteJoint, DistanceJoint, WeldJoint, FilterJoint, JointMotor, JointLimit, JointLinearSpring, JointAngularSpring, JointSettings, } from "./joints/components.js";
21
23
  // Events
22
- export { ContactEvents, SensorEvents, HitEvents, } from "./components/events.js";
24
+ export { ContactEvents, SensorEvents, HitEvents, } from "./events/components.js";
23
25
  // Queries
24
26
  export { physics } from "./adapter/queries.js";
25
27
  //# sourceMappingURL=index.js.map
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,gFAAgF;AAChF,uBAAuB;AAEvB,cAAc;AACd,OAAO,EAAE,aAAa,EAAuB,MAAM,aAAa,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO;AACP,OAAO,EACL,IAAI,EACJ,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,cAAc,EACd,eAAe,GAChB,MAAM,sBAAsB,CAAC;AAE9B,gBAAgB;AAChB,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAExF,aAAa;AACb,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,4BAA4B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;AAC7B,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAE1F,oBAAoB;AACpB,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAEhF,oBAAoB;AACpB,OAAO,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAE7F,SAAS;AACT,OAAO,EACL,KAAK,EACL,UAAU,EACV,UAAU,EACV,UAAU,EACV,aAAa,EACb,aAAa,EACb,SAAS,EACT,WAAW,EACX,UAAU,EACV,UAAU,EACV,iBAAiB,EACjB,kBAAkB,EAClB,aAAa,GACd,MAAM,wBAAwB,CAAC;AAEhC,SAAS;AACT,OAAO,EACL,aAAa,EAEb,YAAY,EAEZ,SAAS,GAEV,MAAM,wBAAwB,CAAC;AAEhC,UAAU;AACV,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,116 @@
1
+ import { Relationship } from "@vworlds/vecs";
2
+ import type { Vec2 } from "../shapes/components.js";
3
+ /**
4
+ * Empty umbrella marker for every concrete joint type. A joint entity carries
5
+ * exactly one of `RevoluteJoint`, `DistanceJoint`, `WeldJoint`, or `FilterJoint`;
6
+ * each implements `Joint` so queries and systems can match any joint without
7
+ * enumerating every concrete type. Holds the single Box2D handle, since every
8
+ * joint type maps to exactly one `b2JointId`.
9
+ */
10
+ export declare abstract class Joint {
11
+ }
12
+ /**
13
+ * Relationship to the first connected body ("body A"). Set its `target` to the
14
+ * body entity. Destroying body A destroys the joint entity (Box2D destroys a
15
+ * body's joints with it). Anchors/limits/reference angle are expressed relative
16
+ * to A through {@link JointFrame}.
17
+ */
18
+ export declare class JointBodyA extends Relationship {
19
+ }
20
+ /**
21
+ * Relationship to the second connected body ("body B"). Set its `target` to the
22
+ * body entity. Destroying body B destroys the joint entity. The A/B roles are
23
+ * asymmetric: motors drive B relative to A and the reference angle is measured as
24
+ * B's rest angle relative to A.
25
+ */
26
+ export declare class JointBodyB extends Relationship {
27
+ }
28
+ /**
29
+ * Where the joint attaches on each body and the bodies' rest orientation.
30
+ * `localAnchorA`/`localAnchorB` are anchor points in each body's local frame;
31
+ * `referenceAngle` is body B's angle relative to body A at rest (radians).
32
+ *
33
+ * Optional: a missing `JointFrame` anchors both bodies at their origins with a
34
+ * zero reference angle. `DistanceJoint` ignores `referenceAngle`.
35
+ */
36
+ export declare class JointFrame {
37
+ localAnchorA: Vec2;
38
+ localAnchorB: Vec2;
39
+ referenceAngle: number;
40
+ }
41
+ /**
42
+ * Revolute (hinge) joint: pins the two bodies at a shared anchor and lets them
43
+ * rotate relative to each other. Add {@link JointMotor} to drive the rotation,
44
+ * {@link JointLimit} to clamp the angle (radians, relative to the reference
45
+ * angle), or {@link JointAngularSpring} for a soft rest angle.
46
+ */
47
+ export declare class RevoluteJoint extends Joint {
48
+ }
49
+ /**
50
+ * Distance joint: keeps the two anchor points a fixed `length` apart (a rigid
51
+ * rod by default). Add {@link JointLinearSpring} to make it springy,
52
+ * {@link JointLimit} to bound the separation (`lower`/`upper` become min/max
53
+ * length), or {@link JointMotor} to drive the length.
54
+ */
55
+ export declare class DistanceJoint extends Joint {
56
+ length: number;
57
+ }
58
+ /**
59
+ * Weld joint: rigidly fixes the two bodies' relative position and orientation
60
+ * (at the reference angle). Add {@link JointLinearSpring} and/or
61
+ * {@link JointAngularSpring} to make the weld soft along each axis.
62
+ */
63
+ export declare class WeldJoint extends Joint {
64
+ }
65
+ /**
66
+ * Filter joint: disables collision between the two connected bodies without
67
+ * otherwise constraining them. Carries no tunables; motor/limit/spring features
68
+ * do not apply.
69
+ */
70
+ export declare class FilterJoint extends Joint {
71
+ }
72
+ /**
73
+ * Optional motor feature. Present = motor enabled. Drives the joint toward
74
+ * `targetSpeed` (rad/s for revolute, m/s for distance) bounded by `maxForce`
75
+ * (interpreted as a torque for angular joints). Applies to `RevoluteJoint` and
76
+ * `DistanceJoint`.
77
+ */
78
+ export declare class JointMotor {
79
+ targetSpeed: number;
80
+ maxForce: number;
81
+ }
82
+ /**
83
+ * Optional limit feature. Present = limit enabled. `lower`/`upper` are an angle
84
+ * range (radians) for `RevoluteJoint` and a length range (meters) for
85
+ * `DistanceJoint`.
86
+ */
87
+ export declare class JointLimit {
88
+ lower: number;
89
+ upper: number;
90
+ }
91
+ /**
92
+ * Optional linear spring feature (soft constraint along the joint's linear axis).
93
+ * Present = spring enabled. `hertz` is the stiffness frequency, `dampingRatio`
94
+ * the damping. Applies to `DistanceJoint` and the linear axis of `WeldJoint`.
95
+ */
96
+ export declare class JointLinearSpring {
97
+ hertz: number;
98
+ dampingRatio: number;
99
+ }
100
+ /**
101
+ * Optional angular spring feature (soft constraint on the relative angle).
102
+ * Present = spring enabled. Applies to `RevoluteJoint` and the angular axis of
103
+ * `WeldJoint`. Split from {@link JointLinearSpring} so a weld can carry both at
104
+ * once.
105
+ */
106
+ export declare class JointAngularSpring {
107
+ hertz: number;
108
+ dampingRatio: number;
109
+ }
110
+ /**
111
+ * Optional base-joint settings. `collideConnected` lets the two connected bodies
112
+ * still collide with each other (off by default). Missing = Box2D defaults.
113
+ */
114
+ export declare class JointSettings {
115
+ collideConnected: boolean;
116
+ }