@pinkaphant/kolmo 0.1.3 → 0.2.0

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/bin/kolmo.mjs CHANGED
@@ -2,6 +2,8 @@
2
2
  import fs from "node:fs";
3
3
  import path from "node:path";
4
4
 
5
+ const kolmoPkg = JSON.parse(fs.readFileSync(new URL("../package.json", import.meta.url), "utf8"));
6
+
5
7
  const args = process.argv.slice(2);
6
8
  const cmd = args[0];
7
9
  if (cmd !== "create" && cmd !== "init") {
@@ -37,13 +39,13 @@ fs.writeFileSync(path.join(targetDir, "package.json"), JSON.stringify({
37
39
  },
38
40
  dependencies: {
39
41
  "@dimforge/rapier3d-compat": "0.19.2",
40
- "@khr3/assets": "^0.2.2",
41
- "@khr3/c12": "^0.3.1",
42
- "@khr3/core": "^0.1.2",
43
- "@khr3/launchers": "^0.2.2",
44
- "@khr3/vehicles": "^0.1.3",
45
- "@pinkaphant/ecctrl": "^2.0.4-beta.3",
46
- "@pinkaphant/kolmo": "^0.1.3",
42
+ "@khr3/assets": kolmoPkg.dependencies["@khr3/assets"],
43
+ "@khr3/c12": kolmoPkg.dependencies["@khr3/c12"],
44
+ "@khr3/core": kolmoPkg.dependencies["@khr3/core"],
45
+ "@khr3/launchers": kolmoPkg.dependencies["@khr3/launchers"],
46
+ "@khr3/vehicles": kolmoPkg.dependencies["@khr3/vehicles"],
47
+ "@pinkaphant/ecctrl": kolmoPkg.peerDependencies["@pinkaphant/ecctrl"],
48
+ "@pinkaphant/kolmo": `^${kolmoPkg.version}`,
47
49
  "@pmndrs/uikit": "^1.0.78",
48
50
  "@preact/signals-core": "^1.14.5",
49
51
  "@react-three/drei": "^10.7.7",
@@ -53,9 +53,9 @@ function k({ ref: y, bundle: b, socket: x, bodyRef: k, parentSocketObject: A, us
53
53
  invRoot: n,
54
54
  colliderEntries: o
55
55
  };
56
- }, [b]), H = t(() => {
57
- let e = F.current, t = A ?? k?.current?.socket(x) ?? I.current;
58
- e && t && (b.scene.parent !== t && t.add(b.scene), b.scene.updateWorldMatrix(!0, !1), S.multiplyMatrices(b.scene.matrixWorld, z), S.decompose(C, w, T), w.normalize(), e.setTranslation(C, !0), e.setRotation(w, !0), e.setNextKinematicTranslation(C), e.setNextKinematicRotation(w), M.propagateModifiedBodyPositionsToColliders());
56
+ }, [b]), H = t((e) => {
57
+ let t = F.current, n = A ?? k?.current?.socket(x) ?? I.current;
58
+ t && n && (b.scene.parent !== n && n.add(b.scene), b.scene.updateWorldMatrix(!0, !1), S.multiplyMatrices(b.scene.matrixWorld, z), S.decompose(C, w, T), w.normalize(), e ? (t.setTranslation(C, !0), t.setRotation(w, !0), t.setNextKinematicTranslation(C), t.setNextKinematicRotation(w), M.propagateModifiedBodyPositionsToColliders()) : (t.setNextKinematicTranslation(C), t.setNextKinematicRotation(w)));
59
59
  }, [
60
60
  b,
61
61
  z,
@@ -108,7 +108,7 @@ function k({ ref: y, bundle: b, socket: x, bodyRef: k, parentSocketObject: A, us
108
108
  let t = o.get(e.nodeName);
109
109
  t.parent = o.get(e.joint.connectedNodeName) ?? null, N?.add(t);
110
110
  }
111
- return L.current = o, H(), () => {
111
+ return L.current = o, H(!0), () => {
112
112
  for (let e of o.values()) N?.delete(e), e.object.position.copy(e.restPosition), e.object.quaternion.copy(e.restQuaternion);
113
113
  L.current = /* @__PURE__ */ new Map(), b.scene.parent && b.scene.parent.remove(b.scene), n && n.add(b.scene), b.scene.position.copy(e), b.scene.quaternion.copy(t), p(b);
114
114
  };
@@ -123,7 +123,7 @@ function k({ ref: y, bundle: b, socket: x, bodyRef: k, parentSocketObject: A, us
123
123
  V,
124
124
  H
125
125
  ]), c(() => {
126
- H();
126
+ H(!1);
127
127
  }), r(y, () => {
128
128
  let e = (e, t) => {
129
129
  if (!e.drive || e.drive.stiffness === void 0) throw new d(`Joint "${e.nodeName}" has no authored drive stiffness; cannot set a position target`);
@@ -1,11 +1,11 @@
1
- import { BODY_MOVE_TUNE as e, BODY_SI as t, BODY_SOCKET_IDS as n, bodyEyeOffsetY as r, bodyRestCenterY as i, stepCameraSync as a } from "./bodySi.js";
2
- import { useEffect as o, useImperativeHandle as s, useMemo as c, useRef as l } from "react";
3
- import { useFrame as u, useThree as d } from "@react-three/fiber";
4
- import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
5
- import { Ecctrl as h } from "@pinkaphant/ecctrl";
6
- import { EcctrlCameraControls as g } from "@pinkaphant/ecctrl/camera";
1
+ import { BODY_SI as e, BODY_SOCKET_IDS as t, bodyEyeOffsetY as n, bodyRestCenterY as r, stepCameraSync as i } from "./bodySi.js";
2
+ import { useEffect as a, useImperativeHandle as o, useMemo as s, useRef as c } from "react";
3
+ import { useFrame as l, useThree as u } from "@react-three/fiber";
4
+ import { Fragment as d, jsx as f, jsxs as p } from "react/jsx-runtime";
5
+ import { Ecctrl as m } from "@pinkaphant/ecctrl";
6
+ import { EcctrlCameraControls as h } from "@pinkaphant/ecctrl/camera";
7
7
  // src/body/KhrBody.tsx
8
- var _ = Object.freeze({
8
+ var g = Object.freeze({
9
9
  Socket_Hand_R: [
10
10
  .22,
11
11
  -.18,
@@ -26,7 +26,7 @@ var _ = Object.freeze({
26
26
  -.25,
27
27
  .28
28
28
  ]
29
- }), v = {
29
+ }), _ = {
30
30
  forward: !1,
31
31
  backward: !1,
32
32
  leftward: !1,
@@ -34,8 +34,8 @@ var _ = Object.freeze({
34
34
  run: !1,
35
35
  jump: !1
36
36
  };
37
- function y({ active: e, ecctrlRef: t }) {
38
- let n = l({
37
+ function v({ active: e, ecctrlRef: t }) {
38
+ let n = c({
39
39
  w: !1,
40
40
  s: !1,
41
41
  a: !1,
@@ -43,8 +43,8 @@ function y({ active: e, ecctrlRef: t }) {
43
43
  shift: !1,
44
44
  space: !1,
45
45
  dirty: !1
46
- }), r = l(e);
47
- return o(() => {
46
+ }), r = c(e);
47
+ return a(() => {
48
48
  if (!e || typeof window > "u" || typeof window.addEventListener != "function") return;
49
49
  let t = (e) => (t) => {
50
50
  let r = n.current;
@@ -56,33 +56,33 @@ function y({ active: e, ecctrlRef: t }) {
56
56
  return window.addEventListener("keydown", i), window.addEventListener("keyup", a), window.addEventListener("blur", r), () => {
57
57
  window.removeEventListener("keydown", i), window.removeEventListener("keyup", a), window.removeEventListener("blur", r);
58
58
  };
59
- }, [e]), u(() => {
59
+ }, [e]), l(() => {
60
60
  let i = t.current;
61
61
  if (!i) return;
62
62
  if (!e) {
63
63
  if (r.current) {
64
64
  let e = n.current;
65
- e.w = !1, e.s = !1, e.a = !1, e.d = !1, e.shift = !1, e.space = !1, e.dirty = !1, v.forward = !1, v.backward = !1, v.leftward = !1, v.rightward = !1, v.run = !1, v.jump = !1, i.setMovement(v), r.current = !1;
65
+ e.w = !1, e.s = !1, e.a = !1, e.d = !1, e.shift = !1, e.space = !1, e.dirty = !1, _.forward = !1, _.backward = !1, _.leftward = !1, _.rightward = !1, _.run = !1, _.jump = !1, i.setMovement(_), r.current = !1;
66
66
  }
67
67
  return;
68
68
  }
69
69
  r.current = !0;
70
70
  let a = n.current;
71
- a.dirty && (a.dirty = !1, v.forward = a.w, v.backward = a.s, v.leftward = a.a, v.rightward = a.d, v.run = a.shift, v.jump = a.space, i.setMovement(v));
71
+ a.dirty && (a.dirty = !1, _.forward = a.w, _.backward = a.s, _.leftward = a.a, _.rightward = a.d, _.run = a.shift, _.jump = a.space, i.setMovement(_));
72
72
  }), null;
73
73
  }
74
- function b({ ref: o, si: u = t, smoothCamera: v = !1, makeDefaultCamera: b = !0, enableInput: S = !0, enable: C = !0, viewModelChildren: w, socketOffsets: T, children: E, userData: D, position: O, ...k }) {
75
- let A = l(null), j = l(null), M = l(null), N = l({
74
+ function y({ ref: a, si: l = e, smoothCamera: _ = !1, makeDefaultCamera: y = !0, enableInput: x = !0, enable: S = !0, viewModelChildren: C, socketOffsets: w, children: T, userData: E, position: D, ...O }) {
75
+ let k = c(null), A = c(null), j = c(null), M = c({
76
76
  Socket_Hand_R: null,
77
77
  Socket_Hand_L: null,
78
78
  Socket_Head: null,
79
79
  Socket_Back: null
80
- }), P = c(() => r(u), [u]), F = c(() => [
80
+ }), N = s(() => n(l), [l]), P = s(() => [
81
81
  0,
82
- i(u),
82
+ r(l),
83
83
  0
84
- ], [u]), I = d((e) => typeof e.gl?.domElement?.setAttribute == "function"), L = c(() => {
85
- let e = D ?? {}, t = e.ecctrl ?? {};
84
+ ], [l]), F = u((e) => typeof e.gl?.domElement?.setAttribute == "function"), I = s(() => {
85
+ let e = E ?? {}, t = e.ecctrl ?? {};
86
86
  return {
87
87
  ...e,
88
88
  ecctrl: {
@@ -90,63 +90,55 @@ function b({ ref: o, si: u = t, smoothCamera: v = !1, makeDefaultCamera: b = !0,
90
90
  ...t
91
91
  }
92
92
  };
93
- }, [D]);
94
- return s(o, () => ({
93
+ }, [E]);
94
+ return o(a, () => ({
95
95
  get ecctrl() {
96
- return A.current;
96
+ return k.current;
97
97
  },
98
98
  get cameraControls() {
99
- return j.current;
99
+ return A.current;
100
100
  },
101
101
  socket(e) {
102
- return N.current[e] ?? null;
102
+ return M.current[e] ?? null;
103
103
  },
104
104
  syncCameraStep(e) {
105
- a(j.current, e, P, v, A.current?.bodyYAxis);
105
+ i(A.current, e, N, _, k.current?.bodyYAxis);
106
106
  }
107
- }), [P, v]), /* @__PURE__ */ m(f, { children: [
108
- /* @__PURE__ */ p(y, {
109
- active: !!(C && S),
110
- ecctrlRef: A
107
+ }), [N, _]), /* @__PURE__ */ p(d, { children: [
108
+ /* @__PURE__ */ f(v, {
109
+ active: !!(S && x),
110
+ ecctrlRef: k
111
111
  }),
112
- /* @__PURE__ */ p(h, {
113
- ref: A,
114
- enable: C,
115
- position: O ?? F,
116
- capsuleHalfHeight: u.capsuleHalfHeight,
117
- capsuleRadius: u.capsuleRadius,
118
- floatHeight: u.floatHeight,
119
- maxWalkVel: e.maxWalkVel,
120
- maxRunVel: e.maxRunVel,
121
- accDeltaTime: e.accDeltaTime,
122
- decDeltaTime: e.decDeltaTime,
123
- slideGripFactor: e.slideGripFactor,
124
- moveImpulsePointOffset: e.moveImpulsePointOffset,
125
- airDragFactor: e.airDragFactor,
126
- enableToggleRun: e.enableToggleRun,
127
- ...k,
128
- userData: L,
129
- children: E
112
+ /* @__PURE__ */ f(m, {
113
+ ref: k,
114
+ enable: S,
115
+ position: D ?? P,
116
+ capsuleHalfHeight: l.capsuleHalfHeight,
117
+ capsuleRadius: l.capsuleRadius,
118
+ floatHeight: l.floatHeight,
119
+ ...O,
120
+ userData: I,
121
+ children: T
130
122
  }),
131
- I ? /* @__PURE__ */ p(g, {
132
- ref: j,
133
- makeDefault: b
123
+ F ? /* @__PURE__ */ f(h, {
124
+ ref: A,
125
+ makeDefault: y
134
126
  }) : null,
135
- /* @__PURE__ */ p(x, {
136
- enable: C,
137
- makeDefaultCamera: b,
138
- ecctrlRef: A,
139
- camControlsRef: j,
140
- viewModelGroupRef: M,
141
- eyeOffsetY: P,
142
- smoothCamera: v
127
+ /* @__PURE__ */ f(b, {
128
+ enable: S,
129
+ makeDefaultCamera: y,
130
+ ecctrlRef: k,
131
+ camControlsRef: A,
132
+ viewModelGroupRef: j,
133
+ eyeOffsetY: N,
134
+ smoothCamera: _
143
135
  }),
144
- /* @__PURE__ */ m("group", {
145
- ref: M,
136
+ /* @__PURE__ */ p("group", {
137
+ ref: j,
146
138
  name: "KhrBody_ViewModel",
147
- children: [n.map((e) => {
148
- let t = T?.[e] ?? _[e];
149
- return /* @__PURE__ */ p("group", {
139
+ children: [t.map((e) => {
140
+ let t = w?.[e] ?? g[e];
141
+ return /* @__PURE__ */ f("group", {
150
142
  name: e,
151
143
  position: [
152
144
  t[0],
@@ -154,26 +146,26 @@ function b({ ref: o, si: u = t, smoothCamera: v = !1, makeDefaultCamera: b = !0,
154
146
  t[2]
155
147
  ],
156
148
  ref: (t) => {
157
- N.current[e] = t;
149
+ M.current[e] = t;
158
150
  }
159
151
  }, e);
160
- }), w]
152
+ }), C]
161
153
  })
162
154
  ] });
163
155
  }
164
- function x({ enable: e, makeDefaultCamera: t, ecctrlRef: n, camControlsRef: r, viewModelGroupRef: i, eyeOffsetY: o, smoothCamera: s }) {
165
- return u((c) => {
156
+ function b({ enable: e, makeDefaultCamera: t, ecctrlRef: n, camControlsRef: r, viewModelGroupRef: a, eyeOffsetY: o, smoothCamera: s }) {
157
+ return l((c) => {
166
158
  if (!e) return;
167
159
  let l = n.current;
168
160
  if (l) {
169
- if (r.current) a(r.current, l.currPos, o, s, l.bodyYAxis);
161
+ if (r.current) i(r.current, l.currPos, o, s, l.bodyYAxis);
170
162
  else if (t) {
171
163
  let e = l.bodyYAxis;
172
164
  c.camera.position.set(l.currPos.x + e.x * o, l.currPos.y + e.y * o, l.currPos.z + e.z * o);
173
165
  }
174
166
  }
175
- let u = i.current;
167
+ let u = a.current;
176
168
  u && (u.position.copy(c.camera.position), u.quaternion.copy(c.camera.quaternion));
177
169
  }), null;
178
170
  }
179
- export { b as KhrBody, a as stepCameraSync };
171
+ export { y as KhrBody, i as stepCameraSync };
@@ -18,17 +18,6 @@ export interface BodySiConstants {
18
18
  }
19
19
  /** 1.75 m standing adult: 2 * 0.50 + 2 * 0.30 + 0.15. */
20
20
  export declare const BODY_SI: BodySiConstants;
21
- /** Ecctrl movement tuning for the standing SI body. */
22
- export declare const BODY_MOVE_TUNE: Readonly<{
23
- readonly maxWalkVel: 2.5;
24
- readonly maxRunVel: 9;
25
- readonly accDeltaTime: 0.25;
26
- readonly decDeltaTime: 0.25;
27
- readonly slideGripFactor: 1;
28
- readonly moveImpulsePointOffset: 0;
29
- readonly airDragFactor: 0.85;
30
- readonly enableToggleRun: false;
31
- }>;
32
21
  export type BodySocketId = "Socket_Hand_R" | "Socket_Hand_L" | "Socket_Head" | "Socket_Back";
33
22
  export declare const BODY_SOCKET_IDS: readonly BodySocketId[];
34
23
  /** Rigid-body centre height when standing at rest on flat ground. */
@@ -6,44 +6,35 @@ var e = Object.freeze({
6
6
  eyeHeight: 1.62,
7
7
  firstPersonDistance: .02,
8
8
  thirdPersonDistance: 3.2
9
- }), t = Object.freeze({
10
- maxWalkVel: 2.5,
11
- maxRunVel: 9,
12
- accDeltaTime: .25,
13
- decDeltaTime: .25,
14
- slideGripFactor: 1,
15
- moveImpulsePointOffset: 0,
16
- airDragFactor: .85,
17
- enableToggleRun: !1
18
- }), n = Object.freeze([
9
+ }), t = Object.freeze([
19
10
  "Socket_Hand_R",
20
11
  "Socket_Hand_L",
21
12
  "Socket_Head",
22
13
  "Socket_Back"
23
14
  ]);
24
- function r(e) {
15
+ function n(e) {
25
16
  for (let [t, n] of Object.entries(e)) if (!(typeof n == "number" && Number.isFinite(n) && n >= 0)) throw RangeError(`kolmo/body: ${t} must be a finite non-negative number, got ${String(n)}`);
26
17
  if (!(e.capsuleRadius > 0)) throw RangeError("kolmo/body: capsuleRadius must be > 0");
27
18
  }
19
+ function r(t = e) {
20
+ return n(t), t.floatHeight + t.capsuleRadius + t.capsuleHalfHeight;
21
+ }
28
22
  function i(t = e) {
29
- return r(t), t.floatHeight + t.capsuleRadius + t.capsuleHalfHeight;
23
+ return r(t) + t.capsuleHalfHeight + t.capsuleRadius;
30
24
  }
31
25
  function a(t = e) {
32
- return i(t) + t.capsuleHalfHeight + t.capsuleRadius;
33
- }
34
- function o(t = e) {
35
- let n = t.eyeHeight - i(t);
26
+ let n = t.eyeHeight - r(t);
36
27
  if (!(n > 0)) throw RangeError("kolmo/body: eyeHeight must sit above the body centre");
37
28
  return n;
38
29
  }
39
- function s(t, n, r, a = e) {
30
+ function o(t, n, i, a = e) {
40
31
  return [
41
32
  t,
42
- n + i(a),
43
- r
33
+ n + r(a),
34
+ i
44
35
  ];
45
36
  }
46
- function c(e) {
37
+ function s(e) {
47
38
  let t = e?.ecctrl ?? {};
48
39
  return {
49
40
  ...e ?? {},
@@ -53,9 +44,9 @@ function c(e) {
53
44
  }
54
45
  };
55
46
  }
56
- function l(e, t, n, r, i) {
47
+ function c(e, t, n, r, i) {
57
48
  if (!e) return;
58
49
  let a = i ? t.x + i.x * n : t.x, o = i ? t.y + i.y * n : t.y + n, s = i ? t.z + i.z * n : t.z;
59
50
  e.moveTo?.(a, o, s, r);
60
51
  }
61
- export { t as BODY_MOVE_TUNE, e as BODY_SI, n as BODY_SOCKET_IDS, o as bodyEyeOffsetY, i as bodyRestCenterY, s as bodySpawnPosition, a as bodyStandingHeight, l as stepCameraSync, c as withExcludeCharacterRay };
52
+ export { e as BODY_SI, t as BODY_SOCKET_IDS, a as bodyEyeOffsetY, r as bodyRestCenterY, o as bodySpawnPosition, i as bodyStandingHeight, c as stepCameraSync, s as withExcludeCharacterRay };
@@ -1,3 +1,3 @@
1
- export { BODY_MOVE_TUNE, BODY_SI, BODY_SOCKET_IDS, bodyEyeOffsetY, bodyRestCenterY, bodySpawnPosition, bodyStandingHeight, stepCameraSync, withExcludeCharacterRay, type BodySiConstants, type BodySocketId, } from "./bodySi.js";
1
+ export { BODY_SI, BODY_SOCKET_IDS, bodyEyeOffsetY, bodyRestCenterY, bodySpawnPosition, bodyStandingHeight, stepCameraSync, withExcludeCharacterRay, type BodySiConstants, type BodySocketId, } from "./bodySi.js";
2
2
  export { KhrBody, type KhrBodyHandle, type KhrBodyProps } from "./KhrBody.js";
3
3
  export { HeldItem, type HeldItemHandle, type HeldItemProps } from "./HeldItem.js";
@@ -1,4 +1,4 @@
1
- import { BODY_MOVE_TUNE as e, BODY_SI as t, BODY_SOCKET_IDS as n, bodyEyeOffsetY as r, bodyRestCenterY as i, bodySpawnPosition as a, bodyStandingHeight as o, stepCameraSync as s, withExcludeCharacterRay as c } from "./bodySi.js";
2
- import { KhrBody as l } from "./KhrBody.js";
3
- import { HeldItem as u } from "./HeldItem.js";
4
- export { e as BODY_MOVE_TUNE, t as BODY_SI, n as BODY_SOCKET_IDS, u as HeldItem, l as KhrBody, r as bodyEyeOffsetY, i as bodyRestCenterY, a as bodySpawnPosition, o as bodyStandingHeight, s as stepCameraSync, c as withExcludeCharacterRay };
1
+ import { BODY_SI as e, BODY_SOCKET_IDS as t, bodyEyeOffsetY as n, bodyRestCenterY as r, bodySpawnPosition as i, bodyStandingHeight as a, stepCameraSync as o, withExcludeCharacterRay as s } from "./bodySi.js";
2
+ import { KhrBody as c } from "./KhrBody.js";
3
+ import { HeldItem as l } from "./HeldItem.js";
4
+ export { e as BODY_SI, t as BODY_SOCKET_IDS, l as HeldItem, c as KhrBody, n as bodyEyeOffsetY, r as bodyRestCenterY, i as bodySpawnPosition, a as bodyStandingHeight, o as stepCameraSync, s as withExcludeCharacterRay };
@@ -1,4 +1,9 @@
1
+ import React, { type ReactNode } from "react";
1
2
  import { type KeyboardControlsEntry } from "@react-three/drei";
3
+ export declare const KolmoKeyboardContext: React.Context<(() => Record<string, boolean>) | null>;
4
+ export declare function KolmoKeyboardBridge({ children }: {
5
+ readonly children: ReactNode;
6
+ }): React.JSX.Element;
2
7
  export type KolmoKeyAction = "forward" | "backward" | "left" | "right" | "brake" | "boost" | "interact" | "turnLeft" | "turnRight" | "descend" | "cameraView";
3
8
  export type KolmoInputState = Record<KolmoKeyAction, boolean>;
4
9
  export type KolmoInputGetter = () => Partial<KolmoInputState>;
@@ -1,7 +1,12 @@
1
- import { useCallback as e, useRef as t } from "react";
2
- import { useKeyboardControls as n } from "@react-three/drei";
1
+ import e, { createContext as t, useCallback as n, useContext as r, useRef as i } from "react";
2
+ import { useKeyboardControls as a } from "@react-three/drei";
3
3
  // src/engine/kolmoInput.ts
4
- var r = Object.freeze({
4
+ var o = t(null);
5
+ function s({ children: t }) {
6
+ let [, n] = a();
7
+ return e.createElement(o.Provider, { value: n }, t);
8
+ }
9
+ var c = Object.freeze({
5
10
  forward: !1,
6
11
  backward: !1,
7
12
  left: !1,
@@ -13,7 +18,7 @@ var r = Object.freeze({
13
18
  turnRight: !1,
14
19
  descend: !1,
15
20
  cameraView: !1
16
- }), i = [
21
+ }), l = [
17
22
  {
18
23
  name: "forward",
19
24
  keys: ["KeyW", "ArrowUp"]
@@ -59,22 +64,15 @@ var r = Object.freeze({
59
64
  keys: ["KeyV"]
60
65
  }
61
66
  ];
62
- function a(i) {
63
- let a = null;
64
- try {
65
- let [, e] = n();
66
- a = e;
67
- } catch {
68
- a = null;
69
- }
70
- let o = t(i);
71
- o.current = i;
72
- let s = t({ ...r });
73
- return e(() => {
74
- let e = o.current?.();
75
- if (!a && !e) return r;
76
- let t = a ? a() : r, n = s.current;
77
- return n.forward = !!(e?.forward ?? t.forward), n.backward = !!(e?.backward ?? t.backward), n.left = !!(e?.left ?? t.left), n.right = !!(e?.right ?? t.right), n.brake = !!(e?.brake ?? t.brake), n.boost = !!(e?.boost ?? t.boost), n.interact = !!(e?.interact ?? t.interact), n.turnLeft = !!(e?.turnLeft ?? t.turnLeft), n.turnRight = !!(e?.turnRight ?? t.turnRight), n.descend = !!(e?.descend ?? t.descend), n.cameraView = !!(e?.cameraView ?? t.cameraView), n;
78
- }, [a]);
67
+ function u(e) {
68
+ let t = r(o), a = i(e);
69
+ a.current = e;
70
+ let s = i({ ...c });
71
+ return n(() => {
72
+ let e = a.current?.();
73
+ if (!t && !e) return c;
74
+ let n = t ? t() : c, r = s.current;
75
+ return r.forward = !!(e?.forward ?? n.forward), r.backward = !!(e?.backward ?? n.backward), r.left = !!(e?.left ?? n.left), r.right = !!(e?.right ?? n.right), r.brake = !!(e?.brake ?? n.brake), r.boost = !!(e?.boost ?? n.boost), r.interact = !!(e?.interact ?? n.interact), r.turnLeft = !!(e?.turnLeft ?? n.turnLeft), r.turnRight = !!(e?.turnRight ?? n.turnRight), r.descend = !!(e?.descend ?? n.descend), r.cameraView = !!(e?.cameraView ?? n.cameraView), r;
76
+ }, [t]);
79
77
  }
80
- export { r as EMPTY_KOLMO_INPUT, i as KOLMO_KEY_MAP, a as useKolmoInput };
78
+ export { c as EMPTY_KOLMO_INPUT, l as KOLMO_KEY_MAP, s as KolmoKeyboardBridge, o as KolmoKeyboardContext, u as useKolmoInput };
@@ -22,6 +22,7 @@ export interface KolmoVehicleProps {
22
22
  userData?: Record<string, unknown>;
23
23
  onCollisionEnter?: (payload: CollisionEnterPayload) => void;
24
24
  wheelConfig?: KhrVehicleProps["wheelConfig"];
25
+ propellerConfig?: KhrVehicleProps["propellerConfig"];
25
26
  carConfig?: Record<string, unknown>;
26
27
  droneConfig?: Partial<DroneConfigType>;
27
28
  vehicleRef?: React.RefObject<EcctrlVehicleHandle | null>;
@@ -6,14 +6,14 @@ import { applySceneRetroMaterials as o } from "../shaders/retroShader.js";
6
6
  import { useKolmoInput as ee } from "./kolmoInput.js";
7
7
  import { InteractableTrait as te, VehicleTrait as s, WorldSessionTrait as c, ensureWorldSession as ne, kolmoActions as l, useActiveKolmoWorld as re, useWorldTrait as ie } from "./kolmoStore.js";
8
8
  import { stepKolmoVehicleFrame as ae } from "./kolmoVehicleDriver.js";
9
- import { useCallback as u, useContext as oe, useEffect as d, useLayoutEffect as f, useMemo as p, useRef as m, useState as h } from "react";
10
- import * as se from "three";
11
- import { useFrame as ce } from "@react-three/fiber";
12
- import { cloneKhrBundle as le, loadKhrGlb as g, useKhrGlb as _ } from "@khr3/core";
13
- import { jsx as v, jsxs as y } from "react/jsx-runtime";
14
- import { KhrVehicle as b } from "@khr3/core/vehicle";
9
+ import { useCallback as u, useContext as d, useEffect as f, useLayoutEffect as p, useMemo as m, useRef as h, useState as g } from "react";
10
+ import * as oe from "three";
11
+ import { useFrame as se } from "@react-three/fiber";
12
+ import { cloneKhrBundle as ce, loadKhrGlb as _, useKhrGlb as v } from "@khr3/core";
13
+ import { jsx as y, jsxs as le } from "react/jsx-runtime";
14
+ import { KhrVehicle as ue } from "@khr3/core/vehicle";
15
15
  // src/engine/kolmoVehicle.tsx
16
- function ue(e) {
16
+ function b(e) {
17
17
  e.traverse((e) => {
18
18
  let n = e.userData?.gltfExtensions?.[t];
19
19
  n && !e.userData.KOLMO_emitter && (e.userData[t] = n);
@@ -38,35 +38,40 @@ function de(e) {
38
38
  for (let e of t) e.dispose();
39
39
  };
40
40
  }
41
- function x({ id: t, sourceBundle: o, rawGlbBytes: h, position: g = [
41
+ function x({ id: t, sourceBundle: o, rawGlbBytes: g, position: _ = [
42
42
  0,
43
43
  .35,
44
44
  0
45
- ], rotation: _, piloted: x = !1, flightMode: S = !1, vehicleMode: C, enable: w = !0, ccd: T, linearDamping: E, angularDamping: D, userData: O, onCollisionEnter: k, wheelConfig: A, carConfig: j, droneConfig: M, vehicleRef: N, getInput: fe, driver: P, cameraController: F, children: I }) {
46
- let L = oe(e), R = re();
47
- f(() => {
45
+ ], rotation: v, piloted: x = !1, flightMode: S = !1, vehicleMode: C, enable: fe = !0, ccd: w, linearDamping: T, angularDamping: E, userData: D, onCollisionEnter: O, wheelConfig: k, propellerConfig: A, carConfig: j, droneConfig: M, vehicleRef: N, getInput: pe, driver: P, cameraController: F, children: I }) {
46
+ let L = d(e), R = re();
47
+ p(() => {
48
48
  ne(R);
49
49
  }, [R]);
50
- let z = ie(R, c), B = ee(fe), V = p(() => le(o), [o]), H = p(() => i(V), [V]), U = p(() => (ue(V.scene), r(V.scene, h)), [V, h]);
51
- f(() => de([
52
- V.scene,
53
- ...V.wheels.map((e) => e.object),
54
- ...V.propellers.map((e) => e.object)
55
- ]), [V]);
56
- let W = !!(C === "rocket" || S || C !== "drive" && V.propellers.length > 0), G = p(() => U.sockets.find((e) => e.role === "seat" || e.role === "optic")?.localPosition ?? [
50
+ let z = ie(R, c), me = ee(pe), B = m(() => ce(o), [o]), V = m(() => i(B), [B]), H = m(() => (b(B.scene), r(B.scene, g)), [B, g]);
51
+ p(() => de([
52
+ B.scene,
53
+ ...B.wheels.map((e) => e.object),
54
+ ...B.propellers.map((e) => e.object)
55
+ ]), [B]);
56
+ let U = !!(C === "rocket" || S || C !== "drive" && B.propellers.length > 0), W = m(() => H.sockets.find((e) => e.role === "seat" || e.role === "optic")?.localPosition ?? [
57
57
  0,
58
58
  .65,
59
59
  0
60
- ], [U]), K = p(() => U.sockets.find((e) => e.role === "exit")?.localPosition ?? [
60
+ ], [H]), G = m(() => H.sockets.find((e) => e.role === "exit")?.localPosition ?? [
61
61
  -1.55,
62
62
  .45,
63
63
  0
64
- ], [U]), q = p(() => {
65
- if (A || C !== void 0) return {
64
+ ], [H]), K = m(() => {
65
+ if (k || C !== void 0) return {
66
66
  ...C === void 0 ? {} : { enable: C === "drive" },
67
+ ...k ?? {}
68
+ };
69
+ }, [k, C]), q = m(() => {
70
+ if (A || C !== void 0) return {
71
+ ...C === void 0 ? {} : { enable: C === "rocket" },
67
72
  ...A ?? {}
68
73
  };
69
- }, [A, C]), J = p(() => W ? {
74
+ }, [A, C]), J = m(() => U ? {
70
75
  controlMode: "VELOCITY",
71
76
  maxHorizSpeed: 46,
72
77
  maxVertSpeed: 16,
@@ -74,21 +79,21 @@ function x({ id: t, sourceBundle: o, rawGlbBytes: h, position: g = [
74
79
  maxTiltAngle: .52,
75
80
  HORIZ_VEL_P: 1.8,
76
81
  VERT_VEL_P: 2.8,
77
- ...V.droneTune ?? {},
82
+ ...B.droneTune ?? {},
78
83
  ...M ?? {}
79
84
  } : M, [
80
- W,
81
- V.droneTune,
85
+ U,
86
+ B.droneTune,
82
87
  M
83
- ]), Y = m(null), pe = m([
84
- g[0],
85
- g[1],
86
- g[2]
87
- ]), X = m(_ ? [
88
+ ]), Y = h(null), he = h([
88
89
  _[0],
89
90
  _[1],
90
91
  _[2]
91
- ] : void 0), Z = m(n()), Q = m(new se.Vector3()), me = m({
92
+ ]), X = h(v ? [
93
+ v[0],
94
+ v[1],
95
+ v[2]
96
+ ] : void 0), Z = h(n()), Q = h(new oe.Vector3()), ge = h({
92
97
  camInit: !1,
93
98
  cockpit: !1,
94
99
  prevCam: !1,
@@ -96,7 +101,7 @@ function x({ id: t, sourceBundle: o, rawGlbBytes: h, position: g = [
96
101
  prevR: !1,
97
102
  turnL: !1,
98
103
  turnR: !1
99
- }), he = m({
104
+ }), _e = h({
100
105
  forward: !1,
101
106
  backward: !1,
102
107
  steerLeft: !1,
@@ -121,14 +126,14 @@ function x({ id: t, sourceBundle: o, rawGlbBytes: h, position: g = [
121
126
  }
122
127
  }
123
128
  }, []);
124
- d(() => {
129
+ f(() => {
125
130
  let e = R.spawn(s({
126
131
  id: t,
127
132
  handle: Y.current,
128
- centerOfMass: [...V.centerOfMass],
129
- seatOffset: G,
130
- exitOffset: K,
131
- isFlight: W,
133
+ centerOfMass: [...B.centerOfMass],
134
+ seatOffset: W,
135
+ exitOffset: G,
136
+ isFlight: U,
132
137
  onOriginShift: $
133
138
  }), te({
134
139
  id: t,
@@ -141,14 +146,14 @@ function x({ id: t, sourceBundle: o, rawGlbBytes: h, position: g = [
141
146
  }, [
142
147
  R,
143
148
  t,
144
- V,
145
- G,
146
- K,
149
+ B,
147
150
  W,
151
+ G,
152
+ U,
148
153
  x,
149
154
  $
150
155
  ]);
151
- let ge = u((e) => {
156
+ let ve = u((e) => {
152
157
  Y.current = e, N && (N.current = e);
153
158
  for (let n of R.query(s)) {
154
159
  let r = n.get(s);
@@ -163,65 +168,66 @@ function x({ id: t, sourceBundle: o, rawGlbBytes: h, position: g = [
163
168
  t,
164
169
  N,
165
170
  $
166
- ]), _e = z?.activeVehicleId === t || x && !z?.activeVehicleId;
167
- return ce((e, n) => {
171
+ ]), ye = z?.activeVehicleId === t || x && !z?.activeVehicleId;
172
+ return se((e, n) => {
168
173
  let r = Math.min(Math.max(n, 1e-4), .05);
169
- H.step(r);
174
+ V.step(r);
170
175
  let i = Y.current;
171
176
  i && i.body && (P ? (P(i, r, e), F && F(i, r, e)) : ae({
172
177
  id: t,
173
178
  veh: i,
174
- keys: B(),
175
- cmd: he.current,
179
+ keys: me(),
180
+ cmd: _e.current,
176
181
  sig: Z.current,
177
- st: me.current,
182
+ st: ge.current,
178
183
  camTarget: Q.current,
179
- centerOfMass: V.centerOfMass,
180
- seatOffset: G,
181
- isPiloted: _e,
182
- isFlight: W,
184
+ centerOfMass: B.centerOfMass,
185
+ seatOffset: W,
186
+ isPiloted: ye,
187
+ isFlight: U,
183
188
  dt: r,
184
189
  state: e,
185
190
  cameraController: F
186
191
  }));
187
- }), /* @__PURE__ */ v("group", {
192
+ }), /* @__PURE__ */ y("group", {
188
193
  onClick: (e) => {
189
- e.delta <= 5 && H.toggleHitObject(e.object) && e.stopPropagation();
194
+ e.delta <= 5 && V.toggleHitObject(e.object) && e.stopPropagation();
190
195
  },
191
- children: /* @__PURE__ */ y(b, {
192
- ref: ge,
193
- bundle: V,
194
- position: pe.current,
195
- enable: w,
196
+ children: /* @__PURE__ */ le(ue, {
197
+ ref: ve,
198
+ bundle: B,
199
+ position: he.current,
200
+ enable: fe,
196
201
  enableCustomGravity: L,
197
202
  ...X.current === void 0 ? {} : { rotation: X.current },
198
- ...T === void 0 ? {} : { ccd: T },
199
- ...E === void 0 ? {} : { linearDamping: E },
200
- ...D === void 0 ? {} : { angularDamping: D },
201
- ...O === void 0 ? {} : { userData: O },
202
- ...k === void 0 ? {} : { onCollisionEnter: k },
203
- ...q === void 0 ? {} : { wheelConfig: q },
203
+ ...w === void 0 ? {} : { ccd: w },
204
+ ...T === void 0 ? {} : { linearDamping: T },
205
+ ...E === void 0 ? {} : { angularDamping: E },
206
+ ...D === void 0 ? {} : { userData: D },
207
+ ...O === void 0 ? {} : { onCollisionEnter: O },
208
+ ...K === void 0 ? {} : { wheelConfig: K },
209
+ ...q === void 0 ? {} : { propellerConfig: q },
204
210
  ...j === void 0 ? {} : { carConfig: j },
205
211
  ...J === void 0 ? {} : { droneConfig: J },
206
- children: [/* @__PURE__ */ v(a, {
207
- emitters: U.emitters,
212
+ children: [/* @__PURE__ */ y(a, {
213
+ emitters: H.emitters,
208
214
  signalsRef: Z
209
215
  }), I]
210
216
  })
211
217
  });
212
218
  }
213
219
  function S(e) {
214
- return /* @__PURE__ */ v(x, {
220
+ return /* @__PURE__ */ y(x, {
215
221
  ...e,
216
- sourceBundle: _(e.src)
222
+ sourceBundle: v(e.src)
217
223
  });
218
224
  }
219
225
  function C(e) {
220
- let [t, n] = h(null);
221
- return d(() => {
226
+ let [t, n] = g(null);
227
+ return f(() => {
222
228
  if (e.bundle || e.src || !e.rawGlbBytes) return;
223
229
  let t = !0;
224
- return g(e.rawGlbBytes).then((e) => {
230
+ return _(e.rawGlbBytes).then((e) => {
225
231
  t && n(e);
226
232
  }), () => {
227
233
  t = !1;
@@ -230,13 +236,13 @@ function C(e) {
230
236
  e.bundle,
231
237
  e.src,
232
238
  e.rawGlbBytes
233
- ]), e.bundle ? /* @__PURE__ */ v(x, {
239
+ ]), e.bundle ? /* @__PURE__ */ y(x, {
234
240
  ...e,
235
241
  sourceBundle: e.bundle
236
- }) : e.src ? /* @__PURE__ */ v(S, {
242
+ }) : e.src ? /* @__PURE__ */ y(S, {
237
243
  ...e,
238
244
  src: e.src
239
- }) : t ? /* @__PURE__ */ v(x, {
245
+ }) : t ? /* @__PURE__ */ y(x, {
240
246
  ...e,
241
247
  sourceBundle: t
242
248
  }) : null;
@@ -2,37 +2,28 @@ import { kolmoTelemetry as e } from "./kolmoStore.js";
2
2
  import * as t from "three";
3
3
  import { easing as n } from "maath";
4
4
  // src/engine/kolmoVehicleDriver.ts
5
- var r = new t.Vector3(), i = new t.Vector3(), a = new t.Vector3(), o = new t.Vector3(), s = new t.Vector3();
6
- function c(t) {
7
- let { id: c, veh: l, keys: u, cmd: d, sig: f, st: p, camTarget: m, centerOfMass: h, seatOffset: g, isPiloted: _, isFlight: v, dt: y, state: b, cameraController: x } = t;
8
- if (_) {
9
- if (u.cameraView && !p.prevCam && (p.cockpit = !p.cockpit), p.prevCam = u.cameraView, v) d.pitchForward = u.forward, d.pitchBackward = u.backward, d.yawLeft = u.left, d.yawRight = u.right, d.rollLeft = u.turnLeft, d.rollRight = u.turnRight, d.throttleUp = u.brake, d.throttleDown = u.descend, d.forward = !1, d.backward = !1, d.steerLeft = !1, d.steerRight = !1, d.brake = !1, u.boost && l.body.applyImpulse(s.copy(l.bodyZAxis).multiplyScalar(l.body.mass() * 14 * y), !1);
10
- else if (u.turnLeft && !p.prevL && (p.turnL = !p.turnL, p.turnR = !1), u.turnRight && !p.prevR && (p.turnR = !p.turnR, p.turnL = !1), p.prevL = u.turnLeft, p.prevR = u.turnRight, d.forward = u.forward, d.backward = u.backward, d.steerLeft = u.left, d.steerRight = u.right, d.brake = u.brake, d.pitchForward = !1, d.pitchBackward = !1, d.throttleUp = !1, d.throttleDown = !1, d.yawLeft = !1, d.yawRight = !1, d.rollLeft = !1, d.rollRight = !1, u.boost && u.forward) {
11
- for (let e of l.wheelsInfo.values()) if (e.current.rayHit) {
12
- l.body.applyImpulse(s.copy(l.bodyZAxis).multiplyScalar(l.body.mass() * 6.5 * y), !1);
13
- break;
14
- }
15
- }
16
- l.setMovement(d);
5
+ var r = new t.Vector3(), i = new t.Vector3(), a = new t.Vector3(), o = new t.Vector3();
6
+ function s(t) {
7
+ let { id: s, veh: c, keys: l, cmd: u, sig: d, st: f, camTarget: p, centerOfMass: m, seatOffset: h, isPiloted: g, isFlight: _, dt: v, state: y, cameraController: b } = t;
8
+ g && (l.cameraView && !f.prevCam && (f.cockpit = !f.cockpit), f.prevCam = l.cameraView, _ ? (u.pitchForward = l.forward, u.pitchBackward = l.backward, u.yawLeft = l.left, u.yawRight = l.right, u.rollLeft = l.turnLeft, u.rollRight = l.turnRight, u.throttleUp = l.brake, u.throttleDown = l.descend, u.forward = !1, u.backward = !1, u.steerLeft = !1, u.steerRight = !1, u.brake = !1) : (l.turnLeft && !f.prevL && (f.turnL = !f.turnL, f.turnR = !1), l.turnRight && !f.prevR && (f.turnR = !f.turnR, f.turnL = !1), f.prevL = l.turnLeft, f.prevR = l.turnRight, u.forward = l.forward, u.backward = l.backward, u.steerLeft = l.left, u.steerRight = l.right, u.brake = l.brake, u.pitchForward = !1, u.pitchBackward = !1, u.throttleUp = !1, u.throttleDown = !1, u.yawLeft = !1, u.yawRight = !1, u.rollLeft = !1, u.rollRight = !1), c.setMovement(u));
9
+ let x = 0, S = 0;
10
+ for (let e of c.wheelsInfo.values()) e.current.rayHit && e.current.slipStrength > x && (x = e.current.slipStrength);
11
+ if (c.propellersInfo.size > 0) {
12
+ for (let e of c.propellersInfo.values()) S += e.current.finalThrottle;
13
+ S /= c.propellersInfo.size;
17
14
  }
18
- let S = 0, C = 0;
19
- for (let e of l.wheelsInfo.values()) e.current.rayHit && e.current.slipStrength > S && (S = e.current.slipStrength);
20
- if (l.propellersInfo.size > 0) {
21
- for (let e of l.propellersInfo.values()) C += e.current.finalThrottle;
22
- C /= l.propellersInfo.size;
23
- }
24
- let w = l.currLinVel.dot(l.bodyZAxis);
25
- if (f.throttle = _ ? v ? u.forward || u.brake ? 1 : Math.max(.22, C) : +!!u.forward : 0, f.boost = _ ? v ? u.boost ? 1 : u.forward ? .58 : .16 : u.boost && u.forward ? 1 : 0 : 0, f.brake = _ && !v && (u.brake || u.backward && w > 1) ? 1 : 0, f.reverse = _ && !v && u.backward && w <= 1 ? 1 : 0, f.slip = Math.min(1, S), f.turn_l = +!!p.turnL, f.turn_r = +!!p.turnR, f.headlight = 1, f.always = 1, !_) return;
26
- if (e.speedKmh = l.currLinVel.length() * 3.6, e.rpm = Math.round(v ? 1800 + f.throttle * 6200 + f.boost * 4200 : l.engineRPM), e.gear = v ? u.boost ? 2 : 1 : l.gearIndex + 1, e.throttle = f.throttle, e.boost = f.boost, e.mode = v ? "flight" : "car", e.activeVehicleId = c, x) {
27
- x(l, y, b);
15
+ let C = c.currLinVel.dot(c.bodyZAxis);
16
+ if (d.throttle = g ? _ ? l.forward || l.brake ? 1 : Math.max(.22, S) : +!!l.forward : 0, d.boost = g ? _ ? l.boost ? 1 : l.forward ? .58 : .16 : l.boost && l.forward ? 1 : 0 : 0, d.brake = g && !_ && (l.brake || l.backward && C > 1) ? 1 : 0, d.reverse = g && !_ && l.backward && C <= 1 ? 1 : 0, d.slip = Math.min(1, x), d.turn_l = +!!f.turnL, d.turn_r = +!!f.turnR, d.headlight = 1, d.always = 1, !g) return;
17
+ if (e.speedKmh = c.currLinVel.length() * 3.6, e.rpm = Math.round(_ ? 1800 + d.throttle * 6200 + d.boost * 4200 : c.engineRPM), e.gear = _ ? l.boost ? 2 : 1 : c.gearIndex + 1, e.throttle = d.throttle, e.boost = d.boost, e.mode = _ ? "flight" : "car", e.activeVehicleId = s, b) {
18
+ b(c, v, y);
28
19
  return;
29
20
  }
30
- if (r.copy(l.upAxis), r.lengthSq() < 1e-6 && r.copy(l.bodyYAxis), p.cockpit) {
31
- a.set(g[0] - h[0], g[1] - h[1] + .32, g[2] - h[2]).applyQuaternion(l.currQuat).add(l.currPos), o.copy(a).addScaledVector(l.bodyZAxis, 24), n.damp3(b.camera.position, a, .04, y), n.damp3(b.camera.up, l.bodyYAxis, .08, y), b.camera.lookAt(o);
21
+ if (r.copy(c.upAxis), r.lengthSq() < 1e-6 && r.copy(c.bodyYAxis), f.cockpit) {
22
+ a.set(h[0] - m[0], h[1] - m[1] + .32, h[2] - m[2]).applyQuaternion(c.currQuat).add(c.currPos), o.copy(a).addScaledVector(c.bodyZAxis, 24), n.damp3(y.camera.position, a, .04, v), n.damp3(y.camera.up, c.bodyYAxis, .08, v), y.camera.lookAt(o);
32
23
  return;
33
24
  }
34
- i.copy(l.bodyZAxis), v || i.projectOnPlane(r).normalize(), i.lengthSq() < 1e-6 && i.copy(l.bodyZAxis);
35
- let T = v ? 11.2 : 6.8, E = v ? 3.1 : 2.15;
36
- a.copy(l.currPos).addScaledVector(i, -T).addScaledVector(r, E), o.copy(l.currPos).addScaledVector(i, v ? 7.5 : 3.6).addScaledVector(r, .65), p.camInit ||= (b.camera.position.copy(a), m.copy(o), !0), n.damp3(b.camera.position, a, .14, y), n.damp3(m, o, .08, y), n.damp3(b.camera.up, r, .16, y), b.camera.lookAt(m);
25
+ i.copy(c.bodyZAxis), _ || i.projectOnPlane(r).normalize(), i.lengthSq() < 1e-6 && i.copy(c.bodyZAxis);
26
+ let w = _ ? 11.2 : 6.8, T = _ ? 3.1 : 2.15;
27
+ a.copy(c.currPos).addScaledVector(i, -w).addScaledVector(r, T), o.copy(c.currPos).addScaledVector(i, _ ? 7.5 : 3.6).addScaledVector(r, .65), f.camInit ||= (y.camera.position.copy(a), p.copy(o), !0), n.damp3(y.camera.position, a, .14, v), n.damp3(p, o, .08, v), n.damp3(y.camera.up, r, .16, v), y.camera.lookAt(p);
37
28
  }
38
- export { c as stepKolmoVehicleFrame };
29
+ export { s as stepKolmoVehicleFrame };
@@ -1,22 +1,22 @@
1
1
  import { KolmoGravityContext as e, KolmoPhysics as t, useIsKolmoCustomGravity as n, useOptionalKootaWorld as r } from "../physics/index.js";
2
2
  import { KolmoSkybox as i } from "../shaders/celestialBackdrop.js";
3
3
  import { syncRetroUniforms as a } from "../shaders/retroShader.js";
4
- import { EMPTY_KOLMO_INPUT as o, KOLMO_KEY_MAP as s, useKolmoInput as c } from "./kolmoInput.js";
5
- import { RetroViewportSync as l, RoomEnvRig as u, ShadowSnapRig as d } from "./kolmoRigs.js";
6
- import { WorldSessionTrait as f, ensureWorldSession as p, kolmoActions as m, kolmoWorld as h, useWorldTrait as g } from "./kolmoStore.js";
7
- import { useEffect as _, useLayoutEffect as v } from "react";
8
- import * as y from "three";
9
- import { Canvas as b } from "@react-three/fiber";
10
- import { KeyboardControls as x } from "@react-three/drei";
11
- import { WorldProvider as S } from "koota/react";
12
- import { Fragment as C, jsx as w, jsxs as T } from "react/jsx-runtime";
4
+ import { EMPTY_KOLMO_INPUT as o, KOLMO_KEY_MAP as s, KolmoKeyboardBridge as c, KolmoKeyboardContext as l, useKolmoInput as u } from "./kolmoInput.js";
5
+ import { RetroViewportSync as d, RoomEnvRig as f, ShadowSnapRig as p } from "./kolmoRigs.js";
6
+ import { WorldSessionTrait as m, ensureWorldSession as h, kolmoActions as g, kolmoWorld as _, useWorldTrait as v } from "./kolmoStore.js";
7
+ import { useEffect as y, useLayoutEffect as b } from "react";
8
+ import * as x from "three";
9
+ import { Canvas as S } from "@react-three/fiber";
10
+ import { KeyboardControls as C } from "@react-three/drei";
11
+ import { WorldProvider as w } from "koota/react";
12
+ import { Fragment as T, jsx as E, jsxs as D } from "react/jsx-runtime";
13
13
  // src/engine/kolmoWorld.tsx
14
- function E({ children: e, className: t, style: n, fov: r = 56, near: i = .15, far: a = 6500, cameraPosition: o = [
14
+ function O({ children: e, className: t, style: n, fov: r = 56, near: i = .15, far: a = 6500, cameraPosition: o = [
15
15
  0,
16
16
  3.2,
17
17
  -8.5
18
- ], dpr: s = [1, 1.5], frameloop: c = "always", shadows: l = "basic", toneMapping: d, onCanvasReady: f, onContextLost: p, roomEnv: m = !1 }) {
19
- return /* @__PURE__ */ T(b, {
18
+ ], dpr: s = [1, 1.5], frameloop: c = "always", shadows: l = "basic", toneMapping: u, onCanvasReady: d, onContextLost: p, roomEnv: m = !1 }) {
19
+ return /* @__PURE__ */ D(S, {
20
20
  className: t,
21
21
  style: n ?? {
22
22
  width: "100%",
@@ -29,7 +29,7 @@ function E({ children: e, className: t, style: n, fov: r = 56, near: i = .15, fa
29
29
  gl: {
30
30
  antialias: !1,
31
31
  powerPreference: "high-performance",
32
- ...d === void 0 ? {} : { toneMapping: d }
32
+ ...u === void 0 ? {} : { toneMapping: u }
33
33
  },
34
34
  camera: {
35
35
  fov: r,
@@ -38,44 +38,44 @@ function E({ children: e, className: t, style: n, fov: r = 56, near: i = .15, fa
38
38
  position: o
39
39
  },
40
40
  onCreated: ({ gl: e }) => {
41
- e.outputColorSpace = y.SRGBColorSpace;
41
+ e.outputColorSpace = x.SRGBColorSpace;
42
42
  let t = e.domElement;
43
- f?.(t), p && (t.addEventListener("webglcontextlost", (e) => {
43
+ d?.(t), p && (t.addEventListener("webglcontextlost", (e) => {
44
44
  e.preventDefault(), p(!0);
45
45
  }), t.addEventListener("webglcontextrestored", () => p(!1)));
46
46
  },
47
- children: [m !== !1 && /* @__PURE__ */ w(u, { intensity: typeof m == "number" ? m : .65 }), e]
47
+ children: [m !== !1 && /* @__PURE__ */ E(f, { intensity: typeof m == "number" ? m : .65 }), e]
48
48
  });
49
49
  }
50
- function D({ world: e, retroPreset: t }) {
51
- v(() => {
52
- e && p(e);
50
+ function k({ world: e, retroPreset: t }) {
51
+ b(() => {
52
+ e && h(e);
53
53
  }, [e]);
54
- let n = g(e, f);
55
- return _(() => {
56
- e ? t ? m(e).setRetroPreset(t) : n?.activeRetroPreset && a(n.activeRetroPreset) : t && a(t);
54
+ let n = v(e, m);
55
+ return y(() => {
56
+ e ? t ? g(e).setRetroPreset(t) : n?.activeRetroPreset && a(n.activeRetroPreset) : t && a(t);
57
57
  }, [
58
58
  e,
59
59
  t,
60
60
  n?.activeRetroPreset
61
61
  ]), null;
62
62
  }
63
- function O({ gravity: e = "planar", paused: n = !1, timeScale: a = 1, maxDelta: o, physicsDebug: c = !1, retroPreset: l, skybox: u = "nebula", lighting: f = "default", fogExp2: m, sunLightRef: g, shadowSnap: _ = !1, world: y = h, keyboardMap: b = s, children: E }) {
64
- let O = r(), k = y === null ? O : y;
65
- v(() => {
66
- k && p(k);
67
- }, [k]);
68
- let A = /* @__PURE__ */ T(C, { children: [
69
- /* @__PURE__ */ w(D, {
70
- world: k,
71
- retroPreset: l
63
+ function A({ gravity: e = "planar", paused: n = !1, timeScale: a = 1, maxDelta: o, physicsDebug: u = !1, retroPreset: d, skybox: f = "nebula", lighting: m = "default", fogExp2: g, sunLightRef: v, shadowSnap: y = !1, world: x = _, keyboardMap: S = s, children: O }) {
64
+ let A = r(), j = x === null ? A : x;
65
+ b(() => {
66
+ j && h(j);
67
+ }, [j]);
68
+ let M = /* @__PURE__ */ D(T, { children: [
69
+ /* @__PURE__ */ E(k, {
70
+ world: j,
71
+ retroPreset: d
72
72
  }),
73
- _ && g && /* @__PURE__ */ w(d, { sunLightRef: g }),
74
- u === "nebula" && /* @__PURE__ */ w(i, {}),
75
- u === "day" && /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ w("color", {
73
+ y && v && /* @__PURE__ */ E(p, { sunLightRef: v }),
74
+ f === "nebula" && /* @__PURE__ */ E(i, {}),
75
+ f === "day" && /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E("color", {
76
76
  attach: "background",
77
77
  args: ["#6ba6d6"]
78
- }), !m && /* @__PURE__ */ w("fog", {
78
+ }), !g && /* @__PURE__ */ E("fog", {
79
79
  attach: "fog",
80
80
  args: [
81
81
  "#9dc4e2",
@@ -83,18 +83,18 @@ function O({ gravity: e = "planar", paused: n = !1, timeScale: a = 1, maxDelta:
83
83
  520
84
84
  ]
85
85
  })] }),
86
- m && /* @__PURE__ */ w("fogExp2", {
86
+ g && /* @__PURE__ */ E("fogExp2", {
87
87
  attach: "fog",
88
- args: m
88
+ args: g
89
89
  }),
90
- f === "default" && /* @__PURE__ */ T(C, { children: [
91
- /* @__PURE__ */ w("hemisphereLight", { args: [
90
+ m === "default" && /* @__PURE__ */ D(T, { children: [
91
+ /* @__PURE__ */ E("hemisphereLight", { args: [
92
92
  "#b8dcff",
93
93
  "#241d30",
94
94
  .8
95
95
  ] }),
96
- /* @__PURE__ */ w("directionalLight", {
97
- ref: g,
96
+ /* @__PURE__ */ E("directionalLight", {
97
+ ref: v,
98
98
  position: [
99
99
  48,
100
100
  76,
@@ -105,7 +105,7 @@ function O({ gravity: e = "planar", paused: n = !1, timeScale: a = 1, maxDelta:
105
105
  castShadow: !0,
106
106
  "shadow-mapSize": [1024, 1024]
107
107
  }),
108
- /* @__PURE__ */ w("directionalLight", {
108
+ /* @__PURE__ */ E("directionalLight", {
109
109
  position: [
110
110
  -42,
111
111
  28,
@@ -115,22 +115,25 @@ function O({ gravity: e = "planar", paused: n = !1, timeScale: a = 1, maxDelta:
115
115
  color: "#68a8ff"
116
116
  })
117
117
  ] }),
118
- /* @__PURE__ */ w(t, {
118
+ /* @__PURE__ */ E(t, {
119
119
  gravity: e,
120
120
  paused: n,
121
121
  timeScale: a,
122
122
  maxDelta: o,
123
- physicsDebug: c,
123
+ physicsDebug: u,
124
124
  world: null,
125
- children: E
125
+ children: O
126
126
  })
127
- ] }), j = b ? /* @__PURE__ */ w(x, {
128
- map: b,
129
- children: A
130
- }) : A;
131
- return y !== null && y !== O ? /* @__PURE__ */ w(S, {
132
- world: y,
133
- children: j
134
- }) : j;
127
+ ] }), N = S ? /* @__PURE__ */ E(C, {
128
+ map: S,
129
+ children: /* @__PURE__ */ E(c, { children: M })
130
+ }) : /* @__PURE__ */ E(l.Provider, {
131
+ value: null,
132
+ children: M
133
+ });
134
+ return x !== null && x !== A ? /* @__PURE__ */ E(w, {
135
+ world: x,
136
+ children: N
137
+ }) : N;
135
138
  }
136
- export { o as EMPTY_KOLMO_INPUT, s as KOLMO_KEY_MAP, E as KolmoCanvas, e as KolmoGravityContext, t as KolmoPhysics, O as KolmoWorld, l as RetroViewportSync, u as RoomEnvRig, d as ShadowSnapRig, n as useIsKolmoCustomGravity, c as useKolmoInput, r as useOptionalKootaWorld };
139
+ export { o as EMPTY_KOLMO_INPUT, s as KOLMO_KEY_MAP, O as KolmoCanvas, e as KolmoGravityContext, t as KolmoPhysics, A as KolmoWorld, d as RetroViewportSync, f as RoomEnvRig, p as ShadowSnapRig, n as useIsKolmoCustomGravity, u as useKolmoInput, r as useOptionalKootaWorld };
package/dist/index.js CHANGED
@@ -44,26 +44,26 @@ import { extractMeshIslands as Rt, normalizeSceneToSi as zt, separateVehicleMesh
44
44
  import { CHOP_ROLES as Ht, buildSurfaceTopology as Ut, floodFillByCrease as Wt, getIslandTopology as Gt, mirrorTriangles as Kt } from "./importer/surfaceTopology.js";
45
45
  import { buildSelectionOverlayGeometry as qt, createFleet12GonWheelGroup as Jt, findMirrorIslandId as Yt, peelIslandSelection as Xt, previewLoopPolyline as Zt, refineMeshAlongLoop as Qt, remapIslandIds as $t, selectFacesByClick as en, selectFacesByLoop as tn } from "./importer/surfaceCutter.js";
46
46
  import { ChopShopPanel as nn } from "./importer/ChopShopPanel.js";
47
- import { BODY_MOVE_TUNE as rn, BODY_SI as an, BODY_SOCKET_IDS as on, bodyEyeOffsetY as sn, bodyRestCenterY as cn, bodySpawnPosition as ln, bodyStandingHeight as un, stepCameraSync as dn, withExcludeCharacterRay as fn } from "./body/bodySi.js";
48
- import { KhrBody as pn } from "./body/KhrBody.js";
49
- import { HeldItem as mn } from "./body/HeldItem.js";
50
- import { bakeArticulatedLauncherGlb as hn, buildLauncherSceneFromPlan as gn } from "./importer/launcherBake.js";
51
- import { DomainWorkshopPanel as _n, enforceRetroPersonMaterials as vn } from "./importer/DomainWorkshopPanel.js";
52
- import { DAMP_ZETA as yn, FREQ_HZ as bn, gateTelemetry as xn, isGateStep1Unlocked as Sn, useGateStore as Cn } from "./importer/gateStore.js";
53
- import { GateHudBar as wn } from "./importer/GateHudBar.js";
54
- import { buildImporterWebMcpTools as Tn, getNavigatorModelContext as En, useImporterWebMcp as Dn } from "./importer/importerWebMcp.js";
55
- import { makeStarterDomainScene as On } from "./importer/ImporterPlinthUikitTags.js";
56
- import { compileKhrAssetGlb as kn } from "./importer/khrCompiler.js";
57
- import { Step1CalibrationPlinth as An } from "./importer/Step1CalibrationPlinth.js";
58
- import { C12_TICK_M as jn, UNIFIED_ANCHOR_NAMES as Mn, computeC12Metrics as Nn, defaultTargetMeters as Pn, detectSceneAnchors as Fn, khrBoxToRapierHalfExtents as In, measureAssemblyCalibration as Ln, measureNormalizedSceneCalibration as Rn, snapMetersToC12 as zn, wrapSingleMeshWithPaperShellProxy as Bn } from "./importer/glbNormalizer.js";
59
- import { ImperativeVehicleRig as Vn } from "./importer/ImperativeVehicleRig.js";
60
- import { Step2UniversalPad as Hn } from "./importer/Step2UniversalPad.js";
61
- import { VfxEmitterPool as Un } from "./importer/VfxEmitterPool.js";
62
- import { convertUsdToGlb as Wn, isUsdFileName as Gn } from "./importer/usdToGlb.js";
63
- import { bakeUniversalGateGlb as Kn } from "./importer/universalGateBake.js";
47
+ import { BODY_SI as rn, BODY_SOCKET_IDS as an, bodyEyeOffsetY as on, bodyRestCenterY as sn, bodySpawnPosition as cn, bodyStandingHeight as ln, stepCameraSync as un, withExcludeCharacterRay as dn } from "./body/bodySi.js";
48
+ import { KhrBody as fn } from "./body/KhrBody.js";
49
+ import { HeldItem as pn } from "./body/HeldItem.js";
50
+ import { bakeArticulatedLauncherGlb as mn, buildLauncherSceneFromPlan as hn } from "./importer/launcherBake.js";
51
+ import { DomainWorkshopPanel as gn, enforceRetroPersonMaterials as _n } from "./importer/DomainWorkshopPanel.js";
52
+ import { DAMP_ZETA as vn, FREQ_HZ as yn, gateTelemetry as bn, isGateStep1Unlocked as xn, useGateStore as Sn } from "./importer/gateStore.js";
53
+ import { GateHudBar as Cn } from "./importer/GateHudBar.js";
54
+ import { buildImporterWebMcpTools as wn, getNavigatorModelContext as Tn, useImporterWebMcp as En } from "./importer/importerWebMcp.js";
55
+ import { makeStarterDomainScene as Dn } from "./importer/ImporterPlinthUikitTags.js";
56
+ import { compileKhrAssetGlb as On } from "./importer/khrCompiler.js";
57
+ import { Step1CalibrationPlinth as kn } from "./importer/Step1CalibrationPlinth.js";
58
+ import { C12_TICK_M as An, UNIFIED_ANCHOR_NAMES as jn, computeC12Metrics as Mn, defaultTargetMeters as Nn, detectSceneAnchors as Pn, khrBoxToRapierHalfExtents as Fn, measureAssemblyCalibration as In, measureNormalizedSceneCalibration as Ln, snapMetersToC12 as Rn, wrapSingleMeshWithPaperShellProxy as zn } from "./importer/glbNormalizer.js";
59
+ import { ImperativeVehicleRig as Bn } from "./importer/ImperativeVehicleRig.js";
60
+ import { Step2UniversalPad as Vn } from "./importer/Step2UniversalPad.js";
61
+ import { VfxEmitterPool as Hn } from "./importer/VfxEmitterPool.js";
62
+ import { convertUsdToGlb as Un, isUsdFileName as Wn } from "./importer/usdToGlb.js";
63
+ import { bakeUniversalGateGlb as Gn } from "./importer/universalGateBake.js";
64
64
  import { GlbImportGate as $ } from "./importer/GlbImportGate.js";
65
- import { DOOR_HINGE_SPEC as qn, Ex as Jn, ROOT3 as Yn, buildFootprint as Xn, canPlace as Zn, instanceBatches as Qn, latticePose as $n, planSettlement as er, poseEq as tr, poseFromJSON as nr, poseToFloat as rr, poseToJSON as ir, snapPose as ar, socketFor as or, triangleCorners as sr, vToFloat as cr, worldSockets as lr } from "@khr3/c12";
66
- import { DEFAULT_VAULT_URL as ur, KOLMO_ASSETS_URL as dr, VAULT_CARS as fr, VAULT_CATALOG as pr, VAULT_CITY as mr, VAULT_WEAPONS as hr, createAssetVault as gr, inspectGlbBuffer as _r, normalizeGlbBuffer as vr, vaultAssetUrl as yr } from "@khr3/assets";
67
- import { CARBINE_556 as br, LAUNCHER_RECIPES as xr, PISTOL_9MM as Sr, SHOTGUN_12G as Cr, attachModule as wr, createLauncherState as Tr, detachModule as Er, findLauncherRecipe as Dr, planLauncher as Or, stepLauncher as kr } from "@khr3/launchers";
68
- import { COUPE_2DOOR as Ar, FLEET as jr, SEDAN_4DOOR as Mr, VEHICLE_DOMAINS as Nr, VEHICLE_DOMAIN_SPECS as Pr, carUrl as Fr, findCar as Ir, fleetByDomain as Lr, planCar as Rr } from "@khr3/vehicles";
69
- export { qe as ATMO_FRAG, Je as ATMO_VERT, z as Actor, w as ActorTrait, rn as BODY_MOVE_TUNE, an as BODY_SI, on as BODY_SOCKET_IDS, rt as BOTTLE_HEIGHT, Fe as C12TileKind, jn as C12_TICK_M, Ie as C12_TILE_M, it as CAN_LOD_THRESHOLD_M, br as CARBINE_556, Ht as CHOP_ROLES, Ar as COUPE_2DOOR, e as Canvas, nn as ChopShopPanel, yn as DAMP_ZETA, ur as DEFAULT_VAULT_URL, qn as DOOR_HINGE_SPEC, Tt as DestructibleTarget, _n as DomainWorkshopPanel, v as EMPTY_KOLMO_INPUT, X as EmitterRig, Jn as Ex, J as Exoplanet, jr as FLEET, Le as FLOATING_ORIGIN_STEP_M, bn as FREQ_HZ, T as FloatingBodyTrait, ie as GLSL_BAYER_RGB555, ae as GLSL_RETRO_QUANTIZE, wn as GateHudBar, $ as GlbImportGate, mn as HeldItem, Vn as ImperativeVehicleRig, $ as ImporterWorkbench, Ve as InfiniteLongDrivePlanner, E as InteractableTrait, K as Island, Q as Junk, Ye as KEY_SUN_DIRECTION, dr as KOLMO_ASSETS_URL, At as KOLMO_EXTENSION_NAME, y as KOLMO_KEY_MAP, pn as KhrBody, z as KolmoActor, e as KolmoCanvas, X as KolmoEmitterRig, J as KolmoExoplanet, m as KolmoGravityContext, K as KolmoIsland, Q as KolmoJunk, q as KolmoLongDrive, h as KolmoPhysics, W as KolmoProp, Y as KolmoSkybox, G as KolmoSurface, R as KolmoVehicle, t as KolmoWorld, xr as LAUNCHER_RECIPES, q as LongDrive, Re as MACRO_SIZE_M, n as PALETTE_CRUNCHY_16, r as PALETTE_CRUNCHY_64, Et as PARTICLE_FRAG, Dt as PARTICLE_VERT, Sr as PISTOL_9MM, Ot as PLUME_FRAG, kt as PLUME_VERT, oe as PS1_SNAP_RESOLUTION, h as Physics, D as PilotLink, W as Prop, i as RETRO_COLOR_MODES, se as RETRO_PRESETS, ce as RETRO_UNIFORMS, Xe as RING_MOONLET_COUNT, Yn as ROOT3, x as RetroViewportSync, S as RoomEnvRig, Mr as SEDAN_4DOOR, Cr as SHOTGUN_12G, Ce as SHOULDER_K, Qe as SPLAT_LAYER, ke as SeededSimplex2D, C as ShadowSnapRig, ht as ShardPieces, Ke as ShiftedFixedBody, Y as Skybox, Ae as SplitMix32, An as Step1CalibrationPlinth, Hn as Step2UniversalPad, G as Surface, ze as TILES_PER_MACRO, at as TIN_CAN_HEIGHT, ot as TIN_CAN_RADIUS, gt as TargetDecals, Mn as UNIFIED_ANCHOR_NAMES, fr as VAULT_CARS, pr as VAULT_CATALOG, mr as VAULT_CITY, hr as VAULT_WEAPONS, Nr as VEHICLE_DOMAINS, Pr as VEHICLE_DOMAIN_SPECS, R as Vehicle, O as VehicleTrait, Un as VfxEmitterPool, t as World, k as WorldSessionTrait, s as applyPs1Material, a as applyRetroFilteringToMaterial, c as applyRetroMaterial, o as applyRetroTextureFiltering, l as applySceneRetroMaterials, bt as applySegmentsToImportedRoot, wr as attachModule, hn as bakeArticulatedLauncherGlb, Kn as bakeUniversalGateGlb, je as bakeWorldSplatMaps, sn as bodyEyeOffsetY, cn as bodyRestCenterY, ln as bodySpawnPosition, un as bodyStandingHeight, He as buildCarvedTerrainGeometry, Ne as buildDodecagonalCivicHub, Xn as buildFootprint, st as buildGlassBottleGeometry, Ue as buildHighwayAsphaltTexture, Tn as buildImporterWebMcpTools, gn as buildLauncherSceneFromPlan, ee as buildPaletteLutData, B as buildPatchPreviewEmitters, We as buildRoadRibbonGeometry, qt as buildSelectionOverlayGeometry, Ut as buildSurfaceTopology, ct as buildTinCanGeometry, Zn as canPlace, Fr as carUrl, me as childSeed, ye as closedRoadFromPoints, pt as collectValidTris, kn as compileKhrAssetGlb, Nn as computeC12Metrics, V as computeChopPartHinge, ue as computeIslandSpawnPose, fe as computeLongDriveBridgeheadSpawn, pe as computeLongDriveMainlandSpawn, te as computeRetroDpr, Wn as convertUsdToGlb, lt as countGeometryTriangles, gr as createAssetVault, Z as createDefaultSignals, Jt as createFleet12GonWheelGroup, ut as createGlassBottleMaterial, Tr as createLauncherState, tt as createPS2RoadMaterialWebGL, nt as createPS2TerrainMaterialWebGL, $e as createPS2WorldTextures, dt as createTinCanMaterials, H as createVehiclePanelAnimator, jt as decodeKolmoRig, Pn as defaultTargetMeters, Er as detachModule, Fn as detectSceneAnchors, vt as disposeImportedRoot, vn as enforceRetroPersonMaterials, yt as ensureMeshAttributes, A as ensureWorldSession, Rt as extractMeshIslands, he as fbm2, Ir as findCar, Dr as findLauncherRecipe, Yt as findMirrorIslandId, Lr as fleetByDomain, Wt as floodFillByCrease, Ee as frontage, xn as gateTelemetry, et as generatePS2DetailSlices, _t as getBulletHoleTexture, de as getCachedIslandPlan, ne as getColorQuantVector, Gt as getIslandTopology, En as getNavigatorModelContext, re as getPaletteLutTexture, Ct as getProceduralLabelTexture, u as getRetroPreset, d as getRetroShaderUniforms, be as growRoad, Me as hashSeed, Mt as inferKolmoSocketRole, _r as inspectGlbBuffer, Qn as instanceBatches, Sn as isGateStep1Unlocked, Gn as isUsdFileName, In as khrBoxToRapierHalfExtents, j as kolmoActions, M as kolmoTelemetry, N as kolmoWorld, $n as latticePose, wt as loadCustomLabelTexture, xt as loadImportedGlbUrl, De as makeIslandHeightfn, On as makeStarterDomainScene, we as makeTerrain, xe as maxGrade, Ln as measureAssemblyCalibration, Rn as measureNormalizedSceneCalibration, Ft as measureSelection, Kt as mirrorTriangles, Pt as mountPS2WorldMeshes, ge as mulberry32, U as normalToMinusZQuaternion, vr as normalizeGlbBuffer, zt as normalizeSceneToSi, St as parseImportedGlbBuffer, Xt as peelIslandSelection, Rr as planCar, Ge as planDirtSpurs, Oe as planIslandWorld, Or as planLauncher, er as planSettlement, Ze as populateMoonletMatrices, tr as poseEq, nr as poseFromJSON, rr as poseToFloat, ir as poseToJSON, Zt as previewLoopPolyline, Be as quantizeFloatingOrigin192, P as readFloatingOriginAnchorXZ, Qt as refineMeshAlongLoop, $t as remapIslandIds, Se as roadFromPoints, Pe as routeMacroKnightAStar, Te as sampleHeightfield, _e as seedFrom, ft as selectCanLod, en as selectFacesByClick, tn as selectFacesByLoop, Bt as separateVehicleMeshes, F as shiftFloatingOriginEntities, Vt as sliceMeshTriangles, zn as snapMetersToC12, ar as snapPose, or as socketFor, mt as splitObjectIntoShards, Nt as stampKolmoNodesIntoGlb, dn as stepCameraSync, kr as stepLauncher, It as suggestCarAxles, f as syncRetroUniforms, p as syncRetroViewport, Lt as toggleIslandSelection, le as togglePropJoint, sr as triangleCorners, I as useActiveKolmoWorld, Cn as useGateStore, Dn as useImporterWebMcp, g as useIsKolmoCustomGravity, b as useKolmoInput, _ as useOptionalKootaWorld, L as useWorldTrait, cr as vToFloat, ve as valueNoise2, yr as vaultAssetUrl, fn as withExcludeCharacterRay, lr as worldSockets, Bn as wrapSingleMeshWithPaperShellProxy };
65
+ import { DOOR_HINGE_SPEC as Kn, Ex as qn, ROOT3 as Jn, buildFootprint as Yn, canPlace as Xn, instanceBatches as Zn, latticePose as Qn, planSettlement as $n, poseEq as er, poseFromJSON as tr, poseToFloat as nr, poseToJSON as rr, snapPose as ir, socketFor as ar, triangleCorners as or, vToFloat as sr, worldSockets as cr } from "@khr3/c12";
66
+ import { DEFAULT_VAULT_URL as lr, KOLMO_ASSETS_URL as ur, VAULT_CARS as dr, VAULT_CATALOG as fr, VAULT_CITY as pr, VAULT_WEAPONS as mr, createAssetVault as hr, inspectGlbBuffer as gr, normalizeGlbBuffer as _r, vaultAssetUrl as vr } from "@khr3/assets";
67
+ import { CARBINE_556 as yr, LAUNCHER_RECIPES as br, PISTOL_9MM as xr, SHOTGUN_12G as Sr, attachModule as Cr, createLauncherState as wr, detachModule as Tr, findLauncherRecipe as Er, planLauncher as Dr, stepLauncher as Or } from "@khr3/launchers";
68
+ import { COUPE_2DOOR as kr, FLEET as Ar, SEDAN_4DOOR as jr, VEHICLE_DOMAINS as Mr, VEHICLE_DOMAIN_SPECS as Nr, carUrl as Pr, findCar as Fr, fleetByDomain as Ir, planCar as Lr } from "@khr3/vehicles";
69
+ export { qe as ATMO_FRAG, Je as ATMO_VERT, z as Actor, w as ActorTrait, rn as BODY_SI, an as BODY_SOCKET_IDS, rt as BOTTLE_HEIGHT, Fe as C12TileKind, An as C12_TICK_M, Ie as C12_TILE_M, it as CAN_LOD_THRESHOLD_M, yr as CARBINE_556, Ht as CHOP_ROLES, kr as COUPE_2DOOR, e as Canvas, nn as ChopShopPanel, vn as DAMP_ZETA, lr as DEFAULT_VAULT_URL, Kn as DOOR_HINGE_SPEC, Tt as DestructibleTarget, gn as DomainWorkshopPanel, v as EMPTY_KOLMO_INPUT, X as EmitterRig, qn as Ex, J as Exoplanet, Ar as FLEET, Le as FLOATING_ORIGIN_STEP_M, yn as FREQ_HZ, T as FloatingBodyTrait, ie as GLSL_BAYER_RGB555, ae as GLSL_RETRO_QUANTIZE, Cn as GateHudBar, $ as GlbImportGate, pn as HeldItem, Bn as ImperativeVehicleRig, $ as ImporterWorkbench, Ve as InfiniteLongDrivePlanner, E as InteractableTrait, K as Island, Q as Junk, Ye as KEY_SUN_DIRECTION, ur as KOLMO_ASSETS_URL, At as KOLMO_EXTENSION_NAME, y as KOLMO_KEY_MAP, fn as KhrBody, z as KolmoActor, e as KolmoCanvas, X as KolmoEmitterRig, J as KolmoExoplanet, m as KolmoGravityContext, K as KolmoIsland, Q as KolmoJunk, q as KolmoLongDrive, h as KolmoPhysics, W as KolmoProp, Y as KolmoSkybox, G as KolmoSurface, R as KolmoVehicle, t as KolmoWorld, br as LAUNCHER_RECIPES, q as LongDrive, Re as MACRO_SIZE_M, n as PALETTE_CRUNCHY_16, r as PALETTE_CRUNCHY_64, Et as PARTICLE_FRAG, Dt as PARTICLE_VERT, xr as PISTOL_9MM, Ot as PLUME_FRAG, kt as PLUME_VERT, oe as PS1_SNAP_RESOLUTION, h as Physics, D as PilotLink, W as Prop, i as RETRO_COLOR_MODES, se as RETRO_PRESETS, ce as RETRO_UNIFORMS, Xe as RING_MOONLET_COUNT, Jn as ROOT3, x as RetroViewportSync, S as RoomEnvRig, jr as SEDAN_4DOOR, Sr as SHOTGUN_12G, Ce as SHOULDER_K, Qe as SPLAT_LAYER, ke as SeededSimplex2D, C as ShadowSnapRig, ht as ShardPieces, Ke as ShiftedFixedBody, Y as Skybox, Ae as SplitMix32, kn as Step1CalibrationPlinth, Vn as Step2UniversalPad, G as Surface, ze as TILES_PER_MACRO, at as TIN_CAN_HEIGHT, ot as TIN_CAN_RADIUS, gt as TargetDecals, jn as UNIFIED_ANCHOR_NAMES, dr as VAULT_CARS, fr as VAULT_CATALOG, pr as VAULT_CITY, mr as VAULT_WEAPONS, Mr as VEHICLE_DOMAINS, Nr as VEHICLE_DOMAIN_SPECS, R as Vehicle, O as VehicleTrait, Hn as VfxEmitterPool, t as World, k as WorldSessionTrait, s as applyPs1Material, a as applyRetroFilteringToMaterial, c as applyRetroMaterial, o as applyRetroTextureFiltering, l as applySceneRetroMaterials, bt as applySegmentsToImportedRoot, Cr as attachModule, mn as bakeArticulatedLauncherGlb, Gn as bakeUniversalGateGlb, je as bakeWorldSplatMaps, on as bodyEyeOffsetY, sn as bodyRestCenterY, cn as bodySpawnPosition, ln as bodyStandingHeight, He as buildCarvedTerrainGeometry, Ne as buildDodecagonalCivicHub, Yn as buildFootprint, st as buildGlassBottleGeometry, Ue as buildHighwayAsphaltTexture, wn as buildImporterWebMcpTools, hn as buildLauncherSceneFromPlan, ee as buildPaletteLutData, B as buildPatchPreviewEmitters, We as buildRoadRibbonGeometry, qt as buildSelectionOverlayGeometry, Ut as buildSurfaceTopology, ct as buildTinCanGeometry, Xn as canPlace, Pr as carUrl, me as childSeed, ye as closedRoadFromPoints, pt as collectValidTris, On as compileKhrAssetGlb, Mn as computeC12Metrics, V as computeChopPartHinge, ue as computeIslandSpawnPose, fe as computeLongDriveBridgeheadSpawn, pe as computeLongDriveMainlandSpawn, te as computeRetroDpr, Un as convertUsdToGlb, lt as countGeometryTriangles, hr as createAssetVault, Z as createDefaultSignals, Jt as createFleet12GonWheelGroup, ut as createGlassBottleMaterial, wr as createLauncherState, tt as createPS2RoadMaterialWebGL, nt as createPS2TerrainMaterialWebGL, $e as createPS2WorldTextures, dt as createTinCanMaterials, H as createVehiclePanelAnimator, jt as decodeKolmoRig, Nn as defaultTargetMeters, Tr as detachModule, Pn as detectSceneAnchors, vt as disposeImportedRoot, _n as enforceRetroPersonMaterials, yt as ensureMeshAttributes, A as ensureWorldSession, Rt as extractMeshIslands, he as fbm2, Fr as findCar, Er as findLauncherRecipe, Yt as findMirrorIslandId, Ir as fleetByDomain, Wt as floodFillByCrease, Ee as frontage, bn as gateTelemetry, et as generatePS2DetailSlices, _t as getBulletHoleTexture, de as getCachedIslandPlan, ne as getColorQuantVector, Gt as getIslandTopology, Tn as getNavigatorModelContext, re as getPaletteLutTexture, Ct as getProceduralLabelTexture, u as getRetroPreset, d as getRetroShaderUniforms, be as growRoad, Me as hashSeed, Mt as inferKolmoSocketRole, gr as inspectGlbBuffer, Zn as instanceBatches, xn as isGateStep1Unlocked, Wn as isUsdFileName, Fn as khrBoxToRapierHalfExtents, j as kolmoActions, M as kolmoTelemetry, N as kolmoWorld, Qn as latticePose, wt as loadCustomLabelTexture, xt as loadImportedGlbUrl, De as makeIslandHeightfn, Dn as makeStarterDomainScene, we as makeTerrain, xe as maxGrade, In as measureAssemblyCalibration, Ln as measureNormalizedSceneCalibration, Ft as measureSelection, Kt as mirrorTriangles, Pt as mountPS2WorldMeshes, ge as mulberry32, U as normalToMinusZQuaternion, _r as normalizeGlbBuffer, zt as normalizeSceneToSi, St as parseImportedGlbBuffer, Xt as peelIslandSelection, Lr as planCar, Ge as planDirtSpurs, Oe as planIslandWorld, Dr as planLauncher, $n as planSettlement, Ze as populateMoonletMatrices, er as poseEq, tr as poseFromJSON, nr as poseToFloat, rr as poseToJSON, Zt as previewLoopPolyline, Be as quantizeFloatingOrigin192, P as readFloatingOriginAnchorXZ, Qt as refineMeshAlongLoop, $t as remapIslandIds, Se as roadFromPoints, Pe as routeMacroKnightAStar, Te as sampleHeightfield, _e as seedFrom, ft as selectCanLod, en as selectFacesByClick, tn as selectFacesByLoop, Bt as separateVehicleMeshes, F as shiftFloatingOriginEntities, Vt as sliceMeshTriangles, Rn as snapMetersToC12, ir as snapPose, ar as socketFor, mt as splitObjectIntoShards, Nt as stampKolmoNodesIntoGlb, un as stepCameraSync, Or as stepLauncher, It as suggestCarAxles, f as syncRetroUniforms, p as syncRetroViewport, Lt as toggleIslandSelection, le as togglePropJoint, or as triangleCorners, I as useActiveKolmoWorld, Sn as useGateStore, En as useImporterWebMcp, g as useIsKolmoCustomGravity, b as useKolmoInput, _ as useOptionalKootaWorld, L as useWorldTrait, sr as vToFloat, ve as valueNoise2, vr as vaultAssetUrl, dn as withExcludeCharacterRay, cr as worldSockets, zn as wrapSingleMeshWithPaperShellProxy };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pinkaphant/kolmo",
3
- "version": "0.1.3",
3
+ "version": "0.2.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -90,7 +90,7 @@
90
90
  "dependencies": {
91
91
  "@khr3/assets": "^0.2.2",
92
92
  "@khr3/c12": "^0.3.1",
93
- "@khr3/core": "^0.1.2",
93
+ "@khr3/core": "^0.1.3",
94
94
  "@khr3/launchers": "^0.2.2",
95
95
  "@khr3/vehicles": "^0.1.3",
96
96
  "@pmndrs/uikit": "^1.0.78",