@khr3/core 0.2.6 → 0.2.7

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 (43) hide show
  1. package/README.md +169 -9
  2. package/dist/KhrAssembly.d.ts +1 -1
  3. package/dist/KhrCollider.d.ts +5 -1
  4. package/dist/curves-Cf8okB-M.js +542 -0
  5. package/dist/curves-Cf8okB-M.js.map +1 -0
  6. package/dist/curves.js +1 -542
  7. package/dist/index.d.ts +3 -2
  8. package/dist/index.js +4 -1544
  9. package/dist/index.js.map +1 -1
  10. package/dist/jointDynamics.d.ts +7 -0
  11. package/dist/khrClone.d.ts +3 -3
  12. package/dist/khrInertia-DgCUCDTx.js +247 -0
  13. package/dist/khrInertia-DgCUCDTx.js.map +1 -0
  14. package/dist/khrVehicleJointHelpers.d.ts +16 -0
  15. package/dist/khrVehicleJoints.d.ts +2 -1
  16. package/dist/khrVehicleSlots.d.ts +11 -3
  17. package/dist/{physicsEcs-dBq4psbC.js → physicsEcs-C00N5zCh.js} +27 -251
  18. package/dist/physicsEcs-C00N5zCh.js.map +1 -0
  19. package/dist/sand3d/sand3dAssemblyHelpers.d.ts +30 -0
  20. package/dist/sand3d/sand3dCavityOps.d.ts +15 -0
  21. package/dist/sand3d/sand3dCompiler.d.ts +121 -0
  22. package/dist/sand3d/sand3dEvaluator.d.ts +80 -0
  23. package/dist/sand3d/sand3dFramesAndEdits.d.ts +30 -0
  24. package/dist/sand3d/sand3dHullAndSweep.d.ts +27 -0
  25. package/dist/sand3d/sand3dParser.d.ts +6 -0
  26. package/dist/sand3d/sand3dPrimitives.d.ts +50 -0
  27. package/dist/sand3d/sand3dProfiles.d.ts +32 -0
  28. package/dist/sand3d/sand3dRecipes.d.ts +5 -0
  29. package/dist/sand3d/sand3dShellOp.d.ts +8 -0
  30. package/dist/sand3d/sand3dSolids.d.ts +32 -0
  31. package/dist/sand3d/sand3dTokenizer.d.ts +8 -0
  32. package/dist/sand3d/sand3dTypes.d.ts +157 -0
  33. package/dist/sand3d-DQ8-OMlo.js +5045 -0
  34. package/dist/sand3d-DQ8-OMlo.js.map +1 -0
  35. package/dist/sand3d.d.ts +23 -0
  36. package/dist/sand3d.js +1 -0
  37. package/dist/vehicle.js +198 -21
  38. package/dist/vehicle.js.map +1 -1
  39. package/dist/wheelLoads.d.ts +3 -1
  40. package/docs/api-reference.md +332 -163
  41. package/package.json +5 -1
  42. package/dist/curves.js.map +0 -1
  43. package/dist/physicsEcs-dBq4psbC.js.map +0 -1
package/README.md CHANGED
@@ -1,16 +1,176 @@
1
1
  # `@khr3/core` (`khr3`)
2
2
 
3
- `KHR_physics_rigid_bodies` + `KHR_implicit_shapes` + `OMI_vehicle_wheel` runtime loader, binary `.glb` exporter, `@react-three/rapier` multi-body `ImpulseJoint` assembly & contact-impulse breakaway synchronizer ([src/KhrAssembly.tsx](./src/KhrAssembly.tsx), [src/KhrCollider.tsx](./src/KhrCollider.tsx), [src/PhysicsWorld.tsx](./src/PhysicsWorld.tsx)), and `@pinkaphant/ecctrl` vehicle rig ([src/KhrVehicle.tsx](./src/KhrVehicle.tsx)) + monotone Pacejka curve presets ([src/pacejka.ts](./src/pacejka.ts)) for React Three Fiber.
3
+ `@khr3/core` provides `KHR_physics_rigid_bodies`, `KHR_implicit_shapes`, and `OMI_vehicle_wheel` glTF 2.0 binary `.glb` loading and exporting, `@react-three/rapier` multi-body `ImpulseJoint` assembly synchronization, `@pinkaphant/ecctrl` vehicle and rotor rigging, Fritsch–Carlson monotone Pacejka curve compilation, and the declarative `Sand3D` Code-CAD and kinematic KHR compiler for React Three Fiber.
4
4
 
