@khr3/core 0.1.0 → 0.1.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.
package/README.md CHANGED
@@ -1,7 +1,20 @@
1
- # khr3
1
+ # `@khr3/core` (`khr3`)
2
2
 
3
3
  `KHR_physics_rigid_bodies` + `KHR_implicit_shapes` runtime loader, binary `.glb` exporter, `@react-three/rapier` multi-body assembly synchronizer, and `@pinkaphant/ecctrl` vehicle rig + monotone Pacejka curve presets for React Three Fiber.
4
4
 
5
+ ## Stack Map (`@khr3/*` → `Kolmo`)
6
+
7
+ All `@khr3/*` packages are **strictly `koota`-free** reusable building blocks; `Kolmo` owns the ECS, world generation, character body, and universal GLB intake gate:
8
+
9
+ | Package | Role | `koota`? |
10
+ | --- | --- | --- |
11
+ | **`@khr3/core`** *(this package)* | `.glb` KHR physics loader/exporter, `<PhysicsWorld>`, `<KhrAssembly>`, `<KhrVehicle>`, `@khr3/core/curves` | No |
12
+ | `@khr3/assets` | Cloudflare R2 `.glb` vault Worker/client + binary `inspectGlbBuffer` / `normalizeGlbBuffer` | No |
13
+ | `@khr3/c12` | Exact architectural grid ($\mathbb{Z}[1/2, \sqrt{3}]$, `yaw12`), `3 m` socket snapping, `planSettlement` | No |
14
+ | `@khr3/vehicles` | Multi-domain R2 vehicle catalog, multi-body `planCar` (`SEDAN_4DOOR`, `COUPE_2DOOR`), `@khr3/vehicles/paper-shell` | No |
15
+ | `@khr3/launchers` | Moving-part launcher planner (`planLauncher`), rail/hand sockets, ammo catalog, `stepLauncher` | No |
16
+ | `Kolmo` | Game engine & studio (`koota` ECS, `src/world/` roads & terrain, `src/body/`, Universal 2-Step GLB & USD Gate) | **Yes** |
17
+
5
18
  ## Install
6
19
 
