@directivegames/genesys.js 3.1.24
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 +123 -0
- package/assets/animation-profiles/mixamo.skeleton-profile.json +63 -0
- package/assets/animation-profiles/rigify.skeleton-profile.json +61 -0
- package/assets/character/SKM_SB_MediumHuman.glb +0 -0
- package/assets/character/config/AnimationStateMachineComponent.md +107 -0
- package/assets/character/config/mannequin-anim.json +53 -0
- package/assets/character/mannequin.glb +0 -0
- package/assets/character/mannequinG.glb +0 -0
- package/assets/default.genesys-scene +194 -0
- package/assets/models/PickupActors/SM_Pickup_Health.glb +0 -0
- package/assets/models/PickupActors/SM_Pickup_Station.glb +0 -0
- package/assets/models/SM_Capsule.glb +0 -0
- package/assets/models/SM_ChamferCube.glb +0 -0
- package/assets/models/SM_Cone.glb +0 -0
- package/assets/models/SM_Cube.glb +0 -0
- package/assets/models/SM_Cylinder.glb +0 -0
- package/assets/models/SM_Plane.glb +0 -0
- package/assets/models/SM_Pyramid.glb +0 -0
- package/assets/models/SM_Sphere.glb +0 -0
- package/assets/models/SM_Torus.glb +0 -0
- package/assets/models/SM_Wedge.glb +0 -0
- package/assets/models/Weapons/SM_ShotGun_01.glb +0 -0
- package/assets/models/demo/Characters/Knightdude.glb +0 -0
- package/assets/models/demo/Characters/Spacedude.glb +0 -0
- package/assets/models/demo/LowPoly/SM_Bush01.glb +0 -0
- package/assets/models/demo/LowPoly/SM_Bush02.glb +0 -0
- package/assets/models/demo/LowPoly/SM_Flower01.glb +0 -0
- package/assets/models/demo/LowPoly/SM_Flower02.glb +0 -0
- package/assets/models/demo/LowPoly/SM_Flower03.glb +0 -0
- package/assets/models/demo/LowPoly/SM_GeneratedLandscape.glb +0 -0
- package/assets/models/demo/LowPoly/SM_Grass01.glb +0 -0
- package/assets/models/demo/LowPoly/SM_Grass02.glb +0 -0
- package/assets/models/demo/LowPoly/SM_Grass03.glb +0 -0
- package/assets/models/demo/LowPoly/SM_Mushroom01.glb +0 -0
- package/assets/models/demo/LowPoly/SM_Mushroom02.glb +0 -0
- package/assets/models/demo/LowPoly/SM_MushroomCluster01.glb +0 -0
- package/assets/models/demo/LowPoly/SM_MushroomCluster02.glb +0 -0
- package/assets/models/demo/LowPoly/SM_Rock01.glb +0 -0
- package/assets/models/demo/LowPoly/SM_Rock02.glb +0 -0
- package/assets/models/demo/LowPoly/SM_Rock03.glb +0 -0
- package/assets/models/demo/LowPoly/SM_Rock04.glb +0 -0
- package/assets/models/demo/LowPoly/SM_Tree01.glb +0 -0
- package/assets/models/demo/LowPoly/SM_Tree02.glb +0 -0
- package/assets/models/demo/LowPoly/SM_Tree03.glb +0 -0
- package/assets/models/demo/LowPoly/SM_Tree04.glb +0 -0
- package/assets/models/demo/LowPoly/SM_TreeStump.glb +0 -0
- package/assets/models/demo/LowPoly/SM_TreeTrunk.glb +0 -0
- package/assets/models/demo/LowPoly/low_poly_ship_wreck.glb +0 -0
- package/assets/models/demo/SandboxAsset/Blocks/SM_SB_Block.glb +0 -0
- package/assets/models/demo/SandboxAsset/Blocks/SM_SB_Block_Dirt.glb +0 -0
- package/assets/models/demo/SandboxAsset/Blocks/SM_SB_Block_Grass02.glb +0 -0
- package/assets/models/demo/SandboxAsset/Blocks/SM_SB_Block_Grass02Patch.glb +0 -0
- package/assets/models/demo/SandboxAsset/Blocks/SM_SB_Block_Gravel.glb +0 -0
- package/assets/models/demo/SandboxAsset/Blocks/SM_SB_Block_Lava.glb +0 -0
- package/assets/models/demo/SandboxAsset/Blocks/SM_SB_Block_LavaStone.glb +0 -0
- package/assets/models/demo/SandboxAsset/Blocks/SM_SB_Block_Sand.glb +0 -0
- package/assets/models/demo/SandboxAsset/Blocks/SM_SB_Block_Stone.glb +0 -0
- package/assets/models/demo/SandboxAsset/Blocks/SM_SB_Block_StoneA.glb +0 -0
- package/assets/models/demo/SandboxAsset/Blocks/SM_SB_Block_StoneC.glb +0 -0
- package/assets/models/demo/SandboxAsset/Blocks/SM_SB_Block_Wall.glb +0 -0
- package/assets/models/demo/SandboxAsset/Blocks/SM_SB_Block_Water.glb +0 -0
- package/assets/models/demo/SandboxAsset/Characters/SKM_Arachnids_Large_Spider.glb +0 -0
- package/assets/models/demo/SandboxAsset/Characters/SKM_SB_Adventurer_F01.glb +0 -0
- package/assets/models/demo/SandboxAsset/Characters/SKM_SB_Adventurer_M01.glb +0 -0
- package/assets/models/demo/SandboxAsset/Characters/SKM_SB_Aviator_F01.glb +0 -0
- package/assets/models/demo/SandboxAsset/Characters/SKM_SB_Aviator_M01.glb +0 -0
- package/assets/models/demo/SandboxAsset/Characters/SKM_SB_Aztec_F01.glb +0 -0
- package/assets/models/demo/SandboxAsset/Characters/SKM_SB_Aztec_M01.glb +0 -0
- package/assets/models/demo/SandboxAsset/Characters/SKM_SB_MediumHuman.glb +0 -0
- package/assets/models/demo/SandboxAsset/Characters/SKM_SB_Shaman.glb +0 -0
- package/assets/models/demo/SandboxAsset/Clouds/SM_SB_Cloud_01.glb +0 -0
- package/assets/models/demo/SandboxAsset/Clouds/SM_SB_Cloud_02.glb +0 -0
- package/assets/models/demo/SandboxAsset/Clouds/SM_SB_Cloud_03.glb +0 -0
- package/assets/models/demo/SandboxAsset/Clouds/SM_SB_Cloud_04.glb +0 -0
- package/assets/models/demo/SandboxAsset/Clouds/SM_SB_Env_Cloud_01.glb +0 -0
- package/assets/models/demo/SandboxAsset/Clouds/SM_SB_Env_Cloud_02.glb +0 -0
- package/assets/models/demo/SandboxAsset/Clouds/SM_SB_Env_Cloud_03.glb +0 -0
- package/assets/models/demo/SandboxAsset/Clouds/SM_SB_Env_Cloud_04.glb +0 -0
- package/assets/models/demo/SandboxAsset/Clouds/SM_SB_Env_Cloud_05.glb +0 -0
- package/assets/models/demo/SandboxAsset/Clouds/SM_SB_Env_Cloud_06.glb +0 -0
- package/assets/models/demo/SandboxAsset/Clouds/SM_SB_Env_Cloud_07.glb +0 -0
- package/assets/models/demo/SandboxAsset/Clouds/SM_SB_SmallCloud01.glb +0 -0
- package/assets/models/demo/SandboxAsset/Clouds/SM_SB_SmallCloud_02.glb +0 -0
- package/assets/models/demo/SandboxAsset/Decorations/SM_SB_AztecStatue.glb +0 -0
- package/assets/models/demo/SandboxAsset/Decorations/SM_SB_Claypot_01.glb +0 -0
- package/assets/models/demo/SandboxAsset/Decorations/SM_SB_Claypot_02.glb +0 -0
- package/assets/models/demo/SandboxAsset/Decorations/SM_SB_Claypot_03.glb +0 -0
- package/assets/models/demo/SandboxAsset/Decorations/SM_SB_Claypot_Broken_01.glb +0 -0
- package/assets/models/demo/SandboxAsset/Decorations/SM_SB_Claypot_Broken_02.glb +0 -0
- package/assets/models/demo/SandboxAsset/Decorations/SM_SB_Crystal_Calendar_01.glb +0 -0
- package/assets/models/demo/SandboxAsset/Decorations/SM_SB_Crystal_Calendar_02.glb +0 -0
- package/assets/models/demo/SandboxAsset/Decorations/SM_SB_Crystal_Skull.glb +0 -0
- package/assets/models/demo/SandboxAsset/Decorations/SM_SB_Goldpile_01.glb +0 -0
- package/assets/models/demo/SandboxAsset/Decorations/SM_SB_Goldpile_02.glb +0 -0
- package/assets/models/demo/SandboxAsset/Decorations/SM_SB_Rubble_Skeleton_01.glb +0 -0
- package/assets/models/demo/SandboxAsset/Decorations/SM_SB_TreasureChest.glb +0 -0
- package/assets/models/demo/SandboxAsset/Decorations/SM_SB_TreasureChestSmall.glb +0 -0
- package/assets/models/demo/SandboxAsset/Decorations/SM_SB_Wall_Deco_01.glb +0 -0
- package/assets/models/demo/SandboxAsset/Dungeon/SM_SB_AngledWall.glb +0 -0
- package/assets/models/demo/SandboxAsset/Dungeon/SM_SB_Arch.glb +0 -0
- package/assets/models/demo/SandboxAsset/Dungeon/SM_SB_Beams.glb +0 -0
- package/assets/models/demo/SandboxAsset/Dungeon/SM_SB_Beams02.glb +0 -0
- package/assets/models/demo/SandboxAsset/Dungeon/SM_SB_Corner.glb +0 -0
- package/assets/models/demo/SandboxAsset/Dungeon/SM_SB_CornerB.glb +0 -0
- package/assets/models/demo/SandboxAsset/Dungeon/SM_SB_Floor.glb +0 -0
- package/assets/models/demo/SandboxAsset/Dungeon/SM_SB_Floor2.glb +0 -0
- package/assets/models/demo/SandboxAsset/Dungeon/SM_SB_Floor3.glb +0 -0
- package/assets/models/demo/SandboxAsset/Dungeon/SM_SB_GrowingTree.glb +0 -0
- package/assets/models/demo/SandboxAsset/Dungeon/SM_SB_HalfFloor.glb +0 -0
- package/assets/models/demo/SandboxAsset/Dungeon/SM_SB_IronBucket.glb +0 -0
- package/assets/models/demo/SandboxAsset/Dungeon/SM_SB_Pillar.glb +0 -0
- package/assets/models/demo/SandboxAsset/Dungeon/SM_SB_Railing.glb +0 -0
- package/assets/models/demo/SandboxAsset/Dungeon/SM_SB_RoofWindow.glb +0 -0
- package/assets/models/demo/SandboxAsset/Dungeon/SM_SB_Stairs01.glb +0 -0
- package/assets/models/demo/SandboxAsset/Dungeon/SM_SB_Statue.glb +0 -0
- package/assets/models/demo/SandboxAsset/Dungeon/SM_SB_Wall.glb +0 -0
- package/assets/models/demo/SandboxAsset/Dungeon/SM_SB_Wall02.glb +0 -0
- package/assets/models/demo/SandboxAsset/Dungeon/SM_SB_Wall03.glb +0 -0
- package/assets/models/demo/SandboxAsset/Dungeon/SM_SB_Wall03B.glb +0 -0
- package/assets/models/demo/SandboxAsset/Dungeon/SM_SB_Wall04.glb +0 -0
- package/assets/models/demo/SandboxAsset/Dungeon/SM_SB_WallB.glb +0 -0
- package/assets/models/demo/SandboxAsset/Dungeon/SM_SB_WallTrim.glb +0 -0
- package/assets/models/demo/SandboxAsset/Floors/SM_SB_Floor_01.glb +0 -0
- package/assets/models/demo/SandboxAsset/Floors/SM_SB_Floor_02.glb +0 -0
- package/assets/models/demo/SandboxAsset/Flowers/SM_SB_Flower01_ColorA.glb +0 -0
- package/assets/models/demo/SandboxAsset/Flowers/SM_SB_Flower01_ColorB.glb +0 -0
- package/assets/models/demo/SandboxAsset/Flowers/SM_SB_Flower02_ColorA.glb +0 -0
- package/assets/models/demo/SandboxAsset/Flowers/SM_SB_Flower02_ColorB.glb +0 -0
- package/assets/models/demo/SandboxAsset/Flowers/SM_SB_Flower03_ColorA.glb +0 -0
- package/assets/models/demo/SandboxAsset/Flowers/SM_SB_Flower03_ColorB.glb +0 -0
- package/assets/models/demo/SandboxAsset/Foliage/SM_SB_Beach_Grass.glb +0 -0
- package/assets/models/demo/SandboxAsset/Foliage/SM_SB_Birgaradier_Tree.glb +0 -0
- package/assets/models/demo/SandboxAsset/Foliage/SM_SB_Cactus_Long.glb +0 -0
- package/assets/models/demo/SandboxAsset/Foliage/SM_SB_ElephantEar01.glb +0 -0
- package/assets/models/demo/SandboxAsset/Foliage/SM_SB_Fern01.glb +0 -0
- package/assets/models/demo/SandboxAsset/Foliage/SM_SB_GrassPatch.glb +0 -0
- package/assets/models/demo/SandboxAsset/Foliage/SM_SB_Growing_Plant.glb +0 -0
- package/assets/models/demo/SandboxAsset/Foliage/SM_SB_Leaf_bush01.glb +0 -0
- package/assets/models/demo/SandboxAsset/Foliage/SM_SB_Middle_Moss.glb +0 -0
- package/assets/models/demo/SandboxAsset/Foliage/SM_SB_Oracle_Tree.glb +0 -0
- package/assets/models/demo/SandboxAsset/Foliage/SM_SB_Plant01.glb +0 -0
- package/assets/models/demo/SandboxAsset/Foliage/SM_SB_Tree01.glb +0 -0
- package/assets/models/demo/SandboxAsset/Foliage/SM_SB_plant.glb +0 -0
- package/assets/models/demo/SandboxAsset/GameItems/SM_SB_Arrow_large_01.glb +0 -0
- package/assets/models/demo/SandboxAsset/GameItems/SM_SB_Arrow_large_02.glb +0 -0
- package/assets/models/demo/SandboxAsset/GameItems/SM_SB_HangingBridgeEnd_01.glb +0 -0
- package/assets/models/demo/SandboxAsset/GameItems/SM_SB_HangingBridgeEnd_02.glb +0 -0
- package/assets/models/demo/SandboxAsset/GameItems/SM_SB_HangingBridgeMiddle.glb +0 -0
- package/assets/models/demo/SandboxAsset/GameItems/SM_SB_MovingPlatform_01.glb +0 -0
- package/assets/models/demo/SandboxAsset/GameItems/SM_SB_MovingWall.glb +0 -0
- package/assets/models/demo/SandboxAsset/GameItems/SM_SB_ObsidianTrap.glb +0 -0
- package/assets/models/demo/SandboxAsset/GameItems/SM_SB_Scull_Arrowshooter01.glb +0 -0
- package/assets/models/demo/SandboxAsset/GameItems/SM_SB_Scull_Arrowshooter02.glb +0 -0
- package/assets/models/demo/SandboxAsset/GameItems/SM_SB_Snakepit.glb +0 -0
- package/assets/models/demo/SandboxAsset/Rocks/SM_SB_Rock01.glb +0 -0
- package/assets/models/demo/SandboxAsset/Rocks/SM_SB_Rock02.glb +0 -0
- package/assets/models/demo/SandboxAsset/Slides/SM_SB_Slide_Corner_L.glb +0 -0
- package/assets/models/demo/SandboxAsset/Slides/SM_SB_Slide_Corner_R.glb +0 -0
- package/assets/models/demo/SandboxAsset/Slides/SM_SB_Slide_Edge.glb +0 -0
- package/assets/models/demo/SandboxAsset/Slides/SM_SB_Slide_End01.glb +0 -0
- package/assets/models/demo/SandboxAsset/Slides/SM_SB_Slide_Module.glb +0 -0
- package/assets/models/demo/SandboxAsset/Trees/SM_SB_CaribbeanPine_01.glb +0 -0
- package/assets/models/demo/SandboxAsset/Trees/SM_SB_CaribbeanPine_02.glb +0 -0
- package/assets/models/demo/SandboxAsset/Trees/SM_SB_CoconutTree01.glb +0 -0
- package/assets/models/demo/SandboxAsset/Trees/SM_SB_CoconutTree02.glb +0 -0
- package/assets/models/demo/SandboxAsset/Trees/SM_SB_KapokTree_01.glb +0 -0
- package/assets/models/demo/SandboxAsset/Trees/SM_SB_KapokTree_02.glb +0 -0
- package/assets/models/demo/SandboxAsset/Trees/SM_SB_QueenPalm_01.glb +0 -0
- package/assets/models/demo/SandboxAsset/Trees/SM_SB_QueenPalm_02.glb +0 -0
- package/assets/models/demo/SandboxAsset/Trees/SM_SB_TreeTrunk.glb +0 -0
- package/assets/models/demo/SandboxAsset/Trims/SM_SB_TrimA.glb +0 -0
- package/assets/models/demo/SandboxAsset/Trims/SM_SB_TrimB.glb +0 -0
- package/assets/models/demo/SandboxAsset/Trims/SM_SB_TrimC.glb +0 -0
- package/assets/models/demo/SandboxAsset/Trims/SM_SB_TrimD.glb +0 -0
- package/assets/models/demo/SandboxAsset/Trims/SM_SB_TrimE.glb +0 -0
- package/assets/models/demo/SandboxAsset/Trims/SM_SB_TrimF.glb +0 -0
- package/assets/models/demo/SandboxAsset/Trims/SM_SB_TrimG.glb +0 -0
- package/assets/models/demo/SandboxAsset/Trims/SM_SB_TrimH.glb +0 -0
- package/assets/models/demo/SandboxAsset/Trims/SM_SB_TrimI.glb +0 -0
- package/assets/models/demo/SandboxAsset/Trims/SM_SB_TrimJ.glb +0 -0
- package/assets/models/demo/SandboxAsset/Walls/SM_SB_Aztec_Wall_01.glb +0 -0
- package/assets/models/demo/SandboxAsset/Walls/SM_SB_Aztec_Wall_02.glb +0 -0
- package/assets/models/demo/SandboxAsset/Walls/SM_SB_Brick01.glb +0 -0
- package/assets/models/demo/SandboxAsset/Walls/SM_SB_BrickBlock01.glb +0 -0
- package/assets/models/demo/SandboxAsset/Walls/SM_SB_BrickBlock02.glb +0 -0
- package/assets/models/demo/SandboxAsset/Walls/SM_SB_Vineswall01.glb +0 -0
- package/assets/models/demo/SandboxAsset/Walls/SM_SB_WallDecoA.glb +0 -0
- package/assets/models/demo/SandboxAsset/Walls/SM_SB_Wall_L_01B_128x96.glb +0 -0
- package/assets/models/demo/SandboxAsset/Walls/SM_SB_Wall_L_01_128x96.glb +0 -0
- package/assets/models/demo/SandboxAsset/Walls/SM_SB_Wall_L_02B_128x96.glb +0 -0
- package/assets/models/demo/SandboxAsset/Walls/SM_SB_Wall_L_02C_128x96.glb +0 -0
- package/assets/models/demo/SandboxAsset/Walls/SM_SB_Wall_L_02D_128x96.glb +0 -0
- package/assets/models/demo/SandboxAsset/Walls/SM_SB_Wall_L_02_128x96.glb +0 -0
- package/assets/models/demo/SandboxAsset/Walls/SM_SB_Wall_L_03B_128x96.glb +0 -0
- package/assets/models/demo/SandboxAsset/Walls/SM_SB_Wall_L_03_128x96.glb +0 -0
- package/assets/prefabs/actors/demo_health_pickup.prefab.json +114 -0
- package/assets/prefabs/actors/demo_health_pickup_spawner.prefab.json +102 -0
- package/assets/prefabs/actors/test.prefab.json +87 -0
- package/assets/shaders/M_Anisotropy_Brushed.material.json +89 -0
- package/assets/shaders/M_Anisotropy_Radial.material.json +55 -0
- package/assets/shaders/M_Chrome.material.json +18 -0
- package/assets/shaders/M_Emissive_Blue.material.json +26 -0
- package/assets/shaders/M_Glass_Frosted.material.json +24 -0
- package/assets/shaders/M_Glass_ThinFilm.material.json +23 -0
- package/assets/shaders/M_Glossy_Grey.material.json +20 -0
- package/assets/shaders/M_Matte_White.material.json +20 -0
- package/assets/shaders/M_Metal_Anisotropic_Gold.material.json +31 -0
- package/assets/shaders/M_Metal_Anisotropic_Silver.material.json +31 -0
- package/assets/shaders/M_Metal_Brushed.material.json +61 -0
- package/assets/shaders/M_Paint_Clearcoat.material.json +28 -0
- package/assets/shaders/M_Stone_Mossy.material.json +153 -0
- package/assets/shaders/M_Stone_Mossy_Snow.material.json +151 -0
- package/assets/shaders/M_Toon_Anime.material.json +49 -0
- package/assets/shaders/M_Toon_Anime_5Step.material.json +45 -0
- package/assets/shaders/M_Toon_Cel.material.json +49 -0
- package/assets/shaders/M_Transmission.material.json +42 -0
- package/assets/shaders/M_Velvet_Blue.material.json +33 -0
- package/assets/shaders/M_Velvet_Purple.material.json +30 -0
- package/assets/shaders/M_Velvet_Red.material.json +33 -0
- package/assets/shaders/M_Wax_SSSLite.material.json +55 -0
- package/assets/shaders/matcap/M_Matcap_Blue.material.json +27 -0
- package/assets/shaders/matcap/M_Matcap_Rainbow.material.json +26 -0
- package/assets/shaders/matcap/M_Matcap_White.material.json +28 -0
- package/assets/sounds/birds.mp3 +0 -0
- package/assets/sounds/explosion.mp3 +0 -0
- package/assets/sounds/game-gun-short.mp3 +0 -0
- package/assets/sounds/laser.mp3 +0 -0
- package/assets/sounds/pickup.mp3 +0 -0
- package/assets/sounds/tuba.mp3 +0 -0
- package/assets/textures/Checkerboard.png +0 -0
- package/assets/textures/Grid_10x10.png +0 -0
- package/assets/textures/T_AnisotropyMap_Radial.png +0 -0
- package/assets/textures/T_Anisotropy_Roughness.png +0 -0
- package/assets/textures/T_Gradient.png +0 -0
- package/assets/textures/T_Grid_01.png +0 -0
- package/assets/textures/T_Grid_01.texture.json +7 -0
- package/assets/textures/T_Metal_Brushed_Normal.png +0 -0
- package/assets/textures/T_Normal.png +0 -0
- package/assets/textures/T_Stone_Mossy_AmbientOcclusion.jpg +0 -0
- package/assets/textures/T_Stone_Mossy_BaseColor.jpg +0 -0
- package/assets/textures/T_Stone_Mossy_Normal.jpg +0 -0
- package/assets/textures/T_Stone_Mossy_Roughness.jpg +0 -0
- package/assets/textures/T_Stone_Mossy_Snow_AmbientOcclusion.jpg +0 -0
- package/assets/textures/T_Stone_Mossy_Snow_BaseColor.jpg +0 -0
- package/assets/textures/T_Stone_Mossy_Snow_Normal.jpg +0 -0
- package/assets/textures/T_Stone_Mossy_Snow_Roughness.jpg +0 -0
- package/assets/textures/T_Toon_Anime_4Step.png +0 -0
- package/assets/textures/T_Toon_Anime_5Step.png +0 -0
- package/assets/textures/T_Toon_Cel_2Step.png +0 -0
- package/assets/textures/T_Wax_Thickness.png +0 -0
- package/assets/textures/matcaps/T_Matcap_Rainbow.png.png +0 -0
- package/assets/textures/matcaps/beige.png +0 -0
- package/assets/textures/matcaps/black.png +0 -0
- package/assets/textures/matcaps/blue.png +0 -0
- package/assets/textures/matcaps/brown.png +0 -0
- package/assets/textures/matcaps/emeraldGreen.png +0 -0
- package/assets/textures/matcaps/gold.png +0 -0
- package/assets/textures/matcaps/gray.png +0 -0
- package/assets/textures/matcaps/green.png +0 -0
- package/assets/textures/matcaps/metal.png +0 -0
- package/assets/textures/matcaps/orange.png +0 -0
- package/assets/textures/matcaps/purple.png +0 -0
- package/assets/textures/matcaps/red.png +0 -0
- package/assets/textures/matcaps/white.png +0 -0
- package/assets/textures/matcaps/yellow.png +0 -0
- package/assets/textures/skybox/citrus_orchard_road_puresky_2k.hdr +0 -0
- package/assets/textures/skybox/venice_sunset_4k.hdr +0 -0
- package/assets/ui/styles/ammo-counter.css +58 -0
- package/assets/ui/styles/compass.css +54 -0
- package/assets/ui/styles/controls-help.css +21 -0
- package/assets/ui/styles/crosshair.css +51 -0
- package/assets/ui/styles/inventory-bar.css +112 -0
- package/assets/ui/styles/inventory-grid.css +257 -0
- package/assets/ui/styles/main-menu.css +59 -0
- package/assets/ui/styles/minimap.css +12 -0
- package/assets/ui/styles/number-display.css +18 -0
- package/assets/ui/styles/progress-bar.css +199 -0
- package/assets/ui/styles/reload-indicator.css +76 -0
- package/assets/ui/templates/ammo-counter.html +7 -0
- package/assets/ui/templates/compass.html +6 -0
- package/assets/ui/templates/controls-help.html +9 -0
- package/assets/ui/templates/crosshair.html +1 -0
- package/assets/ui/templates/inventory-bar.html +38 -0
- package/assets/ui/templates/inventory-grid.html +9 -0
- package/assets/ui/templates/main-menu.html +10 -0
- package/assets/ui/templates/minimap.html +3 -0
- package/assets/ui/templates/number-display.html +3 -0
- package/assets/ui/templates/progress-bar.html +7 -0
- package/assets/ui/templates/reload-indicator.html +13 -0
- package/dist/games/animation-demo.d.ts +21 -0
- package/dist/games/animation-demo.js +398 -0
- package/dist/games/animation-retarget-demo.d.ts +44 -0
- package/dist/games/animation-retarget-demo.js +574 -0
- package/dist/games/behavior-tree-demo.d.ts +100 -0
- package/dist/games/behavior-tree-demo.js +1656 -0
- package/dist/games/character_animation.d.ts +15 -0
- package/dist/games/character_animation.js +170 -0
- package/dist/games/collision-demo.d.ts +4 -0
- package/dist/games/collision-demo.js +134 -0
- package/dist/games/deprecated/advanced-grid-demo.d.ts +18 -0
- package/dist/games/deprecated/advanced-grid-demo.js +305 -0
- package/dist/games/deprecated/airplane-demo.d.ts +10 -0
- package/dist/games/deprecated/airplane-demo.js +136 -0
- package/dist/games/deprecated/character-controller.d.ts +6 -0
- package/dist/games/deprecated/character-controller.js +144 -0
- package/dist/games/deprecated/chase-game.d.ts +17 -0
- package/dist/games/deprecated/chase-game.js +269 -0
- package/dist/games/deprecated/collision-config.d.ts +7 -0
- package/dist/games/deprecated/collision-config.js +295 -0
- package/dist/games/deprecated/door-demo.d.ts +30 -0
- package/dist/games/deprecated/door-demo.js +562 -0
- package/dist/games/deprecated/fps-demo.d.ts +9 -0
- package/dist/games/deprecated/fps-demo.js +119 -0
- package/dist/games/deprecated/fps-shotgun-demo.d.ts +19 -0
- package/dist/games/deprecated/fps-shotgun-demo.js +221 -0
- package/dist/games/deprecated/index.d.ts +25 -0
- package/dist/games/deprecated/index.js +26 -0
- package/dist/games/deprecated/lightmapping-demo.d.ts +135 -0
- package/dist/games/deprecated/lightmapping-demo.js +1344 -0
- package/dist/games/deprecated/lights-demo.d.ts +93 -0
- package/dist/games/deprecated/lights-demo.js +815 -0
- package/dist/games/deprecated/matcap-demo.d.ts +54 -0
- package/dist/games/deprecated/matcap-demo.js +788 -0
- package/dist/games/deprecated/material-demo-2.d.ts +14 -0
- package/dist/games/deprecated/material-demo-2.js +521 -0
- package/dist/games/deprecated/material-demo.d.ts +8 -0
- package/dist/games/deprecated/material-demo.js +177 -0
- package/dist/games/deprecated/memory-leak-test.d.ts +6 -0
- package/dist/games/deprecated/memory-leak-test.js +20 -0
- package/dist/games/deprecated/model-stress-test.d.ts +10 -0
- package/dist/games/deprecated/model-stress-test.js +116 -0
- package/dist/games/deprecated/multiplayer-demo.d.ts +13 -0
- package/dist/games/deprecated/multiplayer-demo.js +377 -0
- package/dist/games/deprecated/physics-demo.d.ts +10 -0
- package/dist/games/deprecated/physics-demo.js +200 -0
- package/dist/games/deprecated/shadow-demo.d.ts +25 -0
- package/dist/games/deprecated/shadow-demo.js +402 -0
- package/dist/games/deprecated/shooting-demo.d.ts +19 -0
- package/dist/games/deprecated/shooting-demo.js +338 -0
- package/dist/games/deprecated/skybox-demo.d.ts +35 -0
- package/dist/games/deprecated/skybox-demo.js +323 -0
- package/dist/games/deprecated/sound-demo.d.ts +11 -0
- package/dist/games/deprecated/sound-demo.js +125 -0
- package/dist/games/deprecated/timer-demo.d.ts +11 -0
- package/dist/games/deprecated/timer-demo.js +150 -0
- package/dist/games/deprecated/voxel-demo.d.ts +5 -0
- package/dist/games/deprecated/voxel-demo.js +41 -0
- package/dist/games/deprecated/world-commands.d.ts +8 -0
- package/dist/games/deprecated/world-commands.js +168 -0
- package/dist/games/deprecated/world-loading.d.ts +6 -0
- package/dist/games/deprecated/world-loading.js +86 -0
- package/dist/games/examples/fps-advanced/const.d.ts +171 -0
- package/dist/games/examples/fps-advanced/const.js +116 -0
- package/dist/games/examples/fps-advanced/enemies.d.ts +21 -0
- package/dist/games/examples/fps-advanced/enemies.js +182 -0
- package/dist/games/examples/fps-advanced/game-mode.d.ts +53 -0
- package/dist/games/examples/fps-advanced/game-mode.js +353 -0
- package/dist/games/examples/fps-advanced/game.d.ts +9 -0
- package/dist/games/examples/fps-advanced/game.js +58 -0
- package/dist/games/examples/fps-advanced/pickups.d.ts +36 -0
- package/dist/games/examples/fps-advanced/pickups.js +225 -0
- package/dist/games/examples/fps-advanced/player.d.ts +12 -0
- package/dist/games/examples/fps-advanced/player.js +110 -0
- package/dist/games/examples/fps-advanced/ui/endgame-ui.d.ts +21 -0
- package/dist/games/examples/fps-advanced/ui/endgame-ui.js +291 -0
- package/dist/games/examples/fps-advanced/ui/game-hud.d.ts +17 -0
- package/dist/games/examples/fps-advanced/ui/game-hud.js +225 -0
- package/dist/games/examples/fps-advanced/ui/menu-ui.d.ts +13 -0
- package/dist/games/examples/fps-advanced/ui/menu-ui.js +224 -0
- package/dist/games/examples/fps-advanced/ui/weapon-hud.d.ts +27 -0
- package/dist/games/examples/fps-advanced/ui/weapon-hud.js +259 -0
- package/dist/games/examples/fps-advanced/weapons.d.ts +14 -0
- package/dist/games/examples/fps-advanced/weapons.js +173 -0
- package/dist/games/examples/index.d.ts +5 -0
- package/dist/games/examples/index.js +6 -0
- package/dist/games/examples/plugin-demo/game.d.ts +7 -0
- package/dist/games/examples/plugin-demo/game.js +168 -0
- package/dist/games/examples/plugin-demo/plugins/dynamic-lighting.d.ts +8 -0
- package/dist/games/examples/plugin-demo/plugins/dynamic-lighting.js +156 -0
- package/dist/games/examples/plugin-demo/plugins/instanced-forest.d.ts +7 -0
- package/dist/games/examples/plugin-demo/plugins/instanced-forest.js +194 -0
- package/dist/games/examples/plugin-demo/plugins/particle-fountain.d.ts +7 -0
- package/dist/games/examples/plugin-demo/plugins/particle-fountain.js +64 -0
- package/dist/games/examples/plugin-demo/plugins/physics-playground.d.ts +7 -0
- package/dist/games/examples/plugin-demo/plugins/physics-playground.js +185 -0
- package/dist/games/examples/plugin-demo/plugins/robot-follower.d.ts +7 -0
- package/dist/games/examples/plugin-demo/plugins/robot-follower.js +347 -0
- package/dist/games/examples/plugin-demo/plugins/scatter-models.d.ts +7 -0
- package/dist/games/examples/plugin-demo/plugins/scatter-models.js +70 -0
- package/dist/games/examples/plugin-demo/plugins/simple-cube.d.ts +7 -0
- package/dist/games/examples/plugin-demo/plugins/simple-cube.js +44 -0
- package/dist/games/examples/plugin-demo/plugins/tic-tac-toe.d.ts +8 -0
- package/dist/games/examples/plugin-demo/plugins/tic-tac-toe.js +526 -0
- package/dist/games/examples/plugin-demo/plugins/wobbling-sphere.d.ts +7 -0
- package/dist/games/examples/plugin-demo/plugins/wobbling-sphere.js +63 -0
- package/dist/games/examples/side-scroller-advanced/const.d.ts +97 -0
- package/dist/games/examples/side-scroller-advanced/const.js +82 -0
- package/dist/games/examples/side-scroller-advanced/game-mode.d.ts +54 -0
- package/dist/games/examples/side-scroller-advanced/game-mode.js +351 -0
- package/dist/games/examples/side-scroller-advanced/game.d.ts +9 -0
- package/dist/games/examples/side-scroller-advanced/game.js +70 -0
- package/dist/games/examples/side-scroller-advanced/level-generator.d.ts +68 -0
- package/dist/games/examples/side-scroller-advanced/level-generator.js +366 -0
- package/dist/games/examples/side-scroller-advanced/pickups.d.ts +18 -0
- package/dist/games/examples/side-scroller-advanced/pickups.js +147 -0
- package/dist/games/examples/side-scroller-advanced/player.d.ts +5 -0
- package/dist/games/examples/side-scroller-advanced/player.js +104 -0
- package/dist/games/examples/side-scroller-advanced/ui/endgame-ui.d.ts +16 -0
- package/dist/games/examples/side-scroller-advanced/ui/endgame-ui.js +290 -0
- package/dist/games/examples/side-scroller-advanced/ui/game-hud.d.ts +21 -0
- package/dist/games/examples/side-scroller-advanced/ui/game-hud.js +265 -0
- package/dist/games/examples/side-scroller-advanced/ui/menu-ui.d.ts +13 -0
- package/dist/games/examples/side-scroller-advanced/ui/menu-ui.js +222 -0
- package/dist/games/examples/vehicle/base-vehicle.d.ts +30 -0
- package/dist/games/examples/vehicle/base-vehicle.js +155 -0
- package/dist/games/examples/vehicle/game.d.ts +11 -0
- package/dist/games/examples/vehicle/game.js +140 -0
- package/dist/games/examples/vehicle/mesh-vehicle.d.ts +19 -0
- package/dist/games/examples/vehicle/mesh-vehicle.js +194 -0
- package/dist/games/examples/vehicle/player.d.ts +9 -0
- package/dist/games/examples/vehicle/player.js +87 -0
- package/dist/games/examples/vehicle/primitive-vehicle.d.ts +21 -0
- package/dist/games/examples/vehicle/primitive-vehicle.js +269 -0
- package/dist/games/examples/vr-game/VRAttachableCube.d.ts +8 -0
- package/dist/games/examples/vr-game/VRAttachableCube.js +41 -0
- package/dist/games/examples/vr-game/VRInteractableCylinder.d.ts +10 -0
- package/dist/games/examples/vr-game/VRInteractableCylinder.js +76 -0
- package/dist/games/examples/vr-game/VRPressableButton.d.ts +24 -0
- package/dist/games/examples/vr-game/VRPressableButton.js +135 -0
- package/dist/games/examples/vr-game/VRProjectileActor.d.ts +19 -0
- package/dist/games/examples/vr-game/VRProjectileActor.js +75 -0
- package/dist/games/examples/vr-game/VRRifleActor.d.ts +16 -0
- package/dist/games/examples/vr-game/VRRifleActor.js +142 -0
- package/dist/games/examples/vr-game/game.d.ts +9 -0
- package/dist/games/examples/vr-game/game.js +56 -0
- package/dist/games/examples/vr-game/index.d.ts +5 -0
- package/dist/games/examples/vr-game/index.js +9 -0
- package/dist/games/examples/vr-game/scene.d.ts +5 -0
- package/dist/games/examples/vr-game/scene.js +83 -0
- package/dist/games/hand-tracking-demo.d.ts +10 -0
- package/dist/games/hand-tracking-demo.js +65 -0
- package/dist/games/index.d.ts +21 -0
- package/dist/games/index.js +22 -0
- package/dist/games/instanced-mesh-demo.d.ts +45 -0
- package/dist/games/instanced-mesh-demo.js +416 -0
- package/dist/games/manifold-demo.d.ts +6 -0
- package/dist/games/manifold-demo.js +44 -0
- package/dist/games/navigation-demo.d.ts +30 -0
- package/dist/games/navigation-demo.js +336 -0
- package/dist/games/navmesh-primitives-demo.d.ts +167 -0
- package/dist/games/navmesh-primitives-demo.js +1105 -0
- package/dist/games/performance-test-demo.d.ts +13 -0
- package/dist/games/performance-test-demo.js +214 -0
- package/dist/games/postprocess-demo.d.ts +46 -0
- package/dist/games/postprocess-demo.js +829 -0
- package/dist/games/ragdoll-demo-simple.d.ts +34 -0
- package/dist/games/ragdoll-demo-simple.js +152 -0
- package/dist/games/ragdoll-demo.d.ts +30 -0
- package/dist/games/ragdoll-demo.js +258 -0
- package/dist/games/swipe-tap-demo.d.ts +24 -0
- package/dist/games/swipe-tap-demo.js +238 -0
- package/dist/games/tween-demo.d.ts +22 -0
- package/dist/games/tween-demo.js +122 -0
- package/dist/games/ui-demo.d.ts +75 -0
- package/dist/games/ui-demo.js +1054 -0
- package/dist/games/vfx-demo.d.ts +48 -0
- package/dist/games/vfx-demo.js +821 -0
- package/dist/games/vfx-wawa-demo.d.ts +7 -0
- package/dist/games/vfx-wawa-demo.js +471 -0
- package/dist/games/vr-ui-demo-minimal.d.ts +15 -0
- package/dist/games/vr-ui-demo-minimal.js +141 -0
- package/dist/games/vr-ui-demo.d.ts +32 -0
- package/dist/games/vr-ui-demo.js +871 -0
- package/dist/genesys.min.mjs +7035 -0
- package/dist/launcher.d.ts +1 -0
- package/dist/launcher.js +778 -0
- package/dist/scripts/build-browser-bundle.d.ts +5 -0
- package/dist/scripts/build-browser-bundle.js +69 -0
- package/dist/scripts/check-asset-path.d.ts +1 -0
- package/dist/scripts/check-asset-path.js +146 -0
- package/dist/scripts/dump-templates.d.ts +1 -0
- package/dist/scripts/dump-templates.js +16 -0
- package/dist/scripts/generate-dependencies.d.ts +1 -0
- package/dist/scripts/generate-dependencies.js +110 -0
- package/dist/scripts/generate-prefabs.d.ts +1 -0
- package/dist/scripts/generate-prefabs.js +106 -0
- package/dist/scripts/load-save-world.d.ts +2 -0
- package/dist/scripts/load-save-world.js +35 -0
- package/dist/scripts/loc.d.ts +1 -0
- package/dist/scripts/loc.js +80 -0
- package/dist/scripts/optimize-glb-wrapper.d.ts +1 -0
- package/dist/scripts/optimize-glb-wrapper.js +26 -0
- package/dist/scripts/optimize-glb.d.ts +41 -0
- package/dist/scripts/optimize-glb.js +296 -0
- package/dist/scripts/session-server.d.ts +117 -0
- package/dist/scripts/session-server.js +782 -0
- package/dist/scripts/test-world-loading.d.ts +14 -0
- package/dist/scripts/test-world-loading.js +19 -0
- package/dist/src/actors/Actor.d.ts +510 -0
- package/dist/src/actors/Actor.js +1180 -0
- package/dist/src/actors/GLTFMeshActor.d.ts +34 -0
- package/dist/src/actors/GLTFMeshActor.js +102 -0
- package/dist/src/actors/GlobalParticleManager.d.ts +154 -0
- package/dist/src/actors/GlobalParticleManager.js +365 -0
- package/dist/src/actors/Pawn.d.ts +191 -0
- package/dist/src/actors/Pawn.js +384 -0
- package/dist/src/actors/PlayerController.d.ts +177 -0
- package/dist/src/actors/PlayerController.js +763 -0
- package/dist/src/actors/PlayerStart.d.ts +8 -0
- package/dist/src/actors/PlayerStart.js +48 -0
- package/dist/src/actors/Projectile.d.ts +50 -0
- package/dist/src/actors/Projectile.js +157 -0
- package/dist/src/actors/RagdollTestActor.d.ts +31 -0
- package/dist/src/actors/RagdollTestActor.js +153 -0
- package/dist/src/actors/ThirdPersonCharacterPawn.d.ts +27 -0
- package/dist/src/actors/ThirdPersonCharacterPawn.js +149 -0
- package/dist/src/actors/index.d.ts +20 -0
- package/dist/src/actors/index.js +21 -0
- package/dist/src/animation/AnimationClipCache.d.ts +41 -0
- package/dist/src/animation/AnimationClipCache.js +97 -0
- package/dist/src/animation/AnimationRetargeting.d.ts +100 -0
- package/dist/src/animation/AnimationRetargeting.js +455 -0
- package/dist/src/animation/SkeletonProfile.d.ts +112 -0
- package/dist/src/animation/SkeletonProfile.js +84 -0
- package/dist/src/animation/index.d.ts +14 -0
- package/dist/src/animation/index.js +15 -0
- package/dist/src/animation/retargeting.d.ts +142 -0
- package/dist/src/animation/retargeting.js +834 -0
- package/dist/src/components/CharacterStatsComponent.d.ts +89 -0
- package/dist/src/components/CharacterStatsComponent.js +207 -0
- package/dist/src/components/CollisionShapeComponent.d.ts +102 -0
- package/dist/src/components/CollisionShapeComponent.js +232 -0
- package/dist/src/components/Component.d.ts +82 -0
- package/dist/src/components/Component.js +2 -0
- package/dist/src/components/FollowComponent.d.ts +67 -0
- package/dist/src/components/FollowComponent.js +128 -0
- package/dist/src/components/PrimitiveComponent.d.ts +183 -0
- package/dist/src/components/PrimitiveComponent.js +368 -0
- package/dist/src/components/ResetPositionComponent.d.ts +52 -0
- package/dist/src/components/ResetPositionComponent.js +161 -0
- package/dist/src/components/SceneComponent.d.ts +225 -0
- package/dist/src/components/SceneComponent.js +621 -0
- package/dist/src/components/audio/SoundComponent.d.ts +109 -0
- package/dist/src/components/audio/SoundComponent.js +353 -0
- package/dist/src/components/audio/index.d.ts +11 -0
- package/dist/src/components/audio/index.js +12 -0
- package/dist/src/components/csg/CSGCombiner.d.ts +87 -0
- package/dist/src/components/csg/CSGCombiner.js +240 -0
- package/dist/src/components/csg/CSGShapes.d.ts +173 -0
- package/dist/src/components/csg/CSGShapes.js +326 -0
- package/dist/src/components/csg/index.d.ts +12 -0
- package/dist/src/components/csg/index.js +13 -0
- package/dist/src/components/gameplay/BaseWeaponComponent.d.ts +175 -0
- package/dist/src/components/gameplay/BaseWeaponComponent.js +496 -0
- package/dist/src/components/gameplay/DoorComponent.d.ts +236 -0
- package/dist/src/components/gameplay/DoorComponent.js +928 -0
- package/dist/src/components/gameplay/Equipment.d.ts +22 -0
- package/dist/src/components/gameplay/Equipment.js +9 -0
- package/dist/src/components/gameplay/GenericEquipment.d.ts +37 -0
- package/dist/src/components/gameplay/GenericEquipment.js +90 -0
- package/dist/src/components/gameplay/InstantHitWeaponComponent.d.ts +96 -0
- package/dist/src/components/gameplay/InstantHitWeaponComponent.js +194 -0
- package/dist/src/components/gameplay/PickupComponent.d.ts +130 -0
- package/dist/src/components/gameplay/PickupComponent.js +429 -0
- package/dist/src/components/gameplay/ProjectileWeaponComponent.d.ts +49 -0
- package/dist/src/components/gameplay/ProjectileWeaponComponent.js +93 -0
- package/dist/src/components/gameplay/ShotgunComponent.d.ts +18 -0
- package/dist/src/components/gameplay/ShotgunComponent.js +216 -0
- package/dist/src/components/gameplay/SwitchComponent.d.ts +152 -0
- package/dist/src/components/gameplay/SwitchComponent.js +481 -0
- package/dist/src/components/gameplay/TriggerZoneComponent.d.ts +157 -0
- package/dist/src/components/gameplay/TriggerZoneComponent.js +312 -0
- package/dist/src/components/gameplay/index.d.ts +20 -0
- package/dist/src/components/gameplay/index.js +21 -0
- package/dist/src/components/index.d.ts +16 -0
- package/dist/src/components/index.js +18 -0
- package/dist/src/components/lights/AmbientLightComponent.d.ts +37 -0
- package/dist/src/components/lights/AmbientLightComponent.js +68 -0
- package/dist/src/components/lights/DirectionalLightComponent.d.ts +77 -0
- package/dist/src/components/lights/DirectionalLightComponent.js +146 -0
- package/dist/src/components/lights/HemisphereLightComponent.d.ts +67 -0
- package/dist/src/components/lights/HemisphereLightComponent.js +121 -0
- package/dist/src/components/lights/LightComponent.d.ts +145 -0
- package/dist/src/components/lights/LightComponent.js +315 -0
- package/dist/src/components/lights/PointLightComponent.d.ts +61 -0
- package/dist/src/components/lights/PointLightComponent.js +103 -0
- package/dist/src/components/lights/RectAreaLightComponent.d.ts +78 -0
- package/dist/src/components/lights/RectAreaLightComponent.js +135 -0
- package/dist/src/components/lights/SpotLightComponent.d.ts +100 -0
- package/dist/src/components/lights/SpotLightComponent.js +167 -0
- package/dist/src/components/lights/index.d.ts +17 -0
- package/dist/src/components/lights/index.js +18 -0
- package/dist/src/components/movement/AerialMovementComponent.d.ts +93 -0
- package/dist/src/components/movement/AerialMovementComponent.js +339 -0
- package/dist/src/components/movement/AirplaneMovementComponent.d.ts +59 -0
- package/dist/src/components/movement/AirplaneMovementComponent.js +215 -0
- package/dist/src/components/movement/BasePawnMovementComponent.d.ts +132 -0
- package/dist/src/components/movement/BasePawnMovementComponent.js +264 -0
- package/dist/src/components/movement/CharacterMovementComponent.d.ts +175 -0
- package/dist/src/components/movement/CharacterMovementComponent.js +448 -0
- package/dist/src/components/movement/DirectionalCharacterMovementComponent.d.ts +17 -0
- package/dist/src/components/movement/DirectionalCharacterMovementComponent.js +82 -0
- package/dist/src/components/movement/NpcMovementComponent.d.ts +232 -0
- package/dist/src/components/movement/NpcMovementComponent.js +890 -0
- package/dist/src/components/movement/PathMovementComponent.d.ts +54 -0
- package/dist/src/components/movement/PathMovementComponent.js +211 -0
- package/dist/src/components/movement/TopDownMovementComponent.d.ts +25 -0
- package/dist/src/components/movement/TopDownMovementComponent.js +79 -0
- package/dist/src/components/movement/TweenMovementComponent.d.ts +59 -0
- package/dist/src/components/movement/TweenMovementComponent.js +362 -0
- package/dist/src/components/movement/VehicleMovementComponent.d.ts +98 -0
- package/dist/src/components/movement/VehicleMovementComponent.js +402 -0
- package/dist/src/components/movement/index.d.ts +19 -0
- package/dist/src/components/movement/index.js +20 -0
- package/dist/src/components/physics/RagdollComponent.d.ts +118 -0
- package/dist/src/components/physics/RagdollComponent.js +671 -0
- package/dist/src/components/visual/AnimationComponent.d.ts +29 -0
- package/dist/src/components/visual/AnimationComponent.js +234 -0
- package/dist/src/components/visual/AnimationStateMachineComponent.d.ts +235 -0
- package/dist/src/components/visual/AnimationStateMachineComponent.js +1048 -0
- package/dist/src/components/visual/BaseInstancedMeshComponent.d.ts +253 -0
- package/dist/src/components/visual/BaseInstancedMeshComponent.js +763 -0
- package/dist/src/components/visual/BillboardComponent.d.ts +26 -0
- package/dist/src/components/visual/BillboardComponent.js +143 -0
- package/dist/src/components/visual/EditorOnlyMeshComponent.d.ts +17 -0
- package/dist/src/components/visual/EditorOnlyMeshComponent.js +53 -0
- package/dist/src/components/visual/FogComponent.d.ts +32 -0
- package/dist/src/components/visual/FogComponent.js +131 -0
- package/dist/src/components/visual/GLTFMeshComponent.d.ts +138 -0
- package/dist/src/components/visual/GLTFMeshComponent.js +411 -0
- package/dist/src/components/visual/InstancedGltfMeshComponent.d.ts +75 -0
- package/dist/src/components/visual/InstancedGltfMeshComponent.js +217 -0
- package/dist/src/components/visual/InstancedMeshComponent.d.ts +57 -0
- package/dist/src/components/visual/InstancedMeshComponent.js +114 -0
- package/dist/src/components/visual/MeshComponent.d.ts +71 -0
- package/dist/src/components/visual/MeshComponent.js +208 -0
- package/dist/src/components/visual/ParticleEmitterComponent.d.ts +145 -0
- package/dist/src/components/visual/ParticleEmitterComponent.js +569 -0
- package/dist/src/components/visual/SkyboxComponent.d.ts +135 -0
- package/dist/src/components/visual/SkyboxComponent.js +342 -0
- package/dist/src/components/visual/TerrainMeshComponent.d.ts +119 -0
- package/dist/src/components/visual/TerrainMeshComponent.js +309 -0
- package/dist/src/components/visual/UI3DComponent.d.ts +60 -0
- package/dist/src/components/visual/UI3DComponent.js +248 -0
- package/dist/src/components/visual/index.d.ts +23 -0
- package/dist/src/components/visual/index.js +24 -0
- package/dist/src/components/voxel/MagicaVoxelLoader.d.ts +18 -0
- package/dist/src/components/voxel/MagicaVoxelLoader.js +151 -0
- package/dist/src/components/voxel/VoxelMeshComponent.d.ts +66 -0
- package/dist/src/components/voxel/VoxelMeshComponent.js +246 -0
- package/dist/src/components/voxel/index.d.ts +2 -0
- package/dist/src/components/voxel/index.js +3 -0
- package/dist/src/const.d.ts +61 -0
- package/dist/src/const.js +62 -0
- package/dist/src/csg/CSGUtils.d.ts +118 -0
- package/dist/src/csg/CSGUtils.js +805 -0
- package/dist/src/csg/ManifoldWrapper.d.ts +172 -0
- package/dist/src/csg/ManifoldWrapper.js +629 -0
- package/dist/src/csg/index.d.ts +13 -0
- package/dist/src/csg/index.js +14 -0
- package/dist/src/dependencies.d.ts +125 -0
- package/dist/src/dependencies.js +72 -0
- package/dist/src/game/GameBuilder.d.ts +104 -0
- package/dist/src/game/GameBuilder.js +263 -0
- package/dist/src/game/GameLoop.d.ts +204 -0
- package/dist/src/game/GameLoop.js +545 -0
- package/dist/src/game/GameMode.d.ts +58 -0
- package/dist/src/game/GameMode.js +131 -0
- package/dist/src/game/Playable.d.ts +38 -0
- package/dist/src/game/Playable.js +83 -0
- package/dist/src/game/World.d.ts +512 -0
- package/dist/src/game/World.js +1467 -0
- package/dist/src/game/index.d.ts +18 -0
- package/dist/src/game/index.js +19 -0
- package/dist/src/index.d.ts +39 -0
- package/dist/src/index.js +40 -0
- package/dist/src/materials.d.ts +49 -0
- package/dist/src/materials.js +177 -0
- package/dist/src/multiplayer/MovementPrediction.d.ts +28 -0
- package/dist/src/multiplayer/MovementPrediction.js +204 -0
- package/dist/src/multiplayer/NetWorld.d.ts +125 -0
- package/dist/src/multiplayer/NetWorld.js +960 -0
- package/dist/src/multiplayer/implementations/MemorySession.d.ts +18 -0
- package/dist/src/multiplayer/implementations/MemorySession.js +112 -0
- package/dist/src/multiplayer/implementations/WebSocketSession.d.ts +134 -0
- package/dist/src/multiplayer/implementations/WebSocketSession.js +439 -0
- package/dist/src/multiplayer/implementations/index.d.ts +14 -0
- package/dist/src/multiplayer/implementations/index.js +15 -0
- package/dist/src/multiplayer/index.d.ts +16 -0
- package/dist/src/multiplayer/index.js +17 -0
- package/dist/src/multiplayer/interface.d.ts +134 -0
- package/dist/src/multiplayer/interface.js +87 -0
- package/dist/src/navigation/NavigationServer.d.ts +134 -0
- package/dist/src/navigation/NavigationServer.js +47 -0
- package/dist/src/navigation/RecastNavigationServer.d.ts +82 -0
- package/dist/src/navigation/RecastNavigationServer.js +325 -0
- package/dist/src/navigation/index.d.ts +16 -0
- package/dist/src/navigation/index.js +17 -0
- package/dist/src/npc/behavior-tree/BehaviorNode.d.ts +95 -0
- package/dist/src/npc/behavior-tree/BehaviorNode.js +177 -0
- package/dist/src/npc/behavior-tree/BehaviorTreeComponent.d.ts +104 -0
- package/dist/src/npc/behavior-tree/BehaviorTreeComponent.js +341 -0
- package/dist/src/npc/behavior-tree/behaviors/BehaviorAction.d.ts +52 -0
- package/dist/src/npc/behavior-tree/behaviors/BehaviorAction.js +70 -0
- package/dist/src/npc/behavior-tree/behaviors/ConditionEvaluator.d.ts +73 -0
- package/dist/src/npc/behavior-tree/behaviors/ConditionEvaluator.js +116 -0
- package/dist/src/npc/behavior-tree/behaviors/actions/aerial/AerialMoveToTargetAction.d.ts +33 -0
- package/dist/src/npc/behavior-tree/behaviors/actions/aerial/AerialMoveToTargetAction.js +138 -0
- package/dist/src/npc/behavior-tree/behaviors/actions/aerial/AerialSearchAction.d.ts +42 -0
- package/dist/src/npc/behavior-tree/behaviors/actions/aerial/AerialSearchAction.js +170 -0
- package/dist/src/npc/behavior-tree/behaviors/actions/aerial/AerialTrackTargetAction.d.ts +27 -0
- package/dist/src/npc/behavior-tree/behaviors/actions/aerial/AerialTrackTargetAction.js +86 -0
- package/dist/src/npc/behavior-tree/behaviors/actions/aerial/AerialWanderAction.d.ts +50 -0
- package/dist/src/npc/behavior-tree/behaviors/actions/aerial/AerialWanderAction.js +189 -0
- package/dist/src/npc/behavior-tree/behaviors/actions/aerial/index.d.ts +4 -0
- package/dist/src/npc/behavior-tree/behaviors/actions/aerial/index.js +6 -0
- package/dist/src/npc/behavior-tree/behaviors/actions/combat/MeleeAttackAction.d.ts +37 -0
- package/dist/src/npc/behavior-tree/behaviors/actions/combat/MeleeAttackAction.js +172 -0
- package/dist/src/npc/behavior-tree/behaviors/actions/combat/ShootAction.d.ts +35 -0
- package/dist/src/npc/behavior-tree/behaviors/actions/combat/ShootAction.js +173 -0
- package/dist/src/npc/behavior-tree/behaviors/actions/combat/index.d.ts +2 -0
- package/dist/src/npc/behavior-tree/behaviors/actions/combat/index.js +4 -0
- package/dist/src/npc/behavior-tree/behaviors/actions/ground/FleeFromTargetAction.d.ts +34 -0
- package/dist/src/npc/behavior-tree/behaviors/actions/ground/FleeFromTargetAction.js +148 -0
- package/dist/src/npc/behavior-tree/behaviors/actions/ground/FollowActorAction.d.ts +30 -0
- package/dist/src/npc/behavior-tree/behaviors/actions/ground/FollowActorAction.js +129 -0
- package/dist/src/npc/behavior-tree/behaviors/actions/ground/MoveToPositionAction.d.ts +27 -0
- package/dist/src/npc/behavior-tree/behaviors/actions/ground/MoveToPositionAction.js +115 -0
- package/dist/src/npc/behavior-tree/behaviors/actions/ground/SetNextWaypointAction.d.ts +28 -0
- package/dist/src/npc/behavior-tree/behaviors/actions/ground/SetNextWaypointAction.js +120 -0
- package/dist/src/npc/behavior-tree/behaviors/actions/ground/WanderAction.d.ts +35 -0
- package/dist/src/npc/behavior-tree/behaviors/actions/ground/WanderAction.js +172 -0
- package/dist/src/npc/behavior-tree/behaviors/actions/ground/index.d.ts +5 -0
- package/dist/src/npc/behavior-tree/behaviors/actions/ground/index.js +7 -0
- package/dist/src/npc/behavior-tree/behaviors/actions/index.d.ts +4 -0
- package/dist/src/npc/behavior-tree/behaviors/actions/index.js +10 -0
- package/dist/src/npc/behavior-tree/behaviors/actions/utility/CalculateTacticalPositionAction.d.ts +32 -0
- package/dist/src/npc/behavior-tree/behaviors/actions/utility/CalculateTacticalPositionAction.js +123 -0
- package/dist/src/npc/behavior-tree/behaviors/actions/utility/LookAtTargetAction.d.ts +43 -0
- package/dist/src/npc/behavior-tree/behaviors/actions/utility/LookAtTargetAction.js +140 -0
- package/dist/src/npc/behavior-tree/behaviors/actions/utility/WaitAction.d.ts +24 -0
- package/dist/src/npc/behavior-tree/behaviors/actions/utility/WaitAction.js +85 -0
- package/dist/src/npc/behavior-tree/behaviors/actions/utility/index.d.ts +3 -0
- package/dist/src/npc/behavior-tree/behaviors/actions/utility/index.js +5 -0
- package/dist/src/npc/behavior-tree/behaviors/conditions/BlackboardValueCondition.d.ts +40 -0
- package/dist/src/npc/behavior-tree/behaviors/conditions/BlackboardValueCondition.js +133 -0
- package/dist/src/npc/behavior-tree/behaviors/conditions/CanSeeTargetCondition.d.ts +29 -0
- package/dist/src/npc/behavior-tree/behaviors/conditions/CanSeeTargetCondition.js +167 -0
- package/dist/src/npc/behavior-tree/behaviors/conditions/HasLastKnownPositionCondition.d.ts +19 -0
- package/dist/src/npc/behavior-tree/behaviors/conditions/HasLastKnownPositionCondition.js +67 -0
- package/dist/src/npc/behavior-tree/behaviors/conditions/HpAbovePercentCondition.d.ts +25 -0
- package/dist/src/npc/behavior-tree/behaviors/conditions/HpAbovePercentCondition.js +94 -0
- package/dist/src/npc/behavior-tree/behaviors/conditions/IsPlayerNearCondition.d.ts +15 -0
- package/dist/src/npc/behavior-tree/behaviors/conditions/IsPlayerNearCondition.js +51 -0
- package/dist/src/npc/behavior-tree/behaviors/conditions/TargetBelowHpPercentCondition.d.ts +19 -0
- package/dist/src/npc/behavior-tree/behaviors/conditions/TargetBelowHpPercentCondition.js +66 -0
- package/dist/src/npc/behavior-tree/behaviors/conditions/TargetInConeCondition.d.ts +26 -0
- package/dist/src/npc/behavior-tree/behaviors/conditions/TargetInConeCondition.js +111 -0
- package/dist/src/npc/behavior-tree/behaviors/conditions/TimeLimitCondition.d.ts +24 -0
- package/dist/src/npc/behavior-tree/behaviors/conditions/TimeLimitCondition.js +81 -0
- package/dist/src/npc/behavior-tree/behaviors/conditions/index.d.ts +8 -0
- package/dist/src/npc/behavior-tree/behaviors/conditions/index.js +15 -0
- package/dist/src/npc/behavior-tree/behaviors/index.d.ts +4 -0
- package/dist/src/npc/behavior-tree/behaviors/index.js +8 -0
- package/dist/src/npc/behavior-tree/blackboard/Blackboard.d.ts +50 -0
- package/dist/src/npc/behavior-tree/blackboard/Blackboard.js +121 -0
- package/dist/src/npc/behavior-tree/blackboard/BlackboardKey.d.ts +35 -0
- package/dist/src/npc/behavior-tree/blackboard/BlackboardKey.js +66 -0
- package/dist/src/npc/behavior-tree/blackboard/index.d.ts +2 -0
- package/dist/src/npc/behavior-tree/blackboard/index.js +3 -0
- package/dist/src/npc/behavior-tree/index.d.ts +9 -0
- package/dist/src/npc/behavior-tree/index.js +19 -0
- package/dist/src/npc/behavior-tree/loader/BehaviorTreeLoader.d.ts +91 -0
- package/dist/src/npc/behavior-tree/loader/BehaviorTreeLoader.js +240 -0
- package/dist/src/npc/behavior-tree/nodes/CompositeNode.d.ts +46 -0
- package/dist/src/npc/behavior-tree/nodes/CompositeNode.js +93 -0
- package/dist/src/npc/behavior-tree/nodes/LeafNode.d.ts +8 -0
- package/dist/src/npc/behavior-tree/nodes/LeafNode.js +11 -0
- package/dist/src/npc/behavior-tree/nodes/composite/SelectorNode.d.ts +15 -0
- package/dist/src/npc/behavior-tree/nodes/composite/SelectorNode.js +61 -0
- package/dist/src/npc/behavior-tree/nodes/composite/SequenceNode.d.ts +15 -0
- package/dist/src/npc/behavior-tree/nodes/composite/SequenceNode.js +61 -0
- package/dist/src/physics/BasePhysicsEngine.d.ts +389 -0
- package/dist/src/physics/BasePhysicsEngine.js +1227 -0
- package/dist/src/physics/IPhysicsVehicle.d.ts +150 -0
- package/dist/src/physics/IPhysicsVehicle.js +2 -0
- package/dist/src/physics/PhysicsEngine.d.ts +425 -0
- package/dist/src/physics/PhysicsEngine.js +69 -0
- package/dist/src/physics/PhysicsTypes.d.ts +91 -0
- package/dist/src/physics/PhysicsTypes.js +24 -0
- package/dist/src/physics/implementations/RapierDebugRender.d.ts +24 -0
- package/dist/src/physics/implementations/RapierDebugRender.js +66 -0
- package/dist/src/physics/implementations/RapierPhysics.d.ts +122 -0
- package/dist/src/physics/implementations/RapierPhysics.js +1191 -0
- package/dist/src/physics/implementations/RapierVehicle.d.ts +31 -0
- package/dist/src/physics/implementations/RapierVehicle.js +236 -0
- package/dist/src/physics/index.d.ts +16 -0
- package/dist/src/physics/index.js +17 -0
- package/dist/src/render/EdgeOutlineEffect.d.ts +40 -0
- package/dist/src/render/EdgeOutlineEffect.js +389 -0
- package/dist/src/render/PostProcessManager.d.ts +274 -0
- package/dist/src/render/PostProcessManager.js +932 -0
- package/dist/src/render/Renderer.d.ts +84 -0
- package/dist/src/render/Renderer.js +306 -0
- package/dist/src/render/Texture.d.ts +51 -0
- package/dist/src/render/Texture.js +144 -0
- package/dist/src/render/index.d.ts +20 -0
- package/dist/src/render/index.js +21 -0
- package/dist/src/render/lightmapping/LightmapAtlas.d.ts +52 -0
- package/dist/src/render/lightmapping/LightmapAtlas.js +201 -0
- package/dist/src/render/lightmapping/LightmapBaker.d.ts +99 -0
- package/dist/src/render/lightmapping/LightmapBaker.js +239 -0
- package/dist/src/render/lightmapping/LightmapManager.d.ts +148 -0
- package/dist/src/render/lightmapping/LightmapManager.js +630 -0
- package/dist/src/render/lightmapping/LightmapMaterial.d.ts +26 -0
- package/dist/src/render/lightmapping/LightmapMaterial.js +242 -0
- package/dist/src/render/lightmapping/LightmapSerialization.d.ts +379 -0
- package/dist/src/render/lightmapping/LightmapSerialization.js +244 -0
- package/dist/src/render/lightmapping/LightmapSerializer.d.ts +94 -0
- package/dist/src/render/lightmapping/LightmapSerializer.js +223 -0
- package/dist/src/render/lightmapping/MultiLightmapperMaterial.d.ts +41 -0
- package/dist/src/render/lightmapping/MultiLightmapperMaterial.js +424 -0
- package/dist/src/render/lightmapping/index.d.ts +9 -0
- package/dist/src/render/lightmapping/index.js +6 -0
- package/dist/src/render/postprocessing/EffectPassWrapper.d.ts +17 -0
- package/dist/src/render/postprocessing/EffectPassWrapper.js +47 -0
- package/dist/src/render/postprocessing/ObjectOutlineEffect.d.ts +49 -0
- package/dist/src/render/postprocessing/ObjectOutlineEffect.js +364 -0
- package/dist/src/render/postprocessing/index.d.ts +2 -0
- package/dist/src/render/postprocessing/index.js +3 -0
- package/dist/src/runtime/GameRuntime.d.ts +25 -0
- package/dist/src/runtime/GameRuntime.js +131 -0
- package/dist/src/runtime/InjectedDependencies.d.ts +13 -0
- package/dist/src/runtime/InjectedDependencies.js +63 -0
- package/dist/src/runtime/Utils.d.ts +16 -0
- package/dist/src/runtime/Utils.js +113 -0
- package/dist/src/runtime/index.d.ts +4 -0
- package/dist/src/runtime/index.js +5 -0
- package/dist/src/runtime/materials/MatcapShaderMaterial.d.ts +23 -0
- package/dist/src/runtime/materials/MatcapShaderMaterial.js +235 -0
- package/dist/src/runtime/materials/index.d.ts +1 -0
- package/dist/src/runtime/materials/index.js +2 -0
- package/dist/src/scripting/Plugin.d.ts +64 -0
- package/dist/src/scripting/Plugin.js +2 -0
- package/dist/src/scripting/PluginManager.d.ts +40 -0
- package/dist/src/scripting/PluginManager.js +111 -0
- package/dist/src/scripting/index.d.ts +1 -0
- package/dist/src/scripting/index.js +2 -0
- package/dist/src/storage/defaultStorageProvider.d.ts +15 -0
- package/dist/src/storage/defaultStorageProvider.js +73 -0
- package/dist/src/storage/index.d.ts +16 -0
- package/dist/src/storage/index.js +17 -0
- package/dist/src/storage/projectContext.d.ts +80 -0
- package/dist/src/storage/projectContext.js +164 -0
- package/dist/src/storage/storageProvider.d.ts +148 -0
- package/dist/src/storage/storageProvider.js +181 -0
- package/dist/src/systems/ClassRegistry.d.ts +98 -0
- package/dist/src/systems/ClassRegistry.js +478 -0
- package/dist/src/systems/ConsoleManager.d.ts +66 -0
- package/dist/src/systems/ConsoleManager.js +465 -0
- package/dist/src/systems/ConsoleVariableHandler.d.ts +17 -0
- package/dist/src/systems/ConsoleVariableHandler.js +120 -0
- package/dist/src/systems/ConsoleVariableManager.d.ts +128 -0
- package/dist/src/systems/ConsoleVariableManager.js +295 -0
- package/dist/src/systems/InputManager.d.ts +511 -0
- package/dist/src/systems/InputManager.js +1025 -0
- package/dist/src/systems/ObjectNamingSystem.d.ts +9 -0
- package/dist/src/systems/ObjectNamingSystem.js +34 -0
- package/dist/src/systems/Stats.d.ts +36 -0
- package/dist/src/systems/Stats.js +193 -0
- package/dist/src/systems/TimerSystem.d.ts +180 -0
- package/dist/src/systems/TimerSystem.js +292 -0
- package/dist/src/systems/TweenManager.d.ts +57 -0
- package/dist/src/systems/TweenManager.js +107 -0
- package/dist/src/systems/WorldSerialization.d.ts +216 -0
- package/dist/src/systems/WorldSerialization.js +1082 -0
- package/dist/src/systems/collision/CollisionConfig.d.ts +56 -0
- package/dist/src/systems/collision/CollisionConfig.js +249 -0
- package/dist/src/systems/collision/CollisionTypes.d.ts +138 -0
- package/dist/src/systems/collision/CollisionTypes.js +204 -0
- package/dist/src/systems/collision/index.d.ts +15 -0
- package/dist/src/systems/collision/index.js +16 -0
- package/dist/src/systems/index.d.ts +23 -0
- package/dist/src/systems/index.js +24 -0
- package/dist/src/templates/MyActor.d.ts +9 -0
- package/dist/src/templates/MyActor.js +25 -0
- package/dist/src/templates/MySceneComponent.d.ts +9 -0
- package/dist/src/templates/MySceneComponent.js +25 -0
- package/dist/src/ui/LoadingScreen.d.ts +15 -0
- package/dist/src/ui/LoadingScreen.js +103 -0
- package/dist/src/ui/UIElement.d.ts +74 -0
- package/dist/src/ui/UIElement.js +202 -0
- package/dist/src/ui/UILayout.d.ts +126 -0
- package/dist/src/ui/UILayout.js +244 -0
- package/dist/src/ui/UIManager.d.ts +44 -0
- package/dist/src/ui/UIManager.js +148 -0
- package/dist/src/ui/UIResource.d.ts +6 -0
- package/dist/src/ui/UIResource.js +24 -0
- package/dist/src/ui/components/AmmoCounter.d.ts +28 -0
- package/dist/src/ui/components/AmmoCounter.js +125 -0
- package/dist/src/ui/components/BaseUIComponent.d.ts +128 -0
- package/dist/src/ui/components/BaseUIComponent.js +342 -0
- package/dist/src/ui/components/Compass.d.ts +28 -0
- package/dist/src/ui/components/Compass.js +125 -0
- package/dist/src/ui/components/ControlsPanel.d.ts +37 -0
- package/dist/src/ui/components/ControlsPanel.js +47 -0
- package/dist/src/ui/components/Crosshair.d.ts +20 -0
- package/dist/src/ui/components/Crosshair.js +67 -0
- package/dist/src/ui/components/InventoryBar.d.ts +103 -0
- package/dist/src/ui/components/InventoryBar.js +177 -0
- package/dist/src/ui/components/InventoryGrid.d.ts +139 -0
- package/dist/src/ui/components/InventoryGrid.js +407 -0
- package/dist/src/ui/components/Minimap.d.ts +39 -0
- package/dist/src/ui/components/Minimap.js +156 -0
- package/dist/src/ui/components/NumberDisplay.d.ts +51 -0
- package/dist/src/ui/components/NumberDisplay.js +164 -0
- package/dist/src/ui/components/ProgressBar.d.ts +115 -0
- package/dist/src/ui/components/ProgressBar.js +347 -0
- package/dist/src/ui/components/ReloadIndicator.d.ts +29 -0
- package/dist/src/ui/components/ReloadIndicator.js +147 -0
- package/dist/src/ui/components/index.d.ts +11 -0
- package/dist/src/ui/components/index.js +13 -0
- package/dist/src/ui/index.d.ts +21 -0
- package/dist/src/ui/index.js +22 -0
- package/dist/src/ui/ui-loader.d.ts +49 -0
- package/dist/src/ui/ui-loader.js +83 -0
- package/dist/src/utils/Color.d.ts +48 -0
- package/dist/src/utils/Color.js +121 -0
- package/dist/src/utils/Delegate.d.ts +72 -0
- package/dist/src/utils/Delegate.js +102 -0
- package/dist/src/utils/DescriptionHelpers.d.ts +47 -0
- package/dist/src/utils/DescriptionHelpers.js +65 -0
- package/dist/src/utils/EditorClassMeta.d.ts +99 -0
- package/dist/src/utils/EditorClassMeta.js +2 -0
- package/dist/src/utils/GlobalAudioManager.d.ts +141 -0
- package/dist/src/utils/GlobalAudioManager.js +312 -0
- package/dist/src/utils/IAsyncLoadable.d.ts +94 -0
- package/dist/src/utils/IAsyncLoadable.js +52 -0
- package/dist/src/utils/MaterialHelpers.d.ts +67 -0
- package/dist/src/utils/MaterialHelpers.js +278 -0
- package/dist/src/utils/MathHelpers.d.ts +65 -0
- package/dist/src/utils/MathHelpers.js +60 -0
- package/dist/src/utils/NodeJs.d.ts +1 -0
- package/dist/src/utils/NodeJs.js +81 -0
- package/dist/src/utils/Perlin.d.ts +39 -0
- package/dist/src/utils/Perlin.js +380 -0
- package/dist/src/utils/ResourceManager.d.ts +183 -0
- package/dist/src/utils/ResourceManager.js +703 -0
- package/dist/src/utils/SceneGraphUtils.d.ts +26 -0
- package/dist/src/utils/SceneGraphUtils.js +139 -0
- package/dist/src/utils/Spawn.d.ts +27 -0
- package/dist/src/utils/Spawn.js +73 -0
- package/dist/src/utils/ThreeJsExtensions.d.ts +298 -0
- package/dist/src/utils/ThreeJsExtensions.js +817 -0
- package/dist/src/utils/TweenExtensions.d.ts +8 -0
- package/dist/src/utils/TweenExtensions.js +103 -0
- package/dist/src/utils/UserCodeEngine.d.ts +70 -0
- package/dist/src/utils/UserCodeEngine.js +235 -0
- package/dist/src/utils/Utils.d.ts +65 -0
- package/dist/src/utils/Utils.js +296 -0
- package/dist/src/utils/VRButtonUtils.d.ts +21 -0
- package/dist/src/utils/VRButtonUtils.js +88 -0
- package/dist/src/utils/browser-polyfills/module.d.ts +20 -0
- package/dist/src/utils/browser-polyfills/module.js +31 -0
- package/dist/src/utils/browser-polyfills/path.d.ts +69 -0
- package/dist/src/utils/browser-polyfills/path.js +188 -0
- package/dist/src/utils/index.d.ts +29 -0
- package/dist/src/utils/index.js +30 -0
- package/dist/src/utils/serialization/cdo.d.ts +6 -0
- package/dist/src/utils/serialization/cdo.js +74 -0
- package/dist/src/utils/serialization/clsAlias.d.ts +15 -0
- package/dist/src/utils/serialization/clsAlias.js +96 -0
- package/dist/src/utils/serialization/decorator.d.ts +132 -0
- package/dist/src/utils/serialization/decorator.js +66 -0
- package/dist/src/utils/serialization/index.d.ts +7 -0
- package/dist/src/utils/serialization/index.js +8 -0
- package/dist/src/utils/serialization/prefab.d.ts +9 -0
- package/dist/src/utils/serialization/prefab.js +55 -0
- package/dist/src/utils/serialization/prefabManager.d.ts +17 -0
- package/dist/src/utils/serialization/prefabManager.js +84 -0
- package/dist/src/utils/serialization/serializable.d.ts +23 -0
- package/dist/src/utils/serialization/serializable.js +2 -0
- package/dist/src/utils/serialization/serializer.d.ts +126 -0
- package/dist/src/utils/serialization/serializer.js +1032 -0
- package/dist/src/utils/serialization/specialization.d.ts +1 -0
- package/dist/src/utils/serialization/specialization.js +194 -0
- package/dist/src/utils/serialization/specializationUtils.d.ts +27 -0
- package/dist/src/utils/serialization/specializationUtils.js +137 -0
- package/dist/src/vfx/VFXComponent.d.ts +65 -0
- package/dist/src/vfx/VFXComponent.js +202 -0
- package/dist/src/vfx/index.d.ts +11 -0
- package/dist/src/vfx/index.js +11 -0
- package/dist/src/vfx/types.d.ts +146 -0
- package/dist/src/vfx/types.js +146 -0
- package/dist/src/world-commands/common.d.ts +23 -0
- package/dist/src/world-commands/common.js +2 -0
- package/dist/src/world-commands/generate-code.d.ts +3 -0
- package/dist/src/world-commands/generate-code.js +90 -0
- package/dist/src/world-commands/index.d.ts +19 -0
- package/dist/src/world-commands/index.js +20 -0
- package/dist/src/world-commands/place-gltf.d.ts +25 -0
- package/dist/src/world-commands/place-gltf.js +39 -0
- package/dist/src/world-commands/place-prefab.d.ts +25 -0
- package/dist/src/world-commands/place-prefab.js +40 -0
- package/dist/src/world-commands/place-primitive.d.ts +39 -0
- package/dist/src/world-commands/place-primitive.js +100 -0
- package/dist/src/world-commands/remove-actors.d.ts +23 -0
- package/dist/src/world-commands/remove-actors.js +9 -0
- package/dist/src/xr/VRActor.d.ts +46 -0
- package/dist/src/xr/VRActor.js +56 -0
- package/dist/src/xr/VRControllerHandler.d.ts +25 -0
- package/dist/src/xr/VRControllerHandler.js +74 -0
- package/dist/src/xr/VRControllerManager.d.ts +194 -0
- package/dist/src/xr/VRControllerManager.js +539 -0
- package/dist/src/xr/VRDeviceHandler.d.ts +47 -0
- package/dist/src/xr/VRDeviceHandler.js +61 -0
- package/dist/src/xr/VRHandHandler.d.ts +23 -0
- package/dist/src/xr/VRHandHandler.js +161 -0
- package/dist/src/xr/VRInputDevice.d.ts +100 -0
- package/dist/src/xr/VRInputDevice.js +367 -0
- package/dist/src/xr/VRPawn.d.ts +198 -0
- package/dist/src/xr/VRPawn.js +771 -0
- package/dist/src/xr/actor-components/CanvasUIComponent.d.ts +61 -0
- package/dist/src/xr/actor-components/CanvasUIComponent.js +418 -0
- package/dist/src/xr/actor-components/VRBaseComponent.d.ts +15 -0
- package/dist/src/xr/actor-components/VRBaseComponent.js +24 -0
- package/dist/src/xr/actor-components/VRGrabbableComponent.d.ts +31 -0
- package/dist/src/xr/actor-components/VRGrabbableComponent.js +81 -0
- package/dist/src/xr/actor-components/VRInteractableComponent.d.ts +19 -0
- package/dist/src/xr/actor-components/VRInteractableComponent.js +50 -0
- package/dist/src/xr/index.d.ts +17 -0
- package/dist/src/xr/index.js +18 -0
- package/dist/src/xr/pawn-components/VRGrabComponent.d.ts +36 -0
- package/dist/src/xr/pawn-components/VRGrabComponent.js +445 -0
- package/dist/src/xr/pawn-components/VRInteractComponent.d.ts +20 -0
- package/dist/src/xr/pawn-components/VRInteractComponent.js +81 -0
- package/dist/src/xr/pawn-components/VRSnapTurnComponent.d.ts +25 -0
- package/dist/src/xr/pawn-components/VRSnapTurnComponent.js +114 -0
- package/dist/src/xr/pawn-components/VRTeleportComponent.d.ts +42 -0
- package/dist/src/xr/pawn-components/VRTeleportComponent.js +318 -0
- package/dist/src/xr/ui/CanvasColorPicker.d.ts +33 -0
- package/dist/src/xr/ui/CanvasColorPicker.js +188 -0
- package/dist/src/xr/ui/CanvasKeyboard.d.ts +21 -0
- package/dist/src/xr/ui/CanvasKeyboard.js +281 -0
- package/dist/src/xr/ui/CanvasSlider.d.ts +21 -0
- package/dist/src/xr/ui/CanvasSlider.js +112 -0
- package/dist/src/xr/ui/CanvasUI.d.ts +129 -0
- package/dist/src/xr/ui/CanvasUI.js +876 -0
- package/dist/src/xr/ui/index.d.ts +8 -0
- package/dist/src/xr/ui/index.js +9 -0
- package/dist/test/absolute-transform.test.d.ts +1 -0
- package/dist/test/absolute-transform.test.js +796 -0
- package/dist/test/asset-path.test.d.ts +1 -0
- package/dist/test/asset-path.test.js +339 -0
- package/dist/test/component.test.d.ts +1 -0
- package/dist/test/component.test.js +24 -0
- package/dist/test/construction.test.d.ts +1 -0
- package/dist/test/construction.test.js +26 -0
- package/dist/test/default-options-validation.test.d.ts +1 -0
- package/dist/test/default-options-validation.test.js +186 -0
- package/dist/test/metadata.test.d.ts +1 -0
- package/dist/test/metadata.test.js +82 -0
- package/dist/test/nodeStorage.d.ts +19 -0
- package/dist/test/nodeStorage.js +85 -0
- package/dist/test/postprocess-manager.test.d.ts +1 -0
- package/dist/test/postprocess-manager.test.js +77 -0
- package/dist/test/prefab.test.d.ts +1 -0
- package/dist/test/prefab.test.js +903 -0
- package/dist/test/scene-component.test.d.ts +1 -0
- package/dist/test/scene-component.test.js +13 -0
- package/dist/test/scene-graph.test.d.ts +1 -0
- package/dist/test/scene-graph.test.js +163 -0
- package/dist/test/serialization-v1.test.d.ts +15 -0
- package/dist/test/serialization-v1.test.js +1057 -0
- package/dist/test/serialization.test.d.ts +1 -0
- package/dist/test/serialization.test.js +425 -0
- package/dist/test/spawn.test.d.ts +1 -0
- package/dist/test/spawn.test.js +137 -0
- package/dist/test/utils.d.ts +27 -0
- package/dist/test/utils.js +115 -0
- package/docs/agent-instructions.md +49 -0
- package/docs/deprecated/8-guide-user-interface-2.md +600 -0
- package/docs/deprecated/Agents.md +117 -0
- package/docs/deprecated/TELEGRAM_MINIAPP_SUPPORT_PLAN.md +283 -0
- package/docs/deprecated/summary-2.md +101 -0
- package/docs/engine-summary.md +104 -0
- package/docs/guides/0-world-and-gameloop.md +331 -0
- package/docs/guides/1-actors-and-components.md +955 -0
- package/docs/guides/10-camera-system.md +778 -0
- package/docs/guides/11-equipment-and-weapons.md +850 -0
- package/docs/guides/12-threejs-extensions.md +528 -0
- package/docs/guides/13-visual-effects-and-particles.md +530 -0
- package/docs/guides/14-sound-system.md +436 -0
- package/docs/guides/15-global-audio-manager.md +367 -0
- package/docs/guides/15-navigation-and-pathfinding.md +818 -0
- package/docs/guides/16-ragdoll-physics.md +479 -0
- package/docs/guides/17-asset-referencing.md +248 -0
- package/docs/guides/18-lightmapping-system.md +984 -0
- package/docs/guides/19-webxr-virtual-reality.md +367 -0
- package/docs/guides/2-player-inputs-and-controls.md +737 -0
- package/docs/guides/3-physics-and-collisions.md +248 -0
- package/docs/guides/4-visuals-and-rendering.md +946 -0
- package/docs/guides/5-animation.md +310 -0
- package/docs/guides/6-ai-and-behavior-trees.md +1316 -0
- package/docs/guides/7-building-levels.md +211 -0
- package/docs/guides/8-user-interface.md +291 -0
- package/docs/guides/9-multiplayer.md +181 -0
- package/docs/high-level-class-hierarchy.md +218 -0
- package/eslint-rules/constructor-type-consistency.js +251 -0
- package/eslint-rules/default-getter-return-type.js +42 -0
- package/eslint-rules/engine-class-name-consistency.js +62 -0
- package/eslint-rules/no-async-override-mismatch.js +100 -0
- package/eslint-rules/no-default-class-fields.js +66 -0
- package/eslint-rules/no-override-methods.js +158 -0
- package/games/animation-demo.ts +367 -0
- package/games/animation-retarget-demo.ts +553 -0
- package/games/behavior-tree-demo.ts +1774 -0
- package/games/character_animation.ts +194 -0
- package/games/collision-demo.ts +139 -0
- package/games/deprecated/advanced-grid-demo.ts +336 -0
- package/games/deprecated/airplane-demo.ts +156 -0
- package/games/deprecated/character-controller.ts +161 -0
- package/games/deprecated/chase-game.ts +310 -0
- package/games/deprecated/collision-config.ts +317 -0
- package/games/deprecated/door-demo.ts +641 -0
- package/games/deprecated/fps-demo.ts +128 -0
- package/games/deprecated/fps-shotgun-demo.ts +227 -0
- package/games/deprecated/index.ts +25 -0
- package/games/deprecated/lightmapping-demo.ts +1515 -0
- package/games/deprecated/lights-demo.ts +957 -0
- package/games/deprecated/matcap-demo.ts +823 -0
- package/games/deprecated/material-demo-2.ts +582 -0
- package/games/deprecated/material-demo.ts +204 -0
- package/games/deprecated/memory-leak-test.ts +23 -0
- package/games/deprecated/model-stress-test.ts +150 -0
- package/games/deprecated/multiplayer-demo.ts +392 -0
- package/games/deprecated/physics-demo.ts +199 -0
- package/games/deprecated/shadow-demo.ts +435 -0
- package/games/deprecated/shooting-demo.ts +352 -0
- package/games/deprecated/skybox-demo.ts +341 -0
- package/games/deprecated/sound-demo.ts +117 -0
- package/games/deprecated/timer-demo.ts +178 -0
- package/games/deprecated/voxel-demo.ts +50 -0
- package/games/deprecated/world-commands.ts +184 -0
- package/games/deprecated/world-loading.ts +90 -0
- package/games/examples/fps-advanced/const.ts +122 -0
- package/games/examples/fps-advanced/enemies.ts +174 -0
- package/games/examples/fps-advanced/game-mode.ts +347 -0
- package/games/examples/fps-advanced/game.ts +74 -0
- package/games/examples/fps-advanced/pickups.ts +225 -0
- package/games/examples/fps-advanced/player.ts +101 -0
- package/games/examples/fps-advanced/ui/endgame-ui.ts +277 -0
- package/games/examples/fps-advanced/ui/game-hud.ts +211 -0
- package/games/examples/fps-advanced/ui/menu-ui.ts +217 -0
- package/games/examples/fps-advanced/ui/weapon-hud.ts +254 -0
- package/games/examples/fps-advanced/weapons.ts +209 -0
- package/games/examples/index.ts +5 -0
- package/games/examples/plugin-demo/game.ts +175 -0
- package/games/examples/plugin-demo/plugins/dynamic-lighting.ts +146 -0
- package/games/examples/plugin-demo/plugins/instanced-forest.ts +186 -0
- package/games/examples/plugin-demo/plugins/particle-fountain.ts +63 -0
- package/games/examples/plugin-demo/plugins/physics-playground.ts +189 -0
- package/games/examples/plugin-demo/plugins/robot-follower.ts +306 -0
- package/games/examples/plugin-demo/plugins/scatter-models.ts +74 -0
- package/games/examples/plugin-demo/plugins/simple-cube.ts +44 -0
- package/games/examples/plugin-demo/plugins/tic-tac-toe.ts +522 -0
- package/games/examples/plugin-demo/plugins/wobbling-sphere.ts +66 -0
- package/games/examples/side-scroller-advanced/const.ts +88 -0
- package/games/examples/side-scroller-advanced/game-mode.ts +350 -0
- package/games/examples/side-scroller-advanced/game.ts +80 -0
- package/games/examples/side-scroller-advanced/level-generator.ts +384 -0
- package/games/examples/side-scroller-advanced/pickups.ts +132 -0
- package/games/examples/side-scroller-advanced/player.ts +105 -0
- package/games/examples/side-scroller-advanced/ui/endgame-ui.ts +278 -0
- package/games/examples/side-scroller-advanced/ui/game-hud.ts +238 -0
- package/games/examples/side-scroller-advanced/ui/menu-ui.ts +215 -0
- package/games/examples/vehicle/base-vehicle.ts +159 -0
- package/games/examples/vehicle/game.ts +154 -0
- package/games/examples/vehicle/mesh-vehicle.ts +191 -0
- package/games/examples/vehicle/player.ts +86 -0
- package/games/examples/vehicle/primitive-vehicle.ts +266 -0
- package/games/examples/vr-game/VRAttachableCube.ts +39 -0
- package/games/examples/vr-game/VRInteractableCylinder.ts +83 -0
- package/games/examples/vr-game/VRPressableButton.ts +113 -0
- package/games/examples/vr-game/VRProjectileActor.ts +69 -0
- package/games/examples/vr-game/VRRifleActor.ts +138 -0
- package/games/examples/vr-game/game.ts +69 -0
- package/games/examples/vr-game/index.ts +9 -0
- package/games/examples/vr-game/scene.ts +99 -0
- package/games/hand-tracking-demo.ts +71 -0
- package/games/index.ts +21 -0
- package/games/instanced-mesh-demo.ts +429 -0
- package/games/manifold-demo.ts +52 -0
- package/games/navigation-demo.ts +351 -0
- package/games/navmesh-primitives-demo.ts +1252 -0
- package/games/performance-test-demo.ts +237 -0
- package/games/postprocess-demo.ts +867 -0
- package/games/ragdoll-demo-simple.ts +163 -0
- package/games/ragdoll-demo.ts +272 -0
- package/games/swipe-tap-demo.ts +228 -0
- package/games/tween-demo.ts +125 -0
- package/games/ui-demo.ts +1058 -0
- package/games/vfx-demo.ts +922 -0
- package/games/vfx-wawa-demo.ts +540 -0
- package/games/vr-ui-demo-minimal.ts +156 -0
- package/games/vr-ui-demo.ts +972 -0
- package/package.json +104 -0
- package/scripts/build-browser-bundle.ts +75 -0
- package/scripts/check-asset-path.ts +166 -0
- package/scripts/dump-templates.ts +21 -0
- package/scripts/generate-dependencies.ts +145 -0
- package/scripts/generate-prefabs.ts +120 -0
- package/scripts/load-save-world.ts +44 -0
- package/scripts/loc.ts +112 -0
- package/scripts/optimize-glb-wrapper.ts +28 -0
- package/scripts/optimize-glb.ts +352 -0
- package/scripts/session-server.ts +861 -0
- package/scripts/test-world-loading.ts +23 -0
- package/src/actors/Actor.ts +1183 -0
- package/src/actors/GLTFMeshActor.ts +107 -0
- package/src/actors/GlobalParticleManager.ts +460 -0
- package/src/actors/Pawn.ts +370 -0
- package/src/actors/PlayerController.ts +646 -0
- package/src/actors/PlayerStart.ts +47 -0
- package/src/actors/Projectile.ts +179 -0
- package/src/actors/RagdollTestActor.ts +153 -0
- package/src/actors/ThirdPersonCharacterPawn.ts +139 -0
- package/src/actors/index.ts +21 -0
- package/src/animation/AnimationClipCache.ts +86 -0
- package/src/animation/AnimationRetargeting.ts +566 -0
- package/src/animation/SkeletonProfile.ts +137 -0
- package/src/animation/index.ts +14 -0
- package/src/animation/retargeting.ts +866 -0
- package/src/components/CharacterStatsComponent.ts +199 -0
- package/src/components/CollisionShapeComponent.ts +256 -0
- package/src/components/Component.ts +111 -0
- package/src/components/FollowComponent.ts +149 -0
- package/src/components/PrimitiveComponent.ts +368 -0
- package/src/components/ResetPositionComponent.ts +175 -0
- package/src/components/SceneComponent.ts +628 -0
- package/src/components/audio/SoundComponent.ts +385 -0
- package/src/components/audio/index.ts +11 -0
- package/src/components/csg/CSGCombiner.ts +268 -0
- package/src/components/csg/CSGShapes.ts +344 -0
- package/src/components/csg/index.ts +12 -0
- package/src/components/gameplay/BaseWeaponComponent.ts +597 -0
- package/src/components/gameplay/DoorComponent.ts +930 -0
- package/src/components/gameplay/Equipment.ts +30 -0
- package/src/components/gameplay/GenericEquipment.ts +96 -0
- package/src/components/gameplay/InstantHitWeaponComponent.ts +248 -0
- package/src/components/gameplay/PickupComponent.ts +473 -0
- package/src/components/gameplay/ProjectileWeaponComponent.ts +114 -0
- package/src/components/gameplay/ShotgunComponent.ts +220 -0
- package/src/components/gameplay/SwitchComponent.ts +466 -0
- package/src/components/gameplay/TriggerZoneComponent.ts +346 -0
- package/src/components/gameplay/index.ts +20 -0
- package/src/components/index.ts +19 -0
- package/src/components/lights/AmbientLightComponent.ts +72 -0
- package/src/components/lights/DirectionalLightComponent.ts +163 -0
- package/src/components/lights/HemisphereLightComponent.ts +132 -0
- package/src/components/lights/LightComponent.ts +351 -0
- package/src/components/lights/PointLightComponent.ts +115 -0
- package/src/components/lights/RectAreaLightComponent.ts +151 -0
- package/src/components/lights/SpotLightComponent.ts +193 -0
- package/src/components/lights/index.ts +17 -0
- package/src/components/movement/AerialMovementComponent.ts +348 -0
- package/src/components/movement/AirplaneMovementComponent.ts +236 -0
- package/src/components/movement/BasePawnMovementComponent.ts +297 -0
- package/src/components/movement/CharacterMovementComponent.ts +446 -0
- package/src/components/movement/DirectionalCharacterMovementComponent.ts +79 -0
- package/src/components/movement/NpcMovementComponent.ts +930 -0
- package/src/components/movement/PathMovementComponent.ts +190 -0
- package/src/components/movement/TopDownMovementComponent.ts +88 -0
- package/src/components/movement/TweenMovementComponent.ts +386 -0
- package/src/components/movement/VehicleMovementComponent.ts +469 -0
- package/src/components/movement/index.ts +19 -0
- package/src/components/physics/RagdollComponent.ts +730 -0
- package/src/components/visual/AnimationComponent.ts +208 -0
- package/src/components/visual/AnimationStateMachineComponent.ts +1079 -0
- package/src/components/visual/BaseInstancedMeshComponent.ts +904 -0
- package/src/components/visual/BillboardComponent.ts +127 -0
- package/src/components/visual/EditorOnlyMeshComponent.ts +54 -0
- package/src/components/visual/FogComponent.ts +131 -0
- package/src/components/visual/GLTFMeshComponent.ts +444 -0
- package/src/components/visual/InstancedGltfMeshComponent.ts +215 -0
- package/src/components/visual/InstancedMeshComponent.ts +118 -0
- package/src/components/visual/MeshComponent.ts +224 -0
- package/src/components/visual/ParticleEmitterComponent.ts +628 -0
- package/src/components/visual/SkyboxComponent.ts +381 -0
- package/src/components/visual/TerrainMeshComponent.ts +346 -0
- package/src/components/visual/UI3DComponent.ts +264 -0
- package/src/components/visual/index.ts +23 -0
- package/src/components/voxel/MagicaVoxelLoader.ts +184 -0
- package/src/components/voxel/VoxelMeshComponent.ts +274 -0
- package/src/components/voxel/index.ts +3 -0
- package/src/const.ts +68 -0
- package/src/csg/CSGUtils.ts +771 -0
- package/src/csg/ManifoldWrapper.ts +704 -0
- package/src/csg/index.ts +13 -0
- package/src/dependencies.ts +76 -0
- package/src/game/GameBuilder.ts +280 -0
- package/src/game/GameLoop.ts +614 -0
- package/src/game/GameMode.ts +127 -0
- package/src/game/Playable.ts +84 -0
- package/src/game/World.ts +1430 -0
- package/src/game/index.ts +18 -0
- package/src/global.d.ts +11 -0
- package/src/index.ts +39 -0
- package/src/materials.ts +181 -0
- package/src/multiplayer/MovementPrediction.ts +202 -0
- package/src/multiplayer/NetWorld.ts +920 -0
- package/src/multiplayer/README.md +349 -0
- package/src/multiplayer/implementations/MemorySession.ts +112 -0
- package/src/multiplayer/implementations/WebSocketSession.ts +468 -0
- package/src/multiplayer/implementations/index.ts +14 -0
- package/src/multiplayer/index.ts +16 -0
- package/src/multiplayer/interface.ts +174 -0
- package/src/navigation/NavigationServer.ts +170 -0
- package/src/navigation/RecastNavigationServer.ts +370 -0
- package/src/navigation/index.ts +17 -0
- package/src/npc/behavior-tree/BehaviorNode.ts +191 -0
- package/src/npc/behavior-tree/BehaviorTreeComponent.ts +351 -0
- package/src/npc/behavior-tree/behaviors/BehaviorAction.ts +97 -0
- package/src/npc/behavior-tree/behaviors/ConditionEvaluator.ts +128 -0
- package/src/npc/behavior-tree/behaviors/actions/aerial/AerialMoveToTargetAction.ts +128 -0
- package/src/npc/behavior-tree/behaviors/actions/aerial/AerialSearchAction.ts +159 -0
- package/src/npc/behavior-tree/behaviors/actions/aerial/AerialTrackTargetAction.ts +76 -0
- package/src/npc/behavior-tree/behaviors/actions/aerial/AerialWanderAction.ts +160 -0
- package/src/npc/behavior-tree/behaviors/actions/aerial/index.ts +5 -0
- package/src/npc/behavior-tree/behaviors/actions/combat/MeleeAttackAction.ts +151 -0
- package/src/npc/behavior-tree/behaviors/actions/combat/ShootAction.ts +158 -0
- package/src/npc/behavior-tree/behaviors/actions/combat/index.ts +3 -0
- package/src/npc/behavior-tree/behaviors/actions/ground/FleeFromTargetAction.ts +157 -0
- package/src/npc/behavior-tree/behaviors/actions/ground/FollowActorAction.ts +131 -0
- package/src/npc/behavior-tree/behaviors/actions/ground/MoveToPositionAction.ts +99 -0
- package/src/npc/behavior-tree/behaviors/actions/ground/SetNextWaypointAction.ts +114 -0
- package/src/npc/behavior-tree/behaviors/actions/ground/WanderAction.ts +146 -0
- package/src/npc/behavior-tree/behaviors/actions/ground/index.ts +6 -0
- package/src/npc/behavior-tree/behaviors/actions/index.ts +13 -0
- package/src/npc/behavior-tree/behaviors/actions/utility/CalculateTacticalPositionAction.ts +117 -0
- package/src/npc/behavior-tree/behaviors/actions/utility/LookAtTargetAction.ts +136 -0
- package/src/npc/behavior-tree/behaviors/actions/utility/WaitAction.ts +70 -0
- package/src/npc/behavior-tree/behaviors/actions/utility/index.ts +4 -0
- package/src/npc/behavior-tree/behaviors/conditions/BlackboardValueCondition.ts +144 -0
- package/src/npc/behavior-tree/behaviors/conditions/CanSeeTargetCondition.ts +171 -0
- package/src/npc/behavior-tree/behaviors/conditions/HasLastKnownPositionCondition.ts +63 -0
- package/src/npc/behavior-tree/behaviors/conditions/HpAbovePercentCondition.ts +83 -0
- package/src/npc/behavior-tree/behaviors/conditions/IsPlayerNearCondition.ts +49 -0
- package/src/npc/behavior-tree/behaviors/conditions/TargetBelowHpPercentCondition.ts +61 -0
- package/src/npc/behavior-tree/behaviors/conditions/TargetInConeCondition.ts +106 -0
- package/src/npc/behavior-tree/behaviors/conditions/TimeLimitCondition.ts +65 -0
- package/src/npc/behavior-tree/behaviors/conditions/index.ts +19 -0
- package/src/npc/behavior-tree/behaviors/index.ts +9 -0
- package/src/npc/behavior-tree/blackboard/Blackboard.ts +127 -0
- package/src/npc/behavior-tree/blackboard/BlackboardKey.ts +59 -0
- package/src/npc/behavior-tree/blackboard/index.ts +2 -0
- package/src/npc/behavior-tree/index.ts +27 -0
- package/src/npc/behavior-tree/loader/BehaviorTreeLoader.ts +296 -0
- package/src/npc/behavior-tree/nodes/CompositeNode.ts +100 -0
- package/src/npc/behavior-tree/nodes/LeafNode.ts +11 -0
- package/src/npc/behavior-tree/nodes/composite/SelectorNode.ts +56 -0
- package/src/npc/behavior-tree/nodes/composite/SequenceNode.ts +56 -0
- package/src/physics/BasePhysicsEngine.ts +1486 -0
- package/src/physics/IPhysicsVehicle.ts +162 -0
- package/src/physics/PhysicsEngine.ts +517 -0
- package/src/physics/PhysicsTypes.ts +116 -0
- package/src/physics/implementations/RapierDebugRender.ts +55 -0
- package/src/physics/implementations/RapierPhysics.ts +1419 -0
- package/src/physics/implementations/RapierVehicle.ts +267 -0
- package/src/physics/index.ts +16 -0
- package/src/render/EdgeOutlineEffect.ts +365 -0
- package/src/render/PostProcessManager.ts +1025 -0
- package/src/render/Renderer.ts +310 -0
- package/src/render/Texture.ts +140 -0
- package/src/render/index.ts +22 -0
- package/src/render/lightmapping/LightmapAtlas.ts +248 -0
- package/src/render/lightmapping/LightmapBaker.ts +333 -0
- package/src/render/lightmapping/LightmapManager.ts +752 -0
- package/src/render/lightmapping/LightmapMaterial.ts +283 -0
- package/src/render/lightmapping/LightmapSerialization.ts +336 -0
- package/src/render/lightmapping/LightmapSerializer.ts +309 -0
- package/src/render/lightmapping/MultiLightmapperMaterial.ts +484 -0
- package/src/render/lightmapping/index.ts +18 -0
- package/src/render/postprocessing/EffectPassWrapper.ts +47 -0
- package/src/render/postprocessing/ObjectOutlineEffect.ts +356 -0
- package/src/render/postprocessing/index.ts +2 -0
- package/src/runtime/GameRuntime.ts +153 -0
- package/src/runtime/InjectedDependencies.ts +70 -0
- package/src/runtime/Utils.ts +146 -0
- package/src/runtime/index.ts +4 -0
- package/src/runtime/materials/MatcapShaderMaterial.ts +242 -0
- package/src/runtime/materials/index.ts +1 -0
- package/src/scripting/Plugin.ts +67 -0
- package/src/scripting/PluginManager.ts +99 -0
- package/src/scripting/index.ts +1 -0
- package/src/storage/defaultStorageProvider.ts +95 -0
- package/src/storage/index.ts +16 -0
- package/src/storage/projectContext.ts +176 -0
- package/src/storage/storageProvider.ts +271 -0
- package/src/systems/ClassRegistry.ts +484 -0
- package/src/systems/ConsoleManager.ts +484 -0
- package/src/systems/ConsoleVariableHandler.ts +105 -0
- package/src/systems/ConsoleVariableManager.ts +288 -0
- package/src/systems/InputManager.ts +1255 -0
- package/src/systems/ObjectNamingSystem.ts +30 -0
- package/src/systems/Stats.ts +178 -0
- package/src/systems/TimerSystem.ts +353 -0
- package/src/systems/TweenManager.ts +107 -0
- package/src/systems/WorldSerialization.ts +1211 -0
- package/src/systems/collision/CollisionConfig.ts +281 -0
- package/src/systems/collision/CollisionTypes.ts +185 -0
- package/src/systems/collision/index.ts +15 -0
- package/src/systems/index.ts +23 -0
- package/src/templates/MyActor.ts +29 -0
- package/src/templates/MySceneComponent.ts +29 -0
- package/src/templates/README.md +1 -0
- package/src/types/rapier-es.d.ts +16 -0
- package/src/types/stats.js.d.ts +22 -0
- package/src/ui/LoadingScreen.ts +110 -0
- package/src/ui/UIElement.ts +224 -0
- package/src/ui/UILayout.ts +269 -0
- package/src/ui/UIManager.ts +161 -0
- package/src/ui/UIResource.ts +20 -0
- package/src/ui/components/AmmoCounter.ts +126 -0
- package/src/ui/components/BaseUIComponent.md +296 -0
- package/src/ui/components/BaseUIComponent.ts +390 -0
- package/src/ui/components/Compass.ts +144 -0
- package/src/ui/components/ControlsPanel.ts +62 -0
- package/src/ui/components/Crosshair.ts +76 -0
- package/src/ui/components/InventoryBar.ts +224 -0
- package/src/ui/components/InventoryGrid.ts +471 -0
- package/src/ui/components/Minimap.ts +181 -0
- package/src/ui/components/NumberDisplay.ts +198 -0
- package/src/ui/components/ProgressBar.ts +403 -0
- package/src/ui/components/ReloadIndicator.ts +159 -0
- package/src/ui/components/index.ts +12 -0
- package/src/ui/index.ts +21 -0
- package/src/ui/ui-loader.ts +87 -0
- package/src/utils/Color.ts +51 -0
- package/src/utils/Delegate.ts +112 -0
- package/src/utils/DescriptionHelpers.ts +93 -0
- package/src/utils/EditorClassMeta.ts +91 -0
- package/src/utils/GlobalAudioManager.ts +370 -0
- package/src/utils/IAsyncLoadable.ts +122 -0
- package/src/utils/MaterialHelpers.ts +321 -0
- package/src/utils/MathHelpers.ts +79 -0
- package/src/utils/NodeJs.ts +79 -0
- package/src/utils/Perlin.ts +346 -0
- package/src/utils/ResourceManager.ts +716 -0
- package/src/utils/SceneGraphUtils.ts +173 -0
- package/src/utils/Spawn.ts +93 -0
- package/src/utils/ThreeJsExtensions.ts +1200 -0
- package/src/utils/TweenExtensions.ts +124 -0
- package/src/utils/UserCodeEngine.ts +243 -0
- package/src/utils/Utils.ts +328 -0
- package/src/utils/VRButtonUtils.ts +125 -0
- package/src/utils/browser-polyfills/module.ts +36 -0
- package/src/utils/browser-polyfills/path.ts +232 -0
- package/src/utils/index.ts +29 -0
- package/src/utils/serialization/cdo.ts +87 -0
- package/src/utils/serialization/clsAlias.ts +92 -0
- package/src/utils/serialization/decorator.ts +176 -0
- package/src/utils/serialization/index.ts +7 -0
- package/src/utils/serialization/prefab.ts +78 -0
- package/src/utils/serialization/prefabManager.ts +88 -0
- package/src/utils/serialization/serializable.ts +28 -0
- package/src/utils/serialization/serializer.ts +1111 -0
- package/src/utils/serialization/specialization.ts +224 -0
- package/src/utils/serialization/specializationUtils.ts +185 -0
- package/src/vfx/VFXComponent.ts +206 -0
- package/src/vfx/index.ts +17 -0
- package/src/vfx/types.ts +287 -0
- package/src/vfx/wawa-vfx-reference.md +399 -0
- package/src/world-commands/common.ts +25 -0
- package/src/world-commands/generate-code.ts +99 -0
- package/src/world-commands/index.ts +19 -0
- package/src/world-commands/place-gltf.ts +63 -0
- package/src/world-commands/place-prefab.ts +62 -0
- package/src/world-commands/place-primitive.ts +128 -0
- package/src/world-commands/remove-actors.ts +32 -0
- package/src/xr/VRActor.ts +71 -0
- package/src/xr/VRControllerHandler.ts +87 -0
- package/src/xr/VRControllerManager.ts +559 -0
- package/src/xr/VRDeviceHandler.ts +77 -0
- package/src/xr/VRHandHandler.ts +166 -0
- package/src/xr/VRInputDevice.ts +374 -0
- package/src/xr/VRPawn.ts +815 -0
- package/src/xr/actor-components/CanvasUIComponent.ts +425 -0
- package/src/xr/actor-components/VRBaseComponent.ts +26 -0
- package/src/xr/actor-components/VRGrabbableComponent.ts +73 -0
- package/src/xr/actor-components/VRInteractableComponent.ts +43 -0
- package/src/xr/index.ts +17 -0
- package/src/xr/pawn-components/VRGrabComponent.ts +435 -0
- package/src/xr/pawn-components/VRInteractComponent.ts +77 -0
- package/src/xr/pawn-components/VRSnapTurnComponent.ts +103 -0
- package/src/xr/pawn-components/VRTeleportComponent.ts +284 -0
- package/src/xr/ui/CanvasColorPicker.ts +172 -0
- package/src/xr/ui/CanvasKeyboard.ts +283 -0
- package/src/xr/ui/CanvasSlider.ts +83 -0
- package/src/xr/ui/CanvasUI.ts +879 -0
- package/src/xr/ui/index.ts +9 -0
|
@@ -0,0 +1,1486 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BasePhysicsEngine supplies reusable logic for multiple physics backends.
|
|
3
|
+
*
|
|
4
|
+
* This class manages the collection of physics bodies associated with scene
|
|
5
|
+
* components and dispatches collision events back into Genesys. It defines a
|
|
6
|
+
* number of abstract `do*` methods which concrete engines implement to hook
|
|
7
|
+
* into their specific library. The engine also handles mesh simplification,
|
|
8
|
+
* terrain height field generation and character controller creation so derived
|
|
9
|
+
* classes only deal with low level data conversions.
|
|
10
|
+
*
|
|
11
|
+
* Recommended usage (for humans and AI assistants):
|
|
12
|
+
* - Extend this class when adding support for a new physics library to inherit
|
|
13
|
+
* consistent scene integration and body lifecycle handling.
|
|
14
|
+
* - Call `create` with `PhysicsOptions` to initialize and then `tick` each
|
|
15
|
+
* frame to step the simulation.
|
|
16
|
+
* - Override methods like `doCreateBoxBody` or `doSetVectorParam` to translate
|
|
17
|
+
* requests into library-specific calls.
|
|
18
|
+
* - Use `addComponent` to automatically determine body types from component
|
|
19
|
+
* geometry or collision shapes.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
import * as THREE from 'three';
|
|
23
|
+
|
|
24
|
+
import { CollisionShapeComponent, CollisionShapeType } from '../components/CollisionShapeComponent.js';
|
|
25
|
+
import { PrimitiveComponent } from '../components/PrimitiveComponent.js';
|
|
26
|
+
import { GLTFMeshComponent } from '../components/visual/GLTFMeshComponent.js';
|
|
27
|
+
import { InstancedGltfMeshComponent } from '../components/visual/InstancedGltfMeshComponent.js';
|
|
28
|
+
import { InstancedMeshComponent } from '../components/visual/InstancedMeshComponent.js';
|
|
29
|
+
import { MeshComponent } from '../components/visual/MeshComponent.js';
|
|
30
|
+
import { TerrainMeshComponent } from '../components/visual/TerrainMeshComponent.js';
|
|
31
|
+
import { CollisionConfig } from '../systems/collision/CollisionConfig.js';
|
|
32
|
+
import { CollisionMode } from '../systems/collision/CollisionTypes.js';
|
|
33
|
+
import { ConsoleCommand } from '../systems/ConsoleManager.js';
|
|
34
|
+
import { ensure } from '../utils/Utils.js';
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
import { CollisionEventType } from './PhysicsEngine.js';
|
|
38
|
+
import { CollisionMeshType, PhysicsMotionType } from './PhysicsTypes.js';
|
|
39
|
+
|
|
40
|
+
import type { IPhysicsVehicle } from './IPhysicsVehicle.js';
|
|
41
|
+
import type { PhysicsBodyDesc } from './PhysicsEngine.js';
|
|
42
|
+
import type {
|
|
43
|
+
CharacterControllerOptions,
|
|
44
|
+
CollisionEvent,
|
|
45
|
+
HitTestOptions,
|
|
46
|
+
HitTestResult,
|
|
47
|
+
IPhysicsEngine,
|
|
48
|
+
PhysicsOptions,
|
|
49
|
+
PhysicsScalarParam,
|
|
50
|
+
PhysicsVectorParam,
|
|
51
|
+
PrimitiveComponentPhysicsState,
|
|
52
|
+
RawCollisionEvent,
|
|
53
|
+
VectorArray
|
|
54
|
+
} from './PhysicsEngine.js';
|
|
55
|
+
import type { ComponentPhysicsOptions, VoxelCollisionDesc } from './PhysicsTypes.js';
|
|
56
|
+
import type { BasePawnMovementComponent } from '../components/movement/BasePawnMovementComponent.js';
|
|
57
|
+
import type { SceneComponent } from '../components/SceneComponent.js';
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
export type BaseDesc = {
|
|
61
|
+
motionType: PhysicsMotionType,
|
|
62
|
+
options: ComponentPhysicsOptions,
|
|
63
|
+
worldPos: THREE.Vector3,
|
|
64
|
+
worldQuat: THREE.Quaternion,
|
|
65
|
+
mass: number,
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export type BoxBodyDesc = BaseDesc & {
|
|
69
|
+
size: THREE.Vector3,
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export type MeshBodyDesc = BaseDesc & {
|
|
73
|
+
meshes: THREE.Mesh[],
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export type VoxelBodyDesc = BaseDesc & {
|
|
77
|
+
voxelSize: THREE.Vector3,
|
|
78
|
+
offset?: THREE.Vector3,
|
|
79
|
+
voxels: Float32Array | Int32Array
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export type SphereBodyDesc = BaseDesc & {
|
|
83
|
+
center: THREE.Vector3,
|
|
84
|
+
radius: number,
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export type CylinderBodyDesc = BaseDesc & {
|
|
88
|
+
height: number,
|
|
89
|
+
radius: number,
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export type CapsuleBodyDesc = BaseDesc & {
|
|
93
|
+
height: number,
|
|
94
|
+
radius: number,
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export type ConeBodyDesc = BaseDesc & {
|
|
98
|
+
height: number,
|
|
99
|
+
radius: number,
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export type HeightFieldBodyDesc = BaseDesc & {
|
|
103
|
+
width: number,
|
|
104
|
+
depth: number,
|
|
105
|
+
widthPixels: number,
|
|
106
|
+
depthPixels: number,
|
|
107
|
+
heights: Float32Array,
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export enum JointType {
|
|
111
|
+
Spherical = 'spherical',
|
|
112
|
+
Fixed = 'fixed',
|
|
113
|
+
Revolute = 'revolute',
|
|
114
|
+
Prismatic = 'prismatic'
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export interface JointDesc {
|
|
118
|
+
type: JointType;
|
|
119
|
+
componentA: PrimitiveComponent;
|
|
120
|
+
componentB: PrimitiveComponent;
|
|
121
|
+
anchorA: THREE.Vector3;
|
|
122
|
+
anchorB: THREE.Vector3;
|
|
123
|
+
axis?: THREE.Vector3; // For revolute/prismatic joints
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export abstract class BasePhysicsEngine<TRecord, TCharacterControllerRecord, TJointRecord = any> implements IPhysicsEngine {
|
|
127
|
+
protected initialized: boolean = false;
|
|
128
|
+
protected bodies: Map<PrimitiveComponent, TRecord[]> = new Map();
|
|
129
|
+
protected characterControllers: Map<BasePawnMovementComponent, TCharacterControllerRecord> = new Map();
|
|
130
|
+
protected joints: Map<string, TJointRecord> = new Map(); // Using string ID as key
|
|
131
|
+
protected directBodies: Map<string, TRecord> = new Map(); // Direct physics bodies by handle
|
|
132
|
+
protected options: PhysicsOptions | null = null;
|
|
133
|
+
private nextJointId: number = 0;
|
|
134
|
+
private nextBodyId: number = 0;
|
|
135
|
+
|
|
136
|
+
// Reference to the game world that owns this physics engine
|
|
137
|
+
protected gameWorld: any;
|
|
138
|
+
|
|
139
|
+
protected physicMeshesCache: Map<number, THREE.Mesh[]> = new Map();
|
|
140
|
+
|
|
141
|
+
constructor(gameWorld?: any) {
|
|
142
|
+
this.gameWorld = gameWorld;
|
|
143
|
+
if (gameWorld) {
|
|
144
|
+
gameWorld?.consoleManager.addCommandHandler(this);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
public performHitTest(options: HitTestOptions): HitTestResult[] {
|
|
149
|
+
return []; // Override in derived class
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
@ConsoleCommand('debugphysics', 'Enable/disable physics debug visualization (usage: debugphysics <true | false>)')
|
|
153
|
+
private debugPhysics(enable: string = ''): string {
|
|
154
|
+
// Use truthy value to enable debug visualization
|
|
155
|
+
if (enable === 'true' || enable === '1') {
|
|
156
|
+
this.setDebugRendererEnabled(true);
|
|
157
|
+
} else {
|
|
158
|
+
this.setDebugRendererEnabled(false);
|
|
159
|
+
}
|
|
160
|
+
return 'Debug physics ' + (this.isDebugRendererEnabled() ? 'enabled' : 'disabled');
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Initializes the physics engine with the specified options
|
|
166
|
+
* @param options Physics engine configuration options
|
|
167
|
+
* @returns Promise that resolves to true if initialization was successful
|
|
168
|
+
*/
|
|
169
|
+
public async create(options: PhysicsOptions): Promise<boolean> {
|
|
170
|
+
if (!ensure(!this.initialized)) {
|
|
171
|
+
return false;
|
|
172
|
+
}
|
|
173
|
+
this.initialized = await this.doCreate(options);
|
|
174
|
+
this.options = options;
|
|
175
|
+
return this.initialized;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Get the physics engine options
|
|
180
|
+
* @returns Physics engine options
|
|
181
|
+
*/
|
|
182
|
+
public getOptions(): PhysicsOptions | null {
|
|
183
|
+
return this.options;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Destroys the physics engine and cleans up resources
|
|
188
|
+
*/
|
|
189
|
+
public destroy(): void {
|
|
190
|
+
if (!this.initialized) {
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// Clean up all joints before destroying the physics world
|
|
195
|
+
for (const [jointId, jointRecord] of this.joints) {
|
|
196
|
+
this.doRemoveJoint(jointRecord);
|
|
197
|
+
}
|
|
198
|
+
this.joints.clear();
|
|
199
|
+
|
|
200
|
+
// Clean up all direct physics bodies
|
|
201
|
+
for (const [handle, record] of this.directBodies) {
|
|
202
|
+
this.doRemoveDirectBody(record);
|
|
203
|
+
}
|
|
204
|
+
this.directBodies.clear();
|
|
205
|
+
|
|
206
|
+
if (this.doDestroy()) {
|
|
207
|
+
this.initialized = false;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
if (this.gameWorld) {
|
|
211
|
+
this.gameWorld?.consoleManager.removeCommandHandler(this);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Updates the physics simulation by one time step
|
|
217
|
+
* @param deltaTime Time elapsed since last tick in seconds
|
|
218
|
+
*/
|
|
219
|
+
public tick(deltaTime: number): void {
|
|
220
|
+
if (!this.initialized) {
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
// update component transform to the physics just before ticking
|
|
225
|
+
for (const component of this.bodies.keys()) {
|
|
226
|
+
component.syncToPhysics(this);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
this.doTick(deltaTime);
|
|
230
|
+
this.processCollisionEvents();
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
private cloneMesh(originalMesh: THREE.Mesh): THREE.Mesh {
|
|
234
|
+
const clonedMesh = new THREE.Mesh(
|
|
235
|
+
originalMesh.geometry.clone(),
|
|
236
|
+
originalMesh.material
|
|
237
|
+
);
|
|
238
|
+
return clonedMesh;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Processes a GLTF model to extract physics meshes with proper scaling and transforms
|
|
243
|
+
* @param model The GLTF scene model
|
|
244
|
+
* @returns Array of processed physics meshes. The meshes are always meshes at Identity, i.e. sitting at origin, no rotation, no scale
|
|
245
|
+
*/
|
|
246
|
+
private processGLTFModelForPhysics(model: THREE.Object3D): THREE.Mesh[] {
|
|
247
|
+
// Collect all physics meshes
|
|
248
|
+
const physicsMeshes: THREE.Mesh[] = [];
|
|
249
|
+
|
|
250
|
+
// we're now using the model template, so that means it is sitting at Identity, and we don't need to do any transforms to it.
|
|
251
|
+
// of course, while this saves the copy, we are expecting they NEVER get modified
|
|
252
|
+
model.traverse((object) => {
|
|
253
|
+
if (object instanceof THREE.Mesh) {
|
|
254
|
+
physicsMeshes.push(object);
|
|
255
|
+
}
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
return physicsMeshes;
|
|
259
|
+
|
|
260
|
+
// // alternative way is to clone all meshes, and apply the local to root transform to each mesh
|
|
261
|
+
// const worldToRootMatrix = model.matrixWorld.clone().invert();
|
|
262
|
+
|
|
263
|
+
// // Process all meshes in the cloned model
|
|
264
|
+
// model.traverse((object) => {
|
|
265
|
+
// if (object instanceof THREE.Mesh) {
|
|
266
|
+
// const physicsMesh = this.cloneMesh(object);
|
|
267
|
+
|
|
268
|
+
// physicsMesh.matrixAutoUpdate = false;
|
|
269
|
+
// // object local to world -> object local to root -> physics mesh is placed at Identity, so an extra `premultiply(Identity);` is omitted
|
|
270
|
+
// const matrix = object.matrixWorld.clone().premultiply(worldToRootMatrix);
|
|
271
|
+
// physicsMesh.matrix.copy(matrix);
|
|
272
|
+
// physicsMesh.updateMatrixWorld(true);
|
|
273
|
+
|
|
274
|
+
// physicsMeshes.push(physicsMesh);
|
|
275
|
+
// }
|
|
276
|
+
// });
|
|
277
|
+
|
|
278
|
+
// // caching in this.physicMeshesCache
|
|
279
|
+
|
|
280
|
+
// return physicsMeshes;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* Processes a model to extract physics mesh with proper scaling and transforms
|
|
285
|
+
* @param model The scene model
|
|
286
|
+
* @param worldScale The world scale to apply
|
|
287
|
+
* @returns Array of processed physics meshes. The meshes are always meshes at Identity, i.e. sitting at origin, no rotation, no scale
|
|
288
|
+
*/
|
|
289
|
+
private processModelForPhysics(mesh: THREE.Mesh): THREE.Mesh {
|
|
290
|
+
const cacheKey = mesh.id;
|
|
291
|
+
if (this.physicMeshesCache.has(cacheKey)) {
|
|
292
|
+
return this.physicMeshesCache.get(cacheKey)![0];
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
const physicsMesh = this.cloneMesh(mesh);
|
|
296
|
+
physicsMesh.matrixAutoUpdate = false;
|
|
297
|
+
physicsMesh.matrix.copy(new THREE.Matrix4());
|
|
298
|
+
physicsMesh.updateMatrixWorld(true);
|
|
299
|
+
|
|
300
|
+
// cache it so we have the same physicsMesh always, which is good for cache of collider desc
|
|
301
|
+
this.physicMeshesCache.set(cacheKey, [physicsMesh]);
|
|
302
|
+
|
|
303
|
+
return physicsMesh;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* Adds a scene component to the physics simulation
|
|
308
|
+
* @param component The scene component to add
|
|
309
|
+
* @returns The motion type assigned to the component, or null if addition failed
|
|
310
|
+
*/
|
|
311
|
+
public addComponent(component: PrimitiveComponent): PhysicsMotionType | null {
|
|
312
|
+
if (!ensure(this.initialized)) {
|
|
313
|
+
return null;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
if (!ensure(!this.bodies.has(component))) {
|
|
317
|
+
return null;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
const physicsOptions = component.getPhysicsOptions();
|
|
321
|
+
|
|
322
|
+
const collisionConfig = CollisionConfig.getInstance();
|
|
323
|
+
const collisionProfile = collisionConfig.profiles.find(profile => profile.name === physicsOptions?.collisionProfile);
|
|
324
|
+
if (collisionProfile?.mode === CollisionMode.NoCollision) {
|
|
325
|
+
return null;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
// FIXME: deprecate? Or should it be a combination of enabled and collisionProfile?
|
|
329
|
+
if (!physicsOptions?.enabled) {
|
|
330
|
+
return null;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
let motionType: PhysicsMotionType | null = null;
|
|
334
|
+
const worldPos = new THREE.Vector3();
|
|
335
|
+
const worldQuat = new THREE.Quaternion();
|
|
336
|
+
const worldScale = new THREE.Vector3();
|
|
337
|
+
component.getWorldPosition(worldPos);
|
|
338
|
+
component.getWorldQuaternion(worldQuat);
|
|
339
|
+
component.getWorldScale(worldScale);
|
|
340
|
+
|
|
341
|
+
let records: TRecord[] = [];
|
|
342
|
+
let record: TRecord | null = null;
|
|
343
|
+
if (component instanceof(MeshComponent)) {
|
|
344
|
+
[record, motionType] = this.createMeshComponentRecord(component, physicsOptions, worldPos, worldQuat, worldScale);
|
|
345
|
+
} else if (component instanceof(CollisionShapeComponent)) {
|
|
346
|
+
[record, motionType] = this.createCollisionShapeRecord(component, physicsOptions, worldPos, worldQuat, worldScale);
|
|
347
|
+
} else if (component instanceof(TerrainMeshComponent)) {
|
|
348
|
+
[record, motionType] = this.createTerrainMeshRecord(component, physicsOptions, worldPos, worldQuat, worldScale);
|
|
349
|
+
} else if (component instanceof(GLTFMeshComponent)) {
|
|
350
|
+
[record, motionType] = this.createGLTFMeshRecord(component, physicsOptions, worldPos, worldQuat, worldScale);
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
if (record) {
|
|
354
|
+
records.push(record);
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
if (component instanceof(InstancedGltfMeshComponent)) {
|
|
358
|
+
[records, motionType] = this.createInstancedGltfMeshRecord(component, physicsOptions, worldPos, worldQuat);
|
|
359
|
+
} else if (component instanceof(InstancedMeshComponent)) {
|
|
360
|
+
[records, motionType] = this.createInstancedMeshRecord(component, physicsOptions, worldPos, worldQuat, worldScale);
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
if (records.length > 0) {
|
|
364
|
+
this.bodies.set(component, records);
|
|
365
|
+
}
|
|
366
|
+
return motionType;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
/**
|
|
370
|
+
* Creates a physics record for a MeshComponent
|
|
371
|
+
* @param component The mesh component
|
|
372
|
+
* @param physicsOptions The physics options
|
|
373
|
+
* @param worldPos The world position
|
|
374
|
+
* @param worldQuat The world quaternion
|
|
375
|
+
* @param worldScale The world scale
|
|
376
|
+
* @returns [record, motionType] tuple
|
|
377
|
+
*/
|
|
378
|
+
protected createMeshComponentRecord(
|
|
379
|
+
component: MeshComponent,
|
|
380
|
+
physicsOptions: ComponentPhysicsOptions | undefined,
|
|
381
|
+
worldPos: THREE.Vector3,
|
|
382
|
+
worldQuat: THREE.Quaternion,
|
|
383
|
+
worldScale: THREE.Vector3,
|
|
384
|
+
): [TRecord | null, PhysicsMotionType | null] {
|
|
385
|
+
const mesh = component.getMesh();
|
|
386
|
+
if (!mesh) {
|
|
387
|
+
return [null, null];
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
const [records, motionType] = this.createMeshRecord(mesh, physicsOptions, [{worldPos, worldQuat, worldScale}], component);
|
|
391
|
+
return [records.length > 0 ? records[0] : null, motionType];
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
|
+
*
|
|
396
|
+
* @param mesh
|
|
397
|
+
* @param physicsOptions
|
|
398
|
+
* @param worldTransforms Array of world position, rotation, scale for each instance,
|
|
399
|
+
* NOTE: for voxels, it creates the voxels collision using the collisionData.voxels per transform.
|
|
400
|
+
* so be aware, most likely you only need to pass the component's transform
|
|
401
|
+
* @param context Optional context object for logging
|
|
402
|
+
* @returns
|
|
403
|
+
*/
|
|
404
|
+
private createMeshRecord(
|
|
405
|
+
mesh: THREE.Mesh,
|
|
406
|
+
physicsOptions: ComponentPhysicsOptions | undefined,
|
|
407
|
+
worldTransforms: {worldPos: THREE.Vector3, worldQuat: THREE.Quaternion, worldScale: THREE.Vector3}[],
|
|
408
|
+
context?: any
|
|
409
|
+
): [(TRecord | null)[], PhysicsMotionType | null] {
|
|
410
|
+
const records: (TRecord | null)[] = [];
|
|
411
|
+
const motionType = physicsOptions?.motionType ?? PhysicsMotionType.Dynamic;
|
|
412
|
+
|
|
413
|
+
const geometry = mesh.geometry;
|
|
414
|
+
if (geometry instanceof(THREE.SphereGeometry) || geometry instanceof(THREE.DodecahedronGeometry) || geometry instanceof(THREE.IcosahedronGeometry)) {
|
|
415
|
+
// sphere
|
|
416
|
+
geometry.computeBoundingSphere();
|
|
417
|
+
for (const {worldPos, worldQuat, worldScale} of worldTransforms) {
|
|
418
|
+
// Apply world scale to radius
|
|
419
|
+
const scaleFactor = Math.max(worldScale.x, worldScale.y, worldScale.z);
|
|
420
|
+
const scaledRadius = geometry.boundingSphere!.radius * scaleFactor;
|
|
421
|
+
const record = this.doCreateSphereBody({
|
|
422
|
+
motionType,
|
|
423
|
+
options: physicsOptions!,
|
|
424
|
+
worldPos,
|
|
425
|
+
worldQuat,
|
|
426
|
+
mass: this.calculateSphereMass(scaledRadius, physicsOptions?.density),
|
|
427
|
+
center: geometry.boundingSphere!.center,
|
|
428
|
+
radius: scaledRadius,
|
|
429
|
+
});
|
|
430
|
+
records.push(record);
|
|
431
|
+
}
|
|
432
|
+
} else if (geometry instanceof(THREE.CapsuleGeometry)) {
|
|
433
|
+
const capsuleParams = (geometry as THREE.CapsuleGeometry).parameters;
|
|
434
|
+
for (const {worldPos, worldQuat, worldScale} of worldTransforms) {
|
|
435
|
+
// Apply world scale
|
|
436
|
+
const height = capsuleParams.height * worldScale.y;
|
|
437
|
+
const radius = capsuleParams.radius * Math.max(worldScale.x, worldScale.z);
|
|
438
|
+
const record = this.doCreateCapsuleBody({
|
|
439
|
+
motionType,
|
|
440
|
+
options: physicsOptions!,
|
|
441
|
+
worldPos,
|
|
442
|
+
worldQuat,
|
|
443
|
+
mass: this.calculateCapsuleMass(height, radius, physicsOptions?.density),
|
|
444
|
+
height,
|
|
445
|
+
radius,
|
|
446
|
+
});
|
|
447
|
+
records.push(record);
|
|
448
|
+
}
|
|
449
|
+
} else if (geometry instanceof(THREE.ConeGeometry)) {
|
|
450
|
+
const coneParams = (geometry as THREE.ConeGeometry).parameters;
|
|
451
|
+
for (const {worldPos, worldQuat, worldScale} of worldTransforms) {
|
|
452
|
+
// Apply world scale
|
|
453
|
+
const height = coneParams.height * worldScale.y;
|
|
454
|
+
const radius = coneParams.radius * Math.max(worldScale.x, worldScale.z);
|
|
455
|
+
const record = this.doCreateConeBody({
|
|
456
|
+
motionType,
|
|
457
|
+
options: physicsOptions!,
|
|
458
|
+
worldPos,
|
|
459
|
+
worldQuat,
|
|
460
|
+
mass: this.calculateConeMass(height, radius, physicsOptions?.density),
|
|
461
|
+
height,
|
|
462
|
+
radius,
|
|
463
|
+
});
|
|
464
|
+
records.push(record);
|
|
465
|
+
}
|
|
466
|
+
} else if (geometry instanceof(THREE.CylinderGeometry)) {
|
|
467
|
+
const cylinderParams = (geometry as THREE.CylinderGeometry).parameters;
|
|
468
|
+
for (const {worldPos, worldQuat, worldScale} of worldTransforms) {
|
|
469
|
+
// Apply world scale
|
|
470
|
+
const height = cylinderParams.height * worldScale.y;
|
|
471
|
+
const radius = (cylinderParams.radiusTop + cylinderParams.radiusBottom) / 2 * Math.max(worldScale.x, worldScale.z);
|
|
472
|
+
const record = this.doCreateCylinderBody({
|
|
473
|
+
motionType,
|
|
474
|
+
options: physicsOptions!,
|
|
475
|
+
worldPos,
|
|
476
|
+
worldQuat,
|
|
477
|
+
mass: this.calculateCylinderMass(height, radius, physicsOptions?.density),
|
|
478
|
+
height,
|
|
479
|
+
radius,
|
|
480
|
+
});
|
|
481
|
+
records.push(record);
|
|
482
|
+
}
|
|
483
|
+
} else if (physicsOptions?.collisionMeshType) {
|
|
484
|
+
// Use mesh collider for arbitrary geometry when collisionMeshType is specified
|
|
485
|
+
console.log('Using mesh collider for', context, 'with type', physicsOptions.collisionMeshType);
|
|
486
|
+
|
|
487
|
+
const isVoxelsCollision = physicsOptions.collisionMeshType === CollisionMeshType.Voxels;
|
|
488
|
+
if (isVoxelsCollision) {
|
|
489
|
+
const voxelsCollisionDesc: VoxelCollisionDesc | undefined = physicsOptions.collisionData?.voxels;
|
|
490
|
+
if (!voxelsCollisionDesc) {
|
|
491
|
+
console.log('No voxel collision data provided, using default single voxel at origin. Either provide collisionData.voxels in constructor, or use `overridePhysicsOptions`/`replacePhysicsOptions` to set it later.');
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
if (worldTransforms.length > 1) {
|
|
495
|
+
console.warn('Multiple transforms provided for voxel mesh collision, each transform will create a full voxel body based on `collisionData.voxels`.');
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
for (const {worldPos, worldQuat, worldScale} of worldTransforms) {
|
|
499
|
+
const voxelSize = voxelsCollisionDesc?.voxelSize ?? new THREE.Vector3(1, 1, 1);
|
|
500
|
+
const voxels: Float32Array | Int32Array = voxelsCollisionDesc?.coordinates ?? new Int32Array([0, 0, 0]);
|
|
501
|
+
const voxelCount = voxels.length / 3;
|
|
502
|
+
const mass = this.calculateBoxMass(voxelSize, physicsOptions?.density) * voxelCount;
|
|
503
|
+
const record = this.doCreateVoxelBody({
|
|
504
|
+
motionType,
|
|
505
|
+
options: physicsOptions!,
|
|
506
|
+
worldPos,
|
|
507
|
+
worldQuat,
|
|
508
|
+
mass,
|
|
509
|
+
voxels,
|
|
510
|
+
voxelSize,
|
|
511
|
+
offset: voxelsCollisionDesc?.offset,
|
|
512
|
+
});
|
|
513
|
+
records.push(record);
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
else {
|
|
517
|
+
// Non-Voxel, build the collision from the mesh geometry
|
|
518
|
+
const physicsMesh = this.processModelForPhysics(mesh);
|
|
519
|
+
const transforms = worldTransforms.map(t => ({position: t.worldPos, rotation: t.worldQuat, scale: t.worldScale}));
|
|
520
|
+
|
|
521
|
+
// Now create the physics body at the component's world position/rotation
|
|
522
|
+
records.push(...this.doCreateMeshBodiesWithTransformOverrides({
|
|
523
|
+
motionType,
|
|
524
|
+
options: physicsOptions!,
|
|
525
|
+
worldPos: new THREE.Vector3(), // transforms will provide the position/rotation overrides
|
|
526
|
+
worldQuat: new THREE.Quaternion(), // same as above
|
|
527
|
+
mass: this.calculateMeshMass(physicsMesh.geometry, physicsOptions?.density),
|
|
528
|
+
meshes: [physicsMesh],
|
|
529
|
+
}, transforms));
|
|
530
|
+
}
|
|
531
|
+
} else {
|
|
532
|
+
// box
|
|
533
|
+
for (const {worldPos, worldQuat, worldScale} of worldTransforms) {
|
|
534
|
+
const size = new THREE.Vector3();
|
|
535
|
+
mesh.geometry.computeBoundingBox();
|
|
536
|
+
mesh.geometry.boundingBox!.getSize(size);
|
|
537
|
+
// Apply world scale to size
|
|
538
|
+
size.multiply(worldScale);
|
|
539
|
+
const record = this.doCreateBoxBody({
|
|
540
|
+
motionType,
|
|
541
|
+
options: physicsOptions!,
|
|
542
|
+
worldPos,
|
|
543
|
+
worldQuat,
|
|
544
|
+
mass: this.calculateBoxMass(size, physicsOptions?.density),
|
|
545
|
+
size,
|
|
546
|
+
});
|
|
547
|
+
records.push(record);
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
return [records, motionType];
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
/**
|
|
555
|
+
* Creates a physics record for a CollisionShapeComponent
|
|
556
|
+
* @param component The collision shape component
|
|
557
|
+
* @param physicsOptions The physics options
|
|
558
|
+
* @param worldPos The world position
|
|
559
|
+
* @param worldQuat The world quaternion
|
|
560
|
+
* @param worldScale The world scale
|
|
561
|
+
* @returns [record, motionType] tuple
|
|
562
|
+
*/
|
|
563
|
+
protected createCollisionShapeRecord(
|
|
564
|
+
component: CollisionShapeComponent,
|
|
565
|
+
physicsOptions: ComponentPhysicsOptions | undefined,
|
|
566
|
+
worldPos: THREE.Vector3,
|
|
567
|
+
worldQuat: THREE.Quaternion,
|
|
568
|
+
worldScale: THREE.Vector3
|
|
569
|
+
): [TRecord | null, PhysicsMotionType | null] {
|
|
570
|
+
const motionType = physicsOptions?.motionType ?? PhysicsMotionType.Dynamic;
|
|
571
|
+
const shapeType = component.getShapeType();
|
|
572
|
+
let record: TRecord | null;
|
|
573
|
+
|
|
574
|
+
if (shapeType === CollisionShapeType.Sphere) {
|
|
575
|
+
// For sphere, use the maximum scale component as radius
|
|
576
|
+
// CollisionShapeComponent creates unit-sized shapes that are scaled by the transform
|
|
577
|
+
const radius = Math.max(worldScale.x, worldScale.y, worldScale.z);
|
|
578
|
+
record = this.doCreateSphereBody({
|
|
579
|
+
motionType,
|
|
580
|
+
options: physicsOptions!,
|
|
581
|
+
worldPos,
|
|
582
|
+
worldQuat,
|
|
583
|
+
mass: this.calculateSphereMass(radius, physicsOptions?.density),
|
|
584
|
+
center: new THREE.Vector3(0, 0, 0),
|
|
585
|
+
radius: radius,
|
|
586
|
+
});
|
|
587
|
+
} else {
|
|
588
|
+
// Cube or default
|
|
589
|
+
// CollisionShapeComponent creates unit-sized shapes (1x1x1) that are scaled by the transform
|
|
590
|
+
// So the final size is simply the world scale
|
|
591
|
+
const size = worldScale.clone();
|
|
592
|
+
|
|
593
|
+
record = this.doCreateBoxBody({
|
|
594
|
+
motionType,
|
|
595
|
+
options: physicsOptions!,
|
|
596
|
+
worldPos,
|
|
597
|
+
worldQuat,
|
|
598
|
+
mass: this.calculateBoxMass(size, physicsOptions?.density),
|
|
599
|
+
size,
|
|
600
|
+
});
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
return [record, motionType];
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
/**
|
|
607
|
+
* Creates a physics record for a TerrainMeshComponent
|
|
608
|
+
* @param component The terrain mesh component
|
|
609
|
+
* @param physicsOptions The physics options
|
|
610
|
+
* @param worldPos The world position
|
|
611
|
+
* @param worldQuat The world quaternion
|
|
612
|
+
* @param worldScale The world scale
|
|
613
|
+
* @returns [record, motionType] tuple
|
|
614
|
+
*/
|
|
615
|
+
protected createTerrainMeshRecord(
|
|
616
|
+
component: TerrainMeshComponent,
|
|
617
|
+
physicsOptions: ComponentPhysicsOptions | undefined,
|
|
618
|
+
worldPos: THREE.Vector3,
|
|
619
|
+
worldQuat: THREE.Quaternion,
|
|
620
|
+
worldScale: THREE.Vector3
|
|
621
|
+
): [TRecord | null, PhysicsMotionType | null] {
|
|
622
|
+
const heightMap = component.getHeightMap();
|
|
623
|
+
// Apply world scale to terrain dimensions
|
|
624
|
+
const width = component.options.width * worldScale.x;
|
|
625
|
+
const depth = component.options.depth * worldScale.z;
|
|
626
|
+
const widthPixels = component.options.widthSegments + 1;
|
|
627
|
+
const depthPixels = component.options.depthSegments + 1;
|
|
628
|
+
const numPixels = widthPixels * depthPixels;
|
|
629
|
+
|
|
630
|
+
if (!ensure(heightMap)) {
|
|
631
|
+
return [null, null];
|
|
632
|
+
} else if (!ensure(heightMap!.length === numPixels)) {
|
|
633
|
+
return [null, null];
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
// Scale the height values
|
|
637
|
+
const scaledHeightMap = new Float32Array(heightMap!.length);
|
|
638
|
+
for (let i = 0; i < heightMap!.length; i++) {
|
|
639
|
+
scaledHeightMap[i] = heightMap![i] * worldScale.y;
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
const motionType = PhysicsMotionType.Static;
|
|
643
|
+
const record = this.doCreateHeightFieldBody({
|
|
644
|
+
motionType,
|
|
645
|
+
options: physicsOptions!,
|
|
646
|
+
worldPos,
|
|
647
|
+
worldQuat,
|
|
648
|
+
mass: 0,
|
|
649
|
+
width,
|
|
650
|
+
depth,
|
|
651
|
+
widthPixels,
|
|
652
|
+
depthPixels,
|
|
653
|
+
heights: scaledHeightMap,
|
|
654
|
+
});
|
|
655
|
+
|
|
656
|
+
return [record, motionType];
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
/**
|
|
660
|
+
* Creates a physics record for a GLTFMeshComponent
|
|
661
|
+
* @param component The GLTF mesh component
|
|
662
|
+
* @param physicsOptions The physics options
|
|
663
|
+
* @param worldPos The world position
|
|
664
|
+
* @param worldQuat The world quaternion
|
|
665
|
+
* @param worldScale The world scale
|
|
666
|
+
* @returns [record, motionType] tuple
|
|
667
|
+
*/
|
|
668
|
+
protected createGLTFMeshRecord(
|
|
669
|
+
component: GLTFMeshComponent,
|
|
670
|
+
physicsOptions: ComponentPhysicsOptions,
|
|
671
|
+
worldPos: THREE.Vector3,
|
|
672
|
+
worldQuat: THREE.Quaternion,
|
|
673
|
+
worldScale: THREE.Vector3,
|
|
674
|
+
): [TRecord | null, PhysicsMotionType | null] {
|
|
675
|
+
// Only proceed if the model is loaded
|
|
676
|
+
if (!component.isModelLoaded()) {
|
|
677
|
+
return [null, null];
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
const motionType = physicsOptions?.motionType ?? PhysicsMotionType.Dynamic;
|
|
681
|
+
|
|
682
|
+
const model = component.getModelTemplate(); // use model template as that's the copy living in resource manager and making it easy for cache
|
|
683
|
+
let record: TRecord | null = null;
|
|
684
|
+
const isVoxelsCollision = physicsOptions?.collisionMeshType === CollisionMeshType.Voxels;
|
|
685
|
+
if (isVoxelsCollision) {
|
|
686
|
+
const voxelsCollisionDesc: VoxelCollisionDesc | undefined = physicsOptions.collisionData?.voxels;
|
|
687
|
+
if (!voxelsCollisionDesc) {
|
|
688
|
+
console.log('No voxel collision data provided, using default single voxel at origin. Either provide collisionData.voxels in constructor, or use `overridePhysicsOptions`/`replacePhysicsOptions` to set it later.');
|
|
689
|
+
}
|
|
690
|
+
const voxelSize = voxelsCollisionDesc?.voxelSize ?? new THREE.Vector3(1, 1, 1);
|
|
691
|
+
const voxels: Float32Array | Int32Array = voxelsCollisionDesc?.coordinates ?? new Int32Array([0, 0, 0]);
|
|
692
|
+
const voxelCount = voxels.length / 3;
|
|
693
|
+
const mass = this.calculateBoxMass(voxelSize, physicsOptions?.density) * voxelCount;
|
|
694
|
+
record = this.doCreateVoxelBody({
|
|
695
|
+
motionType,
|
|
696
|
+
options: physicsOptions!,
|
|
697
|
+
worldPos,
|
|
698
|
+
worldQuat,
|
|
699
|
+
mass,
|
|
700
|
+
voxels,
|
|
701
|
+
voxelSize,
|
|
702
|
+
offset: voxelsCollisionDesc?.offset,
|
|
703
|
+
});
|
|
704
|
+
}
|
|
705
|
+
else {
|
|
706
|
+
// Collect all meshes from the model and create a single combined physics body
|
|
707
|
+
if (model) {
|
|
708
|
+
// don't bother finding physics meshes for voxel collision, as it comes from the physicsOptions.collisionData provided by user
|
|
709
|
+
const physicsMeshes = this.processGLTFModelForPhysics(model);
|
|
710
|
+
|
|
711
|
+
// Create a single physics body for all meshes combined
|
|
712
|
+
if (physicsMeshes.length > 0) {
|
|
713
|
+
record = this.doCreateMeshBody({
|
|
714
|
+
motionType: motionType!,
|
|
715
|
+
options: physicsOptions!,
|
|
716
|
+
worldPos,
|
|
717
|
+
worldQuat,
|
|
718
|
+
mass: physicsMeshes.reduce((sum, mesh) => sum + this.calculateMeshMass(mesh.geometry, physicsOptions?.density), 0),
|
|
719
|
+
meshes: physicsMeshes,
|
|
720
|
+
}, worldScale);
|
|
721
|
+
|
|
722
|
+
if (record) {
|
|
723
|
+
// should contain only one record as there is only one worldPos and worldQuat
|
|
724
|
+
console.log('Created combined physics body for GLTF model with', physicsMeshes.length, 'meshes');
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
return [record, motionType];
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
/**
|
|
734
|
+
*
|
|
735
|
+
* @param component The instanced mesh component
|
|
736
|
+
* @param physicsOptions The physics options
|
|
737
|
+
* @param worldPos The world position
|
|
738
|
+
* @param worldQuat The world quaternion
|
|
739
|
+
* @param worldScale The world scale
|
|
740
|
+
* @returns
|
|
741
|
+
*/
|
|
742
|
+
protected createInstancedMeshRecord(
|
|
743
|
+
component: InstancedMeshComponent,
|
|
744
|
+
physicsOptions: ComponentPhysicsOptions | undefined,
|
|
745
|
+
worldPos: THREE.Vector3,
|
|
746
|
+
worldQuat: THREE.Quaternion,
|
|
747
|
+
worldScale: THREE.Vector3
|
|
748
|
+
): [TRecord[], PhysicsMotionType | null] {
|
|
749
|
+
let records: TRecord[] = [];
|
|
750
|
+
const motionType = physicsOptions?.motionType ?? PhysicsMotionType.Dynamic;
|
|
751
|
+
const transforms = component.getInstancesTransforms(true);
|
|
752
|
+
const isVoxelsCollision = physicsOptions?.collisionMeshType === CollisionMeshType.Voxels;
|
|
753
|
+
const mesh = component.getInstancedMesh();
|
|
754
|
+
if (!mesh) {
|
|
755
|
+
return [[], null];
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
const instanceCount = component.getInstanceCount();
|
|
759
|
+
if (!instanceCount || instanceCount === 0) {
|
|
760
|
+
return [[], null];
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
const worldTransforms = isVoxelsCollision ? [{worldPos, worldQuat, worldScale}] :
|
|
764
|
+
transforms.map(transform => ({
|
|
765
|
+
worldPos: transform.position ?? new THREE.Vector3(),
|
|
766
|
+
worldQuat: transform.rotation ? new THREE.Quaternion().setFromEuler(transform.rotation) : new THREE.Quaternion(),
|
|
767
|
+
worldScale: transform.scale ?? new THREE.Vector3(1, 1, 1)
|
|
768
|
+
}));
|
|
769
|
+
|
|
770
|
+
const [createdRecords, ] = this.createMeshRecord(mesh, physicsOptions, worldTransforms, component);
|
|
771
|
+
records = createdRecords.filter(r => r !== null) as TRecord[];
|
|
772
|
+
|
|
773
|
+
return [records, motionType];
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
/**
|
|
777
|
+
* Creates physics records for an InstancedGltfMeshComponent
|
|
778
|
+
* @param component The instanced GLTF mesh component
|
|
779
|
+
* @param physicsOptions The physics options
|
|
780
|
+
* @param worldScale The world scale
|
|
781
|
+
* @returns [records, motionType] tuple
|
|
782
|
+
*/
|
|
783
|
+
protected createInstancedGltfMeshRecord(
|
|
784
|
+
component: InstancedGltfMeshComponent,
|
|
785
|
+
physicsOptions: ComponentPhysicsOptions | undefined,
|
|
786
|
+
worldPos: THREE.Vector3,
|
|
787
|
+
worldQuat: THREE.Quaternion
|
|
788
|
+
): [TRecord[], PhysicsMotionType | null] {
|
|
789
|
+
// Only proceed if the model is loaded (check if we have instanced meshes)
|
|
790
|
+
if (component.isLoading()) {
|
|
791
|
+
return [[], null];
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
const instancedMeshes = component.getInstancedMeshes();
|
|
795
|
+
if (!instancedMeshes || instancedMeshes.length === 0) {
|
|
796
|
+
return [[], null];
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
// Get the number of instances
|
|
800
|
+
const instanceCount = component.getInstanceCount();
|
|
801
|
+
|
|
802
|
+
if (!instanceCount || instanceCount === 0) {
|
|
803
|
+
return [[], null];
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
let records: TRecord[] = [];
|
|
807
|
+
const motionType = physicsOptions?.motionType ?? PhysicsMotionType.Dynamic;
|
|
808
|
+
const isVoxelsCollision = physicsOptions?.collisionMeshType === CollisionMeshType.Voxels;
|
|
809
|
+
if (isVoxelsCollision) {
|
|
810
|
+
const voxelsCollisionDesc: VoxelCollisionDesc | undefined = physicsOptions.collisionData?.voxels;
|
|
811
|
+
if (!voxelsCollisionDesc) {
|
|
812
|
+
console.log('No voxel collision data provided, using default single voxel at origin. Either provide collisionData.voxels in constructor, or use `overridePhysicsOptions`/`replacePhysicsOptions` to set it later.');
|
|
813
|
+
}
|
|
814
|
+
const voxelSize = voxelsCollisionDesc?.voxelSize ?? new THREE.Vector3(1, 1, 1);
|
|
815
|
+
const voxels: Float32Array | Int32Array = voxelsCollisionDesc?.coordinates ?? new Int32Array([0, 0, 0]);
|
|
816
|
+
const voxelCount = voxels.length / 3;
|
|
817
|
+
const mass = this.calculateBoxMass(voxelSize, physicsOptions?.density) * voxelCount;
|
|
818
|
+
const record = this.doCreateVoxelBody({
|
|
819
|
+
motionType,
|
|
820
|
+
options: physicsOptions!,
|
|
821
|
+
worldPos,
|
|
822
|
+
worldQuat,
|
|
823
|
+
mass,
|
|
824
|
+
voxels,
|
|
825
|
+
voxelSize,
|
|
826
|
+
offset: voxelsCollisionDesc?.offset,
|
|
827
|
+
});
|
|
828
|
+
if (record) {
|
|
829
|
+
records = [record];
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
else {
|
|
833
|
+
const model = component.getModelTemplate();
|
|
834
|
+
if (model) {
|
|
835
|
+
// Process the GLTF model to create physics meshes (same as regular GLTF)
|
|
836
|
+
const physicsMeshes = this.processGLTFModelForPhysics(model);
|
|
837
|
+
|
|
838
|
+
// Create physics bodies for the instances
|
|
839
|
+
if (physicsMeshes.length > 0) {
|
|
840
|
+
const transforms = component.getInstancesTransforms(true);
|
|
841
|
+
const paramTransforms = transforms.map(transform => ({
|
|
842
|
+
position: transform.position ?? new THREE.Vector3(),
|
|
843
|
+
rotation: transform.rotation ? new THREE.Quaternion().setFromEuler(transform.rotation) : new THREE.Quaternion(),
|
|
844
|
+
scale: transform.scale ?? new THREE.Vector3(1, 1, 1)
|
|
845
|
+
}));
|
|
846
|
+
|
|
847
|
+
records = this.doCreateMeshBodiesWithTransformOverrides({
|
|
848
|
+
motionType: motionType!,
|
|
849
|
+
options: physicsOptions!,
|
|
850
|
+
worldPos: paramTransforms[0].position,
|
|
851
|
+
worldQuat: paramTransforms[0].rotation,
|
|
852
|
+
// sum of all physicsMeshes
|
|
853
|
+
mass: physicsMeshes.reduce((sum, mesh) => sum + this.calculateMeshMass(mesh.geometry, physicsOptions?.density), 0),
|
|
854
|
+
meshes: physicsMeshes,
|
|
855
|
+
}, paramTransforms);
|
|
856
|
+
}
|
|
857
|
+
}
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
return [records, motionType];
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
/**
|
|
864
|
+
* Removes a scene component from the physics simulation
|
|
865
|
+
* @param component The scene component to remove
|
|
866
|
+
*/
|
|
867
|
+
public removeComponent(component: PrimitiveComponent): void {
|
|
868
|
+
if (!ensure(this.initialized)) {
|
|
869
|
+
return;
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
const records = this.bodies.get(component);
|
|
873
|
+
if (!records) {
|
|
874
|
+
return;
|
|
875
|
+
}
|
|
876
|
+
|
|
877
|
+
records.forEach((record) => {
|
|
878
|
+
this.doRemoveComponent(record);
|
|
879
|
+
});
|
|
880
|
+
this.bodies.delete(component);
|
|
881
|
+
}
|
|
882
|
+
|
|
883
|
+
/**
|
|
884
|
+
* Updates the transform (position/rotation) of a physics body
|
|
885
|
+
* @param component The primitive component whose transform should be updated
|
|
886
|
+
*/
|
|
887
|
+
public updateTransform(component: PrimitiveComponent): void {
|
|
888
|
+
if (!ensure(this.initialized)) {
|
|
889
|
+
return;
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
const records = this.bodies.get(component);
|
|
893
|
+
if (!records) {
|
|
894
|
+
return;
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
records.forEach((record) => {
|
|
898
|
+
this.doUpdateTransform(component, record);
|
|
899
|
+
});
|
|
900
|
+
}
|
|
901
|
+
|
|
902
|
+
/**
|
|
903
|
+
* Gets a scalar physics parameter value for a component
|
|
904
|
+
* @param component The scene component to query
|
|
905
|
+
* @param param The scalar parameter to get
|
|
906
|
+
* @returns The parameter value or null if not found
|
|
907
|
+
*/
|
|
908
|
+
public getScalarParam(component: PrimitiveComponent, param: PhysicsScalarParam): number | null {
|
|
909
|
+
if (!ensure(this.initialized)) {
|
|
910
|
+
return null;
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
const records = this.bodies.get(component);
|
|
914
|
+
if (!records || records.length === 0) {
|
|
915
|
+
return null;
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
return this.doGetScalarParam(records[0], param);
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
/**
|
|
922
|
+
* Sets a scalar physics parameter value for a component
|
|
923
|
+
* @param component The scene component to modify
|
|
924
|
+
* @param param The scalar parameter to set
|
|
925
|
+
* @param value The new parameter value
|
|
926
|
+
* @returns True if the parameter was set successfully
|
|
927
|
+
*/
|
|
928
|
+
public setScalarParam(component: PrimitiveComponent, param: PhysicsScalarParam, value: number): boolean {
|
|
929
|
+
if (!ensure(this.initialized)) {
|
|
930
|
+
return false;
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
const records = this.bodies.get(component);
|
|
934
|
+
if (!records) {
|
|
935
|
+
return false;
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
return this.doSetScalarParam(records, param, value);
|
|
939
|
+
}
|
|
940
|
+
|
|
941
|
+
/**
|
|
942
|
+
* Gets a vector physics parameter value for a component
|
|
943
|
+
* @param component The scene component to query
|
|
944
|
+
* @param param The vector parameter to get
|
|
945
|
+
* @returns The parameter value array or null if not found
|
|
946
|
+
*/
|
|
947
|
+
public getVectorParam(component: PrimitiveComponent, param: PhysicsVectorParam): VectorArray | null {
|
|
948
|
+
if (!ensure(this.initialized)) {
|
|
949
|
+
return null;
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
const records = this.bodies.get(component);
|
|
953
|
+
if (!records || records.length === 0) {
|
|
954
|
+
return null;
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
return this.doGetVectorParam(records[0], param);
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
/**
|
|
961
|
+
* Sets a vector physics parameter value for a component
|
|
962
|
+
* @param component The scene component to modify
|
|
963
|
+
* @param param The vector parameter to set
|
|
964
|
+
* @param value The new parameter value array
|
|
965
|
+
* @returns True if the parameter was set successfully
|
|
966
|
+
*/
|
|
967
|
+
public setVectorParam(component: PrimitiveComponent, param: PhysicsVectorParam, value: VectorArray): boolean {
|
|
968
|
+
if (!ensure(this.initialized)) {
|
|
969
|
+
return false;
|
|
970
|
+
}
|
|
971
|
+
|
|
972
|
+
const records = this.bodies.get(component);
|
|
973
|
+
if (!records || records.length === 0) {
|
|
974
|
+
return false;
|
|
975
|
+
}
|
|
976
|
+
return records.reduce((acc, record) => acc && this.doSetVectorParam(record, param, value), true);
|
|
977
|
+
}
|
|
978
|
+
|
|
979
|
+
/**
|
|
980
|
+
* Clears a vector physics parameter value for a component
|
|
981
|
+
* @param component The scene component to modify
|
|
982
|
+
* @param param The vector parameter to clear
|
|
983
|
+
* @returns True if the parameter was cleared successfully
|
|
984
|
+
*/
|
|
985
|
+
public clearVectorParam(component: PrimitiveComponent, param: PhysicsVectorParam): boolean {
|
|
986
|
+
if (!ensure(this.initialized)) {
|
|
987
|
+
return false;
|
|
988
|
+
}
|
|
989
|
+
|
|
990
|
+
const records = this.bodies.get(component);
|
|
991
|
+
if (!records || records.length === 0) {
|
|
992
|
+
return false;
|
|
993
|
+
}
|
|
994
|
+
return records.reduce((acc, record) => acc && this.doClearVectorParam(record, param), true);
|
|
995
|
+
}
|
|
996
|
+
|
|
997
|
+
/**
|
|
998
|
+
* Create a character controller for a scene component
|
|
999
|
+
* @param movementComponent Component to create controller for
|
|
1000
|
+
* @param options Character controller options
|
|
1001
|
+
* @returns True if the character controller was created successfully, false otherwise
|
|
1002
|
+
*/
|
|
1003
|
+
public createCharacterController(movementComponent: BasePawnMovementComponent, options: CharacterControllerOptions): boolean {
|
|
1004
|
+
if (!ensure(this.initialized)) {
|
|
1005
|
+
return false;
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
if (!ensure(!this.characterControllers.has(movementComponent))) {
|
|
1009
|
+
return false;
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
const record = this.doCreateCharacterController(options);
|
|
1013
|
+
if (!record) {
|
|
1014
|
+
return false;
|
|
1015
|
+
}
|
|
1016
|
+
this.characterControllers.set(movementComponent, record);
|
|
1017
|
+
return true;
|
|
1018
|
+
}
|
|
1019
|
+
|
|
1020
|
+
/**
|
|
1021
|
+
* Remove a character controller for a scene component
|
|
1022
|
+
* @param movementComponent Component to remove controller for
|
|
1023
|
+
*/
|
|
1024
|
+
public removeCharacterController(movementComponent: BasePawnMovementComponent): void {
|
|
1025
|
+
if (!ensure(this.initialized)) {
|
|
1026
|
+
return;
|
|
1027
|
+
}
|
|
1028
|
+
|
|
1029
|
+
const record = this.characterControllers.get(movementComponent);
|
|
1030
|
+
if (!record) {
|
|
1031
|
+
return;
|
|
1032
|
+
}
|
|
1033
|
+
|
|
1034
|
+
if (this.doRemoveCharacterController(record)) {
|
|
1035
|
+
this.characterControllers.delete(movementComponent);
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1038
|
+
|
|
1039
|
+
/**
|
|
1040
|
+
* Compute character movement for a scene component
|
|
1041
|
+
* @param movementComponent Component to compute movement for
|
|
1042
|
+
* @param componentToMove Component to move
|
|
1043
|
+
* @param movement Movement vector [x, y, z]
|
|
1044
|
+
*/
|
|
1045
|
+
public computeCharacterMovement(movementComponent: BasePawnMovementComponent, componentToMove: PrimitiveComponent, movement: VectorArray, ignoreCollision: boolean): { isGrounded: boolean } {
|
|
1046
|
+
if (!ensure(this.initialized)) {
|
|
1047
|
+
return { isGrounded: false };
|
|
1048
|
+
}
|
|
1049
|
+
|
|
1050
|
+
const record = this.characterControllers.get(movementComponent);
|
|
1051
|
+
if (!record) {
|
|
1052
|
+
return { isGrounded: false };
|
|
1053
|
+
}
|
|
1054
|
+
|
|
1055
|
+
const recordsToMove = this.bodies.get(componentToMove);
|
|
1056
|
+
if (!recordsToMove || recordsToMove.length === 0) {
|
|
1057
|
+
return { isGrounded: false };
|
|
1058
|
+
}
|
|
1059
|
+
|
|
1060
|
+
// only handle recordsToMove[0] for now
|
|
1061
|
+
return this.doComputeCharacterMovement(record, recordsToMove[0], movement, ignoreCollision);
|
|
1062
|
+
}
|
|
1063
|
+
|
|
1064
|
+
/**
|
|
1065
|
+
* Configure collision filtering between two components
|
|
1066
|
+
* @param componentA First component
|
|
1067
|
+
* @param componentB Second component
|
|
1068
|
+
* @param ignore Whether componentA should ignore collisions with componentB
|
|
1069
|
+
*/
|
|
1070
|
+
public setComponentCollisionIgnore(componentA: PrimitiveComponent, componentB: PrimitiveComponent, ignore: boolean): boolean {
|
|
1071
|
+
if (!ensure(this.initialized)) {
|
|
1072
|
+
return false;
|
|
1073
|
+
}
|
|
1074
|
+
|
|
1075
|
+
const recordsA = this.bodies.get(componentA);
|
|
1076
|
+
const recordsB = this.bodies.get(componentB);
|
|
1077
|
+
|
|
1078
|
+
if (!recordsA || !recordsB) {
|
|
1079
|
+
return false;
|
|
1080
|
+
}
|
|
1081
|
+
|
|
1082
|
+
let result = true;
|
|
1083
|
+
for (const recordA of recordsA) {
|
|
1084
|
+
for (const recordB of recordsB) {
|
|
1085
|
+
result = result && this.doSetComponentCollisionIgnore(recordA, recordB, ignore);
|
|
1086
|
+
}
|
|
1087
|
+
}
|
|
1088
|
+
|
|
1089
|
+
return result;
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1092
|
+
/**
|
|
1093
|
+
* Creates a joint between two physics bodies
|
|
1094
|
+
* @param desc Joint description containing type, components, and connection points
|
|
1095
|
+
* @returns Joint ID if successful, null if failed
|
|
1096
|
+
*/
|
|
1097
|
+
public createJoint(desc: JointDesc): string | null {
|
|
1098
|
+
if (!ensure(this.initialized)) {
|
|
1099
|
+
return null;
|
|
1100
|
+
}
|
|
1101
|
+
|
|
1102
|
+
const recordsA = this.bodies.get(desc.componentA);
|
|
1103
|
+
const recordsB = this.bodies.get(desc.componentB);
|
|
1104
|
+
|
|
1105
|
+
if (!recordsA || !recordsB) {
|
|
1106
|
+
console.error('Cannot create joint: one or both components not found in physics engine');
|
|
1107
|
+
return null;
|
|
1108
|
+
}
|
|
1109
|
+
|
|
1110
|
+
if (recordsA.length !== 1 || recordsB.length !== 1) {
|
|
1111
|
+
console.error('Cannot create joint: one or both components have multiple or none body count');
|
|
1112
|
+
return null;
|
|
1113
|
+
}
|
|
1114
|
+
|
|
1115
|
+
const jointRecord = this.doCreateJoint(desc, recordsA[0], recordsB[0]);
|
|
1116
|
+
if (!jointRecord) {
|
|
1117
|
+
return null;
|
|
1118
|
+
}
|
|
1119
|
+
|
|
1120
|
+
const jointId = `joint_${this.nextJointId++}`;
|
|
1121
|
+
this.joints.set(jointId, jointRecord);
|
|
1122
|
+
return jointId;
|
|
1123
|
+
}
|
|
1124
|
+
|
|
1125
|
+
/**
|
|
1126
|
+
* Removes a joint from the physics simulation
|
|
1127
|
+
* @param jointId The joint ID returned from createJoint
|
|
1128
|
+
* @returns True if the joint was successfully removed
|
|
1129
|
+
*/
|
|
1130
|
+
public removeJoint(jointId: string): boolean {
|
|
1131
|
+
if (!ensure(this.initialized)) {
|
|
1132
|
+
return false;
|
|
1133
|
+
}
|
|
1134
|
+
|
|
1135
|
+
const jointRecord = this.joints.get(jointId);
|
|
1136
|
+
if (!jointRecord) {
|
|
1137
|
+
return false;
|
|
1138
|
+
}
|
|
1139
|
+
|
|
1140
|
+
if (this.doRemoveJoint(jointRecord)) {
|
|
1141
|
+
this.joints.delete(jointId);
|
|
1142
|
+
return true;
|
|
1143
|
+
}
|
|
1144
|
+
return false;
|
|
1145
|
+
}
|
|
1146
|
+
|
|
1147
|
+
/**
|
|
1148
|
+
* Gets all active joint IDs
|
|
1149
|
+
* @returns Array of joint IDs
|
|
1150
|
+
*/
|
|
1151
|
+
public getActiveJoints(): string[] {
|
|
1152
|
+
return Array.from(this.joints.keys());
|
|
1153
|
+
}
|
|
1154
|
+
|
|
1155
|
+
/**
|
|
1156
|
+
* Creates a joint directly from physics body records (for special cases like ragdoll)
|
|
1157
|
+
* @param type Joint type
|
|
1158
|
+
* @param recordA First physics body record
|
|
1159
|
+
* @param recordB Second physics body record
|
|
1160
|
+
* @param anchorA Anchor point on first body
|
|
1161
|
+
* @param anchorB Anchor point on second body
|
|
1162
|
+
* @param axis Optional axis for revolute/prismatic joints
|
|
1163
|
+
* @returns Joint ID if successful, null if failed
|
|
1164
|
+
*/
|
|
1165
|
+
public createJointFromRecords(
|
|
1166
|
+
type: JointType,
|
|
1167
|
+
recordA: TRecord,
|
|
1168
|
+
recordB: TRecord,
|
|
1169
|
+
anchorA: THREE.Vector3,
|
|
1170
|
+
anchorB: THREE.Vector3,
|
|
1171
|
+
axis?: THREE.Vector3
|
|
1172
|
+
): string | null {
|
|
1173
|
+
if (!ensure(this.initialized)) {
|
|
1174
|
+
return null;
|
|
1175
|
+
}
|
|
1176
|
+
|
|
1177
|
+
const jointRecord = this.doCreateJointFromRecords(type, recordA, recordB, anchorA, anchorB, axis);
|
|
1178
|
+
if (!jointRecord) {
|
|
1179
|
+
return null;
|
|
1180
|
+
}
|
|
1181
|
+
|
|
1182
|
+
const jointId = `joint_${this.nextJointId++}`;
|
|
1183
|
+
this.joints.set(jointId, jointRecord);
|
|
1184
|
+
return jointId;
|
|
1185
|
+
}
|
|
1186
|
+
|
|
1187
|
+
// Direct physics body management methods (for special cases like ragdolls)
|
|
1188
|
+
|
|
1189
|
+
public createPhysicsBody(desc: PhysicsBodyDesc): string | null {
|
|
1190
|
+
if (!ensure(this.initialized)) {
|
|
1191
|
+
return null;
|
|
1192
|
+
}
|
|
1193
|
+
|
|
1194
|
+
const record = this.doCreateDirectBody(desc);
|
|
1195
|
+
if (!record) {
|
|
1196
|
+
return null;
|
|
1197
|
+
}
|
|
1198
|
+
|
|
1199
|
+
const handle = `body_${this.nextBodyId++}`;
|
|
1200
|
+
this.directBodies.set(handle, record);
|
|
1201
|
+
return handle;
|
|
1202
|
+
}
|
|
1203
|
+
|
|
1204
|
+
public removePhysicsBody(handle: string): boolean {
|
|
1205
|
+
if (!ensure(this.initialized)) {
|
|
1206
|
+
return false;
|
|
1207
|
+
}
|
|
1208
|
+
|
|
1209
|
+
const record = this.directBodies.get(handle);
|
|
1210
|
+
if (!record) {
|
|
1211
|
+
return false;
|
|
1212
|
+
}
|
|
1213
|
+
|
|
1214
|
+
const success = this.doRemoveDirectBody(record);
|
|
1215
|
+
if (success) {
|
|
1216
|
+
this.directBodies.delete(handle);
|
|
1217
|
+
}
|
|
1218
|
+
return success;
|
|
1219
|
+
}
|
|
1220
|
+
|
|
1221
|
+
public isValidPhysicsBody(handle: string): boolean {
|
|
1222
|
+
return this.directBodies.has(handle);
|
|
1223
|
+
}
|
|
1224
|
+
|
|
1225
|
+
public getPhysicsBodyPosition(handle: string): THREE.Vector3 | null {
|
|
1226
|
+
const record = this.directBodies.get(handle);
|
|
1227
|
+
if (!record) {
|
|
1228
|
+
return null;
|
|
1229
|
+
}
|
|
1230
|
+
return this.doGetBodyPosition(record);
|
|
1231
|
+
}
|
|
1232
|
+
|
|
1233
|
+
public getPhysicsBodyRotation(handle: string): THREE.Quaternion | null {
|
|
1234
|
+
const record = this.directBodies.get(handle);
|
|
1235
|
+
if (!record) {
|
|
1236
|
+
return null;
|
|
1237
|
+
}
|
|
1238
|
+
return this.doGetBodyRotation(record);
|
|
1239
|
+
}
|
|
1240
|
+
|
|
1241
|
+
public setPhysicsBodyPosition(handle: string, position: THREE.Vector3): boolean {
|
|
1242
|
+
const record = this.directBodies.get(handle);
|
|
1243
|
+
if (!record) {
|
|
1244
|
+
return false;
|
|
1245
|
+
}
|
|
1246
|
+
return this.doSetBodyPosition(record, position);
|
|
1247
|
+
}
|
|
1248
|
+
|
|
1249
|
+
public setPhysicsBodyRotation(handle: string, rotation: THREE.Quaternion): boolean {
|
|
1250
|
+
const record = this.directBodies.get(handle);
|
|
1251
|
+
if (!record) {
|
|
1252
|
+
return false;
|
|
1253
|
+
}
|
|
1254
|
+
return this.doSetBodyRotation(record, rotation);
|
|
1255
|
+
}
|
|
1256
|
+
|
|
1257
|
+
public applyImpulseToPhysicsBody(handle: string, impulse: THREE.Vector3, worldSpace: boolean = true): boolean {
|
|
1258
|
+
const record = this.directBodies.get(handle);
|
|
1259
|
+
if (!record) {
|
|
1260
|
+
return false;
|
|
1261
|
+
}
|
|
1262
|
+
return this.doApplyBodyImpulse(record, impulse, worldSpace);
|
|
1263
|
+
}
|
|
1264
|
+
|
|
1265
|
+
public setPhysicsBodyEnabled(handle: string, enabled: boolean): boolean {
|
|
1266
|
+
const record = this.directBodies.get(handle);
|
|
1267
|
+
if (!record) {
|
|
1268
|
+
return false;
|
|
1269
|
+
}
|
|
1270
|
+
return this.doSetBodyEnabled(record, enabled);
|
|
1271
|
+
}
|
|
1272
|
+
|
|
1273
|
+
public createJointFromBodies(
|
|
1274
|
+
type: JointType,
|
|
1275
|
+
bodyA: string,
|
|
1276
|
+
bodyB: string,
|
|
1277
|
+
anchorA: THREE.Vector3,
|
|
1278
|
+
anchorB: THREE.Vector3,
|
|
1279
|
+
axis?: THREE.Vector3
|
|
1280
|
+
): string | null {
|
|
1281
|
+
if (!ensure(this.initialized)) {
|
|
1282
|
+
return null;
|
|
1283
|
+
}
|
|
1284
|
+
|
|
1285
|
+
const recordA = this.directBodies.get(bodyA);
|
|
1286
|
+
const recordB = this.directBodies.get(bodyB);
|
|
1287
|
+
|
|
1288
|
+
if (!recordA || !recordB) {
|
|
1289
|
+
return null;
|
|
1290
|
+
}
|
|
1291
|
+
|
|
1292
|
+
const jointRecord = this.doCreateJointFromRecords(type, recordA, recordB, anchorA, anchorB, axis);
|
|
1293
|
+
if (!jointRecord) {
|
|
1294
|
+
return null;
|
|
1295
|
+
}
|
|
1296
|
+
|
|
1297
|
+
const jointId = `joint_${this.nextJointId++}`;
|
|
1298
|
+
this.joints.set(jointId, jointRecord);
|
|
1299
|
+
return jointId;
|
|
1300
|
+
}
|
|
1301
|
+
|
|
1302
|
+
//====================================================================================================
|
|
1303
|
+
|
|
1304
|
+
protected calculateBoxMass(size: THREE.Vector3, density: number | undefined): number {
|
|
1305
|
+
const volume = size.x * size.y * size.z;
|
|
1306
|
+
return volume * (density ?? 1);
|
|
1307
|
+
}
|
|
1308
|
+
|
|
1309
|
+
protected calculateSphereMass(radius: number, density: number | undefined): number {
|
|
1310
|
+
const volume = (4 / 3) * Math.PI * radius * radius * radius;
|
|
1311
|
+
return volume * (density ?? 1);
|
|
1312
|
+
}
|
|
1313
|
+
|
|
1314
|
+
protected calculateCylinderMass(height: number, radius: number, density: number | undefined): number {
|
|
1315
|
+
const volume = Math.PI * radius * radius * height;
|
|
1316
|
+
return volume * (density ?? 1);
|
|
1317
|
+
}
|
|
1318
|
+
|
|
1319
|
+
protected calculateCapsuleMass(height: number, radius: number, density: number | undefined): number {
|
|
1320
|
+
// Capsule is a cylinder with two hemisphere caps
|
|
1321
|
+
const cylinderVolume = Math.PI * radius * radius * height;
|
|
1322
|
+
const hemisphereVolume = (2/3) * Math.PI * radius * radius * radius;
|
|
1323
|
+
const volume = cylinderVolume + 2 * hemisphereVolume;
|
|
1324
|
+
return volume * (density ?? 1);
|
|
1325
|
+
}
|
|
1326
|
+
|
|
1327
|
+
protected calculateConeMass(height: number, radius: number, density: number | undefined): number {
|
|
1328
|
+
const volume = (1 / 3) * Math.PI * radius * radius * height;
|
|
1329
|
+
return volume * (density ?? 1);
|
|
1330
|
+
}
|
|
1331
|
+
|
|
1332
|
+
protected calculateMeshMass(geometry: THREE.BufferGeometry, density: number | undefined): number {
|
|
1333
|
+
// Approximate mass based on bounding box volume
|
|
1334
|
+
geometry.computeBoundingBox();
|
|
1335
|
+
const bbox = geometry.boundingBox;
|
|
1336
|
+
if (!bbox) {
|
|
1337
|
+
return 1; // default mass
|
|
1338
|
+
}
|
|
1339
|
+
const size = new THREE.Vector3();
|
|
1340
|
+
bbox.getSize(size);
|
|
1341
|
+
const volume = size.x * size.y * size.z;
|
|
1342
|
+
return volume * (density ?? 1);
|
|
1343
|
+
}
|
|
1344
|
+
|
|
1345
|
+
|
|
1346
|
+
protected abstract doCreate(options: PhysicsOptions): Promise<boolean>;
|
|
1347
|
+
protected abstract doDestroy(): boolean;
|
|
1348
|
+
protected abstract doTick(deltaTime: number): void;
|
|
1349
|
+
protected abstract doRemoveComponent(record: TRecord): boolean;
|
|
1350
|
+
protected abstract doUpdateTransform(component: SceneComponent, record: TRecord): void;
|
|
1351
|
+
protected abstract doGetScalarParam(record: TRecord, param: PhysicsScalarParam): number | null;
|
|
1352
|
+
protected abstract doSetScalarParam(records: TRecord[], param: PhysicsScalarParam, value: number): boolean;
|
|
1353
|
+
protected abstract doGetVectorParam(record: TRecord, param: PhysicsVectorParam): VectorArray | null;
|
|
1354
|
+
protected abstract doSetVectorParam(record: TRecord, param: PhysicsVectorParam, value: VectorArray): boolean;
|
|
1355
|
+
protected abstract doClearVectorParam(record: TRecord, param: PhysicsVectorParam): boolean;
|
|
1356
|
+
protected abstract doCreateBoxBody(desc: BoxBodyDesc): TRecord | null;
|
|
1357
|
+
protected abstract doCreateMeshBody(desc: MeshBodyDesc, scale: THREE.Vector3): TRecord | null;
|
|
1358
|
+
protected abstract doCreateMeshBodiesWithTransformOverrides(desc: MeshBodyDesc, transforms: {position?: THREE.Vector3, rotation?: THREE.Quaternion, scale?: THREE.Vector3}[]): TRecord[];
|
|
1359
|
+
protected abstract doCreateVoxelBody(desc: VoxelBodyDesc): TRecord | null;
|
|
1360
|
+
protected abstract doCreateSphereBody(desc: SphereBodyDesc): TRecord | null;
|
|
1361
|
+
protected abstract doCreateCylinderBody(desc: CylinderBodyDesc): TRecord | null;
|
|
1362
|
+
protected abstract doCreateCapsuleBody(desc: CapsuleBodyDesc): TRecord | null;
|
|
1363
|
+
protected abstract doCreateConeBody(desc: ConeBodyDesc): TRecord | null;
|
|
1364
|
+
protected abstract doCreateHeightFieldBody(desc: HeightFieldBodyDesc): TRecord | null;
|
|
1365
|
+
protected doCreateCharacterController(options: CharacterControllerOptions): TCharacterControllerRecord | null {
|
|
1366
|
+
throw new Error('Not implemented');
|
|
1367
|
+
}
|
|
1368
|
+
protected doRemoveCharacterController(record: TCharacterControllerRecord): boolean {
|
|
1369
|
+
throw new Error('Not implemented');
|
|
1370
|
+
}
|
|
1371
|
+
protected doComputeCharacterMovement(record: TCharacterControllerRecord, recordToMove: TRecord, movement: VectorArray, ignoreCollision: boolean): { isGrounded: boolean } {
|
|
1372
|
+
throw new Error('Not implemented');
|
|
1373
|
+
}
|
|
1374
|
+
protected doSetComponentCollisionIgnore(recordA: TRecord, recordB: TRecord, ignore: boolean): boolean {
|
|
1375
|
+
throw new Error('Not implemented');
|
|
1376
|
+
}
|
|
1377
|
+
protected abstract doCreateJoint(desc: JointDesc, recordA: TRecord, recordB: TRecord): TJointRecord | null;
|
|
1378
|
+
protected abstract doRemoveJoint(jointRecord: TJointRecord): boolean;
|
|
1379
|
+
protected abstract doCreateJointFromRecords(
|
|
1380
|
+
type: JointType,
|
|
1381
|
+
recordA: TRecord,
|
|
1382
|
+
recordB: TRecord,
|
|
1383
|
+
anchorA: THREE.Vector3,
|
|
1384
|
+
anchorB: THREE.Vector3,
|
|
1385
|
+
axis?: THREE.Vector3
|
|
1386
|
+
): TJointRecord | null;
|
|
1387
|
+
|
|
1388
|
+
// Abstract methods for direct physics body management
|
|
1389
|
+
protected abstract doCreateDirectBody(desc: PhysicsBodyDesc): TRecord | null;
|
|
1390
|
+
protected abstract doRemoveDirectBody(record: TRecord): boolean;
|
|
1391
|
+
protected abstract doGetBodyPosition(record: TRecord): THREE.Vector3 | null;
|
|
1392
|
+
protected abstract doGetBodyRotation(record: TRecord): THREE.Quaternion | null;
|
|
1393
|
+
protected abstract doSetBodyPosition(record: TRecord, position: THREE.Vector3): boolean;
|
|
1394
|
+
protected abstract doSetBodyRotation(record: TRecord, rotation: THREE.Quaternion): boolean;
|
|
1395
|
+
protected abstract doApplyBodyImpulse(record: TRecord, impulse: THREE.Vector3, worldSpace: boolean): boolean;
|
|
1396
|
+
protected abstract doSetBodyEnabled(record: TRecord, enabled: boolean): boolean;
|
|
1397
|
+
public abstract getComponentState(component: PrimitiveComponent): PrimitiveComponentPhysicsState | null;
|
|
1398
|
+
public abstract getCollisionEvents(): RawCollisionEvent[];
|
|
1399
|
+
public abstract clearCollisionEvents(): void;
|
|
1400
|
+
public abstract setDebugRendererEnabled(enabled: boolean): boolean;
|
|
1401
|
+
public abstract isDebugRendererEnabled(): boolean;
|
|
1402
|
+
|
|
1403
|
+
/**
|
|
1404
|
+
* Process any pending collision events in the physics system
|
|
1405
|
+
* This is called internally by the tick method
|
|
1406
|
+
*/
|
|
1407
|
+
protected processCollisionEvents(): void {
|
|
1408
|
+
const events = this.getCollisionEvents();
|
|
1409
|
+
for (const event of events) {
|
|
1410
|
+
this.handleCollisionEvent(event);
|
|
1411
|
+
}
|
|
1412
|
+
// Clear the collision events after processing them
|
|
1413
|
+
this.clearCollisionEvents();
|
|
1414
|
+
}
|
|
1415
|
+
|
|
1416
|
+
/**
|
|
1417
|
+
* Handles a single collision event by notifying the involved components
|
|
1418
|
+
* @param event Collision event information
|
|
1419
|
+
*/
|
|
1420
|
+
protected handleCollisionEvent(event: RawCollisionEvent): void {
|
|
1421
|
+
const componentA = event.componentA;
|
|
1422
|
+
const componentB = event.componentB;
|
|
1423
|
+
|
|
1424
|
+
const eventA: CollisionEvent = {
|
|
1425
|
+
thisComponent: componentA,
|
|
1426
|
+
otherComponent: componentB,
|
|
1427
|
+
thisPoint: event.pointA,
|
|
1428
|
+
thisNormal: event.normalA,
|
|
1429
|
+
otherPoint: event.pointB,
|
|
1430
|
+
otherNormal: event.normalB,
|
|
1431
|
+
relativeVelocity: event.relativeVelocity,
|
|
1432
|
+
};
|
|
1433
|
+
|
|
1434
|
+
const eventB: CollisionEvent = {
|
|
1435
|
+
thisComponent: componentB,
|
|
1436
|
+
otherComponent: componentA,
|
|
1437
|
+
thisPoint: event.pointB,
|
|
1438
|
+
thisNormal: event.normalB,
|
|
1439
|
+
otherPoint: event.pointA,
|
|
1440
|
+
otherNormal: event.normalA,
|
|
1441
|
+
relativeVelocity: event.relativeVelocity,
|
|
1442
|
+
};
|
|
1443
|
+
|
|
1444
|
+
if (componentA && componentB) {
|
|
1445
|
+
const actorA = componentA.getActor();
|
|
1446
|
+
const actorB = componentB.getActor();
|
|
1447
|
+
|
|
1448
|
+
if(event.eventType === CollisionEventType.Started) {
|
|
1449
|
+
if (event.isTriggerEvent) {
|
|
1450
|
+
// Component events
|
|
1451
|
+
componentA.onOverlapWith.invoke(componentA, componentB, eventA);
|
|
1452
|
+
componentB.onOverlapWith.invoke(componentB, componentA, eventB);
|
|
1453
|
+
// Actor events
|
|
1454
|
+
if (actorA && actorB) actorA.onOverlapWith.invoke(actorA, componentA, actorB, componentB, eventA);
|
|
1455
|
+
if (actorB && actorA) actorB.onOverlapWith.invoke(actorB, componentB, actorA, componentA, eventB);
|
|
1456
|
+
} else {
|
|
1457
|
+
// Component events
|
|
1458
|
+
componentA.onCollideWith.invoke(componentA, componentB, eventA);
|
|
1459
|
+
componentB.onCollideWith.invoke(componentB, componentA, eventB);
|
|
1460
|
+
// Actor events
|
|
1461
|
+
if (actorA && actorB) actorA.onCollideWith.invoke(actorA, componentA, actorB, componentB, eventA);
|
|
1462
|
+
if (actorB && actorA) actorB.onCollideWith.invoke(actorB, componentB, actorA, componentA, eventB);
|
|
1463
|
+
}
|
|
1464
|
+
} else {
|
|
1465
|
+
if (event.isTriggerEvent) {
|
|
1466
|
+
// Component events
|
|
1467
|
+
componentA.onStopOverlappingWith.invoke(componentA, componentB, eventA);
|
|
1468
|
+
componentB.onStopOverlappingWith.invoke(componentB, componentA, eventB);
|
|
1469
|
+
// Actor events
|
|
1470
|
+
if (actorA && actorB) actorA.onStopOverlappingWith.invoke(actorA, componentA, actorB, componentB, eventA);
|
|
1471
|
+
if (actorB && actorA) actorB.onStopOverlappingWith.invoke(actorB, componentB, actorA, componentA, eventB);
|
|
1472
|
+
} else {
|
|
1473
|
+
// Component events
|
|
1474
|
+
componentA.onStopCollidingWith.invoke(componentA, componentB, eventA);
|
|
1475
|
+
componentB.onStopCollidingWith.invoke(componentB, componentA, eventB);
|
|
1476
|
+
// Actor events
|
|
1477
|
+
if (actorA && actorB) actorA.onStopCollidingWith.invoke(actorA, componentA, actorB, componentB, eventA);
|
|
1478
|
+
if (actorB && actorA) actorB.onStopCollidingWith.invoke(actorB, componentB, actorA, componentA, eventB);
|
|
1479
|
+
}
|
|
1480
|
+
}
|
|
1481
|
+
}
|
|
1482
|
+
}
|
|
1483
|
+
|
|
1484
|
+
// Vehicle controller methods - default implementations that throw errors
|
|
1485
|
+
public abstract createVehicle(movementComponent: BasePawnMovementComponent, chassisComponent: PrimitiveComponent): IPhysicsVehicle | null;
|
|
1486
|
+
}
|