@khr3/launchers 0.2.9 → 0.3.1

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 (107) hide show
  1. package/AGENTS.md +3 -3
  2. package/CLAUDE.md +1 -5
  3. package/LICENSE +1 -1
  4. package/README.md +39 -32
  5. package/dist/KhrLauncher.d.ts +46 -0
  6. package/dist/KhrLauncher.js +316 -0
  7. package/dist/KhrLauncher.js.map +1 -0
  8. package/dist/armory/engine/assemblyVerifier.d.ts +48 -0
  9. package/dist/armory/engine/assemblyVerifier.js +443 -0
  10. package/dist/armory/engine/assemblyVerifier.js.map +1 -0
  11. package/dist/armory/engine/audioSynth.d.ts +26 -0
  12. package/dist/armory/engine/audioSynth.js +256 -0
  13. package/dist/armory/engine/audioSynth.js.map +1 -0
  14. package/dist/armory/engine/ballistics.d.ts +125 -0
  15. package/dist/armory/engine/ballistics.js +399 -0
  16. package/dist/armory/engine/ballistics.js.map +1 -0
  17. package/dist/armory/engine/bvhExploder.d.ts +43 -0
  18. package/dist/armory/engine/bvhExploder.js +326 -0
  19. package/dist/armory/engine/bvhExploder.js.map +1 -0
  20. package/dist/armory/engine/dispose.d.ts +6 -0
  21. package/dist/armory/engine/dispose.js +54 -0
  22. package/dist/armory/engine/dispose.js.map +1 -0
  23. package/dist/armory/engine/glbPhysicsExporter.d.ts +116 -0
  24. package/dist/armory/engine/glbPhysicsExporter.js +1960 -0
  25. package/dist/armory/engine/glbPhysicsExporter.js.map +1 -0
  26. package/dist/armory/engine/jointGraph.d.ts +5 -0
  27. package/dist/armory/engine/jointGraph.js +50 -0
  28. package/dist/armory/engine/jointGraph.js.map +1 -0
  29. package/dist/armory/engine/materials.d.ts +87 -0
  30. package/dist/armory/engine/materials.js +1089 -0
  31. package/dist/armory/engine/materials.js.map +1 -0
  32. package/dist/armory/engine/meshSegmenter.d.ts +44 -0
  33. package/dist/armory/engine/meshSegmenter.js +527 -0
  34. package/dist/armory/engine/meshSegmenter.js.map +1 -0
  35. package/dist/armory/engine/orthoExtruder.d.ts +33 -0
  36. package/dist/armory/engine/orthoExtruder.js +549 -0
  37. package/dist/armory/engine/orthoExtruder.js.map +1 -0
  38. package/dist/armory/engine/parts/boltRifleBuilder.d.ts +16 -0
  39. package/dist/armory/engine/parts/boltRifleBuilder.js +233 -0
  40. package/dist/armory/engine/parts/boltRifleBuilder.js.map +1 -0
  41. package/dist/armory/engine/parts/cadKernel.d.ts +39 -0
  42. package/dist/armory/engine/parts/cadKernel.js +367 -0
  43. package/dist/armory/engine/parts/cadKernel.js.map +1 -0
  44. package/dist/armory/engine/parts/fireControlGroup.d.ts +29 -0
  45. package/dist/armory/engine/parts/fireControlGroup.js +428 -0
  46. package/dist/armory/engine/parts/fireControlGroup.js.map +1 -0
  47. package/dist/armory/engine/parts/magazineBuilder.d.ts +14 -0
  48. package/dist/armory/engine/parts/magazineBuilder.js +146 -0
  49. package/dist/armory/engine/parts/magazineBuilder.js.map +1 -0
  50. package/dist/armory/engine/parts/muzzleDevices.d.ts +8 -0
  51. package/dist/armory/engine/parts/muzzleDevices.js +72 -0
  52. package/dist/armory/engine/parts/muzzleDevices.js.map +1 -0
  53. package/dist/armory/engine/parts/picatinnyRail.d.ts +49 -0
  54. package/dist/armory/engine/parts/picatinnyRail.js +474 -0
  55. package/dist/armory/engine/parts/picatinnyRail.js.map +1 -0
  56. package/dist/armory/engine/parts/pistolVariants.d.ts +28 -0
  57. package/dist/armory/engine/parts/pistolVariants.js +318 -0
  58. package/dist/armory/engine/parts/pistolVariants.js.map +1 -0
  59. package/dist/armory/engine/parts/revolverBuilder.d.ts +49 -0
  60. package/dist/armory/engine/parts/revolverBuilder.js +475 -0
  61. package/dist/armory/engine/parts/revolverBuilder.js.map +1 -0
  62. package/dist/armory/engine/proceduralGeometry.d.ts +113 -0
  63. package/dist/armory/engine/proceduralGeometry.js +1591 -0
  64. package/dist/armory/engine/proceduralGeometry.js.map +1 -0
  65. package/dist/armory/engine/renderState.d.ts +2 -0
  66. package/dist/armory/engine/renderState.js +20 -0
  67. package/dist/armory/engine/renderState.js.map +1 -0
  68. package/dist/armory/engine/simSolver.d.ts +127 -0
  69. package/dist/armory/engine/simSolver.js +736 -0
  70. package/dist/armory/engine/simSolver.js.map +1 -0
  71. package/dist/armory/engine/weaponSpecs.d.ts +277 -0
  72. package/dist/armory/engine/weaponSpecs.js +1311 -0
  73. package/dist/armory/engine/weaponSpecs.js.map +1 -0
  74. package/dist/armory/engine/webglContext.d.ts +1 -0
  75. package/dist/armory/engine/webglContext.js +14 -0
  76. package/dist/armory/engine/webglContext.js.map +1 -0
  77. package/dist/armory/types/physicsSchema.d.ts +205 -0
  78. package/dist/armory/types/physicsSchema.js +2 -0
  79. package/dist/armory/types/physicsSchema.js.map +1 -0
  80. package/dist/index.d.ts +7 -0
  81. package/dist/index.js +8 -0
  82. package/dist/index.js.map +1 -1
  83. package/dist/inertia.d.ts +3 -9
  84. package/dist/inertia.js +6 -6
  85. package/dist/inertia.js.map +1 -1
  86. package/dist/launcherKhr.d.ts +3 -9
  87. package/dist/launcherKhr.js +3 -15
  88. package/dist/launcherKhr.js.map +1 -1
  89. package/dist/launcherParts.d.ts +3 -8
  90. package/dist/launcherParts.js +19 -39
  91. package/dist/launcherParts.js.map +1 -1
  92. package/dist/react.d.ts +3 -0
  93. package/dist/react.js +4 -0
  94. package/dist/react.js.map +1 -0
  95. package/dist/recipes.d.ts +18 -12
  96. package/dist/recipes.js +103 -2
  97. package/dist/recipes.js.map +1 -1
  98. package/dist/runtime.js +3 -2
  99. package/dist/runtime.js.map +1 -1
  100. package/dist/schema.d.ts +2 -1
  101. package/dist/schema.js +18 -0
  102. package/dist/schema.js.map +1 -1
  103. package/dist/three.d.ts +54 -0
  104. package/dist/three.js +58 -0
  105. package/dist/three.js.map +1 -0
  106. package/docs/api-reference.md +49 -299
  107. package/package.json +63 -8