7
20
  ```sh
@@ -13,7 +26,7 @@ npm install @khr3/core @pinkaphant/ecctrl @dimforge/rapier3d-compat @react-three
13
26
  | Package | Version | Required By |
14
27
  | --- | --- | --- |
15
28
  | `@dimforge/rapier3d-compat` | `^0.19.0` | `@khr3/core`, `@khr3/core/vehicle` |
16
- | `@pinkaphant/ecctrl` | `^2.0.4-beta.2` | Optional (`@khr3/core/vehicle` only) |
29
+ | `@pinkaphant/ecctrl` | `^2.0.4-beta.3` | Optional (`@khr3/core/vehicle` only) |
17
30
  | `@react-three/fiber` | `^9.0.0` | `@khr3/core`, `@khr3/core/vehicle` |
18
31
  | `@react-three/rapier` | `^2.2.0` | `@khr3/core`, `@khr3/core/vehicle` |
19
32
  | `react` | `^19.0.0` | `@khr3/core`, `@khr3/core/vehicle` |
@@ -26,9 +39,9 @@ npm install @khr3/core @pinkaphant/ecctrl @dimforge/rapier3d-compat @react-three
26
39
 
27
40
  | Subpath | Exports |
28
41
  | --- | --- |
29
- | `@khr3/core` | `PhysicsWorld`, `loadKhrGlb`, `cloneKhrBundle`, `exportKhrGlb`, `patchGlbJsonChunk`, `KhrCollider`, `KhrAssembly`, `KhrValidationError`, KHR & rotor tag types |
30
- | `@khr3/core/vehicle` | `KhrVehicle`, `solveWheelLoads`, `BENCH_GRAVITY`, `KhrVehicleProps`, `KhrWheelConfig`, `SolvedWheel` |
31
- | `@khr3/core/curves` | `compilePacejkaCurve`, `tireGripForSurface`, `engineHorsepowerForPeakTorque`, `TIRE_ARCHETYPES`, `TIRE_SLIP_CURVES`, `ENGINE_TORQUE_CURVES`, `STEER_SPEED_CURVES`, `TireArchetypePreset` |
42
+ | `@khr3/core` | `PhysicsWorld`, `createKhrGltfPlugin`, `useKhrGlb`, `loadKhrGlb`, `cloneKhrBundle`, `disposeKhrBundle`, `claimBundleMount`, `releaseBundleMount`, `exportKhrGlb`, `patchGlbJsonChunk`, `KhrCollider`, `KhrAssembly`, `JointRegistryContext`, `assertUnitScale`, `assertIdentityWorldScale`, `assertSceneIdentityWorldScale`, `KhrValidationError`, KHR & rotor tag types |
43
+ | `@khr3/core/vehicle` | `KhrVehicle`, `solveWheelLoads`, `BENCH_GRAVITY`, `WHEEL_ASSEMBLY_DENSITY_KG_M3`, `KhrVehicleProps`, `KhrWheelConfig`, `SolvedWheel` |
44
+ | `@khr3/core/curves` | `compilePacejkaCurve`, `tireGripForSurface`, `engineHorsepowerForPeakTorque`, `TIRE_ARCHETYPES`, `TIRE_SLIP_CURVES`, `ENGINE_TORQUE_CURVES`, `STEER_SPEED_CURVES`, `TireArchetypePreset`, `CurveData`, `CurvePoint` |
32
45
 
33
46
  ## Quick Start
34
47
 
@@ -109,6 +122,6 @@ function Door() {
109
122
  - **Peak Torque Scaling**: `EcctrlVehicle` computes $T_{\max} = \frac{\text{engineHorsepower} \times 7022}{\text{engineMaxRPM}}$. Use `engineHorsepowerForPeakTorque(peakTorqueNm, engineMaxRPM)`.
110
123
  - **Slip Domains**: `lngSlipRatioCurveData` maps $x = \frac{|\omega R - v_x|}{\max(|v_x|, 10^{-4})} \in [0, 1]$; `latSlipRatioCurveData` maps slip angle linearly as $x = \frac{\operatorname{atan2}(|v_y|, |v_x|)}{\pi/2} \in [0, 1]$.
111
124
  - **Monotone Hermite Tangents**: `CurvePoint` `r_in`/`r_out` are **radian angles** (`slope = Math.tan(r)`). `compilePacejkaCurve` enforces Fritsch–Carlson clamping so `bakeCurveLUT` stays strictly in $[0, 1]$ with zero Hermite overshoot.
112
- - **Shift Hysteresis & Gear-Relative Steer Curve**: Auto transmission requires `shiftDownRPM < shiftUpRPM * min(g[i+1] / g[i])` to prevent shift-hunting; `steerAngleCurveData` evaluates at `v_fwd / (maxWheelAngVel * R)` relative to the **active gear's** redline wheel speed.
125
+ - **Shift Hysteresis & Gear-Relative Steer Curve**: Auto transmission requires `shiftDownRPM < shiftUpRPM * min(g[i+1] / g[i])` to prevent shift oscillation; `steerAngleCurveData` evaluates at `v_fwd / (maxWheelAngVel * R)` relative to the **active gear's** redline wheel speed.
113
126
 
114
127
  See [docs/api-reference.md](./docs/api-reference.md) for the complete API, `.glb` KHR + `extras` schema, custom gravity, transmission, and curve reference.
package/dist/curves.d.ts CHANGED
@@ -340,4 +340,39 @@ export declare const STEER_SPEED_CURVES: {
340
340
  readonly w_in: 1;
341
341
  }];
342
342
  };
343
+ readonly heavy6x6AntiRollover: {
344
+ readonly samples: 80;
345
+ readonly points: [{
346
+ readonly x: 0;
347
+ readonly y: 1;
348
+ readonly r_out: 0;
349
+ readonly w_out: 1;
350
+ }, {
351
+ readonly x: 0.1;
352
+ readonly y: 0.94;
353
+ readonly r_in: -0.45;
354
+ readonly r_out: -0.95;
355
+ readonly w_in: 1;
356
+ readonly w_out: 1;
357
+ }, {
358
+ readonly x: 0.28;
359
+ readonly y: 0.42;
360
+ readonly r_in: -1.12;
361
+ readonly r_out: -0.85;
362
+ readonly w_in: 1;
363
+ readonly w_out: 1;
364
+ }, {
365
+ readonly x: 0.55;
366
+ readonly y: 0.19;
367
+ readonly r_in: -0.42;
368
+ readonly r_out: -0.22;
369
+ readonly w_in: 1;
370
+ readonly w_out: 1;
371
+ }, {
372
+ readonly x: 1;
373
+ readonly y: 0.11;
374
+ readonly r_in: -0.1;
375
+ readonly w_in: 1;
376
+ }];
377
+ };
343
378
  };
package/dist/curves.js CHANGED
@@ -468,6 +468,47 @@ var i = {
468
468
  w_in: 1
469
469
  }
470
470
  ]
471
+ },
472
+ heavy6x6AntiRollover: {
473
+ samples: 80,
474
+ points: [
475
+ {
476
+ x: 0,
477
+ y: 1,
478
+ r_out: 0,
479
+ w_out: 1
480
+ },
481
+ {
482
+ x: .1,
483
+ y: .94,
484
+ r_in: -.45,
485
+ r_out: -.95,
486
+ w_in: 1,
487
+ w_out: 1
488
+ },
489
+ {
490
+ x: .28,
491
+ y: .42,
492
+ r_in: -1.12,
493
+ r_out: -.85,
494
+ w_in: 1,
495
+ w_out: 1
496
+ },
497
+ {
498
+ x: .55,
499
+ y: .19,
500
+ r_in: -.42,
501
+ r_out: -.22,
502
+ w_in: 1,
503
+ w_out: 1
504
+ },
505
+ {
506
+ x: 1,
507
+ y: .11,
508
+ r_in: -.1,
509
+ w_in: 1
510
+ }
511
+ ]
471
512
  }
472
513
  };
473
514
  export { o as ENGINE_TORQUE_CURVES, s as STEER_SPEED_CURVES, i as TIRE_ARCHETYPES, a as TIRE_SLIP_CURVES, t as compilePacejkaCurve, r as engineHorsepowerForPeakTorque, n as tireGripForSurface };
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ export { PhysicsWorld, type PhysicsWorldProps } from "./PhysicsWorld.js";
2
2
  export { KhrValidationError, createKhrGltfPlugin, loadKhrGlb, type EcctrlPropellerTag, type EcctrlWheelTag, type KhrAssetBundle, type KhrBodySpec, type KhrColliderShape, type KhrColliderSpec, type KhrExportNodeSpec, type KhrImplicitShape, type KhrJointDriveSpec, type KhrJointSpec, type LoadKhrGlbOptions, } from "./khrLoader.js";
3
3
  export { exportKhrGlb, patchGlbJsonChunk } from "./khrExporter.js";
4
4
  export { claimBundleMount, cloneKhrBundle, disposeKhrBundle, releaseBundleMount } from "./khrClone.js";
5
- export { assertIdentityWorldScale } from "./khrInertia.js";
5
+ export { assertIdentityWorldScale, assertSceneIdentityWorldScale, assertUnitScale } from "./khrInertia.js";
6
6
  export { KhrCollider } from "./KhrCollider.js";
7
7
  export { KhrAssembly, type KhrAssemblyHandle, type KhrAssemblyProps } from "./KhrAssembly.js";
8
8
  export { useKhrGlb } from "./useKhrGlb.js";
package/dist/index.js CHANGED
@@ -1481,4 +1481,4 @@ ht.preload = (e, t) => {
1481
1481
  }
1482
1482
  }
1483
1483
  };
1484
- export { y as JointRegistryContext, at as KhrAssembly, t as KhrCollider, v as KhrValidationError, ce as PhysicsWorld, g as assertIdentityWorldScale, d as claimBundleMount, m as cloneKhrBundle, Ve as createKhrGltfPlugin, r as disposeKhrBundle, Xe as exportKhrGlb, We as loadKhrGlb, he as patchGlbJsonChunk, c as releaseBundleMount, ht as useKhrGlb };
1484
+ export { y as JointRegistryContext, at as KhrAssembly, t as KhrCollider, v as KhrValidationError, ce as PhysicsWorld, g as assertIdentityWorldScale, i as assertSceneIdentityWorldScale, a as assertUnitScale, d as claimBundleMount, m as cloneKhrBundle, Ve as createKhrGltfPlugin, r as disposeKhrBundle, Xe as exportKhrGlb, We as loadKhrGlb, he as patchGlbJsonChunk, c as releaseBundleMount, ht as useKhrGlb };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@khr3/core",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -59,7 +59,7 @@
59
59
  },
60
60
  "devDependencies": {
61
61
  "@dimforge/rapier3d-compat": "^0.19.2",
62
- "@pinkaphant/ecctrl": "2.0.4-beta.3",
62
+ "@pinkaphant/ecctrl": "^2.0.4-beta.3",
63
63
  "@playwright/test": "^1.65.1",
64
64
  "@react-three/drei": "^10.7.7",
65
65
  "@react-three/fiber": "^9.6.1",