@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,1419 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RapierPhysicsEngine powers Genesys physics using the Rapier library.
|
|
3
|
+
*
|
|
4
|
+
* This implementation extends `BasePhysicsEngine` and converts scene components
|
|
5
|
+
* into Rapier rigid bodies and colliders. A single `Rapier.World` instance is
|
|
6
|
+
* maintained along with an event queue to capture collision events which are
|
|
7
|
+
* then mapped back to components. The engine supports mesh-based colliders,
|
|
8
|
+
* terrain height fields and character controllers, and it can optionally draw
|
|
9
|
+
* debug lines using `RapierDebugRenderer`.
|
|
10
|
+
*
|
|
11
|
+
* Recommended usage (for humans and AI assistants):
|
|
12
|
+
* - Instantiate via `createPhysicsEngine` with `PhysicsEngine.Rapier`.
|
|
13
|
+
* - Call `addComponent` only after a component's mesh or collision shape is
|
|
14
|
+
* initialized so colliders are created correctly.
|
|
15
|
+
* - Enable the debug renderer during development with
|
|
16
|
+
* `setDebugRendererEnabled(true)` to visualize physics bodies.
|
|
17
|
+
* - Prefer simplified or convex meshes when possible to keep performance high.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import * as RAPIER from '@dimforge/rapier3d-compat';
|
|
21
|
+
import * as THREE from 'three';
|
|
22
|
+
|
|
23
|
+
import { CollisionMeshType, PhysicsMotionType } from '../../physics/PhysicsTypes.js';
|
|
24
|
+
import { CollisionConfig, getCollisionChannelBit, resolveChannelName } from '../../systems/collision/CollisionConfig.js';
|
|
25
|
+
import { CollisionMode, CollisionResponse, DefaultCollisionProfile } from '../../systems/collision/CollisionTypes.js';
|
|
26
|
+
import { ensure } from '../../utils/Utils.js';
|
|
27
|
+
import { BasePhysicsEngine } from '../BasePhysicsEngine.js';
|
|
28
|
+
import { JointType } from '../BasePhysicsEngine.js';
|
|
29
|
+
import { PhysicsScalarParam, PhysicsVectorParam } from '../PhysicsEngine.js';
|
|
30
|
+
import { CollisionEventType, type RawCollisionEvent } from '../PhysicsEngine.js';
|
|
31
|
+
|
|
32
|
+
import { RapierDebugRenderer } from './RapierDebugRender.js';
|
|
33
|
+
import { RapierVehicle } from './RapierVehicle.js';
|
|
34
|
+
|
|
35
|
+
import type { BasePawnMovementComponent } from '../../components/movement/BasePawnMovementComponent.js';
|
|
36
|
+
import type { PrimitiveComponent } from '../../components/PrimitiveComponent.js';
|
|
37
|
+
import type { CollisionProfile} from '../../systems/collision/CollisionTypes.js';
|
|
38
|
+
import type {
|
|
39
|
+
BaseDesc,
|
|
40
|
+
BoxBodyDesc,
|
|
41
|
+
CapsuleBodyDesc,
|
|
42
|
+
ConeBodyDesc,
|
|
43
|
+
CylinderBodyDesc,
|
|
44
|
+
HeightFieldBodyDesc,
|
|
45
|
+
JointDesc,
|
|
46
|
+
MeshBodyDesc,
|
|
47
|
+
SphereBodyDesc,
|
|
48
|
+
VoxelBodyDesc
|
|
49
|
+
} from '../BasePhysicsEngine';
|
|
50
|
+
import type { IPhysicsVehicle } from '../IPhysicsVehicle.js';
|
|
51
|
+
import type {
|
|
52
|
+
CharacterControllerOptions,
|
|
53
|
+
HitTestOptions,
|
|
54
|
+
HitTestResult,
|
|
55
|
+
PhysicsOptions,
|
|
56
|
+
PrimitiveComponentPhysicsState,
|
|
57
|
+
VectorArray
|
|
58
|
+
} from '../PhysicsEngine';
|
|
59
|
+
import type { PhysicsBodyDesc } from '../PhysicsEngine.js';
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Rapier physics engine integration
|
|
63
|
+
*/
|
|
64
|
+
type TRecord = [RAPIER.RigidBody, RAPIER.Collider, PhysicsMotionType];
|
|
65
|
+
type TCharacterControllerRecord = RAPIER.KinematicCharacterController;
|
|
66
|
+
type TJointRecord = RAPIER.ImpulseJoint;
|
|
67
|
+
|
|
68
|
+
export class RapierPhysicsEngine extends BasePhysicsEngine<TRecord, TCharacterControllerRecord, TJointRecord> {
|
|
69
|
+
|
|
70
|
+
private pendingCollisions: RawCollisionEvent[] = [];
|
|
71
|
+
|
|
72
|
+
private world: RAPIER.World | null = null;
|
|
73
|
+
|
|
74
|
+
private eventQueue: RAPIER.EventQueue | null = null;
|
|
75
|
+
|
|
76
|
+
// Map from collider to component for fast lookup during collision processing
|
|
77
|
+
private colliderToComponent: Map<number, PrimitiveComponent> = new Map();
|
|
78
|
+
|
|
79
|
+
// Set of ignored collider pairs (stored as "handle1,handle2" strings)
|
|
80
|
+
private ignoredColliderPairs: Set<string> = new Set();
|
|
81
|
+
|
|
82
|
+
// Debug renderer
|
|
83
|
+
private debugRenderer: RapierDebugRenderer | null = null;
|
|
84
|
+
|
|
85
|
+
// Vehicle controllers
|
|
86
|
+
private vehicles: Map<BasePawnMovementComponent, RapierVehicle> = new Map();
|
|
87
|
+
|
|
88
|
+
// cache for collider desc without scale, mapping from a list of meshes and the collision mesh type
|
|
89
|
+
private cachedColliderDescTemplates: Map<string, RAPIER.ColliderDesc | null> = new Map();
|
|
90
|
+
|
|
91
|
+
private cachedCharacterControllerCollisions: Map<number, number[]> = new Map();
|
|
92
|
+
|
|
93
|
+
constructor(gameWorld?: any) {
|
|
94
|
+
super(gameWorld);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
public async doCreate(options: PhysicsOptions): Promise<boolean> {
|
|
98
|
+
await RAPIER.init();
|
|
99
|
+
this.world = new RAPIER.World(this.makeVector(options.gravity.toArray()));
|
|
100
|
+
this.eventQueue = new RAPIER.EventQueue(true);
|
|
101
|
+
|
|
102
|
+
// Initialize debug renderer if we have a scene to render to
|
|
103
|
+
if (this.gameWorld && this.gameWorld.scene) {
|
|
104
|
+
this.debugRenderer = new RapierDebugRenderer(this.gameWorld.scene, this.world);
|
|
105
|
+
this.debugRenderer.enabled = options.debugVisualization ?? false;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return true;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
protected doDestroy(): boolean {
|
|
112
|
+
this.cachedCharacterControllerCollisions.clear();
|
|
113
|
+
this.pendingCollisions = [];
|
|
114
|
+
|
|
115
|
+
const world = this.world!;
|
|
116
|
+
|
|
117
|
+
// Clean up vehicles
|
|
118
|
+
this.vehicles.forEach((vehicle, _) => {
|
|
119
|
+
vehicle.destroy();
|
|
120
|
+
});
|
|
121
|
+
this.vehicles.clear();
|
|
122
|
+
|
|
123
|
+
// Remove all physics bodies and colliders first
|
|
124
|
+
this.bodies.forEach((records, _) => {
|
|
125
|
+
records.forEach(([body, collider]) => {
|
|
126
|
+
world.removeRigidBody(body);
|
|
127
|
+
world.removeCollider(collider, false);
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
this.bodies.clear();
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
// Clean up character controllers
|
|
134
|
+
this.characterControllers.forEach((controller, _) => {
|
|
135
|
+
world.removeCharacterController(controller);
|
|
136
|
+
});
|
|
137
|
+
this.characterControllers.clear();
|
|
138
|
+
|
|
139
|
+
// Clean up joints
|
|
140
|
+
this.joints.forEach((joint, _) => {
|
|
141
|
+
world.removeImpulseJoint(joint, true);
|
|
142
|
+
});
|
|
143
|
+
this.joints.clear();
|
|
144
|
+
|
|
145
|
+
// Free the WASM world object
|
|
146
|
+
world.free();
|
|
147
|
+
this.world = null;
|
|
148
|
+
|
|
149
|
+
if (this.eventQueue) {
|
|
150
|
+
this.eventQueue.free();
|
|
151
|
+
this.eventQueue = null;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// Clean up debug renderer
|
|
155
|
+
if (this.debugRenderer) {
|
|
156
|
+
this.debugRenderer.dispose();
|
|
157
|
+
this.debugRenderer = null;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
this.colliderToComponent.clear();
|
|
161
|
+
this.ignoredColliderPairs.clear();
|
|
162
|
+
return true;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
protected doTick(deltaTime: number): void {
|
|
166
|
+
this.world!.step(this.eventQueue!);
|
|
167
|
+
|
|
168
|
+
for (const vehicle of this.vehicles.values()) {
|
|
169
|
+
vehicle.tick(deltaTime);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// Process collision events from Rapier
|
|
173
|
+
this.eventQueue!.drainCollisionEvents((handle1, handle2, started) => {
|
|
174
|
+
this.handleRapierCollision(handle1, handle2, started);
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
const objectPosition = new THREE.Vector3();
|
|
178
|
+
const objectQuat = new THREE.Quaternion();
|
|
179
|
+
|
|
180
|
+
// Update all object positions based on physics
|
|
181
|
+
this.bodies.forEach((records, object) => {
|
|
182
|
+
records.forEach(([body, _]) => {
|
|
183
|
+
const motionType = object.getMotionType();
|
|
184
|
+
if (motionType === PhysicsMotionType.Static) {
|
|
185
|
+
// static objects cannot be moved by the physics engine
|
|
186
|
+
// so there's no need to sync its transform back to the scene component
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
const position = body.translation();
|
|
190
|
+
const rotation = body.rotation();
|
|
191
|
+
|
|
192
|
+
objectPosition.x = position.x;
|
|
193
|
+
objectPosition.y = position.y;
|
|
194
|
+
objectPosition.z = position.z;
|
|
195
|
+
|
|
196
|
+
objectQuat.x = rotation.x;
|
|
197
|
+
objectQuat.y = rotation.y;
|
|
198
|
+
objectQuat.z = rotation.z;
|
|
199
|
+
objectQuat.w = rotation.w;
|
|
200
|
+
|
|
201
|
+
object.syncFromPhysics(objectPosition, objectQuat);
|
|
202
|
+
});
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
// Update debug renderer if available
|
|
206
|
+
if (this.debugRenderer) {
|
|
207
|
+
this.debugRenderer.update();
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
private handleRapierCollision(handle1: number, handle2: number, started: boolean): void {
|
|
212
|
+
// Check if this collision pair should be ignored
|
|
213
|
+
const pairKey1 = `${handle1},${handle2}`;
|
|
214
|
+
const pairKey2 = `${handle2},${handle1}`;
|
|
215
|
+
if (this.ignoredColliderPairs.has(pairKey1) || this.ignoredColliderPairs.has(pairKey2)) {
|
|
216
|
+
return; // Ignore this collision
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
const collider1 = this.world!.getCollider(handle1);
|
|
220
|
+
const collider2 = this.world!.getCollider(handle2);
|
|
221
|
+
|
|
222
|
+
if (!collider1 || !collider2) return;
|
|
223
|
+
|
|
224
|
+
const componentA = this.colliderToComponent.get(handle1);
|
|
225
|
+
const componentB = this.colliderToComponent.get(handle2);
|
|
226
|
+
|
|
227
|
+
if (!componentA || !componentB) return;
|
|
228
|
+
|
|
229
|
+
const contact = collider1.contactCollider(collider2, 0.1);
|
|
230
|
+
let contactPointA: THREE.Vector3 | null = null;
|
|
231
|
+
let contactNormalA: THREE.Vector3 | null = null;
|
|
232
|
+
let contactPointB: THREE.Vector3 | null = null;
|
|
233
|
+
let contactNormalB: THREE.Vector3 | null = null;
|
|
234
|
+
if (contact) {
|
|
235
|
+
contactPointA = new THREE.Vector3(contact.point1.x, contact.point1.y, contact.point1.z);
|
|
236
|
+
contactNormalA = new THREE.Vector3(contact.normal1.x, contact.normal1.y, contact.normal1.z);
|
|
237
|
+
contactPointB = new THREE.Vector3(contact.point2.x, contact.point2.y, contact.point2.z);
|
|
238
|
+
contactNormalB = new THREE.Vector3(contact.normal2.x, contact.normal2.y, contact.normal2.z);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
// Calculate relative velocity at the contact point
|
|
242
|
+
const bodyA = collider1.parent();
|
|
243
|
+
const bodyB = collider2.parent();
|
|
244
|
+
|
|
245
|
+
let relativeVelocity: number | null = null;
|
|
246
|
+
if (bodyA && bodyB) {
|
|
247
|
+
const velA = bodyA.linvel();
|
|
248
|
+
const velB = bodyB.linvel();
|
|
249
|
+
// Calculate squared length manually
|
|
250
|
+
const dx = velB.x - velA.x;
|
|
251
|
+
const dy = velB.y - velA.y;
|
|
252
|
+
const dz = velB.z - velA.z;
|
|
253
|
+
relativeVelocity = Math.sqrt(dx*dx + dy*dy + dz*dz);
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
// Create collision info
|
|
257
|
+
const collision: RawCollisionEvent = {
|
|
258
|
+
componentA,
|
|
259
|
+
componentB,
|
|
260
|
+
pointA: contactPointA,
|
|
261
|
+
normalA: contactNormalA,
|
|
262
|
+
pointB: contactPointB,
|
|
263
|
+
normalB: contactNormalB,
|
|
264
|
+
relativeVelocity,
|
|
265
|
+
isTriggerEvent: collider1.isSensor() || collider2.isSensor(),
|
|
266
|
+
eventType: started ? CollisionEventType.Started : CollisionEventType.Ended,
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
this.pendingCollisions.push(collision);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
protected doCreateBoxBody(desc: BoxBodyDesc): TRecord | null {
|
|
273
|
+
const colliderDesc = RAPIER.ColliderDesc.cuboid(desc.size.x / 2, desc.size.y / 2, desc.size.z / 2);
|
|
274
|
+
const record = this.createBody(colliderDesc, desc);
|
|
275
|
+
return record;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
private populateVerticesAndIndices(meshes: THREE.Mesh[], populateIndices: boolean = true): {vertices: Float32Array, indices: Uint32Array} {
|
|
279
|
+
let totalVertexCount = 0;
|
|
280
|
+
let totalIndexCount = 0;
|
|
281
|
+
const validMeshes: THREE.Mesh[] = [];
|
|
282
|
+
|
|
283
|
+
for (const mesh of meshes) {
|
|
284
|
+
const geometry = mesh.geometry;
|
|
285
|
+
if (!geometry.isBufferGeometry) {
|
|
286
|
+
console.error('Geometry is not a BufferGeometry');
|
|
287
|
+
continue;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
const positionAttribute = geometry.getAttribute('position');
|
|
291
|
+
if (!positionAttribute) {
|
|
292
|
+
console.error('Geometry has no position attribute');
|
|
293
|
+
continue;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
totalVertexCount += positionAttribute.count;
|
|
297
|
+
|
|
298
|
+
const indexAttribute = geometry.getIndex();
|
|
299
|
+
if (indexAttribute) {
|
|
300
|
+
totalIndexCount += indexAttribute.count;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
validMeshes.push(mesh);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
const vertices = new Float32Array(totalVertexCount * 3);
|
|
307
|
+
const indices = new Uint32Array(populateIndices ? totalIndexCount: 0);
|
|
308
|
+
|
|
309
|
+
let vertexOffset = 0;
|
|
310
|
+
let indexOffset = 0;
|
|
311
|
+
|
|
312
|
+
for (const mesh of validMeshes) {
|
|
313
|
+
const geometry = mesh.geometry;
|
|
314
|
+
if (indices !== null) {
|
|
315
|
+
const indexAttribute = geometry.getIndex();
|
|
316
|
+
if (indexAttribute) {
|
|
317
|
+
for (let i = 0; i < indexAttribute.count; i++) {
|
|
318
|
+
indices[indexOffset + i] = indexAttribute.getX(i) + vertexOffset;
|
|
319
|
+
}
|
|
320
|
+
indexOffset += indexAttribute.count;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
const matrix = mesh.matrixWorld;
|
|
325
|
+
const positionAttribute = geometry.getAttribute('position');
|
|
326
|
+
for (let i = 0; i < positionAttribute.count; i++) {
|
|
327
|
+
// Must apply the mesh's matrix as there can be a transform from the mesh inside gltf
|
|
328
|
+
const vertex = new THREE.Vector3(
|
|
329
|
+
positionAttribute.getX(i),
|
|
330
|
+
positionAttribute.getY(i),
|
|
331
|
+
positionAttribute.getZ(i)
|
|
332
|
+
);
|
|
333
|
+
vertex.applyMatrix4(matrix);
|
|
334
|
+
|
|
335
|
+
vertices[(vertexOffset + i) * 3] = vertex.x;
|
|
336
|
+
vertices[(vertexOffset + i) * 3 + 1] = vertex.y;
|
|
337
|
+
vertices[(vertexOffset + i) * 3 + 2] = vertex.z;
|
|
338
|
+
}
|
|
339
|
+
vertexOffset += positionAttribute.count;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
return {vertices, indices};
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
private calcBoundingPrimitive<T extends THREE.Box3 | THREE.Sphere>(
|
|
346
|
+
meshes: THREE.Mesh[],
|
|
347
|
+
calcBoundingFunc: (geometry: THREE.BufferGeometry) => void,
|
|
348
|
+
getBoundingFunc: (geometry: THREE.BufferGeometry) => T | null,
|
|
349
|
+
primitiveType: new () => T
|
|
350
|
+
): T {
|
|
351
|
+
const combined: T = new primitiveType();
|
|
352
|
+
for (const mesh of meshes) {
|
|
353
|
+
const geometry = mesh.geometry;
|
|
354
|
+
{
|
|
355
|
+
const bounding = getBoundingFunc(geometry);
|
|
356
|
+
if (!bounding) {
|
|
357
|
+
calcBoundingFunc(geometry);
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
const bounding = getBoundingFunc(geometry)!.clone();
|
|
362
|
+
// The bounding (box/sphere/etc...) is calculated from the geometry with no transforms
|
|
363
|
+
// its parent node in glb can carry extra transforms, so we need to take that into account
|
|
364
|
+
bounding.applyMatrix4(mesh.matrixWorld);
|
|
365
|
+
|
|
366
|
+
(combined as any).union(bounding);
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
return combined;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
private makeMeshColliderDescTemplate(meshes: THREE.Mesh[] | null, collisionMeshType: CollisionMeshType = CollisionMeshType.ConvexHull): RAPIER.ColliderDesc | null {
|
|
373
|
+
if (!meshes || meshes.length === 0) {
|
|
374
|
+
console.error('No meshes provided to create mesh body');
|
|
375
|
+
return null;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
const cacheKey = meshes.map(m => m.id).sort().join(',') + '|' + collisionMeshType;
|
|
379
|
+
if (this.cachedColliderDescTemplates.has(cacheKey)) {
|
|
380
|
+
return this.cachedColliderDescTemplates.get(cacheKey)!;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
let colliderDesc: RAPIER.ColliderDesc | null = null;
|
|
384
|
+
|
|
385
|
+
// Use the combined data for collider creation
|
|
386
|
+
try {
|
|
387
|
+
// Determine which type of collider to create based on collisionMeshType
|
|
388
|
+
switch (collisionMeshType) {
|
|
389
|
+
case CollisionMeshType.Trimesh:
|
|
390
|
+
{
|
|
391
|
+
const { vertices, indices } = this.populateVerticesAndIndices(meshes, true);
|
|
392
|
+
console.log('Create Trimesh collider with', vertices.length, 'vertices', indices.length, 'indices');
|
|
393
|
+
colliderDesc = RAPIER.ColliderDesc.trimesh(vertices, indices);
|
|
394
|
+
break;
|
|
395
|
+
}
|
|
396
|
+
case CollisionMeshType.ConvexHull:
|
|
397
|
+
{
|
|
398
|
+
const { vertices } = this.populateVerticesAndIndices(meshes, false);
|
|
399
|
+
console.log('Create ConvexHull collider with', vertices.length, 'vertices');
|
|
400
|
+
colliderDesc = RAPIER.ColliderDesc.convexHull(vertices);
|
|
401
|
+
break;
|
|
402
|
+
}
|
|
403
|
+
case CollisionMeshType.BoundingBox:
|
|
404
|
+
{
|
|
405
|
+
const boundingBox = this.calcBoundingPrimitive(
|
|
406
|
+
meshes,
|
|
407
|
+
(geometry) => geometry.computeBoundingBox(),
|
|
408
|
+
(geometry) => geometry.boundingBox,
|
|
409
|
+
THREE.Box3
|
|
410
|
+
);
|
|
411
|
+
const halfExtents = new THREE.Vector3();
|
|
412
|
+
boundingBox.getSize(halfExtents);
|
|
413
|
+
halfExtents.multiplyScalar(0.5);
|
|
414
|
+
|
|
415
|
+
// Create box collider using the combined bounding box dimensions
|
|
416
|
+
console.log('Created box collider with half dimensions', halfExtents.x, halfExtents.y, halfExtents.z, 'from', meshes.length, 'meshes');
|
|
417
|
+
colliderDesc = RAPIER.ColliderDesc.cuboid(halfExtents.x, halfExtents.y, halfExtents.z);
|
|
418
|
+
const offset = boundingBox.getCenter(new THREE.Vector3());
|
|
419
|
+
colliderDesc.setTranslation(offset.x, offset.y, offset.z);
|
|
420
|
+
break;
|
|
421
|
+
}
|
|
422
|
+
case CollisionMeshType.BoundingSphere:
|
|
423
|
+
{
|
|
424
|
+
const combinedBoundingSphere = this.calcBoundingPrimitive(
|
|
425
|
+
meshes,
|
|
426
|
+
(geometry) => geometry.computeBoundingSphere(),
|
|
427
|
+
(geometry) => geometry.boundingSphere,
|
|
428
|
+
THREE.Sphere
|
|
429
|
+
);
|
|
430
|
+
const radius = combinedBoundingSphere.radius;
|
|
431
|
+
console.log('Created sphere collider with radius', radius, 'from', meshes.length, 'meshes');
|
|
432
|
+
|
|
433
|
+
colliderDesc = RAPIER.ColliderDesc.ball(radius);
|
|
434
|
+
const offset = combinedBoundingSphere.center;
|
|
435
|
+
colliderDesc.setTranslation(offset.x, offset.y, offset.z);
|
|
436
|
+
break;
|
|
437
|
+
}
|
|
438
|
+
case CollisionMeshType.Voxels:
|
|
439
|
+
{
|
|
440
|
+
// until we support generating voxels from meshes, we expect the user to provide voxel coords and process that in doCreateVoxelBody
|
|
441
|
+
console.error('Voxel type collision mesh should be handled by doCreateVoxelBody');
|
|
442
|
+
break;
|
|
443
|
+
}
|
|
444
|
+
default:
|
|
445
|
+
console.error('Invalid collision mesh type:', collisionMeshType);
|
|
446
|
+
break;
|
|
447
|
+
}
|
|
448
|
+
} catch (error) {
|
|
449
|
+
console.error('Error creating mesh collider:', error);
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
this.cachedColliderDescTemplates.set(cacheKey, colliderDesc);
|
|
453
|
+
|
|
454
|
+
return colliderDesc;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
private scaleMeshColliderDesc(colliderDesc: RAPIER.ColliderDesc | null, scale: THREE.Vector3): RAPIER.ColliderDesc | null {
|
|
458
|
+
// don't bother for (1, 1, 1) scale
|
|
459
|
+
if (scale.x === 1 && scale.y === 1 && scale.z === 1) return colliderDesc;
|
|
460
|
+
|
|
461
|
+
if (!colliderDesc) return null;
|
|
462
|
+
|
|
463
|
+
switch (colliderDesc.shape.type) {
|
|
464
|
+
case RAPIER.ShapeType.Cuboid: {
|
|
465
|
+
const halfExtents = (colliderDesc.shape as RAPIER.Cuboid).halfExtents;
|
|
466
|
+
|
|
467
|
+
const scaledDesc = RAPIER.ColliderDesc.cuboid(halfExtents.x * scale.x, halfExtents.y * scale.y, halfExtents.z * scale.z);
|
|
468
|
+
const translation = colliderDesc.translation;
|
|
469
|
+
scaledDesc.setTranslation(translation.x * scale.x, translation.y * scale.y, translation.z * scale.z);
|
|
470
|
+
return scaledDesc;
|
|
471
|
+
}
|
|
472
|
+
case RAPIER.ShapeType.Ball: {
|
|
473
|
+
const radius = (colliderDesc.shape as RAPIER.Ball).radius;
|
|
474
|
+
const scaledDesc = RAPIER.ColliderDesc.ball(radius * Math.max(scale.x, scale.y, scale.z));
|
|
475
|
+
const translation = colliderDesc.translation;
|
|
476
|
+
scaledDesc.setTranslation(translation.x * scale.x, translation.y * scale.y, translation.z * scale.z);
|
|
477
|
+
return scaledDesc;
|
|
478
|
+
}
|
|
479
|
+
case RAPIER.ShapeType.TriMesh: {
|
|
480
|
+
const vertices = (colliderDesc.shape as RAPIER.TriMesh).vertices.map((v, i) => v * (i % 3 === 0 ? scale.x : (i % 3 === 1 ? scale.y : scale.z)));
|
|
481
|
+
const indices = (colliderDesc.shape as RAPIER.TriMesh).indices;
|
|
482
|
+
return RAPIER.ColliderDesc.trimesh(vertices, indices);
|
|
483
|
+
}
|
|
484
|
+
case RAPIER.ShapeType.ConvexPolyhedron: {
|
|
485
|
+
const vertices = (colliderDesc.shape as RAPIER.ConvexPolyhedron).vertices.map((v, i) => v * (i % 3 === 0 ? scale.x : (i % 3 === 1 ? scale.y : scale.z)));
|
|
486
|
+
return RAPIER.ColliderDesc.convexHull(vertices);
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
console.error(`Unknown collision type: ${colliderDesc.shape.type}`);
|
|
491
|
+
return colliderDesc;
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
/**
|
|
495
|
+
* Creates a mesh-based collider using either trimesh, convexMesh, or convexHull
|
|
496
|
+
* based on the mesh geometry and collisionMeshType option
|
|
497
|
+
*/
|
|
498
|
+
protected doCreateMeshBody(desc: MeshBodyDesc, worldScale: THREE.Vector3): TRecord | null {
|
|
499
|
+
const colliderDesc = this.scaleMeshColliderDesc(
|
|
500
|
+
this.makeMeshColliderDescTemplate(desc.meshes, desc.options.collisionMeshType), worldScale
|
|
501
|
+
);
|
|
502
|
+
if (!colliderDesc) {
|
|
503
|
+
return null;
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
return this.createBody(colliderDesc, desc);
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
protected doCreateMeshBodiesWithTransformOverrides(desc: MeshBodyDesc, transforms: {position?: THREE.Vector3, rotation?: THREE.Quaternion, scale?: THREE.Vector3}[]): TRecord[] {
|
|
510
|
+
const templateColliderDesc = this.makeMeshColliderDescTemplate(desc.meshes, desc.options.collisionMeshType);
|
|
511
|
+
if (!templateColliderDesc) {
|
|
512
|
+
return [];
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
const baseDesc = {
|
|
516
|
+
motionType: desc.motionType,
|
|
517
|
+
options: desc.options,
|
|
518
|
+
worldPos: desc.worldPos,
|
|
519
|
+
worldQuat: desc.worldQuat,
|
|
520
|
+
mass: desc.mass,
|
|
521
|
+
};
|
|
522
|
+
|
|
523
|
+
const cachedColliderDesc: Record<string, RAPIER.ColliderDesc | null> = {};
|
|
524
|
+
|
|
525
|
+
const records: TRecord[] = [];
|
|
526
|
+
for (const transform of transforms) {
|
|
527
|
+
const scale = transform.scale ?? new THREE.Vector3(1, 1, 1);
|
|
528
|
+
const scaleKey = String(scale.toArray());
|
|
529
|
+
cachedColliderDesc[scaleKey] ??= this.scaleMeshColliderDesc(templateColliderDesc, scale);
|
|
530
|
+
const colliderDesc = cachedColliderDesc[scaleKey];
|
|
531
|
+
if (colliderDesc) {
|
|
532
|
+
// overwrite the position and rotation
|
|
533
|
+
baseDesc.worldPos = transform.position ?? new THREE.Vector3(0, 0, 0);
|
|
534
|
+
baseDesc.worldQuat = transform.rotation ?? new THREE.Quaternion(0, 0, 0, 1);
|
|
535
|
+
const record = this.createBody(colliderDesc, baseDesc);
|
|
536
|
+
if (record) {
|
|
537
|
+
records.push(record);
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
return records;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
protected doCreateVoxelBody(desc: VoxelBodyDesc): TRecord | null {
|
|
546
|
+
const voxelSize = desc.voxelSize;
|
|
547
|
+
const voxels = desc.voxels;
|
|
548
|
+
const colliderDesc = RAPIER.ColliderDesc.voxels(voxels, new RAPIER.Vector3(voxelSize.x, voxelSize.y, voxelSize.z));
|
|
549
|
+
const offset = desc.offset;
|
|
550
|
+
if (offset) {
|
|
551
|
+
colliderDesc.setTranslation(offset.x, offset.y, offset.z);
|
|
552
|
+
}
|
|
553
|
+
return this.createBody(colliderDesc, desc);
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
protected doCreateSphereBody(desc: SphereBodyDesc): TRecord | null {
|
|
557
|
+
const colliderDesc = RAPIER.ColliderDesc.ball(desc.radius);
|
|
558
|
+
return this.createBody(colliderDesc, desc);
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
protected doCreateCylinderBody(desc: CylinderBodyDesc): TRecord | null {
|
|
562
|
+
const colliderDesc = RAPIER.ColliderDesc.cylinder(desc.height / 2, desc.radius);
|
|
563
|
+
return this.createBody(colliderDesc, desc);
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
protected doCreateConeBody(desc: ConeBodyDesc): TRecord | null {
|
|
567
|
+
const colliderDesc = RAPIER.ColliderDesc.cone(desc.height / 2, desc.radius);
|
|
568
|
+
return this.createBody(colliderDesc, desc);
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
protected doCreateCapsuleBody(desc: CapsuleBodyDesc): TRecord | null {
|
|
572
|
+
const colliderDesc = RAPIER.ColliderDesc.capsule(desc.height / 2, desc.radius);
|
|
573
|
+
return this.createBody(colliderDesc, desc);
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
protected doCreateHeightFieldBody(desc: HeightFieldBodyDesc): TRecord | null {
|
|
577
|
+
// Transform heightmap data to match RAPIER's format
|
|
578
|
+
const transformedHeightMap = new Float32Array(desc.heights.length);
|
|
579
|
+
for (var z = 0; z < desc.depthPixels; z++) {
|
|
580
|
+
for (var x = 0; x < desc.widthPixels; x++) {
|
|
581
|
+
const readIndex = z * desc.widthPixels + x;
|
|
582
|
+
const writeIndex = x * desc.depthPixels + z;
|
|
583
|
+
transformedHeightMap[writeIndex] = desc.heights[readIndex];
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
const terrainScale = this.makeVector([
|
|
588
|
+
desc.width,
|
|
589
|
+
1,
|
|
590
|
+
desc.depth
|
|
591
|
+
]);
|
|
592
|
+
const colliderDesc = RAPIER.ColliderDesc.heightfield(desc.widthPixels - 1, desc.depthPixels - 1, transformedHeightMap, terrainScale);
|
|
593
|
+
return this.createBody(colliderDesc, desc);
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
protected doRemoveComponent(record: TRecord): boolean {
|
|
597
|
+
const world = this.world!;
|
|
598
|
+
const collider = record[1];
|
|
599
|
+
this.colliderToComponent.delete(collider.handle);
|
|
600
|
+
world.removeRigidBody(record[0]);
|
|
601
|
+
world.removeCollider(collider, false);
|
|
602
|
+
return true;
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
protected doUpdateTransform(component: PrimitiveComponent, record: TRecord): void {
|
|
606
|
+
const body: RAPIER.RigidBody = record[0];
|
|
607
|
+
const motionType: PhysicsMotionType = record[2];
|
|
608
|
+
const worldPosition = new THREE.Vector3();
|
|
609
|
+
const worldQuat = new THREE.Quaternion();
|
|
610
|
+
component.getWorldPosition(worldPosition);
|
|
611
|
+
component.getWorldQuaternion(worldQuat);
|
|
612
|
+
const flags = component.getPhysicsTransformUpdateFlags();
|
|
613
|
+
|
|
614
|
+
const newRotation = this.makeRotation(worldQuat.toArray());
|
|
615
|
+
const newPosition = this.makeVector(worldPosition.toArray());
|
|
616
|
+
switch (motionType) {
|
|
617
|
+
case PhysicsMotionType.Static:
|
|
618
|
+
if (flags.sendPosition) {
|
|
619
|
+
body.setTranslation(newPosition, true);
|
|
620
|
+
}
|
|
621
|
+
if (flags.sendRotation) {
|
|
622
|
+
body.setRotation(newRotation, true);
|
|
623
|
+
}
|
|
624
|
+
break;
|
|
625
|
+
case PhysicsMotionType.Dynamic:
|
|
626
|
+
if (flags.sendPosition) {
|
|
627
|
+
body.setTranslation(newPosition, true);
|
|
628
|
+
}
|
|
629
|
+
if (flags.sendRotation) {
|
|
630
|
+
body.setRotation(newRotation, true);
|
|
631
|
+
}
|
|
632
|
+
break;
|
|
633
|
+
case PhysicsMotionType.KinematicPositionBased:
|
|
634
|
+
if (flags.sendPosition) {
|
|
635
|
+
body.setNextKinematicTranslation(newPosition);
|
|
636
|
+
}
|
|
637
|
+
if (flags.sendRotation) {
|
|
638
|
+
body.setNextKinematicRotation(newRotation);
|
|
639
|
+
}
|
|
640
|
+
break;
|
|
641
|
+
case PhysicsMotionType.KinematicVelocityBased:
|
|
642
|
+
const userData = (body.userData ?? {}) as any;
|
|
643
|
+
const linearVelocity = userData[PhysicsVectorParam.LinearVelocity] as VectorArray | undefined;
|
|
644
|
+
const angularVelocity = userData[PhysicsVectorParam.AngularVelocity] as VectorArray | undefined;
|
|
645
|
+
if (flags.sendPosition && !linearVelocity) {
|
|
646
|
+
const currentPosition = body.translation();
|
|
647
|
+
const timestep = this.world!.timestep;
|
|
648
|
+
const velocity = {
|
|
649
|
+
x: (newPosition.x - currentPosition.x) / timestep,
|
|
650
|
+
y: (newPosition.y - currentPosition.y) / timestep,
|
|
651
|
+
z: (newPosition.z - currentPosition.z) / timestep,
|
|
652
|
+
};
|
|
653
|
+
body.setLinvel(velocity, true);
|
|
654
|
+
}
|
|
655
|
+
if (flags.sendRotation && !angularVelocity) {
|
|
656
|
+
const currentRotation = body.rotation();
|
|
657
|
+
const timestep = this.world!.timestep;
|
|
658
|
+
|
|
659
|
+
// Calculate quaternion difference: q_diff = newRotation * currentRotation^-1
|
|
660
|
+
const qx = newRotation.w * currentRotation.x - newRotation.x * currentRotation.w - newRotation.y * currentRotation.z + newRotation.z * currentRotation.y;
|
|
661
|
+
const qy = newRotation.w * currentRotation.y + newRotation.x * currentRotation.z - newRotation.y * currentRotation.w - newRotation.z * currentRotation.x;
|
|
662
|
+
const qz = newRotation.w * currentRotation.z - newRotation.x * currentRotation.y + newRotation.y * currentRotation.x - newRotation.z * currentRotation.w;
|
|
663
|
+
const qw = newRotation.w * currentRotation.w + newRotation.x * currentRotation.x + newRotation.y * currentRotation.y + newRotation.z * currentRotation.z;
|
|
664
|
+
|
|
665
|
+
// Convert quaternion to axis-angle, then to angular velocity
|
|
666
|
+
const sinHalfAngle = Math.sqrt(qx * qx + qy * qy + qz * qz);
|
|
667
|
+
const angle = 2 * Math.atan2(sinHalfAngle, qw);
|
|
668
|
+
const scale = sinHalfAngle > 1e-6 ? angle / sinHalfAngle / timestep : 2 / timestep;
|
|
669
|
+
|
|
670
|
+
const velocity = {
|
|
671
|
+
x: qx * scale,
|
|
672
|
+
y: qy * scale,
|
|
673
|
+
z: qz * scale,
|
|
674
|
+
};
|
|
675
|
+
body.setAngvel(velocity, true);
|
|
676
|
+
}
|
|
677
|
+
break;
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
protected doGetScalarParam(record: TRecord, param: PhysicsScalarParam): number | null {
|
|
682
|
+
const body = record[0];
|
|
683
|
+
switch (param) {
|
|
684
|
+
case PhysicsScalarParam.LinearDamping:
|
|
685
|
+
return body.linearDamping();
|
|
686
|
+
case PhysicsScalarParam.AngularDamping:
|
|
687
|
+
return body.angularDamping();
|
|
688
|
+
case PhysicsScalarParam.GravityScale:
|
|
689
|
+
return body.gravityScale();
|
|
690
|
+
default:
|
|
691
|
+
ensure(false);
|
|
692
|
+
}
|
|
693
|
+
return null;
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
protected override doSetScalarParam(records: TRecord[], param: PhysicsScalarParam, value: number): boolean {
|
|
697
|
+
const doTask = (record: TRecord) => {
|
|
698
|
+
const body = record[0];
|
|
699
|
+
switch (param) {
|
|
700
|
+
case PhysicsScalarParam.LinearDamping:
|
|
701
|
+
body.setLinearDamping(value);
|
|
702
|
+
return true;
|
|
703
|
+
case PhysicsScalarParam.AngularDamping:
|
|
704
|
+
body.setAngularDamping(value);
|
|
705
|
+
return true;
|
|
706
|
+
case PhysicsScalarParam.GravityScale:
|
|
707
|
+
body.setGravityScale(value, true);
|
|
708
|
+
return true;
|
|
709
|
+
default:
|
|
710
|
+
ensure(false);
|
|
711
|
+
}
|
|
712
|
+
return false;
|
|
713
|
+
};
|
|
714
|
+
|
|
715
|
+
let result = true;
|
|
716
|
+
for (const record of records) {
|
|
717
|
+
result &&= doTask(record);
|
|
718
|
+
}
|
|
719
|
+
return result;
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
protected override doGetVectorParam(record: TRecord, param: PhysicsVectorParam): VectorArray | null {
|
|
723
|
+
const body = record[0];
|
|
724
|
+
let ret: RAPIER.Vector | null = null;
|
|
725
|
+
switch (param) {
|
|
726
|
+
case PhysicsVectorParam.LinearVelocity:
|
|
727
|
+
ret = body.linvel();
|
|
728
|
+
break;
|
|
729
|
+
case PhysicsVectorParam.AngularVelocity:
|
|
730
|
+
ret = body.angvel();
|
|
731
|
+
break;
|
|
732
|
+
default:
|
|
733
|
+
ensure(false);
|
|
734
|
+
}
|
|
735
|
+
return ret ? [ret.x, ret.y, ret.z] : null;
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
protected override doSetVectorParam(record: TRecord, param: PhysicsVectorParam, value: VectorArray): boolean {
|
|
739
|
+
const body = record[0];
|
|
740
|
+
body.userData ??= {};
|
|
741
|
+
(body.userData as any)[param] = value;
|
|
742
|
+
switch (param) {
|
|
743
|
+
case PhysicsVectorParam.LinearVelocity:
|
|
744
|
+
body.setLinvel(this.makeVector(value), true);
|
|
745
|
+
return true;
|
|
746
|
+
case PhysicsVectorParam.AngularVelocity:
|
|
747
|
+
body.setAngvel(this.makeVector(value), true);
|
|
748
|
+
return true;
|
|
749
|
+
default:
|
|
750
|
+
ensure(false);
|
|
751
|
+
}
|
|
752
|
+
return false;
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
protected override doClearVectorParam(record: TRecord, param: PhysicsVectorParam): boolean {
|
|
756
|
+
const body = record[0];
|
|
757
|
+
body.userData ??= {};
|
|
758
|
+
(body.userData as any)[param] = undefined;
|
|
759
|
+
return true;
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
protected override doCreateCharacterController(options: CharacterControllerOptions): TCharacterControllerRecord | null {
|
|
763
|
+
const world = this.world!;
|
|
764
|
+
const controller: RAPIER.KinematicCharacterController = world.createCharacterController(options.offset);
|
|
765
|
+
controller.setUp({ x: 0.0, y: 1.0, z: 0.0 });
|
|
766
|
+
|
|
767
|
+
if (options.applyImpulsesToDynamicBodies !== undefined) {
|
|
768
|
+
controller.setApplyImpulsesToDynamicBodies(options.applyImpulsesToDynamicBodies);
|
|
769
|
+
}
|
|
770
|
+
if (options.characterMass !== undefined) {
|
|
771
|
+
controller.setCharacterMass(options.characterMass);
|
|
772
|
+
}
|
|
773
|
+
if (options.slideEnabled !== undefined) {
|
|
774
|
+
controller.setSlideEnabled(options.slideEnabled);
|
|
775
|
+
}
|
|
776
|
+
if (options.maxSlopeClimbAngle !== undefined) {
|
|
777
|
+
controller.setMaxSlopeClimbAngle(options.maxSlopeClimbAngle);
|
|
778
|
+
}
|
|
779
|
+
if (options.minSlopeSlideAngle !== undefined) {
|
|
780
|
+
controller.setMinSlopeSlideAngle(options.minSlopeSlideAngle);
|
|
781
|
+
}
|
|
782
|
+
if (options.snapToGroundDistance !== undefined) {
|
|
783
|
+
controller.enableSnapToGround(options.snapToGroundDistance);
|
|
784
|
+
}
|
|
785
|
+
if (options.autoStepConfig !== undefined) {
|
|
786
|
+
controller.enableAutostep(options.autoStepConfig.maxHeight, options.autoStepConfig.minWidth, options.autoStepConfig.includeDynamicBodies);
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
return controller;
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
protected override doRemoveCharacterController(record: TCharacterControllerRecord): boolean {
|
|
793
|
+
const world = this.world!;
|
|
794
|
+
world.removeCharacterController(record);
|
|
795
|
+
return true;
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
protected override doComputeCharacterMovement(record: TCharacterControllerRecord, recordToMove: TRecord, movement: VectorArray, ignoreCollision: boolean): { isGrounded: boolean } {
|
|
799
|
+
// See https://rapier.rs/docs/user_guides/javascript/character_controller
|
|
800
|
+
const controller = record;
|
|
801
|
+
const body = recordToMove[0];
|
|
802
|
+
const collider = recordToMove[1];
|
|
803
|
+
const motionType = recordToMove[2];
|
|
804
|
+
controller.computeColliderMovement(
|
|
805
|
+
collider,
|
|
806
|
+
this.makeVector(movement),
|
|
807
|
+
RAPIER.QueryFilterFlags.EXCLUDE_SENSORS,
|
|
808
|
+
collider.collisionGroups(),
|
|
809
|
+
ignoreCollision ? (collider: RAPIER.Collider) => { return false; } : undefined
|
|
810
|
+
);
|
|
811
|
+
const actualMovement = controller.computedMovement();
|
|
812
|
+
const bodyPosition = body.translation();
|
|
813
|
+
bodyPosition.x += actualMovement.x;
|
|
814
|
+
bodyPosition.y += actualMovement.y;
|
|
815
|
+
bodyPosition.z += actualMovement.z;
|
|
816
|
+
switch (motionType) {
|
|
817
|
+
case PhysicsMotionType.Dynamic:
|
|
818
|
+
body.setTranslation(bodyPosition, true);
|
|
819
|
+
break;
|
|
820
|
+
case PhysicsMotionType.KinematicPositionBased:
|
|
821
|
+
body.setNextKinematicTranslation(bodyPosition);
|
|
822
|
+
break;
|
|
823
|
+
case PhysicsMotionType.KinematicVelocityBased:
|
|
824
|
+
const timestep = this.world!.timestep;
|
|
825
|
+
const velocity = {x: actualMovement.x/timestep, y: actualMovement.y/timestep, z: actualMovement.z/timestep};
|
|
826
|
+
body.setLinvel(velocity, true);
|
|
827
|
+
break;
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
// Get grounded state from controller
|
|
831
|
+
let isGrounded = controller.computedGrounded();
|
|
832
|
+
|
|
833
|
+
// Workaround for voxel colliders: if controller says not grounded but we had downward movement
|
|
834
|
+
// and the actual movement was much less than requested (indicating collision), consider grounded
|
|
835
|
+
if (!isGrounded && movement[1] < 0) {
|
|
836
|
+
// We intended to move down, check if we were blocked
|
|
837
|
+
const intendedVertical = movement[1];
|
|
838
|
+
const actualVertical = actualMovement.y;
|
|
839
|
+
// If actual movement is significantly less than intended (more than 90% blocked), we hit ground
|
|
840
|
+
if (Math.abs(actualVertical) < Math.abs(intendedVertical) * 0.1) {
|
|
841
|
+
isGrounded = true;
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
const handleA = collider.handle;
|
|
846
|
+
const numCollisions = controller.numComputedCollisions();
|
|
847
|
+
const previousCollidedHandles = this.cachedCharacterControllerCollisions.get(handleA) ?? [];
|
|
848
|
+
const newCollidedHandles: number[] = [];
|
|
849
|
+
for (let index = 0; index < numCollisions; index++) {
|
|
850
|
+
const collision: RAPIER.CharacterCollision | null = controller.computedCollision(index);
|
|
851
|
+
if (collision && collision.collider) {
|
|
852
|
+
const handleB = collision.collider.handle;
|
|
853
|
+
newCollidedHandles.push(handleB);
|
|
854
|
+
if (!previousCollidedHandles.includes(handleB)) {
|
|
855
|
+
this.handleRapierCollision(handleA, handleB, true);
|
|
856
|
+
}
|
|
857
|
+
}
|
|
858
|
+
}
|
|
859
|
+
for(const handleB of previousCollidedHandles) {
|
|
860
|
+
if (!newCollidedHandles.includes(handleB)) {
|
|
861
|
+
this.handleRapierCollision(handleA, handleB, false);
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
this.cachedCharacterControllerCollisions.set(handleA, newCollidedHandles);
|
|
865
|
+
|
|
866
|
+
return { isGrounded };
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
public override getComponentState(component: PrimitiveComponent): PrimitiveComponentPhysicsState | null {
|
|
870
|
+
const records = this.bodies.get(component);
|
|
871
|
+
if (!records || records.length === 0) {
|
|
872
|
+
return null;
|
|
873
|
+
}
|
|
874
|
+
const record = records[0];
|
|
875
|
+
return {
|
|
876
|
+
isTrigger: record[1].isSensor(),
|
|
877
|
+
motionType: record[2],
|
|
878
|
+
};
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
//====================================================================================================
|
|
882
|
+
|
|
883
|
+
public override getCollisionEvents(): RawCollisionEvent[] {
|
|
884
|
+
return this.pendingCollisions;
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
public override clearCollisionEvents(): void {
|
|
888
|
+
this.pendingCollisions = [];
|
|
889
|
+
}
|
|
890
|
+
|
|
891
|
+
/**
|
|
892
|
+
* Toggles the physics debug renderer visibility
|
|
893
|
+
* @param enabled Whether the debug renderer should be visible
|
|
894
|
+
* @returns Whether the debug renderer is now enabled
|
|
895
|
+
*/
|
|
896
|
+
public override setDebugRendererEnabled(enabled: boolean): boolean {
|
|
897
|
+
if (this.debugRenderer) {
|
|
898
|
+
this.debugRenderer.enabled = enabled;
|
|
899
|
+
return true;
|
|
900
|
+
}
|
|
901
|
+
return false;
|
|
902
|
+
}
|
|
903
|
+
|
|
904
|
+
/**
|
|
905
|
+
* Checks if the physics debug renderer is enabled
|
|
906
|
+
* @returns Whether the debug renderer is currently enabled, or false if not available
|
|
907
|
+
*/
|
|
908
|
+
public override isDebugRendererEnabled(): boolean {
|
|
909
|
+
return this.debugRenderer?.enabled ?? false;
|
|
910
|
+
}
|
|
911
|
+
|
|
912
|
+
private createBody(colliderDesc: RAPIER.ColliderDesc, desc: BaseDesc): TRecord | null {
|
|
913
|
+
const world = this.world!;
|
|
914
|
+
|
|
915
|
+
const collisionProfileName = desc.options.collisionProfile ?? DefaultCollisionProfile.Default;
|
|
916
|
+
const collisionConfig = CollisionConfig.getInstance();
|
|
917
|
+
const collisionProfile = collisionConfig.profiles.find(p => p.name === collisionProfileName);
|
|
918
|
+
|
|
919
|
+
const isSensor = collisionProfile?.mode === CollisionMode.QueryOnly;
|
|
920
|
+
|
|
921
|
+
// FIXME: Find out what of this should be configured based on the profile instead
|
|
922
|
+
const rigidBodyDesc = this.createRigidBodyDesc(desc.motionType);
|
|
923
|
+
rigidBodyDesc.mass = desc.mass;
|
|
924
|
+
rigidBodyDesc.setCcdEnabled(!!desc.options.enableCCD);
|
|
925
|
+
|
|
926
|
+
const generateCollisionEvents = !!desc.options.generateCollisionEvents || isSensor;
|
|
927
|
+
colliderDesc.setActiveEvents(generateCollisionEvents ? RAPIER.ActiveEvents.COLLISION_EVENTS : RAPIER.ActiveEvents.NONE);
|
|
928
|
+
if (generateCollisionEvents) {
|
|
929
|
+
colliderDesc.setActiveCollisionTypes(RAPIER.ActiveCollisionTypes.ALL);
|
|
930
|
+
}
|
|
931
|
+
|
|
932
|
+
const createCollider = (pos: THREE.Vector3, rot: THREE.Quaternion) => {
|
|
933
|
+
const rigidBody = world.createRigidBody(rigidBodyDesc);
|
|
934
|
+
rigidBody.setTranslation(this.makeVector(pos.toArray()), true);
|
|
935
|
+
rigidBody.setRotation(this.makeRotation(rot.toArray()), true);
|
|
936
|
+
const collider = world.createCollider(colliderDesc, rigidBody);
|
|
937
|
+
collider.setSensor(isSensor);
|
|
938
|
+
rigidBody.setGravityScale(desc.options.gravityScale ?? 1, true);
|
|
939
|
+
if (collisionProfile) {
|
|
940
|
+
collider.setCollisionGroups(this.getCollisionGroups(collisionProfile));
|
|
941
|
+
}
|
|
942
|
+
|
|
943
|
+
return { rigidBody, collider };
|
|
944
|
+
};
|
|
945
|
+
|
|
946
|
+
const {rigidBody, collider} = createCollider(desc.worldPos, desc.worldQuat);
|
|
947
|
+
return [rigidBody, collider, desc.motionType];
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
private getCollisionGroups(collisionProfile: CollisionProfile): number {
|
|
951
|
+
// top 16 bits indicate what channel this object occupies, for now that's always a single channel
|
|
952
|
+
// bottom 16 bits indicate what channels it can interact with
|
|
953
|
+
let groups = getCollisionChannelBit(collisionProfile.objectChannel) << 16;
|
|
954
|
+
collisionProfile.responses.forEach(r => {
|
|
955
|
+
// need to set the collision group even for overlapping interaction, otherwise collision event will NOT be generated
|
|
956
|
+
if (r.response !== CollisionResponse.Ignore) {
|
|
957
|
+
const channelEnum = typeof r.channel === 'string' ? resolveChannelName(r.channel) : r.channel;
|
|
958
|
+
if (channelEnum !== undefined) {
|
|
959
|
+
groups |= getCollisionChannelBit(channelEnum);
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
});
|
|
963
|
+
return groups;
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
private createRigidBodyDesc(motionType: PhysicsMotionType): RAPIER.RigidBodyDesc {
|
|
967
|
+
switch (motionType) {
|
|
968
|
+
case PhysicsMotionType.Static:
|
|
969
|
+
return RAPIER.RigidBodyDesc.fixed();
|
|
970
|
+
case PhysicsMotionType.KinematicVelocityBased:
|
|
971
|
+
return RAPIER.RigidBodyDesc.kinematicVelocityBased();
|
|
972
|
+
case PhysicsMotionType.KinematicPositionBased:
|
|
973
|
+
return RAPIER.RigidBodyDesc.kinematicPositionBased();
|
|
974
|
+
case PhysicsMotionType.Dynamic:
|
|
975
|
+
return RAPIER.RigidBodyDesc.dynamic();
|
|
976
|
+
}
|
|
977
|
+
}
|
|
978
|
+
|
|
979
|
+
private makeVector(v: [number, number, number]): RAPIER.Vector {
|
|
980
|
+
return {
|
|
981
|
+
x: v[0],
|
|
982
|
+
y: v[1],
|
|
983
|
+
z: v[2],
|
|
984
|
+
};
|
|
985
|
+
}
|
|
986
|
+
|
|
987
|
+
private makeRotation(r: [number, number, number, number]): RAPIER.Rotation {
|
|
988
|
+
return {
|
|
989
|
+
x: r[0],
|
|
990
|
+
y: r[1],
|
|
991
|
+
z: r[2],
|
|
992
|
+
w: r[3],
|
|
993
|
+
};
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
// Override addComponent to handle collider mapping
|
|
997
|
+
public override addComponent(component: PrimitiveComponent): PhysicsMotionType | null {
|
|
998
|
+
|
|
999
|
+
const motionType = super.addComponent(component);
|
|
1000
|
+
const records = this.bodies.get(component);
|
|
1001
|
+
if (records) {
|
|
1002
|
+
records.forEach((record) => {
|
|
1003
|
+
const collider = record[1];
|
|
1004
|
+
this.colliderToComponent.set(collider.handle, component);
|
|
1005
|
+
});
|
|
1006
|
+
}
|
|
1007
|
+
return motionType;
|
|
1008
|
+
}
|
|
1009
|
+
|
|
1010
|
+
protected override doSetComponentCollisionIgnore(recordA: TRecord, recordB: TRecord, ignore: boolean): boolean {
|
|
1011
|
+
const colliderA = recordA[1];
|
|
1012
|
+
const colliderB = recordB[1];
|
|
1013
|
+
const pairKey = `${colliderA.handle},${colliderB.handle}`;
|
|
1014
|
+
|
|
1015
|
+
if (ignore) {
|
|
1016
|
+
this.ignoredColliderPairs.add(pairKey);
|
|
1017
|
+
} else {
|
|
1018
|
+
this.ignoredColliderPairs.delete(pairKey);
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
return true;
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
protected doCreateJoint(desc: JointDesc, recordA: TRecord, recordB: TRecord): TJointRecord | null {
|
|
1025
|
+
const world = this.world!;
|
|
1026
|
+
const bodyA = recordA[0];
|
|
1027
|
+
const bodyB = recordB[0];
|
|
1028
|
+
|
|
1029
|
+
try {
|
|
1030
|
+
let jointData: RAPIER.JointData;
|
|
1031
|
+
|
|
1032
|
+
switch (desc.type) {
|
|
1033
|
+
case JointType.Spherical:
|
|
1034
|
+
jointData = RAPIER.JointData.spherical(
|
|
1035
|
+
{ x: desc.anchorA.x, y: desc.anchorA.y, z: desc.anchorA.z },
|
|
1036
|
+
{ x: desc.anchorB.x, y: desc.anchorB.y, z: desc.anchorB.z }
|
|
1037
|
+
);
|
|
1038
|
+
break;
|
|
1039
|
+
|
|
1040
|
+
case JointType.Fixed:
|
|
1041
|
+
jointData = RAPIER.JointData.fixed(
|
|
1042
|
+
{ x: desc.anchorA.x, y: desc.anchorA.y, z: desc.anchorA.z },
|
|
1043
|
+
{ x: 0, y: 0, z: 0, w: 1 }, // Identity quaternion for now
|
|
1044
|
+
{ x: desc.anchorB.x, y: desc.anchorB.y, z: desc.anchorB.z },
|
|
1045
|
+
{ x: 0, y: 0, z: 0, w: 1 } // Identity quaternion for now
|
|
1046
|
+
);
|
|
1047
|
+
break;
|
|
1048
|
+
|
|
1049
|
+
case JointType.Revolute:
|
|
1050
|
+
if (!desc.axis) {
|
|
1051
|
+
console.error('Revolute joint requires an axis');
|
|
1052
|
+
return null;
|
|
1053
|
+
}
|
|
1054
|
+
jointData = RAPIER.JointData.revolute(
|
|
1055
|
+
{ x: desc.anchorA.x, y: desc.anchorA.y, z: desc.anchorA.z },
|
|
1056
|
+
{ x: desc.anchorB.x, y: desc.anchorB.y, z: desc.anchorB.z },
|
|
1057
|
+
{ x: desc.axis.x, y: desc.axis.y, z: desc.axis.z }
|
|
1058
|
+
);
|
|
1059
|
+
break;
|
|
1060
|
+
|
|
1061
|
+
case JointType.Prismatic:
|
|
1062
|
+
if (!desc.axis) {
|
|
1063
|
+
console.error('Prismatic joint requires an axis');
|
|
1064
|
+
return null;
|
|
1065
|
+
}
|
|
1066
|
+
jointData = RAPIER.JointData.prismatic(
|
|
1067
|
+
{ x: desc.anchorA.x, y: desc.anchorA.y, z: desc.anchorA.z },
|
|
1068
|
+
{ x: desc.anchorB.x, y: desc.anchorB.y, z: desc.anchorB.z },
|
|
1069
|
+
{ x: desc.axis.x, y: desc.axis.y, z: desc.axis.z }
|
|
1070
|
+
);
|
|
1071
|
+
break;
|
|
1072
|
+
|
|
1073
|
+
default:
|
|
1074
|
+
console.error('Unsupported joint type:', desc.type);
|
|
1075
|
+
return null;
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
const joint = world.createImpulseJoint(jointData, bodyA, bodyB, true);
|
|
1079
|
+
return joint;
|
|
1080
|
+
} catch (error) {
|
|
1081
|
+
console.error('Failed to create joint:', error);
|
|
1082
|
+
return null;
|
|
1083
|
+
}
|
|
1084
|
+
}
|
|
1085
|
+
|
|
1086
|
+
protected doRemoveJoint(jointRecord: TJointRecord): boolean {
|
|
1087
|
+
const world = this.world!;
|
|
1088
|
+
try {
|
|
1089
|
+
world.removeImpulseJoint(jointRecord, true);
|
|
1090
|
+
return true;
|
|
1091
|
+
} catch (error) {
|
|
1092
|
+
console.error('Failed to remove joint:', error);
|
|
1093
|
+
return false;
|
|
1094
|
+
}
|
|
1095
|
+
}
|
|
1096
|
+
|
|
1097
|
+
protected doCreateJointFromRecords(
|
|
1098
|
+
type: JointType,
|
|
1099
|
+
recordA: TRecord,
|
|
1100
|
+
recordB: TRecord,
|
|
1101
|
+
anchorA: THREE.Vector3,
|
|
1102
|
+
anchorB: THREE.Vector3,
|
|
1103
|
+
axis?: THREE.Vector3
|
|
1104
|
+
): TJointRecord | null {
|
|
1105
|
+
const world = this.world!;
|
|
1106
|
+
const bodyA = recordA[0];
|
|
1107
|
+
const bodyB = recordB[0];
|
|
1108
|
+
|
|
1109
|
+
try {
|
|
1110
|
+
let jointData: RAPIER.JointData;
|
|
1111
|
+
|
|
1112
|
+
switch (type) {
|
|
1113
|
+
case JointType.Spherical:
|
|
1114
|
+
jointData = RAPIER.JointData.spherical(
|
|
1115
|
+
{ x: anchorA.x, y: anchorA.y, z: anchorA.z },
|
|
1116
|
+
{ x: anchorB.x, y: anchorB.y, z: anchorB.z }
|
|
1117
|
+
);
|
|
1118
|
+
break;
|
|
1119
|
+
|
|
1120
|
+
case JointType.Fixed:
|
|
1121
|
+
jointData = RAPIER.JointData.fixed(
|
|
1122
|
+
{ x: anchorA.x, y: anchorA.y, z: anchorA.z },
|
|
1123
|
+
{ x: 0, y: 0, z: 0, w: 1 }, // Identity quaternion for now
|
|
1124
|
+
{ x: anchorB.x, y: anchorB.y, z: anchorB.z },
|
|
1125
|
+
{ x: 0, y: 0, z: 0, w: 1 } // Identity quaternion for now
|
|
1126
|
+
);
|
|
1127
|
+
break;
|
|
1128
|
+
|
|
1129
|
+
case JointType.Revolute:
|
|
1130
|
+
if (!axis) {
|
|
1131
|
+
console.error('Revolute joint requires an axis');
|
|
1132
|
+
return null;
|
|
1133
|
+
}
|
|
1134
|
+
jointData = RAPIER.JointData.revolute(
|
|
1135
|
+
{ x: anchorA.x, y: anchorA.y, z: anchorA.z },
|
|
1136
|
+
{ x: anchorB.x, y: anchorB.y, z: anchorB.z },
|
|
1137
|
+
{ x: axis.x, y: axis.y, z: axis.z }
|
|
1138
|
+
);
|
|
1139
|
+
break;
|
|
1140
|
+
|
|
1141
|
+
case JointType.Prismatic:
|
|
1142
|
+
if (!axis) {
|
|
1143
|
+
console.error('Prismatic joint requires an axis');
|
|
1144
|
+
return null;
|
|
1145
|
+
}
|
|
1146
|
+
jointData = RAPIER.JointData.prismatic(
|
|
1147
|
+
{ x: anchorA.x, y: anchorA.y, z: anchorA.z },
|
|
1148
|
+
{ x: anchorB.x, y: anchorB.y, z: anchorB.z },
|
|
1149
|
+
{ x: axis.x, y: axis.y, z: axis.z }
|
|
1150
|
+
);
|
|
1151
|
+
break;
|
|
1152
|
+
|
|
1153
|
+
default:
|
|
1154
|
+
console.error('Unsupported joint type:', type);
|
|
1155
|
+
return null;
|
|
1156
|
+
}
|
|
1157
|
+
|
|
1158
|
+
const joint = world.createImpulseJoint(jointData, bodyA, bodyB, true);
|
|
1159
|
+
return joint;
|
|
1160
|
+
} catch (error) {
|
|
1161
|
+
console.error('Failed to create joint from records:', error);
|
|
1162
|
+
return null;
|
|
1163
|
+
}
|
|
1164
|
+
}
|
|
1165
|
+
|
|
1166
|
+
// Direct physics body management implementations
|
|
1167
|
+
|
|
1168
|
+
protected doCreateDirectBody(desc: PhysicsBodyDesc): TRecord | null {
|
|
1169
|
+
const world = this.world!;
|
|
1170
|
+
|
|
1171
|
+
try {
|
|
1172
|
+
// Create collider based on shape type
|
|
1173
|
+
let colliderDesc: RAPIER.ColliderDesc;
|
|
1174
|
+
|
|
1175
|
+
switch (desc.shape.type) {
|
|
1176
|
+
case 'box':
|
|
1177
|
+
const size = desc.shape.size!;
|
|
1178
|
+
colliderDesc = RAPIER.ColliderDesc.cuboid(
|
|
1179
|
+
size.x / 2,
|
|
1180
|
+
size.y / 2,
|
|
1181
|
+
size.z / 2
|
|
1182
|
+
);
|
|
1183
|
+
break;
|
|
1184
|
+
case 'sphere':
|
|
1185
|
+
colliderDesc = RAPIER.ColliderDesc.ball(desc.shape.radius!);
|
|
1186
|
+
break;
|
|
1187
|
+
case 'cylinder':
|
|
1188
|
+
colliderDesc = RAPIER.ColliderDesc.cylinder(desc.shape.height! / 2, desc.shape.radius!);
|
|
1189
|
+
break;
|
|
1190
|
+
case 'capsule':
|
|
1191
|
+
colliderDesc = RAPIER.ColliderDesc.capsule(desc.shape.height! / 2, desc.shape.radius!);
|
|
1192
|
+
break;
|
|
1193
|
+
default:
|
|
1194
|
+
console.error(`Unsupported shape type: ${desc.shape.type}`);
|
|
1195
|
+
return null;
|
|
1196
|
+
}
|
|
1197
|
+
|
|
1198
|
+
// Create rigid body
|
|
1199
|
+
let rigidBodyDesc: RAPIER.RigidBodyDesc;
|
|
1200
|
+
|
|
1201
|
+
switch (desc.motionType) {
|
|
1202
|
+
case PhysicsMotionType.Static:
|
|
1203
|
+
rigidBodyDesc = RAPIER.RigidBodyDesc.fixed();
|
|
1204
|
+
break;
|
|
1205
|
+
case PhysicsMotionType.KinematicPositionBased:
|
|
1206
|
+
rigidBodyDesc = RAPIER.RigidBodyDesc.kinematicPositionBased();
|
|
1207
|
+
break;
|
|
1208
|
+
case PhysicsMotionType.KinematicVelocityBased:
|
|
1209
|
+
rigidBodyDesc = RAPIER.RigidBodyDesc.kinematicVelocityBased();
|
|
1210
|
+
break;
|
|
1211
|
+
case PhysicsMotionType.Dynamic:
|
|
1212
|
+
default:
|
|
1213
|
+
rigidBodyDesc = RAPIER.RigidBodyDesc.dynamic();
|
|
1214
|
+
break;
|
|
1215
|
+
}
|
|
1216
|
+
|
|
1217
|
+
rigidBodyDesc
|
|
1218
|
+
.setTranslation(desc.position.x, desc.position.y, desc.position.z)
|
|
1219
|
+
.setRotation({ x: desc.rotation.x, y: desc.rotation.y, z: desc.rotation.z, w: desc.rotation.w });
|
|
1220
|
+
|
|
1221
|
+
const rigidBody = world.createRigidBody(rigidBodyDesc);
|
|
1222
|
+
const collider = world.createCollider(colliderDesc, rigidBody);
|
|
1223
|
+
|
|
1224
|
+
// Set mass for dynamic bodies
|
|
1225
|
+
if (desc.motionType === PhysicsMotionType.Dynamic && desc.mass > 0) {
|
|
1226
|
+
collider.setMass(desc.mass);
|
|
1227
|
+
}
|
|
1228
|
+
|
|
1229
|
+
// Set enabled state
|
|
1230
|
+
if (desc.enabled !== undefined) {
|
|
1231
|
+
rigidBody.setEnabled(desc.enabled);
|
|
1232
|
+
}
|
|
1233
|
+
|
|
1234
|
+
return [rigidBody, collider, desc.motionType];
|
|
1235
|
+
} catch (error) {
|
|
1236
|
+
console.error('Failed to create direct physics body:', error);
|
|
1237
|
+
return null;
|
|
1238
|
+
}
|
|
1239
|
+
}
|
|
1240
|
+
|
|
1241
|
+
protected doRemoveDirectBody(record: TRecord): boolean {
|
|
1242
|
+
const world = this.world!;
|
|
1243
|
+
const [rigidBody, collider] = record;
|
|
1244
|
+
|
|
1245
|
+
try {
|
|
1246
|
+
world.removeRigidBody(rigidBody);
|
|
1247
|
+
world.removeCollider(collider, false);
|
|
1248
|
+
return true;
|
|
1249
|
+
} catch (error) {
|
|
1250
|
+
console.error('Failed to remove direct physics body:', error);
|
|
1251
|
+
return false;
|
|
1252
|
+
}
|
|
1253
|
+
}
|
|
1254
|
+
|
|
1255
|
+
protected doGetBodyPosition(record: TRecord): THREE.Vector3 | null {
|
|
1256
|
+
const [rigidBody] = record;
|
|
1257
|
+
|
|
1258
|
+
try {
|
|
1259
|
+
const translation = rigidBody.translation();
|
|
1260
|
+
return new THREE.Vector3(translation.x, translation.y, translation.z);
|
|
1261
|
+
} catch (error) {
|
|
1262
|
+
console.error('Failed to get body position:', error);
|
|
1263
|
+
return null;
|
|
1264
|
+
}
|
|
1265
|
+
}
|
|
1266
|
+
|
|
1267
|
+
protected doGetBodyRotation(record: TRecord): THREE.Quaternion | null {
|
|
1268
|
+
const [rigidBody] = record;
|
|
1269
|
+
|
|
1270
|
+
try {
|
|
1271
|
+
const rotation = rigidBody.rotation();
|
|
1272
|
+
return new THREE.Quaternion(rotation.x, rotation.y, rotation.z, rotation.w);
|
|
1273
|
+
} catch (error) {
|
|
1274
|
+
console.error('Failed to get body rotation:', error);
|
|
1275
|
+
return null;
|
|
1276
|
+
}
|
|
1277
|
+
}
|
|
1278
|
+
|
|
1279
|
+
protected doSetBodyPosition(record: TRecord, position: THREE.Vector3): boolean {
|
|
1280
|
+
const [rigidBody] = record;
|
|
1281
|
+
|
|
1282
|
+
try {
|
|
1283
|
+
rigidBody.setTranslation({ x: position.x, y: position.y, z: position.z }, true);
|
|
1284
|
+
return true;
|
|
1285
|
+
} catch (error) {
|
|
1286
|
+
console.error('Failed to set body position:', error);
|
|
1287
|
+
return false;
|
|
1288
|
+
}
|
|
1289
|
+
}
|
|
1290
|
+
|
|
1291
|
+
protected doSetBodyRotation(record: TRecord, rotation: THREE.Quaternion): boolean {
|
|
1292
|
+
const [rigidBody] = record;
|
|
1293
|
+
|
|
1294
|
+
try {
|
|
1295
|
+
rigidBody.setRotation({ x: rotation.x, y: rotation.y, z: rotation.z, w: rotation.w }, true);
|
|
1296
|
+
return true;
|
|
1297
|
+
} catch (error) {
|
|
1298
|
+
console.error('Failed to set body rotation:', error);
|
|
1299
|
+
return false;
|
|
1300
|
+
}
|
|
1301
|
+
}
|
|
1302
|
+
|
|
1303
|
+
protected doApplyBodyImpulse(record: TRecord, impulse: THREE.Vector3, worldSpace: boolean): boolean {
|
|
1304
|
+
const [rigidBody] = record;
|
|
1305
|
+
|
|
1306
|
+
try {
|
|
1307
|
+
rigidBody.applyImpulse({ x: impulse.x, y: impulse.y, z: impulse.z }, worldSpace);
|
|
1308
|
+
return true;
|
|
1309
|
+
} catch (error) {
|
|
1310
|
+
console.error('Failed to apply body impulse:', error);
|
|
1311
|
+
return false;
|
|
1312
|
+
}
|
|
1313
|
+
}
|
|
1314
|
+
|
|
1315
|
+
protected doSetBodyEnabled(record: TRecord, enabled: boolean): boolean {
|
|
1316
|
+
const [rigidBody] = record;
|
|
1317
|
+
|
|
1318
|
+
try {
|
|
1319
|
+
rigidBody.setEnabled(enabled);
|
|
1320
|
+
return true;
|
|
1321
|
+
} catch (error) {
|
|
1322
|
+
console.error('Failed to set body enabled state:', error);
|
|
1323
|
+
return false;
|
|
1324
|
+
}
|
|
1325
|
+
}
|
|
1326
|
+
|
|
1327
|
+
private buildHitTestResult(origin: THREE.Vector3, direction: THREE.Vector3, intersection: RAPIER.RayColliderIntersection): HitTestResult {
|
|
1328
|
+
const hitComponent = this.colliderToComponent.get(intersection.collider.handle) ?? null;
|
|
1329
|
+
return {
|
|
1330
|
+
origin: origin,
|
|
1331
|
+
direction: direction,
|
|
1332
|
+
hitLocation: origin.clone().add(direction.clone().multiplyScalar(intersection.timeOfImpact)),
|
|
1333
|
+
hitNormal: new THREE.Vector3(intersection.normal.x, intersection.normal.y, intersection.normal.z),
|
|
1334
|
+
hitComponent: hitComponent,
|
|
1335
|
+
hitActor: hitComponent?.getActor() ?? null,
|
|
1336
|
+
};
|
|
1337
|
+
}
|
|
1338
|
+
|
|
1339
|
+
public override performHitTest(options: HitTestOptions): HitTestResult[] {
|
|
1340
|
+
const world = this.world!;
|
|
1341
|
+
const ray = new RAPIER.Ray(
|
|
1342
|
+
{ x: options.origin.x, y: options.origin.y, z: options.origin.z },
|
|
1343
|
+
{ x: options.direction.x, y: options.direction.y, z: options.direction.z }
|
|
1344
|
+
);
|
|
1345
|
+
|
|
1346
|
+
const groups = options.collisionProfile ? this.getCollisionGroups(options.collisionProfile) : undefined;
|
|
1347
|
+
|
|
1348
|
+
const filterPredicate = (collider: RAPIER.Collider) => {
|
|
1349
|
+
if (options.ignoredActors || options.ignoredComponents) {
|
|
1350
|
+
const component = this.colliderToComponent.get(collider.handle);
|
|
1351
|
+
if (!component) {
|
|
1352
|
+
return false;
|
|
1353
|
+
}
|
|
1354
|
+
if (options.ignoredActors && options.ignoredActors.includes(component.getActor()!)) {
|
|
1355
|
+
return false;
|
|
1356
|
+
}
|
|
1357
|
+
if (options.ignoredComponents && options.ignoredComponents.includes(component)) {
|
|
1358
|
+
return false;
|
|
1359
|
+
}
|
|
1360
|
+
}
|
|
1361
|
+
return true;
|
|
1362
|
+
};
|
|
1363
|
+
|
|
1364
|
+
const results: HitTestResult[] = [];
|
|
1365
|
+
|
|
1366
|
+
if (options.stopOnFirstHit) {
|
|
1367
|
+
const intersection = world.castRayAndGetNormal(ray, options.maxDistance, true, RAPIER.QueryFilterFlags.EXCLUDE_SENSORS, groups, undefined, undefined, filterPredicate);
|
|
1368
|
+
if (intersection) {
|
|
1369
|
+
results.push(this.buildHitTestResult(options.origin, options.direction, intersection));
|
|
1370
|
+
}
|
|
1371
|
+
} else {
|
|
1372
|
+
world.intersectionsWithRay(ray, options.maxDistance, true, (intersect: RAPIER.RayColliderIntersection) => {
|
|
1373
|
+
results.push(this.buildHitTestResult(options.origin, options.direction, intersect));
|
|
1374
|
+
return true;
|
|
1375
|
+
}, RAPIER.QueryFilterFlags.EXCLUDE_SENSORS, groups, undefined, undefined, filterPredicate);
|
|
1376
|
+
}
|
|
1377
|
+
|
|
1378
|
+
return results;
|
|
1379
|
+
}
|
|
1380
|
+
|
|
1381
|
+
// Vehicle controller implementation
|
|
1382
|
+
|
|
1383
|
+
public override createVehicle(movementComponent: BasePawnMovementComponent, chassisComponent: PrimitiveComponent): IPhysicsVehicle | null {
|
|
1384
|
+
if (!this.world) return null;
|
|
1385
|
+
|
|
1386
|
+
// Get the chassis physics record
|
|
1387
|
+
const chassisRecords = this.bodies.get(chassisComponent);
|
|
1388
|
+
if (!chassisRecords || chassisRecords.length !== 1) {
|
|
1389
|
+
console.error('VehicleController: Chassis component not found in physics simulation');
|
|
1390
|
+
return null;
|
|
1391
|
+
}
|
|
1392
|
+
|
|
1393
|
+
if (this.vehicles.has(movementComponent)) {
|
|
1394
|
+
console.error('VehicleController: Vehicle controller already exists for component:', movementComponent.getPathName());
|
|
1395
|
+
return null;
|
|
1396
|
+
}
|
|
1397
|
+
|
|
1398
|
+
try {
|
|
1399
|
+
// Create the vehicle controller using Rapier's DynamicRayCastVehicleController
|
|
1400
|
+
const chassisRecord = chassisRecords[0];
|
|
1401
|
+
const chassisBody = chassisRecord[0];
|
|
1402
|
+
|
|
1403
|
+
// Create and return the physics vehicle interface
|
|
1404
|
+
const vehicle = new RapierVehicle({
|
|
1405
|
+
world: this.world,
|
|
1406
|
+
chassis: chassisBody,
|
|
1407
|
+
});
|
|
1408
|
+
|
|
1409
|
+
// Store the record for cleanup purposes
|
|
1410
|
+
this.vehicles.set(movementComponent, vehicle);
|
|
1411
|
+
|
|
1412
|
+
console.log('VehicleController: Created vehicle controller for component:', movementComponent.getPathName());
|
|
1413
|
+
return vehicle;
|
|
1414
|
+
} catch (error) {
|
|
1415
|
+
console.error('VehicleController: Failed to create vehicle controller:', error);
|
|
1416
|
+
return null;
|
|
1417
|
+
}
|
|
1418
|
+
}
|
|
1419
|
+
}
|