package/AGENTS.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # `@khr3/launchers` (`khr3-launchers`) — Agent & Contributor Guide
2
2
 
3
- - **Zero Dependencies**: Keep `@khr3/launchers` zero-dependency pure TypeScript ESM (`koota` and `three` free).
4
- - **Articulated KHR Physics & Cycle FSM**: `planLauncher` computes exact parallel-axis mass and Jacobi-diagonalized principal inertia (`inertiaDiagonal` + right-handed `inertiaOrientation`) on `Receiver_Root` with prismatic/revolute `KHR_physics_rigid_bodies` joints (`Bolt`, `Trigger`, `Pump`), rail/character sockets, SI `DEFAULT_AMMO_CATALOG`, and deterministic `stepLauncher` state transitions.
5
- - **Module Hygiene & Verification**: Keep every file in `src/` `<= 250` lines, keep [README.md](./README.md) and [docs/api-reference.md](./docs/api-reference.md) aligned with exports, and verify with `npm run typecheck && npm test && npm run build`.
3
+ - **Zero-Dependency Root (`.`)**: Keep `@khr3/launchers` (`src/index.ts`) zero-dependency pure TypeScript ESM (`three`, `react`, and `koota` free): KHR moving-part planner (`planLauncher`), Jacobi principal inertia, SI `DEFAULT_AMMO_CATALOG`, `stepLauncher` cycle FSM, and the 240Hz `khr-armory` mechanism & ballistics solver.
4
+ - **Procedural 3D Armory (`./three`) & R3F Glue (`./react`)**: `@khr3/launchers/three` (`src/three.ts`) synthesizes all 7 modular 3D launcher rigs (`pistol`, `revolver`, `smg`, `bolt-rifle`, `shotgun`, `rotary-gl`, `rpg`), 8-stage ammo LODs, and validated `@khr3/core` `KhrAssetBundle`s (`loadArmoryLauncherBundle`). `@khr3/launchers/react` (`src/KhrLauncher.tsx`) mounts directly onto `@khr3/body/react` `<HeldItem>` at priority `0` in `useFrame` with zero Rapier impulse joints and zero per-frame allocations.
5
+ - **Verification**: Keep [README.md](./README.md) and [docs/api-reference.md](./docs/api-reference.md) aligned with exports, and verify with `npm run typecheck && npm test && npm run build`.
package/CLAUDE.md CHANGED
@@ -1,5 +1 @@
1
- @AGENTS.md
2
-
3
- # `@khr3/launchers` (`khr3-launchers`) — Claude Code Guide
4
-
5
- Follow [AGENTS.md](./AGENTS.md), [README.md](./README.md), and [docs/api-reference.md](./docs/api-reference.md). Keep `@khr3/launchers` zero-dependency, keep `src/` modules `<= 250` lines, and verify with `npm run typecheck && npm test && npm run build`.
1
+ See [AGENTS.md](./AGENTS.md) and [docs/api-reference.md](./docs/api-reference.md).
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2026 khr3 contributors
3
+ Copyright (c) 2026 Nat Howard
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,32 +1,21 @@
1
1
  # `@khr3/launchers`
2
2
 
