@babylonjs/core 8.8.0 → 8.8.2

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.
Files changed (409) hide show
  1. package/Actions/actionManager.js +2 -0
  2. package/Actions/actionManager.js.map +1 -1
  3. package/Animations/animatable.core.js +1 -1
  4. package/Animations/animatable.core.js.map +1 -1
  5. package/Animations/animation.js +4 -2
  6. package/Animations/animation.js.map +1 -1
  7. package/Audio/audioEngine.d.ts +1 -1
  8. package/Audio/audioEngine.js +20 -10
  9. package/Audio/audioEngine.js.map +1 -1
  10. package/Audio/audioSceneComponent.js +2 -0
  11. package/Audio/audioSceneComponent.js.map +1 -1
  12. package/Audio/sound.js +2 -0
  13. package/Audio/sound.js.map +1 -1
  14. package/AudioV2/abstractAudio/audioEngineV2.js +8 -1
  15. package/AudioV2/abstractAudio/audioEngineV2.js.map +1 -1
  16. package/AudioV2/abstractAudio/streamingSound.js +3 -1
  17. package/AudioV2/abstractAudio/streamingSound.js.map +1 -1
  18. package/AudioV2/abstractAudio/subNodes/abstractAudioSubGraph.js +6 -2
  19. package/AudioV2/abstractAudio/subNodes/abstractAudioSubGraph.js.map +1 -1
  20. package/AudioV2/abstractAudio/subProperties/audioAnalyzer.js +3 -0
  21. package/AudioV2/abstractAudio/subProperties/audioAnalyzer.js.map +1 -1
  22. package/AudioV2/abstractAudio/subProperties/spatialAudio.js +1 -0
  23. package/AudioV2/abstractAudio/subProperties/spatialAudio.js.map +1 -1
  24. package/AudioV2/webAudio/webAudioEngine.js +5 -1
  25. package/AudioV2/webAudio/webAudioEngine.js.map +1 -1
  26. package/AudioV2/webAudio/webAudioStaticSound.js +2 -0
  27. package/AudioV2/webAudio/webAudioStaticSound.js.map +1 -1
  28. package/AudioV2/webAudio/webAudioStreamingSound.js +3 -0
  29. package/AudioV2/webAudio/webAudioStreamingSound.js.map +1 -1
  30. package/AudioV2/webAudio/webAudioUnmuteUI.js +1 -0
  31. package/AudioV2/webAudio/webAudioUnmuteUI.js.map +1 -1
  32. package/BakedVertexAnimation/vertexAnimationBaker.d.ts +1 -0
  33. package/BakedVertexAnimation/vertexAnimationBaker.js +3 -1
  34. package/BakedVertexAnimation/vertexAnimationBaker.js.map +1 -1
  35. package/Buffers/buffer.nonFloatVertexBuffers.js +1 -0
  36. package/Buffers/buffer.nonFloatVertexBuffers.js.map +1 -1
  37. package/Buffers/storageBuffer.js +1 -1
  38. package/Buffers/storageBuffer.js.map +1 -1
  39. package/Cameras/Inputs/arcRotateCameraVRDeviceOrientationInput.js +2 -0
  40. package/Cameras/Inputs/arcRotateCameraVRDeviceOrientationInput.js.map +1 -1
  41. package/Cameras/Inputs/freeCameraDeviceOrientationInput.js +6 -1
  42. package/Cameras/Inputs/freeCameraDeviceOrientationInput.js.map +1 -1
  43. package/Cameras/VR/vrExperienceHelper.js +2 -0
  44. package/Cameras/VR/vrExperienceHelper.js.map +1 -1
  45. package/Collisions/gpuPicker.js +9 -6
  46. package/Collisions/gpuPicker.js.map +1 -1
  47. package/Compute/computeShader.js +1 -1
  48. package/Compute/computeShader.js.map +1 -1
  49. package/Culling/Helper/boundingInfoHelper.js +3 -3
  50. package/Culling/Helper/boundingInfoHelper.js.map +1 -1
  51. package/Culling/Helper/computeShaderBoundingHelper.js +3 -1
  52. package/Culling/Helper/computeShaderBoundingHelper.js.map +1 -1
  53. package/Culling/Helper/transformFeedbackBoundingHelper.js +3 -0
  54. package/Culling/Helper/transformFeedbackBoundingHelper.js.map +1 -1
  55. package/Debug/debugLayer.js +1 -1
  56. package/Debug/debugLayer.js.map +1 -1
  57. package/Engines/AbstractEngine/abstractEngine.cubeTexture.js +1 -0
  58. package/Engines/AbstractEngine/abstractEngine.cubeTexture.js.map +1 -1
  59. package/Engines/Extensions/engine.prefilteredCubeTexture.js +1 -0
  60. package/Engines/Extensions/engine.prefilteredCubeTexture.js.map +1 -1
  61. package/Engines/Extensions/engine.readTexture.js +1 -0
  62. package/Engines/Extensions/engine.readTexture.js.map +1 -1
  63. package/Engines/WebGPU/Extensions/engine.computeShader.js +1 -0
  64. package/Engines/WebGPU/Extensions/engine.computeShader.js.map +1 -1
  65. package/Engines/WebGPU/Extensions/engine.readTexture.js +1 -0
  66. package/Engines/WebGPU/Extensions/engine.readTexture.js.map +1 -1
  67. package/Engines/WebGPU/Extensions/engine.videoTexture.js +2 -0
  68. package/Engines/WebGPU/Extensions/engine.videoTexture.js.map +1 -1
  69. package/Engines/WebGPU/webgpuBufferManager.js +3 -1
  70. package/Engines/WebGPU/webgpuBufferManager.js.map +1 -1
  71. package/Engines/WebGPU/webgpuOcclusionQuery.js +1 -0
  72. package/Engines/WebGPU/webgpuOcclusionQuery.js.map +1 -1
  73. package/Engines/WebGPU/webgpuQuerySet.js +15 -9
  74. package/Engines/WebGPU/webgpuQuerySet.js.map +1 -1
  75. package/Engines/WebGPU/webgpuTextureManager.js +1 -0
  76. package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
  77. package/Engines/WebGPU/webgpuTimestampQuery.js +4 -2
  78. package/Engines/WebGPU/webgpuTimestampQuery.js.map +1 -1
  79. package/Engines/WebGPU/webgpuTintWASM.js +1 -0
  80. package/Engines/WebGPU/webgpuTintWASM.js.map +1 -1
  81. package/Engines/abstractEngine.js +5 -2
  82. package/Engines/abstractEngine.js.map +1 -1
  83. package/Engines/constants.d.ts +23 -0
  84. package/Engines/constants.js +23 -0
  85. package/Engines/constants.js.map +1 -1
  86. package/Engines/engine.common.js +7 -1
  87. package/Engines/engine.common.js.map +1 -1
  88. package/Engines/engine.js +5 -3
  89. package/Engines/engine.js.map +1 -1
  90. package/Engines/engineFactory.js +1 -1
  91. package/Engines/engineFactory.js.map +1 -1
  92. package/Engines/nativeEngine.js +19 -11
  93. package/Engines/nativeEngine.js.map +1 -1
  94. package/Engines/thinEngine.d.ts +1 -0
  95. package/Engines/thinEngine.js +22 -18
  96. package/Engines/thinEngine.js.map +1 -1
  97. package/Engines/webgpuEngine.js +30 -11
  98. package/Engines/webgpuEngine.js.map +1 -1
  99. package/FlowGraph/flowGraphParser.js +2 -2
  100. package/FlowGraph/flowGraphParser.js.map +1 -1
  101. package/FrameGraph/Node/nodeRenderGraph.js +5 -1
  102. package/FrameGraph/Node/nodeRenderGraph.js.map +1 -1
  103. package/FrameGraph/Node/nodeRenderGraphBlock.js +1 -1
  104. package/FrameGraph/Node/nodeRenderGraphBlock.js.map +1 -1
  105. package/FrameGraph/frameGraph.js +1 -1
  106. package/FrameGraph/frameGraph.js.map +1 -1
  107. package/Helpers/sceneHelpers.js +1 -3
  108. package/Helpers/sceneHelpers.js.map +1 -1
  109. package/Helpers/videoDome.js +1 -0
  110. package/Helpers/videoDome.js.map +1 -1
  111. package/Layers/thinEffectLayer.js +1 -0
  112. package/Layers/thinEffectLayer.js.map +1 -1
  113. package/LensFlares/lensFlareSystem.js +1 -0
  114. package/LensFlares/lensFlareSystem.js.map +1 -1
  115. package/Lights/Shadows/shadowGenerator.js +3 -2
  116. package/Lights/Shadows/shadowGenerator.js.map +1 -1
  117. package/Lights/areaLight.js +2 -0
  118. package/Lights/areaLight.js.map +1 -1
  119. package/Loading/sceneLoader.js +56 -22
  120. package/Loading/sceneLoader.js.map +1 -1
  121. package/Materials/GaussianSplatting/gaussianSplattingMaterial.d.ts +15 -1
  122. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js +34 -7
  123. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js.map +1 -1
  124. package/Materials/Node/Blocks/Dual/clipPlanesBlock.js +1 -0
  125. package/Materials/Node/Blocks/Dual/clipPlanesBlock.js.map +1 -1
  126. package/Materials/Node/Blocks/Dual/fogBlock.js +1 -0
  127. package/Materials/Node/Blocks/Dual/fogBlock.js.map +1 -1
  128. package/Materials/Node/Blocks/Dual/lightBlock.js +1 -0
  129. package/Materials/Node/Blocks/Dual/lightBlock.js.map +1 -1
  130. package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js +1 -0
  131. package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js.map +1 -1
  132. package/Materials/Node/Blocks/Fragment/imageProcessingBlock.js +1 -0
  133. package/Materials/Node/Blocks/Fragment/imageProcessingBlock.js.map +1 -1
  134. package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js +1 -0
  135. package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js.map +1 -1
  136. package/Materials/Node/Blocks/Fragment/shadowMapBlock.js +1 -0
  137. package/Materials/Node/Blocks/Fragment/shadowMapBlock.js.map +1 -1
  138. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js +9 -11
  139. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js.map +1 -1
  140. package/Materials/Node/Blocks/PBR/sheenBlock.js +1 -1
  141. package/Materials/Node/Blocks/PBR/sheenBlock.js.map +1 -1
  142. package/Materials/Node/Blocks/PBR/subSurfaceBlock.js +6 -2
  143. package/Materials/Node/Blocks/PBR/subSurfaceBlock.js.map +1 -1
  144. package/Materials/Node/Blocks/Vertex/bonesBlock.js +1 -0
  145. package/Materials/Node/Blocks/Vertex/bonesBlock.js.map +1 -1
  146. package/Materials/Node/Blocks/Vertex/morphTargetsBlock.js +1 -0
  147. package/Materials/Node/Blocks/Vertex/morphTargetsBlock.js.map +1 -1
  148. package/Materials/Node/nodeMaterial.js +11 -3
  149. package/Materials/Node/nodeMaterial.js.map +1 -1
  150. package/Materials/Node/nodeMaterialBuildState.js +1 -0
  151. package/Materials/Node/nodeMaterialBuildState.js.map +1 -1
  152. package/Materials/PBR/pbrBRDFConfiguration.d.ts +11 -0
  153. package/Materials/PBR/pbrBRDFConfiguration.js +16 -0
  154. package/Materials/PBR/pbrBRDFConfiguration.js.map +1 -1
  155. package/Materials/PBR/pbrBaseMaterial.d.ts +4 -0
  156. package/Materials/PBR/pbrBaseMaterial.js +12 -8
  157. package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
  158. package/Materials/PBR/pbrMaterial.d.ts +8 -0
  159. package/Materials/PBR/pbrMaterial.js +16 -0
  160. package/Materials/PBR/pbrMaterial.js.map +1 -1
  161. package/Materials/Textures/Filtering/hdrIrradianceFiltering.js +1 -0
  162. package/Materials/Textures/Filtering/hdrIrradianceFiltering.js.map +1 -1
  163. package/Materials/Textures/Loaders/basisTextureLoader.js +4 -0
  164. package/Materials/Textures/Loaders/basisTextureLoader.js.map +1 -1
  165. package/Materials/Textures/Loaders/envTextureLoader.js +1 -0
  166. package/Materials/Textures/Loaders/envTextureLoader.js.map +1 -1
  167. package/Materials/Textures/Loaders/exrTextureLoader.js +2 -0
  168. package/Materials/Textures/Loaders/exrTextureLoader.js.map +1 -1
  169. package/Materials/Textures/Loaders/ktxTextureLoader.js +1 -0
  170. package/Materials/Textures/Loaders/ktxTextureLoader.js.map +1 -1
  171. package/Materials/Textures/Loaders/textureLoaderManager.js +9 -9
  172. package/Materials/Textures/Loaders/textureLoaderManager.js.map +1 -1
  173. package/Materials/Textures/Packer/packer.js +3 -1
  174. package/Materials/Textures/Packer/packer.js.map +1 -1
  175. package/Materials/Textures/Procedurals/proceduralTexture.js +1 -0
  176. package/Materials/Textures/Procedurals/proceduralTexture.js.map +1 -1
  177. package/Materials/Textures/baseTexture.polynomial.js +1 -0
  178. package/Materials/Textures/baseTexture.polynomial.js.map +1 -1
  179. package/Materials/Textures/hdrCubeTexture.js +1 -0
  180. package/Materials/Textures/hdrCubeTexture.js.map +1 -1
  181. package/Materials/Textures/internalTexture.js +1 -0
  182. package/Materials/Textures/internalTexture.js.map +1 -1
  183. package/Materials/Textures/rawCubeTexture.js +3 -0
  184. package/Materials/Textures/rawCubeTexture.js.map +1 -1
  185. package/Materials/Textures/renderTargetTexture.js +2 -0
  186. package/Materials/Textures/renderTargetTexture.js.map +1 -1
  187. package/Materials/Textures/videoTexture.js +6 -0
  188. package/Materials/Textures/videoTexture.js.map +1 -1
  189. package/Materials/effect.js +2 -1
  190. package/Materials/effect.js.map +1 -1
  191. package/Materials/effect.webgl.functions.js +3 -1
  192. package/Materials/effect.webgl.functions.js.map +1 -1
  193. package/Materials/effectRenderer.js +1 -0
  194. package/Materials/effectRenderer.js.map +1 -1
  195. package/Materials/material.js +2 -1
  196. package/Materials/material.js.map +1 -1
  197. package/Materials/shaderMaterial.js +4 -2
  198. package/Materials/shaderMaterial.js.map +1 -1
  199. package/Meshes/Compression/dracoCodec.js +5 -1
  200. package/Meshes/Compression/dracoCodec.js.map +1 -1
  201. package/Meshes/Compression/dracoCompression.js +4 -3
  202. package/Meshes/Compression/dracoCompression.js.map +1 -1
  203. package/Meshes/Compression/dracoCompressionWorker.js +5 -2
  204. package/Meshes/Compression/dracoCompressionWorker.js.map +1 -1
  205. package/Meshes/Compression/dracoDecoder.js +5 -1
  206. package/Meshes/Compression/dracoDecoder.js.map +1 -1
  207. package/Meshes/Compression/dracoEncoder.js +3 -2
  208. package/Meshes/Compression/dracoEncoder.js.map +1 -1
  209. package/Meshes/Compression/meshoptCompression.js +18 -18
  210. package/Meshes/Compression/meshoptCompression.js.map +1 -1
  211. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +14 -15
  212. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
  213. package/Meshes/Node/Blocks/Textures/geometryTextureBlock.js +20 -10
  214. package/Meshes/Node/Blocks/Textures/geometryTextureBlock.js.map +1 -1
  215. package/Meshes/Node/Blocks/booleanGeometryBlock.js +1 -0
  216. package/Meshes/Node/Blocks/booleanGeometryBlock.js.map +1 -1
  217. package/Meshes/Node/nodeGeometry.js +5 -1
  218. package/Meshes/Node/nodeGeometry.js.map +1 -1
  219. package/Meshes/mesh.js +2 -2
  220. package/Meshes/mesh.js.map +1 -1
  221. package/Meshes/meshUVSpaceRenderer.js +1 -0
  222. package/Meshes/meshUVSpaceRenderer.js.map +1 -1
  223. package/Misc/HighDynamicRange/cubemapToSphericalPolynomial.js +1 -0
  224. package/Misc/HighDynamicRange/cubemapToSphericalPolynomial.js.map +1 -1
  225. package/Misc/assetsManager.js +2 -1
  226. package/Misc/assetsManager.js.map +1 -1
  227. package/Misc/asyncLock.js +5 -2
  228. package/Misc/asyncLock.js.map +1 -1
  229. package/Misc/basis.js +9 -2
  230. package/Misc/basis.js.map +1 -1
  231. package/Misc/basisWorker.js +3 -1
  232. package/Misc/basisWorker.js.map +1 -1
  233. package/Misc/copyTextureToTexture.js +1 -0
  234. package/Misc/copyTextureToTexture.js.map +1 -1
  235. package/Misc/coroutine.js +2 -1
  236. package/Misc/coroutine.js.map +1 -1
  237. package/Misc/dataReader.js +3 -4
  238. package/Misc/dataReader.js.map +1 -1
  239. package/Misc/dumpTools.js +7 -1
  240. package/Misc/dumpTools.js.map +1 -1
  241. package/Misc/environmentTextureTools.d.ts +0 -2
  242. package/Misc/environmentTextureTools.js +20 -7
  243. package/Misc/environmentTextureTools.js.map +1 -1
  244. package/Misc/equirectangularCapture.js +2 -1
  245. package/Misc/equirectangularCapture.js.map +1 -1
  246. package/Misc/fileTools.js +2 -0
  247. package/Misc/fileTools.js.map +1 -1
  248. package/Misc/filesInput.js +5 -1
  249. package/Misc/filesInput.js.map +1 -1
  250. package/Misc/khronosTextureContainer2.js +10 -3
  251. package/Misc/khronosTextureContainer2.js.map +1 -1
  252. package/Misc/khronosTextureContainer2Worker.js +4 -1
  253. package/Misc/khronosTextureContainer2Worker.js.map +1 -1
  254. package/Misc/minMaxReducer.js +1 -0
  255. package/Misc/minMaxReducer.js.map +1 -1
  256. package/Misc/observable.extensions.js +3 -1
  257. package/Misc/observable.extensions.js.map +1 -1
  258. package/Misc/observable.js +2 -0
  259. package/Misc/observable.js.map +1 -1
  260. package/Misc/observableCoroutine.js +1 -0
  261. package/Misc/observableCoroutine.js.map +1 -1
  262. package/Misc/reflector.js +1 -0
  263. package/Misc/reflector.js.map +1 -1
  264. package/Misc/rgbdTextureTools.js +2 -1
  265. package/Misc/rgbdTextureTools.js.map +1 -1
  266. package/Misc/sceneSerializer.js +2 -2
  267. package/Misc/sceneSerializer.js.map +1 -1
  268. package/Misc/screenshotTools.js +9 -4
  269. package/Misc/screenshotTools.js.map +1 -1
  270. package/Misc/textureTools.js +2 -0
  271. package/Misc/textureTools.js.map +1 -1
  272. package/Misc/tools.internals.js +2 -1
  273. package/Misc/tools.internals.js.map +1 -1
  274. package/Misc/tools.js +9 -3
  275. package/Misc/tools.js.map +1 -1
  276. package/Misc/videoRecorder.js +1 -0
  277. package/Misc/videoRecorder.js.map +1 -1
  278. package/Misc/webRequest.fetch.js +2 -1
  279. package/Misc/webRequest.fetch.js.map +1 -1
  280. package/Misc/workerPool.js +3 -0
  281. package/Misc/workerPool.js.map +1 -1
  282. package/Particles/flowMap.js +1 -1
  283. package/Particles/flowMap.js.map +1 -1
  284. package/Particles/particleHelper.js +7 -0
  285. package/Particles/particleHelper.js.map +1 -1
  286. package/Particles/pointsCloudSystem.js +7 -7
  287. package/Particles/pointsCloudSystem.js.map +1 -1
  288. package/Particles/thinParticleSystem.js +2 -0
  289. package/Particles/thinParticleSystem.js.map +1 -1
  290. package/Physics/physicsHelper.js +2 -2
  291. package/Physics/physicsHelper.js.map +1 -1
  292. package/Physics/v1/Plugins/oimoJSPlugin.js +1 -1
  293. package/Physics/v1/Plugins/oimoJSPlugin.js.map +1 -1
  294. package/PostProcesses/RenderPipeline/Pipelines/standardRenderingPipeline.js +1 -0
  295. package/PostProcesses/RenderPipeline/Pipelines/standardRenderingPipeline.js.map +1 -1
  296. package/Rendering/GlobalIllumination/giRSMManager.js +1 -0
  297. package/Rendering/GlobalIllumination/giRSMManager.js.map +1 -1
  298. package/Rendering/IBLShadows/iblShadowsVoxelRenderer.js +1 -0
  299. package/Rendering/IBLShadows/iblShadowsVoxelRenderer.js.map +1 -1
  300. package/Rendering/depthRenderer.js +1 -0
  301. package/Rendering/depthRenderer.js.map +1 -1
  302. package/Rendering/fluidRenderer/fluidRenderingTargetRenderer.js +3 -1
  303. package/Rendering/fluidRenderer/fluidRenderingTargetRenderer.js.map +1 -1
  304. package/Rendering/fluidRenderer/fluidRenderingTextures.js.map +1 -1
  305. package/Rendering/geometryBufferRenderer.js +1 -0
  306. package/Rendering/geometryBufferRenderer.js.map +1 -1
  307. package/Rendering/iblCdfGenerator.js +4 -1
  308. package/Rendering/iblCdfGenerator.js.map +1 -1
  309. package/Shaders/ShadersInclude/lightFragment.js +5 -1
  310. package/Shaders/ShadersInclude/lightFragment.js.map +1 -1
  311. package/Shaders/ShadersInclude/pbrBRDFFunctions.js +12 -5
  312. package/Shaders/ShadersInclude/pbrBRDFFunctions.js.map +1 -1
  313. package/Shaders/ShadersInclude/pbrBlockDirectLighting.js +3 -0
  314. package/Shaders/ShadersInclude/pbrBlockDirectLighting.js.map +1 -1
  315. package/Shaders/ShadersInclude/pbrBlockFinalLitComponents.js +21 -8
  316. package/Shaders/ShadersInclude/pbrBlockFinalLitComponents.js.map +1 -1
  317. package/Shaders/ShadersInclude/pbrBlockFinalUnlitComponents.js +3 -0
  318. package/Shaders/ShadersInclude/pbrBlockFinalUnlitComponents.js.map +1 -1
  319. package/Shaders/ShadersInclude/pbrBlockReflectance.js +6 -6
  320. package/Shaders/ShadersInclude/pbrBlockReflectance.js.map +1 -1
  321. package/Shaders/ShadersInclude/pbrBlockReflectance0.js +2 -7
  322. package/Shaders/ShadersInclude/pbrBlockReflectance0.js.map +1 -1
  323. package/Shaders/ShadersInclude/pbrBlockReflectivity.js +20 -16
  324. package/Shaders/ShadersInclude/pbrBlockReflectivity.js.map +1 -1
  325. package/Shaders/ShadersInclude/pbrBlockSubSurface.js +6 -8
  326. package/Shaders/ShadersInclude/pbrBlockSubSurface.js.map +1 -1
  327. package/Shaders/ShadersInclude/pbrDebug.js +2 -2
  328. package/Shaders/ShadersInclude/pbrDebug.js.map +1 -1
  329. package/Shaders/ShadersInclude/pbrDirectLightingFunctions.js +1 -5
  330. package/Shaders/ShadersInclude/pbrDirectLightingFunctions.js.map +1 -1
  331. package/Shaders/pbr.fragment.js +7 -3
  332. package/Shaders/pbr.fragment.js.map +1 -1
  333. package/ShadersWGSL/ShadersInclude/lightFragment.js +5 -1
  334. package/ShadersWGSL/ShadersInclude/lightFragment.js.map +1 -1
  335. package/ShadersWGSL/ShadersInclude/pbrBRDFFunctions.js +5 -5
  336. package/ShadersWGSL/ShadersInclude/pbrBRDFFunctions.js.map +1 -1
  337. package/ShadersWGSL/ShadersInclude/pbrBlockDirectLighting.js +3 -0
  338. package/ShadersWGSL/ShadersInclude/pbrBlockDirectLighting.js.map +1 -1
  339. package/ShadersWGSL/ShadersInclude/pbrBlockFinalLitComponents.js +21 -8
  340. package/ShadersWGSL/ShadersInclude/pbrBlockFinalLitComponents.js.map +1 -1
  341. package/ShadersWGSL/ShadersInclude/pbrBlockFinalUnlitComponents.js +3 -0
  342. package/ShadersWGSL/ShadersInclude/pbrBlockFinalUnlitComponents.js.map +1 -1
  343. package/ShadersWGSL/ShadersInclude/pbrBlockReflectance.js +6 -6
  344. package/ShadersWGSL/ShadersInclude/pbrBlockReflectance.js.map +1 -1
  345. package/ShadersWGSL/ShadersInclude/pbrBlockReflectance0.js +2 -7
  346. package/ShadersWGSL/ShadersInclude/pbrBlockReflectance0.js.map +1 -1
  347. package/ShadersWGSL/ShadersInclude/pbrBlockReflectivity.js +22 -15
  348. package/ShadersWGSL/ShadersInclude/pbrBlockReflectivity.js.map +1 -1
  349. package/ShadersWGSL/ShadersInclude/pbrBlockSubSurface.js +6 -8
  350. package/ShadersWGSL/ShadersInclude/pbrBlockSubSurface.js.map +1 -1
  351. package/ShadersWGSL/ShadersInclude/pbrDebug.js +2 -2
  352. package/ShadersWGSL/ShadersInclude/pbrDebug.js.map +1 -1
  353. package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.js +1 -7
  354. package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.js.map +1 -1
  355. package/ShadersWGSL/pbr.fragment.js +7 -3
  356. package/ShadersWGSL/pbr.fragment.js.map +1 -1
  357. package/Sprites/spriteManager.js +5 -1
  358. package/Sprites/spriteManager.js.map +1 -1
  359. package/Sprites/spriteRenderer.js +1 -0
  360. package/Sprites/spriteRenderer.js.map +1 -1
  361. package/XR/features/WebXRAnchorSystem.js +4 -3
  362. package/XR/features/WebXRAnchorSystem.js.map +1 -1
  363. package/XR/features/WebXRDepthSensing.js +1 -1
  364. package/XR/features/WebXRDepthSensing.js.map +1 -1
  365. package/XR/features/WebXRHandTracking.js +4 -1
  366. package/XR/features/WebXRHandTracking.js.map +1 -1
  367. package/XR/features/WebXRHitTest.js +4 -1
  368. package/XR/features/WebXRHitTest.js.map +1 -1
  369. package/XR/features/WebXRHitTestLegacy.js +6 -5
  370. package/XR/features/WebXRHitTestLegacy.js.map +1 -1
  371. package/XR/features/WebXRImageTracking.js +2 -1
  372. package/XR/features/WebXRImageTracking.js.map +1 -1
  373. package/XR/features/WebXRLightEstimation.js +3 -0
  374. package/XR/features/WebXRLightEstimation.js.map +1 -1
  375. package/XR/features/WebXRNearInteraction.js +2 -0
  376. package/XR/features/WebXRNearInteraction.js.map +1 -1
  377. package/XR/features/WebXRPlaneDetector.js +2 -2
  378. package/XR/features/WebXRPlaneDetector.js.map +1 -1
  379. package/XR/motionController/webXRAbstractMotionController.js +3 -2
  380. package/XR/motionController/webXRAbstractMotionController.js.map +1 -1
  381. package/XR/motionController/webXRMicrosoftMixedRealityController.js +6 -6
  382. package/XR/motionController/webXRMicrosoftMixedRealityController.js.map +1 -1
  383. package/XR/motionController/webXRMotionControllerManager.js +15 -9
  384. package/XR/motionController/webXRMotionControllerManager.js.map +1 -1
  385. package/XR/motionController/webXRProfiledMotionController.js +1 -1
  386. package/XR/motionController/webXRProfiledMotionController.js.map +1 -1
  387. package/XR/native/nativeXRFrame.js +1 -0
  388. package/XR/native/nativeXRFrame.js.map +1 -1
  389. package/XR/webXRDefaultExperience.js +10 -12
  390. package/XR/webXRDefaultExperience.js.map +1 -1
  391. package/XR/webXREnterExitUI.js +2 -1
  392. package/XR/webXREnterExitUI.js.map +1 -1
  393. package/XR/webXRExperienceHelper.js +5 -2
  394. package/XR/webXRExperienceHelper.js.map +1 -1
  395. package/XR/webXRFeaturesManager.js +1 -0
  396. package/XR/webXRFeaturesManager.js.map +1 -1
  397. package/XR/webXRInput.js +1 -0
  398. package/XR/webXRInput.js.map +1 -1
  399. package/XR/webXRInputSource.js +2 -0
  400. package/XR/webXRInputSource.js.map +1 -1
  401. package/XR/webXRManagedOutputCanvas.js +5 -1
  402. package/XR/webXRManagedOutputCanvas.js.map +1 -1
  403. package/XR/webXRSessionManager.js +56 -60
  404. package/XR/webXRSessionManager.js.map +1 -1
  405. package/assetContainer.js +28 -28
  406. package/assetContainer.js.map +1 -1
  407. package/package.json +1 -1
  408. package/scene.js +5 -4
  409. package/scene.js.map +1 -1
