@pinkaphant/kolmo 0.5.1 → 0.5.3
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 +92 -14
- package/dist/engine/actor.d.ts +1 -1
- package/dist/engine/index.d.ts +3 -0
- package/dist/engine/index.js +94 -441
- package/dist/engine/index.js.map +1 -1
- package/dist/engine/surface.d.ts +5 -6
- package/dist/engine/traits.d.ts +27 -0
- package/dist/engine/world.d.ts +5 -3
- package/dist/index.d.ts +2 -2
- package/dist/index.js +10 -6
- package/dist/physics/index.d.ts +2 -1
- package/dist/physics/index.js +3 -1
- package/dist/physics-KYWAXctg.js +233 -0
- package/dist/physics-KYWAXctg.js.map +1 -0
- package/dist/replay/index.d.ts +84 -0
- package/dist/replay/index.js +380 -0
- package/dist/replay/index.js.map +1 -0
- package/dist/terrain/index.d.ts +119 -0
- package/dist/terrain/index.js +495 -0
- package/dist/terrain/index.js.map +1 -0
- package/dist/toolgun/Toolgun.d.ts +17 -6
- package/dist/toolgun/index.d.ts +2 -2
- package/dist/toolgun/index.js +1 -1
- package/dist/toolgun/store.d.ts +25 -75
- package/dist/{toolgun-BfcCIAQx.js → toolgun-COu_5SxS.js} +391 -673
- package/dist/toolgun-COu_5SxS.js.map +1 -0
- package/dist/traits-Dp1ey_4w.js +267 -0
- package/dist/traits-Dp1ey_4w.js.map +1 -0
- package/dist/vite/index.js +1 -0
- package/dist/vite/index.js.map +1 -1
- package/dist/water/index.d.ts +71 -0
- package/dist/water/index.js +442 -0
- package/dist/water/index.js.map +1 -0
- package/dist/{surface-DUol_5ml.js → world-BDhBihjW.js} +442 -57
- package/dist/world-BDhBihjW.js.map +1 -0
- package/docs/api-reference.md +201 -0
- package/package.json +25 -8
- package/dist/physics-ZDFXaCli.js +0 -475
- package/dist/physics-ZDFXaCli.js.map +0 -1
- package/dist/surface-DUol_5ml.js.map +0 -1
- package/dist/toolgun-BfcCIAQx.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"world-BDhBihjW.js","names":["_jsx","_jsx","_jsxs","_jsx","_Fragment","createPortal"],"sources":["../src/engine/input.ts","../src/engine/vehicle.tsx","../src/engine/surface.tsx","../src/engine/world.tsx"],"sourcesContent":["import React, { createContext, useCallback, useContext, useRef, type ReactNode } from \"react\";\nimport { useKeyboardControls, type KeyboardControlsEntry } from \"@react-three/drei\";\nimport { useButtonStore, useJoystickStore } from \"@pinkaphant/ecctrl/input\";\n\nexport const KolmoKeyboardContext = createContext<(() => Record<string, boolean>) | null>(null);\n\nexport function KolmoKeyboardBridge({ children }: { readonly children: ReactNode }): React.JSX.Element {\n const [, getKeys] = useKeyboardControls();\n return React.createElement(KolmoKeyboardContext.Provider, { value: getKeys }, children);\n}\n\nexport type KolmoKeyAction =\n | \"forward\"\n | \"backward\"\n | \"left\"\n | \"right\"\n | \"brake\"\n | \"boost\"\n | \"interact\"\n | \"turnLeft\"\n | \"turnRight\"\n | \"descend\"\n | \"cameraView\"\n | \"reset\"\n | \"modeToggle\";\n\nexport interface KolmoInputState extends Record<KolmoKeyAction, boolean> {\n stickX: number;\n stickY: number;\n}\n\nexport type KolmoInputGetter = () => Partial<KolmoInputState>;\n\nexport const KOLMO_STICK_DEADZONE = 0.08;\n\nconst EMPTY_KEYS: Readonly<Record<KolmoKeyAction, boolean>> = Object.freeze({\n forward: false,\n backward: false,\n left: false,\n right: false,\n brake: false,\n boost: false,\n interact: false,\n turnLeft: false,\n turnRight: false,\n descend: false,\n cameraView: false,\n reset: false,\n modeToggle: false,\n});\n\nexport const EMPTY_KOLMO_INPUT: Readonly<KolmoInputState> = Object.freeze({\n ...EMPTY_KEYS,\n stickX: 0,\n stickY: 0,\n});\n\nexport const KOLMO_KEY_MAP: KeyboardControlsEntry<string>[] = [\n { name: \"forward\", keys: [\"KeyW\", \"ArrowUp\"] },\n { name: \"backward\", keys: [\"KeyS\", \"ArrowDown\"] },\n { name: \"left\", keys: [\"KeyA\", \"ArrowLeft\"] },\n { name: \"right\", keys: [\"KeyD\", \"ArrowRight\"] },\n { name: \"brake\", keys: [\"Space\"] },\n { name: \"boost\", keys: [\"ShiftLeft\", \"ShiftRight\"] },\n { name: \"interact\", keys: [\"KeyF\"] },\n { name: \"turnLeft\", keys: [\"KeyQ\"] },\n { name: \"turnRight\", keys: [\"KeyC\"] },\n { name: \"descend\", keys: [\"KeyX\", \"ControlLeft\"] },\n { name: \"cameraView\", keys: [\"KeyV\"] },\n { name: \"reset\", keys: [\"KeyR\"] },\n { name: \"modeToggle\", keys: [\"KeyG\"] },\n];\n\n/**\n * Input reader merging Drei `<KeyboardControls>`, `@pinkaphant/ecctrl/input`\n * Zustand stores (`useJoystickStore` + `useButtonStore`), and optional `getInput()` overrides.\n * Analog thumbstick values stay analog (`stickX`, `stickY`) rather than slamming digital WASD booleans.\n */\nexport function useKolmoInput(getInput?: KolmoInputGetter): () => Readonly<KolmoInputState> {\n const getKeyboard = useContext(KolmoKeyboardContext);\n const getterRef = useRef(getInput);\n getterRef.current = getInput;\n const outRef = useRef<KolmoInputState>({ ...EMPTY_KOLMO_INPUT });\n\n return useCallback(() => {\n const custom = getterRef.current?.();\n const k = getKeyboard ? getKeyboard() : EMPTY_KEYS;\n const rawStick = useJoystickStore.getState().joysticks.default;\n const btns = useButtonStore.getState().buttons;\n const rx = rawStick?.x ?? 0;\n const ry = rawStick?.y ?? 0;\n const mag = Math.hypot(rx, ry);\n const scaled = mag > KOLMO_STICK_DEADZONE ? (Math.min(1, mag) - KOLMO_STICK_DEADZONE) / ((1 - KOLMO_STICK_DEADZONE) * mag) : 0;\n\n const out = outRef.current;\n out.stickX = custom?.stickX ?? rx * scaled;\n out.stickY = custom?.stickY ?? ry * scaled;\n out.forward = Boolean(custom?.forward ?? k.forward);\n out.backward = Boolean(custom?.backward ?? k.backward);\n out.left = Boolean(custom?.left ?? k.left);\n out.right = Boolean(custom?.right ?? k.right);\n out.brake = Boolean(custom?.brake ?? (k.brake || btns.brake || btns.jump));\n out.boost = Boolean(custom?.boost ?? (k.boost || btns.boost || btns.run));\n out.interact = Boolean(custom?.interact ?? (k.interact || btns.interact));\n out.turnLeft = Boolean(custom?.turnLeft ?? (k.turnLeft || btns.turnLeft));\n out.turnRight = Boolean(custom?.turnRight ?? (k.turnRight || btns.turnRight));\n out.descend = Boolean(custom?.descend ?? (k.descend || btns.descend));\n out.cameraView = Boolean(custom?.cameraView ?? (k.cameraView || btns.cameraView));\n out.reset = Boolean(custom?.reset ?? (k.reset || btns.reset));\n out.modeToggle = Boolean(custom?.modeToggle ?? (k.modeToggle || btns.modeToggle));\n return out;\n }, [getKeyboard]);\n}\n","import React, { useCallback, useContext, useId, useLayoutEffect, useMemo, useRef, useState } from \"react\";\nimport * as THREE from \"three\";\nimport { useFrame, type RootState } from \"@react-three/fiber\";\nimport { useRapier } from \"@react-three/rapier\";\nimport { easing } from \"maath\";\nimport type { Entity } from \"koota\";\nimport { useHas } from \"koota/react\";\nimport { assignRef, cloneKhrBundle, useKhrGlb, type KhrAssetBundle } from \"@khr3/core\";\nimport { KhrVehicle, type KhrVehicleJointsHandle, type KhrVehicleProps } from \"@khr3/core/vehicle\";\nimport type { EcctrlVehicleHandle, VehicleInput } from \"@pinkaphant/ecctrl/vehicle\";\nimport { KolmoGravityContext } from \"../physics/index.js\";\nimport { useKolmoInput, type KolmoInputGetter } from \"./input.js\";\nimport {\n InteractableTrait,\n PilotedTag,\n TransformTrait,\n VehicleTelemetryTrait,\n VehicleTrait,\n VelocityTrait,\n createEmptyVehicleCmd,\n ensureWorldSession,\n flipVehicleBodyUpright,\n kolmoActions,\n pilotedVehicleQuery,\n useActiveKolmoWorld,\n writeEntityKinematics,\n writeVehicleTelemetry,\n} from \"./traits.js\";\n\nfunction hasActiveCmd(c: Readonly<VehicleInput>): boolean {\n return Boolean(\n c.forward || c.backward || c.steerLeft || c.steerRight || c.brake ||\n c.throttleUp || c.throttleDown || c.yawLeft || c.yawRight ||\n c.pitchForward || c.pitchBackward || c.rollLeft || c.rollRight ||\n (c.joystickL && (c.joystickL.x !== 0 || c.joystickL.y !== 0)) ||\n (c.joystickR && (c.joystickR.x !== 0 || c.joystickR.y !== 0)),\n );\n}\n\nfunction clearCmdInPlace(cmd: VehicleInput, stickL: { x: number; y: number }, stickR: { x: number; y: number }): void {\n cmd.forward = false;\n cmd.backward = false;\n cmd.steerLeft = false;\n cmd.steerRight = false;\n cmd.brake = false;\n cmd.throttleUp = false;\n cmd.throttleDown = false;\n cmd.yawLeft = false;\n cmd.yawRight = false;\n cmd.pitchForward = false;\n cmd.pitchBackward = false;\n cmd.rollLeft = false;\n cmd.rollRight = false;\n stickL.x = 0;\n stickL.y = 0;\n stickR.x = 0;\n stickR.y = 0;\n cmd.joystickL = stickL;\n cmd.joystickR = stickR;\n}\n\nconst _up = new THREE.Vector3();\nconst _fwd = new THREE.Vector3();\nconst _camGoal = new THREE.Vector3();\nconst _lookGoal = new THREE.Vector3();\n\nexport interface KolmoVehicleProps extends Omit<KhrVehicleProps, \"ref\" | \"bundle\"> {\n readonly ref?: React.Ref<EcctrlVehicleHandle>;\n readonly id?: string;\n readonly src?: string;\n readonly bundle?: KhrAssetBundle;\n readonly piloted?: boolean;\n readonly flightMode?: boolean;\n readonly vehicleMode?: \"drive\" | \"rocket\";\n readonly interactRadius?: number;\n readonly getInput?: KolmoInputGetter;\n readonly driver?: (veh: EcctrlVehicleHandle, dt: number, state: RootState) => void;\n readonly cameraController?: (veh: EcctrlVehicleHandle, dt: number, state: RootState) => void;\n}\n\nfunction KolmoVehicleMount({\n ref,\n vehicleRef,\n jointsRef: outerJointsRef,\n id,\n sourceBundle,\n alreadyCloned = false,\n piloted = false,\n flightMode = false,\n vehicleMode,\n interactRadius = 4.2,\n enable = true,\n enableCustomGravity,\n carConfig,\n wheelConfig,\n propellerConfig,\n droneConfig,\n getInput,\n driver,\n cameraController,\n children,\n ...khrRest\n}: Omit<KolmoVehicleProps, \"src\" | \"bundle\" | \"id\"> & {\n id: string;\n sourceBundle: KhrAssetBundle;\n alreadyCloned?: boolean;\n}): React.JSX.Element {\n const ctxCustomGravity = useContext(KolmoGravityContext);\n const activeWorld = useActiveKolmoWorld();\n useLayoutEffect(() => {\n ensureWorldSession(activeWorld);\n }, [activeWorld]);\n\n const readInput = useKolmoInput(getInput);\n const bundle = useMemo(\n () => (alreadyCloned ? sourceBundle : cloneKhrBundle(sourceBundle)),\n [sourceBundle, alreadyCloned],\n );\n const jointsRef = useRef<KhrVehicleJointsHandle | null>(null);\n const innerRef = useRef<EcctrlVehicleHandle | null>(null);\n\n const canHybridToggle = vehicleMode === undefined && bundle.wheels.length > 0 && bundle.propellers.length > 0;\n const [hybridFlight, setHybridFlight] = useState(flightMode);\n useLayoutEffect(() => {\n setHybridFlight(flightMode);\n }, [flightMode]);\n const [boostThrustActive, setBoostThrustActive] = useState(false);\n const boostThrustRef = useRef(false);\n\n const isFlight = Boolean(\n vehicleMode === \"rocket\" ||\n (canHybridToggle ? hybridFlight : flightMode) ||\n (vehicleMode !== \"drive\" && bundle.propellers.length > 0 && bundle.wheels.length === 0),\n );\n const isManualTrans = (carConfig?.transmissionMode ?? bundle.tune?.transmissionMode) === \"manual\";\n\n const seatOffset = useMemo<[number, number, number]>(() => {\n const dot =\n bundle.sockets.seat ??\n bundle.sockets.Socket_Seat ??\n bundle.sockets.IK_Seat ??\n bundle.sockets.Seat_L ??\n bundle.sockets.driver_butt ??\n bundle.sockets.butt;\n return dot ? [dot[0], dot[1], dot[2]] : [0, 0.65, 0];\n }, [bundle.sockets]);\n\n const exitOffset = useMemo<[number, number, number]>(() => {\n const dot = bundle.sockets.exit ?? bundle.sockets.Socket_Exit;\n return dot ? [dot[0], dot[1], dot[2]] : [-1.55, 0.45, 0];\n }, [bundle.sockets]);\n\n const propActive = bundle.propellers.length > 0 && (isFlight || (vehicleMode !== \"drive\" && boostThrustActive));\n const mergedWheelConfig = useMemo<KhrVehicleProps[\"wheelConfig\"]>(() => {\n const wheelOverride = bundle.wheels.length > 0 && vehicleMode === \"rocket\" ? { enable: false } : undefined;\n return !wheelConfig && !wheelOverride ? undefined : { ...wheelOverride, ...(wheelConfig ?? {}) };\n }, [bundle.wheels.length, vehicleMode, wheelConfig]);\n\n const mergedPropellerConfig = useMemo<KhrVehicleProps[\"propellerConfig\"]>(() => {\n const propOverride = bundle.propellers.length > 0 && !propActive ? { enable: false } : undefined;\n return !propellerConfig && !propOverride ? undefined : { ...propOverride, ...(propellerConfig ?? {}) };\n }, [bundle.propellers.length, propActive, propellerConfig]);\n\n const [vehEnt, setVehEnt] = useState<Entity | null>(null);\n const vehEntRef = useRef<Entity | null>(null);\n const camTargetRef = useRef(new THREE.Vector3());\n const stickLRef = useRef({ x: 0, y: 0 });\n const stickRRef = useRef({ x: 0, y: 0 });\n const cmdRef = useRef(createEmptyVehicleCmd(false));\n const stRef = useRef({ camInit: false, cockpit: false, prevCam: false, prevReset: false, prevMode: false, wasPiloted: false });\n\n useLayoutEffect(() => {\n const ent = activeWorld.spawn(\n VehicleTrait({ id, handle: innerRef.current, jointsHandle: jointsRef.current, seatOffset, exitOffset, isFlight }),\n InteractableTrait({ id, radius: interactRadius, kind: \"vehicle\" }),\n TransformTrait,\n VelocityTrait,\n VehicleTelemetryTrait,\n );\n vehEntRef.current = ent;\n setVehEnt(ent);\n if (piloted && !activeWorld.queryFirst(pilotedVehicleQuery)) {\n kolmoActions(activeWorld).boardVehicle(id);\n }\n return () => {\n if (ent.isAlive() && ent.has(PilotedTag))\n kolmoActions(activeWorld).exitVehicle();\n vehEntRef.current = null;\n ent.destroy();\n };\n }, [activeWorld, id]);\n\n useLayoutEffect(() => {\n const ent = vehEntRef.current;\n if (!ent?.isAlive())\n return;\n const v = ent.get(VehicleTrait);\n if (v)\n ent.set(VehicleTrait, { ...v, seatOffset, exitOffset, isFlight });\n ent.set(InteractableTrait, { id, radius: interactRadius, kind: \"vehicle\" });\n }, [id, seatOffset, exitOffset, interactRadius, isFlight]);\n\n const assignVehicleRef = useCallback((handle: EcctrlVehicleHandle | null) => {\n innerRef.current = handle;\n assignRef(vehicleRef, handle);\n assignRef(ref, handle);\n const ent = vehEntRef.current;\n if (ent?.isAlive()) {\n const v = ent.get(VehicleTrait);\n if (v)\n ent.set(VehicleTrait, { ...v, handle });\n }\n }, [ref, vehicleRef]);\n\n const assignJointsRef = useCallback((jh: KhrVehicleJointsHandle | null) => {\n jointsRef.current = jh;\n assignRef(outerJointsRef, jh);\n const ent = vehEntRef.current;\n if (ent?.isAlive()) {\n const v = ent.get(VehicleTrait);\n if (v)\n ent.set(VehicleTrait, { ...v, jointsHandle: jh });\n }\n }, [outerJointsRef]);\n\n const { world: rapierWorld } = useRapier();\n const hasPilotedTag = useHas(vehEnt, PilotedTag);\n const isPiloted = hasPilotedTag || (piloted && vehEnt === null);\n\n const recordKinematicsAndTelemetry = (veh: EcctrlVehicleHandle, throttle: number, boost: number): void => {\n if (!vehEntRef.current?.isAlive())\n return;\n let maxSlip = 0;\n for (const w of veh.wheelsInfo.values()) {\n if (w.current.rayHit && w.current.slipStrength > maxSlip)\n maxSlip = w.current.slipStrength;\n }\n writeEntityKinematics(activeWorld, vehEntRef.current, veh.currPos, veh.currQuat, veh.currLinVel, veh.currLinVel.length() * 3.6);\n writeVehicleTelemetry(activeWorld, vehEntRef.current, Math.round(veh.engineRPM), veh.gearIndex + 1, throttle, boost, Math.min(1, maxSlip));\n };\n\n useFrame((state, delta) => {\n const dt = rapierWorld.timestep > 0 ? rapierWorld.timestep : Math.min(Math.max(delta, 1e-4), 1 / 30);\n const veh = innerRef.current;\n if (!veh?.body)\n return;\n\n if (driver) {\n driver(veh, dt, state);\n recordKinematicsAndTelemetry(veh, 0, 0);\n cameraController?.(veh, dt, state);\n return;\n }\n\n const keys = readInput();\n const st = stRef.current;\n const cmd = cmdRef.current;\n const stickL = stickLRef.current;\n const stickR = stickRRef.current;\n\n const wantBoostProp = isPiloted && !isFlight && vehicleMode !== \"drive\" && bundle.propellers.length > 0 && keys.boost && (keys.forward || keys.brake);\n if (wantBoostProp !== boostThrustRef.current) {\n boostThrustRef.current = wantBoostProp;\n setBoostThrustActive(wantBoostProp);\n }\n\n if (isPiloted) {\n st.wasPiloted = true;\n if (keys.cameraView && !st.prevCam)\n st.cockpit = !st.cockpit;\n st.prevCam = keys.cameraView;\n if (keys.reset && !st.prevReset) {\n flipVehicleBodyUpright(veh, jointsRef.current);\n }\n st.prevReset = keys.reset;\n if (keys.modeToggle && !st.prevMode && canHybridToggle)\n setHybridFlight((f) => !f);\n st.prevMode = keys.modeToggle;\n\n let anyGrounded = false;\n for (const w of veh.wheelsInfo.values()) {\n if (w.current.rayHit) {\n anyGrounded = true;\n break;\n }\n }\n\n if (isFlight) {\n cmd.pitchForward = keys.forward;\n cmd.pitchBackward = keys.backward;\n cmd.yawLeft = keys.left;\n cmd.yawRight = keys.right;\n cmd.rollLeft = keys.turnLeft;\n cmd.rollRight = keys.turnRight;\n cmd.throttleUp = keys.brake;\n cmd.throttleDown = keys.descend;\n cmd.forward = anyGrounded && keys.forward;\n cmd.backward = anyGrounded && keys.backward;\n cmd.steerLeft = anyGrounded && keys.left;\n cmd.steerRight = anyGrounded && keys.right;\n cmd.brake = false;\n stickL.x = 0;\n stickL.y = 0;\n stickR.x = keys.stickX;\n stickR.y = keys.stickY;\n cmd.joystickL = stickL;\n cmd.joystickR = stickR;\n veh.setMovement(cmd);\n }\n else {\n const fwdVel = veh.currLinVel.dot(veh.bodyZAxis);\n const effForward = keys.forward || keys.stickY > 0.15;\n const effBackward = keys.backward || keys.stickY < -0.15;\n const revBraking = effBackward && !effForward && fwdVel > 1.0;\n const fwdBraking = effForward && !effBackward && fwdVel < -1.0;\n if (!isManualTrans && ((effBackward && !revBraking) || (effForward && Math.abs(fwdVel) < 2.5)) && veh.gearIndex !== 0) {\n veh.setGear(0);\n }\n const boostProp = keys.boost && (bundle.propellers.length > 0 || veh.propellersInfo.size > 0) && veh.gravityMag > 1e-4;\n cmd.forward = effForward && !fwdBraking;\n cmd.backward = effBackward && !revBraking;\n cmd.steerLeft = keys.left;\n cmd.steerRight = keys.right;\n cmd.brake = keys.brake || revBraking || fwdBraking;\n cmd.pitchForward = boostProp && effForward;\n cmd.pitchBackward = false;\n cmd.throttleUp = boostProp && !effForward && keys.brake;\n cmd.throttleDown = false;\n cmd.yawLeft = boostProp && keys.left;\n cmd.yawRight = boostProp && keys.right;\n cmd.rollLeft = false;\n cmd.rollRight = false;\n stickL.x = keys.stickX;\n stickL.y = 0;\n stickR.x = 0;\n stickR.y = 0;\n cmd.joystickL = stickL;\n cmd.joystickR = stickR;\n veh.setMovement(cmd);\n }\n }\n else {\n st.prevCam = st.prevReset = st.prevMode = false;\n if (st.wasPiloted || hasActiveCmd(cmd)) {\n st.wasPiloted = false;\n clearCmdInPlace(cmd, stickL, stickR);\n veh.setMovement(cmd);\n }\n }\n\n const throttle = isPiloted ? +(keys.forward || keys.stickY > 0.15 || (isFlight && keys.brake)) : 0;\n const boost = isPiloted && keys.boost && throttle > 0 ? 1 : 0;\n recordKinematicsAndTelemetry(veh, throttle, boost);\n\n if (!isPiloted)\n return;\n if (cameraController) {\n cameraController(veh, dt, state);\n return;\n }\n\n _up.copy(veh.upAxis);\n if (_up.lengthSq() < 1e-6)\n _up.copy(veh.bodyYAxis);\n\n if (st.cockpit) {\n _camGoal.set(seatOffset[0], seatOffset[1] + 0.32, seatOffset[2]).applyQuaternion(veh.currQuat).add(veh.currPos);\n _lookGoal.copy(_camGoal).addScaledVector(veh.bodyZAxis, 24);\n easing.damp3(state.camera.position, _camGoal, 0.04, dt);\n easing.damp3(state.camera.up, veh.bodyYAxis, 0.08, dt);\n state.camera.lookAt(_lookGoal);\n return;\n }\n\n _fwd.copy(veh.bodyZAxis);\n if (!isFlight)\n _fwd.projectOnPlane(_up).normalize();\n if (_fwd.lengthSq() < 1e-6)\n _fwd.copy(veh.bodyZAxis);\n\n _camGoal.copy(veh.currPos).addScaledVector(_fwd, isFlight ? -11.2 : -6.8).addScaledVector(_up, isFlight ? 3.1 : 2.15);\n _lookGoal.copy(veh.currPos).addScaledVector(_fwd, isFlight ? 7.5 : 3.6).addScaledVector(_up, 0.65);\n\n if (!st.camInit) {\n state.camera.position.copy(_camGoal);\n camTargetRef.current.copy(_lookGoal);\n st.camInit = true;\n }\n easing.damp3(state.camera.position, _camGoal, 0.14, dt);\n easing.damp3(camTargetRef.current, _lookGoal, 0.08, dt);\n easing.damp3(state.camera.up, _up, 0.16, dt);\n state.camera.lookAt(camTargetRef.current);\n });\n\n return (\n <KhrVehicle\n ref={assignVehicleRef}\n jointsRef={assignJointsRef}\n bundle={bundle}\n enable={enable}\n enableCustomGravity={enableCustomGravity ?? ctxCustomGravity}\n {...(carConfig === undefined ? {} : { carConfig })}\n {...(mergedWheelConfig === undefined ? {} : { wheelConfig: mergedWheelConfig })}\n {...(mergedPropellerConfig === undefined ? {} : { propellerConfig: mergedPropellerConfig })}\n {...(droneConfig === undefined ? {} : { droneConfig })}\n {...khrRest}\n >\n {children}\n </KhrVehicle>\n );\n}\n\nfunction KolmoVehicleFromUrl(props: Omit<KolmoVehicleProps, \"src\" | \"bundle\" | \"id\"> & { id: string; src: string }): React.JSX.Element {\n const { src, ...rest } = props;\n const bundle = useKhrGlb(src);\n return <KolmoVehicleMount {...rest} sourceBundle={bundle} alreadyCloned />;\n}\n\nexport function KolmoVehicle(props: KolmoVehicleProps): React.JSX.Element | null {\n const reactId = useId();\n const id = props.id ?? `vehicle_${reactId.replace(/:/g, \"\")}`;\n const { src, bundle, ...rest } = props;\n if (bundle)\n return <KolmoVehicleMount {...rest} id={id} sourceBundle={bundle} />;\n if (src)\n return <KolmoVehicleFromUrl {...rest} id={id} src={src} />;\n return null;\n}\n","import React, { useCallback, useContext, useId, useLayoutEffect, useMemo, useRef } from \"react\";\nimport { useFrame, type ThreeEvent } from \"@react-three/fiber\";\nimport { useRapier } from \"@react-three/rapier\";\nimport type { Entity } from \"koota\";\nimport {\n KhrAssembly,\n assignRef,\n cloneKhrBundle,\n useKhrGlb,\n type KhrAssemblyHandle,\n type KhrAssemblyProps,\n type KhrAssetBundle,\n} from \"@khr3/core\";\nimport { KolmoGravityContext } from \"../physics/index.js\";\nimport {\n PropTrait,\n TransformTrait,\n VelocityTrait,\n useActiveKolmoWorld,\n writeEntityKinematics,\n} from \"./traits.js\";\n\nfunction BundleSurface({\n ref,\n bundle,\n alreadyCloned = false,\n position,\n enableCustomGravity,\n ...rest\n}: Omit<KhrAssemblyProps, \"bundle\"> & { bundle: KhrAssetBundle; alreadyCloned?: boolean }): React.JSX.Element {\n const ctxCustomGravity = useContext(KolmoGravityContext);\n const cloned = useMemo(() => (alreadyCloned ? bundle : cloneKhrBundle(bundle)), [bundle, alreadyCloned]);\n return (\n <KhrAssembly\n ref={ref}\n bundle={cloned}\n position={position}\n fixedRoot\n enableCustomGravity={enableCustomGravity ?? ctxCustomGravity}\n {...rest}\n />\n );\n}\n\nfunction UrlSurface({\n src,\n ...rest\n}: Omit<KhrAssemblyProps, \"bundle\"> & { src: string }): React.JSX.Element {\n const bundle = useKhrGlb(src);\n return <BundleSurface bundle={bundle} alreadyCloned {...rest} />;\n}\n\nexport interface KolmoSurfaceProps extends Omit<KhrAssemblyProps, \"bundle\"> {\n readonly src?: string;\n readonly bundle?: KhrAssetBundle;\n}\n\nexport function KolmoSurface({\n ref,\n src,\n bundle,\n position = [0, 0, 0],\n ...rest\n}: KolmoSurfaceProps): React.JSX.Element {\n if (bundle)\n return <BundleSurface ref={ref} bundle={bundle} position={position} {...rest} />;\n if (src)\n return <UrlSurface ref={ref} src={src} position={position} {...rest} />;\n throw new Error(\"KolmoSurface requires a KHR .glb `bundle` or `src` — use <KolmoTerrain> for mathematical heightfield terrain.\");\n}\n\nfunction BundleProp({\n ref,\n propId,\n bundle,\n alreadyCloned = false,\n fixed = false,\n enableCustomGravity,\n onClick: userOnClick,\n ...rest\n}: Omit<KhrAssemblyProps, \"bundle\" | \"onClick\" | \"id\"> & {\n propId: string;\n bundle: KhrAssetBundle;\n alreadyCloned?: boolean;\n fixed?: boolean;\n onClick?: (e: ThreeEvent<MouseEvent>) => void;\n}): React.JSX.Element {\n const ctxCustomGravity = useContext(KolmoGravityContext);\n const activeWorld = useActiveKolmoWorld();\n const { world: rapierWorld } = useRapier();\n const asmRef = useRef<KhrAssemblyHandle | null>(null);\n const propEntRef = useRef<Entity | null>(null);\n const cloned = useMemo(() => (alreadyCloned ? bundle : cloneKhrBundle(bundle)), [bundle, alreadyCloned]);\n const rootBodyName = useMemo(\n () => cloned.bodies.find((b) => !b.joint)?.nodeName ?? cloned.bodies[0]?.nodeName ?? \"\",\n [cloned],\n );\n\n useLayoutEffect(() => {\n const ent = activeWorld.spawn(\n PropTrait({ id: propId, handle: asmRef.current, fixed }),\n TransformTrait,\n VelocityTrait,\n );\n propEntRef.current = ent;\n return () => {\n propEntRef.current = null;\n if (ent.isAlive())\n ent.destroy();\n };\n }, [activeWorld, propId, fixed]);\n\n const assignAsmRef = useCallback((h: KhrAssemblyHandle | null) => {\n asmRef.current = h;\n assignRef(ref, h);\n const ent = propEntRef.current;\n if (ent?.isAlive()) {\n ent.set(PropTrait, { id: propId, handle: h, fixed });\n }\n }, [ref, propId, fixed]);\n\n useFrame(() => {\n if (fixed || !rootBodyName)\n return;\n const ent = propEntRef.current;\n const rawRb = asmRef.current?.getBody(rootBodyName) ?? null;\n if (!ent?.isAlive() || !rawRb)\n return;\n const liveRb = rapierWorld.getRigidBody(rawRb.handle);\n if (!liveRb)\n return;\n const t = liveRb.translation();\n const r = liveRb.rotation();\n const lv = liveRb.linvel();\n const speedKmh = Math.hypot(lv.x, lv.y, lv.z) * 3.6;\n writeEntityKinematics(activeWorld, ent, t, r, lv, speedKmh);\n });\n\n const onClick = useCallback(\n (e: ThreeEvent<MouseEvent>) => {\n if (e.delta <= 5 && asmRef.current?.toggleHitObject(e.object)) {\n e.stopPropagation();\n }\n userOnClick?.(e);\n },\n [userOnClick],\n );\n\n return (\n <KhrAssembly\n ref={assignAsmRef}\n bundle={cloned}\n fixedRoot={fixed}\n enableCustomGravity={enableCustomGravity ?? ctxCustomGravity}\n onClick={onClick}\n {...rest}\n />\n );\n}\n\nfunction UrlProp({\n src,\n ...rest\n}: Omit<KhrAssemblyProps, \"bundle\" | \"onClick\" | \"id\"> & {\n propId: string;\n src: string;\n fixed?: boolean;\n onClick?: (e: ThreeEvent<MouseEvent>) => void;\n}): React.JSX.Element {\n const bundle = useKhrGlb(src);\n return <BundleProp bundle={bundle} alreadyCloned {...rest} />;\n}\n\nexport interface KolmoPropProps extends Omit<KhrAssemblyProps, \"bundle\" | \"onClick\" | \"id\"> {\n readonly id?: string;\n readonly src?: string;\n readonly bundle?: KhrAssetBundle;\n readonly fixed?: boolean;\n readonly onClick?: (e: ThreeEvent<MouseEvent>) => void;\n}\n\nexport function KolmoProp({ id: explicitId, src, bundle, ...rest }: KolmoPropProps): React.JSX.Element {\n const reactId = useId();\n const propId = explicitId ?? `prop_${reactId.replace(/:/g, \"\")}`;\n if (bundle)\n return <BundleProp propId={propId} bundle={bundle} {...rest} />;\n if (src)\n return <UrlProp propId={propId} src={src} {...rest} />;\n throw new Error(\"KolmoProp requires a KHR .glb `bundle` or `src`.\");\n}\n","import React, {\n createContext,\n useContext,\n useEffect,\n useLayoutEffect,\n useReducer,\n useRef,\n useState,\n type CSSProperties,\n type ReactNode,\n} from \"react\";\nimport { createPortal } from \"react-dom\";\nimport * as THREE from \"three\";\nimport { Canvas, addEffect, useThree } from \"@react-three/fiber\";\nimport { KeyboardControls, type KeyboardControlsEntry } from \"@react-three/drei\";\nimport { RoomEnvironment } from \"three/examples/jsm/environments/RoomEnvironment.js\";\nimport { type World } from \"koota\";\nimport { WorldProvider } from \"koota/react\";\nimport { Joystick, VirtualButton } from \"@pinkaphant/ecctrl/input\";\nimport {\n KolmoPhysics,\n type KolmoGravitySpec,\n type KolmoTimeControlValue,\n} from \"../physics/index.js\";\nimport { KOLMO_KEY_MAP, KolmoKeyboardBridge, KolmoKeyboardContext } from \"./input.js\";\nimport {\n ActorTrait,\n KolmoWorldContext,\n PilotLink,\n PilotedTag,\n VehicleTelemetryTrait,\n VehicleTrait,\n VelocityTrait,\n WorldSessionTrait,\n ensureWorldSession,\n kolmoActions,\n kolmoWorld,\n pilotedVehicleQuery,\n useActiveKolmoWorld,\n useOptionalKootaWorld,\n type KolmoControlMode,\n} from \"./traits.js\";\n\nexport const KolmoInCanvasContext = createContext<boolean>(false);\nexport const KolmoOverlayPortalContext = createContext<HTMLElement | null>(null);\n\nexport interface RoomEnvRigProps {\n readonly intensity?: number;\n}\n\nexport function RoomEnvRig({ intensity = 0.65 }: RoomEnvRigProps): null {\n const { gl, scene } = useThree();\n useEffect(() => {\n const pmrem = new THREE.PMREMGenerator(gl);\n const room = new RoomEnvironment();\n const rt = pmrem.fromScene(room, 0.04);\n const prevEnv = scene.environment;\n const prevInt = scene.environmentIntensity;\n scene.environment = rt.texture;\n scene.environmentIntensity = intensity;\n room.dispose();\n pmrem.dispose();\n return () => {\n scene.environment = prevEnv;\n scene.environmentIntensity = prevInt;\n rt.dispose();\n };\n }, [gl, scene, intensity]);\n return null;\n}\n\nexport interface KolmoCanvasProps {\n readonly children: ReactNode;\n readonly className?: string;\n readonly style?: CSSProperties;\n readonly fov?: number;\n readonly near?: number;\n readonly far?: number;\n readonly cameraPosition?: [number, number, number];\n readonly dpr?: number | [number, number];\n readonly frameloop?: \"always\" | \"demand\" | \"never\";\n readonly shadows?: boolean | \"basic\" | \"percentage\" | \"soft\" | \"variance\";\n readonly antialias?: boolean;\n readonly toneMapping?: THREE.ToneMapping;\n readonly roomEnv?: boolean | number;\n}\n\nexport function KolmoCanvas({\n children,\n className,\n style,\n fov = 56,\n near = 0.15,\n far = 4000,\n cameraPosition = [0, 3.2, -8.5],\n dpr = [1, 1.5],\n frameloop = \"always\",\n shadows = true,\n antialias = true,\n toneMapping,\n roomEnv = 0.65,\n}: KolmoCanvasProps): React.JSX.Element {\n return (\n <Canvas\n className={className}\n style={{ width: \"100%\", height: \"100%\", display: \"block\", touchAction: \"none\", userSelect: \"none\", ...style }}\n shadows={shadows}\n dpr={dpr}\n frameloop={frameloop}\n gl={{\n antialias,\n powerPreference: \"high-performance\",\n ...(toneMapping === undefined ? {} : { toneMapping }),\n }}\n camera={{ fov, near, far, position: cameraPosition }}\n onCreated={({ gl }) => {\n gl.outputColorSpace = THREE.SRGBColorSpace;\n }}\n >\n {roomEnv !== false && <RoomEnvRig intensity={typeof roomEnv === \"number\" ? roomEnv : 0.65} />}\n {children}\n </Canvas>\n );\n}\n\nexport interface KolmoWorldProps {\n readonly gravity?: KolmoGravitySpec;\n readonly paused?: boolean;\n readonly timeScale?: KolmoTimeControlValue;\n readonly maxDelta?: KolmoTimeControlValue;\n readonly debug?: boolean;\n readonly physicsDebug?: boolean;\n readonly skybox?: \"day\" | \"night\" | \"none\";\n readonly lighting?: \"default\" | \"none\";\n readonly fogExp2?: [color: string, density: number] | null;\n readonly sunLightRef?: React.RefObject<THREE.DirectionalLight | null>;\n readonly world?: World | null;\n readonly keyboardMap?: KeyboardControlsEntry<string>[] | null;\n readonly children: ReactNode;\n}\n\nexport function KolmoWorld({\n gravity = \"planar\",\n paused = false,\n timeScale = 1,\n maxDelta,\n debug,\n physicsDebug = false,\n skybox = \"day\",\n lighting = \"default\",\n fogExp2,\n sunLightRef,\n world = kolmoWorld,\n keyboardMap = KOLMO_KEY_MAP,\n children,\n}: KolmoWorldProps): React.JSX.Element {\n const effDebug = debug ?? physicsDebug;\n const outerWorld = useOptionalKootaWorld();\n const effectiveWorld = world ?? outerWorld ?? kolmoWorld;\n useLayoutEffect(() => {\n ensureWorldSession(effectiveWorld);\n }, [effectiveWorld]);\n\n const inner = (\n <KolmoInCanvasContext.Provider value={true}>\n {skybox === \"day\" && (\n <>\n <color attach=\"background\" args={[\"#6ba6d6\"]} />\n {!fogExp2 && <fog attach=\"fog\" args={[\"#9dc4e2\", 110, 520]} />}\n </>\n )}\n {skybox === \"night\" && <color attach=\"background\" args={[\"#090d16\"]} />}\n {fogExp2 && <fogExp2 attach=\"fog\" args={fogExp2} />}\n {lighting === \"default\" && (\n <>\n <hemisphereLight args={[\"#b8dcff\", \"#241d30\", 0.8]} />\n <directionalLight\n ref={sunLightRef}\n position={[48, 76, 36]}\n intensity={1.85}\n color=\"#fff3dc\"\n castShadow\n shadow-mapSize={[2048, 2048]}\n shadow-bias={-0.0004}\n shadow-camera-left={-55}\n shadow-camera-right={55}\n shadow-camera-top={55}\n shadow-camera-bottom={-55}\n shadow-camera-near={1}\n shadow-camera-far={220}\n />\n </>\n )}\n <KolmoPhysics\n gravity={gravity}\n paused={paused}\n timeScale={timeScale}\n maxDelta={maxDelta}\n debug={effDebug}\n world={effectiveWorld}\n >\n {children}\n </KolmoPhysics>\n </KolmoInCanvasContext.Provider>\n );\n\n const withKeyboard = keyboardMap ? (\n <KeyboardControls map={keyboardMap}>\n <KolmoKeyboardBridge>{inner}</KolmoKeyboardBridge>\n </KeyboardControls>\n ) : (\n <KolmoKeyboardContext.Provider value={null}>{inner}</KolmoKeyboardContext.Provider>\n );\n\n return effectiveWorld !== outerWorld ? (\n <KolmoWorldContext.Provider value={effectiveWorld}>\n <WorldProvider world={effectiveWorld}>{withKeyboard}</WorldProvider>\n </KolmoWorldContext.Provider>\n ) : (\n withKeyboard\n );\n}\n\nexport interface KolmoGameHookState {\n readonly world: World;\n readonly mode: KolmoControlMode;\n readonly activeVehicleId: string;\n readonly nearVehicleId: string | null;\n readonly boardVehicle: (id: string) => void;\n readonly exitVehicle: () => void;\n readonly resetVehicle: (id?: string) => void;\n}\n\nexport function useKolmoGame(explicitWorld?: World | null): KolmoGameHookState {\n const active = useActiveKolmoWorld();\n const targetWorld = explicitWorld ?? active;\n const [, bump] = useReducer((x: number) => x + 1, 0);\n\n useEffect(() => {\n ensureWorldSession(targetWorld);\n const onChange = () => bump();\n const u1 = targetWorld.onChange(WorldSessionTrait, onChange);\n const u2 = targetWorld.onAdd(PilotedTag, onChange);\n const u3 = targetWorld.onRemove(PilotedTag, onChange);\n const u4 = targetWorld.onAdd(PilotLink, onChange);\n const u5 = targetWorld.onRemove(PilotLink, onChange);\n const u6 = targetWorld.onChange(VehicleTrait, onChange);\n return () => {\n u1(); u2(); u3(); u4(); u5(); u6();\n };\n }, [targetWorld]);\n\n const session = targetWorld.has(WorldSessionTrait) ? targetWorld.get(WorldSessionTrait) : undefined;\n const pilotedEnt = targetWorld.queryFirst(ActorTrait)?.targetFor(PilotLink) ?? targetWorld.queryFirst(pilotedVehicleQuery);\n const pilotedData = pilotedEnt?.get(VehicleTrait);\n const actions = kolmoActions(targetWorld);\n\n return {\n world: targetWorld,\n mode: pilotedData ? (pilotedData.isFlight ? \"flight\" : \"car\") : \"foot\",\n activeVehicleId: pilotedData?.id ?? \"\",\n nearVehicleId: session?.nearVehicleId || null,\n boardVehicle: actions.boardVehicle,\n exitVehicle: actions.exitVehicle,\n resetVehicle: actions.resetVehicle,\n };\n}\n\nfunction detectTouchDevice(): boolean {\n if (typeof window === \"undefined\")\n return false;\n return navigator.maxTouchPoints > 0 || window.matchMedia?.(\"(pointer: coarse)\")?.matches === true;\n}\n\nfunction formatHudStrings(world: World): { line: string; prompt: string } {\n const actor = world.queryFirst(ActorTrait);\n const vehEnt = actor?.targetFor(PilotLink) ?? world.queryFirst(pilotedVehicleQuery);\n if (vehEnt) {\n const vd = vehEnt.get(VehicleTrait);\n const vel = vehEnt.get(VelocityTrait);\n const tel = vehEnt.get(VehicleTelemetryTrait);\n const kmh = Math.round(vel?.speedKmh ?? 0);\n const rpm = Math.round(tel?.rpm ?? 0);\n const gear = tel?.gear ?? 1;\n return {\n line: `${vd?.isFlight ? \"Flight\" : \"Car\"} · ${kmh} km/h · G${gear} · ${rpm} rpm`,\n prompt: vd?.isFlight\n ? \"[WASD] Fly · [Space/X] Rise/Dive · [Shift] Boost · [G] Mode · [V] Cam · [F] Exit\"\n : \"[WASD] Drive · [Shift] Boost · [Space] Brake · [V] Cam · [R] Flip · [F] Exit\",\n };\n }\n const vel = actor?.get(VelocityTrait);\n const near = world.has(WorldSessionTrait) ? world.get(WorldSessionTrait)?.nearVehicleId : \"\";\n return {\n line: `On foot · ${Math.round(vel?.speedKmh ?? 0)} km/h`,\n prompt: near\n ? \"[F] Board vehicle · [WASD] Walk · [Shift] Sprint · [Space] Jump\"\n : \"[WASD] Walk · [Shift] Sprint · [Space] Jump\",\n };\n}\n\nexport interface KolmoHudProps {\n readonly showTouchControls?: boolean;\n readonly extraPrompt?: string;\n readonly style?: CSSProperties;\n}\n\nexport function KolmoHud({ showTouchControls, extraPrompt, style }: KolmoHudProps): React.JSX.Element | null {\n const inCanvas = useContext(KolmoInCanvasContext);\n const portalTarget = useContext(KolmoOverlayPortalContext);\n const world = useActiveKolmoWorld();\n const telemetryRef = useRef<HTMLDivElement | null>(null);\n const promptRef = useRef<HTMLDivElement | null>(null);\n const lastMsRef = useRef(-Infinity);\n const [isTouch, setIsTouch] = useState(detectTouchDevice);\n useEffect(() => {\n setIsTouch(detectTouchDevice());\n }, []);\n const touchEnabled = showTouchControls ?? isTouch;\n\n useEffect(() => {\n ensureWorldSession(world);\n const sync = (): void => {\n const { line, prompt } = formatHudStrings(world);\n const fullPrompt = extraPrompt ? `${prompt} · ${extraPrompt}` : prompt;\n if (telemetryRef.current && telemetryRef.current.textContent !== line)\n telemetryRef.current.textContent = line;\n if (promptRef.current && promptRef.current.textContent !== fullPrompt)\n promptRef.current.textContent = fullPrompt;\n };\n sync();\n const u1 = world.onChange(WorldSessionTrait, sync);\n const u2 = world.onAdd(PilotedTag, sync);\n const u3 = world.onRemove(PilotedTag, sync);\n const u4 = world.onAdd(PilotLink, sync);\n const u5 = world.onRemove(PilotLink, sync);\n const u6 = world.onChange(VehicleTrait, sync);\n const unsubFrame = addEffect((now) => {\n if (Math.abs(now - lastMsRef.current) < 50)\n return;\n lastMsRef.current = now;\n sync();\n });\n return () => {\n u1(); u2(); u3(); u4(); u5(); u6();\n unsubFrame();\n };\n }, [world, extraPrompt, touchEnabled]);\n\n const hudMarkup = (\n <div\n style={{\n position: \"fixed\", inset: 0, pointerEvents: \"none\", zIndex: 30,\n fontFamily: \"ui-monospace, SFMono-Regular, Menlo, monospace\", color: \"#e6edf3\", ...style,\n }}\n >\n <div\n ref={telemetryRef}\n style={{\n position: \"absolute\", top: \"max(10px, env(safe-area-inset-top))\", left: \"max(12px, env(safe-area-inset-left))\",\n padding: \"6px 10px\", background: \"rgba(9, 13, 22, 0.82)\", border: \"1px solid #38bdf8\",\n borderRadius: 4, fontSize: 12, fontWeight: 700,\n }}\n >\n On foot · 0 km/h\n </div>\n {!touchEnabled ? (\n <div\n ref={promptRef}\n style={{\n position: \"absolute\", bottom: \"max(12px, env(safe-area-inset-bottom))\", left: \"50%\", transform: \"translateX(-50%)\",\n padding: \"5px 10px\", background: \"rgba(9, 13, 22, 0.78)\", border: \"1px solid rgba(255,255,255,0.16)\",\n borderRadius: 4, fontSize: 11, whiteSpace: \"nowrap\",\n }}\n >\n [WASD] Walk · [Shift] Sprint · [Space] Jump\n </div>\n ) : (\n <div style={{ pointerEvents: \"auto\" }}>\n <Joystick />\n <VirtualButton id=\"jump\" label=\"JMP\" buttonWrapperStyle={{ position: \"fixed\", right: 20, bottom: 24 }} />\n <VirtualButton id=\"boost\" label=\"BST\" buttonWrapperStyle={{ position: \"fixed\", right: 88, bottom: 24 }} />\n <VirtualButton id=\"interact\" label=\"USE\" buttonWrapperStyle={{ position: \"fixed\", right: 20, bottom: 92 }} />\n </div>\n )}\n </div>\n );\n\n if (!inCanvas)\n return hudMarkup;\n const target = portalTarget ?? (typeof document !== \"undefined\" ? document.body : null);\n return target ? createPortal(hudMarkup, target) : null;\n}\n\nexport interface KolmoGameProps {\n readonly gravity?: KolmoGravitySpec;\n readonly skybox?: \"day\" | \"night\" | \"none\";\n readonly lighting?: \"default\" | \"none\";\n readonly fogExp2?: [color: string, density: number] | null;\n readonly paused?: boolean;\n readonly timeScale?: KolmoTimeControlValue;\n readonly maxDelta?: KolmoTimeControlValue;\n readonly debug?: boolean;\n readonly physicsDebug?: boolean;\n readonly dpr?: number | [number, number];\n readonly roomEnv?: boolean | number;\n readonly kootaWorld?: World;\n readonly style?: CSSProperties;\n readonly className?: string;\n readonly children?: ReactNode;\n}\n\nexport function KolmoGame({\n gravity = \"planar\",\n skybox = \"day\",\n lighting = \"default\",\n fogExp2,\n paused = false,\n timeScale = 1,\n maxDelta,\n debug,\n physicsDebug = false,\n dpr,\n roomEnv = 0.65,\n kootaWorld = kolmoWorld,\n style,\n className,\n children,\n}: KolmoGameProps): React.JSX.Element {\n const effDebug = debug ?? physicsDebug;\n const outerWorld = useOptionalKootaWorld();\n const [overlayEl, setOverlayEl] = useState<HTMLDivElement | null>(null);\n\n const shell = (\n <KolmoOverlayPortalContext.Provider value={overlayEl}>\n <div\n className={className}\n style={{\n position: \"relative\", width: \"100vw\", height: \"100dvh\", overflow: \"hidden\",\n touchAction: \"none\", userSelect: \"none\", ...style,\n }}\n >\n <KolmoCanvas dpr={dpr} roomEnv={roomEnv}>\n <KolmoWorld\n gravity={gravity}\n paused={paused}\n timeScale={timeScale}\n maxDelta={maxDelta}\n skybox={skybox}\n lighting={lighting}\n fogExp2={fogExp2}\n debug={effDebug}\n world={kootaWorld}\n >\n {children}\n </KolmoWorld>\n </KolmoCanvas>\n <div ref={setOverlayEl} style={{ position: \"absolute\", inset: 0, pointerEvents: \"none\" }} />\n </div>\n </KolmoOverlayPortalContext.Provider>\n );\n\n return kootaWorld !== outerWorld ? (\n <KolmoWorldContext.Provider value={kootaWorld}>\n <WorldProvider world={kootaWorld}>{shell}</WorldProvider>\n </KolmoWorldContext.Provider>\n ) : (\n shell\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAIA,IAAa,uBAAuB,cAAsD,IAAI;AAE9F,SAAgB,oBAAoB,EAAE,YAAiE;CACnG,MAAM,GAAG,WAAW,oBAAoB;CACxC,OAAO,MAAM,cAAc,qBAAqB,UAAU,EAAE,OAAO,QAAQ,GAAG,QAAQ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,201 @@
|
|
|
1
|
+
# `@pinkaphant/kolmo` API Reference
|
|
2
|
+
|
|
3
|
+
`@pinkaphant/kolmo` is a thin React Three Fiber (`@react-three/fiber`) + Rapier WASM (`@react-three/rapier`) game layer composing:
|
|
4
|
+
|
|
5
|
+
- **`@pinkaphant/ecctrl`** (`Ecctrl` character capsule + `EcctrlCameraControls` + `EcctrlVehicle` / `ShapeCastWheel` / `ThrustPropeller` + `Joystick` / `VirtualButton` + `useCustomGravity`)
|
|
6
|
+
- **`@khr3/core`** (`KHR_physics_rigid_bodies` + `KHR_implicit_shapes` + `OMI_vehicle_wheel` + `KOLMO_emitter` `.glb` loader, exporter, articulated `KhrAssembly`, `KhrVehicle`, and `KhrHeightfield`)
|
|
7
|
+
- **`@khr3/c12`** (exact $\mathbb{Z}[1/2, \sqrt{3}]$ 12-direction modular building lattice & socket snapping)
|
|
8
|
+
- **`@khr3/roads`** (seeded spline roads, slope-bounded terrain, and frontage lots)
|
|
9
|
+
- **`koota`** (zero-allocation Structure-of-Arrays ECS world, traits, exclusive `PilotLink` relation, and actions)
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## 1. Vite Configuration (`@pinkaphant/kolmo/vite`)
|
|
14
|
+
|
|
15
|
+
Always pass `KOLMO_SINGLETON_DEDUPE` to `resolve.dedupe` so React contexts, Three.js `Object3D` prototypes, Rapier WASM worlds, Koota worlds, and Zustand stores are never duplicated across chunks:
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import { defineConfig } from "vite";
|
|
19
|
+
import react from "@vitejs/plugin-react";
|
|
20
|
+
import { KOLMO_SINGLETON_DEDUPE } from "@pinkaphant/kolmo/vite";
|
|
21
|
+
|
|
22
|
+
export default defineConfig({
|
|
23
|
+
plugins: [react()],
|
|
24
|
+
resolve: {
|
|
25
|
+
dedupe: KOLMO_SINGLETON_DEDUPE,
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## 2. Shell, World & Physics (`@pinkaphant/kolmo`)
|
|
33
|
+
|
|
34
|
+
### `<Game>` (`KolmoGame`)
|
|
35
|
+
|
|
36
|
+
Full-viewport game container mounting `<KolmoCanvas>`, `<KolmoWorld>`, Koota `<WorldProvider>`, and an overlay portal target for `<Hud>`.
|
|
37
|
+
|
|
38
|
+
| Prop | Type | Default | Description |
|
|
39
|
+
| --- | --- | --- | --- |
|
|
40
|
+
| `gravity` | `KolmoGravitySpec` | `"planar"` | `"planar"` (`[0, -9.81, 0]`), `"zero"`, `[gx, gy, gz]`, `{ kind: "point", center, surfaceG, radius, inverseSquare? }`, `{ kind: "nbody", attractors }`, or `(pos, out) => THREE.Vector3`. |
|
|
41
|
+
| `skybox` | `"day" \| "night" \| "none"` | `"day"` | Sky clear color and atmospheric fog. |
|
|
42
|
+
| `lighting` | `"default" \| "none"` | `"default"` | Hemisphere + shadow-casting sun directional light (`RoomEnvironment` IBL controlled via `roomEnv`). |
|
|
43
|
+
| `fogExp2` | `[color: string, density: number] \| null` | `undefined` | Optional exponential squared fog override. |
|
|
44
|
+
| `paused` | `boolean` | `false` | Freezes physics stepping while preserving rendering. |
|
|
45
|
+
| `timeScale` | `number \| RefObject<number>` | `1` | Real-time simulation speed multiplier (supports bullet-time). |
|
|
46
|
+
| `maxDelta` | `number \| RefObject<number>` | `1 / 30` | Upper clamp on variable frame `dt`. |
|
|
47
|
+
| `debug` | `boolean` | `false` | Renders Rapier WASM collider wireframes (`physicsDebug` alias also accepted). |
|
|
48
|
+
| `dpr` | `number \| [number, number]` | `[1, 1.5]` | Canvas device pixel ratio. |
|
|
49
|
+
| `roomEnv` | `boolean \| number` | `0.65` | `RoomEnvironment` PMREM IBL intensity (`false` to disable). |
|
|
50
|
+
| `kootaWorld` | `KootaWorld` | `kolmoWorld` | Custom Koota `World` instance. |
|
|
51
|
+
|
|
52
|
+
> **Composing Inside Your Own `<Canvas>`**: Render `<World>` (`KolmoWorld`) inside any `<Canvas>` (or `<Physics>` / `KolmoPhysics` if managing your own lights and `<KeyboardControls>`). `<Hud>` works both inside `<Canvas>` (portals out automatically) and outside `<Canvas>`.
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## 3. Terrain (`<Terrain>` / `@pinkaphant/kolmo/terrain`)
|
|
57
|
+
|
|
58
|
+
`<Terrain>` (`KolmoTerrain`) supports **two modes** with zero `BoxGeometry` placeholders and exact Rapier WASM `HeightFieldFlags.FIX_INTERNAL_EDGES` parity:
|
|
59
|
+
|
|
60
|
+
### Mode A: Pre-Sampled Height Grid (e.g. `@khr3/roads`)
|
|
61
|
+
|
|
62
|
+
```tsx
|
|
63
|
+
import { Terrain } from "@pinkaphant/kolmo";
|
|
64
|
+
import { growRoad, makeTerrain, sampleRapierHeightfield } from "@khr3/roads";
|
|
65
|
+
|
|
66
|
+
const road = growRoad(7, { length: 1200, halfWidth: 4, controlSpacing: 40, maxTurn: 0.3, maxGrade: 0.08, hilliness: 24 });
|
|
67
|
+
const land = makeTerrain(7, road, {
|
|
68
|
+
amplitude: 16,
|
|
69
|
+
noise: { wavelength: 160, octaves: 4, gain: 0.5, lacunarity: 2 },
|
|
70
|
+
maxSlope: 0.55,
|
|
71
|
+
minShoulder: 6,
|
|
72
|
+
verge: 1.5,
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
// Sample centered at [0, 0, 0] over [-200, +200] x [-200, +200] in Rapier column-major order:
|
|
76
|
+
const heights = sampleRapierHeightfield(land, [-200, 0, -200], 400, 128);
|
|
77
|
+
|
|
78
|
+
<Terrain heights={heights} segments={128} size={[400, 400]} position={[0, 0, 0]} color="#49644d" />
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
*(If you have a row-major height array such as `@khr3/roads` `sampleHeightfield`, pass `layout="row-major"` and `<Terrain>` transposes it automatically.)*
|
|
82
|
+
|
|
83
|
+
### Mode B: Multi-Chunk Sculptable & `.glb`-Exportable Heightfield
|
|
84
|
+
|
|
85
|
+
```tsx
|
|
86
|
+
const terrainRef = useRef<KolmoTerrainHandle>(null);
|
|
87
|
+
|
|
88
|
+
<Terrain
|
|
89
|
+
ref={terrainRef}
|
|
90
|
+
chunksX={4}
|
|
91
|
+
chunksZ={4}
|
|
92
|
+
cellsPerChunk={24}
|
|
93
|
+
cellSizeM={1.5}
|
|
94
|
+
heightFn={(x, z) => 3 * Math.sin(x * 0.04) * Math.cos(z * 0.04)}
|
|
95
|
+
/>
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
- `terrainRef.current.applyBrush({ x, z, radius, strength, mode: "add" | "flatten" | "smooth" })` updates dirty chunk meshes and Rapier colliders in real time with $C^1$ cross-chunk normals.
|
|
99
|
+
- `await terrainRef.current.exportGlb()` exports a Khronos `KHR_physics_rigid_bodies` `.glb` binary with static trimesh colliders.
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## 4. Actors, Vehicles, Props & Surfaces
|
|
104
|
+
|
|
105
|
+
### `<Actor>` (`KolmoActor`)
|
|
106
|
+
|
|
107
|
+
Wraps `@pinkaphant/ecctrl`'s `<Ecctrl>` (`enableToggleRun={false}` by default so `[Shift]` sprints while held) + `<EcctrlCameraControls>` + Koota `ActorTrait`, and handles `[F]` vehicle boarding/exiting (`<React.StrictMode>` safe via `getLiveActorBody`):
|
|
108
|
+
|
|
109
|
+
```tsx
|
|
110
|
+
<Actor
|
|
111
|
+
ref={actorRef}
|
|
112
|
+
position={[0, 2, 8]}
|
|
113
|
+
bundle={optionalCharacterBundle}
|
|
114
|
+
maxWalkVel={3.8}
|
|
115
|
+
maxRunVel={7.8}
|
|
116
|
+
jumpVel={5.8}
|
|
117
|
+
/>
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### `<Vehicle>` (`KolmoVehicle`)
|
|
121
|
+
|
|
122
|
+
Loads a `.glb` (`src` or `bundle`) via `@khr3/core`'s `<KhrVehicle>`, resolves `seat` / `exit` sockets (`KOLMO_emitter` `socket: "seat" | "exit"`, `IK_Seat`, or `Seat_L`), drives ground cars, aircraft/rockets (`propellers`), or hybrid vehicles (`[G]` mode toggle), and streams `TransformTrait`, `VelocityTrait`, and `VehicleTelemetryTrait` (`rpm`, `gear`, `throttle`, `boost`, `slip`) into Koota:
|
|
123
|
+
|
|
124
|
+
```tsx
|
|
125
|
+
<Vehicle
|
|
126
|
+
id="skyline"
|
|
127
|
+
src="https://khr3.optimuspi.workers.dev/assets/cars/nissan_skyline_r34.glb"
|
|
128
|
+
position={[0, 1.6, 0]}
|
|
129
|
+
piloted={false}
|
|
130
|
+
interactRadius={4.2}
|
|
131
|
+
/>
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
- Pass `driver={(veh, dt, state) => { ... }}` for AI traffic / autonomous control.
|
|
135
|
+
- Read `bundle.emitters` (`KhrEmitterSpec[]`) for authored exhaust plumes, brake flares, and headlights (`KOLMO_emitter`).
|
|
136
|
+
|
|
137
|
+
### `<Prop>` (`KolmoProp`) & `<Surface>` (`KolmoSurface`)
|
|
138
|
+
|
|
139
|
+
- `<Prop src={...} position={[x, y, z]} fixed={false} />`: Mounts a dynamic or `fixed` KHR `.glb` assembly (`KhrAssembly`), registers `PropTrait` in Koota, and toggles articulated doors/hinges on click.
|
|
140
|
+
- `<Surface src={...} position={[x, y, z]} />`: Mounts a static KHR `.glb` ground/road/building assembly (`fixedRoot={true}`).
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## 5. Water Hydrodynamics (`<Water>` / `@pinkaphant/kolmo/water`)
|
|
145
|
+
|
|
146
|
+
Exact spherical-cap and 8-octant Archimedes submerged-volume buoyancy, hydrostatic roll/pitch righting torque, and exponentially stable linear/quadratic drag over dynamic Rapier bodies:
|
|
147
|
+
|
|
148
|
+
```tsx
|
|
149
|
+
<Water levelY={-1.2} originXZ={[0, 0]} size={[80, 80]} segments={[48, 48]} densityKgM3={1000} />
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## 6. Toolgun (`<Toolgun>` / `@pinkaphant/kolmo/toolgun`)
|
|
155
|
+
|
|
156
|
+
6-mode physics & C12 construction toolgun (`spawn`, `weld`, `hinge`, `rig`, `build`, `delete`):
|
|
157
|
+
|
|
158
|
+
- **Zero Primitive Fallbacks**: Viewmodel renders only when a `.glb` `src` or `bundle` is supplied (LCD canvas quad mounts automatically when `screen_rect` or `lcd_screen` exists on the `.glb`). Spawning/building requires an actual Rapier raycast surface hit (`NO SURFACE HIT` on sky miss).
|
|
159
|
+
- **Default R2 Vault C12 Pieces (`DEFAULT_VAULT_C12_URLS`)**: Out of the box, `build` mode loads real KHR `.glb` C12 architectural pieces (`FoundationSquare`, `FoundationTriangle`, `Wall`, `Doorway`, `Floor`, `FloorTriangle`, `Roof`, `RoofTriangle`, `Stairs`, `Street`, `DoorLeaf`) from the R2 vault, overridable via `c12Bundles` or `c12Urls`.
|
|
160
|
+
- **Shortcuts (when on foot)**: `[1–6]` or `[Q]` mode, `[R]` rotate +30° (`yaw12`), `[` / `]` cycle C12 piece, `[Z]` undo, `LMB` fire, `RMB` / `Tab` zoom.
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## 7. Koota ECS Queries, Actions & Replay
|
|
165
|
+
|
|
166
|
+
```tsx
|
|
167
|
+
import {
|
|
168
|
+
useQuery,
|
|
169
|
+
useActiveKolmoWorld,
|
|
170
|
+
useKolmoGame,
|
|
171
|
+
kolmoActions,
|
|
172
|
+
VehicleTrait,
|
|
173
|
+
VehicleTelemetryTrait,
|
|
174
|
+
PropTrait,
|
|
175
|
+
TransformTrait,
|
|
176
|
+
VelocityTrait,
|
|
177
|
+
} from "@pinkaphant/kolmo";
|
|
178
|
+
|
|
179
|
+
function CustomTelemetry() {
|
|
180
|
+
const { mode, activeVehicleId, nearVehicleId, boardVehicle, exitVehicle, resetVehicle } = useKolmoGame();
|
|
181
|
+
const vehicles = useQuery(VehicleTrait, VelocityTrait, VehicleTelemetryTrait);
|
|
182
|
+
// ...
|
|
183
|
+
}
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### Deterministic Replay (`@pinkaphant/kolmo/replay`)
|
|
187
|
+
|
|
188
|
+
- `FixedStepAccumulator(tickHz)`: Fixed-dt substepper with `alpha` interpolation factor.
|
|
189
|
+
- `InputTapeRecorder` / `InputTapePlayer`: 6-byte/tick binary `KRPL` input recording & playback (`<Actor getInput={player.readTick} />`).
|
|
190
|
+
- `KootaTrajectoryTape`: Zero-allocation `KTAP` SoA state capture (`tape.captureWorld(world)`) and quaternion-slerp timeline scrubbing (`tape.scrubWorld(world, timeSec)`).
|
|
191
|
+
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
## 8. Live Cloudflare R2 Asset Vault (`https://khr3.optimuspi.workers.dev/assets`)
|
|
195
|
+
|
|
196
|
+
Full catalog index: `https://khr3.optimuspi.workers.dev/assets/manifest.json`
|
|
197
|
+
|
|
198
|
+
- **Vehicles (`cars/`)**:
|
|
199
|
+
- `cars/nissan_skyline_r34.glb`, `cars/toyota_supra_a80.glb`, `cars/nissan_silvia_s15.glb`, `cars/lexus_is300.glb`, `cars/kolmogorov_hatchback.glb`, `cars/crotch_rocket.glb`, `cars/starfox_rocket.glb`
|
|
200
|
+
- **C12 Architecture & Props (`city/`)**:
|
|
201
|
+
- `city/foundation_square_3x3.glb`, `city/foundation_triangle_3m.glb`, `city/wall_solid_3x3x200mm.glb`, `city/wall_clapboard_doorframe_3x3.glb`, `city/door_hinged_single_900x2100.glb`, `city/floor_square_3x3.glb`, `city/floor_triangle_3m.glb`, `city/roof_flat_3x3.glb`, `city/roof_triangle_3m.glb`, `city/stairs_3x3.glb`, `city/R_Straight_6x6.glb`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pinkaphant/kolmo",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.3",
|
|
4
4
|
"description": "Thin React Three Fiber + Rapier WASM + @pinkaphant/ecctrl + @khr3/core + @khr3/c12 + Koota ECA game layer",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -20,6 +20,18 @@
|
|
|
20
20
|
"types": "./dist/physics/index.d.ts",
|
|
21
21
|
"import": "./dist/physics/index.js"
|
|
22
22
|
},
|
|
23
|
+
"./terrain": {
|
|
24
|
+
"types": "./dist/terrain/index.d.ts",
|
|
25
|
+
"import": "./dist/terrain/index.js"
|
|
26
|
+
},
|
|
27
|
+
"./water": {
|
|
28
|
+
"types": "./dist/water/index.d.ts",
|
|
29
|
+
"import": "./dist/water/index.js"
|
|
30
|
+
},
|
|
31
|
+
"./replay": {
|
|
32
|
+
"types": "./dist/replay/index.d.ts",
|
|
33
|
+
"import": "./dist/replay/index.js"
|
|
34
|
+
},
|
|
23
35
|
"./toolgun": {
|
|
24
36
|
"types": "./dist/toolgun/index.d.ts",
|
|
25
37
|
"import": "./dist/toolgun/index.js"
|
|
@@ -32,6 +44,7 @@
|
|
|
32
44
|
},
|
|
33
45
|
"files": [
|
|
34
46
|
"dist",
|
|
47
|
+
"docs",
|
|
35
48
|
"LICENSE",
|
|
36
49
|
"README.md"
|
|
37
50
|
],
|
|
@@ -47,29 +60,33 @@
|
|
|
47
60
|
"pack:dry": "npm pack --dry-run"
|
|
48
61
|
},
|
|
49
62
|
"peerDependencies": {
|
|
50
|
-
"@dimforge/rapier3d-compat": "0.19.2",
|
|
51
|
-
"@khr3/c12": ">=0.3.
|
|
52
|
-
"@khr3/core": ">=0.2.
|
|
53
|
-
"@pinkaphant/ecctrl": "2.0.4-beta.5",
|
|
63
|
+
"@dimforge/rapier3d-compat": "^0.19.2",
|
|
64
|
+
"@khr3/c12": ">=0.3.12",
|
|
65
|
+
"@khr3/core": ">=0.2.13",
|
|
66
|
+
"@pinkaphant/ecctrl": ">=2.0.4-beta.5",
|
|
54
67
|
"@react-three/drei": "^10.0.0",
|
|
55
68
|
"@react-three/fiber": "^9.0.0",
|
|
56
69
|
"@react-three/rapier": "^2.2.0",
|
|
70
|
+
"@types/three": ">=0.159.0",
|
|
57
71
|
"koota": "^0.6.6",
|
|
58
72
|
"maath": "^0.10.8",
|
|
59
73
|
"react": "^19.0.0",
|
|
60
74
|
"react-dom": "^19.0.0",
|
|
61
|
-
"three": "0.
|
|
75
|
+
"three": ">=0.159.0",
|
|
62
76
|
"zustand": "^5.0.0"
|
|
63
77
|
},
|
|
64
78
|
"peerDependenciesMeta": {
|
|
79
|
+
"@types/three": {
|
|
80
|
+
"optional": true
|
|
81
|
+
},
|
|
65
82
|
"react-dom": {
|
|
66
83
|
"optional": true
|
|
67
84
|
}
|
|
68
85
|
},
|
|
69
86
|
"devDependencies": {
|
|
70
87
|
"@dimforge/rapier3d-compat": "0.19.2",
|
|
71
|
-
"@khr3/c12": "^0.3.
|
|
72
|
-
"@khr3/core": "^0.2.
|
|
88
|
+
"@khr3/c12": "^0.3.12",
|
|
89
|
+
"@khr3/core": "^0.2.13",
|
|
73
90
|
"@pinkaphant/ecctrl": "2.0.4-beta.5",
|
|
74
91
|
"@react-three/drei": "^10.7.7",
|
|
75
92
|
"@react-three/fiber": "^9.6.1",
|