5
- - Full API & configuration reference: [docs/api-reference.md](./docs/api-reference.md)
6
- - Runnable example: [example/App.tsx](./example/App.tsx) & [example/headless.ts](./example/headless.ts)
5
+ - API and schema reference: [api-reference.md](./docs/api-reference.md)
6
+ - Interactive demo and entrypoints: [App.tsx](./example/App.tsx), [WorkbenchScene.tsx](./example/WorkbenchScene.tsx), [WorkbenchHud.tsx](./example/WorkbenchHud.tsx), [workbenchAssets.ts](./example/workbenchAssets.ts), [main.tsx](./example/main.tsx), [index.html](./example/index.html), and headless runner [headless.ts](./example/headless.ts)
7
+ - Package and build configuration: [package.json](./package.json), [vite.config.ts](./vite.config.ts), [tsconfig.json](./tsconfig.json), [tsconfig.build.json](./tsconfig.build.json), and [LICENSE](./LICENSE)
8
+
9
+ ## Quick Start & Commands
10
+
11
+ ```bash
12
+ npm install # Install package and local dev/peer dependencies
13
+ npm run dev # Start Vite interactive workbench
14
+ npm run example # Run headless GLB export, load, and Sand3D round-trip demo
15
+ npm run typecheck # Type-check source, tests, and example targets
16
+ npm test # Run Node test suite across KHR, R3F, vehicle, and Sand3D modules
17
+ npm run build # Build ESM bundle and declaration files into dist/
18
+ npm run pack:dry # Inspect publishable tarball contents
19
+ ```
20
+
21
+ ### React Three Fiber `<PhysicsWorld>` and `<KhrVehicle>`
22
+
23
+ ```tsx
24
+ import { Suspense } from "react";
25
+ import { Canvas } from "@react-three/fiber";
26
+ import { PhysicsWorld, useKhrGlb } from "@khr3/core";
27
+ import { KhrVehicle } from "@khr3/core/vehicle";
28
+
29
+ function BuggyScene() {
30
+ const bundle = useKhrGlb("/models/mars_buggy.glb");
31
+ return (
32
+ <PhysicsWorld gravity={[0, -9.81, 0]}>
33
+ <KhrVehicle bundle={bundle} position={[0, 1.2, 0]} />
34
+ </PhysicsWorld>
35
+ );
36
+ }
37
+
38
+ export function App() {
39
+ return (
40
+ <Canvas>
41
+ <Suspense fallback={null}>
42
+ <BuggyScene />
43
+ </Suspense>
44
+ </Canvas>
45
+ );
46
+ }
47
+ ```
48
+
49
+ ### Declarative `Sand3D` CAD-to-KHR Compilation
50
+
51
+ ```ts
52
+ import { loadSand3dBundle, s3d } from "@khr3/core/sand3d";
53
+
54
+ // Extrude a rounded 80x40 mm rectangle 6 mm along +Y
55
+ const plate = s3d.extrude(s3d.rect(80, 40, { r: 4 }), 6, { color: "#94a3b8" });
56
+
57
+ // Drill two 6.6 mm through-bores on a 2x1 bolt grid at 50 mm X pitch
58
+ const bracket = s3d.hole(plate, 6.6, { on: s3d.grid(2, 1, 50, 0) });
59
+
60
+ const bundle = await loadSand3dBundle(
61
+ s3d.assembly("cnc_bracket", [s3d.part("Bracket_Base", bracket, { massKg: 0.45 })], { units: "mm" }),
62
+ );
63
+ ```
7
64
 
8
65
  ## Subpath Exports
9
66
 