@@ -630,7 +630,7 @@ class PhysicsUpdraftEvent {
630
630
  const impostors = this._physicsEngine.getImpostors();
631
631
  for (const impostor of impostors) {
632
632
  if (!this._getImpostorHitData(impostor, hitData)) {
633
- return;
633
+ continue;
634
634
  }
635
635
  impostor.applyForce(hitData.force, hitData.contactPoint);
636
636
  }
@@ -807,7 +807,7 @@ class PhysicsVortexEvent {
807
807
  const impostors = this._physicsEngine.getImpostors();
808
808
  for (const impostor of impostors) {
809
809
  if (!this._getImpostorHitData(impostor, hitData)) {
810
- return;
810
+ continue;
811
811
  }
812
812
  impostor.applyForce(hitData.force, hitData.contactPoint);
813
813
  }
@@ -1 +1 @@
1
- {"version":3,"file":"physicsHelper.js","sourceRoot":"","sources":["../../../../dev/core/src/Physics/physicsHelper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAG3D,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AASrC,MAAM,WAAW;IACb;;;OAGG;IACH,MAAM,CAAC,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,WAAM,GAAW,EAAE,CAAC;QAEpB;;WAEG;QACH,8BAAyB,GAAW,GAAG,CAAC;QAExC;;WAEG;QACH,+BAA0B,GAAW,CAAC,CAAC;QAEvC;;WAEG;QACH,+BAA0B,GAAW,GAAG,CAAC;QAEzC;;WAEG;QACH,2BAAsB,GAAW,IAAI,CAAC;IAC1C,CAAC;CAAA;AAED;;;GAGG;AACH,MAAM,CAAN,IAAkB,2BAKjB;AALD,WAAkB,2BAA2B;IACzC,4EAA4E;IAC5E,qFAAQ,CAAA;IACR,uEAAuE;IACvE,iFAAM,CAAA;AACV,CAAC,EALiB,2BAA2B,KAA3B,2BAA2B,QAK5C;AAED;;;GAGG;AACH,MAAM,CAAN,IAAkB,kBAKjB;AALD,WAAkB,kBAAkB;IAChC,wFAAwF;IACxF,+DAAM,CAAA;IACN,2HAA2H;IAC3H,6EAAa,CAAA;AACjB,CAAC,EALiB,kBAAkB,KAAlB,kBAAkB,QAKnC","sourcesContent":["import type { Nullable } from \"../types\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport { TmpVectors, Vector3 } from \"../Maths/math.vector\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport type { Mesh } from \"../Meshes/mesh\";\r\nimport { CreateSphere } from \"../Meshes/Builders/sphereBuilder\";\r\nimport { CreateCylinder } from \"../Meshes/Builders/cylinderBuilder\";\r\nimport { Ray } from \"../Culling/ray\";\r\nimport type { Scene } from \"../scene\";\r\nimport type { PhysicsEngine as PhysicsEngineV1 } from \"./physicsEngine\";\r\nimport type { PhysicsEngine as PhysicsEngineV2 } from \"./v2/physicsEngine\";\r\nimport type { IPhysicsEngine } from \"./IPhysicsEngine\";\r\nimport type { PhysicsImpostor } from \"./v1/physicsImpostor\";\r\nimport type { PhysicsBody } from \"./v2/physicsBody\";\r\nimport { PhysicsMotionType } from \"./v2/IPhysicsEnginePlugin\";\r\n\r\nclass HelperTools {\r\n /*\r\n * Gets the hit contact point between a mesh and a ray. The method varies between\r\n * the different plugin versions; V1 uses a mesh intersection, V2 uses the physics body instance/object center (to avoid a raycast and improve perf).\r\n */\r\n static GetContactPointToRef(mesh: AbstractMesh, origin: Vector3, direction: Vector3, result: Vector3, instanceIndex?: number): boolean {\r\n const engine = mesh.getScene().getPhysicsEngine();\r\n const pluginVersion = engine?.getPluginVersion();\r\n if (pluginVersion === 1) {\r\n const ray = new Ray(origin, direction);\r\n const hit = ray.intersectsMesh(mesh);\r\n if (hit.hit && hit.pickedPoint) {\r\n result.copyFrom(hit.pickedPoint);\r\n return true;\r\n }\r\n } else if (pluginVersion === 2) {\r\n mesh.physicsBody!.getObjectCenterWorldToRef(result, instanceIndex);\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n /**\r\n * Checks if a body will be affected by forces\r\n * @param body the body to check\r\n * @param instanceIndex for instanced bodies, the index of the instance to check\r\n * @returns\r\n */\r\n static HasAppliedForces(body: PhysicsBody, instanceIndex?: number) {\r\n return (\r\n body.getMotionType(instanceIndex) === PhysicsMotionType.STATIC ||\r\n (body.getMassProperties(instanceIndex)?.mass ?? 0) === 0 ||\r\n (body.transformNode as Mesh)?.getTotalVertices() === 0\r\n );\r\n }\r\n\r\n /**\r\n * Checks if a point is inside a cylinder\r\n * @param point point to check\r\n * @param origin cylinder origin on the bottom\r\n * @param radius cylinder radius\r\n * @param height cylinder height\r\n * @returns\r\n */\r\n static IsInsideCylinder(point: Vector3, origin: Vector3, radius: number, height: number): boolean {\r\n const distance = TmpVectors.Vector3[0];\r\n point.subtractToRef(origin, distance);\r\n return Math.abs(distance.x) <= radius && Math.abs(distance.z) <= radius && distance.y >= 0 && distance.y <= height;\r\n }\r\n}\r\n\r\n/**\r\n * A helper for physics simulations\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class\r\n */\r\nexport class PhysicsHelper {\r\n private _scene: Scene;\r\n private _physicsEngine: Nullable<IPhysicsEngine>;\r\n private _hitData: PhysicsHitData = { force: new Vector3(), contactPoint: new Vector3(), distanceFromOrigin: 0 };\r\n\r\n /**\r\n * Initializes the Physics helper\r\n * @param scene Babylon.js scene\r\n */\r\n constructor(scene: Scene) {\r\n this._scene = scene;\r\n this._physicsEngine = this._scene.getPhysicsEngine();\r\n\r\n if (!this._physicsEngine) {\r\n Logger.Warn(\"Physics engine not enabled. Please enable the physics before you can use the methods.\");\r\n return;\r\n }\r\n }\r\n\r\n /**\r\n * Applies a radial explosion impulse\r\n * @param origin the origin of the explosion\r\n * @param radiusOrEventOptions the radius or the options of radial explosion\r\n * @param strength the explosion strength\r\n * @param falloff possible options: Constant & Linear. Defaults to Constant\r\n * @returns A physics radial explosion event, or null\r\n */\r\n public applyRadialExplosionImpulse(\r\n origin: Vector3,\r\n radiusOrEventOptions: number | PhysicsRadialExplosionEventOptions,\r\n strength?: number,\r\n falloff?: PhysicsRadialImpulseFalloff\r\n ): Nullable<PhysicsRadialExplosionEvent> {\r\n if (!this._physicsEngine) {\r\n Logger.Warn(\"Physics engine not enabled. Please enable the physics before you call this method.\");\r\n return null;\r\n }\r\n\r\n if (this._physicsEngine.getPluginVersion() === 1 && (<PhysicsEngineV1>this._physicsEngine).getImpostors().length === 0) {\r\n return null;\r\n }\r\n\r\n if (this._physicsEngine.getPluginVersion() === 2 && (<PhysicsEngineV2>this._physicsEngine).getBodies().length === 0) {\r\n return null;\r\n }\r\n\r\n let useCallback = false;\r\n if (typeof radiusOrEventOptions === \"number\") {\r\n const r = radiusOrEventOptions;\r\n radiusOrEventOptions = new PhysicsRadialExplosionEventOptions();\r\n radiusOrEventOptions.radius = r;\r\n radiusOrEventOptions.strength = strength ?? radiusOrEventOptions.strength;\r\n radiusOrEventOptions.falloff = falloff ?? radiusOrEventOptions.falloff;\r\n } else {\r\n useCallback = !!(radiusOrEventOptions.affectedImpostorsCallback || radiusOrEventOptions.affectedBodiesCallback);\r\n }\r\n\r\n const event = new PhysicsRadialExplosionEvent(this._scene, radiusOrEventOptions);\r\n\r\n const hitData = this._hitData;\r\n if (this._physicsEngine.getPluginVersion() === 1) {\r\n const affectedImpostorsWithData = Array<PhysicsAffectedImpostorWithData>();\r\n const impostors = (<PhysicsEngineV1>this._physicsEngine).getImpostors();\r\n for (const impostor of impostors) {\r\n if (!event.getImpostorHitData(impostor, origin, hitData)) {\r\n continue;\r\n }\r\n\r\n impostor.applyImpulse(hitData.force, hitData.contactPoint);\r\n\r\n if (useCallback) {\r\n affectedImpostorsWithData.push({\r\n impostor: impostor,\r\n hitData: this._copyPhysicsHitData(hitData),\r\n });\r\n }\r\n }\r\n\r\n event.triggerAffectedImpostorsCallback(affectedImpostorsWithData);\r\n } else {\r\n this._applicationForBodies(event, origin, hitData, useCallback, (body: PhysicsBody, hitData: PhysicsHitData) => {\r\n body.applyImpulse(hitData.force, hitData.contactPoint, hitData.instanceIndex);\r\n });\r\n }\r\n\r\n event.dispose(false);\r\n\r\n return event;\r\n }\r\n\r\n /**\r\n * Applies a radial explosion force\r\n * @param origin the origin of the explosion\r\n * @param radiusOrEventOptions the radius or the options of radial explosion\r\n * @param strength the explosion strength\r\n * @param falloff possible options: Constant & Linear. Defaults to Constant\r\n * @returns A physics radial explosion event, or null\r\n */\r\n public applyRadialExplosionForce(\r\n origin: Vector3,\r\n radiusOrEventOptions: number | PhysicsRadialExplosionEventOptions,\r\n strength?: number,\r\n falloff?: PhysicsRadialImpulseFalloff\r\n ): Nullable<PhysicsRadialExplosionEvent> {\r\n if (!this._physicsEngine) {\r\n Logger.Warn(\"Physics engine not enabled. Please enable the physics before you call the PhysicsHelper.\");\r\n return null;\r\n }\r\n\r\n if (this._physicsEngine.getPluginVersion() === 1 && (<PhysicsEngineV1>this._physicsEngine).getImpostors().length === 0) {\r\n return null;\r\n }\r\n\r\n if (this._physicsEngine.getPluginVersion() === 2 && (<PhysicsEngineV2>this._physicsEngine).getBodies().length === 0) {\r\n return null;\r\n }\r\n\r\n let useCallback = false;\r\n if (typeof radiusOrEventOptions === \"number\") {\r\n const r = radiusOrEventOptions;\r\n radiusOrEventOptions = new PhysicsRadialExplosionEventOptions();\r\n radiusOrEventOptions.radius = r;\r\n radiusOrEventOptions.strength = strength ?? radiusOrEventOptions.strength;\r\n radiusOrEventOptions.falloff = falloff ?? radiusOrEventOptions.falloff;\r\n } else {\r\n useCallback = !!(radiusOrEventOptions.affectedImpostorsCallback || radiusOrEventOptions.affectedBodiesCallback);\r\n }\r\n\r\n const event = new PhysicsRadialExplosionEvent(this._scene, radiusOrEventOptions);\r\n\r\n const hitData = this._hitData;\r\n if (this._physicsEngine.getPluginVersion() === 1) {\r\n const affectedImpostorsWithData = Array<PhysicsAffectedImpostorWithData>();\r\n const impostors = (<PhysicsEngineV1>this._physicsEngine).getImpostors();\r\n for (const impostor of impostors) {\r\n if (!event.getImpostorHitData(impostor, origin, hitData)) {\r\n continue;\r\n }\r\n\r\n impostor.applyForce(hitData.force, hitData.contactPoint);\r\n\r\n if (useCallback) {\r\n affectedImpostorsWithData.push({\r\n impostor: impostor,\r\n hitData: this._copyPhysicsHitData(hitData),\r\n });\r\n }\r\n }\r\n\r\n event.triggerAffectedImpostorsCallback(affectedImpostorsWithData);\r\n } else {\r\n this._applicationForBodies(event, origin, hitData, useCallback, (body: PhysicsBody, hitData: PhysicsHitData) => {\r\n body.applyForce(hitData.force, hitData.contactPoint, hitData.instanceIndex);\r\n });\r\n }\r\n\r\n event.dispose(false);\r\n\r\n return event;\r\n }\r\n\r\n private _applicationForBodies(\r\n event: PhysicsRadialExplosionEvent,\r\n origin: Vector3,\r\n hitData: PhysicsHitData,\r\n useCallback: boolean,\r\n fnApplication: (body: PhysicsBody, hitData: PhysicsHitData, instanceIndex?: number) => void\r\n ) {\r\n const affectedBodiesWithData = Array<PhysicsAffectedBodyWithData>();\r\n const bodies = (<PhysicsEngineV2>this._physicsEngine).getBodies();\r\n for (const body of bodies) {\r\n body.iterateOverAllInstances((body, instanceIndex) => {\r\n if (!event.getBodyHitData(body, origin, hitData, instanceIndex)) {\r\n return;\r\n }\r\n fnApplication(body, hitData);\r\n\r\n if (useCallback) {\r\n affectedBodiesWithData.push({\r\n body: body,\r\n hitData: this._copyPhysicsHitData(hitData),\r\n });\r\n }\r\n });\r\n }\r\n\r\n event.triggerAffectedBodiesCallback(affectedBodiesWithData);\r\n }\r\n\r\n /**\r\n * Creates a gravitational field\r\n * @param origin the origin of the gravitational field\r\n * @param radiusOrEventOptions the radius or the options of radial gravitational field\r\n * @param strength the gravitational field strength\r\n * @param falloff possible options: Constant & Linear. Defaults to Constant\r\n * @returns A physics gravitational field event, or null\r\n */\r\n public gravitationalField(\r\n origin: Vector3,\r\n radiusOrEventOptions: number | PhysicsRadialExplosionEventOptions,\r\n strength?: number,\r\n falloff?: PhysicsRadialImpulseFalloff\r\n ): Nullable<PhysicsGravitationalFieldEvent> {\r\n if (!this._physicsEngine) {\r\n Logger.Warn(\"Physics engine not enabled. Please enable the physics before you call the PhysicsHelper.\");\r\n return null;\r\n }\r\n\r\n if (this._physicsEngine.getPluginVersion() === 1 && (<PhysicsEngineV1>this._physicsEngine).getImpostors().length === 0) {\r\n return null;\r\n }\r\n\r\n if (this._physicsEngine.getPluginVersion() === 2 && (<PhysicsEngineV2>this._physicsEngine).getBodies().length === 0) {\r\n return null;\r\n }\r\n\r\n if (typeof radiusOrEventOptions === \"number\") {\r\n const r = radiusOrEventOptions;\r\n radiusOrEventOptions = new PhysicsRadialExplosionEventOptions();\r\n radiusOrEventOptions.radius = r;\r\n radiusOrEventOptions.strength = strength ?? radiusOrEventOptions.strength;\r\n radiusOrEventOptions.falloff = falloff ?? radiusOrEventOptions.falloff;\r\n }\r\n\r\n const event = new PhysicsGravitationalFieldEvent(this, this._scene, origin, radiusOrEventOptions);\r\n\r\n event.dispose(false);\r\n\r\n return event;\r\n }\r\n\r\n /**\r\n * Creates a physics updraft event\r\n * @param origin the origin of the updraft\r\n * @param radiusOrEventOptions the radius or the options of the updraft\r\n * @param strength the strength of the updraft\r\n * @param height the height of the updraft\r\n * @param updraftMode possible options: Center & Perpendicular. Defaults to Center\r\n * @returns A physics updraft event, or null\r\n */\r\n public updraft(\r\n origin: Vector3,\r\n radiusOrEventOptions: number | PhysicsUpdraftEventOptions,\r\n strength?: number,\r\n height?: number,\r\n updraftMode?: PhysicsUpdraftMode\r\n ): Nullable<PhysicsUpdraftEvent> {\r\n if (!this._physicsEngine) {\r\n Logger.Warn(\"Physics engine not enabled. Please enable the physics before you call the PhysicsHelper.\");\r\n return null;\r\n }\r\n\r\n if (this._physicsEngine.getPluginVersion() === 1 && (<PhysicsEngineV1>this._physicsEngine).getImpostors().length === 0) {\r\n return null;\r\n }\r\n\r\n if (this._physicsEngine.getPluginVersion() === 2 && (<PhysicsEngineV2>this._physicsEngine).getBodies().length === 0) {\r\n return null;\r\n }\r\n\r\n if (typeof radiusOrEventOptions === \"number\") {\r\n const r = radiusOrEventOptions;\r\n radiusOrEventOptions = new PhysicsUpdraftEventOptions();\r\n radiusOrEventOptions.radius = r;\r\n radiusOrEventOptions.strength = strength ?? radiusOrEventOptions.strength;\r\n radiusOrEventOptions.height = height ?? radiusOrEventOptions.height;\r\n radiusOrEventOptions.updraftMode = updraftMode ?? radiusOrEventOptions.updraftMode;\r\n }\r\n\r\n const event = new PhysicsUpdraftEvent(this._scene, origin, radiusOrEventOptions);\r\n\r\n event.dispose(false);\r\n\r\n return event;\r\n }\r\n\r\n /**\r\n * Creates a physics vortex event\r\n * @param origin the of the vortex\r\n * @param radiusOrEventOptions the radius or the options of the vortex\r\n * @param strength the strength of the vortex\r\n * @param height the height of the vortex\r\n * @returns a Physics vortex event, or null\r\n * A physics vortex event or null\r\n */\r\n public vortex(origin: Vector3, radiusOrEventOptions: number | PhysicsVortexEventOptions, strength?: number, height?: number): Nullable<PhysicsVortexEvent> {\r\n if (!this._physicsEngine) {\r\n Logger.Warn(\"Physics engine not enabled. Please enable the physics before you call the PhysicsHelper.\");\r\n return null;\r\n }\r\n\r\n if (this._physicsEngine.getPluginVersion() === 1 && (<PhysicsEngineV1>this._physicsEngine).getImpostors().length === 0) {\r\n return null;\r\n }\r\n\r\n if (this._physicsEngine.getPluginVersion() === 2 && (<PhysicsEngineV2>this._physicsEngine).getBodies().length === 0) {\r\n return null;\r\n }\r\n\r\n if (typeof radiusOrEventOptions === \"number\") {\r\n const r = radiusOrEventOptions;\r\n radiusOrEventOptions = new PhysicsVortexEventOptions();\r\n radiusOrEventOptions.radius = r;\r\n radiusOrEventOptions.strength = strength ?? radiusOrEventOptions.strength;\r\n radiusOrEventOptions.height = height ?? radiusOrEventOptions.height;\r\n }\r\n\r\n const event = new PhysicsVortexEvent(this._scene, origin, radiusOrEventOptions);\r\n\r\n event.dispose(false);\r\n\r\n return event;\r\n }\r\n\r\n private _copyPhysicsHitData(data: PhysicsHitData): PhysicsHitData {\r\n return { force: data.force.clone(), contactPoint: data.contactPoint.clone(), distanceFromOrigin: data.distanceFromOrigin, instanceIndex: data.instanceIndex };\r\n }\r\n}\r\n\r\n/**\r\n * Represents a physics radial explosion event\r\n */\r\nclass PhysicsRadialExplosionEvent {\r\n private _sphere: Mesh; // create a sphere, so we can get the intersecting meshes inside\r\n private _dataFetched: boolean = false; // check if the data has been fetched. If not, do cleanup\r\n\r\n /**\r\n * Initializes a radial explosion event\r\n * @param _scene BabylonJS scene\r\n * @param _options The options for the vortex event\r\n */\r\n constructor(\r\n private _scene: Scene,\r\n private _options: PhysicsRadialExplosionEventOptions\r\n ) {\r\n this._options = { ...new PhysicsRadialExplosionEventOptions(), ...this._options };\r\n }\r\n\r\n /**\r\n * Returns the data related to the radial explosion event (sphere).\r\n * @returns The radial explosion event data\r\n */\r\n public getData(): PhysicsRadialExplosionEventData {\r\n this._dataFetched = true;\r\n\r\n return {\r\n sphere: this._sphere,\r\n };\r\n }\r\n\r\n private _getHitData(mesh: AbstractMesh, center: Vector3, origin: Vector3, data: PhysicsHitData): boolean {\r\n const direction = TmpVectors.Vector3[0];\r\n direction.copyFrom(center).subtractInPlace(origin);\r\n\r\n const contactPoint = TmpVectors.Vector3[1];\r\n const hasContactPoint = HelperTools.GetContactPointToRef(mesh, origin, direction, contactPoint, data.instanceIndex);\r\n\r\n if (!hasContactPoint) {\r\n return false;\r\n }\r\n\r\n const distanceFromOrigin = Vector3.Distance(origin, contactPoint);\r\n if (distanceFromOrigin > this._options.radius) {\r\n return false;\r\n }\r\n\r\n const multiplier =\r\n this._options.falloff === PhysicsRadialImpulseFalloff.Constant ? this._options.strength : this._options.strength * (1 - distanceFromOrigin / this._options.radius);\r\n\r\n // Direction x multiplier equals force\r\n direction.scaleInPlace(multiplier);\r\n\r\n data.force.copyFrom(direction);\r\n data.contactPoint.copyFrom(contactPoint);\r\n data.distanceFromOrigin = distanceFromOrigin;\r\n return true;\r\n }\r\n\r\n /**\r\n * Returns the force and contact point of the body or false, if the body is not affected by the force/impulse.\r\n * @param body A physics body where the transform node is an AbstractMesh\r\n * @param origin the origin of the explosion\r\n * @param data the data of the hit\r\n * @param instanceIndex the instance index of the body\r\n * @returns if there was a hit\r\n */\r\n public getBodyHitData(body: PhysicsBody, origin: Vector3, data: PhysicsHitData, instanceIndex?: number): boolean {\r\n // No force will be applied in these cases, so we skip calculation\r\n if (HelperTools.HasAppliedForces(body, instanceIndex)) {\r\n return false;\r\n }\r\n\r\n const mesh = body.transformNode as AbstractMesh;\r\n const bodyObjectCenter = body.getObjectCenterWorld(instanceIndex);\r\n data.instanceIndex = instanceIndex;\r\n return this._getHitData(mesh, bodyObjectCenter, origin, data);\r\n }\r\n /**\r\n * Returns the force and contact point of the impostor or false, if the impostor is not affected by the force/impulse.\r\n * @param impostor A physics imposter\r\n * @param origin the origin of the explosion\r\n * @param data the data of the hit\r\n * @returns A physics force and contact point, or null\r\n */\r\n public getImpostorHitData(impostor: PhysicsImpostor, origin: Vector3, data: PhysicsHitData): boolean {\r\n if (impostor.mass === 0) {\r\n return false;\r\n }\r\n\r\n if (impostor.object.getClassName() !== \"Mesh\" && impostor.object.getClassName() !== \"InstancedMesh\") {\r\n return false;\r\n }\r\n\r\n const mesh = impostor.object as AbstractMesh;\r\n if (!this._intersectsWithSphere(mesh, origin, this._options.radius)) {\r\n return false;\r\n }\r\n\r\n const impostorObjectCenter = impostor.getObjectCenter();\r\n\r\n this._getHitData(mesh, impostorObjectCenter, origin, data);\r\n return true;\r\n }\r\n\r\n /**\r\n * Triggers affected impostors callbacks\r\n * @param affectedImpostorsWithData defines the list of affected impostors (including associated data)\r\n */\r\n public triggerAffectedImpostorsCallback(affectedImpostorsWithData: Array<PhysicsAffectedImpostorWithData>) {\r\n if (this._options.affectedImpostorsCallback) {\r\n this._options.affectedImpostorsCallback(affectedImpostorsWithData);\r\n }\r\n }\r\n\r\n /**\r\n * Triggers affected bodies callbacks\r\n * @param affectedBodiesWithData defines the list of affected bodies (including associated data)\r\n */\r\n public triggerAffectedBodiesCallback(affectedBodiesWithData: Array<PhysicsAffectedBodyWithData>) {\r\n if (this._options.affectedBodiesCallback) {\r\n this._options.affectedBodiesCallback(affectedBodiesWithData);\r\n }\r\n }\r\n /**\r\n * Disposes the sphere.\r\n * @param force Specifies if the sphere should be disposed by force\r\n */\r\n public dispose(force: boolean = true) {\r\n if (this._sphere) {\r\n if (force) {\r\n this._sphere.dispose();\r\n } else {\r\n setTimeout(() => {\r\n if (!this._dataFetched) {\r\n this._sphere.dispose();\r\n }\r\n }, 0);\r\n }\r\n }\r\n }\r\n\r\n /*** Helpers ***/\r\n\r\n private _prepareSphere(): void {\r\n if (!this._sphere) {\r\n this._sphere = CreateSphere(\"radialExplosionEventSphere\", this._options.sphere, this._scene);\r\n this._sphere.isVisible = false;\r\n }\r\n }\r\n\r\n private _intersectsWithSphere(mesh: AbstractMesh, origin: Vector3, radius: number): boolean {\r\n this._prepareSphere();\r\n\r\n this._sphere.position = origin;\r\n this._sphere.scaling.setAll(radius * 2);\r\n this._sphere._updateBoundingInfo();\r\n this._sphere.computeWorldMatrix(true);\r\n\r\n return this._sphere.intersectsMesh(mesh, true);\r\n }\r\n}\r\n\r\n/**\r\n * Represents a gravitational field event\r\n */\r\nclass PhysicsGravitationalFieldEvent {\r\n private _tickCallback: any;\r\n private _sphere: Mesh;\r\n private _dataFetched: boolean = false; // check if the has been fetched the data. If not, do cleanup\r\n\r\n /**\r\n * Initializes the physics gravitational field event\r\n * @param _physicsHelper A physics helper\r\n * @param _scene BabylonJS scene\r\n * @param _origin The origin position of the gravitational field event\r\n * @param _options The options for the vortex event\r\n */\r\n constructor(\r\n private _physicsHelper: PhysicsHelper,\r\n private _scene: Scene,\r\n private _origin: Vector3,\r\n private _options: PhysicsRadialExplosionEventOptions\r\n ) {\r\n this._options = { ...new PhysicsRadialExplosionEventOptions(), ...this._options };\r\n\r\n this._tickCallback = () => this._tick();\r\n\r\n this._options.strength = this._options.strength * -1;\r\n }\r\n\r\n /**\r\n * Returns the data related to the gravitational field event (sphere).\r\n * @returns A gravitational field event\r\n */\r\n public getData(): PhysicsGravitationalFieldEventData {\r\n this._dataFetched = true;\r\n\r\n return {\r\n sphere: this._sphere,\r\n };\r\n }\r\n\r\n /**\r\n * Enables the gravitational field.\r\n */\r\n public enable() {\r\n this._tickCallback.call(this);\r\n this._scene.registerBeforeRender(this._tickCallback);\r\n }\r\n\r\n /**\r\n * Disables the gravitational field.\r\n */\r\n public disable() {\r\n this._scene.unregisterBeforeRender(this._tickCallback);\r\n }\r\n\r\n /**\r\n * Disposes the sphere.\r\n * @param force The force to dispose from the gravitational field event\r\n */\r\n public dispose(force: boolean = true) {\r\n if (!this._sphere) {\r\n return;\r\n }\r\n if (force) {\r\n this._sphere.dispose();\r\n } else {\r\n setTimeout(() => {\r\n if (!this._dataFetched) {\r\n this._sphere.dispose();\r\n }\r\n }, 0);\r\n }\r\n }\r\n\r\n private _tick() {\r\n // Since the params won't change, we fetch the event only once\r\n if (this._sphere) {\r\n this._physicsHelper.applyRadialExplosionForce(this._origin, this._options);\r\n } else {\r\n const radialExplosionEvent = this._physicsHelper.applyRadialExplosionForce(this._origin, this._options);\r\n if (radialExplosionEvent) {\r\n this._sphere = radialExplosionEvent.getData().sphere?.clone(\"radialExplosionEventSphereClone\");\r\n }\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Represents a physics updraft event\r\n */\r\nclass PhysicsUpdraftEvent {\r\n private _physicsEngine: PhysicsEngineV1 | PhysicsEngineV2;\r\n private _originTop: Vector3 = Vector3.Zero(); // the most upper part of the cylinder\r\n private _originDirection: Vector3 = Vector3.Zero(); // used if the updraftMode is perpendicular\r\n private _tickCallback: any;\r\n private _cylinder: Mesh | undefined;\r\n private _cylinderPosition: Vector3 = Vector3.Zero(); // to keep the cylinders position, because normally the origin is in the center and not on the bottom\r\n private _dataFetched: boolean = false; // check if the has been fetched the data. If not, do cleanup\r\n private static _HitData: PhysicsHitData = { force: new Vector3(), contactPoint: new Vector3(), distanceFromOrigin: 0 };\r\n /**\r\n * Initializes the physics updraft event\r\n * @param _scene BabylonJS scene\r\n * @param _origin The origin position of the updraft\r\n * @param _options The options for the updraft event\r\n */\r\n constructor(\r\n private _scene: Scene,\r\n private _origin: Vector3,\r\n private _options: PhysicsUpdraftEventOptions\r\n ) {\r\n this._physicsEngine = this._scene.getPhysicsEngine() as PhysicsEngineV1 | PhysicsEngineV2;\r\n this._options = { ...new PhysicsUpdraftEventOptions(), ...this._options };\r\n\r\n this._origin.addToRef(new Vector3(0, this._options.height / 2, 0), this._cylinderPosition);\r\n this._origin.addToRef(new Vector3(0, this._options.height, 0), this._originTop);\r\n\r\n if (this._options.updraftMode === PhysicsUpdraftMode.Perpendicular) {\r\n this._originDirection = this._origin.subtract(this._originTop).normalize();\r\n }\r\n\r\n this._tickCallback = () => this._tick();\r\n\r\n if (this._physicsEngine.getPluginVersion() === 1) {\r\n this._prepareCylinder();\r\n }\r\n }\r\n\r\n /**\r\n * Returns the data related to the updraft event (cylinder).\r\n * @returns A physics updraft event\r\n */\r\n public getData(): PhysicsUpdraftEventData {\r\n this._dataFetched = true;\r\n\r\n return {\r\n cylinder: this._cylinder,\r\n };\r\n }\r\n\r\n /**\r\n * Enables the updraft.\r\n */\r\n public enable() {\r\n this._tickCallback.call(this);\r\n this._scene.registerBeforeRender(this._tickCallback);\r\n }\r\n\r\n /**\r\n * Disables the updraft.\r\n */\r\n public disable() {\r\n this._scene.unregisterBeforeRender(this._tickCallback);\r\n }\r\n\r\n /**\r\n * Disposes the cylinder.\r\n * @param force Specifies if the updraft should be disposed by force\r\n */\r\n public dispose(force: boolean = true) {\r\n if (!this._cylinder) {\r\n return;\r\n }\r\n if (force) {\r\n this._cylinder.dispose();\r\n this._cylinder = undefined;\r\n } else {\r\n setTimeout(() => {\r\n if (!this._dataFetched && this._cylinder) {\r\n this._cylinder.dispose();\r\n this._cylinder = undefined;\r\n }\r\n }, 0);\r\n }\r\n }\r\n\r\n private _getHitData(center: Vector3, data: PhysicsHitData): void {\r\n let direction: Vector3;\r\n if (this._options.updraftMode === PhysicsUpdraftMode.Perpendicular) {\r\n direction = this._originDirection;\r\n } else {\r\n direction = center.subtract(this._originTop);\r\n }\r\n\r\n const distanceFromOrigin = Vector3.Distance(this._origin, center);\r\n\r\n const multiplier = this._options.strength * -1;\r\n\r\n const force = direction.multiplyByFloats(multiplier, multiplier, multiplier);\r\n\r\n data.force.copyFrom(force);\r\n data.contactPoint.copyFrom(center);\r\n data.distanceFromOrigin = distanceFromOrigin;\r\n }\r\n\r\n private _getBodyHitData(body: PhysicsBody, data: PhysicsHitData, instanceIndex?: number): boolean {\r\n if (HelperTools.HasAppliedForces(body)) {\r\n return false;\r\n }\r\n\r\n const center = body.getObjectCenterWorld(instanceIndex);\r\n\r\n if (!HelperTools.IsInsideCylinder(center, this._origin, this._options.radius, this._options.height)) {\r\n return false;\r\n }\r\n\r\n data.instanceIndex = instanceIndex;\r\n this._getHitData(center, data);\r\n return true;\r\n }\r\n\r\n private _getImpostorHitData(impostor: PhysicsImpostor, data: PhysicsHitData): boolean {\r\n if (impostor.mass === 0) {\r\n return false;\r\n }\r\n\r\n const impostorObject = <AbstractMesh>impostor.object;\r\n if (!this._intersectsWithCylinder(impostorObject)) {\r\n return false;\r\n }\r\n\r\n const center = impostor.getObjectCenter();\r\n this._getHitData(center, data);\r\n return true;\r\n }\r\n\r\n private _tick() {\r\n const hitData = PhysicsUpdraftEvent._HitData;\r\n if (this._physicsEngine.getPluginVersion() === 1) {\r\n const impostors = (<PhysicsEngineV1>this._physicsEngine).getImpostors();\r\n for (const impostor of impostors) {\r\n if (!this._getImpostorHitData(impostor, hitData)) {\r\n return;\r\n }\r\n\r\n impostor.applyForce(hitData.force, hitData.contactPoint);\r\n }\r\n } else {\r\n // V2\r\n const bodies = (<PhysicsEngineV2>this._physicsEngine).getBodies();\r\n for (const body of bodies) {\r\n body.iterateOverAllInstances((body, instanceIndex) => {\r\n if (!this._getBodyHitData(body, hitData, instanceIndex)) {\r\n return;\r\n }\r\n\r\n body.applyForce(hitData.force, hitData.contactPoint, hitData.instanceIndex);\r\n });\r\n }\r\n }\r\n }\r\n\r\n /*** Helpers ***/\r\n\r\n private _prepareCylinder(): void {\r\n if (!this._cylinder) {\r\n this._cylinder = CreateCylinder(\r\n \"updraftEventCylinder\",\r\n {\r\n height: this._options.height,\r\n diameter: this._options.radius * 2,\r\n },\r\n this._scene\r\n );\r\n this._cylinder.isVisible = false;\r\n }\r\n }\r\n\r\n private _intersectsWithCylinder(mesh: AbstractMesh): boolean {\r\n if (!this._cylinder) {\r\n return false;\r\n }\r\n this._cylinder.position = this._cylinderPosition;\r\n return this._cylinder.intersectsMesh(mesh, true);\r\n }\r\n}\r\n\r\n/**\r\n * Represents a physics vortex event\r\n */\r\nclass PhysicsVortexEvent {\r\n private _physicsEngine: PhysicsEngineV1 | PhysicsEngineV2;\r\n private _originTop: Vector3 = Vector3.Zero(); // the most upper part of the cylinder\r\n private _tickCallback: any;\r\n private _cylinder: Mesh;\r\n private _cylinderPosition: Vector3 = Vector3.Zero(); // to keep the cylinders position, because normally the origin is in the center and not on the bottom\r\n private _dataFetched: boolean = false; // check if the has been fetched the data. If not, do cleanup\r\n private static _OriginOnPlane: Vector3 = Vector3.Zero();\r\n private static _HitData: PhysicsHitData = { force: new Vector3(), contactPoint: new Vector3(), distanceFromOrigin: 0 };\r\n\r\n /**\r\n * Initializes the physics vortex event\r\n * @param _scene The BabylonJS scene\r\n * @param _origin The origin position of the vortex\r\n * @param _options The options for the vortex event\r\n */\r\n constructor(\r\n private _scene: Scene,\r\n private _origin: Vector3,\r\n private _options: PhysicsVortexEventOptions\r\n ) {\r\n this._physicsEngine = this._scene.getPhysicsEngine() as PhysicsEngineV1 | PhysicsEngineV2;\r\n this._options = { ...new PhysicsVortexEventOptions(), ...this._options };\r\n\r\n this._origin.addToRef(new Vector3(0, this._options.height / 2, 0), this._cylinderPosition);\r\n this._origin.addToRef(new Vector3(0, this._options.height, 0), this._originTop);\r\n\r\n this._tickCallback = () => this._tick();\r\n\r\n if (this._physicsEngine.getPluginVersion() === 1) {\r\n this._prepareCylinder();\r\n }\r\n }\r\n\r\n /**\r\n * Returns the data related to the vortex event (cylinder).\r\n * @returns The physics vortex event data\r\n */\r\n public getData(): PhysicsVortexEventData {\r\n this._dataFetched = true;\r\n\r\n return {\r\n cylinder: this._cylinder,\r\n };\r\n }\r\n\r\n /**\r\n * Enables the vortex.\r\n */\r\n public enable() {\r\n this._tickCallback.call(this);\r\n this._scene.registerBeforeRender(this._tickCallback);\r\n }\r\n\r\n /**\r\n * Disables the cortex.\r\n */\r\n public disable() {\r\n this._scene.unregisterBeforeRender(this._tickCallback);\r\n }\r\n\r\n /**\r\n * Disposes the sphere.\r\n * @param force\r\n */\r\n public dispose(force: boolean = true) {\r\n if (!this._cylinder) {\r\n return;\r\n }\r\n if (force) {\r\n this._cylinder.dispose();\r\n } else {\r\n setTimeout(() => {\r\n if (!this._dataFetched) {\r\n this._cylinder.dispose();\r\n }\r\n }, 0);\r\n }\r\n }\r\n\r\n private _getHitData(mesh: AbstractMesh, center: Vector3, data: PhysicsHitData): boolean {\r\n const originOnPlane = PhysicsVortexEvent._OriginOnPlane;\r\n originOnPlane.set(this._origin.x, center.y, this._origin.z); // the distance to the origin as if both objects were on a plane (Y-axis)\r\n const originToImpostorDirection = TmpVectors.Vector3[0];\r\n center.subtractToRef(originOnPlane, originToImpostorDirection);\r\n\r\n const contactPoint = TmpVectors.Vector3[1];\r\n const hasContactPoint = HelperTools.GetContactPointToRef(mesh, originOnPlane, originToImpostorDirection, contactPoint, data.instanceIndex);\r\n if (!hasContactPoint) {\r\n return false;\r\n }\r\n const distance = Vector3.Distance(contactPoint, originOnPlane);\r\n const absoluteDistanceFromOrigin = distance / this._options.radius;\r\n\r\n const directionToOrigin = TmpVectors.Vector3[2];\r\n contactPoint.normalizeToRef(directionToOrigin);\r\n if (absoluteDistanceFromOrigin > this._options.centripetalForceThreshold) {\r\n directionToOrigin.negateInPlace();\r\n }\r\n\r\n let forceX: number;\r\n let forceY: number;\r\n let forceZ: number;\r\n\r\n if (absoluteDistanceFromOrigin > this._options.centripetalForceThreshold) {\r\n forceX = directionToOrigin.x * this._options.centripetalForceMultiplier;\r\n forceY = directionToOrigin.y * this._options.updraftForceMultiplier;\r\n forceZ = directionToOrigin.z * this._options.centripetalForceMultiplier;\r\n } else {\r\n const perpendicularDirection = Vector3.Cross(originOnPlane, center).normalize();\r\n\r\n forceX = (perpendicularDirection.x + directionToOrigin.x) * this._options.centrifugalForceMultiplier;\r\n forceY = this._originTop.y * this._options.updraftForceMultiplier;\r\n forceZ = (perpendicularDirection.z + directionToOrigin.z) * this._options.centrifugalForceMultiplier;\r\n }\r\n\r\n const force = TmpVectors.Vector3[3];\r\n force.set(forceX, forceY, forceZ);\r\n force.scaleInPlace(this._options.strength);\r\n\r\n data.force.copyFrom(force);\r\n data.contactPoint.copyFrom(center);\r\n data.distanceFromOrigin = absoluteDistanceFromOrigin;\r\n return true;\r\n }\r\n\r\n private _getBodyHitData(body: PhysicsBody, data: PhysicsHitData, instanceIndex?: number): boolean {\r\n if (HelperTools.HasAppliedForces(body, instanceIndex)) {\r\n return false;\r\n }\r\n\r\n const bodyObject = body.transformNode as AbstractMesh;\r\n const bodyCenter = body.getObjectCenterWorld(instanceIndex);\r\n\r\n if (!HelperTools.IsInsideCylinder(bodyCenter, this._origin, this._options.radius, this._options.height)) {\r\n return false;\r\n }\r\n\r\n data.instanceIndex = instanceIndex;\r\n return this._getHitData(bodyObject, bodyCenter, data);\r\n }\r\n\r\n private _getImpostorHitData(impostor: PhysicsImpostor, data: PhysicsHitData): boolean {\r\n if (impostor.mass === 0) {\r\n return false;\r\n }\r\n\r\n if (impostor.object.getClassName() !== \"Mesh\" && impostor.object.getClassName() !== \"InstancedMesh\") {\r\n return false;\r\n }\r\n\r\n const impostorObject = impostor.object as AbstractMesh;\r\n if (!this._intersectsWithCylinder(impostorObject)) {\r\n return false;\r\n }\r\n\r\n const impostorObjectCenter = impostor.getObjectCenter();\r\n this._getHitData(impostorObject, impostorObjectCenter, data);\r\n return true;\r\n }\r\n\r\n private _tick() {\r\n const hitData = PhysicsVortexEvent._HitData;\r\n if (this._physicsEngine.getPluginVersion() === 1) {\r\n const impostors = (<PhysicsEngineV1>this._physicsEngine).getImpostors();\r\n for (const impostor of impostors) {\r\n if (!this._getImpostorHitData(impostor, hitData)) {\r\n return;\r\n }\r\n\r\n impostor.applyForce(hitData.force, hitData.contactPoint);\r\n }\r\n } else {\r\n const bodies = (<PhysicsEngineV2>this._physicsEngine).getBodies();\r\n for (const body of bodies) {\r\n body.iterateOverAllInstances((body: PhysicsBody, instanceIndex?: number) => {\r\n if (!this._getBodyHitData(body, hitData, instanceIndex)) {\r\n return;\r\n }\r\n\r\n body.applyForce(hitData.force, hitData.contactPoint, hitData.instanceIndex);\r\n });\r\n }\r\n }\r\n }\r\n\r\n /*** Helpers ***/\r\n\r\n private _prepareCylinder(): void {\r\n if (!this._cylinder) {\r\n this._cylinder = CreateCylinder(\r\n \"vortexEventCylinder\",\r\n {\r\n height: this._options.height,\r\n diameter: this._options.radius * 2,\r\n },\r\n this._scene\r\n );\r\n this._cylinder.isVisible = false;\r\n }\r\n }\r\n\r\n private _intersectsWithCylinder(mesh: AbstractMesh): boolean {\r\n this._cylinder.position = this._cylinderPosition;\r\n\r\n return this._cylinder.intersectsMesh(mesh, true);\r\n }\r\n}\r\n\r\n/**\r\n * Options fot the radial explosion event\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class\r\n */\r\nexport class PhysicsRadialExplosionEventOptions {\r\n /**\r\n * The radius of the sphere for the radial explosion.\r\n */\r\n radius: number = 5;\r\n\r\n /**\r\n * The strength of the explosion.\r\n */\r\n strength: number = 10;\r\n\r\n /**\r\n * The strength of the force in correspondence to the distance of the affected object\r\n */\r\n falloff: PhysicsRadialImpulseFalloff = PhysicsRadialImpulseFalloff.Constant;\r\n\r\n /**\r\n * Sphere options for the radial explosion.\r\n */\r\n sphere: { segments: number; diameter: number } = { segments: 32, diameter: 1 };\r\n\r\n /**\r\n * Sphere options for the radial explosion.\r\n */\r\n affectedImpostorsCallback: (affectedImpostorsWithData: Array<PhysicsAffectedImpostorWithData>) => void;\r\n\r\n /**\r\n * Sphere options for the radial explosion.\r\n */\r\n affectedBodiesCallback: (affectedBodiesWithData: Array<PhysicsAffectedBodyWithData>) => void;\r\n}\r\n\r\n/**\r\n * Options fot the updraft event\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class\r\n */\r\nexport class PhysicsUpdraftEventOptions {\r\n /**\r\n * The radius of the cylinder for the vortex\r\n */\r\n radius: number = 5;\r\n\r\n /**\r\n * The strength of the updraft.\r\n */\r\n strength: number = 10;\r\n\r\n /**\r\n * The height of the cylinder for the updraft.\r\n */\r\n height: number = 10;\r\n\r\n /**\r\n * The mode for the updraft.\r\n */\r\n updraftMode: PhysicsUpdraftMode = PhysicsUpdraftMode.Center;\r\n}\r\n\r\n/**\r\n * Options fot the vortex event\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class\r\n */\r\nexport class PhysicsVortexEventOptions {\r\n /**\r\n * The radius of the cylinder for the vortex\r\n */\r\n radius: number = 5;\r\n\r\n /**\r\n * The strength of the vortex.\r\n */\r\n strength: number = 10;\r\n\r\n /**\r\n * The height of the cylinder for the vortex.\r\n */\r\n height: number = 10;\r\n\r\n /**\r\n * At which distance, relative to the radius the centripetal forces should kick in? Range: 0-1\r\n */\r\n centripetalForceThreshold: number = 0.7;\r\n\r\n /**\r\n * This multiplier determines with how much force the objects will be pushed sideways/around the vortex, when below the threshold.\r\n */\r\n centripetalForceMultiplier: number = 5;\r\n\r\n /**\r\n * This multiplier determines with how much force the objects will be pushed sideways/around the vortex, when above the threshold.\r\n */\r\n centrifugalForceMultiplier: number = 0.5;\r\n\r\n /**\r\n * This multiplier determines with how much force the objects will be pushed upwards, when in the vortex.\r\n */\r\n updraftForceMultiplier: number = 0.02;\r\n}\r\n\r\n/**\r\n * The strength of the force in correspondence to the distance of the affected object\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class\r\n */\r\nexport const enum PhysicsRadialImpulseFalloff {\r\n /** Defines that impulse is constant in strength across it's whole radius */\r\n Constant,\r\n /** Defines that impulse gets weaker if it's further from the origin */\r\n Linear,\r\n}\r\n\r\n/**\r\n * The strength of the force in correspondence to the distance of the affected object\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class\r\n */\r\nexport const enum PhysicsUpdraftMode {\r\n /** Defines that the upstream forces will pull towards the top center of the cylinder */\r\n Center,\r\n /** Defines that once a impostor is inside the cylinder, it will shoot out perpendicular from the ground of the cylinder */\r\n Perpendicular,\r\n}\r\n\r\n/**\r\n * Interface for a physics hit data\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport interface PhysicsHitData {\r\n /**\r\n * The force applied at the contact point\r\n */\r\n force: Vector3;\r\n /**\r\n * The contact point\r\n */\r\n contactPoint: Vector3;\r\n /**\r\n * The distance from the origin to the contact point\r\n */\r\n distanceFromOrigin: number;\r\n /**\r\n * For an instanced physics body (mesh with thin instances), the index of the thin instance the hit applies to\r\n */\r\n instanceIndex?: number;\r\n}\r\n\r\n/**\r\n * Interface for radial explosion event data\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport interface PhysicsRadialExplosionEventData {\r\n /**\r\n * A sphere used for the radial explosion event\r\n */\r\n sphere: Mesh;\r\n}\r\n\r\n/**\r\n * Interface for gravitational field event data\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport interface PhysicsGravitationalFieldEventData {\r\n /**\r\n * A sphere mesh used for the gravitational field event\r\n */\r\n sphere: Mesh;\r\n}\r\n\r\n/**\r\n * Interface for updraft event data\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport interface PhysicsUpdraftEventData {\r\n /**\r\n * A cylinder used for the updraft event\r\n */\r\n cylinder?: Mesh;\r\n}\r\n\r\n/**\r\n * Interface for vortex event data\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport interface PhysicsVortexEventData {\r\n /**\r\n * A cylinder used for the vortex event\r\n */\r\n cylinder: Mesh;\r\n}\r\n\r\n/**\r\n * Interface for an affected physics impostor\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport interface PhysicsAffectedImpostorWithData {\r\n /**\r\n * The impostor affected by the effect\r\n */\r\n impostor: PhysicsImpostor;\r\n\r\n /**\r\n * The data about the hit/force from the explosion\r\n */\r\n hitData: PhysicsHitData;\r\n}\r\n\r\n/**\r\n * Interface for an affected physics body\r\n * @see\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport interface PhysicsAffectedBodyWithData {\r\n /**\r\n * The impostor affected by the effect\r\n */\r\n body: PhysicsBody;\r\n\r\n /**\r\n * The data about the hit/force from the explosion\r\n */\r\n hitData: PhysicsHitData;\r\n}\r\n"]}
1
+ {"version":3,"file":"physicsHelper.js","sourceRoot":"","sources":["../../../../dev/core/src/Physics/physicsHelper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAG3D,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AASrC,MAAM,WAAW;IACb;;;OAGG;IACH,MAAM,CAAC,oBAAoB,CAAC,IAAkB,EAAE,MAAe,EAAE,SAAkB,EAAE,MAAe,EAAE,aAAsB;QACxH,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC,gBAAgB,EAAE,CAAC;QAClD,MAAM,aAAa,GAAG,MAAM,EAAE,gBAAgB,EAAE,CAAC;QACjD,IAAI,aAAa,KAAK,CAAC,EAAE,CAAC;YACtB,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;YACvC,MAAM,GAAG,GAAG,GAAG,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;YACr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A3B,2BAA2B,QAK5C;AAED;;;GAGG;AACH,MAAM,CAAN,IAAkB,kBAKjB;AALD,WAAkB,kBAAkB;IAChC,wFAAwF;IACxF,+DAAM,CAAA;IACN,2HAA2H;IAC3H,6EAAa,CAAA;AACjB,CAAC,EALiB,kBAAkB,KAAlB,kBAAkB,QAKnC","sourcesContent":["import type { Nullable } from \"../types\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport { TmpVectors, Vector3 } from \"../Maths/math.vector\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport type { Mesh } from \"../Meshes/mesh\";\r\nimport { CreateSphere } from \"../Meshes/Builders/sphereBuilder\";\r\nimport { CreateCylinder } from \"../Meshes/Builders/cylinderBuilder\";\r\nimport { Ray } from \"../Culling/ray\";\r\nimport type { Scene } from \"../scene\";\r\nimport type { PhysicsEngine as PhysicsEngineV1 } from \"./physicsEngine\";\r\nimport type { PhysicsEngine as PhysicsEngineV2 } from \"./v2/physicsEngine\";\r\nimport type { IPhysicsEngine } from \"./IPhysicsEngine\";\r\nimport type { PhysicsImpostor } from \"./v1/physicsImpostor\";\r\nimport type { PhysicsBody } from \"./v2/physicsBody\";\r\nimport { PhysicsMotionType } from \"./v2/IPhysicsEnginePlugin\";\r\n\r\nclass HelperTools {\r\n /*\r\n * Gets the hit contact point between a mesh and a ray. The method varies between\r\n * the different plugin versions; V1 uses a mesh intersection, V2 uses the physics body instance/object center (to avoid a raycast and improve perf).\r\n */\r\n static GetContactPointToRef(mesh: AbstractMesh, origin: Vector3, direction: Vector3, result: Vector3, instanceIndex?: number): boolean {\r\n const engine = mesh.getScene().getPhysicsEngine();\r\n const pluginVersion = engine?.getPluginVersion();\r\n if (pluginVersion === 1) {\r\n const ray = new Ray(origin, direction);\r\n const hit = ray.intersectsMesh(mesh);\r\n if (hit.hit && hit.pickedPoint) {\r\n result.copyFrom(hit.pickedPoint);\r\n return true;\r\n }\r\n } else if (pluginVersion === 2) {\r\n mesh.physicsBody!.getObjectCenterWorldToRef(result, instanceIndex);\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n /**\r\n * Checks if a body will be affected by forces\r\n * @param body the body to check\r\n * @param instanceIndex for instanced bodies, the index of the instance to check\r\n * @returns\r\n */\r\n static HasAppliedForces(body: PhysicsBody, instanceIndex?: number) {\r\n return (\r\n body.getMotionType(instanceIndex) === PhysicsMotionType.STATIC ||\r\n (body.getMassProperties(instanceIndex)?.mass ?? 0) === 0 ||\r\n (body.transformNode as Mesh)?.getTotalVertices() === 0\r\n );\r\n }\r\n\r\n /**\r\n * Checks if a point is inside a cylinder\r\n * @param point point to check\r\n * @param origin cylinder origin on the bottom\r\n * @param radius cylinder radius\r\n * @param height cylinder height\r\n * @returns\r\n */\r\n static IsInsideCylinder(point: Vector3, origin: Vector3, radius: number, height: number): boolean {\r\n const distance = TmpVectors.Vector3[0];\r\n point.subtractToRef(origin, distance);\r\n return Math.abs(distance.x) <= radius && Math.abs(distance.z) <= radius && distance.y >= 0 && distance.y <= height;\r\n }\r\n}\r\n\r\n/**\r\n * A helper for physics simulations\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class\r\n */\r\nexport class PhysicsHelper {\r\n private _scene: Scene;\r\n private _physicsEngine: Nullable<IPhysicsEngine>;\r\n private _hitData: PhysicsHitData = { force: new Vector3(), contactPoint: new Vector3(), distanceFromOrigin: 0 };\r\n\r\n /**\r\n * Initializes the Physics helper\r\n * @param scene Babylon.js scene\r\n */\r\n constructor(scene: Scene) {\r\n this._scene = scene;\r\n this._physicsEngine = this._scene.getPhysicsEngine();\r\n\r\n if (!this._physicsEngine) {\r\n Logger.Warn(\"Physics engine not enabled. Please enable the physics before you can use the methods.\");\r\n return;\r\n }\r\n }\r\n\r\n /**\r\n * Applies a radial explosion impulse\r\n * @param origin the origin of the explosion\r\n * @param radiusOrEventOptions the radius or the options of radial explosion\r\n * @param strength the explosion strength\r\n * @param falloff possible options: Constant & Linear. Defaults to Constant\r\n * @returns A physics radial explosion event, or null\r\n */\r\n public applyRadialExplosionImpulse(\r\n origin: Vector3,\r\n radiusOrEventOptions: number | PhysicsRadialExplosionEventOptions,\r\n strength?: number,\r\n falloff?: PhysicsRadialImpulseFalloff\r\n ): Nullable<PhysicsRadialExplosionEvent> {\r\n if (!this._physicsEngine) {\r\n Logger.Warn(\"Physics engine not enabled. Please enable the physics before you call this method.\");\r\n return null;\r\n }\r\n\r\n if (this._physicsEngine.getPluginVersion() === 1 && (<PhysicsEngineV1>this._physicsEngine).getImpostors().length === 0) {\r\n return null;\r\n }\r\n\r\n if (this._physicsEngine.getPluginVersion() === 2 && (<PhysicsEngineV2>this._physicsEngine).getBodies().length === 0) {\r\n return null;\r\n }\r\n\r\n let useCallback = false;\r\n if (typeof radiusOrEventOptions === \"number\") {\r\n const r = radiusOrEventOptions;\r\n radiusOrEventOptions = new PhysicsRadialExplosionEventOptions();\r\n radiusOrEventOptions.radius = r;\r\n radiusOrEventOptions.strength = strength ?? radiusOrEventOptions.strength;\r\n radiusOrEventOptions.falloff = falloff ?? radiusOrEventOptions.falloff;\r\n } else {\r\n useCallback = !!(radiusOrEventOptions.affectedImpostorsCallback || radiusOrEventOptions.affectedBodiesCallback);\r\n }\r\n\r\n const event = new PhysicsRadialExplosionEvent(this._scene, radiusOrEventOptions);\r\n\r\n const hitData = this._hitData;\r\n if (this._physicsEngine.getPluginVersion() === 1) {\r\n const affectedImpostorsWithData = Array<PhysicsAffectedImpostorWithData>();\r\n const impostors = (<PhysicsEngineV1>this._physicsEngine).getImpostors();\r\n for (const impostor of impostors) {\r\n if (!event.getImpostorHitData(impostor, origin, hitData)) {\r\n continue;\r\n }\r\n\r\n impostor.applyImpulse(hitData.force, hitData.contactPoint);\r\n\r\n if (useCallback) {\r\n affectedImpostorsWithData.push({\r\n impostor: impostor,\r\n hitData: this._copyPhysicsHitData(hitData),\r\n });\r\n }\r\n }\r\n\r\n event.triggerAffectedImpostorsCallback(affectedImpostorsWithData);\r\n } else {\r\n this._applicationForBodies(event, origin, hitData, useCallback, (body: PhysicsBody, hitData: PhysicsHitData) => {\r\n body.applyImpulse(hitData.force, hitData.contactPoint, hitData.instanceIndex);\r\n });\r\n }\r\n\r\n event.dispose(false);\r\n\r\n return event;\r\n }\r\n\r\n /**\r\n * Applies a radial explosion force\r\n * @param origin the origin of the explosion\r\n * @param radiusOrEventOptions the radius or the options of radial explosion\r\n * @param strength the explosion strength\r\n * @param falloff possible options: Constant & Linear. Defaults to Constant\r\n * @returns A physics radial explosion event, or null\r\n */\r\n public applyRadialExplosionForce(\r\n origin: Vector3,\r\n radiusOrEventOptions: number | PhysicsRadialExplosionEventOptions,\r\n strength?: number,\r\n falloff?: PhysicsRadialImpulseFalloff\r\n ): Nullable<PhysicsRadialExplosionEvent> {\r\n if (!this._physicsEngine) {\r\n Logger.Warn(\"Physics engine not enabled. Please enable the physics before you call the PhysicsHelper.\");\r\n return null;\r\n }\r\n\r\n if (this._physicsEngine.getPluginVersion() === 1 && (<PhysicsEngineV1>this._physicsEngine).getImpostors().length === 0) {\r\n return null;\r\n }\r\n\r\n if (this._physicsEngine.getPluginVersion() === 2 && (<PhysicsEngineV2>this._physicsEngine).getBodies().length === 0) {\r\n return null;\r\n }\r\n\r\n let useCallback = false;\r\n if (typeof radiusOrEventOptions === \"number\") {\r\n const r = radiusOrEventOptions;\r\n radiusOrEventOptions = new PhysicsRadialExplosionEventOptions();\r\n radiusOrEventOptions.radius = r;\r\n radiusOrEventOptions.strength = strength ?? radiusOrEventOptions.strength;\r\n radiusOrEventOptions.falloff = falloff ?? radiusOrEventOptions.falloff;\r\n } else {\r\n useCallback = !!(radiusOrEventOptions.affectedImpostorsCallback || radiusOrEventOptions.affectedBodiesCallback);\r\n }\r\n\r\n const event = new PhysicsRadialExplosionEvent(this._scene, radiusOrEventOptions);\r\n\r\n const hitData = this._hitData;\r\n if (this._physicsEngine.getPluginVersion() === 1) {\r\n const affectedImpostorsWithData = Array<PhysicsAffectedImpostorWithData>();\r\n const impostors = (<PhysicsEngineV1>this._physicsEngine).getImpostors();\r\n for (const impostor of impostors) {\r\n if (!event.getImpostorHitData(impostor, origin, hitData)) {\r\n continue;\r\n }\r\n\r\n impostor.applyForce(hitData.force, hitData.contactPoint);\r\n\r\n if (useCallback) {\r\n affectedImpostorsWithData.push({\r\n impostor: impostor,\r\n hitData: this._copyPhysicsHitData(hitData),\r\n });\r\n }\r\n }\r\n\r\n event.triggerAffectedImpostorsCallback(affectedImpostorsWithData);\r\n } else {\r\n this._applicationForBodies(event, origin, hitData, useCallback, (body: PhysicsBody, hitData: PhysicsHitData) => {\r\n body.applyForce(hitData.force, hitData.contactPoint, hitData.instanceIndex);\r\n });\r\n }\r\n\r\n event.dispose(false);\r\n\r\n return event;\r\n }\r\n\r\n private _applicationForBodies(\r\n event: PhysicsRadialExplosionEvent,\r\n origin: Vector3,\r\n hitData: PhysicsHitData,\r\n useCallback: boolean,\r\n fnApplication: (body: PhysicsBody, hitData: PhysicsHitData, instanceIndex?: number) => void\r\n ) {\r\n const affectedBodiesWithData = Array<PhysicsAffectedBodyWithData>();\r\n const bodies = (<PhysicsEngineV2>this._physicsEngine).getBodies();\r\n for (const body of bodies) {\r\n body.iterateOverAllInstances((body, instanceIndex) => {\r\n if (!event.getBodyHitData(body, origin, hitData, instanceIndex)) {\r\n return;\r\n }\r\n fnApplication(body, hitData);\r\n\r\n if (useCallback) {\r\n affectedBodiesWithData.push({\r\n body: body,\r\n hitData: this._copyPhysicsHitData(hitData),\r\n });\r\n }\r\n });\r\n }\r\n\r\n event.triggerAffectedBodiesCallback(affectedBodiesWithData);\r\n }\r\n\r\n /**\r\n * Creates a gravitational field\r\n * @param origin the origin of the gravitational field\r\n * @param radiusOrEventOptions the radius or the options of radial gravitational field\r\n * @param strength the gravitational field strength\r\n * @param falloff possible options: Constant & Linear. Defaults to Constant\r\n * @returns A physics gravitational field event, or null\r\n */\r\n public gravitationalField(\r\n origin: Vector3,\r\n radiusOrEventOptions: number | PhysicsRadialExplosionEventOptions,\r\n strength?: number,\r\n falloff?: PhysicsRadialImpulseFalloff\r\n ): Nullable<PhysicsGravitationalFieldEvent> {\r\n if (!this._physicsEngine) {\r\n Logger.Warn(\"Physics engine not enabled. Please enable the physics before you call the PhysicsHelper.\");\r\n return null;\r\n }\r\n\r\n if (this._physicsEngine.getPluginVersion() === 1 && (<PhysicsEngineV1>this._physicsEngine).getImpostors().length === 0) {\r\n return null;\r\n }\r\n\r\n if (this._physicsEngine.getPluginVersion() === 2 && (<PhysicsEngineV2>this._physicsEngine).getBodies().length === 0) {\r\n return null;\r\n }\r\n\r\n if (typeof radiusOrEventOptions === \"number\") {\r\n const r = radiusOrEventOptions;\r\n radiusOrEventOptions = new PhysicsRadialExplosionEventOptions();\r\n radiusOrEventOptions.radius = r;\r\n radiusOrEventOptions.strength = strength ?? radiusOrEventOptions.strength;\r\n radiusOrEventOptions.falloff = falloff ?? radiusOrEventOptions.falloff;\r\n }\r\n\r\n const event = new PhysicsGravitationalFieldEvent(this, this._scene, origin, radiusOrEventOptions);\r\n\r\n event.dispose(false);\r\n\r\n return event;\r\n }\r\n\r\n /**\r\n * Creates a physics updraft event\r\n * @param origin the origin of the updraft\r\n * @param radiusOrEventOptions the radius or the options of the updraft\r\n * @param strength the strength of the updraft\r\n * @param height the height of the updraft\r\n * @param updraftMode possible options: Center & Perpendicular. Defaults to Center\r\n * @returns A physics updraft event, or null\r\n */\r\n public updraft(\r\n origin: Vector3,\r\n radiusOrEventOptions: number | PhysicsUpdraftEventOptions,\r\n strength?: number,\r\n height?: number,\r\n updraftMode?: PhysicsUpdraftMode\r\n ): Nullable<PhysicsUpdraftEvent> {\r\n if (!this._physicsEngine) {\r\n Logger.Warn(\"Physics engine not enabled. Please enable the physics before you call the PhysicsHelper.\");\r\n return null;\r\n }\r\n\r\n if (this._physicsEngine.getPluginVersion() === 1 && (<PhysicsEngineV1>this._physicsEngine).getImpostors().length === 0) {\r\n return null;\r\n }\r\n\r\n if (this._physicsEngine.getPluginVersion() === 2 && (<PhysicsEngineV2>this._physicsEngine).getBodies().length === 0) {\r\n return null;\r\n }\r\n\r\n if (typeof radiusOrEventOptions === \"number\") {\r\n const r = radiusOrEventOptions;\r\n radiusOrEventOptions = new PhysicsUpdraftEventOptions();\r\n radiusOrEventOptions.radius = r;\r\n radiusOrEventOptions.strength = strength ?? radiusOrEventOptions.strength;\r\n radiusOrEventOptions.height = height ?? radiusOrEventOptions.height;\r\n radiusOrEventOptions.updraftMode = updraftMode ?? radiusOrEventOptions.updraftMode;\r\n }\r\n\r\n const event = new PhysicsUpdraftEvent(this._scene, origin, radiusOrEventOptions);\r\n\r\n event.dispose(false);\r\n\r\n return event;\r\n }\r\n\r\n /**\r\n * Creates a physics vortex event\r\n * @param origin the of the vortex\r\n * @param radiusOrEventOptions the radius or the options of the vortex\r\n * @param strength the strength of the vortex\r\n * @param height the height of the vortex\r\n * @returns a Physics vortex event, or null\r\n * A physics vortex event or null\r\n */\r\n public vortex(origin: Vector3, radiusOrEventOptions: number | PhysicsVortexEventOptions, strength?: number, height?: number): Nullable<PhysicsVortexEvent> {\r\n if (!this._physicsEngine) {\r\n Logger.Warn(\"Physics engine not enabled. Please enable the physics before you call the PhysicsHelper.\");\r\n return null;\r\n }\r\n\r\n if (this._physicsEngine.getPluginVersion() === 1 && (<PhysicsEngineV1>this._physicsEngine).getImpostors().length === 0) {\r\n return null;\r\n }\r\n\r\n if (this._physicsEngine.getPluginVersion() === 2 && (<PhysicsEngineV2>this._physicsEngine).getBodies().length === 0) {\r\n return null;\r\n }\r\n\r\n if (typeof radiusOrEventOptions === \"number\") {\r\n const r = radiusOrEventOptions;\r\n radiusOrEventOptions = new PhysicsVortexEventOptions();\r\n radiusOrEventOptions.radius = r;\r\n radiusOrEventOptions.strength = strength ?? radiusOrEventOptions.strength;\r\n radiusOrEventOptions.height = height ?? radiusOrEventOptions.height;\r\n }\r\n\r\n const event = new PhysicsVortexEvent(this._scene, origin, radiusOrEventOptions);\r\n\r\n event.dispose(false);\r\n\r\n return event;\r\n }\r\n\r\n private _copyPhysicsHitData(data: PhysicsHitData): PhysicsHitData {\r\n return { force: data.force.clone(), contactPoint: data.contactPoint.clone(), distanceFromOrigin: data.distanceFromOrigin, instanceIndex: data.instanceIndex };\r\n }\r\n}\r\n\r\n/**\r\n * Represents a physics radial explosion event\r\n */\r\nclass PhysicsRadialExplosionEvent {\r\n private _sphere: Mesh; // create a sphere, so we can get the intersecting meshes inside\r\n private _dataFetched: boolean = false; // check if the data has been fetched. If not, do cleanup\r\n\r\n /**\r\n * Initializes a radial explosion event\r\n * @param _scene BabylonJS scene\r\n * @param _options The options for the vortex event\r\n */\r\n constructor(\r\n private _scene: Scene,\r\n private _options: PhysicsRadialExplosionEventOptions\r\n ) {\r\n this._options = { ...new PhysicsRadialExplosionEventOptions(), ...this._options };\r\n }\r\n\r\n /**\r\n * Returns the data related to the radial explosion event (sphere).\r\n * @returns The radial explosion event data\r\n */\r\n public getData(): PhysicsRadialExplosionEventData {\r\n this._dataFetched = true;\r\n\r\n return {\r\n sphere: this._sphere,\r\n };\r\n }\r\n\r\n private _getHitData(mesh: AbstractMesh, center: Vector3, origin: Vector3, data: PhysicsHitData): boolean {\r\n const direction = TmpVectors.Vector3[0];\r\n direction.copyFrom(center).subtractInPlace(origin);\r\n\r\n const contactPoint = TmpVectors.Vector3[1];\r\n const hasContactPoint = HelperTools.GetContactPointToRef(mesh, origin, direction, contactPoint, data.instanceIndex);\r\n\r\n if (!hasContactPoint) {\r\n return false;\r\n }\r\n\r\n const distanceFromOrigin = Vector3.Distance(origin, contactPoint);\r\n if (distanceFromOrigin > this._options.radius) {\r\n return false;\r\n }\r\n\r\n const multiplier =\r\n this._options.falloff === PhysicsRadialImpulseFalloff.Constant ? this._options.strength : this._options.strength * (1 - distanceFromOrigin / this._options.radius);\r\n\r\n // Direction x multiplier equals force\r\n direction.scaleInPlace(multiplier);\r\n\r\n data.force.copyFrom(direction);\r\n data.contactPoint.copyFrom(contactPoint);\r\n data.distanceFromOrigin = distanceFromOrigin;\r\n return true;\r\n }\r\n\r\n /**\r\n * Returns the force and contact point of the body or false, if the body is not affected by the force/impulse.\r\n * @param body A physics body where the transform node is an AbstractMesh\r\n * @param origin the origin of the explosion\r\n * @param data the data of the hit\r\n * @param instanceIndex the instance index of the body\r\n * @returns if there was a hit\r\n */\r\n public getBodyHitData(body: PhysicsBody, origin: Vector3, data: PhysicsHitData, instanceIndex?: number): boolean {\r\n // No force will be applied in these cases, so we skip calculation\r\n if (HelperTools.HasAppliedForces(body, instanceIndex)) {\r\n return false;\r\n }\r\n\r\n const mesh = body.transformNode as AbstractMesh;\r\n const bodyObjectCenter = body.getObjectCenterWorld(instanceIndex);\r\n data.instanceIndex = instanceIndex;\r\n return this._getHitData(mesh, bodyObjectCenter, origin, data);\r\n }\r\n /**\r\n * Returns the force and contact point of the impostor or false, if the impostor is not affected by the force/impulse.\r\n * @param impostor A physics imposter\r\n * @param origin the origin of the explosion\r\n * @param data the data of the hit\r\n * @returns A physics force and contact point, or null\r\n */\r\n public getImpostorHitData(impostor: PhysicsImpostor, origin: Vector3, data: PhysicsHitData): boolean {\r\n if (impostor.mass === 0) {\r\n return false;\r\n }\r\n\r\n if (impostor.object.getClassName() !== \"Mesh\" && impostor.object.getClassName() !== \"InstancedMesh\") {\r\n return false;\r\n }\r\n\r\n const mesh = impostor.object as AbstractMesh;\r\n if (!this._intersectsWithSphere(mesh, origin, this._options.radius)) {\r\n return false;\r\n }\r\n\r\n const impostorObjectCenter = impostor.getObjectCenter();\r\n\r\n this._getHitData(mesh, impostorObjectCenter, origin, data);\r\n return true;\r\n }\r\n\r\n /**\r\n * Triggers affected impostors callbacks\r\n * @param affectedImpostorsWithData defines the list of affected impostors (including associated data)\r\n */\r\n public triggerAffectedImpostorsCallback(affectedImpostorsWithData: Array<PhysicsAffectedImpostorWithData>) {\r\n if (this._options.affectedImpostorsCallback) {\r\n this._options.affectedImpostorsCallback(affectedImpostorsWithData);\r\n }\r\n }\r\n\r\n /**\r\n * Triggers affected bodies callbacks\r\n * @param affectedBodiesWithData defines the list of affected bodies (including associated data)\r\n */\r\n public triggerAffectedBodiesCallback(affectedBodiesWithData: Array<PhysicsAffectedBodyWithData>) {\r\n if (this._options.affectedBodiesCallback) {\r\n this._options.affectedBodiesCallback(affectedBodiesWithData);\r\n }\r\n }\r\n /**\r\n * Disposes the sphere.\r\n * @param force Specifies if the sphere should be disposed by force\r\n */\r\n public dispose(force: boolean = true) {\r\n if (this._sphere) {\r\n if (force) {\r\n this._sphere.dispose();\r\n } else {\r\n setTimeout(() => {\r\n if (!this._dataFetched) {\r\n this._sphere.dispose();\r\n }\r\n }, 0);\r\n }\r\n }\r\n }\r\n\r\n /*** Helpers ***/\r\n\r\n private _prepareSphere(): void {\r\n if (!this._sphere) {\r\n this._sphere = CreateSphere(\"radialExplosionEventSphere\", this._options.sphere, this._scene);\r\n this._sphere.isVisible = false;\r\n }\r\n }\r\n\r\n private _intersectsWithSphere(mesh: AbstractMesh, origin: Vector3, radius: number): boolean {\r\n this._prepareSphere();\r\n\r\n this._sphere.position = origin;\r\n this._sphere.scaling.setAll(radius * 2);\r\n this._sphere._updateBoundingInfo();\r\n this._sphere.computeWorldMatrix(true);\r\n\r\n return this._sphere.intersectsMesh(mesh, true);\r\n }\r\n}\r\n\r\n/**\r\n * Represents a gravitational field event\r\n */\r\nclass PhysicsGravitationalFieldEvent {\r\n private _tickCallback: any;\r\n private _sphere: Mesh;\r\n private _dataFetched: boolean = false; // check if the has been fetched the data. If not, do cleanup\r\n\r\n /**\r\n * Initializes the physics gravitational field event\r\n * @param _physicsHelper A physics helper\r\n * @param _scene BabylonJS scene\r\n * @param _origin The origin position of the gravitational field event\r\n * @param _options The options for the vortex event\r\n */\r\n constructor(\r\n private _physicsHelper: PhysicsHelper,\r\n private _scene: Scene,\r\n private _origin: Vector3,\r\n private _options: PhysicsRadialExplosionEventOptions\r\n ) {\r\n this._options = { ...new PhysicsRadialExplosionEventOptions(), ...this._options };\r\n\r\n this._tickCallback = () => this._tick();\r\n\r\n this._options.strength = this._options.strength * -1;\r\n }\r\n\r\n /**\r\n * Returns the data related to the gravitational field event (sphere).\r\n * @returns A gravitational field event\r\n */\r\n public getData(): PhysicsGravitationalFieldEventData {\r\n this._dataFetched = true;\r\n\r\n return {\r\n sphere: this._sphere,\r\n };\r\n }\r\n\r\n /**\r\n * Enables the gravitational field.\r\n */\r\n public enable() {\r\n this._tickCallback.call(this);\r\n this._scene.registerBeforeRender(this._tickCallback);\r\n }\r\n\r\n /**\r\n * Disables the gravitational field.\r\n */\r\n public disable() {\r\n this._scene.unregisterBeforeRender(this._tickCallback);\r\n }\r\n\r\n /**\r\n * Disposes the sphere.\r\n * @param force The force to dispose from the gravitational field event\r\n */\r\n public dispose(force: boolean = true) {\r\n if (!this._sphere) {\r\n return;\r\n }\r\n if (force) {\r\n this._sphere.dispose();\r\n } else {\r\n setTimeout(() => {\r\n if (!this._dataFetched) {\r\n this._sphere.dispose();\r\n }\r\n }, 0);\r\n }\r\n }\r\n\r\n private _tick() {\r\n // Since the params won't change, we fetch the event only once\r\n if (this._sphere) {\r\n this._physicsHelper.applyRadialExplosionForce(this._origin, this._options);\r\n } else {\r\n const radialExplosionEvent = this._physicsHelper.applyRadialExplosionForce(this._origin, this._options);\r\n if (radialExplosionEvent) {\r\n this._sphere = radialExplosionEvent.getData().sphere?.clone(\"radialExplosionEventSphereClone\");\r\n }\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Represents a physics updraft event\r\n */\r\nclass PhysicsUpdraftEvent {\r\n private _physicsEngine: PhysicsEngineV1 | PhysicsEngineV2;\r\n private _originTop: Vector3 = Vector3.Zero(); // the most upper part of the cylinder\r\n private _originDirection: Vector3 = Vector3.Zero(); // used if the updraftMode is perpendicular\r\n private _tickCallback: any;\r\n private _cylinder: Mesh | undefined;\r\n private _cylinderPosition: Vector3 = Vector3.Zero(); // to keep the cylinders position, because normally the origin is in the center and not on the bottom\r\n private _dataFetched: boolean = false; // check if the has been fetched the data. If not, do cleanup\r\n private static _HitData: PhysicsHitData = { force: new Vector3(), contactPoint: new Vector3(), distanceFromOrigin: 0 };\r\n /**\r\n * Initializes the physics updraft event\r\n * @param _scene BabylonJS scene\r\n * @param _origin The origin position of the updraft\r\n * @param _options The options for the updraft event\r\n */\r\n constructor(\r\n private _scene: Scene,\r\n private _origin: Vector3,\r\n private _options: PhysicsUpdraftEventOptions\r\n ) {\r\n this._physicsEngine = this._scene.getPhysicsEngine() as PhysicsEngineV1 | PhysicsEngineV2;\r\n this._options = { ...new PhysicsUpdraftEventOptions(), ...this._options };\r\n\r\n this._origin.addToRef(new Vector3(0, this._options.height / 2, 0), this._cylinderPosition);\r\n this._origin.addToRef(new Vector3(0, this._options.height, 0), this._originTop);\r\n\r\n if (this._options.updraftMode === PhysicsUpdraftMode.Perpendicular) {\r\n this._originDirection = this._origin.subtract(this._originTop).normalize();\r\n }\r\n\r\n this._tickCallback = () => this._tick();\r\n\r\n if (this._physicsEngine.getPluginVersion() === 1) {\r\n this._prepareCylinder();\r\n }\r\n }\r\n\r\n /**\r\n * Returns the data related to the updraft event (cylinder).\r\n * @returns A physics updraft event\r\n */\r\n public getData(): PhysicsUpdraftEventData {\r\n this._dataFetched = true;\r\n\r\n return {\r\n cylinder: this._cylinder,\r\n };\r\n }\r\n\r\n /**\r\n * Enables the updraft.\r\n */\r\n public enable() {\r\n this._tickCallback.call(this);\r\n this._scene.registerBeforeRender(this._tickCallback);\r\n }\r\n\r\n /**\r\n * Disables the updraft.\r\n */\r\n public disable() {\r\n this._scene.unregisterBeforeRender(this._tickCallback);\r\n }\r\n\r\n /**\r\n * Disposes the cylinder.\r\n * @param force Specifies if the updraft should be disposed by force\r\n */\r\n public dispose(force: boolean = true) {\r\n if (!this._cylinder) {\r\n return;\r\n }\r\n if (force) {\r\n this._cylinder.dispose();\r\n this._cylinder = undefined;\r\n } else {\r\n setTimeout(() => {\r\n if (!this._dataFetched && this._cylinder) {\r\n this._cylinder.dispose();\r\n this._cylinder = undefined;\r\n }\r\n }, 0);\r\n }\r\n }\r\n\r\n private _getHitData(center: Vector3, data: PhysicsHitData): void {\r\n let direction: Vector3;\r\n if (this._options.updraftMode === PhysicsUpdraftMode.Perpendicular) {\r\n direction = this._originDirection;\r\n } else {\r\n direction = center.subtract(this._originTop);\r\n }\r\n\r\n const distanceFromOrigin = Vector3.Distance(this._origin, center);\r\n\r\n const multiplier = this._options.strength * -1;\r\n\r\n const force = direction.multiplyByFloats(multiplier, multiplier, multiplier);\r\n\r\n data.force.copyFrom(force);\r\n data.contactPoint.copyFrom(center);\r\n data.distanceFromOrigin = distanceFromOrigin;\r\n }\r\n\r\n private _getBodyHitData(body: PhysicsBody, data: PhysicsHitData, instanceIndex?: number): boolean {\r\n if (HelperTools.HasAppliedForces(body)) {\r\n return false;\r\n }\r\n\r\n const center = body.getObjectCenterWorld(instanceIndex);\r\n\r\n if (!HelperTools.IsInsideCylinder(center, this._origin, this._options.radius, this._options.height)) {\r\n return false;\r\n }\r\n\r\n data.instanceIndex = instanceIndex;\r\n this._getHitData(center, data);\r\n return true;\r\n }\r\n\r\n private _getImpostorHitData(impostor: PhysicsImpostor, data: PhysicsHitData): boolean {\r\n if (impostor.mass === 0) {\r\n return false;\r\n }\r\n\r\n const impostorObject = <AbstractMesh>impostor.object;\r\n if (!this._intersectsWithCylinder(impostorObject)) {\r\n return false;\r\n }\r\n\r\n const center = impostor.getObjectCenter();\r\n this._getHitData(center, data);\r\n return true;\r\n }\r\n\r\n private _tick() {\r\n const hitData = PhysicsUpdraftEvent._HitData;\r\n if (this._physicsEngine.getPluginVersion() === 1) {\r\n const impostors = (<PhysicsEngineV1>this._physicsEngine).getImpostors();\r\n for (const impostor of impostors) {\r\n if (!this._getImpostorHitData(impostor, hitData)) {\r\n continue;\r\n }\r\n\r\n impostor.applyForce(hitData.force, hitData.contactPoint);\r\n }\r\n } else {\r\n // V2\r\n const bodies = (<PhysicsEngineV2>this._physicsEngine).getBodies();\r\n for (const body of bodies) {\r\n body.iterateOverAllInstances((body, instanceIndex) => {\r\n if (!this._getBodyHitData(body, hitData, instanceIndex)) {\r\n return;\r\n }\r\n\r\n body.applyForce(hitData.force, hitData.contactPoint, hitData.instanceIndex);\r\n });\r\n }\r\n }\r\n }\r\n\r\n /*** Helpers ***/\r\n\r\n private _prepareCylinder(): void {\r\n if (!this._cylinder) {\r\n this._cylinder = CreateCylinder(\r\n \"updraftEventCylinder\",\r\n {\r\n height: this._options.height,\r\n diameter: this._options.radius * 2,\r\n },\r\n this._scene\r\n );\r\n this._cylinder.isVisible = false;\r\n }\r\n }\r\n\r\n private _intersectsWithCylinder(mesh: AbstractMesh): boolean {\r\n if (!this._cylinder) {\r\n return false;\r\n }\r\n this._cylinder.position = this._cylinderPosition;\r\n return this._cylinder.intersectsMesh(mesh, true);\r\n }\r\n}\r\n\r\n/**\r\n * Represents a physics vortex event\r\n */\r\nclass PhysicsVortexEvent {\r\n private _physicsEngine: PhysicsEngineV1 | PhysicsEngineV2;\r\n private _originTop: Vector3 = Vector3.Zero(); // the most upper part of the cylinder\r\n private _tickCallback: any;\r\n private _cylinder: Mesh;\r\n private _cylinderPosition: Vector3 = Vector3.Zero(); // to keep the cylinders position, because normally the origin is in the center and not on the bottom\r\n private _dataFetched: boolean = false; // check if the has been fetched the data. If not, do cleanup\r\n private static _OriginOnPlane: Vector3 = Vector3.Zero();\r\n private static _HitData: PhysicsHitData = { force: new Vector3(), contactPoint: new Vector3(), distanceFromOrigin: 0 };\r\n\r\n /**\r\n * Initializes the physics vortex event\r\n * @param _scene The BabylonJS scene\r\n * @param _origin The origin position of the vortex\r\n * @param _options The options for the vortex event\r\n */\r\n constructor(\r\n private _scene: Scene,\r\n private _origin: Vector3,\r\n private _options: PhysicsVortexEventOptions\r\n ) {\r\n this._physicsEngine = this._scene.getPhysicsEngine() as PhysicsEngineV1 | PhysicsEngineV2;\r\n this._options = { ...new PhysicsVortexEventOptions(), ...this._options };\r\n\r\n this._origin.addToRef(new Vector3(0, this._options.height / 2, 0), this._cylinderPosition);\r\n this._origin.addToRef(new Vector3(0, this._options.height, 0), this._originTop);\r\n\r\n this._tickCallback = () => this._tick();\r\n\r\n if (this._physicsEngine.getPluginVersion() === 1) {\r\n this._prepareCylinder();\r\n }\r\n }\r\n\r\n /**\r\n * Returns the data related to the vortex event (cylinder).\r\n * @returns The physics vortex event data\r\n */\r\n public getData(): PhysicsVortexEventData {\r\n this._dataFetched = true;\r\n\r\n return {\r\n cylinder: this._cylinder,\r\n };\r\n }\r\n\r\n /**\r\n * Enables the vortex.\r\n */\r\n public enable() {\r\n this._tickCallback.call(this);\r\n this._scene.registerBeforeRender(this._tickCallback);\r\n }\r\n\r\n /**\r\n * Disables the cortex.\r\n */\r\n public disable() {\r\n this._scene.unregisterBeforeRender(this._tickCallback);\r\n }\r\n\r\n /**\r\n * Disposes the sphere.\r\n * @param force\r\n */\r\n public dispose(force: boolean = true) {\r\n if (!this._cylinder) {\r\n return;\r\n }\r\n if (force) {\r\n this._cylinder.dispose();\r\n } else {\r\n setTimeout(() => {\r\n if (!this._dataFetched) {\r\n this._cylinder.dispose();\r\n }\r\n }, 0);\r\n }\r\n }\r\n\r\n private _getHitData(mesh: AbstractMesh, center: Vector3, data: PhysicsHitData): boolean {\r\n const originOnPlane = PhysicsVortexEvent._OriginOnPlane;\r\n originOnPlane.set(this._origin.x, center.y, this._origin.z); // the distance to the origin as if both objects were on a plane (Y-axis)\r\n const originToImpostorDirection = TmpVectors.Vector3[0];\r\n center.subtractToRef(originOnPlane, originToImpostorDirection);\r\n\r\n const contactPoint = TmpVectors.Vector3[1];\r\n const hasContactPoint = HelperTools.GetContactPointToRef(mesh, originOnPlane, originToImpostorDirection, contactPoint, data.instanceIndex);\r\n if (!hasContactPoint) {\r\n return false;\r\n }\r\n const distance = Vector3.Distance(contactPoint, originOnPlane);\r\n const absoluteDistanceFromOrigin = distance / this._options.radius;\r\n\r\n const directionToOrigin = TmpVectors.Vector3[2];\r\n contactPoint.normalizeToRef(directionToOrigin);\r\n if (absoluteDistanceFromOrigin > this._options.centripetalForceThreshold) {\r\n directionToOrigin.negateInPlace();\r\n }\r\n\r\n let forceX: number;\r\n let forceY: number;\r\n let forceZ: number;\r\n\r\n if (absoluteDistanceFromOrigin > this._options.centripetalForceThreshold) {\r\n forceX = directionToOrigin.x * this._options.centripetalForceMultiplier;\r\n forceY = directionToOrigin.y * this._options.updraftForceMultiplier;\r\n forceZ = directionToOrigin.z * this._options.centripetalForceMultiplier;\r\n } else {\r\n const perpendicularDirection = Vector3.Cross(originOnPlane, center).normalize();\r\n\r\n forceX = (perpendicularDirection.x + directionToOrigin.x) * this._options.centrifugalForceMultiplier;\r\n forceY = this._originTop.y * this._options.updraftForceMultiplier;\r\n forceZ = (perpendicularDirection.z + directionToOrigin.z) * this._options.centrifugalForceMultiplier;\r\n }\r\n\r\n const force = TmpVectors.Vector3[3];\r\n force.set(forceX, forceY, forceZ);\r\n force.scaleInPlace(this._options.strength);\r\n\r\n data.force.copyFrom(force);\r\n data.contactPoint.copyFrom(center);\r\n data.distanceFromOrigin = absoluteDistanceFromOrigin;\r\n return true;\r\n }\r\n\r\n private _getBodyHitData(body: PhysicsBody, data: PhysicsHitData, instanceIndex?: number): boolean {\r\n if (HelperTools.HasAppliedForces(body, instanceIndex)) {\r\n return false;\r\n }\r\n\r\n const bodyObject = body.transformNode as AbstractMesh;\r\n const bodyCenter = body.getObjectCenterWorld(instanceIndex);\r\n\r\n if (!HelperTools.IsInsideCylinder(bodyCenter, this._origin, this._options.radius, this._options.height)) {\r\n return false;\r\n }\r\n\r\n data.instanceIndex = instanceIndex;\r\n return this._getHitData(bodyObject, bodyCenter, data);\r\n }\r\n\r\n private _getImpostorHitData(impostor: PhysicsImpostor, data: PhysicsHitData): boolean {\r\n if (impostor.mass === 0) {\r\n return false;\r\n }\r\n\r\n if (impostor.object.getClassName() !== \"Mesh\" && impostor.object.getClassName() !== \"InstancedMesh\") {\r\n return false;\r\n }\r\n\r\n const impostorObject = impostor.object as AbstractMesh;\r\n if (!this._intersectsWithCylinder(impostorObject)) {\r\n return false;\r\n }\r\n\r\n const impostorObjectCenter = impostor.getObjectCenter();\r\n this._getHitData(impostorObject, impostorObjectCenter, data);\r\n return true;\r\n }\r\n\r\n private _tick() {\r\n const hitData = PhysicsVortexEvent._HitData;\r\n if (this._physicsEngine.getPluginVersion() === 1) {\r\n const impostors = (<PhysicsEngineV1>this._physicsEngine).getImpostors();\r\n for (const impostor of impostors) {\r\n if (!this._getImpostorHitData(impostor, hitData)) {\r\n continue;\r\n }\r\n\r\n impostor.applyForce(hitData.force, hitData.contactPoint);\r\n }\r\n } else {\r\n const bodies = (<PhysicsEngineV2>this._physicsEngine).getBodies();\r\n for (const body of bodies) {\r\n body.iterateOverAllInstances((body: PhysicsBody, instanceIndex?: number) => {\r\n if (!this._getBodyHitData(body, hitData, instanceIndex)) {\r\n return;\r\n }\r\n\r\n body.applyForce(hitData.force, hitData.contactPoint, hitData.instanceIndex);\r\n });\r\n }\r\n }\r\n }\r\n\r\n /*** Helpers ***/\r\n\r\n private _prepareCylinder(): void {\r\n if (!this._cylinder) {\r\n this._cylinder = CreateCylinder(\r\n \"vortexEventCylinder\",\r\n {\r\n height: this._options.height,\r\n diameter: this._options.radius * 2,\r\n },\r\n this._scene\r\n );\r\n this._cylinder.isVisible = false;\r\n }\r\n }\r\n\r\n private _intersectsWithCylinder(mesh: AbstractMesh): boolean {\r\n this._cylinder.position = this._cylinderPosition;\r\n\r\n return this._cylinder.intersectsMesh(mesh, true);\r\n }\r\n}\r\n\r\n/**\r\n * Options fot the radial explosion event\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class\r\n */\r\nexport class PhysicsRadialExplosionEventOptions {\r\n /**\r\n * The radius of the sphere for the radial explosion.\r\n */\r\n radius: number = 5;\r\n\r\n /**\r\n * The strength of the explosion.\r\n */\r\n strength: number = 10;\r\n\r\n /**\r\n * The strength of the force in correspondence to the distance of the affected object\r\n */\r\n falloff: PhysicsRadialImpulseFalloff = PhysicsRadialImpulseFalloff.Constant;\r\n\r\n /**\r\n * Sphere options for the radial explosion.\r\n */\r\n sphere: { segments: number; diameter: number } = { segments: 32, diameter: 1 };\r\n\r\n /**\r\n * Sphere options for the radial explosion.\r\n */\r\n affectedImpostorsCallback: (affectedImpostorsWithData: Array<PhysicsAffectedImpostorWithData>) => void;\r\n\r\n /**\r\n * Sphere options for the radial explosion.\r\n */\r\n affectedBodiesCallback: (affectedBodiesWithData: Array<PhysicsAffectedBodyWithData>) => void;\r\n}\r\n\r\n/**\r\n * Options fot the updraft event\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class\r\n */\r\nexport class PhysicsUpdraftEventOptions {\r\n /**\r\n * The radius of the cylinder for the vortex\r\n */\r\n radius: number = 5;\r\n\r\n /**\r\n * The strength of the updraft.\r\n */\r\n strength: number = 10;\r\n\r\n /**\r\n * The height of the cylinder for the updraft.\r\n */\r\n height: number = 10;\r\n\r\n /**\r\n * The mode for the updraft.\r\n */\r\n updraftMode: PhysicsUpdraftMode = PhysicsUpdraftMode.Center;\r\n}\r\n\r\n/**\r\n * Options fot the vortex event\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class\r\n */\r\nexport class PhysicsVortexEventOptions {\r\n /**\r\n * The radius of the cylinder for the vortex\r\n */\r\n radius: number = 5;\r\n\r\n /**\r\n * The strength of the vortex.\r\n */\r\n strength: number = 10;\r\n\r\n /**\r\n * The height of the cylinder for the vortex.\r\n */\r\n height: number = 10;\r\n\r\n /**\r\n * At which distance, relative to the radius the centripetal forces should kick in? Range: 0-1\r\n */\r\n centripetalForceThreshold: number = 0.7;\r\n\r\n /**\r\n * This multiplier determines with how much force the objects will be pushed sideways/around the vortex, when below the threshold.\r\n */\r\n centripetalForceMultiplier: number = 5;\r\n\r\n /**\r\n * This multiplier determines with how much force the objects will be pushed sideways/around the vortex, when above the threshold.\r\n */\r\n centrifugalForceMultiplier: number = 0.5;\r\n\r\n /**\r\n * This multiplier determines with how much force the objects will be pushed upwards, when in the vortex.\r\n */\r\n updraftForceMultiplier: number = 0.02;\r\n}\r\n\r\n/**\r\n * The strength of the force in correspondence to the distance of the affected object\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class\r\n */\r\nexport const enum PhysicsRadialImpulseFalloff {\r\n /** Defines that impulse is constant in strength across it's whole radius */\r\n Constant,\r\n /** Defines that impulse gets weaker if it's further from the origin */\r\n Linear,\r\n}\r\n\r\n/**\r\n * The strength of the force in correspondence to the distance of the affected object\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class\r\n */\r\nexport const enum PhysicsUpdraftMode {\r\n /** Defines that the upstream forces will pull towards the top center of the cylinder */\r\n Center,\r\n /** Defines that once a impostor is inside the cylinder, it will shoot out perpendicular from the ground of the cylinder */\r\n Perpendicular,\r\n}\r\n\r\n/**\r\n * Interface for a physics hit data\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport interface PhysicsHitData {\r\n /**\r\n * The force applied at the contact point\r\n */\r\n force: Vector3;\r\n /**\r\n * The contact point\r\n */\r\n contactPoint: Vector3;\r\n /**\r\n * The distance from the origin to the contact point\r\n */\r\n distanceFromOrigin: number;\r\n /**\r\n * For an instanced physics body (mesh with thin instances), the index of the thin instance the hit applies to\r\n */\r\n instanceIndex?: number;\r\n}\r\n\r\n/**\r\n * Interface for radial explosion event data\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport interface PhysicsRadialExplosionEventData {\r\n /**\r\n * A sphere used for the radial explosion event\r\n */\r\n sphere: Mesh;\r\n}\r\n\r\n/**\r\n * Interface for gravitational field event data\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport interface PhysicsGravitationalFieldEventData {\r\n /**\r\n * A sphere mesh used for the gravitational field event\r\n */\r\n sphere: Mesh;\r\n}\r\n\r\n/**\r\n * Interface for updraft event data\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport interface PhysicsUpdraftEventData {\r\n /**\r\n * A cylinder used for the updraft event\r\n */\r\n cylinder?: Mesh;\r\n}\r\n\r\n/**\r\n * Interface for vortex event data\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport interface PhysicsVortexEventData {\r\n /**\r\n * A cylinder used for the vortex event\r\n */\r\n cylinder: Mesh;\r\n}\r\n\r\n/**\r\n * Interface for an affected physics impostor\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport interface PhysicsAffectedImpostorWithData {\r\n /**\r\n * The impostor affected by the effect\r\n */\r\n impostor: PhysicsImpostor;\r\n\r\n /**\r\n * The data about the hit/force from the explosion\r\n */\r\n hitData: PhysicsHitData;\r\n}\r\n\r\n/**\r\n * Interface for an affected physics body\r\n * @see\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport interface PhysicsAffectedBodyWithData {\r\n /**\r\n * The impostor affected by the effect\r\n */\r\n body: PhysicsBody;\r\n\r\n /**\r\n * The data about the hit/force from the explosion\r\n */\r\n hitData: PhysicsHitData;\r\n}\r\n"]}
@@ -121,7 +121,7 @@ export class OimoJSPlugin {
121
121
  const globalQuaternion = new Quaternion();
122
122
  for (const i of impostors) {
123
123
  if (!i.object.rotationQuaternion) {
124
- return;
124
+ continue;
125
125
  }
126
126
  //get the correct bounding box
127
127
  const oldQuaternion = i.object.rotationQuaternion;
@@ -1 +1 @@
1
- {"version":3,"file":"oimoJSPlugin.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Physics/v1/Plugins/oimoJSPlugin.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAEjE,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAElE,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAIxD,gBAAgB;AAChB,MAAM,OAAO,YAAY;IAQrB,YACY,wBAAiC,IAAI,EAC7C,UAAmB,EACnB,aAAa,GAAG,IAAI;QAFZ,0BAAqB,GAArB,qBAAqB,CAAgB;QAP1C,SAAI,GAAW,cAAc,CAAC;QAI7B,mBAAc,GAAW,CAAC,GAAG,EAAE,CAAC;QAmChC,uBAAkB,GAA2B,EAAE,CAAC;QA+MhD,uBAAkB,GAAY,OAAO,CAAC,IAAI,EAAE,CAAC;QA3OjD,IAAI,CAAC,OAAO,GAAG,aAAa,CAAC;QAC7B,IAAI,CAAC,KAAK,GAAG,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;YAChC,UAAU,EAAE,UAAU;SACzB,CAAC,CAAC;QACH,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QACnB,IAAI,CAAC,cAAc,GAAG,IAAI,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GAAG,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC;QACnD,CAAC;IACL,CAAC;IAEM,SAAS,CAAC,QAAyB;QACtC,OAAO,QAAQ,CAAC,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC;IAC9C,CAAC;IAEM,eAAe,CAAC,QAAyB,EAAE,MAAe;QAC7D,MAAM,KAAK,GAAG,QAAQ,CAAC,WAAW,CAAC,MAAM,CAAC;QAC1C,MAAM,CAAC,CAAC,GAAG,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC;QAC/B,MAAM,CAAC,CAAC,GAAG,KAAK,CAAC,UAAU,GAAG,CAAC,CAAC;QAChC,MAAM,CAAC,CAAC,GAAG,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC;IACnC,CAAC;IAEM,OAAO;QACV,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;IACvB,CAAC;IAED;;;;;OAKG;IACI,OAAO,CAAC,IAAa,EAAE,EAAW;QACrC,MAAM,CAAC,IAAI,CAAC,+DAA+D,CAAC,CAAC;QAE7E,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QAEpC,OAAO,IAAI,CAAC,cAAc,CAAC;IAC/B,CAAC;IAED;;;;;OAKG;IACI,YAAY,CAAC,IAAa,EAAE,EAAW,EAAE,MAA4B;QACxE,MAAM,CAAC,IAAI,CAAC,+DAA+D,CAAC,CAAC;QAE7E,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IAC3B,CAAC;CACJ","sourcesContent":["/* eslint-disable @typescript-eslint/no-unsafe-return */\r\n/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { IPhysicsEnabledObject } from \"../physicsImpostor\";\r\nimport { PhysicsImpostor } from \"../physicsImpostor\";\r\nimport type { IMotorEnabledJoint, DistanceJointData, SpringJointData } from \"../physicsJoint\";\r\nimport { PhysicsJoint } from \"../physicsJoint\";\r\nimport type { AbstractMesh } from \"../../../Meshes/abstractMesh\";\r\nimport { Vector3, Quaternion } from \"../../../Maths/math.vector\";\r\nimport type { Nullable } from \"../../../types\";\r\nimport { Logger } from \"../../../Misc/logger\";\r\nimport { PhysicsRaycastResult } from \"../../physicsRaycastResult\";\r\nimport type { IPhysicsEnginePlugin, PhysicsImpostorJoint } from \"../IPhysicsEnginePlugin\";\r\nimport { Epsilon } from \"../../../Maths/math.constants\";\r\n\r\ndeclare let OIMO: any;\r\n\r\n/** @internal */\r\nexport class OimoJSPlugin implements IPhysicsEnginePlugin {\r\n public world: any;\r\n public name: string = \"OimoJSPlugin\";\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n public BJSOIMO: any;\r\n private _raycastResult: PhysicsRaycastResult;\r\n private _fixedTimeStep: number = 1 / 60;\r\n\r\n constructor(\r\n private _useDeltaForWorldStep: boolean = true,\r\n iterations?: number,\r\n oimoInjection = OIMO\r\n ) {\r\n this.BJSOIMO = oimoInjection;\r\n this.world = new this.BJSOIMO.World({\r\n iterations: iterations,\r\n });\r\n this.world.clear();\r\n this._raycastResult = new PhysicsRaycastResult();\r\n }\r\n\r\n /**\r\n *\r\n * @returns plugin version\r\n */\r\n public getPluginVersion(): number {\r\n return 1;\r\n }\r\n\r\n public setGravity(gravity: Vector3) {\r\n this.world.gravity.set(gravity.x, gravity.y, gravity.z);\r\n }\r\n\r\n public setTimeStep(timeStep: number) {\r\n this.world.timeStep = timeStep;\r\n }\r\n\r\n public getTimeStep(): number {\r\n return this.world.timeStep;\r\n }\r\n\r\n private _tmpImpostorsArray: Array<PhysicsImpostor> = [];\r\n\r\n public executeStep(delta: number, impostors: Array<PhysicsImpostor>) {\r\n for (const impostor of impostors) {\r\n impostor.beforeStep();\r\n }\r\n\r\n this.world.timeStep = this._useDeltaForWorldStep ? delta : this._fixedTimeStep;\r\n this.world.step();\r\n\r\n for (const impostor of impostors) {\r\n impostor.afterStep();\r\n //update the ordered impostors array\r\n this._tmpImpostorsArray[impostor.uniqueId] = impostor;\r\n }\r\n\r\n //check for collisions\r\n let contact = this.world.contacts;\r\n\r\n while (contact !== null) {\r\n if (contact.touching && !contact.body1.sleeping && !contact.body2.sleeping) {\r\n contact = contact.next;\r\n continue;\r\n }\r\n //is this body colliding with any other? get the impostor\r\n const mainImpostor = this._tmpImpostorsArray[+contact.body1.name];\r\n const collidingImpostor = this._tmpImpostorsArray[+contact.body2.name];\r\n\r\n if (!mainImpostor || !collidingImpostor) {\r\n contact = contact.next;\r\n continue;\r\n }\r\n\r\n mainImpostor.onCollide({ body: collidingImpostor.physicsBody, point: null, distance: 0, impulse: 0, normal: null });\r\n collidingImpostor.onCollide({ body: mainImpostor.physicsBody, point: null, distance: 0, impulse: 0, normal: null });\r\n contact = contact.next;\r\n }\r\n }\r\n\r\n public applyImpulse(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3) {\r\n const mass = impostor.physicsBody.mass;\r\n impostor.physicsBody.applyImpulse(contactPoint.scale(this.world.invScale), force.scale(this.world.invScale * mass));\r\n }\r\n public applyForce(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3) {\r\n Logger.Warn(\"Oimo doesn't support applying force. Using impulse instead.\");\r\n this.applyImpulse(impostor, force, contactPoint);\r\n }\r\n public generatePhysicsBody(impostor: PhysicsImpostor) {\r\n //parent-child relationship. Does this impostor has a parent impostor?\r\n if (impostor.parent) {\r\n if (impostor.physicsBody) {\r\n this.removePhysicsBody(impostor);\r\n //TODO is that needed?\r\n impostor.forceUpdate();\r\n }\r\n return;\r\n }\r\n\r\n if (impostor.isBodyInitRequired()) {\r\n const bodyConfig: any = {\r\n name: impostor.uniqueId,\r\n //Oimo must have mass, also for static objects.\r\n config: [impostor.getParam(\"mass\") || 0.001, impostor.getParam(\"friction\"), impostor.getParam(\"restitution\")],\r\n size: [],\r\n type: [],\r\n pos: [],\r\n posShape: [],\r\n rot: [],\r\n rotShape: [],\r\n move: impostor.getParam(\"mass\") !== 0,\r\n density: impostor.getParam(\"mass\"),\r\n friction: impostor.getParam(\"friction\"),\r\n restitution: impostor.getParam(\"restitution\"),\r\n //Supporting older versions of Oimo\r\n world: this.world,\r\n };\r\n\r\n const impostors = [impostor];\r\n const addToArray = (parent: IPhysicsEnabledObject) => {\r\n if (!parent.getChildMeshes) {\r\n return;\r\n }\r\n const meshes = parent.getChildMeshes();\r\n for (const m of meshes) {\r\n if (m.physicsImpostor) {\r\n impostors.push(m.physicsImpostor);\r\n //m.physicsImpostor._init();\r\n }\r\n }\r\n };\r\n addToArray(impostor.object);\r\n\r\n const checkWithEpsilon = (value: number): number => {\r\n return Math.max(value, Epsilon);\r\n };\r\n\r\n const globalQuaternion: Quaternion = new Quaternion();\r\n\r\n for (const i of impostors) {\r\n if (!i.object.rotationQuaternion) {\r\n return;\r\n }\r\n //get the correct bounding box\r\n const oldQuaternion = i.object.rotationQuaternion;\r\n globalQuaternion.copyFrom(oldQuaternion);\r\n\r\n i.object.rotationQuaternion.set(0, 0, 0, 1);\r\n i.object.computeWorldMatrix(true);\r\n\r\n const rot = globalQuaternion.toEulerAngles();\r\n const impostorExtents = i.getObjectExtents();\r\n\r\n // eslint-disable-next-line no-loss-of-precision\r\n const radToDeg = 57.295779513082320876;\r\n\r\n if (i === impostor) {\r\n const center = impostor.getObjectCenter();\r\n\r\n impostor.object.getAbsolutePivotPoint().subtractToRef(center, this._tmpPositionVector);\r\n this._tmpPositionVector.divideInPlace(impostor.object.scaling);\r\n\r\n //Can also use Array.prototype.push.apply\r\n bodyConfig.pos.push(center.x);\r\n bodyConfig.pos.push(center.y);\r\n bodyConfig.pos.push(center.z);\r\n bodyConfig.posShape.push(0, 0, 0);\r\n\r\n bodyConfig.rotShape.push(0, 0, 0);\r\n } else {\r\n const localPosition = i.object.position.clone();\r\n bodyConfig.posShape.push(localPosition.x);\r\n bodyConfig.posShape.push(localPosition.y);\r\n bodyConfig.posShape.push(localPosition.z);\r\n\r\n // bodyConfig.pos.push(0, 0, 0);\r\n\r\n bodyConfig.rotShape.push(rot.x * radToDeg, rot.y * radToDeg, rot.z * radToDeg);\r\n }\r\n\r\n i.object.rotationQuaternion.copyFrom(globalQuaternion);\r\n\r\n // register mesh\r\n switch (i.type) {\r\n case PhysicsImpostor.ParticleImpostor:\r\n Logger.Warn(\"No Particle support in OIMO.js. using SphereImpostor instead\");\r\n // eslint-disable-next-line no-fallthrough\r\n case PhysicsImpostor.SphereImpostor: {\r\n const radiusX = impostorExtents.x;\r\n const radiusY = impostorExtents.y;\r\n const radiusZ = impostorExtents.z;\r\n\r\n const size = Math.max(checkWithEpsilon(radiusX), checkWithEpsilon(radiusY), checkWithEpsilon(radiusZ)) / 2;\r\n\r\n bodyConfig.type.push(\"sphere\");\r\n //due to the way oimo works with compounds, add 3 times\r\n bodyConfig.size.push(size);\r\n bodyConfig.size.push(size);\r\n bodyConfig.size.push(size);\r\n break;\r\n }\r\n case PhysicsImpostor.CylinderImpostor: {\r\n const sizeX = checkWithEpsilon(impostorExtents.x) / 2;\r\n const sizeY = checkWithEpsilon(impostorExtents.y);\r\n bodyConfig.type.push(\"cylinder\");\r\n bodyConfig.size.push(sizeX);\r\n bodyConfig.size.push(sizeY);\r\n //due to the way oimo works with compounds, add one more value.\r\n bodyConfig.size.push(sizeY);\r\n break;\r\n }\r\n case PhysicsImpostor.PlaneImpostor:\r\n case PhysicsImpostor.BoxImpostor:\r\n default: {\r\n const sizeX = checkWithEpsilon(impostorExtents.x);\r\n const sizeY = checkWithEpsilon(impostorExtents.y);\r\n const sizeZ = checkWithEpsilon(impostorExtents.z);\r\n\r\n bodyConfig.type.push(\"box\");\r\n //if (i === impostor) {\r\n bodyConfig.size.push(sizeX);\r\n bodyConfig.size.push(sizeY);\r\n bodyConfig.size.push(sizeZ);\r\n //} else {\r\n // bodyConfig.size.push(0,0,0);\r\n //}\r\n break;\r\n }\r\n }\r\n\r\n //actually not needed, but hey...\r\n i.object.rotationQuaternion = oldQuaternion;\r\n }\r\n impostor.physicsBody = this.world.add(bodyConfig);\r\n // set the quaternion, ignoring the previously defined (euler) rotation\r\n impostor.physicsBody.resetQuaternion(globalQuaternion);\r\n // update with delta 0, so the body will receive the new rotation.\r\n impostor.physicsBody.updatePosition(0);\r\n } else {\r\n this._tmpPositionVector.copyFromFloats(0, 0, 0);\r\n }\r\n\r\n impostor.setDeltaPosition(this._tmpPositionVector);\r\n\r\n //this._tmpPositionVector.addInPlace(impostor.mesh.getBoundingInfo().boundingBox.center);\r\n //this.setPhysicsBodyTransformation(impostor, this._tmpPositionVector, impostor.mesh.rotationQuaternion);\r\n }\r\n\r\n private _tmpPositionVector: Vector3 = Vector3.Zero();\r\n\r\n public removePhysicsBody(impostor: PhysicsImpostor) {\r\n //impostor.physicsBody.dispose();\r\n this.world.removeRigidBody(impostor.physicsBody);\r\n }\r\n\r\n public generateJoint(impostorJoint: PhysicsImpostorJoint) {\r\n const mainBody = impostorJoint.mainImpostor.physicsBody;\r\n const connectedBody = impostorJoint.connectedImpostor.physicsBody;\r\n\r\n if (!mainBody || !connectedBody) {\r\n return;\r\n }\r\n const jointData = impostorJoint.joint.jointData;\r\n const options = jointData.nativeParams || {};\r\n let type;\r\n const nativeJointData: any = {\r\n body1: mainBody,\r\n body2: connectedBody,\r\n\r\n axe1: options.axe1 || (jointData.mainAxis ? jointData.mainAxis.asArray() : null),\r\n axe2: options.axe2 || (jointData.connectedAxis ? jointData.connectedAxis.asArray() : null),\r\n pos1: options.pos1 || (jointData.mainPivot ? jointData.mainPivot.asArray() : null),\r\n pos2: options.pos2 || (jointData.connectedPivot ? jointData.connectedPivot.asArray() : null),\r\n\r\n min: options.min,\r\n max: options.max,\r\n collision: options.collision || jointData.collision,\r\n spring: options.spring,\r\n\r\n //supporting older version of Oimo\r\n world: this.world,\r\n };\r\n switch (impostorJoint.joint.type) {\r\n case PhysicsJoint.BallAndSocketJoint:\r\n type = \"jointBall\";\r\n break;\r\n case PhysicsJoint.SpringJoint: {\r\n Logger.Warn(\"OIMO.js doesn't support Spring Constraint. Simulating using DistanceJoint instead\");\r\n const springData = <SpringJointData>jointData;\r\n nativeJointData.min = springData.length || nativeJointData.min;\r\n //Max should also be set, just make sure it is at least min\r\n nativeJointData.max = Math.max(nativeJointData.min, nativeJointData.max);\r\n }\r\n // eslint-disable-next-line no-fallthrough\r\n case PhysicsJoint.DistanceJoint:\r\n type = \"jointDistance\";\r\n nativeJointData.max = (<DistanceJointData>jointData).maxDistance;\r\n break;\r\n case PhysicsJoint.PrismaticJoint:\r\n type = \"jointPrisme\";\r\n break;\r\n case PhysicsJoint.SliderJoint:\r\n type = \"jointSlide\";\r\n break;\r\n case PhysicsJoint.WheelJoint:\r\n type = \"jointWheel\";\r\n break;\r\n case PhysicsJoint.HingeJoint:\r\n default:\r\n type = \"jointHinge\";\r\n break;\r\n }\r\n nativeJointData.type = type;\r\n impostorJoint.joint.physicsJoint = this.world.add(nativeJointData);\r\n }\r\n\r\n public removeJoint(impostorJoint: PhysicsImpostorJoint) {\r\n //Bug in Oimo prevents us from disposing a joint in the playground\r\n //joint.joint.physicsJoint.dispose();\r\n //So we will bruteforce it!\r\n try {\r\n this.world.removeJoint(impostorJoint.joint.physicsJoint);\r\n } catch (e) {\r\n Logger.Warn(e);\r\n }\r\n }\r\n\r\n public isSupported(): boolean {\r\n return this.BJSOIMO !== undefined;\r\n }\r\n\r\n public setTransformationFromPhysicsBody(impostor: PhysicsImpostor) {\r\n if (!impostor.physicsBody.sleeping) {\r\n if (impostor.physicsBody.shapes.next) {\r\n let parent = impostor.physicsBody.shapes;\r\n while (parent.next) {\r\n parent = parent.next;\r\n }\r\n impostor.object.position.set(parent.position.x, parent.position.y, parent.position.z);\r\n } else {\r\n const pos = impostor.physicsBody.getPosition();\r\n impostor.object.position.set(pos.x, pos.y, pos.z);\r\n }\r\n\r\n if (impostor.object.rotationQuaternion) {\r\n const quat = impostor.physicsBody.getQuaternion();\r\n impostor.object.rotationQuaternion.set(quat.x, quat.y, quat.z, quat.w);\r\n }\r\n }\r\n }\r\n\r\n public setPhysicsBodyTransformation(impostor: PhysicsImpostor, newPosition: Vector3, newRotation: Quaternion) {\r\n const body = impostor.physicsBody;\r\n // disable bidirectional for compound meshes\r\n if (impostor.physicsBody.shapes.next) {\r\n return;\r\n }\r\n body.position.set(newPosition.x, newPosition.y, newPosition.z);\r\n body.orientation.set(newRotation.x, newRotation.y, newRotation.z, newRotation.w);\r\n body.syncShapes();\r\n body.awake();\r\n }\r\n\r\n /*private _getLastShape(body: any): any {\r\n var lastShape = body.shapes;\r\n while (lastShape.next) {\r\n lastShape = lastShape.next;\r\n }\r\n return lastShape;\r\n }*/\r\n\r\n public setLinearVelocity(impostor: PhysicsImpostor, velocity: Vector3) {\r\n impostor.physicsBody.linearVelocity.set(velocity.x, velocity.y, velocity.z);\r\n }\r\n\r\n public setAngularVelocity(impostor: PhysicsImpostor, velocity: Vector3) {\r\n impostor.physicsBody.angularVelocity.set(velocity.x, velocity.y, velocity.z);\r\n }\r\n\r\n public getLinearVelocity(impostor: PhysicsImpostor): Nullable<Vector3> {\r\n const v = impostor.physicsBody.linearVelocity;\r\n if (!v) {\r\n return null;\r\n }\r\n return new Vector3(v.x, v.y, v.z);\r\n }\r\n public getAngularVelocity(impostor: PhysicsImpostor): Nullable<Vector3> {\r\n const v = impostor.physicsBody.angularVelocity;\r\n if (!v) {\r\n return null;\r\n }\r\n return new Vector3(v.x, v.y, v.z);\r\n }\r\n\r\n public setBodyMass(impostor: PhysicsImpostor, mass: number) {\r\n const staticBody: boolean = mass === 0;\r\n //this will actually set the body's density and not its mass.\r\n //But this is how oimo treats the mass variable.\r\n impostor.physicsBody.shapes.density = staticBody ? 1 : mass;\r\n impostor.physicsBody.setupMass(staticBody ? 0x2 : 0x1);\r\n }\r\n\r\n public getBodyMass(impostor: PhysicsImpostor): number {\r\n return impostor.physicsBody.shapes.density;\r\n }\r\n\r\n public getBodyFriction(impostor: PhysicsImpostor): number {\r\n return impostor.physicsBody.shapes.friction;\r\n }\r\n\r\n public setBodyFriction(impostor: PhysicsImpostor, friction: number) {\r\n impostor.physicsBody.shapes.friction = friction;\r\n }\r\n\r\n public getBodyRestitution(impostor: PhysicsImpostor): number {\r\n return impostor.physicsBody.shapes.restitution;\r\n }\r\n\r\n public setBodyRestitution(impostor: PhysicsImpostor, restitution: number) {\r\n impostor.physicsBody.shapes.restitution = restitution;\r\n }\r\n\r\n public sleepBody(impostor: PhysicsImpostor) {\r\n impostor.physicsBody.sleep();\r\n }\r\n\r\n public wakeUpBody(impostor: PhysicsImpostor) {\r\n impostor.physicsBody.awake();\r\n }\r\n\r\n public updateDistanceJoint(joint: PhysicsJoint, maxDistance: number, minDistance?: number) {\r\n joint.physicsJoint.limitMotor.upperLimit = maxDistance;\r\n if (minDistance !== void 0) {\r\n joint.physicsJoint.limitMotor.lowerLimit = minDistance;\r\n }\r\n }\r\n\r\n public setMotor(joint: IMotorEnabledJoint, speed: number, force?: number, motorIndex?: number) {\r\n if (force !== undefined) {\r\n Logger.Warn(\"OimoJS plugin currently has unexpected behavior when using setMotor with force parameter\");\r\n } else {\r\n force = 1e6;\r\n }\r\n speed *= -1;\r\n\r\n //TODO separate rotational and transational motors.\r\n const motor = motorIndex\r\n ? joint.physicsJoint.rotationalLimitMotor2\r\n : joint.physicsJoint.rotationalLimitMotor1 || joint.physicsJoint.rotationalLimitMotor || joint.physicsJoint.limitMotor;\r\n if (motor) {\r\n motor.setMotor(speed, force);\r\n }\r\n }\r\n\r\n public setLimit(joint: IMotorEnabledJoint, upperLimit: number, lowerLimit?: number, motorIndex?: number) {\r\n //TODO separate rotational and transational motors.\r\n const motor = motorIndex\r\n ? joint.physicsJoint.rotationalLimitMotor2\r\n : joint.physicsJoint.rotationalLimitMotor1 || joint.physicsJoint.rotationalLimitMotor || joint.physicsJoint.limitMotor;\r\n if (motor) {\r\n motor.setLimit(upperLimit, lowerLimit === void 0 ? -upperLimit : lowerLimit);\r\n }\r\n }\r\n\r\n public syncMeshWithImpostor(mesh: AbstractMesh, impostor: PhysicsImpostor) {\r\n const body = impostor.physicsBody;\r\n\r\n mesh.position.x = body.position.x;\r\n mesh.position.y = body.position.y;\r\n mesh.position.z = body.position.z;\r\n\r\n if (mesh.rotationQuaternion) {\r\n mesh.rotationQuaternion.x = body.orientation.x;\r\n mesh.rotationQuaternion.y = body.orientation.y;\r\n mesh.rotationQuaternion.z = body.orientation.z;\r\n mesh.rotationQuaternion.w = body.orientation.w;\r\n }\r\n }\r\n\r\n public getRadius(impostor: PhysicsImpostor): number {\r\n return impostor.physicsBody.shapes.radius;\r\n }\r\n\r\n public getBoxSizeToRef(impostor: PhysicsImpostor, result: Vector3): void {\r\n const shape = impostor.physicsBody.shapes;\r\n result.x = shape.halfWidth * 2;\r\n result.y = shape.halfHeight * 2;\r\n result.z = shape.halfDepth * 2;\r\n }\r\n\r\n public dispose() {\r\n this.world.clear();\r\n }\r\n\r\n /**\r\n * Does a raycast in the physics world\r\n * @param from when should the ray start?\r\n * @param to when should the ray end?\r\n * @returns PhysicsRaycastResult\r\n */\r\n public raycast(from: Vector3, to: Vector3): PhysicsRaycastResult {\r\n Logger.Warn(\"raycast is not currently supported by the Oimo physics plugin\");\r\n\r\n this._raycastResult.reset(from, to);\r\n\r\n return this._raycastResult;\r\n }\r\n\r\n /**\r\n * Does a raycast in the physics world\r\n * @param from when should the ray start?\r\n * @param to when should the ray end?\r\n * @param result resulting PhysicsRaycastResult\r\n */\r\n public raycastToRef(from: Vector3, to: Vector3, result: PhysicsRaycastResult): void {\r\n Logger.Warn(\"raycast is not currently supported by the Oimo physics plugin\");\r\n\r\n result.reset(from, to);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"oimoJSPlugin.js","sourceRoot":"","sources":["../../../../../../dev/core/src/Physics/v1/Plugins/oimoJSPlugin.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,4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AAC,KAAK,EAAE,CAAC;IACvB,CAAC;IAED;;;;;OAKG;IACI,OAAO,CAAC,IAAa,EAAE,EAAW;QACrC,MAAM,CAAC,IAAI,CAAC,+DAA+D,CAAC,CAAC;QAE7E,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QAEpC,OAAO,IAAI,CAAC,cAAc,CAAC;IAC/B,CAAC;IAED;;;;;OAKG;IACI,YAAY,CAAC,IAAa,EAAE,EAAW,EAAE,MAA4B;QACxE,MAAM,CAAC,IAAI,CAAC,+DAA+D,CAAC,CAAC;QAE7E,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IAC3B,CAAC;CACJ","sourcesContent":["/* eslint-disable @typescript-eslint/no-unsafe-return */\r\n/* eslint-disable @typescript-eslint/naming-convention */\r\nimport type { IPhysicsEnabledObject } from \"../physicsImpostor\";\r\nimport { PhysicsImpostor } from \"../physicsImpostor\";\r\nimport type { IMotorEnabledJoint, DistanceJointData, SpringJointData } from \"../physicsJoint\";\r\nimport { PhysicsJoint } from \"../physicsJoint\";\r\nimport type { AbstractMesh } from \"../../../Meshes/abstractMesh\";\r\nimport { Vector3, Quaternion } from \"../../../Maths/math.vector\";\r\nimport type { Nullable } from \"../../../types\";\r\nimport { Logger } from \"../../../Misc/logger\";\r\nimport { PhysicsRaycastResult } from \"../../physicsRaycastResult\";\r\nimport type { IPhysicsEnginePlugin, PhysicsImpostorJoint } from \"../IPhysicsEnginePlugin\";\r\nimport { Epsilon } from \"../../../Maths/math.constants\";\r\n\r\ndeclare let OIMO: any;\r\n\r\n/** @internal */\r\nexport class OimoJSPlugin implements IPhysicsEnginePlugin {\r\n public world: any;\r\n public name: string = \"OimoJSPlugin\";\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n public BJSOIMO: any;\r\n private _raycastResult: PhysicsRaycastResult;\r\n private _fixedTimeStep: number = 1 / 60;\r\n\r\n constructor(\r\n private _useDeltaForWorldStep: boolean = true,\r\n iterations?: number,\r\n oimoInjection = OIMO\r\n ) {\r\n this.BJSOIMO = oimoInjection;\r\n this.world = new this.BJSOIMO.World({\r\n iterations: iterations,\r\n });\r\n this.world.clear();\r\n this._raycastResult = new PhysicsRaycastResult();\r\n }\r\n\r\n /**\r\n *\r\n * @returns plugin version\r\n */\r\n public getPluginVersion(): number {\r\n return 1;\r\n }\r\n\r\n public setGravity(gravity: Vector3) {\r\n this.world.gravity.set(gravity.x, gravity.y, gravity.z);\r\n }\r\n\r\n public setTimeStep(timeStep: number) {\r\n this.world.timeStep = timeStep;\r\n }\r\n\r\n public getTimeStep(): number {\r\n return this.world.timeStep;\r\n }\r\n\r\n private _tmpImpostorsArray: Array<PhysicsImpostor> = [];\r\n\r\n public executeStep(delta: number, impostors: Array<PhysicsImpostor>) {\r\n for (const impostor of impostors) {\r\n impostor.beforeStep();\r\n }\r\n\r\n this.world.timeStep = this._useDeltaForWorldStep ? delta : this._fixedTimeStep;\r\n this.world.step();\r\n\r\n for (const impostor of impostors) {\r\n impostor.afterStep();\r\n //update the ordered impostors array\r\n this._tmpImpostorsArray[impostor.uniqueId] = impostor;\r\n }\r\n\r\n //check for collisions\r\n let contact = this.world.contacts;\r\n\r\n while (contact !== null) {\r\n if (contact.touching && !contact.body1.sleeping && !contact.body2.sleeping) {\r\n contact = contact.next;\r\n continue;\r\n }\r\n //is this body colliding with any other? get the impostor\r\n const mainImpostor = this._tmpImpostorsArray[+contact.body1.name];\r\n const collidingImpostor = this._tmpImpostorsArray[+contact.body2.name];\r\n\r\n if (!mainImpostor || !collidingImpostor) {\r\n contact = contact.next;\r\n continue;\r\n }\r\n\r\n mainImpostor.onCollide({ body: collidingImpostor.physicsBody, point: null, distance: 0, impulse: 0, normal: null });\r\n collidingImpostor.onCollide({ body: mainImpostor.physicsBody, point: null, distance: 0, impulse: 0, normal: null });\r\n contact = contact.next;\r\n }\r\n }\r\n\r\n public applyImpulse(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3) {\r\n const mass = impostor.physicsBody.mass;\r\n impostor.physicsBody.applyImpulse(contactPoint.scale(this.world.invScale), force.scale(this.world.invScale * mass));\r\n }\r\n public applyForce(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3) {\r\n Logger.Warn(\"Oimo doesn't support applying force. Using impulse instead.\");\r\n this.applyImpulse(impostor, force, contactPoint);\r\n }\r\n public generatePhysicsBody(impostor: PhysicsImpostor) {\r\n //parent-child relationship. Does this impostor has a parent impostor?\r\n if (impostor.parent) {\r\n if (impostor.physicsBody) {\r\n this.removePhysicsBody(impostor);\r\n //TODO is that needed?\r\n impostor.forceUpdate();\r\n }\r\n return;\r\n }\r\n\r\n if (impostor.isBodyInitRequired()) {\r\n const bodyConfig: any = {\r\n name: impostor.uniqueId,\r\n //Oimo must have mass, also for static objects.\r\n config: [impostor.getParam(\"mass\") || 0.001, impostor.getParam(\"friction\"), impostor.getParam(\"restitution\")],\r\n size: [],\r\n type: [],\r\n pos: [],\r\n posShape: [],\r\n rot: [],\r\n rotShape: [],\r\n move: impostor.getParam(\"mass\") !== 0,\r\n density: impostor.getParam(\"mass\"),\r\n friction: impostor.getParam(\"friction\"),\r\n restitution: impostor.getParam(\"restitution\"),\r\n //Supporting older versions of Oimo\r\n world: this.world,\r\n };\r\n\r\n const impostors = [impostor];\r\n const addToArray = (parent: IPhysicsEnabledObject) => {\r\n if (!parent.getChildMeshes) {\r\n return;\r\n }\r\n const meshes = parent.getChildMeshes();\r\n for (const m of meshes) {\r\n if (m.physicsImpostor) {\r\n impostors.push(m.physicsImpostor);\r\n //m.physicsImpostor._init();\r\n }\r\n }\r\n };\r\n addToArray(impostor.object);\r\n\r\n const checkWithEpsilon = (value: number): number => {\r\n return Math.max(value, Epsilon);\r\n };\r\n\r\n const globalQuaternion: Quaternion = new Quaternion();\r\n\r\n for (const i of impostors) {\r\n if (!i.object.rotationQuaternion) {\r\n continue;\r\n }\r\n //get the correct bounding box\r\n const oldQuaternion = i.object.rotationQuaternion;\r\n globalQuaternion.copyFrom(oldQuaternion);\r\n\r\n i.object.rotationQuaternion.set(0, 0, 0, 1);\r\n i.object.computeWorldMatrix(true);\r\n\r\n const rot = globalQuaternion.toEulerAngles();\r\n const impostorExtents = i.getObjectExtents();\r\n\r\n // eslint-disable-next-line no-loss-of-precision\r\n const radToDeg = 57.295779513082320876;\r\n\r\n if (i === impostor) {\r\n const center = impostor.getObjectCenter();\r\n\r\n impostor.object.getAbsolutePivotPoint().subtractToRef(center, this._tmpPositionVector);\r\n this._tmpPositionVector.divideInPlace(impostor.object.scaling);\r\n\r\n //Can also use Array.prototype.push.apply\r\n bodyConfig.pos.push(center.x);\r\n bodyConfig.pos.push(center.y);\r\n bodyConfig.pos.push(center.z);\r\n bodyConfig.posShape.push(0, 0, 0);\r\n\r\n bodyConfig.rotShape.push(0, 0, 0);\r\n } else {\r\n const localPosition = i.object.position.clone();\r\n bodyConfig.posShape.push(localPosition.x);\r\n bodyConfig.posShape.push(localPosition.y);\r\n bodyConfig.posShape.push(localPosition.z);\r\n\r\n // bodyConfig.pos.push(0, 0, 0);\r\n\r\n bodyConfig.rotShape.push(rot.x * radToDeg, rot.y * radToDeg, rot.z * radToDeg);\r\n }\r\n\r\n i.object.rotationQuaternion.copyFrom(globalQuaternion);\r\n\r\n // register mesh\r\n switch (i.type) {\r\n case PhysicsImpostor.ParticleImpostor:\r\n Logger.Warn(\"No Particle support in OIMO.js. using SphereImpostor instead\");\r\n // eslint-disable-next-line no-fallthrough\r\n case PhysicsImpostor.SphereImpostor: {\r\n const radiusX = impostorExtents.x;\r\n const radiusY = impostorExtents.y;\r\n const radiusZ = impostorExtents.z;\r\n\r\n const size = Math.max(checkWithEpsilon(radiusX), checkWithEpsilon(radiusY), checkWithEpsilon(radiusZ)) / 2;\r\n\r\n bodyConfig.type.push(\"sphere\");\r\n //due to the way oimo works with compounds, add 3 times\r\n bodyConfig.size.push(size);\r\n bodyConfig.size.push(size);\r\n bodyConfig.size.push(size);\r\n break;\r\n }\r\n case PhysicsImpostor.CylinderImpostor: {\r\n const sizeX = checkWithEpsilon(impostorExtents.x) / 2;\r\n const sizeY = checkWithEpsilon(impostorExtents.y);\r\n bodyConfig.type.push(\"cylinder\");\r\n bodyConfig.size.push(sizeX);\r\n bodyConfig.size.push(sizeY);\r\n //due to the way oimo works with compounds, add one more value.\r\n bodyConfig.size.push(sizeY);\r\n break;\r\n }\r\n case PhysicsImpostor.PlaneImpostor:\r\n case PhysicsImpostor.BoxImpostor:\r\n default: {\r\n const sizeX = checkWithEpsilon(impostorExtents.x);\r\n const sizeY = checkWithEpsilon(impostorExtents.y);\r\n const sizeZ = checkWithEpsilon(impostorExtents.z);\r\n\r\n bodyConfig.type.push(\"box\");\r\n //if (i === impostor) {\r\n bodyConfig.size.push(sizeX);\r\n bodyConfig.size.push(sizeY);\r\n bodyConfig.size.push(sizeZ);\r\n //} else {\r\n // bodyConfig.size.push(0,0,0);\r\n //}\r\n break;\r\n }\r\n }\r\n\r\n //actually not needed, but hey...\r\n i.object.rotationQuaternion = oldQuaternion;\r\n }\r\n impostor.physicsBody = this.world.add(bodyConfig);\r\n // set the quaternion, ignoring the previously defined (euler) rotation\r\n impostor.physicsBody.resetQuaternion(globalQuaternion);\r\n // update with delta 0, so the body will receive the new rotation.\r\n impostor.physicsBody.updatePosition(0);\r\n } else {\r\n this._tmpPositionVector.copyFromFloats(0, 0, 0);\r\n }\r\n\r\n impostor.setDeltaPosition(this._tmpPositionVector);\r\n\r\n //this._tmpPositionVector.addInPlace(impostor.mesh.getBoundingInfo().boundingBox.center);\r\n //this.setPhysicsBodyTransformation(impostor, this._tmpPositionVector, impostor.mesh.rotationQuaternion);\r\n }\r\n\r\n private _tmpPositionVector: Vector3 = Vector3.Zero();\r\n\r\n public removePhysicsBody(impostor: PhysicsImpostor) {\r\n //impostor.physicsBody.dispose();\r\n this.world.removeRigidBody(impostor.physicsBody);\r\n }\r\n\r\n public generateJoint(impostorJoint: PhysicsImpostorJoint) {\r\n const mainBody = impostorJoint.mainImpostor.physicsBody;\r\n const connectedBody = impostorJoint.connectedImpostor.physicsBody;\r\n\r\n if (!mainBody || !connectedBody) {\r\n return;\r\n }\r\n const jointData = impostorJoint.joint.jointData;\r\n const options = jointData.nativeParams || {};\r\n let type;\r\n const nativeJointData: any = {\r\n body1: mainBody,\r\n body2: connectedBody,\r\n\r\n axe1: options.axe1 || (jointData.mainAxis ? jointData.mainAxis.asArray() : null),\r\n axe2: options.axe2 || (jointData.connectedAxis ? jointData.connectedAxis.asArray() : null),\r\n pos1: options.pos1 || (jointData.mainPivot ? jointData.mainPivot.asArray() : null),\r\n pos2: options.pos2 || (jointData.connectedPivot ? jointData.connectedPivot.asArray() : null),\r\n\r\n min: options.min,\r\n max: options.max,\r\n collision: options.collision || jointData.collision,\r\n spring: options.spring,\r\n\r\n //supporting older version of Oimo\r\n world: this.world,\r\n };\r\n switch (impostorJoint.joint.type) {\r\n case PhysicsJoint.BallAndSocketJoint:\r\n type = \"jointBall\";\r\n break;\r\n case PhysicsJoint.SpringJoint: {\r\n Logger.Warn(\"OIMO.js doesn't support Spring Constraint. Simulating using DistanceJoint instead\");\r\n const springData = <SpringJointData>jointData;\r\n nativeJointData.min = springData.length || nativeJointData.min;\r\n //Max should also be set, just make sure it is at least min\r\n nativeJointData.max = Math.max(nativeJointData.min, nativeJointData.max);\r\n }\r\n // eslint-disable-next-line no-fallthrough\r\n case PhysicsJoint.DistanceJoint:\r\n type = \"jointDistance\";\r\n nativeJointData.max = (<DistanceJointData>jointData).maxDistance;\r\n break;\r\n case PhysicsJoint.PrismaticJoint:\r\n type = \"jointPrisme\";\r\n break;\r\n case PhysicsJoint.SliderJoint:\r\n type = \"jointSlide\";\r\n break;\r\n case PhysicsJoint.WheelJoint:\r\n type = \"jointWheel\";\r\n break;\r\n case PhysicsJoint.HingeJoint:\r\n default:\r\n type = \"jointHinge\";\r\n break;\r\n }\r\n nativeJointData.type = type;\r\n impostorJoint.joint.physicsJoint = this.world.add(nativeJointData);\r\n }\r\n\r\n public removeJoint(impostorJoint: PhysicsImpostorJoint) {\r\n //Bug in Oimo prevents us from disposing a joint in the playground\r\n //joint.joint.physicsJoint.dispose();\r\n //So we will bruteforce it!\r\n try {\r\n this.world.removeJoint(impostorJoint.joint.physicsJoint);\r\n } catch (e) {\r\n Logger.Warn(e);\r\n }\r\n }\r\n\r\n public isSupported(): boolean {\r\n return this.BJSOIMO !== undefined;\r\n }\r\n\r\n public setTransformationFromPhysicsBody(impostor: PhysicsImpostor) {\r\n if (!impostor.physicsBody.sleeping) {\r\n if (impostor.physicsBody.shapes.next) {\r\n let parent = impostor.physicsBody.shapes;\r\n while (parent.next) {\r\n parent = parent.next;\r\n }\r\n impostor.object.position.set(parent.position.x, parent.position.y, parent.position.z);\r\n } else {\r\n const pos = impostor.physicsBody.getPosition();\r\n impostor.object.position.set(pos.x, pos.y, pos.z);\r\n }\r\n\r\n if (impostor.object.rotationQuaternion) {\r\n const quat = impostor.physicsBody.getQuaternion();\r\n impostor.object.rotationQuaternion.set(quat.x, quat.y, quat.z, quat.w);\r\n }\r\n }\r\n }\r\n\r\n public setPhysicsBodyTransformation(impostor: PhysicsImpostor, newPosition: Vector3, newRotation: Quaternion) {\r\n const body = impostor.physicsBody;\r\n // disable bidirectional for compound meshes\r\n if (impostor.physicsBody.shapes.next) {\r\n return;\r\n }\r\n body.position.set(newPosition.x, newPosition.y, newPosition.z);\r\n body.orientation.set(newRotation.x, newRotation.y, newRotation.z, newRotation.w);\r\n body.syncShapes();\r\n body.awake();\r\n }\r\n\r\n /*private _getLastShape(body: any): any {\r\n var lastShape = body.shapes;\r\n while (lastShape.next) {\r\n lastShape = lastShape.next;\r\n }\r\n return lastShape;\r\n }*/\r\n\r\n public setLinearVelocity(impostor: PhysicsImpostor, velocity: Vector3) {\r\n impostor.physicsBody.linearVelocity.set(velocity.x, velocity.y, velocity.z);\r\n }\r\n\r\n public setAngularVelocity(impostor: PhysicsImpostor, velocity: Vector3) {\r\n impostor.physicsBody.angularVelocity.set(velocity.x, velocity.y, velocity.z);\r\n }\r\n\r\n public getLinearVelocity(impostor: PhysicsImpostor): Nullable<Vector3> {\r\n const v = impostor.physicsBody.linearVelocity;\r\n if (!v) {\r\n return null;\r\n }\r\n return new Vector3(v.x, v.y, v.z);\r\n }\r\n public getAngularVelocity(impostor: PhysicsImpostor): Nullable<Vector3> {\r\n const v = impostor.physicsBody.angularVelocity;\r\n if (!v) {\r\n return null;\r\n }\r\n return new Vector3(v.x, v.y, v.z);\r\n }\r\n\r\n public setBodyMass(impostor: PhysicsImpostor, mass: number) {\r\n const staticBody: boolean = mass === 0;\r\n //this will actually set the body's density and not its mass.\r\n //But this is how oimo treats the mass variable.\r\n impostor.physicsBody.shapes.density = staticBody ? 1 : mass;\r\n impostor.physicsBody.setupMass(staticBody ? 0x2 : 0x1);\r\n }\r\n\r\n public getBodyMass(impostor: PhysicsImpostor): number {\r\n return impostor.physicsBody.shapes.density;\r\n }\r\n\r\n public getBodyFriction(impostor: PhysicsImpostor): number {\r\n return impostor.physicsBody.shapes.friction;\r\n }\r\n\r\n public setBodyFriction(impostor: PhysicsImpostor, friction: number) {\r\n impostor.physicsBody.shapes.friction = friction;\r\n }\r\n\r\n public getBodyRestitution(impostor: PhysicsImpostor): number {\r\n return impostor.physicsBody.shapes.restitution;\r\n }\r\n\r\n public setBodyRestitution(impostor: PhysicsImpostor, restitution: number) {\r\n impostor.physicsBody.shapes.restitution = restitution;\r\n }\r\n\r\n public sleepBody(impostor: PhysicsImpostor) {\r\n impostor.physicsBody.sleep();\r\n }\r\n\r\n public wakeUpBody(impostor: PhysicsImpostor) {\r\n impostor.physicsBody.awake();\r\n }\r\n\r\n public updateDistanceJoint(joint: PhysicsJoint, maxDistance: number, minDistance?: number) {\r\n joint.physicsJoint.limitMotor.upperLimit = maxDistance;\r\n if (minDistance !== void 0) {\r\n joint.physicsJoint.limitMotor.lowerLimit = minDistance;\r\n }\r\n }\r\n\r\n public setMotor(joint: IMotorEnabledJoint, speed: number, force?: number, motorIndex?: number) {\r\n if (force !== undefined) {\r\n Logger.Warn(\"OimoJS plugin currently has unexpected behavior when using setMotor with force parameter\");\r\n } else {\r\n force = 1e6;\r\n }\r\n speed *= -1;\r\n\r\n //TODO separate rotational and transational motors.\r\n const motor = motorIndex\r\n ? joint.physicsJoint.rotationalLimitMotor2\r\n : joint.physicsJoint.rotationalLimitMotor1 || joint.physicsJoint.rotationalLimitMotor || joint.physicsJoint.limitMotor;\r\n if (motor) {\r\n motor.setMotor(speed, force);\r\n }\r\n }\r\n\r\n public setLimit(joint: IMotorEnabledJoint, upperLimit: number, lowerLimit?: number, motorIndex?: number) {\r\n //TODO separate rotational and transational motors.\r\n const motor = motorIndex\r\n ? joint.physicsJoint.rotationalLimitMotor2\r\n : joint.physicsJoint.rotationalLimitMotor1 || joint.physicsJoint.rotationalLimitMotor || joint.physicsJoint.limitMotor;\r\n if (motor) {\r\n motor.setLimit(upperLimit, lowerLimit === void 0 ? -upperLimit : lowerLimit);\r\n }\r\n }\r\n\r\n public syncMeshWithImpostor(mesh: AbstractMesh, impostor: PhysicsImpostor) {\r\n const body = impostor.physicsBody;\r\n\r\n mesh.position.x = body.position.x;\r\n mesh.position.y = body.position.y;\r\n mesh.position.z = body.position.z;\r\n\r\n if (mesh.rotationQuaternion) {\r\n mesh.rotationQuaternion.x = body.orientation.x;\r\n mesh.rotationQuaternion.y = body.orientation.y;\r\n mesh.rotationQuaternion.z = body.orientation.z;\r\n mesh.rotationQuaternion.w = body.orientation.w;\r\n }\r\n }\r\n\r\n public getRadius(impostor: PhysicsImpostor): number {\r\n return impostor.physicsBody.shapes.radius;\r\n }\r\n\r\n public getBoxSizeToRef(impostor: PhysicsImpostor, result: Vector3): void {\r\n const shape = impostor.physicsBody.shapes;\r\n result.x = shape.halfWidth * 2;\r\n result.y = shape.halfHeight * 2;\r\n result.z = shape.halfDepth * 2;\r\n }\r\n\r\n public dispose() {\r\n this.world.clear();\r\n }\r\n\r\n /**\r\n * Does a raycast in the physics world\r\n * @param from when should the ray start?\r\n * @param to when should the ray end?\r\n * @returns PhysicsRaycastResult\r\n */\r\n public raycast(from: Vector3, to: Vector3): PhysicsRaycastResult {\r\n Logger.Warn(\"raycast is not currently supported by the Oimo physics plugin\");\r\n\r\n this._raycastResult.reset(from, to);\r\n\r\n return this._raycastResult;\r\n }\r\n\r\n /**\r\n * Does a raycast in the physics world\r\n * @param from when should the ray start?\r\n * @param to when should the ray end?\r\n * @param result resulting PhysicsRaycastResult\r\n */\r\n public raycastToRef(from: Vector3, to: Vector3, result: PhysicsRaycastResult): void {\r\n Logger.Warn(\"raycast is not currently supported by the Oimo physics plugin\");\r\n\r\n result.reset(from, to);\r\n }\r\n}\r\n"]}
@@ -754,6 +754,7 @@ export class StandardRenderingPipeline extends PostProcessRenderPipeline {
754
754
  pp.onAfterRender = () => {
755
755
  const pixel = scene.getEngine().readPixels(0, 0, 1, 1);
756
756
  const bit_shift = new Vector4(1.0 / (255.0 * 255.0 * 255.0), 1.0 / (255.0 * 255.0), 1.0 / 255.0, 1.0);
757
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises, github/no-then
757
758
  pixel.then((pixel) => {
758
759
  const data = new Uint8Array(pixel.buffer);
759
760
  this._hdrCurrentLuminance = (data[0] * bit_shift.x + data[1] * bit_shift.y + data[2] * bit_shift.z + data[3] * bit_shift.w) / 100.0;