@pinkaphant/kolmo 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"surface-DUol_5ml.js","names":["_jsx","_jsxs","_jsx"],"sources":["../src/engine/input.ts","../src/engine/vehicle.tsx","../src/engine/surface.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 = bundle.sockets.IK_Seat ?? bundle.sockets.seat ?? bundle.sockets.driver_butt ?? 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.Socket_Exit ?? bundle.sockets.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, useEffect, useMemo, useRef } from \"react\";\nimport * as THREE from \"three\";\nimport type { ThreeEvent } from \"@react-three/fiber\";\nimport { CuboidCollider, RigidBody } from \"@react-three/rapier\";\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\";\n\nfunction ArenaSlab({\n size,\n position,\n color = \"#252b36\",\n}: {\n size: number;\n position: [number, number, number];\n color?: string;\n}): React.JSX.Element {\n const res = useMemo(\n () => ({\n geo: new THREE.BoxGeometry(size, 1, size),\n mat: new THREE.MeshStandardMaterial({ color, roughness: 0.9, metalness: 0.05 }),\n }),\n [size, color],\n );\n useEffect(\n () => () => {\n res.geo.dispose();\n res.mat.dispose();\n },\n [res],\n );\n\n return (\n <RigidBody type=\"fixed\" colliders={false} position={[position[0], position[1] - 0.5, position[2]]} friction={0.9}>\n <CuboidCollider args={[size * 0.5, 0.5, size * 0.5]} restitution={0.04} />\n <mesh geometry={res.geo} material={res.mat} receiveShadow />\n </RigidBody>\n );\n}\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 readonly size?: number;\n readonly color?: string;\n}\n\nexport function KolmoSurface({\n ref,\n src,\n bundle,\n size = 200,\n color,\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 return <ArenaSlab size={size} position={position} color={color} />;\n}\n\nfunction BundleProp({\n ref,\n bundle,\n alreadyCloned = false,\n fixed = false,\n enableCustomGravity,\n onClick: userOnClick,\n ...rest\n}: Omit<KhrAssemblyProps, \"bundle\" | \"onClick\"> & {\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 asmRef = useRef<KhrAssemblyHandle | null>(null);\n const cloned = useMemo(() => (alreadyCloned ? bundle : cloneKhrBundle(bundle)), [bundle, alreadyCloned]);\n\n const assignAsmRef = useCallback((h: KhrAssemblyHandle | null) => {\n asmRef.current = h;\n assignRef(ref, h);\n }, [ref]);\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\"> & {\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\"> {\n readonly src?: string;\n readonly bundle?: KhrAssetBundle;\n readonly fixed?: boolean;\n readonly onClick?: (e: ThreeEvent<MouseEvent>) => void;\n}\n\nexport function KolmoProp({ src, bundle, ...rest }: KolmoPropProps): React.JSX.Element | null {\n if (bundle)\n return <BundleProp bundle={bundle} {...rest} />;\n if (src)\n return <UrlProp src={src} {...rest} />;\n return null;\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;AAC1F;AAwBA,IAAa,uBAAuB;AAEpC,IAAM,aAAwD,OAAO,OAAO;CACxE,SAAS;CACT,UAAU;CACV,MAAM;CACN,OAAO;CACP,OAAO;CACP,OAAO;CACP,UAAU;CACV,UAAU;CACV,WAAW;CACX,SAAS;CACT,YAAY;CACZ,OAAO;CACP,YAAY;AAChB,CAAC;AAED,IAAa,oBAA+C,OAAO,OAAO;CACtE,GAAG;CACH,QAAQ;CACR,QAAQ;AACZ,CAAC;AAED,IAAa,gBAAiD;CAC1D;EAAE,MAAM;EAAW,MAAM,CAAC,QAAQ,SAAS;CAAE;CAC7C;EAAE,MAAM;EAAY,MAAM,CAAC,QAAQ,WAAW;CAAE;CAChD;EAAE,MAAM;EAAQ,MAAM,CAAC,QAAQ,WAAW;CAAE;CAC5C;EAAE,MAAM;EAAS,MAAM,CAAC,QAAQ,YAAY;CAAE;CAC9C;EAAE,MAAM;EAAS,MAAM,CAAC,OAAO;CAAE;CACjC;EAAE,MAAM;EAAS,MAAM,CAAC,aAAa,YAAY;CAAE;CACnD;EAAE,MAAM;EAAY,MAAM,CAAC,MAAM;CAAE;CACnC;EAAE,MAAM;EAAY,MAAM,CAAC,MAAM;CAAE;CACnC;EAAE,MAAM;EAAa,MAAM,CAAC,MAAM;CAAE;CACpC;EAAE,MAAM;EAAW,MAAM,CAAC,QAAQ,aAAa;CAAE;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G,CAAC,GAAG,CAAC;CAER,MAAM,UAAU,aACX,MAA8B;EAC3B,IAAI,EAAE,SAAS,KAAK,OAAO,SAAS,gBAAgB,EAAE,MAAM,GACxD,EAAE,gBAAgB;EAEtB,cAAc,CAAC;CACnB,GACA,CAAC,WAAW,CAChB;CAEA,OACIA,oBAAC,aAAD;EACI,KAAK;EACL,QAAQ;EACR,WAAW;EACX,qBAAqB,uBAAuB;EACnC;EACT,GAAI;CACP,CAAA;AAET;AAEA,SAAS,QAAQ,EACb,KACA,GAAG,QAKe;CAClB,MAAM,SAAS,UAAU,GAAG;CAC5B,OAAOA,oBAAC,YAAD;EAAoB;EAAQ,eAAA;EAAc,GAAI;CAAO,CAAA;AAChE;AASA,SAAgB,UAAU,EAAE,KAAK,QAAQ,GAAG,QAAkD;CAC1F,IAAI,QACA,OAAOA,oBAAC,YAAD;EAAoB;EAAQ,GAAI;CAAO,CAAA;CAClD,IAAI,KACA,OAAOA,oBAAC,SAAD;EAAc;EAAK,GAAI;CAAO,CAAA;CACzC,OAAO;AACX"}
@@ -0,0 +1,33 @@
1
+ import React from "react";
2
+ import * as THREE from "three";
3
+ import type { EcctrlHandle } from "@pinkaphant/ecctrl";
4
+ import { type KhrAssetBundle } from "@khr3/core";
5
+ import { type ArmedToolgunAsset, type ToolgunActionOutcome, type ToolgunSkinPreset } from "./store.js";
6
+ export interface MeasuredToolgunViewmodel {
7
+ readonly scene: THREE.Object3D;
8
+ readonly gripOffset: [number, number, number];
9
+ readonly muzzleLocal: [number, number, number];
10
+ readonly screenPos: [number, number, number];
11
+ readonly screenQuat: [number, number, number, number];
12
+ readonly screenSize: [number, number];
13
+ }
14
+ export declare function measureToolgunViewmodel(sourceScene: THREE.Object3D): MeasuredToolgunViewmodel;
15
+ export interface KolmoToolgunHandle {
16
+ fire: (shiftKey?: boolean) => ToolgunActionOutcome;
17
+ undo: () => string;
18
+ }
19
+ export interface KolmoToolgunProps {
20
+ readonly ref?: React.Ref<KolmoToolgunHandle>;
21
+ readonly src?: string;
22
+ readonly bundle?: KhrAssetBundle | null;
23
+ readonly actorRef?: React.RefObject<EcctrlHandle | null>;
24
+ readonly skinPreset?: ToolgunSkinPreset;
25
+ readonly defaultArmedAsset?: ArmedToolgunAsset | null;
26
+ readonly maxRangeM?: number;
27
+ readonly hipOffset?: readonly [number, number, number];
28
+ readonly zoomOffset?: readonly [number, number, number];
29
+ readonly enableShortcuts?: boolean;
30
+ readonly mountWorldOutlets?: boolean;
31
+ readonly enable?: boolean;
32
+ }
33
+ export declare function KolmoToolgun({ src, bundle, ...rest }: KolmoToolgunProps): React.JSX.Element | null;
@@ -0,0 +1,2 @@
1
+ export { TOOLGUN_BUILD_KINDS, TOOLGUN_MODES, TOOLGUN_SKIN_PRESETS, castToolgunRay, computeAlignedSpawnPose, computeBuildCandidate, createHingeImpulseJoint, createToolgunStore, createWeldImpulseJoint, rigJointRuntime, useToolgunStore, type ArmedToolgunAsset, type BuildSnapCandidate, type CreatedToolgunJoint, type SpawnedToolgunEntity, type ToolgunActionOutcome, type ToolgunBuildKind, type ToolgunMode, type ToolgunRayHit, type ToolgunSkinPreset, type ToolgunStoreState, } from "./store.js";
2
+ export { KolmoToolgun, KolmoToolgun as Toolgun, measureToolgunViewmodel, type KolmoToolgunHandle, type KolmoToolgunProps, type MeasuredToolgunViewmodel, } from "./Toolgun.js";
@@ -0,0 +1 @@
1
+ export { t as KolmoToolgun, t as Toolgun, r as TOOLGUN_BUILD_KINDS, i as TOOLGUN_MODES, a as TOOLGUN_SKIN_PRESETS, o as castToolgunRay, s as computeAlignedSpawnPose, c as computeBuildCandidate, l as createHingeImpulseJoint, u as createToolgunStore, d as createWeldImpulseJoint, n as measureToolgunViewmodel, f as rigJointRuntime, p as useToolgunStore } from "../toolgun-BfcCIAQx.js";
@@ -0,0 +1,198 @@
1
+ import type RAPIER from "@dimforge/rapier3d-compat";
2
+ import { type StoreApi, type UseBoundStore } from "zustand";
3
+ import { type JointRuntime, type KhrAssetBundle } from "@khr3/core";
4
+ import { type PiecePose, type PlacedPiece } from "@khr3/c12";
5
+ export declare const TOOLGUN_MODES: readonly ["spawn", "weld", "hinge", "rig", "build", "delete"];
6
+ export type ToolgunMode = (typeof TOOLGUN_MODES)[number];
7
+ export declare const TOOLGUN_BUILD_KINDS: readonly ["FoundationSquare", "FoundationTriangle", "Wall", "Doorway", "Floor", "FloorTriangle", "Roof", "RoofTriangle", "Stairs"];
8
+ export type ToolgunBuildKind = (typeof TOOLGUN_BUILD_KINDS)[number];
9
+ export interface ToolgunSkinSpec {
10
+ readonly bodyHex: string;
11
+ readonly accentHex: string;
12
+ readonly emissiveHex: string;
13
+ readonly metalness: number;
14
+ readonly roughness: number;
15
+ }
16
+ export declare const TOOLGUN_SKIN_PRESETS: {
17
+ readonly cobalt: {
18
+ readonly bodyHex: "#1e293b";
19
+ readonly accentHex: "#38bdf8";
20
+ readonly emissiveHex: "#0ea5e9";
21
+ readonly metalness: 0.65;
22
+ readonly roughness: 0.32;
23
+ };
24
+ readonly hazard: {
25
+ readonly bodyHex: "#292524";
26
+ readonly accentHex: "#f59e0b";
27
+ readonly emissiveHex: "#d97706";
28
+ readonly metalness: 0.55;
29
+ readonly roughness: 0.38;
30
+ };
31
+ readonly stealth: {
32
+ readonly bodyHex: "#0f172a";
33
+ readonly accentHex: "#64748b";
34
+ readonly emissiveHex: "#38bdf8";
35
+ readonly metalness: 0.72;
36
+ readonly roughness: 0.28;
37
+ };
38
+ readonly chrome: {
39
+ readonly bodyHex: "#cbd5e1";
40
+ readonly accentHex: "#0284c7";
41
+ readonly emissiveHex: "#38bdf8";
42
+ readonly metalness: 0.92;
43
+ readonly roughness: 0.14;
44
+ };
45
+ readonly arctic: {
46
+ readonly bodyHex: "#f1f5f9";
47
+ readonly accentHex: "#06b6d4";
48
+ readonly emissiveHex: "#22d3ee";
49
+ readonly metalness: 0.35;
50
+ readonly roughness: 0.42;
51
+ };
52
+ readonly ember: {
53
+ readonly bodyHex: "#1c1917";
54
+ readonly accentHex: "#ef4444";
55
+ readonly emissiveHex: "#f97316";
56
+ readonly metalness: 0.62;
57
+ readonly roughness: 0.34;
58
+ };
59
+ };
60
+ export type ToolgunSkinPreset = keyof typeof TOOLGUN_SKIN_PRESETS;
61
+ export interface ArmedToolgunAsset {
62
+ readonly id: string;
63
+ readonly name: string;
64
+ readonly src?: string;
65
+ readonly bundle?: KhrAssetBundle;
66
+ readonly kind?: "auto" | "vehicle" | "prop";
67
+ readonly fixed?: boolean;
68
+ }
69
+ export interface SpawnedToolgunEntity {
70
+ readonly id: string;
71
+ readonly name: string;
72
+ readonly kind: "vehicle" | "prop";
73
+ readonly src?: string;
74
+ readonly bundle?: KhrAssetBundle;
75
+ readonly fixed: boolean;
76
+ readonly position: [number, number, number];
77
+ readonly quaternion: [number, number, number, number];
78
+ }
79
+ export interface CreatedToolgunJoint {
80
+ readonly id: string;
81
+ readonly kind: "weld" | "hinge";
82
+ readonly handle: number;
83
+ readonly joint: RAPIER.ImpulseJoint;
84
+ readonly anchorWorld: [number, number, number];
85
+ }
86
+ export interface ToolgunRayHit {
87
+ readonly point: [number, number, number];
88
+ readonly normal: [number, number, number];
89
+ readonly distanceM: number;
90
+ readonly collider: RAPIER.Collider;
91
+ readonly body: RAPIER.RigidBody | null;
92
+ readonly label: string;
93
+ readonly spawnedEntityId?: string;
94
+ readonly placedPieceId?: string;
95
+ }
96
+ export interface PendingJointAnchor {
97
+ readonly body: RAPIER.RigidBody;
98
+ readonly worldPoint: [number, number, number];
99
+ readonly worldNormal: [number, number, number];
100
+ readonly label: string;
101
+ }
102
+ export interface BuildSnapCandidate {
103
+ readonly kind: ToolgunBuildKind;
104
+ readonly pose: PiecePose;
105
+ readonly position: [number, number, number];
106
+ readonly quaternion: [number, number, number, number];
107
+ readonly snappedSocket: boolean;
108
+ readonly valid: boolean;
109
+ readonly reason: string;
110
+ }
111
+ export type ToolgunHistoryEntry = {
112
+ readonly type: "spawn";
113
+ readonly id: string;
114
+ } | {
115
+ readonly type: "piece";
116
+ readonly id: string;
117
+ } | {
118
+ readonly type: "joint";
119
+ readonly id: string;
120
+ };
121
+ export interface ToolgunActionOutcome {
122
+ readonly ok: boolean;
123
+ readonly status: string;
124
+ readonly beamEnd: [number, number, number];
125
+ }
126
+ /**
127
+ * Casts a solid ray against Rapier WASM colliders, ignoring sensors and the optional actor RigidBody.
128
+ */
129
+ export declare function castToolgunRay(rapier: typeof RAPIER, world: RAPIER.World, origin: readonly [number, number, number], direction: readonly [number, number, number], maxRange?: number, excludeBody?: RAPIER.RigidBody | null): {
130
+ point: [number, number, number];
131
+ normal: [number, number, number];
132
+ toi: number;
133
+ collider: RAPIER.Collider;
134
+ body: RAPIER.RigidBody | null;
135
+ } | null;
136
+ /**
137
+ * Aligns a spawned asset's +Y axis to `surfaceNormal` (when sloped) composed with exact 30° `yaw12` turn.
138
+ */
139
+ export declare function computeAlignedSpawnPose(point: readonly [number, number, number], yaw12: number, surfaceNormal?: readonly [number, number, number], clearanceM?: number): {
140
+ position: [number, number, number];
141
+ quaternion: [number, number, number, number];
142
+ };
143
+ /**
144
+ * Creates a real Rapier WASM Fixed `ImpulseJoint` locking `bodyA` and `bodyB` at their current relative 6-DOF pose.
145
+ */
146
+ export declare function createWeldImpulseJoint(rapier: typeof RAPIER, world: RAPIER.World, bodyA: RAPIER.RigidBody, bodyB: RAPIER.RigidBody, worldAnchor: readonly [number, number, number]): RAPIER.ImpulseJoint;
147
+ /**
148
+ * Creates a real Rapier WASM Revolute `ImpulseJoint` around `worldAxis` through `worldAnchor`.
149
+ * Aligns `bodyB`'s hinge shaft to `worldAxis` about `worldAnchor` when `bodyB` is tilted off-axis so `t=0` has zero snap error.
150
+ */
151
+ export declare function createHingeImpulseJoint(rapier: typeof RAPIER, world: RAPIER.World, bodyA: RAPIER.RigidBody, bodyB: RAPIER.RigidBody, worldAnchor: readonly [number, number, number], worldAxis?: readonly [number, number, number]): RAPIER.ImpulseJoint;
152
+ /**
153
+ * Toggles or breaks an articulated `@khr3/core` `JointRuntime`.
154
+ */
155
+ export declare function rigJointRuntime(rt: JointRuntime, severBreakaway?: boolean): string;
156
+ /**
157
+ * Computes the nearest exact `@khr3/c12` socket-snapped or ground-lattice `BuildSnapCandidate` for `kind`.
158
+ */
159
+ export declare function computeBuildCandidate(placedPieces: readonly PlacedPiece[], aimPoint: readonly [number, number, number], kind: ToolgunBuildKind, yaw12: number, snapRadiusM?: number): BuildSnapCandidate;
160
+ export interface ToolgunStoreState {
161
+ readonly mode: ToolgunMode;
162
+ readonly skinPreset: ToolgunSkinPreset;
163
+ readonly yaw12: number;
164
+ readonly buildKind: ToolgunBuildKind;
165
+ readonly zoomed: boolean;
166
+ readonly armedAsset: ArmedToolgunAsset | null;
167
+ readonly target: ToolgunRayHit | null;
168
+ readonly buildPreview: BuildSnapCandidate | null;
169
+ readonly pendingAnchor: PendingJointAnchor | null;
170
+ readonly spawnedEntities: readonly SpawnedToolgunEntity[];
171
+ readonly placedPieces: readonly PlacedPiece[];
172
+ readonly createdJoints: readonly CreatedToolgunJoint[];
173
+ readonly history: readonly ToolgunHistoryEntry[];
174
+ readonly statusText: string;
175
+ readonly fireCount: number;
176
+ setMode: (mode: ToolgunMode) => void;
177
+ cycleMode: (delta?: number) => void;
178
+ setSkinPreset: (preset: ToolgunSkinPreset) => void;
179
+ rotateYaw12: (stepsDelta?: number) => void;
180
+ setBuildKind: (kind: ToolgunBuildKind) => void;
181
+ cycleBuildKind: (delta?: number) => void;
182
+ setZoomed: (zoomed: boolean) => void;
183
+ armAsset: (asset: ArmedToolgunAsset | null) => void;
184
+ setTarget: (hit: ToolgunRayHit | null) => void;
185
+ setBuildPreview: (candidate: BuildSnapCandidate | null) => void;
186
+ setPendingAnchor: (anchor: PendingJointAnchor | null) => void;
187
+ recordSpawn: (entry: SpawnedToolgunEntity) => void;
188
+ placeBuildPiece: (candidate: BuildSnapCandidate) => PlacedPiece | null;
189
+ recordJoint: (entry: CreatedToolgunJoint) => void;
190
+ removeEntityById: (id: string) => boolean;
191
+ removePieceById: (id: string) => boolean;
192
+ removeJointByBody: (world: RAPIER.World, body: RAPIER.RigidBody) => number;
193
+ undoLast: (world?: RAPIER.World | null) => string;
194
+ bumpFire: (status: string) => void;
195
+ resetAll: (world?: RAPIER.World | null) => void;
196
+ }
197
+ export declare function createToolgunStore(): UseBoundStore<StoreApi<ToolgunStoreState>>;
198
+ export declare const useToolgunStore: UseBoundStore<StoreApi<ToolgunStoreState>>;