10
- | Subpath | Source | Exports |
11
- | --- | --- | --- |
12
- | `@khr3/core` | [src/index.ts](./src/index.ts), [src/PhysicsWorld.tsx](./src/PhysicsWorld.tsx), [src/KhrAssembly.tsx](./src/KhrAssembly.tsx), [src/KhrCollider.tsx](./src/KhrCollider.tsx) | `PhysicsWorld`, `createKhrGltfPlugin`, `useKhrGlb`, `loadKhrGlb`, `cloneKhrBundle`, `disposeKhrBundle`, `claimBundleMount`, `releaseBundleMount`, `exportKhrGlb`, `patchGlbJsonChunk`, `KhrCollider`, `KhrAssembly`, `JointRegistryContext`, `assertUnitScale`, `assertIdentityWorldScale`, `assertSceneIdentityWorldScale`, `KhrValidationError`, KHR, `KhrBreakawaySpec` & rotor tag types |
13
- | `@khr3/core/vehicle` | [src/KhrVehicle.tsx](./src/KhrVehicle.tsx), [src/khrVehicleJoints.tsx](./src/khrVehicleJoints.tsx), [src/wheelLoads.ts](./src/wheelLoads.ts) | `KhrVehicle`, `solveWheelLoads`, `KhrPropellerConfig`, `KhrVehicleJointsHandle`, `KhrVehicleProps`, `KhrWheelConfig`, `SolvedWheel` |
14
- | `@khr3/core/curves` | [src/curves.ts](./src/curves.ts), [src/pacejka.ts](./src/pacejka.ts) | `compilePacejkaCurve`, `tireGripForSurface`, `engineHorsepowerForPeakTorque`, `TIRE_ARCHETYPES`, `TIRE_SLIP_CURVES`, `ENGINE_TORQUE_CURVES`, `STEER_SPEED_CURVES`, `TireArchetypePreset`, `CurveData`, `CurvePoint` |
67
+ | Subpath | Entrypoint | Primary Exports |
68
+ | :--- | :--- | :--- |
69
+ | `@khr3/core` | [index.ts](./src/index.ts) | `PhysicsWorld`, `KhrAssembly`, `KhrCollider`, `loadKhrGlb`, `createKhrGltfPlugin`, `useKhrGlb`, `exportKhrGlb`, `patchGlbJsonChunk`, `cloneKhrBundle`, `disposeKhrBundle`, `claimBundleMount`, `releaseBundleMount`, `JointRegistryContext`, `assertUnitScale`, `assertIdentityWorldScale`, `assertSceneIdentityWorldScale`, `KhrValidationError`, `s3d`, `SAND3D_RECIPES`, `SAND3D_RECIPE_MAP`, `findSand3dRecipe`, `buildSand3dRecipe`, `compileSand3dAssembly`, `exportSand3dGlb`, `loadSand3dBundle`, `parseSand3dSource`, `isSand3dFileName`, `type EcctrlPropellerTag`, `type EcctrlWheelTag`, `type JointRegistry`, `type JointRuntime`, `type KhrAssemblyHandle`, `type KhrAssemblyProps`, `type KhrAssetBundle`, `type KhrBodySpec`, `type KhrBreakawaySpec`, `type KhrCarConfig`, `type KhrColliderProps`, `type KhrColliderShape`, `type KhrColliderSpec`, `type KhrCombineMode`, `type KhrCurveData`, `type KhrCurvePoint`, `type KhrDroneConfig`, `type KhrExportNodeSpec`, `type KhrImplicitShape`, `type KhrJointDriveSpec`, `type KhrJointSpec`, `type KhrPluginOptions`, `type LoadKhrGlbOptions`, `type MutableGltfJson`, `type OmiVehicleWheelSpec`, `type PhysicsWorldProps`, `type RawGltfJson`, `type TimeControlValue`, `type UseKhrGlbOptions`, `type CompiledSand3dAssembly`, `type Sand3dAssembly`, `type Sand3dCompileInput`, `type Sand3dFaceSelector`, `type Sand3dFrame`, `type Sand3dJointDef`, `type Sand3dPartSpec`, `type Sand3dProfile`, `type Sand3dRecipe`, `type Sand3dRecipeId`, `type Sand3dSocketDef`, `type Sand3dSolid`, `type Sand3dThrusterDef`, `type Sand3dUnits`, `type Sand3dWheelDef` |
70
+ | `@khr3/core/vehicle` | [vehicle.ts](./src/vehicle.ts) | `KhrVehicle`, `solveWheelLoads`, `type KhrPropellerConfig`, `type KhrVehicleJointsHandle`, `type KhrVehicleProps`, `type KhrWheelConfig`, `type SolvedWheel` |
71
+ | `@khr3/core/curves` | [curves.ts](./src/curves.ts) | `compilePacejkaCurve`, `tireGripForSurface`, `engineHorsepowerForPeakTorque`, `TIRE_ARCHETYPES`, `TIRE_SLIP_CURVES`, `ENGINE_TORQUE_CURVES`, `STEER_SPEED_CURVES`, `type TireArchetypePreset`, `type CurveData`, `type CurvePoint` |
72
+ | `@khr3/core/sand3d` | [sand3d.ts](./src/sand3d.ts) | `s3d`, `SAND3D_RECIPES`, `SAND3D_RECIPE_MAP`, `findSand3dRecipe`, `buildSand3dRecipe`, `compileSand3dAssembly`, `exportSand3dGlb`, `loadSand3dBundle`, `parseSand3dSource`, `isSand3dFileName`, `rect`, `circle`, `ngon`, `star`, `slot`, `polygon`, `subtractProfileHole`, `triangulateProfile2D`, `signedArea2D`, `cleanLoop2D`, `extrude`, `revolve`, `loft`, `sweep`, `helix`, `box`, `cylinder`, `tube`, `cone`, `sphere`, `dome`, `torus`, `hull`, `finalizeManifoldGeometry`, `grid`, `polar`, `at`, `on`, `resolveFaceFrame`, `hole`, `pocket`, `shell`, `chamfer`, `fillet`, `taper`, `twist`, `bend`, `color`, `translate`, `rotate`, `unionSolids`, `part`, `joint`, `wheel`, `thruster`, `socket`, `assembly`, `exportTarget`, `sand3dUnitScale`, `type CompiledSand3dAssembly`, `type Sand3dAssembly`, `type Sand3dCompileInput`, `type Sand3dEmitterKind`, `type Sand3dFaceSelector`, `type Sand3dFrame`, `type Sand3dJointDef`, `type Sand3dNodeItem`, `type Sand3dPartOpts`, `type Sand3dPartSpec`, `type Sand3dProfile`, `type Sand3dRecipe`, `type Sand3dRecipeId`, `type Sand3dSocketDef`, `type Sand3dSolid`, `type Sand3dThrusterDef`, `type Sand3dUnits`, `type Sand3dWheelDef`, `type Vec2`, `type Vec3`, `type Quat4` |
73
+
74
+ ## Architecture & Runtime Contracts
75
+
76
+ - **Enforced `[1, 1, 1]` Unit Scale**: `assertUnitScale`, `assertIdentityWorldScale`, and `assertSceneIdentityWorldScale` verify unit local and world scale across loaded scenes and mounted components, throwing `KhrValidationError` on scaled transforms so collider half-extents, joint anchors, and inertia tensors match SI meters directly.
77
+ - **4-Byte-Aligned Binary `.glb` Serialization**: `exportKhrGlb` and `patchGlbJsonChunk` emit binary glTF 2.0 containers with space-padded JSON chunks and null-padded `BIN` chunks aligned to 4-byte boundaries, validated on ingest by `loadKhrGlb`.
78
+ - **`<PhysicsWorld>` Step Ordering & Opt-In `JointRegistryContext`**: `<PhysicsWorld>` mounts `@react-three/rapier` `<Physics paused timeStep="vary">` and places `@pinkaphant/ecctrl/time` `<TimeControl>` after scene children so `<EcctrlVehicle>` rotor forces and `ImpulseJoint` motor targets apply ahead of each `world.step(dt)`. `JointRegistryContext` is an opt-in `Set<JointRuntime> | null` registry (`null` default inside `<PhysicsWorld>`) populated when a `<JointRegistryContext.Provider>` is mounted.
79
+ - **Bundle Mount Ownership & Cloning**: `useKhrGlb` and `cloneKhrBundle` produce isolated `THREE.Group` hierarchies while sharing immutable GPU geometries and materials; `claimBundleMount` and `releaseBundleMount` enforce single-host ownership per cloned bundle. Calling `disposeKhrBundle(clone)` retires mount ownership while preserving shared template GPU resources, whereas `disposeKhrBundle(template)` on a root `loadKhrGlb` or `loadSand3dBundle` bundle disposes unique GPU geometries, materials, and textures once.
80
+ - **Natural-Origin `<KhrVehicle>` Mass Properties**: `<KhrVehicle>` preserves the authored glTF scene origin `[0, 0, 0]` on `<EcctrlVehicle>` and attaches composite chassis mass, parallel-axis center of mass, and Jacobi-diagonalized principal inertia declaratively through `<KhrCollider>` `massProperties`.
81
+ - **`Sand3D` SI Meter Scaling & `C12` Modular Lattice**: `compileSand3dAssembly` scales `"mm"` authoring coordinates by `0.001` into unit-scale SI meter geometry, anchors, and prismatic limits, and supports `C12` (the 12-fold cyclotomic modular geometry standard with a `0.25 m` base step, `3.0 m` 12-step module, and `yaw12` `0..11` `30°` angular indices) in recipes such as `cyclotomic_airlock_bulkhead`.
82
+
83
+ ## Source Module Directory
84
+
85
+ ### Core Runtime, Loader, and Exporter
86
+
87
+ - [index.ts](./src/index.ts) — Root package barrel exporting KHR runtime components, `.glb` IO, scale validators, interfaces, and `Sand3D` entrypoints.
88
+ - [PhysicsWorld.tsx](./src/PhysicsWorld.tsx) — React Three Fiber `<Physics>` host paired with `@pinkaphant/ecctrl/time` `<TimeControl>`.
89
+ - [KhrAssembly.tsx](./src/KhrAssembly.tsx) — Multi-body Rapier `<RigidBody>` and `ImpulseJoint` synchronizer with contact-impulse breakaway.
90
+ - [AssemblyRootBody.tsx](./src/AssemblyRootBody.tsx) — Root rigid-body mount computing composite lumped mass properties for articulated subtrees.
91
+ - [BundleSceneHost.tsx](./src/BundleSceneHost.tsx) — Cloned visual scene-graph host tracking per-body Rapier poses.
92
+ - [KhrCollider.tsx](./src/KhrCollider.tsx) — Rapier collider component supporting `box`, `sphere`, `cylinder`, `capsule`, `convexHull`, and `trimesh` shapes.
93
+ - [assemblyPlan.ts](./src/assemblyPlan.ts) — Topological dependency planner sorting root bodies and jointed child chains.
94
+ - [jointDynamics.ts](./src/jointDynamics.ts) — Revolute, prismatic, and fixed `ImpulseJoint` motor target and impact-impulse runtime controller.
95
+ - [physicsEcs.ts](./src/physicsEcs.ts) — `JointRegistryContext` and `JointRuntime` state definitions.
96
+ - [useKhrGlb.ts](./src/useKhrGlb.ts) — Suspense-cached GLB asset loader hook returning isolated `cloneKhrBundle` instances.
97
+ - [khrLoader.ts](./src/khrLoader.ts) — Binary GLB validator and `GLTFLoader` pipeline returning `KhrAssetBundle`.
98
+ - [khrPlugin.ts](./src/khrPlugin.ts) — `GLTFLoader` extension plugin and headless texture stub.
99
+ - [khrPluginHelpers.ts](./src/khrPluginHelpers.ts) — Scene traversal helpers extracting bodies, colliders, wheels, propellers, and sockets.
100
+ - [khrBundleFinalize.ts](./src/khrBundleFinalize.ts) — Bundle finalizer assembling mass totals, centers of mass, and vehicle tuning records.
101
+ - [khrParsers.ts](./src/khrParsers.ts) — Top-level `KHR_physics_rigid_bodies` motion and material table decoders.
102
+ - [khrShapeParser.ts](./src/khrShapeParser.ts) — `KHR_implicit_shapes` and mesh-referenced collider geometry decoders.
103
+ - [khrJointParser.ts](./src/khrJointParser.ts) — `physicsJoints` constraint limit and drive decoders.
104
+ - [khrRotorDecoders.ts](./src/khrRotorDecoders.ts) — `OMI_vehicle_wheel`, `extras.ecctrlWheel`, and `extras.ecctrlPropeller` tag decoders.
105
+ - [khrExtras.ts](./src/khrExtras.ts) — Socket anchor, `contactDots`, `breakaway`, and `registerKhrTemplateMeta` template metadata extractors.
106
+ - [khrGlb.ts](./src/khrGlb.ts) — Binary GLB header validator, JSON chunk patcher, and binary packer.
107
+ - [khrExporter.ts](./src/khrExporter.ts) — `exportKhrGlb` scene serializer writing `KHR_physics_rigid_bodies`, `KHR_implicit_shapes`, and `OMI_vehicle_wheel`.
108
+ - [khrExportEncoders.ts](./src/khrExportEncoders.ts) — Encoders for shapes, motions, constraints, physics materials, collision filters, and `OMI_vehicle_wheel`.
109
+ - [khrClone.ts](./src/khrClone.ts) — Deep bundle cloner, mount ownership tracker, and geometry/material disposer.
110
+ - [khrInertia.ts](./src/khrInertia.ts) — Unit-scale validators, mesh collider vertex extractors, and principal body inertia calculators.
111
+ - [khrMassProps.ts](./src/khrMassProps.ts) — Parallel-axis composite mass and Jacobi eigensolver principal inertia diagonalizer.
112
+ - [khrTypes.ts](./src/khrTypes.ts) — Core `KhrAssetBundle`, body, collider, joint, and export specification types.
113
+ - [khrConfigTypes.ts](./src/khrConfigTypes.ts) — `KhrCarConfig`, `KhrDroneConfig`, and `KhrValidationError` definitions.
114
+ - [khrVehicleTypes.ts](./src/khrVehicleTypes.ts) — `EcctrlWheelTag`, `EcctrlPropellerTag`, and `OmiVehicleWheelSpec` types.
115
+
116
+ ### Vehicle Rig and Pacejka Curves
117
+
118
+ - [vehicle.ts](./src/vehicle.ts) — Subpath barrel for `@khr3/core/vehicle`.
119
+ - [KhrVehicle.tsx](./src/KhrVehicle.tsx) — Natural-origin `<EcctrlVehicle>` wrapper mounting chassis colliders, wheels, propellers, and articulated panels.
120
+ - [khrVehicleChassis.ts](./src/khrVehicleChassis.ts) — Chassis root selection and lumped inertia calculator for vehicle assemblies.
121
+ - [khrVehicleJointHelpers.ts](./src/khrVehicleJointHelpers.ts) — Imperative panel toggle and role-target helpers for `<KhrVehicle>`.
122
+ - [khrVehicleJoints.tsx](./src/khrVehicleJoints.tsx) — Articulated vehicle door, hood, canopy, and breakaway joint mounts.
123
+ - [khrVehicleRotors.tsx](./src/khrVehicleRotors.tsx) — `KhrVehicleRotors` mounting `<ShapeCastWheel>` suspension pucks and `<ThrustPropeller>` thrusters around `<RotorVisualSlot>` subtrees.
124
+ - [khrVehicleSlots.tsx](./src/khrVehicleSlots.tsx) — `ZeroGWheelGate` and `ZeroGWheelPostClear` microgravity wheel gating, `RotorVisualSlot` visual subtree reparenting, `captureRotorOrigins`, and disabled-rotor reset helpers.
125
+ - [wheelLoads.ts](./src/wheelLoads.ts) — Static-equilibrium corner-mass, spring stiffness, and damping solver for N-wheel vehicles.
126
+ - [curves.ts](./src/curves.ts) — Subpath barrel and tire, engine torque, and steering speed curve presets.
127
+ - [pacejka.ts](./src/pacejka.ts) — Monotone 8-knot Fritsch–Carlson Pacejka tire curve compiler and surface grip utilities.
128
+
129
+ ### Declarative `Sand3D` Code-CAD and Parser
130
+
131
+ - [sand3d.ts](./src/sand3d.ts) — Subpath barrel for `@khr3/core/sand3d` accepting assemblies, solids, recipe IDs, and script strings.
132
+ - [sand3dTypes.ts](./src/sand3d/sand3dTypes.ts) — Unit (`mm` / `m`), profile, frame, solid, part, joint, wheel, thruster, socket, and recipe types.
133
+ - [sand3dProfiles.ts](./src/sand3d/sand3dProfiles.ts) — 2D `rect`, `circle`, `ngon`, `star`, `slot`, `polygon`, hole bridging, and ear-clipping triangulator.
134
+ - [sand3dSolids.ts](./src/sand3d/sand3dSolids.ts) — Manifold `extrude`, `revolve`, and multi-station `loft` builders.
135
+ - [sand3dPrimitives.ts](./src/sand3d/sand3dPrimitives.ts) — Manifold `box`, `cylinder`, `tube`, `cone`, `sphere`, `dome`, and `torus` primitives.
136
+ - [sand3dHullAndSweep.ts](./src/sand3d/sand3dHullAndSweep.ts) — Bishop parallel-transport `sweep`, cylindrical `helix`, and 3D incremental convex `hull`.
137
+ - [sand3dFramesAndEdits.ts](./src/sand3d/sand3dFramesAndEdits.ts) — `grid`, `polar`, `at`, `on`, `chamfer`, `fillet`, `taper`, `twist`, `bend`, `color`, `translate`, `rotate`, and `unionSolids`.
138
+ - [sand3dCavityOps.ts](./src/sand3d/sand3dCavityOps.ts) — Planar loop extraction and cylindrical through/blind `hole` and polygonal `pocket` boolean carvers.
139
+ - [sand3dShellOp.ts](./src/sand3d/sand3dShellOp.ts) — Topological face/corner frame resolver and uniform-wall `shell` hollowing builder.
140
+ - [sand3dCompiler.ts](./src/sand3d/sand3dCompiler.ts) — `s3d` fluent namespace, analytic `box`/`sphere`/`cylinder` and `convexHull` collider fitting, `compileSand3dAssembly`, `exportSand3dGlb`, and `loadSand3dBundle`.
141
+ - [sand3dAssemblyHelpers.ts](./src/sand3d/sand3dAssemblyHelpers.ts) — Part, joint, wheel, thruster, and socket constructors and KHR rotor/emitter spec builders.
142
+ - [sand3dTokenizer.ts](./src/sand3d/sand3dTokenizer.ts) — Indentation-aware lexical scanner for `.sand3d`, `.s3d`, `.s3d.py`, and `.s3d.ts` programs.
143
+ - [sand3dParser.ts](./src/sand3d/sand3dParser.ts) — Recursive-descent AST parser and `.s3d.json` manifest loader (`isSand3dFileName`, `parseSand3dSource`).
144
+ - [sand3dEvaluator.ts](./src/sand3d/sand3dEvaluator.ts) — Sandboxed AST interpreter and `.s3d.json` evaluator binding Python keyword arguments, centered primitives, loops, functions, and `s3d.export(...)`.
145
+ - [sand3dRecipes.ts](./src/sand3d/sand3dRecipes.ts) — Six canonical mechanical, robotic, vehicle, aerospace, and C12 `SAND3D_RECIPES`.
146
+
147
+ ### Verification Suites
148
+
149
+ - [core.test.ts](./src/core.test.ts) — End-to-end KHR export, binary load, collider inertia, and socket tests.
150
+ - [schemaFixes.test.ts](./src/schemaFixes.test.ts) — glTF schema edge cases, extension preservation, and validation error checks.
151
+ - [omiWheel.test.ts](./src/omiWheel.test.ts) — `OMI_vehicle_wheel` and `extras.ecctrlWheel` synthesis and round-trip tests.
152
+ - [r3fMount.test.tsx](./src/r3fMount.test.tsx) — React Three Fiber `<PhysicsWorld>`, `<KhrAssembly>`, and `<KhrVehicle>` mount tests.
153
+ - [jointRegistryContext.test.tsx](./src/jointRegistryContext.test.tsx) — Opt-in `JointRegistryContext` provider registration and lifecycle tests.
154
+ - [breakaway.test.tsx](./src/breakaway.test.tsx) — Contact-impulse latch release and dynamic joint breakaway tests.
155
+ - [hybridRotorGate.test.tsx](./src/hybridRotorGate.test.tsx) — Hybrid wheel and propeller switching tests.
156
+ - [zeroGVehicle.test.tsx](./src/zeroGVehicle.test.tsx) — Microgravity wheel gating and thruster control tests.
157
+ - [crossPackage.test.ts](./src/crossPackage.test.ts) — Cross-package round-trips dynamically loading optional sibling `../khr3-vehicles`, `../khr3-launchers`, and `../khr3-assets` builds when present.
158
+ - [indexExports.test.ts](./src/indexExports.test.ts) — Root barrel symbol and type export assertions.
159
+ - [sand3d.test.ts](./src/sand3d/sand3d.test.ts) — `Sand3D` script evaluation, bore geometry, analytic colliders, `.s3d.json` manifests, 6 recipes, and `exportSand3dGlb` to `loadKhrGlb` round-trips.
160
+ - [workbenchAssets.test.ts](./src/workbenchAssets.test.ts) — Interactive workbench `Sand3D` vehicle/assembly round-trips, gullwing breakaway specs, and `0.08` radial thumbstick deadzone checks.
161
+
162
+ ### Example & Configuration Files
15
163
 