3
- Zero-dependency KHR articulated launcher moving-part planner (`receiver`, `bolt`, `pump`, `trigger`, `magazine`, `barrel`, `stock`, `screen_rect`), rail and character mount sockets, SI ammo catalog, and deterministic cycle state machine for `@khr3/core` and `Kolmo`.
3
+ Zero-dependency KHR articulated launcher planner & 240Hz mechanism/ballistics solver (`@khr3/launchers`), procedural 3D armory `.glb` & multi-LOD ammo synthesizer (`@khr3/launchers/three`), and React Three Fiber `<KhrLauncher>` view-model / socket rig (`@khr3/launchers/react`) layered directly on `@khr3/core`, `@khr3/body`, and `@pinkaphant/ecctrl`.
4
4
 
5
- - **Zero dependencies & zero `koota`**: Pure TypeScript ESM with `.d.ts` declarations.
6
- - **Articulated KHR physics output**: `planLauncher(recipe)` lumps fixed parts and mounted rail attachments into `Receiver_Root` — diagonalizing the full 3x3 parallel-axis inertia tensor into `inertiaDiagonal` + right-handed `inertiaOrientation` quaternion (`[qx, qy, qz, qw]`) — and emits prismatic/revolute `KHR_physics_rigid_bodies` joints with critically damped spring drives for `Bolt`, `Trigger`, and `Pump`.
5
+ ## Subpath Exports
7
6
 
8
- - Full API & integration reference: [docs/api-reference.md](./docs/api-reference.md)
9
- - Runnable example: [example/index.ts](./example/index.ts)
10
- - Source modules: [src/schema.ts](./src/schema.ts), [src/runtime.ts](./src/runtime.ts), [src/launcherParts.ts](./src/launcherParts.ts), [src/inertia.ts](./src/inertia.ts), [src/launcherKhr.ts](./src/launcherKhr.ts), [src/recipes.ts](./src/recipes.ts)
11
-
12
- ## Install
13
-
14
- ```sh
15
- npm install @khr3/launchers
16
- ```
17
-
18
- ## Main Exports
19
-
20
- | Area | Exports |
7
+ | Path | Main Exports |
21
8
  | --- | --- |
22
- | **Schema & Ammo** | `LAUNCHER_PART_ROLES`, `LAUNCHER_SOCKETS`, `RAIL_SOCKETS`, `CHARACTER_SOCKETS`, `DEFAULT_AMMO_CATALOG` (`pistol`, `rifle`, `shells_12g`, `laser`, `orb`, `rocket`), `validateLauncherSpec` |
23
- | **Recipes & Multi-Body Planner** | `PISTOL_9MM`, `SMG_9MM`, `CARBINE_556`, `SHOTGUN_12G`, `RPG_LAUNCHER` (aliases for `KOLMOGOROV_PISTOL`, `KOLMOGOROV_SMG`, `KOLMOGOROV_CARBINE`, `KOLMOGOROV_SHOTGUN`, `KOLMOGOROV_RPG`), `LAUNCHER_RECIPES`, `findLauncherRecipe`, `buildLauncherParts`, `resolveLauncherSockets`, `sumLauncherBoxes`, `diagonalizeInertiaTensor`, `planLauncher` (`CARBINE_556` / `KOLMOGOROV_CARBINE` is synthesized offline via `planLauncher` with no R2 `.glb` required; `LauncherRecipe.r2Key` is optional external metadata) |
24
- | **Deterministic Runtime** | `createLauncherState`, `stepLauncher`, `attachModule`, `detachModule` (fractional cooldown carry, smooth `C1` bolt/pump cycle curve, magazine depletion, timed or instant reload, recoil impulse, rail attachments) |
9
+ | `@khr3/launchers` | **Zero-dependency pure TypeScript**: `LAUNCHER_RECIPES` (`PISTOL_9MM`, `REVOLVER_44`, `SMG_9MM`, `CARBINE_556`, `BOLT_RIFLE_762`, `SHOTGUN_12G`, `ROTARY_GL_40MM`, `RPG_LAUNCHER`), `DEFAULT_AMMO_CATALOG`, `planLauncher`, `createLauncherState`, `stepLauncher`, `WEAPON_ARCHETYPES`, `WEAPON_CATALOG`, `DEFAULT_LOADOUT`, `DEFAULT_TUNING`, 240Hz `advanceFixedSimulation`, `sweepProjectileStep`, and `audioSynth`. |
10
+ | `@khr3/launchers/three` | **Procedural 3D Armory & KHR `.glb` Bundles** (`three` + `@khr3/core`): `buildArmoryWeaponRig`, `loadArmoryLauncherBundle` (`+Z` actor hand or `-Z` 1st-person camera space), `buildWeaponKhrGlbBuffer`, `buildAmmoLodChain` (`20-gon -> 2-gon`), `createArmoryMaterials`, `buildTaggedExternalKhrGlbBuffer`, and `captureWeaponSideBlueprint`. |
11
+ | `@khr3/launchers/react` | **R3F `<KhrLauncher>` HeldItem Rig** (`@khr3/body/react` + `@khr3/core`): Priority-`0` `useFrame` ref-driven launcher mounting onto `<KhrBody>` (`Socket_Hand_R`), driving articulated slide/bolt/pump/trigger/hammer joints via `JointRegistryContext` with zero Rapier impulse joints, `Socket_AdsEye` sight alignment, locomotion sway, and recoil kick. |
12
+
13
+ ## Quick Start
25
14
 
26
- ## 1. Plan an Articulated KHR3 Launcher `.glb`
15
+ ### 1. Zero-Dependency Planner & Cycle Solver (`@khr3/launchers`)
27
16
 
