@pinkaphant/kolmo 0.4.7 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +39 -93
- package/dist/engine/actor.d.ts +13 -0
- package/dist/engine/{kolmoGltfLoader.d.ts → gltfLoader.d.ts} +6 -3
- package/dist/engine/index.d.ts +8 -17
- package/dist/engine/index.js +1270 -27
- package/dist/engine/index.js.map +1 -1
- package/dist/engine/{kolmoInput.d.ts → input.d.ts} +7 -6
- package/dist/engine/surface.d.ts +19 -0
- package/dist/engine/{kolmoTraits.d.ts → traits.d.ts} +18 -47
- package/dist/engine/vehicle.d.ts +20 -0
- package/dist/engine/world.d.ts +76 -0
- package/dist/index.d.ts +12 -18
- package/dist/index.js +14 -116
- package/dist/physics/index.js +1 -131
- package/dist/physics-FhWvTBfH.js +424 -0
- package/dist/physics-FhWvTBfH.js.map +1 -0
- package/package.json +31 -85
- package/AGENTS.md +0 -29
- package/CLAUDE.md +0 -8
- package/bin/kolmo.mjs +0 -561
- package/dist/engine/causewayBridge.d.ts +0 -14
- package/dist/engine/causewayBridge.js +0 -166
- package/dist/engine/causewayBridge.js.map +0 -1
- package/dist/engine/islandSettlementMesh.d.ts +0 -26
- package/dist/engine/islandSettlementMesh.js +0 -166
- package/dist/engine/islandSettlementMesh.js.map +0 -1
- package/dist/engine/kolmoActions.d.ts +0 -23
- package/dist/engine/kolmoActions.js +0 -179
- package/dist/engine/kolmoActions.js.map +0 -1
- package/dist/engine/kolmoActor.d.ts +0 -21
- package/dist/engine/kolmoActor.js +0 -273
- package/dist/engine/kolmoActor.js.map +0 -1
- package/dist/engine/kolmoActorHelpers.d.ts +0 -24
- package/dist/engine/kolmoActorHelpers.js +0 -64
- package/dist/engine/kolmoActorHelpers.js.map +0 -1
- package/dist/engine/kolmoBotControl.d.ts +0 -44
- package/dist/engine/kolmoBotControl.js +0 -194
- package/dist/engine/kolmoBotControl.js.map +0 -1
- package/dist/engine/kolmoBotJournal.d.ts +0 -23
- package/dist/engine/kolmoBotJournal.js +0 -138
- package/dist/engine/kolmoBotJournal.js.map +0 -1
- package/dist/engine/kolmoFloatingOrigin.d.ts +0 -17
- package/dist/engine/kolmoFloatingOrigin.js +0 -91
- package/dist/engine/kolmoFloatingOrigin.js.map +0 -1
- package/dist/engine/kolmoGame.d.ts +0 -27
- package/dist/engine/kolmoGame.js +0 -83
- package/dist/engine/kolmoGame.js.map +0 -1
- package/dist/engine/kolmoGltfLoader.js +0 -46
- package/dist/engine/kolmoGltfLoader.js.map +0 -1
- package/dist/engine/kolmoHud.d.ts +0 -23
- package/dist/engine/kolmoHud.js +0 -219
- package/dist/engine/kolmoHud.js.map +0 -1
- package/dist/engine/kolmoInput.js +0 -165
- package/dist/engine/kolmoInput.js.map +0 -1
- package/dist/engine/kolmoIsland.d.ts +0 -14
- package/dist/engine/kolmoIsland.js +0 -243
- package/dist/engine/kolmoIsland.js.map +0 -1
- package/dist/engine/kolmoLongDrive.d.ts +0 -12
- package/dist/engine/kolmoLongDrive.js +0 -178
- package/dist/engine/kolmoLongDrive.js.map +0 -1
- package/dist/engine/kolmoPilotMesh.d.ts +0 -6
- package/dist/engine/kolmoPilotMesh.js +0 -377
- package/dist/engine/kolmoPilotMesh.js.map +0 -1
- package/dist/engine/kolmoProcedural.d.ts +0 -13
- package/dist/engine/kolmoProcedural.js +0 -101
- package/dist/engine/kolmoProcedural.js.map +0 -1
- package/dist/engine/kolmoRigs.d.ts +0 -13
- package/dist/engine/kolmoRigs.js +0 -100
- package/dist/engine/kolmoRigs.js.map +0 -1
- package/dist/engine/kolmoStore.d.ts +0 -3
- package/dist/engine/kolmoStore.js +0 -4
- package/dist/engine/kolmoStore.js.map +0 -1
- package/dist/engine/kolmoSurface.d.ts +0 -18
- package/dist/engine/kolmoSurface.js +0 -198
- package/dist/engine/kolmoSurface.js.map +0 -1
- package/dist/engine/kolmoTouchOverlay.d.ts +0 -21
- package/dist/engine/kolmoTouchOverlay.js +0 -326
- package/dist/engine/kolmoTouchOverlay.js.map +0 -1
- package/dist/engine/kolmoTouchState.d.ts +0 -50
- package/dist/engine/kolmoTouchState.js +0 -210
- package/dist/engine/kolmoTouchState.js.map +0 -1
- package/dist/engine/kolmoTraits.js +0 -140
- package/dist/engine/kolmoTraits.js.map +0 -1
- package/dist/engine/kolmoVehicle.d.ts +0 -4
- package/dist/engine/kolmoVehicle.js +0 -80
- package/dist/engine/kolmoVehicle.js.map +0 -1
- package/dist/engine/kolmoVehicleAutoCompile.d.ts +0 -11
- package/dist/engine/kolmoVehicleAutoCompile.js +0 -94
- package/dist/engine/kolmoVehicleAutoCompile.js.map +0 -1
- package/dist/engine/kolmoVehicleConfig.d.ts +0 -56
- package/dist/engine/kolmoVehicleConfig.js +0 -84
- package/dist/engine/kolmoVehicleConfig.js.map +0 -1
- package/dist/engine/kolmoVehicleDriver.d.ts +0 -39
- package/dist/engine/kolmoVehicleDriver.js +0 -147
- package/dist/engine/kolmoVehicleDriver.js.map +0 -1
- package/dist/engine/kolmoVehicleInner.d.ts +0 -7
- package/dist/engine/kolmoVehicleInner.js +0 -307
- package/dist/engine/kolmoVehicleInner.js.map +0 -1
- package/dist/engine/kolmoWardrobeRig.d.ts +0 -22
- package/dist/engine/kolmoWardrobeRig.js +0 -146
- package/dist/engine/kolmoWardrobeRig.js.map +0 -1
- package/dist/engine/kolmoWorld.d.ts +0 -45
- package/dist/engine/kolmoWorld.js +0 -164
- package/dist/engine/kolmoWorld.js.map +0 -1
- package/dist/engine/longDriveKit.d.ts +0 -19
- package/dist/engine/longDriveKit.js +0 -145
- package/dist/engine/longDriveKit.js.map +0 -1
- package/dist/engine/longDriveRoadside.d.ts +0 -16
- package/dist/engine/longDriveRoadside.js +0 -171
- package/dist/engine/longDriveRoadside.js.map +0 -1
- package/dist/engine/macroCellBuilder.d.ts +0 -44
- package/dist/engine/macroCellBuilder.js +0 -228
- package/dist/engine/macroCellBuilder.js.map +0 -1
- package/dist/engine/mainlandMacroCell.d.ts +0 -15
- package/dist/engine/mainlandMacroCell.js +0 -168
- package/dist/engine/mainlandMacroCell.js.map +0 -1
- package/dist/engine/shiftedFixedBody.d.ts +0 -13
- package/dist/engine/shiftedFixedBody.js +0 -75
- package/dist/engine/shiftedFixedBody.js.map +0 -1
- package/dist/importer/ChopShopPanel.d.ts +0 -52
- package/dist/importer/ChopShopPanel.js +0 -409
- package/dist/importer/ChopShopPanel.js.map +0 -1
- package/dist/importer/DomainWorkshopPanel.d.ts +0 -25
- package/dist/importer/DomainWorkshopPanel.js +0 -385
- package/dist/importer/DomainWorkshopPanel.js.map +0 -1
- package/dist/importer/GateHudBar.d.ts +0 -39
- package/dist/importer/GateHudBar.js +0 -401
- package/dist/importer/GateHudBar.js.map +0 -1
- package/dist/importer/GlbImportGate.d.ts +0 -8
- package/dist/importer/GlbImportGate.js +0 -300
- package/dist/importer/GlbImportGate.js.map +0 -1
- package/dist/importer/ImperativeVehicleRig.d.ts +0 -9
- package/dist/importer/ImperativeVehicleRig.js +0 -274
- package/dist/importer/ImperativeVehicleRig.js.map +0 -1
- package/dist/importer/LiveDrivePads.d.ts +0 -20
- package/dist/importer/LiveDrivePads.js +0 -195
- package/dist/importer/LiveDrivePads.js.map +0 -1
- package/dist/importer/PaperShellDebrisRig.d.ts +0 -25
- package/dist/importer/PaperShellDebrisRig.js +0 -143
- package/dist/importer/PaperShellDebrisRig.js.map +0 -1
- package/dist/importer/R2VaultDrawer.d.ts +0 -12
- package/dist/importer/R2VaultDrawer.js +0 -90
- package/dist/importer/R2VaultDrawer.js.map +0 -1
- package/dist/importer/Step1CalibrationPlinth.d.ts +0 -56
- package/dist/importer/Step1CalibrationPlinth.js +0 -204
- package/dist/importer/Step1CalibrationPlinth.js.map +0 -1
- package/dist/importer/Step1ExplodedIslands.d.ts +0 -31
- package/dist/importer/Step1ExplodedIslands.js +0 -144
- package/dist/importer/Step1ExplodedIslands.js.map +0 -1
- package/dist/importer/Step2UniversalPad.d.ts +0 -18
- package/dist/importer/Step2UniversalPad.js +0 -123
- package/dist/importer/Step2UniversalPad.js.map +0 -1
- package/dist/importer/VfxEmitterPool.d.ts +0 -8
- package/dist/importer/VfxEmitterPool.js +0 -64
- package/dist/importer/VfxEmitterPool.js.map +0 -1
- package/dist/importer/WardrobeWorkshopPanel.d.ts +0 -15
- package/dist/importer/WardrobeWorkshopPanel.js +0 -529
- package/dist/importer/WardrobeWorkshopPanel.js.map +0 -1
- package/dist/importer/WheelRingHandles3D.d.ts +0 -11
- package/dist/importer/WheelRingHandles3D.js +0 -319
- package/dist/importer/WheelRingHandles3D.js.map +0 -1
- package/dist/importer/archLinerGeom.d.ts +0 -2
- package/dist/importer/archLinerGeom.js +0 -51
- package/dist/importer/archLinerGeom.js.map +0 -1
- package/dist/importer/chopHingeHelpers.d.ts +0 -15
- package/dist/importer/chopHingeHelpers.js +0 -193
- package/dist/importer/chopHingeHelpers.js.map +0 -1
- package/dist/importer/chopShopActions.d.ts +0 -58
- package/dist/importer/chopShopActions.js +0 -165
- package/dist/importer/chopShopActions.js.map +0 -1
- package/dist/importer/chopShopHandlers.d.ts +0 -26
- package/dist/importer/chopShopHandlers.js +0 -283
- package/dist/importer/chopShopHandlers.js.map +0 -1
- package/dist/importer/chopShopIoActions.d.ts +0 -20
- package/dist/importer/chopShopIoActions.js +0 -192
- package/dist/importer/chopShopIoActions.js.map +0 -1
- package/dist/importer/chopShopMcpAction.d.ts +0 -18
- package/dist/importer/chopShopMcpAction.js +0 -58
- package/dist/importer/chopShopMcpAction.js.map +0 -1
- package/dist/importer/cylinderBooleanSlice.d.ts +0 -14
- package/dist/importer/cylinderBooleanSlice.js +0 -110
- package/dist/importer/cylinderBooleanSlice.js.map +0 -1
- package/dist/importer/cylinderSliceMath.d.ts +0 -14
- package/dist/importer/cylinderSliceMath.js +0 -251
- package/dist/importer/cylinderSliceMath.js.map +0 -1
- package/dist/importer/fusedWheelDetect.d.ts +0 -4
- package/dist/importer/fusedWheelDetect.js +0 -297
- package/dist/importer/fusedWheelDetect.js.map +0 -1
- package/dist/importer/fusedWheelFit.d.ts +0 -19
- package/dist/importer/fusedWheelFit.js +0 -219
- package/dist/importer/fusedWheelFit.js.map +0 -1
- package/dist/importer/gateStore.d.ts +0 -73
- package/dist/importer/gateStore.js +0 -102
- package/dist/importer/gateStore.js.map +0 -1
- package/dist/importer/glbNormalizer.d.ts +0 -22
- package/dist/importer/glbNormalizer.js +0 -177
- package/dist/importer/glbNormalizer.js.map +0 -1
- package/dist/importer/importerWebMcp.d.ts +0 -51
- package/dist/importer/importerWebMcp.js +0 -50
- package/dist/importer/importerWebMcp.js.map +0 -1
- package/dist/importer/importerWebMcpTools.d.ts +0 -2
- package/dist/importer/importerWebMcpTools.js +0 -368
- package/dist/importer/importerWebMcpTools.js.map +0 -1
- package/dist/importer/index.d.ts +0 -29
- package/dist/importer/index.js +0 -42
- package/dist/importer/index.js.map +0 -1
- package/dist/importer/khrCarGeometryMass.d.ts +0 -20
- package/dist/importer/khrCarGeometryMass.js +0 -131
- package/dist/importer/khrCarGeometryMass.js.map +0 -1
- package/dist/importer/khrCarPlanHelpers.d.ts +0 -39
- package/dist/importer/khrCarPlanHelpers.js +0 -300
- package/dist/importer/khrCarPlanHelpers.js.map +0 -1
- package/dist/importer/khrCarPlanner.d.ts +0 -8
- package/dist/importer/khrCarPlanner.js +0 -289
- package/dist/importer/khrCarPlanner.js.map +0 -1
- package/dist/importer/khrCompiler.d.ts +0 -5
- package/dist/importer/khrCompiler.js +0 -87
- package/dist/importer/khrCompiler.js.map +0 -1
- package/dist/importer/khrCraftPropCompiler.d.ts +0 -45
- package/dist/importer/khrCraftPropCompiler.js +0 -263
- package/dist/importer/khrCraftPropCompiler.js.map +0 -1
- package/dist/importer/khrNodeNameGuard.d.ts +0 -20
- package/dist/importer/khrNodeNameGuard.js +0 -139
- package/dist/importer/khrNodeNameGuard.js.map +0 -1
- package/dist/importer/launcherBake.d.ts +0 -15
- package/dist/importer/launcherBake.js +0 -117
- package/dist/importer/launcherBake.js.map +0 -1
- package/dist/importer/launcherCadGeometry.d.ts +0 -22
- package/dist/importer/launcherCadGeometry.js +0 -185
- package/dist/importer/launcherCadGeometry.js.map +0 -1
- package/dist/importer/meshIslands.d.ts +0 -17
- package/dist/importer/meshIslands.js +0 -102
- package/dist/importer/meshIslands.js.map +0 -1
- package/dist/importer/meshSliceBuffers.d.ts +0 -15
- package/dist/importer/meshSliceBuffers.js +0 -159
- package/dist/importer/meshSliceBuffers.js.map +0 -1
- package/dist/importer/polygonEarClipYZ.d.ts +0 -3
- package/dist/importer/polygonEarClipYZ.js +0 -67
- package/dist/importer/polygonEarClipYZ.js.map +0 -1
- package/dist/importer/proceduralC12AndCraft.d.ts +0 -18
- package/dist/importer/proceduralC12AndCraft.js +0 -302
- package/dist/importer/proceduralC12AndCraft.js.map +0 -1
- package/dist/importer/proceduralDomainBuilders.d.ts +0 -10
- package/dist/importer/proceduralDomainBuilders.js +0 -346
- package/dist/importer/proceduralDomainBuilders.js.map +0 -1
- package/dist/importer/proceduralPersonAndProp.d.ts +0 -8
- package/dist/importer/proceduralPersonAndProp.js +0 -303
- package/dist/importer/proceduralPersonAndProp.js.map +0 -1
- package/dist/importer/sceneSiNormalize.d.ts +0 -19
- package/dist/importer/sceneSiNormalize.js +0 -145
- package/dist/importer/sceneSiNormalize.js.map +0 -1
- package/dist/importer/starterScene.d.ts +0 -5
- package/dist/importer/starterScene.js +0 -139
- package/dist/importer/starterScene.js.map +0 -1
- package/dist/importer/surfaceCutter.d.ts +0 -16
- package/dist/importer/surfaceCutter.js +0 -83
- package/dist/importer/surfaceCutter.js.map +0 -1
- package/dist/importer/surfaceGeodesic.d.ts +0 -7
- package/dist/importer/surfaceGeodesic.js +0 -130
- package/dist/importer/surfaceGeodesic.js.map +0 -1
- package/dist/importer/surfaceLoopRefine.d.ts +0 -6
- package/dist/importer/surfaceLoopRefine.js +0 -171
- package/dist/importer/surfaceLoopRefine.js.map +0 -1
- package/dist/importer/surfacePeel.d.ts +0 -11
- package/dist/importer/surfacePeel.js +0 -119
- package/dist/importer/surfacePeel.js.map +0 -1
- package/dist/importer/surfaceTopology.d.ts +0 -36
- package/dist/importer/surfaceTopology.js +0 -143
- package/dist/importer/surfaceTopology.js.map +0 -1
- package/dist/importer/universalGateBake.d.ts +0 -45
- package/dist/importer/universalGateBake.js +0 -203
- package/dist/importer/universalGateBake.js.map +0 -1
- package/dist/importer/usdPhysicsSpecs.d.ts +0 -3
- package/dist/importer/usdPhysicsSpecs.js +0 -245
- package/dist/importer/usdPhysicsSpecs.js.map +0 -1
- package/dist/importer/usdTextParse.d.ts +0 -12
- package/dist/importer/usdTextParse.js +0 -118
- package/dist/importer/usdTextParse.js.map +0 -1
- package/dist/importer/usdToGlb.d.ts +0 -12
- package/dist/importer/usdToGlb.js +0 -94
- package/dist/importer/usdToGlb.js.map +0 -1
- package/dist/importer/useChopShopController.d.ts +0 -110
- package/dist/importer/useChopShopController.js +0 -219
- package/dist/importer/useChopShopController.js.map +0 -1
- package/dist/importer/useChopShopState.d.ts +0 -103
- package/dist/importer/useChopShopState.js +0 -350
- package/dist/importer/useChopShopState.js.map +0 -1
- package/dist/importer/useWasdKeyRef.d.ts +0 -9
- package/dist/importer/useWasdKeyRef.js +0 -35
- package/dist/importer/useWasdKeyRef.js.map +0 -1
- package/dist/importer/vehiclePartSplit.d.ts +0 -33
- package/dist/importer/vehiclePartSplit.js +0 -183
- package/dist/importer/vehiclePartSplit.js.map +0 -1
- package/dist/importer/wardrobeAutoFit.d.ts +0 -16
- package/dist/importer/wardrobeAutoFit.js +0 -410
- package/dist/importer/wardrobeAutoFit.js.map +0 -1
- package/dist/importer/wardrobeCatalog.d.ts +0 -16
- package/dist/importer/wardrobeCatalog.js +0 -409
- package/dist/importer/wardrobeCatalog.js.map +0 -1
- package/dist/importer/wardrobeController.d.ts +0 -49
- package/dist/importer/wardrobeController.js +0 -181
- package/dist/importer/wardrobeController.js.map +0 -1
- package/dist/importer/wardrobeFitter.d.ts +0 -27
- package/dist/importer/wardrobeFitter.js +0 -269
- package/dist/importer/wardrobeFitter.js.map +0 -1
- package/dist/importer/wardrobeWebMcpTools.d.ts +0 -2
- package/dist/importer/wardrobeWebMcpTools.js +0 -198
- package/dist/importer/wardrobeWebMcpTools.js.map +0 -1
- package/dist/importer/wheelAxlePairing.d.ts +0 -21
- package/dist/importer/wheelAxlePairing.js +0 -157
- package/dist/importer/wheelAxlePairing.js.map +0 -1
- package/dist/importer/wheelCutterHelpers.d.ts +0 -45
- package/dist/importer/wheelCutterHelpers.js +0 -208
- package/dist/importer/wheelCutterHelpers.js.map +0 -1
- package/dist/importer/wheelRingHandleMath.d.ts +0 -20
- package/dist/importer/wheelRingHandleMath.js +0 -66
- package/dist/importer/wheelRingHandleMath.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/junk/DestructibleTarget.d.ts +0 -18
- package/dist/junk/DestructibleTarget.js +0 -223
- package/dist/junk/DestructibleTarget.js.map +0 -1
- package/dist/junk/KolmoJunk.d.ts +0 -14
- package/dist/junk/KolmoJunk.js +0 -76
- package/dist/junk/KolmoJunk.js.map +0 -1
- package/dist/junk/ShardPieces.d.ts +0 -13
- package/dist/junk/ShardPieces.js +0 -101
- package/dist/junk/ShardPieces.js.map +0 -1
- package/dist/junk/TargetDecals.d.ts +0 -9
- package/dist/junk/TargetDecals.js +0 -77
- package/dist/junk/TargetDecals.js.map +0 -1
- package/dist/junk/bvhShatter.d.ts +0 -3
- package/dist/junk/bvhShatter.js +0 -101
- package/dist/junk/bvhShatter.js.map +0 -1
- package/dist/junk/bvhTriCollector.d.ts +0 -16
- package/dist/junk/bvhTriCollector.js +0 -127
- package/dist/junk/bvhTriCollector.js.map +0 -1
- package/dist/junk/index.d.ts +0 -14
- package/dist/junk/index.js +0 -13
- package/dist/junk/index.js.map +0 -1
- package/dist/junk/junkGeometry.d.ts +0 -13
- package/dist/junk/junkGeometry.js +0 -87
- package/dist/junk/junkGeometry.js.map +0 -1
- package/dist/junk/junkImportSanitize.d.ts +0 -5
- package/dist/junk/junkImportSanitize.js +0 -74
- package/dist/junk/junkImportSanitize.js.map +0 -1
- package/dist/junk/junkImporter.d.ts +0 -14
- package/dist/junk/junkImporter.js +0 -124
- package/dist/junk/junkImporter.js.map +0 -1
- package/dist/junk/junkLabelCanvas.d.ts +0 -2
- package/dist/junk/junkLabelCanvas.js +0 -185
- package/dist/junk/junkLabelCanvas.js.map +0 -1
- package/dist/junk/junkLabels.d.ts +0 -9
- package/dist/junk/junkLabels.js +0 -49
- package/dist/junk/junkLabels.js.map +0 -1
- package/dist/junk/junkProceduralScenes.d.ts +0 -12
- package/dist/junk/junkProceduralScenes.js +0 -220
- package/dist/junk/junkProceduralScenes.js.map +0 -1
- package/dist/junk/junkSheetSplitter.d.ts +0 -38
- package/dist/junk/junkSheetSplitter.js +0 -104
- package/dist/junk/junkSheetSplitter.js.map +0 -1
- package/dist/junk/junkTypes.d.ts +0 -48
- package/dist/junk/junkTypes.js +0 -0
- package/dist/junk/junkTypes.js.map +0 -1
- package/dist/junk/targetHelpers.d.ts +0 -55
- package/dist/junk/targetHelpers.js +0 -157
- package/dist/junk/targetHelpers.js.map +0 -1
- package/dist/junk/targetHitLogic.d.ts +0 -30
- package/dist/junk/targetHitLogic.js +0 -163
- package/dist/junk/targetHitLogic.js.map +0 -1
- package/dist/junk/useTargetAssets.d.ts +0 -19
- package/dist/junk/useTargetAssets.js +0 -130
- package/dist/junk/useTargetAssets.js.map +0 -1
- package/dist/physics/index.js.map +0 -1
- package/dist/physics/nBodyGravity.js +0 -70
- package/dist/physics/nBodyGravity.js.map +0 -1
- package/dist/sand3d/KolmoSand3D.d.ts +0 -19
- package/dist/sand3d/KolmoSand3D.js +0 -92
- package/dist/sand3d/KolmoSand3D.js.map +0 -1
- package/dist/sand3d/Sand3dWorkshopSection.d.ts +0 -8
- package/dist/sand3d/Sand3dWorkshopSection.js +0 -117
- package/dist/sand3d/Sand3dWorkshopSection.js.map +0 -1
- package/dist/sand3d/gateBakeHelpers.d.ts +0 -21
- package/dist/sand3d/gateBakeHelpers.js +0 -225
- package/dist/sand3d/gateBakeHelpers.js.map +0 -1
- package/dist/sand3d/gateDoorwayBake.d.ts +0 -12
- package/dist/sand3d/gateDoorwayBake.js +0 -203
- package/dist/sand3d/gateDoorwayBake.js.map +0 -1
- package/dist/sand3d/index.d.ts +0 -3
- package/dist/sand3d/index.js +0 -4
- package/dist/sand3d/index.js.map +0 -1
- package/dist/sand3d/sand3dAssetLoader.d.ts +0 -28
- package/dist/sand3d/sand3dAssetLoader.js +0 -177
- package/dist/sand3d/sand3dAssetLoader.js.map +0 -1
- package/dist/schema/kolmoSchema.d.ts +0 -9
- package/dist/schema/kolmoSchema.js +0 -110
- package/dist/schema/kolmoSchema.js.map +0 -1
- package/dist/schema/kolmoStamp.d.ts +0 -11
- package/dist/schema/kolmoStamp.js +0 -119
- package/dist/schema/kolmoStamp.js.map +0 -1
- package/dist/schema/kolmoTypes.d.ts +0 -63
- package/dist/schema/kolmoTypes.js +0 -66
- package/dist/schema/kolmoTypes.js.map +0 -1
- package/dist/shaders/celestialBackdrop.d.ts +0 -14
- package/dist/shaders/celestialBackdrop.js +0 -181
- package/dist/shaders/celestialBackdrop.js.map +0 -1
- package/dist/shaders/emitterShaders.d.ts +0 -9
- package/dist/shaders/emitterShaders.js +0 -114
- package/dist/shaders/emitterShaders.js.map +0 -1
- package/dist/shaders/index.d.ts +0 -5
- package/dist/shaders/index.js +0 -12
- package/dist/shaders/index.js.map +0 -1
- package/dist/shaders/plumeAndSparkle.d.ts +0 -12
- package/dist/shaders/plumeAndSparkle.js +0 -233
- package/dist/shaders/plumeAndSparkle.js.map +0 -1
- package/dist/shaders/ps2GlslShared.d.ts +0 -20
- package/dist/shaders/ps2GlslShared.js +0 -30
- package/dist/shaders/ps2GlslShared.js.map +0 -1
- package/dist/shaders/ps2MaterialsTSL.d.ts +0 -23
- package/dist/shaders/ps2MaterialsTSL.js +0 -146
- package/dist/shaders/ps2MaterialsTSL.js.map +0 -1
- package/dist/shaders/ps2MaterialsWebGL.d.ts +0 -15
- package/dist/shaders/ps2MaterialsWebGL.js +0 -57
- package/dist/shaders/ps2MaterialsWebGL.js.map +0 -1
- package/dist/shaders/ps2RoadWebGL.d.ts +0 -7
- package/dist/shaders/ps2RoadWebGL.js +0 -138
- package/dist/shaders/ps2RoadWebGL.js.map +0 -1
- package/dist/shaders/ps2TerrainWebGL.d.ts +0 -8
- package/dist/shaders/ps2TerrainWebGL.js +0 -131
- package/dist/shaders/ps2TerrainWebGL.js.map +0 -1
- package/dist/shaders/ps2Textures.d.ts +0 -22
- package/dist/shaders/ps2Textures.js +0 -299
- package/dist/shaders/ps2Textures.js.map +0 -1
- package/dist/shaders/retroPalettes.d.ts +0 -24
- package/dist/shaders/retroPalettes.js +0 -221
- package/dist/shaders/retroPalettes.js.map +0 -1
- package/dist/shaders/retroShader.d.ts +0 -13
- package/dist/shaders/retroShader.js +0 -110
- package/dist/shaders/retroShader.js.map +0 -1
- package/dist/shaders/retroUniforms.d.ts +0 -60
- package/dist/shaders/retroUniforms.js +0 -215
- package/dist/shaders/retroUniforms.js.map +0 -1
- package/dist/shaders/skyboxShaders.d.ts +0 -16
- package/dist/shaders/skyboxShaders.js +0 -266
- package/dist/shaders/skyboxShaders.js.map +0 -1
- package/dist/shaders/tsl.d.ts +0 -1
- package/dist/shaders/tsl.js +0 -1
- package/dist/shaders/tsl.js.map +0 -1
- package/dist/suika/KolmoSuikaOrb.d.ts +0 -33
- package/dist/suika/KolmoSuikaOrb.js +0 -375
- package/dist/suika/KolmoSuikaOrb.js.map +0 -1
- package/dist/suika/index.d.ts +0 -4
- package/dist/suika/index.js +0 -5
- package/dist/suika/index.js.map +0 -1
- package/dist/suika/suikaArbiter.d.ts +0 -60
- package/dist/suika/suikaArbiter.js +0 -265
- package/dist/suika/suikaArbiter.js.map +0 -1
- package/dist/suika/suikaGeometry.d.ts +0 -10
- package/dist/suika/suikaGeometry.js +0 -251
- package/dist/suika/suikaGeometry.js.map +0 -1
- package/dist/suika/suikaTypes.d.ts +0 -74
- package/dist/suika/suikaTypes.js +0 -196
- package/dist/suika/suikaTypes.js.map +0 -1
- package/dist/world/frontage.d.ts +0 -26
- package/dist/world/frontage.js +0 -36
- package/dist/world/frontage.js.map +0 -1
- package/dist/world/index.d.ts +0 -9
- package/dist/world/index.js +0 -12
- package/dist/world/index.js.map +0 -1
- package/dist/world/infiniteWorld2D.d.ts +0 -19
- package/dist/world/infiniteWorld2D.js +0 -219
- package/dist/world/infiniteWorld2D.js.map +0 -1
- package/dist/world/island.d.ts +0 -29
- package/dist/world/island.js +0 -116
- package/dist/world/island.js.map +0 -1
- package/dist/world/islandPathing.d.ts +0 -6
- package/dist/world/islandPathing.js +0 -166
- package/dist/world/islandPathing.js.map +0 -1
- package/dist/world/macroCellSchema.d.ts +0 -72
- package/dist/world/macroCellSchema.js +0 -34
- package/dist/world/macroCellSchema.js.map +0 -1
- package/dist/world/macroKnightAStar.d.ts +0 -11
- package/dist/world/macroKnightAStar.js +0 -240
- package/dist/world/macroKnightAStar.js.map +0 -1
- package/dist/world/macroSettlementZones.d.ts +0 -9
- package/dist/world/macroSettlementZones.js +0 -108
- package/dist/world/macroSettlementZones.js.map +0 -1
- package/dist/world/random.d.ts +0 -23
- package/dist/world/random.js +0 -59
- package/dist/world/random.js.map +0 -1
- package/dist/world/road.d.ts +0 -37
- package/dist/world/road.js +0 -198
- package/dist/world/road.js.map +0 -1
- package/dist/world/roadRibbon.d.ts +0 -29
- package/dist/world/roadRibbon.js +0 -166
- package/dist/world/roadRibbon.js.map +0 -1
- package/dist/world/terrain.d.ts +0 -62
- package/dist/world/terrain.js +0 -133
- package/dist/world/terrain.js.map +0 -1
- package/dist/world/terrainGeometry.d.ts +0 -14
- package/dist/world/terrainGeometry.js +0 -76
- package/dist/world/terrainGeometry.js.map +0 -1
- package/dist/world/worldTypes.d.ts +0 -43
- package/dist/world/worldTypes.js +0 -197
- package/dist/world/worldTypes.js.map +0 -1
- package/docs/api-reference.md +0 -728
- package/skills/kolmo-engine/SKILL.md +0 -109
|
@@ -0,0 +1,424 @@
|
|
|
1
|
+
import { Suspense, createContext, useContext, useLayoutEffect, useMemo } from "react";
|
|
2
|
+
import * as THREE from "three";
|
|
3
|
+
import { PhysicsWorld } from "@khr3/core";
|
|
4
|
+
import { useCustomGravity } from "@pinkaphant/ecctrl/gravity";
|
|
5
|
+
import { createActions, createQuery, createWorld, getStore, relation, trait, unpackEntity } from "koota";
|
|
6
|
+
import { WorldProvider, useWorld } from "koota/react";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
// src/engine/traits.ts
|
|
9
|
+
var VehicleTrait = trait(() => ({
|
|
10
|
+
id: "",
|
|
11
|
+
handle: null,
|
|
12
|
+
seatOffset: [
|
|
13
|
+
0,
|
|
14
|
+
.55,
|
|
15
|
+
0
|
|
16
|
+
],
|
|
17
|
+
exitOffset: [
|
|
18
|
+
-1.5,
|
|
19
|
+
.45,
|
|
20
|
+
0
|
|
21
|
+
],
|
|
22
|
+
isFlight: false
|
|
23
|
+
}));
|
|
24
|
+
var ActorTrait = trait(() => ({
|
|
25
|
+
id: "pilot",
|
|
26
|
+
handle: null,
|
|
27
|
+
exitSpawnPos: null,
|
|
28
|
+
exitSpawnYaw: 0,
|
|
29
|
+
exitLinVel: null
|
|
30
|
+
}));
|
|
31
|
+
var TransformTrait = trait({
|
|
32
|
+
x: 0,
|
|
33
|
+
y: 0,
|
|
34
|
+
z: 0,
|
|
35
|
+
qx: 0,
|
|
36
|
+
qy: 0,
|
|
37
|
+
qz: 0,
|
|
38
|
+
qw: 1
|
|
39
|
+
});
|
|
40
|
+
var VelocityTrait = trait({
|
|
41
|
+
vx: 0,
|
|
42
|
+
vy: 0,
|
|
43
|
+
vz: 0,
|
|
44
|
+
speedKmh: 0
|
|
45
|
+
});
|
|
46
|
+
var VehicleTelemetryTrait = trait({
|
|
47
|
+
rpm: 0,
|
|
48
|
+
gear: 1,
|
|
49
|
+
throttle: 0,
|
|
50
|
+
boost: 0,
|
|
51
|
+
slip: 0
|
|
52
|
+
});
|
|
53
|
+
var InteractableTrait = trait({
|
|
54
|
+
id: "",
|
|
55
|
+
radius: 4,
|
|
56
|
+
kind: "vehicle"
|
|
57
|
+
});
|
|
58
|
+
var PilotedTag = trait();
|
|
59
|
+
var PilotLink = relation({ exclusive: true });
|
|
60
|
+
var WorldSessionTrait = trait({ nearVehicleId: "" });
|
|
61
|
+
var vehicleSimQuery = createQuery(VehicleTrait, TransformTrait, VelocityTrait, VehicleTelemetryTrait);
|
|
62
|
+
var pilotedVehicleQuery = createQuery(VehicleTrait, PilotedTag);
|
|
63
|
+
var kolmoWorld = createWorld(WorldSessionTrait);
|
|
64
|
+
function useActiveKolmoWorld() {
|
|
65
|
+
try {
|
|
66
|
+
return useWorld();
|
|
67
|
+
} catch {
|
|
68
|
+
return kolmoWorld;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
function ensureWorldSession(w) {
|
|
72
|
+
if (!w.has(WorldSessionTrait)) w.add(WorldSessionTrait);
|
|
73
|
+
}
|
|
74
|
+
/** Zero-allocation SoA typed-array writer using Koota's public `unpackEntity` + `getStore`. */
|
|
75
|
+
function writeEntityKinematics(world, entity, pos, quat, linVel, speedKmh) {
|
|
76
|
+
const { entityId } = unpackEntity(entity);
|
|
77
|
+
if (entity.has(TransformTrait)) {
|
|
78
|
+
const xf = getStore(world, TransformTrait);
|
|
79
|
+
xf.x[entityId] = pos.x;
|
|
80
|
+
xf.y[entityId] = pos.y;
|
|
81
|
+
xf.z[entityId] = pos.z;
|
|
82
|
+
xf.qx[entityId] = quat.x;
|
|
83
|
+
xf.qy[entityId] = quat.y;
|
|
84
|
+
xf.qz[entityId] = quat.z;
|
|
85
|
+
xf.qw[entityId] = quat.w;
|
|
86
|
+
}
|
|
87
|
+
if (entity.has(VelocityTrait)) {
|
|
88
|
+
const vl = getStore(world, VelocityTrait);
|
|
89
|
+
vl.vx[entityId] = linVel.x;
|
|
90
|
+
vl.vy[entityId] = linVel.y;
|
|
91
|
+
vl.vz[entityId] = linVel.z;
|
|
92
|
+
vl.speedKmh[entityId] = speedKmh;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
/** Zero-allocation SoA typed-array writer for `VehicleTelemetryTrait` inside `useFrame`. */
|
|
96
|
+
function writeVehicleTelemetry(world, entity, rpm, gear, throttle, boost, slip) {
|
|
97
|
+
if (!entity.has(VehicleTelemetryTrait)) return;
|
|
98
|
+
const { entityId } = unpackEntity(entity);
|
|
99
|
+
const st = getStore(world, VehicleTelemetryTrait);
|
|
100
|
+
st.rpm[entityId] = rpm;
|
|
101
|
+
st.gear[entityId] = gear;
|
|
102
|
+
st.throttle[entityId] = throttle;
|
|
103
|
+
st.boost[entityId] = boost;
|
|
104
|
+
st.slip[entityId] = slip;
|
|
105
|
+
}
|
|
106
|
+
var _exitPos = new THREE.Vector3();
|
|
107
|
+
var _exitFwd = new THREE.Vector3();
|
|
108
|
+
var _flipUp = new THREE.Vector3();
|
|
109
|
+
var _flipFwd = new THREE.Vector3();
|
|
110
|
+
var _flipRight = new THREE.Vector3();
|
|
111
|
+
var _flipMat = new THREE.Matrix4();
|
|
112
|
+
var _flipQuat = new THREE.Quaternion();
|
|
113
|
+
function flipVehicleBodyUpright(veh) {
|
|
114
|
+
const body = veh.body;
|
|
115
|
+
if (!body) return;
|
|
116
|
+
const pos = body.translation();
|
|
117
|
+
_flipUp.copy(veh.upAxis);
|
|
118
|
+
if (_flipUp.lengthSq() < 1e-6) _flipUp.set(0, 1, 0);
|
|
119
|
+
else _flipUp.normalize();
|
|
120
|
+
_flipFwd.copy(veh.bodyZAxis).projectOnPlane(_flipUp);
|
|
121
|
+
if (_flipFwd.lengthSq() < 1e-6) {
|
|
122
|
+
if (Math.abs(_flipUp.y) < .9) _flipFwd.set(0, 1, 0).projectOnPlane(_flipUp);
|
|
123
|
+
else _flipFwd.set(0, 0, 1).projectOnPlane(_flipUp);
|
|
124
|
+
}
|
|
125
|
+
_flipFwd.normalize();
|
|
126
|
+
_flipRight.crossVectors(_flipUp, _flipFwd).normalize();
|
|
127
|
+
_flipMat.makeBasis(_flipRight, _flipUp, _flipFwd);
|
|
128
|
+
_flipQuat.setFromRotationMatrix(_flipMat);
|
|
129
|
+
body.setTranslation({
|
|
130
|
+
x: pos.x + _flipUp.x * 1.35,
|
|
131
|
+
y: pos.y + _flipUp.y * 1.35,
|
|
132
|
+
z: pos.z + _flipUp.z * 1.35
|
|
133
|
+
}, true);
|
|
134
|
+
body.setRotation({
|
|
135
|
+
x: _flipQuat.x,
|
|
136
|
+
y: _flipQuat.y,
|
|
137
|
+
z: _flipQuat.z,
|
|
138
|
+
w: _flipQuat.w
|
|
139
|
+
}, true);
|
|
140
|
+
body.setLinvel({
|
|
141
|
+
x: 0,
|
|
142
|
+
y: 0,
|
|
143
|
+
z: 0
|
|
144
|
+
}, true);
|
|
145
|
+
body.setAngvel({
|
|
146
|
+
x: 0,
|
|
147
|
+
y: 0,
|
|
148
|
+
z: 0
|
|
149
|
+
}, true);
|
|
150
|
+
}
|
|
151
|
+
var kolmoActions = createActions((world) => ({
|
|
152
|
+
boardVehicle: (vehicleId) => {
|
|
153
|
+
ensureWorldSession(world);
|
|
154
|
+
let targetEnt;
|
|
155
|
+
for (const vehEnt of world.query(VehicleTrait)) {
|
|
156
|
+
const v = vehEnt.get(VehicleTrait);
|
|
157
|
+
if (v && (!vehicleId || v.id === vehicleId)) {
|
|
158
|
+
targetEnt = vehEnt;
|
|
159
|
+
break;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
if (!targetEnt) return;
|
|
163
|
+
for (const prev of world.query(pilotedVehicleQuery)) if (prev !== targetEnt && prev.has(PilotedTag)) prev.remove(PilotedTag);
|
|
164
|
+
if (!targetEnt.has(PilotedTag)) targetEnt.add(PilotedTag);
|
|
165
|
+
const pilot = world.queryFirst(ActorTrait);
|
|
166
|
+
if (pilot) pilot.add(PilotLink(targetEnt));
|
|
167
|
+
if (world.get(WorldSessionTrait)?.nearVehicleId) world.set(WorldSessionTrait, { nearVehicleId: "" });
|
|
168
|
+
},
|
|
169
|
+
exitVehicle: () => {
|
|
170
|
+
ensureWorldSession(world);
|
|
171
|
+
const pilot = world.queryFirst(ActorTrait);
|
|
172
|
+
const linked = pilot?.targetFor(PilotLink) ?? world.queryFirst(pilotedVehicleQuery);
|
|
173
|
+
if (linked) {
|
|
174
|
+
const v = linked.get(VehicleTrait);
|
|
175
|
+
if (pilot) {
|
|
176
|
+
if (pilot.has(PilotLink(linked))) pilot.remove(PilotLink(linked));
|
|
177
|
+
if (v?.handle) {
|
|
178
|
+
_exitPos.set(v.exitOffset[0], v.exitOffset[1], v.exitOffset[2]).applyQuaternion(v.handle.currQuat).add(v.handle.currPos);
|
|
179
|
+
_exitFwd.copy(v.handle.bodyZAxis).projectOnPlane(v.handle.upAxis).normalize();
|
|
180
|
+
const yaw = _exitFwd.lengthSq() > 1e-6 ? Math.atan2(_exitFwd.x, _exitFwd.z) : 0;
|
|
181
|
+
const lv = v.handle.currLinVel;
|
|
182
|
+
const curActor = pilot.get(ActorTrait);
|
|
183
|
+
pilot.set(ActorTrait, {
|
|
184
|
+
id: curActor?.id ?? "pilot",
|
|
185
|
+
handle: null,
|
|
186
|
+
exitSpawnPos: [
|
|
187
|
+
_exitPos.x,
|
|
188
|
+
_exitPos.y,
|
|
189
|
+
_exitPos.z
|
|
190
|
+
],
|
|
191
|
+
exitSpawnYaw: yaw,
|
|
192
|
+
exitLinVel: [
|
|
193
|
+
lv.x,
|
|
194
|
+
lv.y,
|
|
195
|
+
lv.z
|
|
196
|
+
]
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
if (linked.has(PilotedTag)) linked.remove(PilotedTag);
|
|
201
|
+
v?.handle?.setMovement({
|
|
202
|
+
forward: false,
|
|
203
|
+
backward: false,
|
|
204
|
+
steerLeft: false,
|
|
205
|
+
steerRight: false,
|
|
206
|
+
brake: !v.isFlight
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
for (const extra of world.query(pilotedVehicleQuery)) if (extra.has(PilotedTag)) extra.remove(PilotedTag);
|
|
210
|
+
},
|
|
211
|
+
resetVehicle: (vehicleId) => {
|
|
212
|
+
let target;
|
|
213
|
+
if (vehicleId) for (const ent of world.query(VehicleTrait)) {
|
|
214
|
+
const v = ent.get(VehicleTrait);
|
|
215
|
+
if (v?.id === vehicleId && v.handle?.body) {
|
|
216
|
+
target = v;
|
|
217
|
+
break;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
if (!target) {
|
|
221
|
+
const pv = (world.queryFirst(ActorTrait)?.targetFor(PilotLink) ?? world.queryFirst(pilotedVehicleQuery))?.get(VehicleTrait);
|
|
222
|
+
if (pv?.handle?.body) target = pv;
|
|
223
|
+
}
|
|
224
|
+
if (!target) for (const ent of world.query(VehicleTrait)) {
|
|
225
|
+
const v = ent.get(VehicleTrait);
|
|
226
|
+
if (v?.handle?.body) {
|
|
227
|
+
target = v;
|
|
228
|
+
break;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
if (target?.handle) flipVehicleBodyUpright(target.handle);
|
|
232
|
+
}
|
|
233
|
+
}));
|
|
234
|
+
// src/physics/nBodyGravity.ts
|
|
235
|
+
/** CODATA Newtonian gravitational constant in SI units (m^3 kg^-1 s^-2). */
|
|
236
|
+
var G_SI = 66743e-15;
|
|
237
|
+
function resolveAttractorMu(attractor, gravitationalConstant = G_SI) {
|
|
238
|
+
const rRef = Math.max(0, attractor.radius ?? 0);
|
|
239
|
+
const eps = Math.max(1e-4, attractor.softeningM ?? (rRef > 0 ? rRef * .05 : .5));
|
|
240
|
+
const epsSq = eps * eps;
|
|
241
|
+
if (typeof attractor.mu === "number" && Number.isFinite(attractor.mu)) return {
|
|
242
|
+
mu: Math.max(0, attractor.mu),
|
|
243
|
+
epsSq
|
|
244
|
+
};
|
|
245
|
+
if (typeof attractor.surfaceG === "number" && Number.isFinite(attractor.surfaceG) && rRef > 0) {
|
|
246
|
+
const denom = Math.pow(rRef * rRef + epsSq, 1.5);
|
|
247
|
+
return {
|
|
248
|
+
mu: Math.max(0, attractor.surfaceG * denom / rRef),
|
|
249
|
+
epsSq
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
if (typeof attractor.massKg === "number" && Number.isFinite(attractor.massKg)) return {
|
|
253
|
+
mu: Math.max(0, attractor.massKg * gravitationalConstant),
|
|
254
|
+
epsSq
|
|
255
|
+
};
|
|
256
|
+
return {
|
|
257
|
+
mu: 0,
|
|
258
|
+
epsSq
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Evaluates softened Newtonian multi-attractor gravitational acceleration (m/s^2):
|
|
263
|
+
* g(x) = sum_i mu_i * (p_i - x) / (|p_i - x|^2 + eps_i^2)^(3/2)
|
|
264
|
+
* Zero artificial floor clamps and zero boundary fences.
|
|
265
|
+
*/
|
|
266
|
+
function evaluateNBodyGravity(pos, attractors, out, gravitationalConstant = G_SI) {
|
|
267
|
+
let gx = 0;
|
|
268
|
+
let gy = 0;
|
|
269
|
+
let gz = 0;
|
|
270
|
+
for (let i = 0; i < attractors.length; i++) {
|
|
271
|
+
const a = attractors[i];
|
|
272
|
+
const { mu, epsSq } = resolveAttractorMu(a, gravitationalConstant);
|
|
273
|
+
if (mu <= 0) continue;
|
|
274
|
+
const dx = a.position[0] - pos.x;
|
|
275
|
+
const dy = a.position[1] - pos.y;
|
|
276
|
+
const dz = a.position[2] - pos.z;
|
|
277
|
+
const rSq = dx * dx + dy * dy + dz * dz;
|
|
278
|
+
if (rSq < 1e-12) continue;
|
|
279
|
+
const scale = mu * (1 / Math.pow(rSq + epsSq, 1.5));
|
|
280
|
+
gx += dx * scale;
|
|
281
|
+
gy += dy * scale;
|
|
282
|
+
gz += dz * scale;
|
|
283
|
+
}
|
|
284
|
+
return out.set(gx, gy, gz);
|
|
285
|
+
}
|
|
286
|
+
function createNBodyGravityField(attractors, gravitationalConstant = G_SI) {
|
|
287
|
+
return (pos, out) => evaluateNBodyGravity(pos, attractors, out, gravitationalConstant);
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Exact tangential speed v_circ (m/s) for a circular orbit of radius `orbitRadiusM`
|
|
291
|
+
* around a softened point/spherical attractor:
|
|
292
|
+
* v^2 / r = mu * r / (r^2 + eps^2)^(3/2) => v = r * sqrt(mu / (r^2 + eps^2)^(3/2))
|
|
293
|
+
*/
|
|
294
|
+
function computeCircularOrbitSpeed(attractor, orbitRadiusM, gravitationalConstant = G_SI) {
|
|
295
|
+
if (orbitRadiusM <= 0) return 0;
|
|
296
|
+
const { mu, epsSq } = resolveAttractorMu(attractor, gravitationalConstant);
|
|
297
|
+
if (mu <= 0) return 0;
|
|
298
|
+
return orbitRadiusM * Math.sqrt(mu / Math.pow(orbitRadiusM * orbitRadiusM + epsSq, 1.5));
|
|
299
|
+
}
|
|
300
|
+
// src/physics/index.tsx
|
|
301
|
+
var KolmoGravityContext = createContext(false);
|
|
302
|
+
function useOptionalKootaWorld() {
|
|
303
|
+
try {
|
|
304
|
+
return useWorld();
|
|
305
|
+
} catch {
|
|
306
|
+
return null;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
function isGravityTuple(g) {
|
|
310
|
+
return Array.isArray(g);
|
|
311
|
+
}
|
|
312
|
+
function isPointGravity(g) {
|
|
313
|
+
return typeof g === "object" && !Array.isArray(g) && "kind" in g && g.kind === "point";
|
|
314
|
+
}
|
|
315
|
+
function isNBodyGravity(g) {
|
|
316
|
+
return typeof g === "object" && !Array.isArray(g) && "kind" in g && g.kind === "nbody";
|
|
317
|
+
}
|
|
318
|
+
var _gravTmp = new THREE.Vector3();
|
|
319
|
+
function KolmoPhysics({ gravity = "planar", paused = false, timeScale = 1, maxDelta, physicsDebug = false, world = null, children, ...physicsProps }) {
|
|
320
|
+
const outerWorld = useOptionalKootaWorld();
|
|
321
|
+
const resolvedWorld = world ?? outerWorld ?? kolmoWorld;
|
|
322
|
+
const isCallback = typeof gravity === "function";
|
|
323
|
+
const isTuple = isGravityTuple(gravity);
|
|
324
|
+
const isCustomLiteral = gravity === "custom";
|
|
325
|
+
const isPoint = isPointGravity(gravity);
|
|
326
|
+
const isNBody = isNBodyGravity(gravity);
|
|
327
|
+
const isCustomGravity = isCallback || isPoint || isNBody || isCustomLiteral;
|
|
328
|
+
const gx = isTuple ? gravity[0] : 0;
|
|
329
|
+
const gy = isTuple ? gravity[1] : -9.81;
|
|
330
|
+
const gz = isTuple ? gravity[2] : 0;
|
|
331
|
+
const cx = isPoint ? gravity.center[0] : 0;
|
|
332
|
+
const cy = isPoint ? gravity.center[1] : 0;
|
|
333
|
+
const cz = isPoint ? gravity.center[2] : 0;
|
|
334
|
+
const pointRadius = isPoint ? gravity.radius : 1;
|
|
335
|
+
const pointInverseSq = isPoint ? Boolean(gravity.inverseSquare) : false;
|
|
336
|
+
const surfaceG = isPoint ? gravity.surfaceG : gravity === "zero" ? 0 : 9.81;
|
|
337
|
+
const gravityFn = isCallback ? gravity : null;
|
|
338
|
+
const nBodySpec = isNBody ? gravity : null;
|
|
339
|
+
const rapierGravity = useMemo(() => isTuple ? [
|
|
340
|
+
gx,
|
|
341
|
+
gy,
|
|
342
|
+
gz
|
|
343
|
+
] : isCustomGravity || gravity === "zero" ? [
|
|
344
|
+
0,
|
|
345
|
+
0,
|
|
346
|
+
0
|
|
347
|
+
] : [
|
|
348
|
+
0,
|
|
349
|
+
-9.81,
|
|
350
|
+
0
|
|
351
|
+
], [
|
|
352
|
+
isTuple,
|
|
353
|
+
gx,
|
|
354
|
+
gy,
|
|
355
|
+
gz,
|
|
356
|
+
isCustomGravity,
|
|
357
|
+
gravity === "zero"
|
|
358
|
+
]);
|
|
359
|
+
useLayoutEffect(() => {
|
|
360
|
+
if (isCustomLiteral || !isCallback && !isPoint && !isNBody) return;
|
|
361
|
+
const setField = useCustomGravity.getState().setGravityField;
|
|
362
|
+
if (gravityFn) setField((pos) => gravityFn(pos, _gravTmp));
|
|
363
|
+
else if (nBodySpec) setField((pos) => evaluateNBodyGravity(pos, nBodySpec.attractors, _gravTmp, nBodySpec.gravitationalConstant));
|
|
364
|
+
else if (isPoint) {
|
|
365
|
+
if (pointInverseSq) {
|
|
366
|
+
const single = [{
|
|
367
|
+
position: [
|
|
368
|
+
cx,
|
|
369
|
+
cy,
|
|
370
|
+
cz
|
|
371
|
+
],
|
|
372
|
+
surfaceG,
|
|
373
|
+
radius: pointRadius
|
|
374
|
+
}];
|
|
375
|
+
setField((pos) => evaluateNBodyGravity(pos, single, _gravTmp));
|
|
376
|
+
} else setField((pos) => {
|
|
377
|
+
_gravTmp.set(pos.x - cx, pos.y - cy, pos.z - cz);
|
|
378
|
+
const lenSq = _gravTmp.lengthSq();
|
|
379
|
+
return lenSq < 1e-8 ? _gravTmp.set(0, -surfaceG, 0) : _gravTmp.multiplyScalar(-surfaceG / Math.sqrt(lenSq));
|
|
380
|
+
});
|
|
381
|
+
}
|
|
382
|
+
return () => {
|
|
383
|
+
setField(() => _gravTmp.set(0, -9.81, 0));
|
|
384
|
+
};
|
|
385
|
+
}, [
|
|
386
|
+
isCustomLiteral,
|
|
387
|
+
isCallback,
|
|
388
|
+
isPoint,
|
|
389
|
+
isNBody,
|
|
390
|
+
gravityFn,
|
|
391
|
+
nBodySpec,
|
|
392
|
+
cx,
|
|
393
|
+
cy,
|
|
394
|
+
cz,
|
|
395
|
+
pointRadius,
|
|
396
|
+
pointInverseSq,
|
|
397
|
+
surfaceG
|
|
398
|
+
]);
|
|
399
|
+
const content = /* @__PURE__ */ jsx(KolmoGravityContext.Provider, {
|
|
400
|
+
value: isCustomGravity,
|
|
401
|
+
children: /* @__PURE__ */ jsx(PhysicsWorld, {
|
|
402
|
+
...physicsProps,
|
|
403
|
+
paused,
|
|
404
|
+
timeScale,
|
|
405
|
+
...maxDelta === void 0 ? {} : { maxDelta },
|
|
406
|
+
gravity: rapierGravity,
|
|
407
|
+
debug: physicsDebug,
|
|
408
|
+
children: /* @__PURE__ */ jsx(Suspense, {
|
|
409
|
+
fallback: null,
|
|
410
|
+
children
|
|
411
|
+
})
|
|
412
|
+
})
|
|
413
|
+
});
|
|
414
|
+
return resolvedWorld !== outerWorld ? /* @__PURE__ */ jsx(WorldProvider, {
|
|
415
|
+
world: resolvedWorld,
|
|
416
|
+
children: content
|
|
417
|
+
}) : content;
|
|
418
|
+
}
|
|
419
|
+
function useIsKolmoCustomGravity() {
|
|
420
|
+
return useContext(KolmoGravityContext);
|
|
421
|
+
}
|
|
422
|
+
export { pilotedVehicleQuery as C, writeVehicleTelemetry as D, writeEntityKinematics as E, kolmoWorld as S, vehicleSimQuery as T, VelocityTrait as _, G_SI as a, flipVehicleBodyUpright as b, evaluateNBodyGravity as c, InteractableTrait as d, PilotLink as f, VehicleTrait as g, VehicleTelemetryTrait as h, useOptionalKootaWorld as i, resolveAttractorMu as l, TransformTrait as m, KolmoPhysics as n, computeCircularOrbitSpeed as o, PilotedTag as p, useIsKolmoCustomGravity as r, createNBodyGravityField as s, KolmoGravityContext as t, ActorTrait as u, WorldSessionTrait as v, useActiveKolmoWorld as w, kolmoActions as x, ensureWorldSession as y };
|
|
423
|
+
|
|
424
|
+
//# sourceMappingURL=physics-FhWvTBfH.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"physics-FhWvTBfH.js","names":["_jsx"],"sources":["../src/engine/traits.ts","../src/physics/nBodyGravity.ts","../src/physics/index.tsx"],"sourcesContent":["import * as THREE from \"three\";\nimport {\n createActions,\n createQuery,\n createWorld,\n getStore,\n relation,\n trait,\n unpackEntity,\n type Entity,\n type World,\n} from \"koota\";\nimport { useWorld } from \"koota/react\";\nimport type { EcctrlHandle } from \"@pinkaphant/ecctrl\";\nimport type { EcctrlVehicleHandle } from \"@pinkaphant/ecctrl/vehicle\";\n\nexport type KolmoControlMode = \"foot\" | \"car\" | \"flight\";\n\nexport interface VehicleTraitData {\n id: string;\n handle: EcctrlVehicleHandle | null;\n seatOffset: [number, number, number];\n exitOffset: [number, number, number];\n isFlight: boolean;\n}\n\nexport interface ActorTraitData {\n id: string;\n handle: EcctrlHandle | null;\n exitSpawnPos: [number, number, number] | null;\n exitSpawnYaw: number;\n exitLinVel: [number, number, number] | null;\n}\n\nexport const VehicleTrait = trait((): VehicleTraitData => ({\n id: \"\",\n handle: null,\n seatOffset: [0, 0.55, 0],\n exitOffset: [-1.5, 0.45, 0],\n isFlight: false,\n}));\n\nexport const ActorTrait = trait((): ActorTraitData => ({\n id: \"pilot\",\n handle: null,\n exitSpawnPos: null,\n exitSpawnYaw: 0,\n exitLinVel: null,\n}));\n\nexport const TransformTrait = trait({ x: 0, y: 0, z: 0, qx: 0, qy: 0, qz: 0, qw: 1 });\nexport const VelocityTrait = trait({ vx: 0, vy: 0, vz: 0, speedKmh: 0 });\nexport const VehicleTelemetryTrait = trait({ rpm: 0, gear: 1, throttle: 0, boost: 0, slip: 0 });\nexport const InteractableTrait = trait({ id: \"\", radius: 4, kind: \"vehicle\" as \"vehicle\" | \"prop\" });\nexport const PilotedTag = trait();\nexport const PilotLink = relation({ exclusive: true });\nexport const WorldSessionTrait = trait({ nearVehicleId: \"\" });\n\nexport const vehicleSimQuery = createQuery(VehicleTrait, TransformTrait, VelocityTrait, VehicleTelemetryTrait);\nexport const pilotedVehicleQuery = createQuery(VehicleTrait, PilotedTag);\n\nexport const kolmoWorld: World = createWorld(WorldSessionTrait);\n\nexport function useActiveKolmoWorld(): World {\n try {\n return useWorld();\n } catch {\n return kolmoWorld;\n }\n}\n\nexport function ensureWorldSession(w: World): void {\n if (!w.has(WorldSessionTrait)) w.add(WorldSessionTrait);\n}\n\n/** Zero-allocation SoA typed-array writer using Koota's public `unpackEntity` + `getStore`. */\nexport function writeEntityKinematics(\n world: World,\n entity: Entity,\n pos: { readonly x: number; readonly y: number; readonly z: number },\n quat: { readonly x: number; readonly y: number; readonly z: number; readonly w: number },\n linVel: { readonly x: number; readonly y: number; readonly z: number },\n speedKmh: number,\n): void {\n const { entityId } = unpackEntity(entity);\n if (entity.has(TransformTrait)) {\n const xf = getStore(world, TransformTrait);\n xf.x[entityId] = pos.x;\n xf.y[entityId] = pos.y;\n xf.z[entityId] = pos.z;\n xf.qx[entityId] = quat.x;\n xf.qy[entityId] = quat.y;\n xf.qz[entityId] = quat.z;\n xf.qw[entityId] = quat.w;\n }\n if (entity.has(VelocityTrait)) {\n const vl = getStore(world, VelocityTrait);\n vl.vx[entityId] = linVel.x;\n vl.vy[entityId] = linVel.y;\n vl.vz[entityId] = linVel.z;\n vl.speedKmh[entityId] = speedKmh;\n }\n}\n\n/** Zero-allocation SoA typed-array writer for `VehicleTelemetryTrait` inside `useFrame`. */\nexport function writeVehicleTelemetry(\n world: World,\n entity: Entity,\n rpm: number,\n gear: number,\n throttle: number,\n boost: number,\n slip: number,\n): void {\n if (!entity.has(VehicleTelemetryTrait)) return;\n const { entityId } = unpackEntity(entity);\n const st = getStore(world, VehicleTelemetryTrait);\n st.rpm[entityId] = rpm;\n st.gear[entityId] = gear;\n st.throttle[entityId] = throttle;\n st.boost[entityId] = boost;\n st.slip[entityId] = slip;\n}\n\nconst _exitPos = new THREE.Vector3();\nconst _exitFwd = new THREE.Vector3();\nconst _flipUp = new THREE.Vector3();\nconst _flipFwd = new THREE.Vector3();\nconst _flipRight = new THREE.Vector3();\nconst _flipMat = new THREE.Matrix4();\nconst _flipQuat = new THREE.Quaternion();\n\nexport function flipVehicleBodyUpright(veh: EcctrlVehicleHandle): void {\n const body = veh.body;\n if (!body) return;\n const pos = body.translation();\n _flipUp.copy(veh.upAxis);\n if (_flipUp.lengthSq() < 1e-6) _flipUp.set(0, 1, 0);\n else _flipUp.normalize();\n\n _flipFwd.copy(veh.bodyZAxis).projectOnPlane(_flipUp);\n if (_flipFwd.lengthSq() < 1e-6) {\n if (Math.abs(_flipUp.y) < 0.9) _flipFwd.set(0, 1, 0).projectOnPlane(_flipUp);\n else _flipFwd.set(0, 0, 1).projectOnPlane(_flipUp);\n }\n _flipFwd.normalize();\n _flipRight.crossVectors(_flipUp, _flipFwd).normalize();\n _flipMat.makeBasis(_flipRight, _flipUp, _flipFwd);\n _flipQuat.setFromRotationMatrix(_flipMat);\n\n body.setTranslation({ x: pos.x + _flipUp.x * 1.35, y: pos.y + _flipUp.y * 1.35, z: pos.z + _flipUp.z * 1.35 }, true);\n body.setRotation({ x: _flipQuat.x, y: _flipQuat.y, z: _flipQuat.z, w: _flipQuat.w }, true);\n body.setLinvel({ x: 0, y: 0, z: 0 }, true);\n body.setAngvel({ x: 0, y: 0, z: 0 }, true);\n}\n\nexport const kolmoActions = createActions((world) => ({\n boardVehicle: (vehicleId: string) => {\n ensureWorldSession(world);\n let targetEnt: Entity | undefined;\n for (const vehEnt of world.query(VehicleTrait)) {\n const v = vehEnt.get(VehicleTrait);\n if (v && (!vehicleId || v.id === vehicleId)) {\n targetEnt = vehEnt;\n break;\n }\n }\n if (!targetEnt) return;\n\n for (const prev of world.query(pilotedVehicleQuery)) {\n if (prev !== targetEnt && prev.has(PilotedTag)) prev.remove(PilotedTag);\n }\n if (!targetEnt.has(PilotedTag)) targetEnt.add(PilotedTag);\n\n const pilot = world.queryFirst(ActorTrait);\n if (pilot) pilot.add(PilotLink(targetEnt));\n\n if (world.get(WorldSessionTrait)?.nearVehicleId) {\n world.set(WorldSessionTrait, { nearVehicleId: \"\" });\n }\n },\n exitVehicle: () => {\n ensureWorldSession(world);\n const pilot = world.queryFirst(ActorTrait);\n const linked = pilot?.targetFor(PilotLink) ?? world.queryFirst(pilotedVehicleQuery);\n if (linked) {\n const v = linked.get(VehicleTrait);\n if (pilot) {\n if (pilot.has(PilotLink(linked))) pilot.remove(PilotLink(linked));\n if (v?.handle) {\n _exitPos\n .set(v.exitOffset[0], v.exitOffset[1], v.exitOffset[2])\n .applyQuaternion(v.handle.currQuat)\n .add(v.handle.currPos);\n _exitFwd.copy(v.handle.bodyZAxis).projectOnPlane(v.handle.upAxis).normalize();\n const yaw = _exitFwd.lengthSq() > 1e-6 ? Math.atan2(_exitFwd.x, _exitFwd.z) : 0;\n const lv = v.handle.currLinVel;\n const curActor = pilot.get(ActorTrait);\n pilot.set(ActorTrait, {\n id: curActor?.id ?? \"pilot\",\n handle: null,\n exitSpawnPos: [_exitPos.x, _exitPos.y, _exitPos.z],\n exitSpawnYaw: yaw,\n exitLinVel: [lv.x, lv.y, lv.z],\n });\n }\n }\n if (linked.has(PilotedTag)) linked.remove(PilotedTag);\n v?.handle?.setMovement({ forward: false, backward: false, steerLeft: false, steerRight: false, brake: !v.isFlight });\n }\n for (const extra of world.query(pilotedVehicleQuery)) {\n if (extra.has(PilotedTag)) extra.remove(PilotedTag);\n }\n },\n resetVehicle: (vehicleId?: string) => {\n let target: VehicleTraitData | undefined;\n if (vehicleId) {\n for (const ent of world.query(VehicleTrait)) {\n const v = ent.get(VehicleTrait);\n if (v?.id === vehicleId && v.handle?.body) {\n target = v;\n break;\n }\n }\n }\n if (!target) {\n const piloted = world.queryFirst(ActorTrait)?.targetFor(PilotLink) ?? world.queryFirst(pilotedVehicleQuery);\n const pv = piloted?.get(VehicleTrait);\n if (pv?.handle?.body) target = pv;\n }\n if (!target) {\n for (const ent of world.query(VehicleTrait)) {\n const v = ent.get(VehicleTrait);\n if (v?.handle?.body) {\n target = v;\n break;\n }\n }\n }\n if (target?.handle) flipVehicleBodyUpright(target.handle);\n },\n}));\n","import * as THREE from \"three\";\n\n/** CODATA Newtonian gravitational constant in SI units (m^3 kg^-1 s^-2). */\nexport const G_SI = 6.6743e-11;\n\nexport interface KolmoGravityAttractor {\n readonly id?: string;\n readonly position: readonly [number, number, number];\n /** Direct standard gravitational parameter mu = G * M (m^3 / s^2). */\n readonly mu?: number;\n /** Mass in kilograms (used with `gravitationalConstant`, defaults to `G_SI`). */\n readonly massKg?: number;\n /** Surface gravity (m/s^2) paired with `radius` (m) -> mu = surfaceG * (radius^2 + softeningM^2)^(3/2) / radius. */\n readonly surfaceG?: number;\n readonly radius?: number;\n /** Plummer softening length epsilon (m) preventing r -> 0 singularities. */\n readonly softeningM?: number;\n}\n\nexport interface KolmoNBodyGravity {\n readonly kind: \"nbody\";\n readonly attractors: readonly KolmoGravityAttractor[];\n readonly gravitationalConstant?: number;\n}\n\nexport function resolveAttractorMu(\n attractor: KolmoGravityAttractor,\n gravitationalConstant = G_SI,\n): { mu: number; epsSq: number } {\n const rRef = Math.max(0, attractor.radius ?? 0);\n const eps = Math.max(1e-4, attractor.softeningM ?? (rRef > 0 ? rRef * 0.05 : 0.5));\n const epsSq = eps * eps;\n if (typeof attractor.mu === \"number\" && Number.isFinite(attractor.mu)) {\n return { mu: Math.max(0, attractor.mu), epsSq };\n }\n if (\n typeof attractor.surfaceG === \"number\" &&\n Number.isFinite(attractor.surfaceG) &&\n rRef > 0\n ) {\n // Exact match so |g(rRef)| === surfaceG even with Plummer softening eps:\n // g(R) = mu * R / (R^2 + eps^2)^(3/2) === surfaceG\n const denom = Math.pow(rRef * rRef + epsSq, 1.5);\n return { mu: Math.max(0, (attractor.surfaceG * denom) / rRef), epsSq };\n }\n if (typeof attractor.massKg === \"number\" && Number.isFinite(attractor.massKg)) {\n return { mu: Math.max(0, attractor.massKg * gravitationalConstant), epsSq };\n }\n return { mu: 0, epsSq };\n}\n\n/**\n * Evaluates softened Newtonian multi-attractor gravitational acceleration (m/s^2):\n * g(x) = sum_i mu_i * (p_i - x) / (|p_i - x|^2 + eps_i^2)^(3/2)\n * Zero artificial floor clamps and zero boundary fences.\n */\nexport function evaluateNBodyGravity(\n pos: { readonly x: number; readonly y: number; readonly z: number },\n attractors: readonly KolmoGravityAttractor[],\n out: THREE.Vector3,\n gravitationalConstant = G_SI,\n): THREE.Vector3 {\n let gx = 0;\n let gy = 0;\n let gz = 0;\n for (let i = 0; i < attractors.length; i++) {\n const a = attractors[i];\n const { mu, epsSq } = resolveAttractorMu(a, gravitationalConstant);\n if (mu <= 0) continue;\n const dx = a.position[0] - pos.x;\n const dy = a.position[1] - pos.y;\n const dz = a.position[2] - pos.z;\n const rSq = dx * dx + dy * dy + dz * dz;\n if (rSq < 1e-12) continue;\n const invR3 = 1 / Math.pow(rSq + epsSq, 1.5);\n const scale = mu * invR3;\n gx += dx * scale;\n gy += dy * scale;\n gz += dz * scale;\n }\n return out.set(gx, gy, gz);\n}\n\nexport function createNBodyGravityField(\n attractors: readonly KolmoGravityAttractor[],\n gravitationalConstant = G_SI,\n): (pos: THREE.Vector3, out: THREE.Vector3) => THREE.Vector3 {\n return (pos, out) => evaluateNBodyGravity(pos, attractors, out, gravitationalConstant);\n}\n\n/**\n * Exact tangential speed v_circ (m/s) for a circular orbit of radius `orbitRadiusM`\n * around a softened point/spherical attractor:\n * v^2 / r = mu * r / (r^2 + eps^2)^(3/2) => v = r * sqrt(mu / (r^2 + eps^2)^(3/2))\n */\nexport function computeCircularOrbitSpeed(\n attractor: KolmoGravityAttractor,\n orbitRadiusM: number,\n gravitationalConstant = G_SI,\n): number {\n if (orbitRadiusM <= 0) return 0;\n const { mu, epsSq } = resolveAttractorMu(attractor, gravitationalConstant);\n if (mu <= 0) return 0;\n return orbitRadiusM * Math.sqrt(mu / Math.pow(orbitRadiusM * orbitRadiusM + epsSq, 1.5));\n}\n","import React, { Suspense, createContext, useContext, useLayoutEffect, useMemo, type ReactNode, type RefObject } from \"react\";\nimport * as THREE from \"three\";\nimport { PhysicsWorld, type PhysicsWorldProps } from \"@khr3/core\";\nimport { useCustomGravity } from \"@pinkaphant/ecctrl/gravity\";\nimport { type World } from \"koota\";\nimport { WorldProvider, useWorld } from \"koota/react\";\nimport { kolmoWorld } from \"../engine/traits.js\";\nimport {\n G_SI,\n computeCircularOrbitSpeed,\n createNBodyGravityField,\n evaluateNBodyGravity,\n resolveAttractorMu,\n type KolmoGravityAttractor,\n type KolmoNBodyGravity,\n} from \"./nBodyGravity.js\";\n\nexport {\n G_SI,\n computeCircularOrbitSpeed,\n createNBodyGravityField,\n evaluateNBodyGravity,\n resolveAttractorMu,\n type KolmoGravityAttractor,\n type KolmoNBodyGravity,\n};\n\nexport type KolmoTimeControlValue = number | RefObject<number>;\n\nexport type KolmoPointGravity = {\n readonly kind: \"point\";\n readonly center: readonly [number, number, number];\n readonly surfaceG: number;\n readonly radius: number;\n readonly inverseSquare?: boolean;\n};\n\nexport type KolmoGravityCallback = (pos: THREE.Vector3, out: THREE.Vector3) => THREE.Vector3;\n\nexport type KolmoGravitySpec =\n | \"planar\"\n | \"zero\"\n | \"custom\"\n | readonly [number, number, number]\n | KolmoPointGravity\n | KolmoNBodyGravity\n | KolmoGravityCallback;\n\nexport const KolmoGravityContext = createContext<boolean>(false);\n\nexport function useOptionalKootaWorld(): World | null {\n try {\n return useWorld();\n }\n catch {\n return null;\n }\n}\n\nfunction isGravityTuple(g: KolmoGravitySpec): g is readonly [number, number, number] {\n return Array.isArray(g);\n}\n\nfunction isPointGravity(g: KolmoGravitySpec): g is KolmoPointGravity {\n return typeof g === \"object\" && !Array.isArray(g) && \"kind\" in g && g.kind === \"point\";\n}\n\nfunction isNBodyGravity(g: KolmoGravitySpec): g is KolmoNBodyGravity {\n return typeof g === \"object\" && !Array.isArray(g) && \"kind\" in g && g.kind === \"nbody\";\n}\n\nconst _gravTmp = new THREE.Vector3();\n\nexport interface KolmoPhysicsProps extends Omit<PhysicsWorldProps, \"gravity\" | \"debug\" | \"timeScale\" | \"maxDelta\" | \"children\"> {\n readonly gravity?: KolmoGravitySpec;\n readonly paused?: boolean;\n readonly timeScale?: KolmoTimeControlValue;\n readonly maxDelta?: KolmoTimeControlValue;\n readonly physicsDebug?: boolean;\n readonly world?: World | null;\n readonly children: ReactNode;\n}\n\nexport function KolmoPhysics({\n gravity = \"planar\",\n paused = false,\n timeScale = 1,\n maxDelta,\n physicsDebug = false,\n world = null,\n children,\n ...physicsProps\n}: KolmoPhysicsProps): React.JSX.Element {\n const outerWorld = useOptionalKootaWorld();\n const resolvedWorld = world ?? outerWorld ?? kolmoWorld;\n const isCallback = typeof gravity === \"function\";\n const isTuple = isGravityTuple(gravity);\n const isCustomLiteral = gravity === \"custom\";\n const isPoint = isPointGravity(gravity);\n const isNBody = isNBodyGravity(gravity);\n const isCustomGravity = isCallback || isPoint || isNBody || isCustomLiteral;\n\n const gx = isTuple ? gravity[0] : 0;\n const gy = isTuple ? gravity[1] : -9.81;\n const gz = isTuple ? gravity[2] : 0;\n const cx = isPoint ? gravity.center[0] : 0;\n const cy = isPoint ? gravity.center[1] : 0;\n const cz = isPoint ? gravity.center[2] : 0;\n const pointRadius = isPoint ? gravity.radius : 1;\n const pointInverseSq = isPoint ? Boolean(gravity.inverseSquare) : false;\n const surfaceG = isPoint ? gravity.surfaceG : gravity === \"zero\" ? 0 : 9.81;\n const gravityFn = isCallback ? gravity : null;\n const nBodySpec = isNBody ? gravity : null;\n\n const rapierGravity = useMemo<[number, number, number]>(\n () => (isTuple ? [gx, gy, gz] : isCustomGravity || gravity === \"zero\" ? [0, 0, 0] : [0, -9.81, 0]),\n [isTuple, gx, gy, gz, isCustomGravity, gravity === \"zero\"],\n );\n\n useLayoutEffect(() => {\n if (isCustomLiteral || (!isCallback && !isPoint && !isNBody))\n return;\n const setField = useCustomGravity.getState().setGravityField;\n if (gravityFn) {\n setField((pos) => gravityFn(pos, _gravTmp));\n }\n else if (nBodySpec) {\n setField((pos) => evaluateNBodyGravity(pos, nBodySpec.attractors, _gravTmp, nBodySpec.gravitationalConstant));\n }\n else if (isPoint) {\n if (pointInverseSq) {\n const single: readonly KolmoGravityAttractor[] = [{ position: [cx, cy, cz], surfaceG, radius: pointRadius }];\n setField((pos) => evaluateNBodyGravity(pos, single, _gravTmp));\n }\n else {\n setField((pos) => {\n _gravTmp.set(pos.x - cx, pos.y - cy, pos.z - cz);\n const lenSq = _gravTmp.lengthSq();\n return lenSq < 1e-8 ? _gravTmp.set(0, -surfaceG, 0) : _gravTmp.multiplyScalar(-surfaceG / Math.sqrt(lenSq));\n });\n }\n }\n return () => {\n setField(() => _gravTmp.set(0, -9.81, 0));\n };\n }, [isCustomLiteral, isCallback, isPoint, isNBody, gravityFn, nBodySpec, cx, cy, cz, pointRadius, pointInverseSq, surfaceG]);\n\n const content = (\n <KolmoGravityContext.Provider value={isCustomGravity}>\n <PhysicsWorld\n {...physicsProps}\n paused={paused}\n timeScale={timeScale}\n {...(maxDelta === undefined ? {} : { maxDelta })}\n gravity={rapierGravity}\n debug={physicsDebug}\n >\n <Suspense fallback={null}>{children}</Suspense>\n </PhysicsWorld>\n </KolmoGravityContext.Provider>\n );\n\n return resolvedWorld !== outerWorld ? <WorldProvider world={resolvedWorld}>{content}</WorldProvider> : content;\n}\n\nexport function useIsKolmoCustomGravity(): boolean {\n return useContext(KolmoGravityContext);\n}\n"],"mappings":";;;;;;;;AAkCA,IAAa,eAAe,aAA+B;CACvD,IAAI;CACJ,QAAQ;CACR,YAAY;EAAC;EAAG;EAAM;CAAC;CACvB,YAAY;EAAC;EAAM;EAAM;CAAC;CAC1B,UAAU;AACd,EAAE;AAEF,IAAa,aAAa,aAA6B;CACnD,IAAI;CACJ,QAAQ;CACR,cAAc;CACd,cAAc;CACd,YAAY;AAChB,EAAE;AAEF,IAAa,iBAAiB,MAAM;CAAE,GAAG;CAAG,GAAG;CAAG,GAAG;CAAG,IAAI;CAAG,IAAI;CAAG,IAAI;CAAG,IAAI;AAAE,CAAC;AACpF,IAAa,gBAAgB,MAAM;CAAE,IAAI;CAAG,IAAI;CAAG,IAAI;CAAG,UAAU;AAAE,CAAC;AACvE,IAAa,wBAAwB,MAAM;CAAE,KAAK;CAAG,MAAM;CAAG,UAAU;CAAG,OAAO;CAAG,MAAM;AAAE,CAAC;AAC9F,IAAa,oBAAoB,MAAM;CAAE,IAAI;CAAI,QAAQ;CAAG,MAAM;AAAgC,CAAC;AACnG,IAAa,aAAa,MAAM;AAChC,IAAa,YAAY,SAAS,EAAE,WAAW,KAAK,CAAC;AACrD,IAAa,oBAAoB,MAAM,EAAE,eAAe,GAAG,CAAC;AAE5D,IAAa,kBAAkB,Y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QAAQ,SAAS,SAAS;IAChC,OAAO,QAAQ,OAAO,SAAS,IAAI,GAAG,CAAC,UAAU,CAAC,IAAI,SAAS,eAAe,CAAC,WAAW,KAAK,KAAK,KAAK,CAAC;GAC9G,CAAC;EAET;EACA,aAAa;GACT,eAAe,SAAS,IAAI,GAAG,OAAO,CAAC,CAAC;EAC5C;CACJ,GAAG;EAAC;EAAiB;EAAY;EAAS;EAAS;EAAW;EAAW;EAAI;EAAI;EAAI;EAAa;EAAgB;CAAQ,CAAC;CAE3H,MAAM,UACFA,oBAAC,oBAAoB,UAArB;EAA8B,OAAO;EACjC,UAAAA,oBAAC,cAAD;GACI,GAAI;GACI;GACG;GACX,GAAK,aAAa,KAAA,IAAY,CAAC,IAAI,EAAE,SAAS;GAC9C,SAAS;GACT,OAAO;GAEP,UAAAA,oBAAC,UAAD;IAAU,UAAU;IAAO;GAAmB,CAAA;EACpC,CAAA;CACY,CAAA;CAGlC,OAAO,kBAAkB,aAAaA,oBAAC,eAAD;EAAe,OAAO;EAAgB,UAAA;CAAuB,CAAA,IAAI;AAC3G;AAEA,SAAgB,0BAAmC;CAC/C,OAAO,WAAW,mBAAmB;AACzC"}
|
package/package.json
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pinkaphant/kolmo",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.5.0",
|
|
4
|
+
"description": "Thin React Three Fiber + Rapier WASM + @pinkaphant/ecctrl + @khr3/core + Koota ECA game layer",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"sideEffects": false,
|
|
8
|
-
"bin": {
|
|
9
|
-
"kolmo": "./bin/kolmo.mjs"
|
|
10
|
-
},
|
|
11
8
|
"main": "./dist/index.js",
|
|
12
9
|
"types": "./dist/index.d.ts",
|
|
13
10
|
"exports": {
|
|
@@ -19,6 +16,10 @@
|
|
|
19
16
|
"types": "./dist/index.d.ts",
|
|
20
17
|
"import": "./dist/index.js"
|
|
21
18
|
},
|
|
19
|
+
"./engine": {
|
|
20
|
+
"types": "./dist/engine/index.d.ts",
|
|
21
|
+
"import": "./dist/engine/index.js"
|
|
22
|
+
},
|
|
22
23
|
"./physics": {
|
|
23
24
|
"types": "./dist/physics/index.d.ts",
|
|
24
25
|
"import": "./dist/physics/index.js"
|
|
@@ -27,92 +28,51 @@
|
|
|
27
28
|
"types": "./dist/vite/index.d.ts",
|
|
28
29
|
"import": "./dist/vite/index.js"
|
|
29
30
|
},
|
|
30
|
-
"./shaders": {
|
|
31
|
-
"types": "./dist/shaders/index.d.ts",
|
|
32
|
-
"import": "./dist/shaders/index.js"
|
|
33
|
-
},
|
|
34
|
-
"./shaders/tsl": {
|
|
35
|
-
"types": "./dist/shaders/tsl.d.ts",
|
|
36
|
-
"import": "./dist/shaders/tsl.js"
|
|
37
|
-
},
|
|
38
|
-
"./world": {
|
|
39
|
-
"types": "./dist/world/index.d.ts",
|
|
40
|
-
"import": "./dist/world/index.js"
|
|
41
|
-
},
|
|
42
|
-
"./engine": {
|
|
43
|
-
"types": "./dist/engine/index.d.ts",
|
|
44
|
-
"import": "./dist/engine/index.js"
|
|
45
|
-
},
|
|
46
|
-
"./importer": {
|
|
47
|
-
"types": "./dist/importer/index.d.ts",
|
|
48
|
-
"import": "./dist/importer/index.js"
|
|
49
|
-
},
|
|
50
|
-
"./junk": {
|
|
51
|
-
"types": "./dist/junk/index.d.ts",
|
|
52
|
-
"import": "./dist/junk/index.js"
|
|
53
|
-
},
|
|
54
|
-
"./suika": {
|
|
55
|
-
"types": "./dist/suika/index.d.ts",
|
|
56
|
-
"import": "./dist/suika/index.js"
|
|
57
|
-
},
|
|
58
|
-
"./sand3d": {
|
|
59
|
-
"types": "./dist/sand3d/index.d.ts",
|
|
60
|
-
"import": "./dist/sand3d/index.js"
|
|
61
|
-
},
|
|
62
|
-
"./schema": {
|
|
63
|
-
"types": "./dist/schema/kolmoSchema.d.ts",
|
|
64
|
-
"import": "./dist/schema/kolmoSchema.js"
|
|
65
|
-
},
|
|
66
31
|
"./package.json": "./package.json"
|
|
67
32
|
},
|
|
68
33
|
"files": [
|
|
69
34
|
"dist",
|
|
70
|
-
"docs",
|
|
71
|
-
"skills",
|
|
72
|
-
"AGENTS.md",
|
|
73
|
-
"bin",
|
|
74
35
|
"LICENSE",
|
|
75
|
-
"README.md"
|
|
76
|
-
"CLAUDE.md"
|
|
36
|
+
"README.md"
|
|
77
37
|
],
|
|
78
38
|
"publishConfig": {
|
|
79
39
|
"access": "public"
|
|
80
40
|
},
|
|
81
41
|
"scripts": {
|
|
82
42
|
"dev": "vite",
|
|
83
|
-
"
|
|
84
|
-
"typecheck": "tsc --noEmit && tsc -p tests/e2e/tsconfig.json --noEmit",
|
|
43
|
+
"typecheck": "tsc --noEmit",
|
|
85
44
|
"test": "node --import tsx --test \"src/**/*.test.ts*\"",
|
|
86
|
-
"build": "
|
|
87
|
-
"
|
|
88
|
-
"prepack": "npm run build:lib >&2",
|
|
45
|
+
"build": "vite build && tsc -p tsconfig.build.json",
|
|
46
|
+
"prepack": "npm run build >&2",
|
|
89
47
|
"pack:dry": "npm pack --dry-run"
|
|
90
48
|
},
|
|
91
|
-
"dependencies": {
|
|
92
|
-
"@khr3/assets": "^0.2.9",
|
|
93
|
-
"@khr3/c12": "^0.3.9",
|
|
94
|
-
"@khr3/core": "^0.2.9",
|
|
95
|
-
"@khr3/launchers": "^0.2.9",
|
|
96
|
-
"@khr3/vehicles": "^0.2.5"
|
|
97
|
-
},
|
|
98
|
-
"overrides": {
|
|
99
|
-
"@dimforge/rapier3d-compat": "0.19.2",
|
|
100
|
-
"@pinkaphant/ecctrl": "2.0.4-beta.5"
|
|
101
|
-
},
|
|
102
49
|
"peerDependencies": {
|
|
103
50
|
"@dimforge/rapier3d-compat": "0.19.2",
|
|
51
|
+
"@khr3/c12": ">=0.3.8",
|
|
52
|
+
"@khr3/core": ">=0.2.7",
|
|
104
53
|
"@pinkaphant/ecctrl": "2.0.4-beta.5",
|
|
105
|
-
"@react-three/drei": "^10.
|
|
54
|
+
"@react-three/drei": "^10.0.0",
|
|
106
55
|
"@react-three/fiber": "^9.0.0",
|
|
107
56
|
"@react-three/rapier": "^2.2.0",
|
|
108
|
-
"koota": "^0.6.
|
|
57
|
+
"koota": "^0.6.6",
|
|
58
|
+
"maath": "^0.10.8",
|
|
109
59
|
"react": "^19.0.0",
|
|
110
60
|
"react-dom": "^19.0.0",
|
|
111
|
-
"three": "
|
|
61
|
+
"three": "0.184.0",
|
|
112
62
|
"zustand": "^5.0.0"
|
|
113
63
|
},
|
|
64
|
+
"peerDependenciesMeta": {
|
|
65
|
+
"@khr3/c12": {
|
|
66
|
+
"optional": true
|
|
67
|
+
},
|
|
68
|
+
"react-dom": {
|
|
69
|
+
"optional": true
|
|
70
|
+
}
|
|
71
|
+
},
|
|
114
72
|
"devDependencies": {
|
|
115
73
|
"@dimforge/rapier3d-compat": "0.19.2",
|
|
74
|
+
"@khr3/c12": "^0.3.9",
|
|
75
|
+
"@khr3/core": "^0.2.9",
|
|
116
76
|
"@pinkaphant/ecctrl": "2.0.4-beta.5",
|
|
117
77
|
"@react-three/drei": "^10.7.7",
|
|
118
78
|
"@react-three/fiber": "^9.6.1",
|
|
@@ -120,33 +80,19 @@
|
|
|
120
80
|
"@types/node": "^22.20.5",
|
|
121
81
|
"@types/react": "^19.2.16",
|
|
122
82
|
"@types/react-dom": "^19.2.3",
|
|
123
|
-
"@types/three": "
|
|
124
|
-
"
|
|
125
|
-
"
|
|
83
|
+
"@types/three": "0.184.0",
|
|
84
|
+
"koota": "^0.6.6",
|
|
85
|
+
"maath": "^0.10.8",
|
|
126
86
|
"react": "^19.2.7",
|
|
127
87
|
"react-dom": "^19.2.7",
|
|
128
|
-
"three": "
|
|
88
|
+
"three": "0.184.0",
|
|
129
89
|
"tsx": "^4.23.15",
|
|
130
90
|
"typescript": "^6.0.3",
|
|
131
91
|
"vite": "^8.3.8",
|
|
132
|
-
"
|
|
133
|
-
"zustand": "^5.0.14"
|
|
92
|
+
"zustand": "^5.1.0"
|
|
134
93
|
},
|
|
135
|
-
"keywords": [
|
|
136
|
-
"threejs",
|
|
137
|
-
"react-three-fiber",
|
|
138
|
-
"rapier",
|
|
139
|
-
"ecctrl",
|
|
140
|
-
"khr3",
|
|
141
|
-
"retro",
|
|
142
|
-
"game-engine"
|
|
143
|
-
],
|
|
144
94
|
"repository": {
|
|
145
95
|
"type": "git",
|
|
146
96
|
"url": "git+https://github.com/pinkAphant/Kolmo.git"
|
|
147
|
-
},
|
|
148
|
-
"homepage": "https://github.com/pinkAphant/kolmo#readme",
|
|
149
|
-
"bugs": {
|
|
150
|
-
"url": "https://github.com/pinkAphant/kolmo/issues"
|
|
151
97
|
}
|
|
152
98
|
}
|