16
- See [docs/api-reference.md](./docs/api-reference.md) for the complete API, `.glb` KHR + `OMI_vehicle_wheel` + `extras` schema, custom gravity, transmission, and curve reference.
164
+ - [api-reference.md](./docs/api-reference.md) — API and schema reference documentation covering all four subpaths.
165
+ - [App.tsx](./example/App.tsx) — Interactive React Three Fiber workbench shell wiring vehicle/assembly selection, camera mode, and `.glb` export.
166
+ - [WorkbenchScene.tsx](./example/WorkbenchScene.tsx) — `<PhysicsWorld>` proving ground mounting `<KhrVehicle>`, `<KhrAssembly>`, `JointRegistryContext` motor/impulse controls, and 60 Hz telemetry.
167
+ - [WorkbenchHud.tsx](./example/WorkbenchHud.tsx) — Safe-area-inset telemetry bar, `Sand3D` selectors, and mobile-landscape virtual stick (`0.08` deadzone) + touch action cluster.
168
+ - [workbenchAssets.ts](./example/workbenchAssets.ts) — Procedural `s3d` Gullwing Coupe and `SAND3D_RECIPES` loader plus shared telemetry and touch state.
169
+ - [main.tsx](./example/main.tsx) — Browser React root entrypoint for the Vite demo.
170
+ - [index.html](./example/index.html) — HTML host page for `npm run dev`.
171
+ - [headless.ts](./example/headless.ts) — Headless Node CLI (`npm run example`) verifying `exportKhrGlb`, `loadKhrGlb`, `solveWheelLoads`, Pacejka curves, and `loadSand3dBundle("cnc_mounting_bracket")`.
172
+ - [package.json](./package.json) — Package manifest, subpath `exports`, peer dependencies, and scripts.
173
+ - [vite.config.ts](./vite.config.ts) — Vite library build configuration emitting multi-entry ESM bundles into `dist/`.
174
+ - [tsconfig.json](./tsconfig.json) — Strict TypeScript project configuration covering `src/` and `example/`.
175
+ - [tsconfig.build.json](./tsconfig.build.json) — Declaration build configuration emitting `.d.ts` typings into `dist/`.
176
+ - [LICENSE](./LICENSE) — MIT license text.
@@ -4,7 +4,7 @@ import type { RapierRigidBody } from "@react-three/rapier";
4
4
  import { type AssemblyRigidBodyProps } from "./AssemblyRootBody.js";