28
17
  ```ts
29
- import { CARBINE_556, attachModule, planLauncher } from "@khr3/launchers";
18
+ import { CARBINE_556, DEFAULT_AMMO_CATALOG, attachModule, createLauncherState, planLauncher, stepLauncher } from "@khr3/launchers";
30
19
 
31
20
  const equipped = {
32
21
  ...CARBINE_556,
@@ -34,22 +23,40 @@ const equipped = {
34
23
  };
35
24
 
36
25
  const plan = planLauncher(equipped);
37
- // plan.nodes -> scene hierarchy (Receiver_Root + articulated Bolt/Trigger + authored Socket_* nodes)
38
- // plan.specs -> KhrLauncherNodeSpecLike rigid bodies, colliders, and prismatic/revolute joints
39
- // plan.inertiaDiagonal -> principal moments [I1, I2, I3] in kg*m^2
40
- // plan.inertiaOrientation -> unit quaternion [qx, qy, qz, qw] (R * diag(I) * R^T === T)
26
+ const state = createLauncherState(equipped.spec);
27
+ const ev = stepLauncher(state, { trigger: true, reload: false }, 1 / 60);
41
28
  ```
42
29
 
43
- ## 2. Step the Deterministic Launch & Reload Cycle
30
+ ### 2. Procedural 3D Armory `.glb` Bundle (`@khr3/launchers/three`)
44
31
 
45
32
  ```ts
46
- import { DEFAULT_AMMO_CATALOG, PISTOL_9MM, createLauncherState, stepLauncher } from "@khr3/launchers";
33
+ import { loadArmoryLauncherBundle } from "@khr3/launchers/three";
47
34
 
48
- const state = createLauncherState(PISTOL_9MM.spec);
49
- const ev = stepLauncher(state, { trigger: true, reload: false }, 1 / 60);
35
+ const { bundle, validation } = await loadArmoryLauncherBundle("shotgun", {
36
+ loadout: { optic: "red-dot", underbarrel: "laser-lam" },
37
+ forwardAxis: "-Z",
38
+ });
39
+ ```
40
+
41
+ ### 3. Embodied R3F First-Person Body + Launcher (`@khr3/launchers/react`)
50
42
 