5
5
  import { type KhrAssetBundle } from "./khrTypes.js";
6
6
  export interface KhrAssemblyHandle {
7
- /** RigidBody owning `nodeName`, or null if no KHR body has that name. */
7
+ /** RigidBody owning `nodeName`, or null if absent from the KHR bundle. */
8
8
  getBody: (nodeName: string) => RapierRigidBody | null;
9
9
  /** Sets the authored Rapier motor position target on one articulated node. */
10
10
  setJointTarget: (nodeName: string, target: number) => void;
@@ -9,6 +9,10 @@ export interface KhrColliderProps {
9
9
  quaternion?: [number, number, number, number];
10
10
  /** Authored body mass carried declaratively by this collider (`density: 0` when omitted). */
11
11
  massProperties?: ColliderMass;
12
+ /** Fallback Rapier collision groups when `c.collisionGroups` is omitted. */
13
+ collisionGroups?: number;
14
+ /** Fallback Rapier solver groups when `c.collisionGroups` is omitted. */
15
+ solverGroups?: number;
12
16
  ref?: React.Ref<RapierCollider>;
13
17
  }
14
- export declare function KhrCollider({ c, position, quaternion, massProperties, ref }: KhrColliderProps): React.JSX.Element;
18
+ export declare function KhrCollider({ c, position, quaternion, massProperties, collisionGroups, solverGroups, ref }: KhrColliderProps): React.JSX.Element;