51
- if (ev) {
52
- const ammo = DEFAULT_AMMO_CATALOG[ev.ammoId];
53
- // Spawn projectile at `ev.muzzleLocal` with `ammo.muzzleSpeedMs` and apply `ev.recoilImpulseNs`
43
+ ```tsx
44
+ import { PhysicsWorld } from "@khr3/core";
45
+ import { KhrBody, type KhrBodyHandle } from "@khr3/body/react";
46
+ import { KhrLauncher, type KhrLauncherHandle } from "@khr3/launchers/react";
47
+ import { useRef } from "react";
48
+
49
+ export function PlayerWithLauncher() {
50
+ const bodyRef = useRef<KhrBodyHandle>(null);
51
+ const launcherRef = useRef<KhrLauncherHandle>(null);
52
+
53
+ return (
54
+ <PhysicsWorld>
55
+ <KhrBody ref={bodyRef} />
56
+ <KhrLauncher ref={launcherRef} archetypeId="smg" bodyRef={bodyRef} sound />
57
+ </PhysicsWorld>
58
+ );
54
59
  }
55
60
  ```
61
+
62
+ - Full API Reference: [docs/api-reference.md](./docs/api-reference.md)
@@ -0,0 +1,46 @@
1
+ import { type BodySocketId, type HeldItemHandle, type KhrBodyHandle } from "@khr3/body/react";
2
+ import { type KhrAssetBundle } from "@khr3/core";
3
+ import { type Ref, type RefObject } from "react";
4
+ import * as THREE from "three";
5
+ import { type FixedArmorySimState } from "./armory/engine/simSolver.js";
6
+ import type { ExportForwardAxis, ModularLoadout, PhysicsTuning, WeaponArchetypeId } from "./armory/types/physicsSchema.js";
7
+ export interface KhrLauncherShotInfo {
8
+ readonly archetypeId: WeaponArchetypeId;
9
+ readonly shotsFired: number;
10
+ readonly magAmmo: number;
11
+ readonly magCapacity: number;
12
+ readonly muzzleOrigin: readonly [number, number, number];
13
+ readonly muzzleDirection: readonly [number, number, number];
14
+ }
15
+ export interface KhrLauncherHandle {
16
+ readonly archetypeId: WeaponArchetypeId;
17
+ readonly bundle: KhrAssetBundle | null;
18
+ readonly heldItem: HeldItemHandle | null;
19
+ readonly simState: FixedArmorySimState;
20
+ readonly offsetGroup: THREE.Group;
21
+ fireOnce(): boolean;
22
+ setFullAuto(active: boolean): void;
23
+ rack(): void;
24
+ reload(): boolean;
25
+ setAds(ads: boolean): void;
26
+ getMuzzleWorldRay(originOut: THREE.Vector3, directionOut: THREE.Vector3): boolean;
27
+ }
28
+ export interface KhrLauncherProps {
29
+ readonly ref?: Ref<KhrLauncherHandle>;
30
+ readonly archetypeId?: WeaponArchetypeId;
31
+ /** Optional pre-loaded `@khr3/core` bundle; when omitted, synthesizes `archetypeId` procedurally. */
32
+ readonly bundle?: KhrAssetBundle | null;
33
+ readonly loadout?: Partial<ModularLoadout>;
34
+ readonly tuning?: Partial<PhysicsTuning>;
35
+ readonly socket?: BodySocketId;
36
+ readonly bodyRef?: RefObject<KhrBodyHandle | null>;
37
+ readonly parentSocketObject?: THREE.Object3D | null;
38
+ readonly forwardAxis?: ExportForwardAxis;
39
+ readonly ads?: boolean;
40
+ readonly sound?: boolean;
41
+ readonly enableSway?: boolean;
42
+ readonly visible?: boolean;
43
+ readonly onFire?: (shot: KhrLauncherShotInfo) => void;
44
+ readonly onBundleReady?: (bundle: KhrAssetBundle) => void;
45
+ }
46
+ export declare function KhrLauncher({ ref, archetypeId, bundle: externalBundle, loadout: loadoutPatch, tuning: tuningPatch, socket, bodyRef, parentSocketObject, forwardAxis, ads, sound, enableSway, visible, onFire, onBundleReady, }: KhrLauncherProps): import("react").JSX.Element | null;
@@ -0,0 +1,316 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { HeldItem } from "@khr3/body/react";
3
+ import { disposeKhrBundle } from "@khr3/core";
4
+ import { useFrame } from "@react-three/fiber";
5
+ import { useEffect, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState } from "react";
6
+ import * as THREE from "three";
7
+ import { audioSynth } from "./armory/engine/audioSynth.js";
8
+ import { advanceFixedSimulation, createEmptySimEvents, createInitialSimState, triggerSimFire, triggerSimRack, triggerSimReload, } from "./armory/engine/simSolver.js";
9
+ import { DEFAULT_LOADOUT, DEFAULT_TUNING, WEAPON_ARCHETYPES } from "./armory/engine/weaponSpecs.js";
10
+ import { loadArmoryLauncherBundle } from "./three.js";
11
+ const NO_RAYCAST = () => null;
12
+ const DRIVEN_ROLES = [
13
+ "slide_blowback",
14
+ "pump_action",
15
+ "trigger",
16
+ "trigger_bar",
17
+ "sear",
18
+ "chamber_breech",
19
+ "magazine_well",
20
+ "hammer",
21
+ ];
22
+ const _muzzleWorldPos = new THREE.Vector3();
23
+ const _muzzleWorldQuat = new THREE.Quaternion();
24
+ const _muzzleForward = new THREE.Vector3();
25
+ export function KhrLauncher({ ref, archetypeId = "pistol", bundle: externalBundle, loadout: loadoutPatch, tuning: tuningPatch, socket = "Socket_Hand_R", bodyRef, parentSocketObject, forwardAxis = "-Z", ads = false, sound = false, enableSway = true, visible = true, onFire, onBundleReady, }) {
26
+ const heldRef = useRef(null);
27
+ const [generatedBundle, setGeneratedBundle] = useState(null);
28
+ // Imperative Three.js offset & muzzle-flash rig (exists synchronously on frame 0, zero R3F JSX reconciler churn)
29
+ const { offsetGroup, muzzleFlash, disposeVisuals } = useMemo(() => {
30
+ const grp = new THREE.Group();
31
+ grp.name = `KhrLauncher_Offset_${socket}`;
32
+ const flashGeo = new THREE.OctahedronGeometry(0.036, 0);
33
+ const flashMat = new THREE.MeshBasicMaterial({ color: 0xfde047 });
34
+ const flash = new THREE.Mesh(flashGeo, flashMat);
35
+ flash.name = "KhrLauncher_MuzzleFlash";
36
+ flash.visible = false;
37
+ flash.frustumCulled = false;
38
+ flash.raycast = NO_RAYCAST;
39
+ grp.add(flash);
40
+ return {
41
+ offsetGroup: grp,
42
+ muzzleFlash: flash,
43
+ disposeVisuals: () => {
44
+ if (grp.parent)
45
+ grp.parent.remove(grp);
46
+ flashGeo.dispose();
47
+ flashMat.dispose();
48
+ },
49
+ };
50
+ }, [socket]);
51
+ useEffect(() => disposeVisuals, [disposeVisuals]);
52
+ const loadout = useMemo(() => ({ ...DEFAULT_LOADOUT, ...loadoutPatch }), [loadoutPatch]);
53
+ const tuning = useMemo(() => ({ ...DEFAULT_TUNING, ...tuningPatch }), [tuningPatch]);
54
+ const loadoutRef = useRef(loadout);
55
+ loadoutRef.current = loadout;
56
+ const tuningRef = useRef(tuning);
57
+ tuningRef.current = tuning;
58
+ const soundRef = useRef(sound);
59
+ soundRef.current = sound;
60
+ const onFireRef = useRef(onFire);
61
+ onFireRef.current = onFire;
62
+ const onReadyRef = useRef(onBundleReady);
63
+ onReadyRef.current = onBundleReady;
64
+ const adsRef = useRef(ads);
65
+ adsRef.current = ads;
66
+ const adsBlendRef = useRef(ads ? 1 : 0);
67
+ const recoilRef = useRef(0);
68
+ const bobPhaseRef = useRef(0);
69
+ const flashTimerRef = useRef(0);
70
+ const eventsScratchRef = useRef(createEmptySimEvents());
71
+ const shotOriginRef = useRef({
72
+ muzzlePos: [0, 0.022, forwardAxis === "-Z" ? -0.2 : 0.2],
73
+ muzzleDir: [0, 0, forwardAxis === "-Z" ? -1 : 1],
74
+ });
75
+ const simStateRef = useRef(createInitialSimState(archetypeId, loadout));
76
+ useEffect(() => {
77
+ simStateRef.current = createInitialSimState(archetypeId, loadout);
78
+ }, [archetypeId, loadout]);
79
+ const loadoutKey = JSON.stringify(loadout);
80
+ useEffect(() => {
81
+ if (externalBundle !== undefined) {
82
+ setGeneratedBundle((prev) => {
83
+ if (prev)
84
+ disposeKhrBundle(prev);
85
+ return null;
86
+ });
87
+ return;
88
+ }
89
+ let cancelled = false;
90
+ loadArmoryLauncherBundle(archetypeId, { loadout, tuning, forwardAxis })
91
+ .then((res) => {
92
+ if (cancelled) {
93
+ disposeKhrBundle(res.bundle);
94
+ return;
95
+ }
96
+ res.bundle.scene.traverse((obj) => {
97
+ obj.frustumCulled = false;
98
+ if (obj.isMesh) {
99
+ obj.raycast = NO_RAYCAST;
100
+ }
101
+ });
102
+ setGeneratedBundle((prev) => {
103
+ if (prev)
104
+ disposeKhrBundle(prev);
105
+ return res.bundle;
106
+ });
107
+ onReadyRef.current?.(res.bundle);
108
+ })
109
+ .catch(() => { });
110
+ return () => {
111
+ cancelled = true;
112
+ };
113
+ // eslint-disable-next-line react-hooks/exhaustive-deps
114
+ }, [archetypeId, externalBundle, forwardAxis, loadoutKey]);
115
+ useEffect(() => {
116
+ return () => {
117
+ setGeneratedBundle((prev) => {
118
+ if (prev)
119
+ disposeKhrBundle(prev);
120
+ return null;
121
+ });
122
+ };
123
+ }, []);
124
+ const activeBundle = externalBundle !== undefined ? externalBundle : generatedBundle;
125
+ const availableRoles = useMemo(() => {
126
+ const roles = new Set();
127
+ if (!activeBundle)
128
+ return roles;
129
+ for (const b of activeBundle.bodies) {
130
+ const r = b.joint?.role ?? b.role;
131
+ if (r && b.joint?.drive?.stiffness !== undefined)
132
+ roles.add(r);
133
+ }
134
+ return roles;
135
+ }, [activeBundle]);
136
+ const muzzleNodeRef = useRef(null);
137
+ useLayoutEffect(() => {
138
+ muzzleNodeRef.current = activeBundle?.scene.getObjectByName("Socket_Muzzle") ?? null;
139
+ }, [activeBundle]);
140
+ useLayoutEffect(() => {
141
+ const host = parentSocketObject ?? bodyRef?.current?.socket(socket) ?? null;
142
+ if (host && offsetGroup.parent !== host)
143
+ host.add(offsetGroup);
144
+ return () => {
145
+ if (host && offsetGroup.parent === host)
146
+ host.remove(offsetGroup);
147
+ };
148
+ }, [activeBundle, bodyRef, offsetGroup, parentSocketObject, socket]);
149
+ const computeMuzzleWorldRay = (originOut, dirOut) => {
150
+ const mNode = muzzleNodeRef.current;
151
+ const bScene = activeBundle?.scene;
152
+ if (!bScene)
153
+ return false;
154
+ if (mNode) {
155
+ mNode.getWorldPosition(originOut);
156
+ bScene.getWorldQuaternion(_muzzleWorldQuat);
157
+ }
158
+ else {
159
+ bScene.getWorldPosition(originOut);
160
+ bScene.getWorldQuaternion(_muzzleWorldQuat);
161
+ }
162
+ dirOut.set(0, 0, forwardAxis === "-Z" ? -1 : 1).applyQuaternion(_muzzleWorldQuat).normalize();
163
+ return true;
164
+ };
165
+ useImperativeHandle(ref, () => ({
166
+ archetypeId,
167
+ offsetGroup,
168
+ get bundle() {
169
+ return activeBundle ?? null;
170
+ },
171
+ get heldItem() {
172
+ return heldRef.current;
173
+ },
174
+ get simState() {
175
+ return simStateRef.current;
176
+ },
177
+ fireOnce() {
178
+ const origin = shotOriginRef.current;
179
+ if (computeMuzzleWorldRay(_muzzleWorldPos, _muzzleForward)) {
180
+ origin.muzzlePos = [_muzzleWorldPos.x, _muzzleWorldPos.y, _muzzleWorldPos.z];
181
+ origin.muzzleDir = [_muzzleForward.x, _muzzleForward.y, _muzzleForward.z];
182
+ }
183
+ const events = eventsScratchRef.current;
184
+ const fired = triggerSimFire(simStateRef.current, tuningRef.current, origin, events, loadoutRef.current);
185
+ if (fired) {
186
+ recoilRef.current = Math.min(1.6, recoilRef.current + 1.0);
187
+ flashTimerRef.current = loadoutRef.current.muzzle === "suppressor" ? 0.018 : 0.042;
188
+ if (soundRef.current)
189
+ audioSynth.playFire(archetypeId, tuningRef.current.timeScale);
190
+ onFireRef.current?.({
191
+ archetypeId,
192
+ shotsFired: 1,
193
+ magAmmo: simStateRef.current.magAmmo,
194
+ magCapacity: simStateRef.current.magCapacity,
195
+ muzzleOrigin: origin.muzzlePos,
196
+ muzzleDirection: origin.muzzleDir,
197
+ });
198
+ }
199
+ else if (soundRef.current) {
200
+ audioSynth.playDryClick();
201
+ }
202
+ return fired;
203
+ },
204
+ setFullAuto(active) {
205
+ simStateRef.current.fullAutoHeld = active;
206
+ },
207
+ rack() {
208
+ triggerSimRack(simStateRef.current);
209
+ if (soundRef.current)
210
+ audioSynth.playMechanicalRack(archetypeId === "shotgun");
211
+ },
212
+ reload() {
213
+ const started = triggerSimReload(simStateRef.current);
214
+ if (started && soundRef.current)
215
+ audioSynth.playMagAction(false);
216
+ return started;
217
+ },
218
+ setAds(nextAds) {
219
+ adsRef.current = nextAds;
220
+ },
221
+ getMuzzleWorldRay: computeMuzzleWorldRay,
222
+ }),
223
+ // eslint-disable-next-line react-hooks/exhaustive-deps
224
+ [activeBundle, archetypeId, forwardAxis, offsetGroup]);
225
+ useFrame((_, rawDt) => {
226
+ const dt = Math.min(Math.max(rawDt, 0), 0.05);
227
+ offsetGroup.visible = visible;
228
+ const host = parentSocketObject ?? bodyRef?.current?.socket(socket) ?? null;
229
+ if (host && offsetGroup.parent !== host)
230
+ host.add(offsetGroup);
231
+ const origin = shotOriginRef.current;
232
+ if (computeMuzzleWorldRay(_muzzleWorldPos, _muzzleForward)) {
233
+ origin.muzzlePos[0] = _muzzleWorldPos.x;
234
+ origin.muzzlePos[1] = _muzzleWorldPos.y;
235
+ origin.muzzlePos[2] = _muzzleWorldPos.z;
236
+ origin.muzzleDir[0] = _muzzleForward.x;
237
+ origin.muzzleDir[1] = _muzzleForward.y;
238
+ origin.muzzleDir[2] = _muzzleForward.z;
239
+ }
240
+ const events = advanceFixedSimulation(simStateRef.current, dt, tuningRef.current, loadoutRef.current, origin, eventsScratchRef.current);
241
+ if (events.shotsFired > 0) {
242
+ recoilRef.current = Math.min(1.6, recoilRef.current + events.shotsFired * 0.9);
243
+ flashTimerRef.current = loadoutRef.current.muzzle === "suppressor" ? 0.018 : 0.042;
244
+ if (soundRef.current)
245
+ audioSynth.playFire(archetypeId, tuningRef.current.timeScale);
246
+ onFireRef.current?.({
247
+ archetypeId,
248
+ shotsFired: events.shotsFired,
249
+ magAmmo: simStateRef.current.magAmmo,
250
+ magCapacity: simStateRef.current.magCapacity,
251
+ muzzleOrigin: [origin.muzzlePos[0], origin.muzzlePos[1], origin.muzzlePos[2]],
252
+ muzzleDirection: [origin.muzzleDir[0], origin.muzzleDir[1], origin.muzzleDir[2]],
253
+ });
254
+ }
255
+ const held = heldRef.current;
256
+ if (held && availableRoles.size > 0) {
257
+ for (const role of DRIVEN_ROLES) {
258
+ if (!availableRoles.has(role))
259
+ continue;
260
+ const jState = simStateRef.current.joints[role];
261
+ if (!jState)
262
+ continue;
263
+ held.setRoleTarget(role, jState.pos);
264
+ }
265
+ }
266
+ if (dt > 0) {
267
+ const targetAds = adsRef.current ? 1 : 0;
268
+ const adsAlpha = 1 - Math.exp(-16 * dt);
269
+ adsBlendRef.current += (targetAds - adsBlendRef.current) * adsAlpha;
270
+ recoilRef.current = Math.max(0, recoilRef.current - dt * 9.5);
271
+ let bobX = 0;
272
+ let bobY = 0;
273
+ const ctrl = bodyRef?.current?.ecctrl;
274
+ if (enableSway && ctrl) {
275
+ const speed = ctrl.moveSpeed;
276
+ if (ctrl.isOnGround && speed > 0.15) {
277
+ bobPhaseRef.current += dt * (4.5 + speed * 1.15);
278
+ const amp = (1 - adsBlendRef.current * 0.78) * Math.min(1, speed / 6) * 0.008;
279
+ bobX = Math.cos(bobPhaseRef.current * 0.5) * amp;
280
+ bobY = Math.abs(Math.sin(bobPhaseRef.current)) * amp * 0.85;
281
+ }
282
+ }
283
+ let adsDx = 0;
284
+ let adsDy = 0;
285
+ let adsDz = 0;
286
+ if (activeBundle && parentSocketObject === undefined && bodyRef?.current) {
287
+ const sockNode = bodyRef.current.socket(socket);
288
+ const grip = activeBundle.sockets.grip_primary ?? activeBundle.sockets.IK_Palm_Primary;
289
+ const adsSock = activeBundle.sockets.Socket_AdsEye;
290
+ if (sockNode && grip && adsSock) {
291
+ const eyeInCamX = sockNode.position.x - grip[0] + adsSock[0];
292
+ const eyeInCamY = sockNode.position.y - grip[1] + adsSock[1];
293
+ adsDx = -eyeInCamX * adsBlendRef.current;
294
+ adsDy = -eyeInCamY * adsBlendRef.current;
295
+ adsDz = 0.08 * adsBlendRef.current;
296
+ }
297
+ }
298
+ const cfg = WEAPON_ARCHETYPES[archetypeId];
299
+ const kickScale = Math.min(0.045, cfg.defaultBlowbackImpulse * 0.0042) * (1 - adsBlendRef.current * 0.35);
300
+ const kickZ = recoilRef.current * kickScale * (forwardAxis === "-Z" ? 1 : -1);
301
+ const kickPitch = recoilRef.current * kickScale * 2.4 * (forwardAxis === "-Z" ? 1 : -1);
302
+ offsetGroup.position.set(adsDx + bobX, adsDy - bobY + recoilRef.current * kickScale * 0.2, adsDz + kickZ);
303
+ offsetGroup.rotation.set(kickPitch, 0, 0);
304
+ }
305
+ flashTimerRef.current = Math.max(0, flashTimerRef.current - dt);
306
+ muzzleFlash.visible = visible && flashTimerRef.current > 0;
307
+ if (muzzleFlash.visible && muzzleNodeRef.current && activeBundle) {
308
+ muzzleFlash.position.copy(activeBundle.scene.position).add(muzzleNodeRef.current.position);
309
+ muzzleFlash.rotation.z += dt * 42;
310
+ }
311
+ });
312
+ if (!activeBundle)
313
+ return null;
314
+ return (_jsx(HeldItem, { ref: heldRef, bundle: activeBundle, socket: socket, parentSocketObject: offsetGroup, bodyRef: bodyRef }));
315
+ }
316
+ //# sourceMappingURL=KhrLauncher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"KhrLauncher.js","sourceRoot":"","sources":["../src/KhrLauncher.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAA8D,MAAM,kBAAkB,CAAC;AACxG,OAAO,EAAE,gBAAgB,EAAuB,MAAM,YAAY,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAA4B,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H,IAAI,CAAC,YAAY;QAAE,OAAO,IAAI,CAAC;IAC/B,OAAO,CACL,KAAC,QAAQ,IACP,GAAG,EAAE,OAAO,EACZ,MAAM,EAAE,YAAY,EACpB,MAAM,EAAE,MAAM,EACd,kBAAkB,EAAE,WAAW,EAC/B,OAAO,EAAE,OAAO,GAChB,CACH,CAAC;AACJ,CAAC"}
@@ -0,0 +1,48 @@
1
+ import * as THREE from 'three';
2
+ import type { ModularLoadout, WeaponArchetypeId } from '../types/physicsSchema.js';
3
+ export interface ContactAuditEntry {
4
+ pair: string;
5
+ gapMeters: number;
6
+ maxAllowedMeters: number;
7
+ passed: boolean;
8
+ }
9
+ export interface CoplanarOverlapEntry {
10
+ meshA: string;
11
+ meshB: string;
12
+ intraMesh: boolean;
13
+ triA: number;
14
+ triB: number;
15
+ areaMm2: number;
16
+ planeGapUm: number;
17
+ normal: [number, number, number];
18
+ centroid: [number, number, number];
19
+ }
20
+ /**
21
+ * Exact world-space Sutherland-Hodgman solver detecting same-normal coplanar triangle pairs
22
+ * (both intra-mesh and inter-mesh) within `planeEpsM` (`300 μm` default) whose overlapping 2D
23
+ * area exceeds `minAreaM2` (`0.25 mm²` default). Opposing-normal CAD contacts (`dot <= -0.985`)
24
+ * do not Z-fight and are intentionally permitted.
25
+ */
26
+ export declare function findCoplanarZFightingOverlaps(root: THREE.Object3D, planeEpsM?: number, minAreaM2?: number): CoplanarOverlapEntry[];
27
+ export interface RigAssemblyAuditReport {
28
+ archetypeId: WeaponArchetypeId;
29
+ presetName: string;
30
+ valid: boolean;
31
+ contacts: ContactAuditEntry[];
32
+ coplanarOverlaps: CoplanarOverlapEntry[];
33
+ errors: string[];
34
+ }
35
+ /**
36
+ * Minimum Euclidean separation distance between two 3D AABBs (0 when touching or overlapping).
37
+ */
38
+ export declare function computeAabbSeparationMeters(a: THREE.Box3, b: THREE.Box3): number;
39
+ /**
40
+ * Audits world-space CAD part contacts, Picatinny dovetail seating, underbarrel mounts,
41
+ * FCU tang mating, muzzle shoulders, moving-joint travel ranges, and exact 0-overlap coplanar
42
+ * Z-fighting across all meshes in a weapon rig.
43
+ */
44
+ export declare function verifyWeaponRigContacts(archetypeId: WeaponArchetypeId, loadout?: ModularLoadout, presetName?: string): RigAssemblyAuditReport;
45
+ /**
46
+ * Verifies every catalog preset plus full optic, LAM, grip-style, and muzzle permutations across all 7 archetypes.
47
+ */
48
+ export declare function verifyAllArchetypeAssemblies(): RigAssemblyAuditReport[];