@babylonjs/core 7.12.0 → 7.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (510) hide show
  1. package/Animations/animation.js +1 -2
  2. package/Animations/animation.js.map +1 -1
  3. package/Animations/animationGroupMask.d.ts +1 -1
  4. package/Animations/animationGroupMask.js +2 -2
  5. package/Animations/animationGroupMask.js.map +1 -1
  6. package/Animations/animationKey.d.ts +1 -1
  7. package/Animations/animationKey.js.map +1 -1
  8. package/Behaviors/Meshes/handConstraintBehavior.d.ts +3 -3
  9. package/Behaviors/Meshes/handConstraintBehavior.js +16 -17
  10. package/Behaviors/Meshes/handConstraintBehavior.js.map +1 -1
  11. package/Behaviors/Meshes/sixDofDragBehavior.js +2 -3
  12. package/Behaviors/Meshes/sixDofDragBehavior.js.map +1 -1
  13. package/Bones/bone.js +31 -32
  14. package/Bones/bone.js.map +1 -1
  15. package/Bones/boneIKController.js +5 -6
  16. package/Bones/boneIKController.js.map +1 -1
  17. package/Bones/boneLookController.js +13 -13
  18. package/Bones/boneLookController.js.map +1 -1
  19. package/Cameras/Inputs/freeCameraMouseWheelInput.js +5 -6
  20. package/Cameras/Inputs/freeCameraMouseWheelInput.js.map +1 -1
  21. package/Cameras/Inputs/freeCameraVirtualJoystickInput.js +5 -5
  22. package/Cameras/Inputs/freeCameraVirtualJoystickInput.js.map +1 -1
  23. package/Cameras/VR/vrExperienceHelper.js +8 -10
  24. package/Cameras/VR/vrExperienceHelper.js.map +1 -1
  25. package/Compute/computeEffect.js +2 -3
  26. package/Compute/computeEffect.js.map +1 -1
  27. package/Compute/computeShader.js +19 -20
  28. package/Compute/computeShader.js.map +1 -1
  29. package/Culling/Helper/IBoundingInfoHelperPlatform.d.ts +4 -0
  30. package/Culling/Helper/IBoundingInfoHelperPlatform.js.map +1 -1
  31. package/Culling/Helper/boundingInfoHelper.d.ts +26 -4
  32. package/Culling/Helper/boundingInfoHelper.js +41 -10
  33. package/Culling/Helper/boundingInfoHelper.js.map +1 -1
  34. package/Culling/Helper/computeShaderBoundingHelper.d.ts +12 -3
  35. package/Culling/Helper/computeShaderBoundingHelper.js +164 -76
  36. package/Culling/Helper/computeShaderBoundingHelper.js.map +1 -1
  37. package/Culling/Helper/transformFeedbackBoundingHelper.d.ts +11 -0
  38. package/Culling/Helper/transformFeedbackBoundingHelper.js +46 -14
  39. package/Culling/Helper/transformFeedbackBoundingHelper.js.map +1 -1
  40. package/Debug/debugLayer.d.ts +1 -1
  41. package/Debug/debugLayer.js.map +1 -1
  42. package/Decorators/nodeDecorator.d.ts +1 -1
  43. package/Decorators/nodeDecorator.js +1 -1
  44. package/Decorators/nodeDecorator.js.map +1 -1
  45. package/DeviceInput/InputDevices/deviceEnums.d.ts +5 -5
  46. package/DeviceInput/InputDevices/deviceEnums.js.map +1 -1
  47. package/DeviceInput/eventFactory.js +3 -3
  48. package/DeviceInput/eventFactory.js.map +1 -1
  49. package/Engines/AbstractEngine/abstractEngine.cubeTexture.js +2 -2
  50. package/Engines/AbstractEngine/abstractEngine.cubeTexture.js.map +1 -1
  51. package/Engines/Extensions/engine.computeShader.d.ts +1 -1
  52. package/Engines/Extensions/engine.computeShader.js.map +1 -1
  53. package/Engines/Extensions/engine.cubeTexture.js +2 -2
  54. package/Engines/Extensions/engine.cubeTexture.js.map +1 -1
  55. package/Engines/Extensions/engine.dynamicTexture.js +2 -2
  56. package/Engines/Extensions/engine.dynamicTexture.js.map +1 -1
  57. package/Engines/Extensions/engine.multiRender.js +3 -3
  58. package/Engines/Extensions/engine.multiRender.js.map +1 -1
  59. package/Engines/Extensions/engine.multiview.js +2 -2
  60. package/Engines/Extensions/engine.multiview.js.map +1 -1
  61. package/Engines/Extensions/engine.prefilteredCubeTexture.js +3 -3
  62. package/Engines/Extensions/engine.prefilteredCubeTexture.js.map +1 -1
  63. package/Engines/Extensions/engine.rawTexture.js +4 -4
  64. package/Engines/Extensions/engine.rawTexture.js.map +1 -1
  65. package/Engines/Extensions/engine.renderTarget.js +3 -3
  66. package/Engines/Extensions/engine.renderTarget.js.map +1 -1
  67. package/Engines/Extensions/engine.renderTargetCube.js +2 -2
  68. package/Engines/Extensions/engine.renderTargetCube.js.map +1 -1
  69. package/Engines/Native/nativeShaderProcessors.js +1 -2
  70. package/Engines/Native/nativeShaderProcessors.js.map +1 -1
  71. package/Engines/Processors/shaderProcessor.js +2 -3
  72. package/Engines/Processors/shaderProcessor.js.map +1 -1
  73. package/Engines/WebGL/webGL2ShaderProcessors.js +1 -2
  74. package/Engines/WebGL/webGL2ShaderProcessors.js.map +1 -1
  75. package/Engines/WebGL/webGLShaderProcessors.js +1 -2
  76. package/Engines/WebGL/webGLShaderProcessors.js.map +1 -1
  77. package/Engines/WebGPU/Extensions/engine.computeShader.js +1 -2
  78. package/Engines/WebGPU/Extensions/engine.computeShader.js.map +1 -1
  79. package/Engines/WebGPU/Extensions/engine.cubeTexture.js +2 -2
  80. package/Engines/WebGPU/Extensions/engine.cubeTexture.js.map +1 -1
  81. package/Engines/WebGPU/Extensions/engine.dynamicTexture.js +2 -2
  82. package/Engines/WebGPU/Extensions/engine.dynamicTexture.js.map +1 -1
  83. package/Engines/WebGPU/Extensions/engine.multiRender.js +2 -2
  84. package/Engines/WebGPU/Extensions/engine.multiRender.js.map +1 -1
  85. package/Engines/WebGPU/Extensions/engine.rawTexture.js +5 -5
  86. package/Engines/WebGPU/Extensions/engine.rawTexture.js.map +1 -1
  87. package/Engines/WebGPU/Extensions/engine.renderTarget.js +3 -3
  88. package/Engines/WebGPU/Extensions/engine.renderTarget.js.map +1 -1
  89. package/Engines/WebGPU/Extensions/engine.renderTargetCube.js +2 -2
  90. package/Engines/WebGPU/Extensions/engine.renderTargetCube.js.map +1 -1
  91. package/Engines/WebGPU/webgpuBufferManager.js +1 -1
  92. package/Engines/WebGPU/webgpuBufferManager.js.map +1 -1
  93. package/Engines/WebGPU/webgpuCacheRenderPipeline.js +81 -82
  94. package/Engines/WebGPU/webgpuCacheRenderPipeline.js.map +1 -1
  95. package/Engines/WebGPU/webgpuCacheSampler.js +60 -64
  96. package/Engines/WebGPU/webgpuCacheSampler.js.map +1 -1
  97. package/Engines/WebGPU/webgpuClearQuad.js +1 -2
  98. package/Engines/WebGPU/webgpuClearQuad.js.map +1 -1
  99. package/Engines/WebGPU/webgpuComputeContext.js +13 -15
  100. package/Engines/WebGPU/webgpuComputeContext.js.map +1 -1
  101. package/Engines/WebGPU/webgpuConstants.d.ts +39 -39
  102. package/Engines/WebGPU/webgpuConstants.js.map +1 -1
  103. package/Engines/WebGPU/webgpuHardwareTexture.js +6 -8
  104. package/Engines/WebGPU/webgpuHardwareTexture.js.map +1 -1
  105. package/Engines/WebGPU/webgpuOcclusionQuery.js +1 -2
  106. package/Engines/WebGPU/webgpuOcclusionQuery.js.map +1 -1
  107. package/Engines/WebGPU/webgpuQuerySet.js +3 -3
  108. package/Engines/WebGPU/webgpuQuerySet.js.map +1 -1
  109. package/Engines/WebGPU/webgpuShaderProcessor.js +15 -19
  110. package/Engines/WebGPU/webgpuShaderProcessor.js.map +1 -1
  111. package/Engines/WebGPU/webgpuShaderProcessorsGLSL.js +8 -10
  112. package/Engines/WebGPU/webgpuShaderProcessorsGLSL.js.map +1 -1
  113. package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js +26 -28
  114. package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js.map +1 -1
  115. package/Engines/WebGPU/webgpuTextureHelper.js +413 -416
  116. package/Engines/WebGPU/webgpuTextureHelper.js.map +1 -1
  117. package/Engines/WebGPU/webgpuTextureManager.js +50 -51
  118. package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
  119. package/Engines/WebGPU/webgpuTimestampQuery.js +1 -2
  120. package/Engines/WebGPU/webgpuTimestampQuery.js.map +1 -1
  121. package/Engines/abstractEngine.js +4 -4
  122. package/Engines/abstractEngine.js.map +1 -1
  123. package/Engines/engine.js +2 -2
  124. package/Engines/engine.js.map +1 -1
  125. package/Engines/nativeEngine.js +9 -9
  126. package/Engines/nativeEngine.js.map +1 -1
  127. package/Engines/nullEngine.js +5 -5
  128. package/Engines/nullEngine.js.map +1 -1
  129. package/Engines/renderTargetWrapper.js +1 -2
  130. package/Engines/renderTargetWrapper.js.map +1 -1
  131. package/Engines/shaderStore.js +6 -7
  132. package/Engines/shaderStore.js.map +1 -1
  133. package/Engines/thinEngine.js +4 -5
  134. package/Engines/thinEngine.js.map +1 -1
  135. package/Engines/webgpuEngine.d.ts +11 -0
  136. package/Engines/webgpuEngine.js +91 -72
  137. package/Engines/webgpuEngine.js.map +1 -1
  138. package/Events/deviceInputEvents.d.ts +1 -1
  139. package/Events/deviceInputEvents.js.map +1 -1
  140. package/FlowGraph/flowGraph.d.ts +1 -1
  141. package/FlowGraph/flowGraph.js +5 -5
  142. package/FlowGraph/flowGraph.js.map +1 -1
  143. package/FlowGraph/flowGraphBlock.js +2 -3
  144. package/FlowGraph/flowGraphBlock.js.map +1 -1
  145. package/FlowGraph/flowGraphConnection.d.ts +1 -1
  146. package/FlowGraph/flowGraphConnection.js.map +1 -1
  147. package/FlowGraph/flowGraphDataConnection.js +3 -3
  148. package/FlowGraph/flowGraphDataConnection.js.map +1 -1
  149. package/FlowGraph/flowGraphExecutionBlock.js +2 -3
  150. package/FlowGraph/flowGraphExecutionBlock.js.map +1 -1
  151. package/FlowGraph/flowGraphSignalConnection.js +3 -3
  152. package/FlowGraph/flowGraphSignalConnection.js.map +1 -1
  153. package/Gamepads/dualShockGamepad.d.ts +2 -2
  154. package/Gamepads/dualShockGamepad.js +14 -14
  155. package/Gamepads/dualShockGamepad.js.map +1 -1
  156. package/Gamepads/xboxGamepad.d.ts +2 -2
  157. package/Gamepads/xboxGamepad.js +14 -14
  158. package/Gamepads/xboxGamepad.js.map +1 -1
  159. package/Gizmos/gizmo.d.ts +2 -2
  160. package/Gizmos/gizmo.js +4 -4
  161. package/Gizmos/gizmo.js.map +1 -1
  162. package/Gizmos/gizmoManager.js +2 -2
  163. package/Gizmos/gizmoManager.js.map +1 -1
  164. package/Gizmos/scaleGizmo.js +3 -3
  165. package/Gizmos/scaleGizmo.js.map +1 -1
  166. package/Loading/sceneLoader.d.ts +1 -1
  167. package/Loading/sceneLoader.js +6 -6
  168. package/Loading/sceneLoader.js.map +1 -1
  169. package/Materials/GreasedLine/greasedLineMaterialInterfaces.d.ts +3 -3
  170. package/Materials/GreasedLine/greasedLineMaterialInterfaces.js.map +1 -1
  171. package/Materials/GreasedLine/greasedLinePluginMaterial.js +10 -11
  172. package/Materials/GreasedLine/greasedLinePluginMaterial.js.map +1 -1
  173. package/Materials/GreasedLine/greasedLineSimpleMaterial.js +8 -9
  174. package/Materials/GreasedLine/greasedLineSimpleMaterial.js.map +1 -1
  175. package/Materials/Node/Blocks/Dual/currentScreenBlock.js +3 -4
  176. package/Materials/Node/Blocks/Dual/currentScreenBlock.js.map +1 -1
  177. package/Materials/Node/Blocks/Dual/fogBlock.js +2 -3
  178. package/Materials/Node/Blocks/Dual/fogBlock.js.map +1 -1
  179. package/Materials/Node/Blocks/Dual/imageSourceBlock.js +1 -2
  180. package/Materials/Node/Blocks/Dual/imageSourceBlock.js.map +1 -1
  181. package/Materials/Node/Blocks/Dual/lightBlock.js +5 -6
  182. package/Materials/Node/Blocks/Dual/lightBlock.js.map +1 -1
  183. package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js +4 -5
  184. package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js.map +1 -1
  185. package/Materials/Node/Blocks/Dual/sceneDepthBlock.js +7 -8
  186. package/Materials/Node/Blocks/Dual/sceneDepthBlock.js.map +1 -1
  187. package/Materials/Node/Blocks/Dual/textureBlock.js +4 -6
  188. package/Materials/Node/Blocks/Dual/textureBlock.js.map +1 -1
  189. package/Materials/Node/Blocks/Fragment/TBNBlock.js +2 -4
  190. package/Materials/Node/Blocks/Fragment/TBNBlock.js.map +1 -1
  191. package/Materials/Node/Blocks/Fragment/derivativeBlock.js +1 -2
  192. package/Materials/Node/Blocks/Fragment/derivativeBlock.js.map +1 -1
  193. package/Materials/Node/Blocks/Fragment/fragCoordBlock.js +1 -2
  194. package/Materials/Node/Blocks/Fragment/fragCoordBlock.js.map +1 -1
  195. package/Materials/Node/Blocks/Fragment/fragDepthBlock.js +1 -2
  196. package/Materials/Node/Blocks/Fragment/fragDepthBlock.js.map +1 -1
  197. package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js +5 -6
  198. package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js.map +1 -1
  199. package/Materials/Node/Blocks/Fragment/frontFacingBlock.js +1 -2
  200. package/Materials/Node/Blocks/Fragment/frontFacingBlock.js.map +1 -1
  201. package/Materials/Node/Blocks/Fragment/heightToNormalBlock.js +5 -6
  202. package/Materials/Node/Blocks/Fragment/heightToNormalBlock.js.map +1 -1
  203. package/Materials/Node/Blocks/Fragment/imageProcessingBlock.js +3 -4
  204. package/Materials/Node/Blocks/Fragment/imageProcessingBlock.js.map +1 -1
  205. package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js +7 -9
  206. package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js.map +1 -1
  207. package/Materials/Node/Blocks/Fragment/screenSizeBlock.js +1 -2
  208. package/Materials/Node/Blocks/Fragment/screenSizeBlock.js.map +1 -1
  209. package/Materials/Node/Blocks/Input/inputBlock.js +19 -21
  210. package/Materials/Node/Blocks/Input/inputBlock.js.map +1 -1
  211. package/Materials/Node/Blocks/Input/prePassTextureBlock.js +3 -4
  212. package/Materials/Node/Blocks/Input/prePassTextureBlock.js.map +1 -1
  213. package/Materials/Node/Blocks/PBR/anisotropyBlock.js +2 -3
  214. package/Materials/Node/Blocks/PBR/anisotropyBlock.js.map +1 -1
  215. package/Materials/Node/Blocks/PBR/clearCoatBlock.js +4 -5
  216. package/Materials/Node/Blocks/PBR/clearCoatBlock.js.map +1 -1
  217. package/Materials/Node/Blocks/PBR/iridescenceBlock.js +1 -2
  218. package/Materials/Node/Blocks/PBR/iridescenceBlock.js.map +1 -1
  219. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js +28 -29
  220. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js.map +1 -1
  221. package/Materials/Node/Blocks/PBR/reflectionBlock.js +4 -5
  222. package/Materials/Node/Blocks/PBR/reflectionBlock.js.map +1 -1
  223. package/Materials/Node/Blocks/PBR/refractionBlock.js +5 -6
  224. package/Materials/Node/Blocks/PBR/refractionBlock.js.map +1 -1
  225. package/Materials/Node/Blocks/PBR/sheenBlock.js +4 -5
  226. package/Materials/Node/Blocks/PBR/sheenBlock.js.map +1 -1
  227. package/Materials/Node/Blocks/PBR/subSurfaceBlock.js +2 -3
  228. package/Materials/Node/Blocks/PBR/subSurfaceBlock.js.map +1 -1
  229. package/Materials/Node/Blocks/Vertex/instancesBlock.js +1 -2
  230. package/Materials/Node/Blocks/Vertex/instancesBlock.js.map +1 -1
  231. package/Materials/Node/Blocks/Vertex/lightInformationBlock.js +1 -2
  232. package/Materials/Node/Blocks/Vertex/lightInformationBlock.js.map +1 -1
  233. package/Materials/Node/Blocks/Vertex/morphTargetsBlock.js +1 -2
  234. package/Materials/Node/Blocks/Vertex/morphTargetsBlock.js.map +1 -1
  235. package/Materials/Node/Blocks/Vertex/vertexOutputBlock.js +1 -2
  236. package/Materials/Node/Blocks/Vertex/vertexOutputBlock.js.map +1 -1
  237. package/Materials/Node/Blocks/arcTan2Block.js +1 -2
  238. package/Materials/Node/Blocks/arcTan2Block.js.map +1 -1
  239. package/Materials/Node/Blocks/biPlanarBlock.js +3 -4
  240. package/Materials/Node/Blocks/biPlanarBlock.js.map +1 -1
  241. package/Materials/Node/Blocks/clampBlock.js +4 -5
  242. package/Materials/Node/Blocks/clampBlock.js.map +1 -1
  243. package/Materials/Node/Blocks/cloudBlock.js +3 -4
  244. package/Materials/Node/Blocks/cloudBlock.js.map +1 -1
  245. package/Materials/Node/Blocks/curveBlock.js +1 -2
  246. package/Materials/Node/Blocks/curveBlock.js.map +1 -1
  247. package/Materials/Node/Blocks/customBlock.js +1 -2
  248. package/Materials/Node/Blocks/customBlock.js.map +1 -1
  249. package/Materials/Node/Blocks/matrixBuilderBlock.js +1 -2
  250. package/Materials/Node/Blocks/matrixBuilderBlock.js.map +1 -1
  251. package/Materials/Node/Blocks/meshAttributeExistsBlock.d.ts +1 -1
  252. package/Materials/Node/Blocks/meshAttributeExistsBlock.js +35 -35
  253. package/Materials/Node/Blocks/meshAttributeExistsBlock.js.map +1 -1
  254. package/Materials/Node/Blocks/modBlock.js +1 -2
  255. package/Materials/Node/Blocks/modBlock.js.map +1 -1
  256. package/Materials/Node/Blocks/remapBlock.js +3 -3
  257. package/Materials/Node/Blocks/remapBlock.js.map +1 -1
  258. package/Materials/Node/Blocks/simplexPerlin3DBlock.js +1 -2
  259. package/Materials/Node/Blocks/simplexPerlin3DBlock.js.map +1 -1
  260. package/Materials/Node/Blocks/transformBlock.js +1 -2
  261. package/Materials/Node/Blocks/transformBlock.js.map +1 -1
  262. package/Materials/Node/Blocks/triPlanarBlock.js +10 -12
  263. package/Materials/Node/Blocks/triPlanarBlock.js.map +1 -1
  264. package/Materials/Node/Blocks/voronoiNoiseBlock.js +3 -4
  265. package/Materials/Node/Blocks/voronoiNoiseBlock.js.map +1 -1
  266. package/Materials/Node/Blocks/waveBlock.d.ts +1 -1
  267. package/Materials/Node/Blocks/waveBlock.js +4 -4
  268. package/Materials/Node/Blocks/waveBlock.js.map +1 -1
  269. package/Materials/Node/Blocks/worleyNoise3DBlock.js +3 -4
  270. package/Materials/Node/Blocks/worleyNoise3DBlock.js.map +1 -1
  271. package/Materials/Node/Enums/nodeMaterialBlockConnectionPointMode.d.ts +1 -1
  272. package/Materials/Node/Enums/nodeMaterialBlockConnectionPointMode.js.map +1 -1
  273. package/Materials/Node/nodeMaterial.js +3 -4
  274. package/Materials/Node/nodeMaterial.js.map +1 -1
  275. package/Materials/Node/nodeMaterialBlock.js +5 -6
  276. package/Materials/Node/nodeMaterialBlock.js.map +1 -1
  277. package/Materials/Node/nodeMaterialBlockConnectionPoint.d.ts +2 -2
  278. package/Materials/Node/nodeMaterialBlockConnectionPoint.js +10 -10
  279. package/Materials/Node/nodeMaterialBlockConnectionPoint.js.map +1 -1
  280. package/Materials/Node/nodeMaterialBuildState.js +18 -19
  281. package/Materials/Node/nodeMaterialBuildState.js.map +1 -1
  282. package/Materials/Node/nodeMaterialConnectionPointCustomObject.js +3 -3
  283. package/Materials/Node/nodeMaterialConnectionPointCustomObject.js.map +1 -1
  284. package/Materials/PBR/pbrBaseMaterial.js +3 -4
  285. package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
  286. package/Materials/Textures/internalTexture.d.ts +1 -1
  287. package/Materials/Textures/internalTexture.js +13 -13
  288. package/Materials/Textures/internalTexture.js.map +1 -1
  289. package/Materials/Textures/ktx2decoderTypes.d.ts +1 -1
  290. package/Materials/Textures/ktx2decoderTypes.js.map +1 -1
  291. package/Materials/Textures/rawCubeTexture.js +1 -2
  292. package/Materials/Textures/rawCubeTexture.js.map +1 -1
  293. package/Materials/effect.functions.js +2 -3
  294. package/Materials/effect.functions.js.map +1 -1
  295. package/Materials/effect.js +3 -4
  296. package/Materials/effect.js.map +1 -1
  297. package/Materials/effect.webgl.functions.js +1 -2
  298. package/Materials/effect.webgl.functions.js.map +1 -1
  299. package/Materials/material.js +7 -9
  300. package/Materials/material.js.map +1 -1
  301. package/Materials/materialPluginEvent.d.ts +1 -1
  302. package/Materials/materialPluginEvent.js.map +1 -1
  303. package/Materials/materialPluginManager.js +9 -11
  304. package/Materials/materialPluginManager.js.map +1 -1
  305. package/Materials/meshDebugPluginMaterial.d.ts +1 -1
  306. package/Materials/meshDebugPluginMaterial.js +2 -2
  307. package/Materials/meshDebugPluginMaterial.js.map +1 -1
  308. package/Materials/shaderLanguage.d.ts +1 -1
  309. package/Materials/shaderLanguage.js.map +1 -1
  310. package/Materials/shadowDepthWrapper.js +1 -2
  311. package/Materials/shadowDepthWrapper.js.map +1 -1
  312. package/Materials/standardMaterial.js +2 -3
  313. package/Materials/standardMaterial.js.map +1 -1
  314. package/Maths/math.axis.d.ts +2 -2
  315. package/Maths/math.axis.js.map +1 -1
  316. package/Maths/math.path.d.ts +1 -1
  317. package/Maths/math.path.js +3 -3
  318. package/Maths/math.path.js.map +1 -1
  319. package/Meshes/Builders/greasedLineBuilder.d.ts +2 -2
  320. package/Meshes/Builders/greasedLineBuilder.js +21 -23
  321. package/Meshes/Builders/greasedLineBuilder.js.map +1 -1
  322. package/Meshes/GreasedLine/greasedLineBaseMesh.d.ts +3 -3
  323. package/Meshes/GreasedLine/greasedLineBaseMesh.js.map +1 -1
  324. package/Meshes/GreasedLine/greasedLineRibbonMesh.js +14 -14
  325. package/Meshes/GreasedLine/greasedLineRibbonMesh.js.map +1 -1
  326. package/Meshes/Node/Blocks/Instances/instantiateBaseBlock.js +2 -2
  327. package/Meshes/Node/Blocks/Instances/instantiateBaseBlock.js.map +1 -1
  328. package/Meshes/Node/Blocks/Instances/instantiateOnFacesBlock.js +2 -2
  329. package/Meshes/Node/Blocks/Instances/instantiateOnFacesBlock.js.map +1 -1
  330. package/Meshes/Node/Blocks/Instances/instantiateOnVerticesBlock.js +3 -3
  331. package/Meshes/Node/Blocks/Instances/instantiateOnVerticesBlock.js.map +1 -1
  332. package/Meshes/Node/Blocks/Instances/instantiateOnVolumeBlock.js +3 -3
  333. package/Meshes/Node/Blocks/Instances/instantiateOnVolumeBlock.js.map +1 -1
  334. package/Meshes/Node/Blocks/Set/setColorsBlock.js +2 -2
  335. package/Meshes/Node/Blocks/Set/setColorsBlock.js.map +1 -1
  336. package/Meshes/Node/Blocks/Set/setMaterialIDBlock.js +2 -2
  337. package/Meshes/Node/Blocks/Set/setMaterialIDBlock.js.map +1 -1
  338. package/Meshes/Node/Blocks/Set/setNormalsBlock.js +2 -2
  339. package/Meshes/Node/Blocks/Set/setNormalsBlock.js.map +1 -1
  340. package/Meshes/Node/Blocks/Set/setPositionsBlock.js +2 -2
  341. package/Meshes/Node/Blocks/Set/setPositionsBlock.js.map +1 -1
  342. package/Meshes/Node/Blocks/Set/setTangentsBlock.js +2 -2
  343. package/Meshes/Node/Blocks/Set/setTangentsBlock.js.map +1 -1
  344. package/Meshes/Node/Blocks/Set/setUVsBlock.js +3 -3
  345. package/Meshes/Node/Blocks/Set/setUVsBlock.js.map +1 -1
  346. package/Meshes/Node/Blocks/Sources/boxBlock.js +2 -2
  347. package/Meshes/Node/Blocks/Sources/boxBlock.js.map +1 -1
  348. package/Meshes/Node/Blocks/Sources/capsuleBlock.js +2 -2
  349. package/Meshes/Node/Blocks/Sources/capsuleBlock.js.map +1 -1
  350. package/Meshes/Node/Blocks/Sources/cylinderBlock.js +2 -2
  351. package/Meshes/Node/Blocks/Sources/cylinderBlock.js.map +1 -1
  352. package/Meshes/Node/Blocks/Sources/discBlock.js +2 -2
  353. package/Meshes/Node/Blocks/Sources/discBlock.js.map +1 -1
  354. package/Meshes/Node/Blocks/Sources/gridBlock.js +2 -2
  355. package/Meshes/Node/Blocks/Sources/gridBlock.js.map +1 -1
  356. package/Meshes/Node/Blocks/Sources/icoSphereBlock.js +2 -2
  357. package/Meshes/Node/Blocks/Sources/icoSphereBlock.js.map +1 -1
  358. package/Meshes/Node/Blocks/Sources/meshBlock.js +2 -2
  359. package/Meshes/Node/Blocks/Sources/meshBlock.js.map +1 -1
  360. package/Meshes/Node/Blocks/Sources/planeBlock.js +2 -2
  361. package/Meshes/Node/Blocks/Sources/planeBlock.js.map +1 -1
  362. package/Meshes/Node/Blocks/Sources/sphereBlock.js +2 -2
  363. package/Meshes/Node/Blocks/Sources/sphereBlock.js.map +1 -1
  364. package/Meshes/Node/Blocks/Sources/torusBlock.js +2 -2
  365. package/Meshes/Node/Blocks/Sources/torusBlock.js.map +1 -1
  366. package/Meshes/Node/Blocks/Textures/geometryTextureBlock.js +2 -2
  367. package/Meshes/Node/Blocks/Textures/geometryTextureBlock.js.map +1 -1
  368. package/Meshes/Node/Blocks/Textures/geometryTextureFetchBlock.js +2 -2
  369. package/Meshes/Node/Blocks/Textures/geometryTextureFetchBlock.js.map +1 -1
  370. package/Meshes/Node/Blocks/booleanGeometryBlock.js +3 -3
  371. package/Meshes/Node/Blocks/booleanGeometryBlock.js.map +1 -1
  372. package/Meshes/Node/Blocks/conditionBlock.js +2 -2
  373. package/Meshes/Node/Blocks/conditionBlock.js.map +1 -1
  374. package/Meshes/Node/Blocks/geometryClampBlock.js +3 -3
  375. package/Meshes/Node/Blocks/geometryClampBlock.js.map +1 -1
  376. package/Meshes/Node/Blocks/geometryCollectionBlock.js +2 -2
  377. package/Meshes/Node/Blocks/geometryCollectionBlock.js.map +1 -1
  378. package/Meshes/Node/Blocks/geometryCurveBlock.js +2 -2
  379. package/Meshes/Node/Blocks/geometryCurveBlock.js.map +1 -1
  380. package/Meshes/Node/Blocks/geometryOptimizeBlock.js +3 -3
  381. package/Meshes/Node/Blocks/geometryOptimizeBlock.js.map +1 -1
  382. package/Meshes/Node/Blocks/geometryTransformBlock.js +2 -2
  383. package/Meshes/Node/Blocks/geometryTransformBlock.js.map +1 -1
  384. package/Meshes/Node/Blocks/geometryTrigonometryBlock.js +2 -2
  385. package/Meshes/Node/Blocks/geometryTrigonometryBlock.js.map +1 -1
  386. package/Meshes/Node/Blocks/mappingBlock.js +2 -2
  387. package/Meshes/Node/Blocks/mappingBlock.js.map +1 -1
  388. package/Meshes/Node/Blocks/mathBlock.js +2 -2
  389. package/Meshes/Node/Blocks/mathBlock.js.map +1 -1
  390. package/Meshes/Node/Blocks/mergeGeometryBlock.js +2 -2
  391. package/Meshes/Node/Blocks/mergeGeometryBlock.js.map +1 -1
  392. package/Meshes/Node/Blocks/randomBlock.js +2 -2
  393. package/Meshes/Node/Blocks/randomBlock.js.map +1 -1
  394. package/Meshes/Node/nodeGeometryBlock.js +3 -3
  395. package/Meshes/Node/nodeGeometryBlock.js.map +1 -1
  396. package/Meshes/Node/nodeGeometryBlockConnectionPoint.d.ts +2 -2
  397. package/Meshes/Node/nodeGeometryBlockConnectionPoint.js +7 -7
  398. package/Meshes/Node/nodeGeometryBlockConnectionPoint.js.map +1 -1
  399. package/Meshes/abstractMesh.js +2 -3
  400. package/Meshes/abstractMesh.js.map +1 -1
  401. package/Meshes/mesh.js +1 -2
  402. package/Meshes/mesh.js.map +1 -1
  403. package/Meshes/meshSimplification.d.ts +1 -1
  404. package/Meshes/meshSimplification.js +1 -1
  405. package/Meshes/meshSimplification.js.map +1 -1
  406. package/Meshes/meshSimplificationSceneComponent.js +2 -2
  407. package/Meshes/meshSimplificationSceneComponent.js.map +1 -1
  408. package/Meshes/transformNode.js +7 -8
  409. package/Meshes/transformNode.js.map +1 -1
  410. package/Misc/assetsManager.d.ts +1 -1
  411. package/Misc/assetsManager.js +9 -9
  412. package/Misc/assetsManager.js.map +1 -1
  413. package/Misc/basis.js +2 -2
  414. package/Misc/basis.js.map +1 -1
  415. package/Misc/copyTextureToTexture.d.ts +1 -1
  416. package/Misc/copyTextureToTexture.js +1 -1
  417. package/Misc/copyTextureToTexture.js.map +1 -1
  418. package/Misc/environmentTextureTools.js +3 -3
  419. package/Misc/environmentTextureTools.js.map +1 -1
  420. package/Misc/iInspectable.d.ts +1 -1
  421. package/Misc/iInspectable.js.map +1 -1
  422. package/Misc/khronosTextureContainer2.js +2 -2
  423. package/Misc/khronosTextureContainer2.js.map +1 -1
  424. package/Misc/timer.d.ts +1 -1
  425. package/Misc/timer.js +5 -5
  426. package/Misc/timer.js.map +1 -1
  427. package/Misc/virtualJoystick.d.ts +1 -1
  428. package/Misc/virtualJoystick.js +16 -16
  429. package/Misc/virtualJoystick.js.map +1 -1
  430. package/Particles/particleSystem.js +3 -3
  431. package/Particles/particleSystem.js.map +1 -1
  432. package/Particles/particleSystemComponent.js +1 -2
  433. package/Particles/particleSystemComponent.js.map +1 -1
  434. package/Particles/pointsCloudSystem.d.ts +1 -1
  435. package/Particles/pointsCloudSystem.js +14 -14
  436. package/Particles/pointsCloudSystem.js.map +1 -1
  437. package/Particles/subEmitter.d.ts +1 -1
  438. package/Particles/subEmitter.js +1 -1
  439. package/Particles/subEmitter.js.map +1 -1
  440. package/Physics/physicsHelper.d.ts +2 -2
  441. package/Physics/physicsHelper.js +6 -7
  442. package/Physics/physicsHelper.js.map +1 -1
  443. package/Physics/v1/physicsImpostor.js +4 -5
  444. package/Physics/v1/physicsImpostor.js.map +1 -1
  445. package/Physics/v2/IPhysicsEnginePlugin.d.ts +16 -8
  446. package/Physics/v2/IPhysicsEnginePlugin.js +9 -0
  447. package/Physics/v2/IPhysicsEnginePlugin.js.map +1 -1
  448. package/Physics/v2/Plugins/havokPlugin.js +96 -79
  449. package/Physics/v2/Plugins/havokPlugin.js.map +1 -1
  450. package/Physics/v2/physicsAggregate.js +8 -9
  451. package/Physics/v2/physicsAggregate.js.map +1 -1
  452. package/Physics/v2/physicsBody.d.ts +14 -2
  453. package/Physics/v2/physicsBody.js +30 -11
  454. package/Physics/v2/physicsBody.js.map +1 -1
  455. package/Physics/v2/physicsConstraint.js +8 -9
  456. package/Physics/v2/physicsConstraint.js.map +1 -1
  457. package/Physics/v2/physicsMaterial.d.ts +1 -1
  458. package/Physics/v2/physicsMaterial.js.map +1 -1
  459. package/Physics/v2/physicsShape.js +9 -10
  460. package/Physics/v2/physicsShape.js.map +1 -1
  461. package/Physics/v2/ragdoll.js +11 -12
  462. package/Physics/v2/ragdoll.js.map +1 -1
  463. package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js +2 -2
  464. package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js.map +1 -1
  465. package/PostProcesses/depthOfFieldEffect.d.ts +1 -1
  466. package/PostProcesses/depthOfFieldEffect.js +3 -3
  467. package/PostProcesses/depthOfFieldEffect.js.map +1 -1
  468. package/PostProcesses/postProcess.js +2 -3
  469. package/PostProcesses/postProcess.js.map +1 -1
  470. package/PostProcesses/tonemapPostProcess.d.ts +1 -1
  471. package/PostProcesses/tonemapPostProcess.js +4 -4
  472. package/PostProcesses/tonemapPostProcess.js.map +1 -1
  473. package/Rendering/fluidRenderer/fluidRenderingTargetRenderer.d.ts +1 -1
  474. package/Rendering/fluidRenderer/fluidRenderingTargetRenderer.js +10 -10
  475. package/Rendering/fluidRenderer/fluidRenderingTargetRenderer.js.map +1 -1
  476. package/Shaders/spriteMap.fragment.js +3 -2
  477. package/Shaders/spriteMap.fragment.js.map +1 -1
  478. package/ShadersWGSL/boundingInfo.compute.js +8 -8
  479. package/ShadersWGSL/boundingInfo.compute.js.map +1 -1
  480. package/XR/features/WebXRDepthSensing.js +2 -2
  481. package/XR/features/WebXRDepthSensing.js.map +1 -1
  482. package/XR/features/WebXRHandTracking.d.ts +2 -2
  483. package/XR/features/WebXRHandTracking.js +76 -76
  484. package/XR/features/WebXRHandTracking.js.map +1 -1
  485. package/XR/features/WebXRLightEstimation.js +2 -2
  486. package/XR/features/WebXRLightEstimation.js.map +1 -1
  487. package/XR/features/WebXRNearInteraction.d.ts +1 -1
  488. package/XR/features/WebXRNearInteraction.js +5 -5
  489. package/XR/features/WebXRNearInteraction.js.map +1 -1
  490. package/XR/features/WebXRRawCameraAccess.js +2 -2
  491. package/XR/features/WebXRRawCameraAccess.js.map +1 -1
  492. package/XR/motionController/webXRProfiledMotionController.js +2 -2
  493. package/XR/motionController/webXRProfiledMotionController.js.map +1 -1
  494. package/XR/webXRCamera.js +3 -4
  495. package/XR/webXRCamera.js.map +1 -1
  496. package/XR/webXREnterExitUI.js +3 -4
  497. package/XR/webXREnterExitUI.js.map +1 -1
  498. package/XR/webXRExperienceHelper.js +12 -13
  499. package/XR/webXRExperienceHelper.js.map +1 -1
  500. package/XR/webXRManagedOutputCanvas.d.ts +1 -1
  501. package/XR/webXRManagedOutputCanvas.js +15 -6
  502. package/XR/webXRManagedOutputCanvas.js.map +1 -1
  503. package/XR/webXRRenderTargetTextureProvider.js +2 -2
  504. package/XR/webXRRenderTargetTextureProvider.js.map +1 -1
  505. package/XR/webXRTypes.d.ts +2 -2
  506. package/XR/webXRTypes.js.map +1 -1
  507. package/package.json +1 -1
  508. package/scene.d.ts +1 -1
  509. package/scene.js +4 -4
  510. package/scene.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"physicsConstraint.js","sourceRoot":"","sources":["../../../../../dev/core/src/Physics/v2/physicsConstraint.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAEtF;;;;GAIG;AACH,MAAM,OAAO,iBAAiB;IAiB1B;;;;;;;;OAQG;IACH,YAAY,IAA2B,EAAE,OAAoC,EAAE,KAAY;QAzB3F;;WAEG;QACI,gBAAW,GAAQ,SAAS,CAAC;QAuBhC,IAAI,CAAC,KAAK,EAAE;YACR,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;SAC1E;QACD,MAAM,aAAa,GAAG,KAAK,CAAC,gBAAgB,EAAE,CAAC;QAC/C,IAAI,CAAC,aAAa,EAAE;YAChB,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;SACnD;QACD,IAAI,aAAa,CAAC,gBAAgB,EAAE,IAAI,CAAC,EAAE;YACvC,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;SACvE;QACD,MAAM,aAAa,GAAG,aAAa,CAAC,gBAAgB,EAAE,CAAC;QACvD,IAAI,CAAC,aAAa,EAAE;YAChB,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;SACnD;QAED,IAAI,CAAC,cAAc,GAAG,aAAuC,CAAC;QAC9D,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACtB,CAAC;IAED;;;;;OAKG;IACH,IAAW,IAAI;QACX,OAAO,IAAI,CAAC,KAAK,CAAC;IACtB,CAAC;IAED;;;;;OAKG;IACH,IAAW,OAAO;QACd,OAAO,IAAI,CAAC,QAAQ,CAAC;IACzB,CAAC;IAED;;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AAc,EAAE,WAAmB,EAAE,WAAmB,EAAE,SAAiB,EAAE,OAAe,EAAE,KAAY;QACpK,KAAK,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,qBAAqB,CAAC,eAAe,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC;IACxK,CAAC;CACJ","sourcesContent":["import type { Scene } from \"../../scene\";\r\nimport type { Vector3 } from \"../../Maths/math.vector\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { IPhysicsEnginePluginV2, PhysicsConstraintParameters, PhysicsConstraintAxisLimitMode, PhysicsConstraintMotorType, ConstrainedBodyPair } from \"./IPhysicsEnginePlugin\";\r\nimport { PhysicsConstraintAxis, PhysicsConstraintType } from \"./IPhysicsEnginePlugin\";\r\n\r\n/**\r\n * This is a holder class for the physics constraint created by the physics plugin\r\n * It holds a set of functions to control the underlying constraint\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine\r\n */\r\nexport class PhysicsConstraint {\r\n /**\r\n * V2 Physics plugin private data for a physics material\r\n */\r\n public _pluginData: any = undefined;\r\n /**\r\n * The V2 plugin used to create and manage this Physics Body\r\n */\r\n protected _physicsPlugin: IPhysicsEnginePluginV2;\r\n protected _options: PhysicsConstraintParameters;\r\n protected _type: PhysicsConstraintType;\r\n /**\r\n * @internal\r\n * The internal options that were used to init the constraint\r\n */\r\n public _initOptions?: PhysicsConstraintParameters;\r\n\r\n /**\r\n * Constructs a new constraint for the physics constraint.\r\n * @param type The type of constraint to create.\r\n * @param options The options for the constraint.\r\n * @param scene The scene the constraint belongs to.\r\n *\r\n * This code is useful for creating a new constraint for the physics engine. It checks if the scene has a physics engine, and if the plugin version is correct.\r\n * If all checks pass, it initializes the constraint with the given type and options.\r\n */\r\n constructor(type: PhysicsConstraintType, options: PhysicsConstraintParameters, scene: Scene) {\r\n if (!scene) {\r\n throw new Error(\"Missing scene parameter for constraint constructor.\");\r\n }\r\n const physicsEngine = scene.getPhysicsEngine();\r\n if (!physicsEngine) {\r\n throw new Error(\"No Physics Engine available.\");\r\n }\r\n if (physicsEngine.getPluginVersion() != 2) {\r\n throw new Error(\"Plugin version is incorrect. Expected version 2.\");\r\n }\r\n const physicsPlugin = physicsEngine.getPhysicsPlugin();\r\n if (!physicsPlugin) {\r\n throw new Error(\"No Physics Plugin available.\");\r\n }\r\n\r\n this._physicsPlugin = physicsPlugin as IPhysicsEnginePluginV2;\r\n this._options = options;\r\n this._type = type;\r\n }\r\n\r\n /**\r\n * Gets the type of the constraint.\r\n *\r\n * @returns The type of the constraint.\r\n *\r\n */\r\n public get type(): PhysicsConstraintType {\r\n return this._type;\r\n }\r\n\r\n /**\r\n * Retrieves the options of the physics constraint.\r\n *\r\n * @returns The physics constraint parameters.\r\n *\r\n */\r\n public get options(): PhysicsConstraintParameters {\r\n return this._options;\r\n }\r\n\r\n /**\r\n * Enable/disable the constraint\r\n * @param isEnabled value for the constraint\r\n */\r\n public set isEnabled(isEnabled: boolean) {\r\n this._physicsPlugin.setEnabled(this, isEnabled);\r\n }\r\n\r\n /**\r\n *\r\n * @returns true if constraint is enabled\r\n */\r\n public get isEnabled(): boolean {\r\n return this._physicsPlugin.getEnabled(this);\r\n }\r\n\r\n /**\r\n * Enables or disables collisions for the physics engine.\r\n *\r\n * @param isEnabled - A boolean value indicating whether collisions should be enabled or disabled.\r\n *\r\n */\r\n public set isCollisionsEnabled(isEnabled: boolean) {\r\n this._physicsPlugin.setCollisionsEnabled(this, isEnabled);\r\n }\r\n\r\n /**\r\n * Gets whether collisions are enabled for this physics object.\r\n *\r\n * @returns `true` if collisions are enabled, `false` otherwise.\r\n *\r\n */\r\n public get isCollisionsEnabled(): boolean {\r\n return this._physicsPlugin.getCollisionsEnabled(this);\r\n }\r\n\r\n /**\r\n * Gets all bodies that are using this constraint\r\n * @returns\r\n */\r\n public getBodiesUsingConstraint(): ConstrainedBodyPair[] {\r\n return this._physicsPlugin.getBodiesUsingConstraint(this);\r\n }\r\n\r\n /**\r\n * Disposes the constraint from the physics engine.\r\n *\r\n * This method is useful for cleaning up the physics engine when a body is no longer needed. Disposing the body will free up resources and prevent memory leaks.\r\n */\r\n public dispose(): void {\r\n this._physicsPlugin.disposeConstraint(this);\r\n }\r\n}\r\n\r\n/**\r\n * This describes a single limit used by Physics6DoFConstraint\r\n */\r\nexport class Physics6DoFLimit {\r\n /**\r\n * The axis ID to limit\r\n */\r\n axis: PhysicsConstraintAxis;\r\n /**\r\n * An optional minimum limit for the axis.\r\n * Corresponds to a distance in meters for linear axes, an angle in radians for angular axes.\r\n */\r\n minLimit?: number;\r\n /**\r\n * An optional maximum limit for the axis.\r\n * Corresponds to a distance in meters for linear axes, an angle in radians for angular axes.\r\n */\r\n maxLimit?: number;\r\n /**\r\n * The stiffness of the constraint.\r\n */\r\n stiffness?: number;\r\n /**\r\n * A constraint parameter that specifies damping.\r\n */\r\n damping?: number;\r\n}\r\n\r\n/**\r\n * A generic constraint, which can be used to build more complex constraints than those specified\r\n * in PhysicsConstraintType. The axis and pivot options in PhysicsConstraintParameters define the space\r\n * the constraint operates in. This constraint contains a set of limits, which restrict the\r\n * relative movement of the bodies in that coordinate system\r\n */\r\nexport class Physics6DoFConstraint extends PhysicsConstraint {\r\n /**\r\n * The collection of limits which this constraint will apply\r\n */\r\n public limits: Physics6DoFLimit[];\r\n\r\n constructor(constraintParams: PhysicsConstraintParameters, limits: Physics6DoFLimit[], scene: Scene) {\r\n super(PhysicsConstraintType.SIX_DOF, constraintParams, scene);\r\n this.limits = limits;\r\n }\r\n\r\n /**\r\n * Sets the friction of the given axis of the physics engine.\r\n * @param axis - The axis of the physics engine to set the friction for.\r\n * @param friction - The friction to set for the given axis.\r\n *\r\n */\r\n public setAxisFriction(axis: PhysicsConstraintAxis, friction: number): void {\r\n this._physicsPlugin.setAxisFriction(this, axis, friction);\r\n }\r\n\r\n /**\r\n * Gets the friction of the given axis of the physics engine.\r\n * @param axis - The axis of the physics engine.\r\n * @returns The friction of the given axis, or null if the constraint hasn't been initialized yet.\r\n *\r\n */\r\n public getAxisFriction(axis: PhysicsConstraintAxis): Nullable<number> {\r\n return this._physicsPlugin.getAxisFriction(this, axis);\r\n }\r\n\r\n /**\r\n * Sets the limit mode for the given axis of the constraint.\r\n * @param axis The axis to set the limit mode for.\r\n * @param limitMode The limit mode to set.\r\n *\r\n * This method is useful for setting the limit mode for a given axis of the constraint. This is important for\r\n * controlling the behavior of the physics engine when the constraint is reached. By setting the limit mode,\r\n * the engine can be configured to either stop the motion of the objects, or to allow them to continue\r\n * moving beyond the constraint.\r\n */\r\n public setAxisMode(axis: PhysicsConstraintAxis, limitMode: PhysicsConstraintAxisLimitMode): void {\r\n this._physicsPlugin.setAxisMode(this, axis, limitMode);\r\n }\r\n\r\n /**\r\n * Gets the limit mode of the given axis of the constraint.\r\n *\r\n * @param axis - The axis of the constraint.\r\n * @returns The limit mode of the given axis, or null if the constraint hasn't been initialized yet.\r\n *\r\n */\r\n public getAxisMode(axis: PhysicsConstraintAxis): Nullable<PhysicsConstraintAxisLimitMode> {\r\n return this._physicsPlugin.getAxisMode(this, axis);\r\n }\r\n\r\n /**\r\n * Sets the minimum limit of a given axis of a constraint.\r\n * @param axis - The axis of the constraint.\r\n * @param minLimit - The minimum limit of the axis.\r\n *\r\n */\r\n public setAxisMinLimit(axis: PhysicsConstraintAxis, minLimit: number): void {\r\n this._physicsPlugin.setAxisMinLimit(this, axis, minLimit);\r\n }\r\n\r\n /**\r\n * Gets the minimum limit of the given axis of the physics engine.\r\n * @param axis - The axis of the physics engine.\r\n * @returns The minimum limit of the given axis, or null if the constraint hasn't been initialized yet.\r\n *\r\n */\r\n public getAxisMinLimit(axis: PhysicsConstraintAxis): Nullable<number> {\r\n return this._physicsPlugin.getAxisMinLimit(this, axis);\r\n }\r\n\r\n /**\r\n * Sets the maximum limit of the given axis for the physics engine.\r\n * @param axis - The axis to set the limit for.\r\n * @param limit - The maximum limit of the axis.\r\n *\r\n * This method is useful for setting the maximum limit of the given axis for the physics engine,\r\n * which can be used to control the movement of the physics object. This helps to ensure that the\r\n * physics object does not move beyond the given limit.\r\n */\r\n public setAxisMaxLimit(axis: PhysicsConstraintAxis, limit: number): void {\r\n this._physicsPlugin.setAxisMaxLimit(this, axis, limit);\r\n }\r\n\r\n /**\r\n * Gets the maximum limit of the given axis of the physics engine.\r\n * @param axis - The axis of the physics engine.\r\n * @returns The maximum limit of the given axis, or null if the constraint hasn't been initialized yet.\r\n *\r\n */\r\n public getAxisMaxLimit(axis: PhysicsConstraintAxis): Nullable<number> {\r\n return this._physicsPlugin.getAxisMaxLimit(this, axis);\r\n }\r\n\r\n /**\r\n * Sets the motor type of the given axis of the constraint.\r\n * @param axis - The axis of the constraint.\r\n * @param motorType - The type of motor to use.\r\n */\r\n public setAxisMotorType(axis: PhysicsConstraintAxis, motorType: PhysicsConstraintMotorType): void {\r\n this._physicsPlugin.setAxisMotorType(this, axis, motorType);\r\n }\r\n\r\n /**\r\n * Gets the motor type of the specified axis of the constraint.\r\n *\r\n * @param axis - The axis of the constraint.\r\n * @returns The motor type of the specified axis, or null if the constraint hasn't been initialized yet.\r\n *\r\n */\r\n public getAxisMotorType(axis: PhysicsConstraintAxis): Nullable<PhysicsConstraintMotorType> {\r\n return this._physicsPlugin.getAxisMotorType(this, axis);\r\n }\r\n\r\n /**\r\n * Sets the target velocity of the motor associated with the given axis of the constraint.\r\n * @param axis - The axis of the constraint.\r\n * @param target - The target velocity of the motor.\r\n *\r\n * This method is useful for setting the target velocity of the motor associated with the given axis of the constraint.\r\n */\r\n public setAxisMotorTarget(axis: PhysicsConstraintAxis, target: number): void {\r\n this._physicsPlugin.setAxisMotorTarget(this, axis, target);\r\n }\r\n\r\n /**\r\n * Gets the target velocity of the motor associated to the given constraint axis.\r\n * @param axis - The constraint axis associated to the motor.\r\n * @returns The target velocity of the motor, or null if the constraint hasn't been initialized yet.\r\n *\r\n */\r\n public getAxisMotorTarget(axis: PhysicsConstraintAxis): Nullable<number> {\r\n return this._physicsPlugin.getAxisMotorTarget(this, axis);\r\n }\r\n\r\n /**\r\n * Sets the maximum force of the motor of the given axis of the constraint.\r\n * @param axis - The axis of the constraint.\r\n * @param maxForce - The maximum force of the motor.\r\n *\r\n */\r\n public setAxisMotorMaxForce(axis: PhysicsConstraintAxis, maxForce: number): void {\r\n this._physicsPlugin.setAxisMotorMaxForce(this, axis, maxForce);\r\n }\r\n\r\n /**\r\n * Gets the maximum force of the motor of the given axis of the constraint.\r\n * @param axis - The axis of the constraint.\r\n * @returns The maximum force of the motor, or null if the constraint hasn't been initialized yet.\r\n *\r\n */\r\n public getAxisMotorMaxForce(axis: PhysicsConstraintAxis): Nullable<number> {\r\n return this._physicsPlugin.getAxisMotorMaxForce(this, axis);\r\n }\r\n}\r\n\r\n/**\r\n * Represents a Ball and Socket Constraint, used to simulate a joint\r\n *\r\n * @param pivotA - The first pivot, defined locally in the first body frame\r\n * @param pivotB - The second pivot, defined locally in the second body frame\r\n * @param axisA - The axis of the first body\r\n * @param axisB - The axis of the second body\r\n * @param scene - The scene the constraint is applied to\r\n * @returns The Ball and Socket Constraint\r\n *\r\n * This class is useful for simulating a joint between two bodies in a physics engine.\r\n * It allows for the two bodies to move relative to each other in a way that mimics a ball and socket joint, such as a shoulder or hip joint.\r\n */\r\nexport class BallAndSocketConstraint extends PhysicsConstraint {\r\n constructor(pivotA: Vector3, pivotB: Vector3, axisA: Vector3, axisB: Vector3, scene: Scene) {\r\n super(PhysicsConstraintType.BALL_AND_SOCKET, { pivotA: pivotA, pivotB: pivotB, axisA: axisA, axisB: axisB }, scene);\r\n }\r\n}\r\n\r\n/**\r\n * Creates a distance constraint.\r\n * @param maxDistance distance between bodies\r\n * @param scene The scene the constraint belongs to\r\n * @returns DistanceConstraint\r\n *\r\n * This code is useful for creating a distance constraint in a physics engine.\r\n * A distance constraint is a type of constraint that keeps two objects at a certain distance from each other.\r\n * The scene is used to add the constraint to the physics engine.\r\n */\r\nexport class DistanceConstraint extends PhysicsConstraint {\r\n constructor(maxDistance: number, scene: Scene) {\r\n super(PhysicsConstraintType.DISTANCE, { maxDistance: maxDistance }, scene);\r\n }\r\n}\r\n\r\n/**\r\n * Creates a HingeConstraint, which is a type of PhysicsConstraint.\r\n *\r\n * @param pivotA - The first pivot point, in world space.\r\n * @param pivotB - The second pivot point, in world space.\r\n * @param scene - The scene the constraint is used in.\r\n * @returns The new HingeConstraint.\r\n *\r\n * This code is useful for creating a HingeConstraint, which is a type of PhysicsConstraint.\r\n * This constraint is used to simulate a hinge joint between two rigid bodies, allowing them to rotate around a single axis.\r\n */\r\nexport class HingeConstraint extends PhysicsConstraint {\r\n constructor(pivotA: Vector3, pivotB: Vector3, axisA: Vector3, axisB: Vector3, scene: Scene) {\r\n super(PhysicsConstraintType.HINGE, { pivotA: pivotA, pivotB: pivotB, axisA: axisA, axisB: axisB }, scene);\r\n }\r\n}\r\n\r\n/**\r\n * Creates a SliderConstraint, which is a type of PhysicsConstraint.\r\n *\r\n * @param pivotA - The first pivot of the constraint, in world space.\r\n * @param pivotB - The second pivot of the constraint, in world space.\r\n * @param axisA - The first axis of the constraint, in world space.\r\n * @param axisB - The second axis of the constraint, in world space.\r\n * @param scene - The scene the constraint belongs to.\r\n * @returns The created SliderConstraint.\r\n *\r\n * This code is useful for creating a SliderConstraint, which is a type of PhysicsConstraint.\r\n * It allows the user to specify the two pivots and two axes of the constraint in world space, as well as the scene the constraint belongs to.\r\n * This is useful for creating a constraint between two rigid bodies that allows them to move along a certain axis.\r\n */\r\nexport class SliderConstraint extends PhysicsConstraint {\r\n constructor(pivotA: Vector3, pivotB: Vector3, axisA: Vector3, axisB: Vector3, scene: Scene) {\r\n super(PhysicsConstraintType.SLIDER, { pivotA: pivotA, pivotB: pivotB, axisA: axisA, axisB: axisB }, scene);\r\n }\r\n}\r\n\r\n/**\r\n * Creates a LockConstraint, which is a type of PhysicsConstraint.\r\n *\r\n * @param pivotA - The first pivot of the constraint in local space.\r\n * @param pivotB - The second pivot of the constraint in local space.\r\n * @param axisA - The first axis of the constraint in local space.\r\n * @param axisB - The second axis of the constraint in local space.\r\n * @param scene - The scene the constraint belongs to.\r\n * @returns The created LockConstraint.\r\n *\r\n * This code is useful for creating a LockConstraint, which is a type of PhysicsConstraint.\r\n * It takes in two pivots and two axes in local space, as well as the scene the constraint belongs to, and creates a LockConstraint.\r\n */\r\nexport class LockConstraint extends PhysicsConstraint {\r\n constructor(pivotA: Vector3, pivotB: Vector3, axisA: Vector3, axisB: Vector3, scene: Scene) {\r\n super(PhysicsConstraintType.LOCK, { pivotA: pivotA, pivotB: pivotB, axisA: axisA, axisB: axisB }, scene);\r\n }\r\n}\r\n\r\n/**\r\n * Creates a PrismaticConstraint, which is a type of PhysicsConstraint.\r\n *\r\n * @param pivotA - The first pivot of the constraint in local space.\r\n * @param pivotB - The second pivot of the constraint in local space.\r\n * @param axisA - The first axis of the constraint in local space.\r\n * @param axisB - The second axis of the constraint in local space.\r\n * @param scene - The scene the constraint belongs to.\r\n * @returns The created LockConstraint.\r\n *\r\n * This code is useful for creating a PrismaticConstraint, which is a type of PhysicsConstraint.\r\n * It takes in two pivots and two axes in local space, as well as the scene the constraint belongs to, and creates a PrismaticConstraint.\r\n */\r\nexport class PrismaticConstraint extends PhysicsConstraint {\r\n constructor(pivotA: Vector3, pivotB: Vector3, axisA: Vector3, axisB: Vector3, scene: Scene) {\r\n super(PhysicsConstraintType.PRISMATIC, { pivotA: pivotA, pivotB: pivotB, axisA: axisA, axisB: axisB }, scene);\r\n }\r\n}\r\n\r\n/**\r\n * Creates a SpringConstraint, which is a type of Physics6DoFConstraint. This constraint applies a force at the ends which is proportional\r\n * to the distance between ends, and a stiffness and damping factor. The force is calculated as (stiffness * positionError) - (damping * velocity)\r\n *\r\n * @param pivotA - The first pivot of the constraint in local space.\r\n * @param pivotB - The second pivot of the constraint in local space.\r\n * @param axisA - The first axis of the constraint in local space.\r\n * @param axisB - The second axis of the constraint in local space.\r\n * @param minDistance - The minimum distance between the two pivots.\r\n * @param maxDistance - The maximum distance between the two pivots.\r\n * @param stiffness - The stiffness of the spring.\r\n * @param damping - The damping of the spring.\r\n * @param scene - The scene the constraint belongs to.\r\n * @returns The created SpringConstraint.\r\n */\r\nexport class SpringConstraint extends Physics6DoFConstraint {\r\n constructor(pivotA: Vector3, pivotB: Vector3, axisA: Vector3, axisB: Vector3, minDistance: number, maxDistance: number, stiffness: number, damping: number, scene: Scene) {\r\n super({ pivotA, pivotB, axisA, axisB }, [{ axis: PhysicsConstraintAxis.LINEAR_DISTANCE, minLimit: minDistance, maxLimit: maxDistance, stiffness, damping }], scene);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"physicsConstraint.js","sourceRoot":"","sources":["../../../../../dev/core/src/Physics/v2/physicsConstraint.ts"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,MAAM,OAAO,iBAAiB;IAiB1B;;;;;;;;OAQG;IACH,YAAY,IAA2B,EAAE,OAAoC,EAAE,KAAY;QAzB3F;;WAEG;QACI,gBAAW,GAAQ,SAAS,CAAC;QAuBhC,IAAI,CAAC,KAAK,EAAE;YACR,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;SAC1E;QACD,MAAM,aAAa,GAAG,KAAK,CAAC,gBAAgB,EAAE,CAAC;QAC/C,IAAI,CAAC,aAAa,EAAE;YAChB,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;SACnD;QACD,IAAI,aAAa,CAAC,gBAAgB,EAAE,IAAI,CAAC,EAAE;YACvC,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;SACvE;QACD,MAAM,aAAa,GAAG,aAAa,CAAC,gBAAgB,EAAE,CAAC;QACvD,IAAI,CAAC,aAAa,EAAE;YAChB,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;SACnD;QAED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AClH,CAAC;CACJ;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAO,gBAAiB,SAAQ,qBAAqB;IACvD,YAAY,MAAe,EAAE,MAAe,EAAE,KAAc,EAAE,KAAc,EAAE,WAAmB,EAAE,WAAmB,EAAE,SAAiB,EAAE,OAAe,EAAE,KAAY;QACpK,KAAK,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,EAAE,IAAI,+CAAuC,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC;IACxK,CAAC;CACJ","sourcesContent":["import type { Scene } from \"../../scene\";\r\nimport type { Vector3 } from \"../../Maths/math.vector\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { IPhysicsEnginePluginV2, PhysicsConstraintParameters, PhysicsConstraintAxisLimitMode, PhysicsConstraintMotorType, ConstrainedBodyPair } from \"./IPhysicsEnginePlugin\";\r\nimport { PhysicsConstraintAxis, PhysicsConstraintType } from \"./IPhysicsEnginePlugin\";\r\n\r\n/**\r\n * This is a holder class for the physics constraint created by the physics plugin\r\n * It holds a set of functions to control the underlying constraint\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine\r\n */\r\nexport class PhysicsConstraint {\r\n /**\r\n * V2 Physics plugin private data for a physics material\r\n */\r\n public _pluginData: any = undefined;\r\n /**\r\n * The V2 plugin used to create and manage this Physics Body\r\n */\r\n protected _physicsPlugin: IPhysicsEnginePluginV2;\r\n protected _options: PhysicsConstraintParameters;\r\n protected _type: PhysicsConstraintType;\r\n /**\r\n * @internal\r\n * The internal options that were used to init the constraint\r\n */\r\n public _initOptions?: PhysicsConstraintParameters;\r\n\r\n /**\r\n * Constructs a new constraint for the physics constraint.\r\n * @param type The type of constraint to create.\r\n * @param options The options for the constraint.\r\n * @param scene The scene the constraint belongs to.\r\n *\r\n * This code is useful for creating a new constraint for the physics engine. It checks if the scene has a physics engine, and if the plugin version is correct.\r\n * If all checks pass, it initializes the constraint with the given type and options.\r\n */\r\n constructor(type: PhysicsConstraintType, options: PhysicsConstraintParameters, scene: Scene) {\r\n if (!scene) {\r\n throw new Error(\"Missing scene parameter for constraint constructor.\");\r\n }\r\n const physicsEngine = scene.getPhysicsEngine();\r\n if (!physicsEngine) {\r\n throw new Error(\"No Physics Engine available.\");\r\n }\r\n if (physicsEngine.getPluginVersion() != 2) {\r\n throw new Error(\"Plugin version is incorrect. Expected version 2.\");\r\n }\r\n const physicsPlugin = physicsEngine.getPhysicsPlugin();\r\n if (!physicsPlugin) {\r\n throw new Error(\"No Physics Plugin available.\");\r\n }\r\n\r\n this._physicsPlugin = physicsPlugin as IPhysicsEnginePluginV2;\r\n this._options = options;\r\n this._type = type;\r\n }\r\n\r\n /**\r\n * Gets the type of the constraint.\r\n *\r\n * @returns The type of the constraint.\r\n *\r\n */\r\n public get type(): PhysicsConstraintType {\r\n return this._type;\r\n }\r\n\r\n /**\r\n * Retrieves the options of the physics constraint.\r\n *\r\n * @returns The physics constraint parameters.\r\n *\r\n */\r\n public get options(): PhysicsConstraintParameters {\r\n return this._options;\r\n }\r\n\r\n /**\r\n * Enable/disable the constraint\r\n * @param isEnabled value for the constraint\r\n */\r\n public set isEnabled(isEnabled: boolean) {\r\n this._physicsPlugin.setEnabled(this, isEnabled);\r\n }\r\n\r\n /**\r\n *\r\n * @returns true if constraint is enabled\r\n */\r\n public get isEnabled(): boolean {\r\n return this._physicsPlugin.getEnabled(this);\r\n }\r\n\r\n /**\r\n * Enables or disables collisions for the physics engine.\r\n *\r\n * @param isEnabled - A boolean value indicating whether collisions should be enabled or disabled.\r\n *\r\n */\r\n public set isCollisionsEnabled(isEnabled: boolean) {\r\n this._physicsPlugin.setCollisionsEnabled(this, isEnabled);\r\n }\r\n\r\n /**\r\n * Gets whether collisions are enabled for this physics object.\r\n *\r\n * @returns `true` if collisions are enabled, `false` otherwise.\r\n *\r\n */\r\n public get isCollisionsEnabled(): boolean {\r\n return this._physicsPlugin.getCollisionsEnabled(this);\r\n }\r\n\r\n /**\r\n * Gets all bodies that are using this constraint\r\n * @returns\r\n */\r\n public getBodiesUsingConstraint(): ConstrainedBodyPair[] {\r\n return this._physicsPlugin.getBodiesUsingConstraint(this);\r\n }\r\n\r\n /**\r\n * Disposes the constraint from the physics engine.\r\n *\r\n * This method is useful for cleaning up the physics engine when a body is no longer needed. Disposing the body will free up resources and prevent memory leaks.\r\n */\r\n public dispose(): void {\r\n this._physicsPlugin.disposeConstraint(this);\r\n }\r\n}\r\n\r\n/**\r\n * This describes a single limit used by Physics6DoFConstraint\r\n */\r\nexport class Physics6DoFLimit {\r\n /**\r\n * The axis ID to limit\r\n */\r\n axis: PhysicsConstraintAxis;\r\n /**\r\n * An optional minimum limit for the axis.\r\n * Corresponds to a distance in meters for linear axes, an angle in radians for angular axes.\r\n */\r\n minLimit?: number;\r\n /**\r\n * An optional maximum limit for the axis.\r\n * Corresponds to a distance in meters for linear axes, an angle in radians for angular axes.\r\n */\r\n maxLimit?: number;\r\n /**\r\n * The stiffness of the constraint.\r\n */\r\n stiffness?: number;\r\n /**\r\n * A constraint parameter that specifies damping.\r\n */\r\n damping?: number;\r\n}\r\n\r\n/**\r\n * A generic constraint, which can be used to build more complex constraints than those specified\r\n * in PhysicsConstraintType. The axis and pivot options in PhysicsConstraintParameters define the space\r\n * the constraint operates in. This constraint contains a set of limits, which restrict the\r\n * relative movement of the bodies in that coordinate system\r\n */\r\nexport class Physics6DoFConstraint extends PhysicsConstraint {\r\n /**\r\n * The collection of limits which this constraint will apply\r\n */\r\n public limits: Physics6DoFLimit[];\r\n\r\n constructor(constraintParams: PhysicsConstraintParameters, limits: Physics6DoFLimit[], scene: Scene) {\r\n super(PhysicsConstraintType.SIX_DOF, constraintParams, scene);\r\n this.limits = limits;\r\n }\r\n\r\n /**\r\n * Sets the friction of the given axis of the physics engine.\r\n * @param axis - The axis of the physics engine to set the friction for.\r\n * @param friction - The friction to set for the given axis.\r\n *\r\n */\r\n public setAxisFriction(axis: PhysicsConstraintAxis, friction: number): void {\r\n this._physicsPlugin.setAxisFriction(this, axis, friction);\r\n }\r\n\r\n /**\r\n * Gets the friction of the given axis of the physics engine.\r\n * @param axis - The axis of the physics engine.\r\n * @returns The friction of the given axis, or null if the constraint hasn't been initialized yet.\r\n *\r\n */\r\n public getAxisFriction(axis: PhysicsConstraintAxis): Nullable<number> {\r\n return this._physicsPlugin.getAxisFriction(this, axis);\r\n }\r\n\r\n /**\r\n * Sets the limit mode for the given axis of the constraint.\r\n * @param axis The axis to set the limit mode for.\r\n * @param limitMode The limit mode to set.\r\n *\r\n * This method is useful for setting the limit mode for a given axis of the constraint. This is important for\r\n * controlling the behavior of the physics engine when the constraint is reached. By setting the limit mode,\r\n * the engine can be configured to either stop the motion of the objects, or to allow them to continue\r\n * moving beyond the constraint.\r\n */\r\n public setAxisMode(axis: PhysicsConstraintAxis, limitMode: PhysicsConstraintAxisLimitMode): void {\r\n this._physicsPlugin.setAxisMode(this, axis, limitMode);\r\n }\r\n\r\n /**\r\n * Gets the limit mode of the given axis of the constraint.\r\n *\r\n * @param axis - The axis of the constraint.\r\n * @returns The limit mode of the given axis, or null if the constraint hasn't been initialized yet.\r\n *\r\n */\r\n public getAxisMode(axis: PhysicsConstraintAxis): Nullable<PhysicsConstraintAxisLimitMode> {\r\n return this._physicsPlugin.getAxisMode(this, axis);\r\n }\r\n\r\n /**\r\n * Sets the minimum limit of a given axis of a constraint.\r\n * @param axis - The axis of the constraint.\r\n * @param minLimit - The minimum limit of the axis.\r\n *\r\n */\r\n public setAxisMinLimit(axis: PhysicsConstraintAxis, minLimit: number): void {\r\n this._physicsPlugin.setAxisMinLimit(this, axis, minLimit);\r\n }\r\n\r\n /**\r\n * Gets the minimum limit of the given axis of the physics engine.\r\n * @param axis - The axis of the physics engine.\r\n * @returns The minimum limit of the given axis, or null if the constraint hasn't been initialized yet.\r\n *\r\n */\r\n public getAxisMinLimit(axis: PhysicsConstraintAxis): Nullable<number> {\r\n return this._physicsPlugin.getAxisMinLimit(this, axis);\r\n }\r\n\r\n /**\r\n * Sets the maximum limit of the given axis for the physics engine.\r\n * @param axis - The axis to set the limit for.\r\n * @param limit - The maximum limit of the axis.\r\n *\r\n * This method is useful for setting the maximum limit of the given axis for the physics engine,\r\n * which can be used to control the movement of the physics object. This helps to ensure that the\r\n * physics object does not move beyond the given limit.\r\n */\r\n public setAxisMaxLimit(axis: PhysicsConstraintAxis, limit: number): void {\r\n this._physicsPlugin.setAxisMaxLimit(this, axis, limit);\r\n }\r\n\r\n /**\r\n * Gets the maximum limit of the given axis of the physics engine.\r\n * @param axis - The axis of the physics engine.\r\n * @returns The maximum limit of the given axis, or null if the constraint hasn't been initialized yet.\r\n *\r\n */\r\n public getAxisMaxLimit(axis: PhysicsConstraintAxis): Nullable<number> {\r\n return this._physicsPlugin.getAxisMaxLimit(this, axis);\r\n }\r\n\r\n /**\r\n * Sets the motor type of the given axis of the constraint.\r\n * @param axis - The axis of the constraint.\r\n * @param motorType - The type of motor to use.\r\n */\r\n public setAxisMotorType(axis: PhysicsConstraintAxis, motorType: PhysicsConstraintMotorType): void {\r\n this._physicsPlugin.setAxisMotorType(this, axis, motorType);\r\n }\r\n\r\n /**\r\n * Gets the motor type of the specified axis of the constraint.\r\n *\r\n * @param axis - The axis of the constraint.\r\n * @returns The motor type of the specified axis, or null if the constraint hasn't been initialized yet.\r\n *\r\n */\r\n public getAxisMotorType(axis: PhysicsConstraintAxis): Nullable<PhysicsConstraintMotorType> {\r\n return this._physicsPlugin.getAxisMotorType(this, axis);\r\n }\r\n\r\n /**\r\n * Sets the target velocity of the motor associated with the given axis of the constraint.\r\n * @param axis - The axis of the constraint.\r\n * @param target - The target velocity of the motor.\r\n *\r\n * This method is useful for setting the target velocity of the motor associated with the given axis of the constraint.\r\n */\r\n public setAxisMotorTarget(axis: PhysicsConstraintAxis, target: number): void {\r\n this._physicsPlugin.setAxisMotorTarget(this, axis, target);\r\n }\r\n\r\n /**\r\n * Gets the target velocity of the motor associated to the given constraint axis.\r\n * @param axis - The constraint axis associated to the motor.\r\n * @returns The target velocity of the motor, or null if the constraint hasn't been initialized yet.\r\n *\r\n */\r\n public getAxisMotorTarget(axis: PhysicsConstraintAxis): Nullable<number> {\r\n return this._physicsPlugin.getAxisMotorTarget(this, axis);\r\n }\r\n\r\n /**\r\n * Sets the maximum force of the motor of the given axis of the constraint.\r\n * @param axis - The axis of the constraint.\r\n * @param maxForce - The maximum force of the motor.\r\n *\r\n */\r\n public setAxisMotorMaxForce(axis: PhysicsConstraintAxis, maxForce: number): void {\r\n this._physicsPlugin.setAxisMotorMaxForce(this, axis, maxForce);\r\n }\r\n\r\n /**\r\n * Gets the maximum force of the motor of the given axis of the constraint.\r\n * @param axis - The axis of the constraint.\r\n * @returns The maximum force of the motor, or null if the constraint hasn't been initialized yet.\r\n *\r\n */\r\n public getAxisMotorMaxForce(axis: PhysicsConstraintAxis): Nullable<number> {\r\n return this._physicsPlugin.getAxisMotorMaxForce(this, axis);\r\n }\r\n}\r\n\r\n/**\r\n * Represents a Ball and Socket Constraint, used to simulate a joint\r\n *\r\n * @param pivotA - The first pivot, defined locally in the first body frame\r\n * @param pivotB - The second pivot, defined locally in the second body frame\r\n * @param axisA - The axis of the first body\r\n * @param axisB - The axis of the second body\r\n * @param scene - The scene the constraint is applied to\r\n * @returns The Ball and Socket Constraint\r\n *\r\n * This class is useful for simulating a joint between two bodies in a physics engine.\r\n * It allows for the two bodies to move relative to each other in a way that mimics a ball and socket joint, such as a shoulder or hip joint.\r\n */\r\nexport class BallAndSocketConstraint extends PhysicsConstraint {\r\n constructor(pivotA: Vector3, pivotB: Vector3, axisA: Vector3, axisB: Vector3, scene: Scene) {\r\n super(PhysicsConstraintType.BALL_AND_SOCKET, { pivotA: pivotA, pivotB: pivotB, axisA: axisA, axisB: axisB }, scene);\r\n }\r\n}\r\n\r\n/**\r\n * Creates a distance constraint.\r\n * @param maxDistance distance between bodies\r\n * @param scene The scene the constraint belongs to\r\n * @returns DistanceConstraint\r\n *\r\n * This code is useful for creating a distance constraint in a physics engine.\r\n * A distance constraint is a type of constraint that keeps two objects at a certain distance from each other.\r\n * The scene is used to add the constraint to the physics engine.\r\n */\r\nexport class DistanceConstraint extends PhysicsConstraint {\r\n constructor(maxDistance: number, scene: Scene) {\r\n super(PhysicsConstraintType.DISTANCE, { maxDistance: maxDistance }, scene);\r\n }\r\n}\r\n\r\n/**\r\n * Creates a HingeConstraint, which is a type of PhysicsConstraint.\r\n *\r\n * @param pivotA - The first pivot point, in world space.\r\n * @param pivotB - The second pivot point, in world space.\r\n * @param scene - The scene the constraint is used in.\r\n * @returns The new HingeConstraint.\r\n *\r\n * This code is useful for creating a HingeConstraint, which is a type of PhysicsConstraint.\r\n * This constraint is used to simulate a hinge joint between two rigid bodies, allowing them to rotate around a single axis.\r\n */\r\nexport class HingeConstraint extends PhysicsConstraint {\r\n constructor(pivotA: Vector3, pivotB: Vector3, axisA: Vector3, axisB: Vector3, scene: Scene) {\r\n super(PhysicsConstraintType.HINGE, { pivotA: pivotA, pivotB: pivotB, axisA: axisA, axisB: axisB }, scene);\r\n }\r\n}\r\n\r\n/**\r\n * Creates a SliderConstraint, which is a type of PhysicsConstraint.\r\n *\r\n * @param pivotA - The first pivot of the constraint, in world space.\r\n * @param pivotB - The second pivot of the constraint, in world space.\r\n * @param axisA - The first axis of the constraint, in world space.\r\n * @param axisB - The second axis of the constraint, in world space.\r\n * @param scene - The scene the constraint belongs to.\r\n * @returns The created SliderConstraint.\r\n *\r\n * This code is useful for creating a SliderConstraint, which is a type of PhysicsConstraint.\r\n * It allows the user to specify the two pivots and two axes of the constraint in world space, as well as the scene the constraint belongs to.\r\n * This is useful for creating a constraint between two rigid bodies that allows them to move along a certain axis.\r\n */\r\nexport class SliderConstraint extends PhysicsConstraint {\r\n constructor(pivotA: Vector3, pivotB: Vector3, axisA: Vector3, axisB: Vector3, scene: Scene) {\r\n super(PhysicsConstraintType.SLIDER, { pivotA: pivotA, pivotB: pivotB, axisA: axisA, axisB: axisB }, scene);\r\n }\r\n}\r\n\r\n/**\r\n * Creates a LockConstraint, which is a type of PhysicsConstraint.\r\n *\r\n * @param pivotA - The first pivot of the constraint in local space.\r\n * @param pivotB - The second pivot of the constraint in local space.\r\n * @param axisA - The first axis of the constraint in local space.\r\n * @param axisB - The second axis of the constraint in local space.\r\n * @param scene - The scene the constraint belongs to.\r\n * @returns The created LockConstraint.\r\n *\r\n * This code is useful for creating a LockConstraint, which is a type of PhysicsConstraint.\r\n * It takes in two pivots and two axes in local space, as well as the scene the constraint belongs to, and creates a LockConstraint.\r\n */\r\nexport class LockConstraint extends PhysicsConstraint {\r\n constructor(pivotA: Vector3, pivotB: Vector3, axisA: Vector3, axisB: Vector3, scene: Scene) {\r\n super(PhysicsConstraintType.LOCK, { pivotA: pivotA, pivotB: pivotB, axisA: axisA, axisB: axisB }, scene);\r\n }\r\n}\r\n\r\n/**\r\n * Creates a PrismaticConstraint, which is a type of PhysicsConstraint.\r\n *\r\n * @param pivotA - The first pivot of the constraint in local space.\r\n * @param pivotB - The second pivot of the constraint in local space.\r\n * @param axisA - The first axis of the constraint in local space.\r\n * @param axisB - The second axis of the constraint in local space.\r\n * @param scene - The scene the constraint belongs to.\r\n * @returns The created LockConstraint.\r\n *\r\n * This code is useful for creating a PrismaticConstraint, which is a type of PhysicsConstraint.\r\n * It takes in two pivots and two axes in local space, as well as the scene the constraint belongs to, and creates a PrismaticConstraint.\r\n */\r\nexport class PrismaticConstraint extends PhysicsConstraint {\r\n constructor(pivotA: Vector3, pivotB: Vector3, axisA: Vector3, axisB: Vector3, scene: Scene) {\r\n super(PhysicsConstraintType.PRISMATIC, { pivotA: pivotA, pivotB: pivotB, axisA: axisA, axisB: axisB }, scene);\r\n }\r\n}\r\n\r\n/**\r\n * Creates a SpringConstraint, which is a type of Physics6DoFConstraint. This constraint applies a force at the ends which is proportional\r\n * to the distance between ends, and a stiffness and damping factor. The force is calculated as (stiffness * positionError) - (damping * velocity)\r\n *\r\n * @param pivotA - The first pivot of the constraint in local space.\r\n * @param pivotB - The second pivot of the constraint in local space.\r\n * @param axisA - The first axis of the constraint in local space.\r\n * @param axisB - The second axis of the constraint in local space.\r\n * @param minDistance - The minimum distance between the two pivots.\r\n * @param maxDistance - The maximum distance between the two pivots.\r\n * @param stiffness - The stiffness of the spring.\r\n * @param damping - The damping of the spring.\r\n * @param scene - The scene the constraint belongs to.\r\n * @returns The created SpringConstraint.\r\n */\r\nexport class SpringConstraint extends Physics6DoFConstraint {\r\n constructor(pivotA: Vector3, pivotB: Vector3, axisA: Vector3, axisB: Vector3, minDistance: number, maxDistance: number, stiffness: number, damping: number, scene: Scene) {\r\n super({ pivotA, pivotB, axisA, axisB }, [{ axis: PhysicsConstraintAxis.LINEAR_DISTANCE, minLimit: minDistance, maxLimit: maxDistance, stiffness, damping }], scene);\r\n }\r\n}\r\n"]}
@@ -5,7 +5,7 @@
5
5
  * is used will be selected based on their order in this enum - i.e.
6
6
  * a value later in this list will be preferentially used.
7
7
  */
8
- export declare enum PhysicsMaterialCombineMode {
8
+ export declare const enum PhysicsMaterialCombineMode {
9
9
  /**
10
10
  * The final value will be the geometric mean of the two values:
11
11
  * sqrt( valueA * valueB )
@@ -1 +1 @@
1
- {"version":3,"file":"physicsMaterial.js","sourceRoot":"","sources":["../../../../../dev/core/src/Physics/v2/physicsMaterial.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,CAAN,IAAY,0BAwBX;AAxBD,WAAY,0BAA0B;IAClC;;;OAGG;IACH,+FAAc,CAAA;IACd;;;OAGG;IACH,iFAAO,CAAA;IACP;;OAEG;IACH,iFAAO,CAAA;IACP;;OAEG;IACH,iGAAe,CAAA;IACf;;;OAGG;IACH,mFAAQ,CAAA;AACZ,CAAC,EAxBW,0BAA0B,KAA1B,0BAA0B,QAwBrC","sourcesContent":["/**\r\n * Determines how values from the PhysicsMaterial are combined when\r\n * two objects are in contact. When each PhysicsMaterial specifies\r\n * a different combine mode for some property, the combine mode which\r\n * is used will be selected based on their order in this enum - i.e.\r\n * a value later in this list will be preferentially used.\r\n */\r\nexport enum PhysicsMaterialCombineMode {\r\n /**\r\n * The final value will be the geometric mean of the two values:\r\n * sqrt( valueA * valueB )\r\n */\r\n GEOMETRIC_MEAN,\r\n /**\r\n * The final value will be the smaller of the two:\r\n * min( valueA , valueB )\r\n */\r\n MINIMUM,\r\n /* The final value will be the larger of the two:\r\n * max( valueA , valueB )\r\n */\r\n MAXIMUM,\r\n /* The final value will be the arithmetic mean of the two values:\r\n * (valueA + valueB) / 2\r\n */\r\n ARITHMETIC_MEAN,\r\n /**\r\n * The final value will be the product of the two values:\r\n * valueA * valueB\r\n */\r\n MULTIPLY,\r\n}\r\n\r\n/**\r\n * Physics material class\r\n * Helps setting friction and restitution that are used to compute responding forces in collision response\r\n */\r\nexport interface PhysicsMaterial {\r\n /**\r\n * Sets the friction used by this material\r\n *\r\n * The friction determines how much an object will slow down when it is in contact with another object.\r\n * This is important for simulating realistic physics, such as when an object slides across a surface.\r\n *\r\n * If not provided, a default value of 0.5 will be used.\r\n */\r\n friction?: number;\r\n\r\n /**\r\n * Sets the static friction used by this material.\r\n *\r\n * Static friction is the friction that must be overcome before a pair of objects can start sliding\r\n * relative to each other; for physically-realistic behaviour, it should be at least as high as the\r\n * normal friction value. If not provided, the friction value will be used\r\n */\r\n staticFriction?: number;\r\n\r\n /**\r\n * Sets the restitution of the physics material.\r\n *\r\n * The restitution is a factor which describes, the amount of energy that is retained after a collision,\r\n * which should be a number between 0 and 1..\r\n *\r\n * A restitution of 0 means that no energy is retained and the objects will not bounce off each other,\r\n * while a restitution of 1 means that all energy is retained and the objects will bounce.\r\n *\r\n * Note, though, due that due to the simulation implementation, an object with a restitution of 1 may\r\n * still lose energy over time.\r\n *\r\n * If not provided, a default value of 0 will be used.\r\n */\r\n restitution?: number;\r\n\r\n /**\r\n * Describes how two different friction values should be combined. See PhysicsMaterialCombineMode for\r\n * more details.\r\n *\r\n * If not provided, will use PhysicsMaterialCombineMode.MINIMUM\r\n */\r\n frictionCombine?: PhysicsMaterialCombineMode;\r\n\r\n /**\r\n * Describes how two different restitution values should be combined. See PhysicsMaterialCombineMode for\r\n * more details.\r\n *\r\n * If not provided, will use PhysicsMaterialCombineMode.MAXIMUM\r\n */\r\n restitutionCombine?: PhysicsMaterialCombineMode;\r\n}\r\n"]}
1
+ {"version":3,"file":"physicsMaterial.js","sourceRoot":"","sources":["../../../../../dev/core/src/Physics/v2/physicsMaterial.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,CAAN,IAAkB,0BAwBjB;AAxBD,WAAkB,0BAA0B;IACxC;;;OAGG;IACH,+FAAc,CAAA;IACd;;;OAGG;IACH,iFAAO,CAAA;IACP;;OAEG;IACH,iFAAO,CAAA;IACP;;OAEG;IACH,iGAAe,CAAA;IACf;;;OAGG;IACH,mFAAQ,CAAA;AACZ,CAAC,EAxBiB,0BAA0B,KAA1B,0BAA0B,QAwB3C","sourcesContent":["/**\r\n * Determines how values from the PhysicsMaterial are combined when\r\n * two objects are in contact. When each PhysicsMaterial specifies\r\n * a different combine mode for some property, the combine mode which\r\n * is used will be selected based on their order in this enum - i.e.\r\n * a value later in this list will be preferentially used.\r\n */\r\nexport const enum PhysicsMaterialCombineMode {\r\n /**\r\n * The final value will be the geometric mean of the two values:\r\n * sqrt( valueA * valueB )\r\n */\r\n GEOMETRIC_MEAN,\r\n /**\r\n * The final value will be the smaller of the two:\r\n * min( valueA , valueB )\r\n */\r\n MINIMUM,\r\n /* The final value will be the larger of the two:\r\n * max( valueA , valueB )\r\n */\r\n MAXIMUM,\r\n /* The final value will be the arithmetic mean of the two values:\r\n * (valueA + valueB) / 2\r\n */\r\n ARITHMETIC_MEAN,\r\n /**\r\n * The final value will be the product of the two values:\r\n * valueA * valueB\r\n */\r\n MULTIPLY,\r\n}\r\n\r\n/**\r\n * Physics material class\r\n * Helps setting friction and restitution that are used to compute responding forces in collision response\r\n */\r\nexport interface PhysicsMaterial {\r\n /**\r\n * Sets the friction used by this material\r\n *\r\n * The friction determines how much an object will slow down when it is in contact with another object.\r\n * This is important for simulating realistic physics, such as when an object slides across a surface.\r\n *\r\n * If not provided, a default value of 0.5 will be used.\r\n */\r\n friction?: number;\r\n\r\n /**\r\n * Sets the static friction used by this material.\r\n *\r\n * Static friction is the friction that must be overcome before a pair of objects can start sliding\r\n * relative to each other; for physically-realistic behaviour, it should be at least as high as the\r\n * normal friction value. If not provided, the friction value will be used\r\n */\r\n staticFriction?: number;\r\n\r\n /**\r\n * Sets the restitution of the physics material.\r\n *\r\n * The restitution is a factor which describes, the amount of energy that is retained after a collision,\r\n * which should be a number between 0 and 1..\r\n *\r\n * A restitution of 0 means that no energy is retained and the objects will not bounce off each other,\r\n * while a restitution of 1 means that all energy is retained and the objects will bounce.\r\n *\r\n * Note, though, due that due to the simulation implementation, an object with a restitution of 1 may\r\n * still lose energy over time.\r\n *\r\n * If not provided, a default value of 0 will be used.\r\n */\r\n restitution?: number;\r\n\r\n /**\r\n * Describes how two different friction values should be combined. See PhysicsMaterialCombineMode for\r\n * more details.\r\n *\r\n * If not provided, will use PhysicsMaterialCombineMode.MINIMUM\r\n */\r\n frictionCombine?: PhysicsMaterialCombineMode;\r\n\r\n /**\r\n * Describes how two different restitution values should be combined. See PhysicsMaterialCombineMode for\r\n * more details.\r\n *\r\n * If not provided, will use PhysicsMaterialCombineMode.MAXIMUM\r\n */\r\n restitutionCombine?: PhysicsMaterialCombineMode;\r\n}\r\n"]}
@@ -1,4 +1,3 @@
1
- import { PhysicsShapeType } from "./IPhysicsEnginePlugin.js";
2
1
  import { Matrix, Vector3, Quaternion, TmpVectors } from "../../Maths/math.vector.js";
3
2
  /**
4
3
  * PhysicsShape class.
@@ -223,7 +222,7 @@ export class PhysicsShapeSphere extends PhysicsShape {
223
222
  * @param scene scene to attach to
224
223
  */
225
224
  constructor(center, radius, scene) {
226
- super({ type: PhysicsShapeType.SPHERE, parameters: { center: center, radius: radius } }, scene);
225
+ super({ type: 0 /* PhysicsShapeType.SPHERE */, parameters: { center: center, radius: radius } }, scene);
227
226
  }
228
227
  /**
229
228
  * Derive an approximate sphere from the mesh.
@@ -250,7 +249,7 @@ export class PhysicsShapeCapsule extends PhysicsShape {
250
249
  * @param scene scene to attach to
251
250
  */
252
251
  constructor(pointA, pointB, radius, scene) {
253
- super({ type: PhysicsShapeType.CAPSULE, parameters: { pointA: pointA, pointB: pointB, radius: radius } }, scene);
252
+ super({ type: 1 /* PhysicsShapeType.CAPSULE */, parameters: { pointA: pointA, pointB: pointB, radius: radius } }, scene);
254
253
  }
255
254
  /**
256
255
  * Derive an approximate capsule from the mesh. Note, this is
@@ -279,7 +278,7 @@ export class PhysicsShapeCylinder extends PhysicsShape {
279
278
  * @param scene scene to attach to
280
279
  */
281
280
  constructor(pointA, pointB, radius, scene) {
282
- super({ type: PhysicsShapeType.CYLINDER, parameters: { pointA: pointA, pointB: pointB, radius: radius } }, scene);
281
+ super({ type: 2 /* PhysicsShapeType.CYLINDER */, parameters: { pointA: pointA, pointB: pointB, radius: radius } }, scene);
283
282
  }
284
283
  /**
285
284
  * Derive an approximate cylinder from the mesh. Note, this is
@@ -308,7 +307,7 @@ export class PhysicsShapeBox extends PhysicsShape {
308
307
  * @param scene scene to attach to
309
308
  */
310
309
  constructor(center, rotation, extents, scene) {
311
- super({ type: PhysicsShapeType.BOX, parameters: { center: center, rotation: rotation, extents: extents } }, scene);
310
+ super({ type: 3 /* PhysicsShapeType.BOX */, parameters: { center: center, rotation: rotation, extents: extents } }, scene);
312
311
  }
313
312
  /**
314
313
  *
@@ -332,7 +331,7 @@ export class PhysicsShapeConvexHull extends PhysicsShape {
332
331
  * @param scene scene to attach to
333
332
  */
334
333
  constructor(mesh, scene) {
335
- super({ type: PhysicsShapeType.CONVEX_HULL, parameters: { mesh: mesh } }, scene);
334
+ super({ type: 4 /* PhysicsShapeType.CONVEX_HULL */, parameters: { mesh: mesh } }, scene);
336
335
  }
337
336
  }
338
337
  /**
@@ -345,7 +344,7 @@ export class PhysicsShapeMesh extends PhysicsShape {
345
344
  * @param scene scene to attach to
346
345
  */
347
346
  constructor(mesh, scene) {
348
- super({ type: PhysicsShapeType.MESH, parameters: { mesh: mesh } }, scene);
347
+ super({ type: 6 /* PhysicsShapeType.MESH */, parameters: { mesh: mesh } }, scene);
349
348
  }
350
349
  }
351
350
  /**
@@ -357,7 +356,7 @@ export class PhysicsShapeContainer extends PhysicsShape {
357
356
  * @param scene scene to attach to
358
357
  */
359
358
  constructor(scene) {
360
- super({ type: PhysicsShapeType.CONTAINER, parameters: {} }, scene);
359
+ super({ type: 5 /* PhysicsShapeType.CONTAINER */, parameters: {} }, scene);
361
360
  }
362
361
  }
363
362
  /**
@@ -375,7 +374,7 @@ export class PhysicsShapeHeightField extends PhysicsShape {
375
374
  */
376
375
  constructor(heightFieldSizeX, heightFieldSizeZ, numHeightFieldSamplesX, numHeightFieldSamplesZ, heightFieldData, scene) {
377
376
  super({
378
- type: PhysicsShapeType.HEIGHTFIELD,
377
+ type: 7 /* PhysicsShapeType.HEIGHTFIELD */,
379
378
  parameters: {
380
379
  heightFieldSizeX: heightFieldSizeX,
381
380
  heightFieldSizeZ: heightFieldSizeZ,
@@ -396,7 +395,7 @@ export class PhysicsShapeGroundMesh extends PhysicsShape {
396
395
  * @param scene scene to attach to
397
396
  */
398
397
  constructor(groundMesh, scene) {
399
- super({ type: PhysicsShapeType.HEIGHTFIELD, parameters: { groundMesh: groundMesh } }, scene);
398
+ super({ type: 7 /* PhysicsShapeType.HEIGHTFIELD */, parameters: { groundMesh: groundMesh } }, scene);
400
399
  }
401
400
  }
402
401
  //# sourceMappingURL=physicsShape.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"physicsShape.js","sourceRoot":"","sources":["../../../../../dev/core/src/Physics/v2/physicsShape.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBA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AE,KAAY;QACvK,KAAK,CACD;YACI,IAAI,EAAE,gBAAgB,CAAC,WAAW;YAClC,UAAU,EAAE;gBACR,gBAAgB,EAAE,gBAAgB;gBAClC,gBAAgB,EAAE,gBAAgB;gBAClC,sBAAsB,EAAE,sBAAsB;gBAC9C,sBAAsB,EAAE,sBAAsB;gBAC9C,eAAe,EAAE,eAAe;aACnC;SACJ,EACD,KAAK,CACR,CAAC;IACN,CAAC;CACJ;AAED;;GAEG;AACH,MAAM,OAAO,sBAAuB,SAAQ,YAAY;IACpD;;;;OAIG;IACH,YAAY,UAAsB,EAAE,KAAY;QAC5C,KAAK,CAAC,EAAE,IAAI,EAAE,gBAAgB,CAAC,WAAW,EAAE,UAAU,EAAE,EAAE,UAAU,EAAE,UAAU,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;IACjG,CAAC;CACJ","sourcesContent":["import type { TransformNode } from \"../../Meshes/transformNode\";\r\nimport type { AbstractMesh } from \"../../Meshes/abstractMesh\";\r\nimport type { BoundingBox } from \"../../Culling/boundingBox\";\r\nimport { PhysicsShapeType } from \"./IPhysicsEnginePlugin\";\r\nimport type { IPhysicsEnginePluginV2, PhysicsShapeParameters } from \"./IPhysicsEnginePlugin\";\r\nimport type { PhysicsMaterial } from \"./physicsMaterial\";\r\nimport { Matrix, Vector3, Quaternion, TmpVectors } from \"../../Maths/math.vector\";\r\nimport type { GroundMesh } from \"../../Meshes/groundMesh\";\r\nimport type { Mesh } from \"../../Meshes/mesh\";\r\nimport type { Scene } from \"../../scene\";\r\n\r\n/**\r\n * Options for creating a physics shape\r\n */\r\nexport interface PhysicShapeOptions {\r\n /**\r\n * The type of the shape. This can be one of the following: SPHERE, BOX, CAPSULE, CYLINDER, CONVEX_HULL, MESH, HEIGHTFIELD, CONTAINER\r\n */\r\n type?: PhysicsShapeType;\r\n /**\r\n * The parameters of the shape. Varies depending of the shape type.\r\n */\r\n parameters?: PhysicsShapeParameters;\r\n /**\r\n * Reference to an already existing physics shape in the plugin.\r\n */\r\n pluginData?: any;\r\n}\r\n\r\n/**\r\n * PhysicsShape class.\r\n * This class is useful for creating a physics shape that can be used in a physics engine.\r\n * A Physic Shape determine how collision are computed. It must be attached to a body.\r\n */\r\nexport class PhysicsShape {\r\n /**\r\n * V2 Physics plugin private data for single shape\r\n */\r\n public _pluginData: any = undefined;\r\n /**\r\n * The V2 plugin used to create and manage this Physics Body\r\n */\r\n private _physicsPlugin: IPhysicsEnginePluginV2;\r\n\r\n private _type: PhysicsShapeType;\r\n\r\n private _material: PhysicsMaterial;\r\n\r\n private _isTrigger: boolean = false;\r\n\r\n private _isDisposed = false;\r\n\r\n /**\r\n * Constructs a new physics shape.\r\n * @param options The options for the physics shape. These are:\r\n * * type: The type of the shape. This can be one of the following: SPHERE, BOX, CAPSULE, CYLINDER, CONVEX_HULL, MESH, HEIGHTFIELD, CONTAINER\r\n * * parameters: The parameters of the shape.\r\n * * pluginData: The plugin data of the shape. This is used if you already have a reference to the object on the plugin side.\r\n * You need to specify either type or pluginData.\r\n * @param scene The scene the shape belongs to.\r\n *\r\n * This code is useful for creating a new physics shape with the given type, options, and scene.\r\n * It also checks that the physics engine and plugin version are correct.\r\n * If not, it throws an error. This ensures that the shape is created with the correct parameters and is compatible with the physics engine.\r\n */\r\n constructor(options: PhysicShapeOptions, scene: Scene) {\r\n if (!scene) {\r\n return;\r\n }\r\n const physicsEngine = scene.getPhysicsEngine();\r\n if (!physicsEngine) {\r\n throw new Error(\"No Physics Engine available.\");\r\n }\r\n if (physicsEngine.getPluginVersion() != 2) {\r\n throw new Error(\"Plugin version is incorrect. Expected version 2.\");\r\n }\r\n const physicsPlugin = physicsEngine.getPhysicsPlugin();\r\n if (!physicsPlugin) {\r\n throw new Error(\"No Physics Plugin available.\");\r\n }\r\n this._physicsPlugin = physicsPlugin as IPhysicsEnginePluginV2;\r\n\r\n if (options.pluginData !== undefined && options.pluginData !== null) {\r\n this._pluginData = options.pluginData;\r\n this._type = this._physicsPlugin.getShapeType(this);\r\n } else if (options.type !== undefined && options.type !== null) {\r\n this._type = options.type;\r\n const parameters = options.parameters ?? {};\r\n this._physicsPlugin.initShape(this, options.type, parameters);\r\n }\r\n }\r\n\r\n /**\r\n * Returns the string \"PhysicsShape\".\r\n * @returns \"PhysicsShape\"\r\n */\r\n public getClassName() {\r\n return \"PhysicsShape\";\r\n }\r\n\r\n /**\r\n * Returns the type of the physics shape.\r\n * @returns The type of the physics shape.\r\n */\r\n public get type(): PhysicsShapeType {\r\n return this._type;\r\n }\r\n\r\n /**\r\n * Set the membership mask of a shape. This is a bitfield of arbitrary\r\n * \"categories\" to which the shape is a member. This is used in combination\r\n * with the collide mask to determine if this shape should collide with\r\n * another.\r\n *\r\n * @param membershipMask Bitfield of categories of this shape.\r\n */\r\n public set filterMembershipMask(membershipMask: number) {\r\n this._physicsPlugin.setShapeFilterMembershipMask(this, membershipMask);\r\n }\r\n\r\n /**\r\n * Get the membership mask of a shape.\r\n * @returns Bitmask of categories which this shape is a member of.\r\n */\r\n public get filterMembershipMask(): number {\r\n return this._physicsPlugin.getShapeFilterMembershipMask(this);\r\n }\r\n\r\n /**\r\n * Sets the collide mask of a shape. This is a bitfield of arbitrary\r\n * \"categories\" to which this shape collides with. Given two shapes,\r\n * the engine will check if the collide mask and membership overlap:\r\n * shapeA.filterMembershipMask & shapeB.filterCollideMask\r\n *\r\n * If this value is zero (i.e. shapeB only collides with categories\r\n * which shapeA is _not_ a member of) then the shapes will not collide.\r\n *\r\n * Note, the engine will also perform the same test with shapeA and\r\n * shapeB swapped; the shapes will not collide if either shape has\r\n * a collideMask which prevents collision with the other shape.\r\n *\r\n * @param collideMask Bitmask of categories this shape should collide with\r\n */\r\n public set filterCollideMask(collideMask: number) {\r\n this._physicsPlugin.setShapeFilterCollideMask(this, collideMask);\r\n }\r\n\r\n /**\r\n *\r\n * @returns Bitmask of categories that this shape should collide with\r\n */\r\n public get filterCollideMask(): number {\r\n return this._physicsPlugin.getShapeFilterCollideMask(this);\r\n }\r\n /**\r\n *\r\n * @param material\r\n */\r\n public set material(material: PhysicsMaterial) {\r\n this._physicsPlugin.setMaterial(this, material);\r\n this._material = material;\r\n }\r\n\r\n /**\r\n * Returns the material of the physics shape.\r\n * @returns The material of the physics shape.\r\n */\r\n public get material(): PhysicsMaterial {\r\n if (!this._material) {\r\n this._material = this._physicsPlugin.getMaterial(this);\r\n }\r\n return this._material;\r\n }\r\n\r\n /**\r\n * Sets the density of the physics shape.\r\n * @param density The density of the physics shape.\r\n */\r\n public set density(density: number) {\r\n this._physicsPlugin.setDensity(this, density);\r\n }\r\n\r\n /**\r\n * Returns the density of the physics shape.\r\n * @returns The density of the physics shape.\r\n */\r\n public get density(): number {\r\n return this._physicsPlugin.getDensity(this);\r\n }\r\n\r\n /**\r\n * Utility to add a child shape to this container,\r\n * automatically computing the relative transform between\r\n * the container shape and the child instance.\r\n *\r\n * @param parentTransform The transform node associated with this shape\r\n * @param newChild The new PhysicsShape to add\r\n * @param childTransform The transform node associated with the child shape\r\n */\r\n public addChildFromParent(parentTransform: TransformNode, newChild: PhysicsShape, childTransform: TransformNode): void {\r\n const childToWorld = childTransform.computeWorldMatrix(true);\r\n const parentToWorld = parentTransform.computeWorldMatrix(true);\r\n const childToParent = TmpVectors.Matrix[0];\r\n childToWorld.multiplyToRef(Matrix.Invert(parentToWorld), childToParent);\r\n const translation = TmpVectors.Vector3[0];\r\n const rotation = TmpVectors.Quaternion[0];\r\n const scale = TmpVectors.Vector3[1];\r\n childToParent.decompose(scale, rotation, translation);\r\n this._physicsPlugin.addChild(this, newChild, translation, rotation, scale);\r\n }\r\n\r\n /**\r\n * Adds a child shape to a container with an optional transform\r\n * @param newChild The new PhysicsShape to add\r\n * @param translation Optional position of the child shape relative to this shape\r\n * @param rotation Optional rotation of the child shape relative to this shape\r\n * @param scale Optional scale of the child shape relative to this shape\r\n */\r\n public addChild(newChild: PhysicsShape, translation?: Vector3, rotation?: Quaternion, scale?: Vector3): void {\r\n this._physicsPlugin.addChild(this, newChild, translation, rotation, scale);\r\n }\r\n\r\n /**\r\n * Removes a child shape from this shape.\r\n * @param childIndex The index of the child shape to remove\r\n */\r\n public removeChild(childIndex: number): void {\r\n this._physicsPlugin.removeChild(this, childIndex);\r\n }\r\n\r\n /**\r\n * Returns the number of children of a physics shape.\r\n * @returns The number of children of a physics shape.\r\n */\r\n public getNumChildren(): number {\r\n return this._physicsPlugin.getNumChildren(this);\r\n }\r\n\r\n /**\r\n * Returns the bounding box of the physics shape.\r\n * @returns The bounding box of the physics shape.\r\n */\r\n public getBoundingBox(): BoundingBox {\r\n return this._physicsPlugin.getBoundingBox(this);\r\n }\r\n\r\n public set isTrigger(isTrigger: boolean) {\r\n if (this._isTrigger === isTrigger) {\r\n return;\r\n }\r\n this._isTrigger = isTrigger;\r\n this._physicsPlugin.setTrigger(this, isTrigger);\r\n }\r\n\r\n public get isTrigger(): boolean {\r\n return this._isTrigger;\r\n }\r\n\r\n /**\r\n * Dispose the shape and release its associated resources.\r\n */\r\n public dispose() {\r\n if (this._isDisposed) {\r\n return;\r\n }\r\n this._physicsPlugin.disposeShape(this);\r\n this._isDisposed = true;\r\n }\r\n}\r\n\r\n/**\r\n * Helper object to create a sphere shape\r\n */\r\nexport class PhysicsShapeSphere extends PhysicsShape {\r\n /**\r\n * Constructor for the Sphere Shape\r\n * @param center local center of the sphere\r\n * @param radius radius\r\n * @param scene scene to attach to\r\n */\r\n constructor(center: Vector3, radius: number, scene: Scene) {\r\n super({ type: PhysicsShapeType.SPHERE, parameters: { center: center, radius: radius } }, scene);\r\n }\r\n\r\n /**\r\n * Derive an approximate sphere from the mesh.\r\n * @param mesh node from which to derive the sphere shape\r\n * @returns PhysicsShapeSphere\r\n */\r\n static FromMesh(mesh: AbstractMesh) {\r\n const bounds = mesh.getBoundingInfo();\r\n const centerLocal = bounds.boundingSphere.center;\r\n const he = bounds.boundingBox.extendSize;\r\n const radius = Math.max(he.x, he.y, he.z);\r\n return new PhysicsShapeSphere(centerLocal, radius, mesh.getScene());\r\n }\r\n}\r\n\r\n/**\r\n * Helper object to create a capsule shape\r\n */\r\nexport class PhysicsShapeCapsule extends PhysicsShape {\r\n /**\r\n *\r\n * @param pointA Starting point that defines the capsule segment\r\n * @param pointB ending point of that same segment\r\n * @param radius radius\r\n * @param scene scene to attach to\r\n */\r\n constructor(pointA: Vector3, pointB: Vector3, radius: number, scene: Scene) {\r\n super({ type: PhysicsShapeType.CAPSULE, parameters: { pointA: pointA, pointB: pointB, radius: radius } }, scene);\r\n }\r\n\r\n /**\r\n * Derive an approximate capsule from the mesh. Note, this is\r\n * not the optimal bounding capsule.\r\n * @param mesh Node from which to derive a cylinder shape\r\n * @returns Physics Shape Capsule\r\n */\r\n static FromMesh(mesh: AbstractMesh): PhysicsShapeCapsule {\r\n const boundsLocal = mesh.getBoundingInfo();\r\n const radius = boundsLocal.boundingBox.extendSize.x;\r\n const pointFromCenter = new Vector3(0, boundsLocal.boundingBox.extendSize.y - radius, 0);\r\n const pointA = boundsLocal.boundingBox.center.add(pointFromCenter);\r\n const pointB = boundsLocal.boundingBox.center.subtract(pointFromCenter);\r\n return new PhysicsShapeCapsule(pointA, pointB, radius, mesh.getScene());\r\n }\r\n}\r\n\r\n/**\r\n * Helper object to create a cylinder shape\r\n */\r\nexport class PhysicsShapeCylinder extends PhysicsShape {\r\n /**\r\n *\r\n * @param pointA Starting point that defines the cylinder segment\r\n * @param pointB ending point of that same segment\r\n * @param radius radius\r\n * @param scene scene to attach to\r\n */\r\n constructor(pointA: Vector3, pointB: Vector3, radius: number, scene: Scene) {\r\n super({ type: PhysicsShapeType.CYLINDER, parameters: { pointA: pointA, pointB: pointB, radius: radius } }, scene);\r\n }\r\n\r\n /**\r\n * Derive an approximate cylinder from the mesh. Note, this is\r\n * not the optimal bounding cylinder.\r\n * @param mesh Node from which to derive a cylinder shape\r\n * @returns Physics Shape Cylinder\r\n */\r\n static FromMesh(mesh: AbstractMesh): PhysicsShapeCylinder {\r\n const boundsLocal = mesh.getBoundingInfo();\r\n const radius = boundsLocal.boundingBox.extendSize.x;\r\n const pointFromCenter = new Vector3(0, boundsLocal.boundingBox.extendSize.y, 0);\r\n const pointA = boundsLocal.boundingBox.center.add(pointFromCenter);\r\n const pointB = boundsLocal.boundingBox.center.subtract(pointFromCenter);\r\n return new PhysicsShapeCylinder(pointA, pointB, radius, mesh.getScene());\r\n }\r\n}\r\n\r\n/**\r\n * Helper object to create a box shape\r\n */\r\nexport class PhysicsShapeBox extends PhysicsShape {\r\n /**\r\n *\r\n * @param center local center of the box\r\n * @param rotation local orientation\r\n * @param extents size of the box in each direction\r\n * @param scene scene to attach to\r\n */\r\n constructor(center: Vector3, rotation: Quaternion, extents: Vector3, scene: Scene) {\r\n super({ type: PhysicsShapeType.BOX, parameters: { center: center, rotation: rotation, extents: extents } }, scene);\r\n }\r\n\r\n /**\r\n *\r\n * @param mesh\r\n * @returns PhysicsShapeBox\r\n */\r\n static FromMesh(mesh: AbstractMesh): PhysicsShapeBox {\r\n const bounds = mesh.getBoundingInfo();\r\n const centerLocal = bounds.boundingBox.center;\r\n const extents = bounds.boundingBox.extendSize.scale(2.0); //<todo.eoin extendSize seems to really be half-extents?\r\n return new PhysicsShapeBox(centerLocal, Quaternion.Identity(), extents, mesh.getScene());\r\n }\r\n}\r\n\r\n/**\r\n * Helper object to create a convex hull shape\r\n */\r\nexport class PhysicsShapeConvexHull extends PhysicsShape {\r\n /**\r\n *\r\n * @param mesh the mesh to be used as topology infos for the convex hull\r\n * @param scene scene to attach to\r\n */\r\n constructor(mesh: Mesh, scene: Scene) {\r\n super({ type: PhysicsShapeType.CONVEX_HULL, parameters: { mesh: mesh } }, scene);\r\n }\r\n}\r\n\r\n/**\r\n * Helper object to create a mesh shape\r\n */\r\nexport class PhysicsShapeMesh extends PhysicsShape {\r\n /**\r\n *\r\n * @param mesh the mesh topology that will be used to create the shape\r\n * @param scene scene to attach to\r\n */\r\n constructor(mesh: Mesh, scene: Scene) {\r\n super({ type: PhysicsShapeType.MESH, parameters: { mesh: mesh } }, scene);\r\n }\r\n}\r\n\r\n/**\r\n * A shape container holds a variable number of shapes. Use AddChild to append to newly created parent container.\r\n */\r\nexport class PhysicsShapeContainer extends PhysicsShape {\r\n /**\r\n * Constructor of the Shape container\r\n * @param scene scene to attach to\r\n */\r\n constructor(scene: Scene) {\r\n super({ type: PhysicsShapeType.CONTAINER, parameters: {} }, scene);\r\n }\r\n}\r\n\r\n/**\r\n * Helper object to create a heightfield Shape\r\n */\r\nexport class PhysicsShapeHeightField extends PhysicsShape {\r\n /**\r\n * Constructor of the Shape heightfield\r\n * @param heightFieldSizeX The size of the heightfield in the X axis\r\n * @param heightFieldSizeZ The size of the heightfield in the Z axis\r\n * @param numHeightFieldSamplesX The number of samples along the X axis\r\n * @param numHeightFieldSamplesZ The number of samples along the Z axis\r\n * @param heightFieldData The data for the heightfield\r\n * @param scene scene to attach to\r\n */\r\n constructor(heightFieldSizeX: number, heightFieldSizeZ: number, numHeightFieldSamplesX: number, numHeightFieldSamplesZ: number, heightFieldData: Float32Array, scene: Scene) {\r\n super(\r\n {\r\n type: PhysicsShapeType.HEIGHTFIELD,\r\n parameters: {\r\n heightFieldSizeX: heightFieldSizeX,\r\n heightFieldSizeZ: heightFieldSizeZ,\r\n numHeightFieldSamplesX: numHeightFieldSamplesX,\r\n numHeightFieldSamplesZ: numHeightFieldSamplesZ,\r\n heightFieldData: heightFieldData,\r\n },\r\n },\r\n scene\r\n );\r\n }\r\n}\r\n\r\n/**\r\n * Helper object to create a ground mesh Shape\r\n */\r\nexport class PhysicsShapeGroundMesh extends PhysicsShape {\r\n /**\r\n * Constructor of the Shape heightfield\r\n * @param groundMesh ground mesh used for display\r\n * @param scene scene to attach to\r\n */\r\n constructor(groundMesh: GroundMesh, scene: Scene) {\r\n super({ type: PhysicsShapeType.HEIGHTFIELD, parameters: { groundMesh: groundMesh } }, scene);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"physicsShape.js","sourceRoot":"","sources":["../../../../../dev/core/src/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C,sBAAsB,EAAE,sBAAsB;gBAC9C,sBAAsB,EAAE,sBAAsB;gBAC9C,eAAe,EAAE,eAAe;aACnC;SACJ,EACD,KAAK,CACR,CAAC;IACN,CAAC;CACJ;AAED;;GAEG;AACH,MAAM,OAAO,sBAAuB,SAAQ,YAAY;IACpD;;;;OAIG;IACH,YAAY,UAAsB,EAAE,KAAY;QAC5C,KAAK,CAAC,EAAE,IAAI,sCAA8B,EAAE,UAAU,EAAE,EAAE,UAAU,EAAE,UAAU,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;IACjG,CAAC;CACJ","sourcesContent":["import type { TransformNode } from \"../../Meshes/transformNode\";\r\nimport type { AbstractMesh } from \"../../Meshes/abstractMesh\";\r\nimport type { BoundingBox } from \"../../Culling/boundingBox\";\r\nimport { PhysicsShapeType } from \"./IPhysicsEnginePlugin\";\r\nimport type { IPhysicsEnginePluginV2, PhysicsShapeParameters } from \"./IPhysicsEnginePlugin\";\r\nimport type { PhysicsMaterial } from \"./physicsMaterial\";\r\nimport { Matrix, Vector3, Quaternion, TmpVectors } from \"../../Maths/math.vector\";\r\nimport type { GroundMesh } from \"../../Meshes/groundMesh\";\r\nimport type { Mesh } from \"../../Meshes/mesh\";\r\nimport type { Scene } from \"../../scene\";\r\n\r\n/**\r\n * Options for creating a physics shape\r\n */\r\nexport interface PhysicShapeOptions {\r\n /**\r\n * The type of the shape. This can be one of the following: SPHERE, BOX, CAPSULE, CYLINDER, CONVEX_HULL, MESH, HEIGHTFIELD, CONTAINER\r\n */\r\n type?: PhysicsShapeType;\r\n /**\r\n * The parameters of the shape. Varies depending of the shape type.\r\n */\r\n parameters?: PhysicsShapeParameters;\r\n /**\r\n * Reference to an already existing physics shape in the plugin.\r\n */\r\n pluginData?: any;\r\n}\r\n\r\n/**\r\n * PhysicsShape class.\r\n * This class is useful for creating a physics shape that can be used in a physics engine.\r\n * A Physic Shape determine how collision are computed. It must be attached to a body.\r\n */\r\nexport class PhysicsShape {\r\n /**\r\n * V2 Physics plugin private data for single shape\r\n */\r\n public _pluginData: any = undefined;\r\n /**\r\n * The V2 plugin used to create and manage this Physics Body\r\n */\r\n private _physicsPlugin: IPhysicsEnginePluginV2;\r\n\r\n private _type: PhysicsShapeType;\r\n\r\n private _material: PhysicsMaterial;\r\n\r\n private _isTrigger: boolean = false;\r\n\r\n private _isDisposed = false;\r\n\r\n /**\r\n * Constructs a new physics shape.\r\n * @param options The options for the physics shape. These are:\r\n * * type: The type of the shape. This can be one of the following: SPHERE, BOX, CAPSULE, CYLINDER, CONVEX_HULL, MESH, HEIGHTFIELD, CONTAINER\r\n * * parameters: The parameters of the shape.\r\n * * pluginData: The plugin data of the shape. This is used if you already have a reference to the object on the plugin side.\r\n * You need to specify either type or pluginData.\r\n * @param scene The scene the shape belongs to.\r\n *\r\n * This code is useful for creating a new physics shape with the given type, options, and scene.\r\n * It also checks that the physics engine and plugin version are correct.\r\n * If not, it throws an error. This ensures that the shape is created with the correct parameters and is compatible with the physics engine.\r\n */\r\n constructor(options: PhysicShapeOptions, scene: Scene) {\r\n if (!scene) {\r\n return;\r\n }\r\n const physicsEngine = scene.getPhysicsEngine();\r\n if (!physicsEngine) {\r\n throw new Error(\"No Physics Engine available.\");\r\n }\r\n if (physicsEngine.getPluginVersion() != 2) {\r\n throw new Error(\"Plugin version is incorrect. Expected version 2.\");\r\n }\r\n const physicsPlugin = physicsEngine.getPhysicsPlugin();\r\n if (!physicsPlugin) {\r\n throw new Error(\"No Physics Plugin available.\");\r\n }\r\n this._physicsPlugin = physicsPlugin as IPhysicsEnginePluginV2;\r\n\r\n if (options.pluginData !== undefined && options.pluginData !== null) {\r\n this._pluginData = options.pluginData;\r\n this._type = this._physicsPlugin.getShapeType(this);\r\n } else if (options.type !== undefined && options.type !== null) {\r\n this._type = options.type;\r\n const parameters = options.parameters ?? {};\r\n this._physicsPlugin.initShape(this, options.type, parameters);\r\n }\r\n }\r\n\r\n /**\r\n * Returns the string \"PhysicsShape\".\r\n * @returns \"PhysicsShape\"\r\n */\r\n public getClassName() {\r\n return \"PhysicsShape\";\r\n }\r\n\r\n /**\r\n * Returns the type of the physics shape.\r\n * @returns The type of the physics shape.\r\n */\r\n public get type(): PhysicsShapeType {\r\n return this._type;\r\n }\r\n\r\n /**\r\n * Set the membership mask of a shape. This is a bitfield of arbitrary\r\n * \"categories\" to which the shape is a member. This is used in combination\r\n * with the collide mask to determine if this shape should collide with\r\n * another.\r\n *\r\n * @param membershipMask Bitfield of categories of this shape.\r\n */\r\n public set filterMembershipMask(membershipMask: number) {\r\n this._physicsPlugin.setShapeFilterMembershipMask(this, membershipMask);\r\n }\r\n\r\n /**\r\n * Get the membership mask of a shape.\r\n * @returns Bitmask of categories which this shape is a member of.\r\n */\r\n public get filterMembershipMask(): number {\r\n return this._physicsPlugin.getShapeFilterMembershipMask(this);\r\n }\r\n\r\n /**\r\n * Sets the collide mask of a shape. This is a bitfield of arbitrary\r\n * \"categories\" to which this shape collides with. Given two shapes,\r\n * the engine will check if the collide mask and membership overlap:\r\n * shapeA.filterMembershipMask & shapeB.filterCollideMask\r\n *\r\n * If this value is zero (i.e. shapeB only collides with categories\r\n * which shapeA is _not_ a member of) then the shapes will not collide.\r\n *\r\n * Note, the engine will also perform the same test with shapeA and\r\n * shapeB swapped; the shapes will not collide if either shape has\r\n * a collideMask which prevents collision with the other shape.\r\n *\r\n * @param collideMask Bitmask of categories this shape should collide with\r\n */\r\n public set filterCollideMask(collideMask: number) {\r\n this._physicsPlugin.setShapeFilterCollideMask(this, collideMask);\r\n }\r\n\r\n /**\r\n *\r\n * @returns Bitmask of categories that this shape should collide with\r\n */\r\n public get filterCollideMask(): number {\r\n return this._physicsPlugin.getShapeFilterCollideMask(this);\r\n }\r\n /**\r\n *\r\n * @param material\r\n */\r\n public set material(material: PhysicsMaterial) {\r\n this._physicsPlugin.setMaterial(this, material);\r\n this._material = material;\r\n }\r\n\r\n /**\r\n * Returns the material of the physics shape.\r\n * @returns The material of the physics shape.\r\n */\r\n public get material(): PhysicsMaterial {\r\n if (!this._material) {\r\n this._material = this._physicsPlugin.getMaterial(this);\r\n }\r\n return this._material;\r\n }\r\n\r\n /**\r\n * Sets the density of the physics shape.\r\n * @param density The density of the physics shape.\r\n */\r\n public set density(density: number) {\r\n this._physicsPlugin.setDensity(this, density);\r\n }\r\n\r\n /**\r\n * Returns the density of the physics shape.\r\n * @returns The density of the physics shape.\r\n */\r\n public get density(): number {\r\n return this._physicsPlugin.getDensity(this);\r\n }\r\n\r\n /**\r\n * Utility to add a child shape to this container,\r\n * automatically computing the relative transform between\r\n * the container shape and the child instance.\r\n *\r\n * @param parentTransform The transform node associated with this shape\r\n * @param newChild The new PhysicsShape to add\r\n * @param childTransform The transform node associated with the child shape\r\n */\r\n public addChildFromParent(parentTransform: TransformNode, newChild: PhysicsShape, childTransform: TransformNode): void {\r\n const childToWorld = childTransform.computeWorldMatrix(true);\r\n const parentToWorld = parentTransform.computeWorldMatrix(true);\r\n const childToParent = TmpVectors.Matrix[0];\r\n childToWorld.multiplyToRef(Matrix.Invert(parentToWorld), childToParent);\r\n const translation = TmpVectors.Vector3[0];\r\n const rotation = TmpVectors.Quaternion[0];\r\n const scale = TmpVectors.Vector3[1];\r\n childToParent.decompose(scale, rotation, translation);\r\n this._physicsPlugin.addChild(this, newChild, translation, rotation, scale);\r\n }\r\n\r\n /**\r\n * Adds a child shape to a container with an optional transform\r\n * @param newChild The new PhysicsShape to add\r\n * @param translation Optional position of the child shape relative to this shape\r\n * @param rotation Optional rotation of the child shape relative to this shape\r\n * @param scale Optional scale of the child shape relative to this shape\r\n */\r\n public addChild(newChild: PhysicsShape, translation?: Vector3, rotation?: Quaternion, scale?: Vector3): void {\r\n this._physicsPlugin.addChild(this, newChild, translation, rotation, scale);\r\n }\r\n\r\n /**\r\n * Removes a child shape from this shape.\r\n * @param childIndex The index of the child shape to remove\r\n */\r\n public removeChild(childIndex: number): void {\r\n this._physicsPlugin.removeChild(this, childIndex);\r\n }\r\n\r\n /**\r\n * Returns the number of children of a physics shape.\r\n * @returns The number of children of a physics shape.\r\n */\r\n public getNumChildren(): number {\r\n return this._physicsPlugin.getNumChildren(this);\r\n }\r\n\r\n /**\r\n * Returns the bounding box of the physics shape.\r\n * @returns The bounding box of the physics shape.\r\n */\r\n public getBoundingBox(): BoundingBox {\r\n return this._physicsPlugin.getBoundingBox(this);\r\n }\r\n\r\n public set isTrigger(isTrigger: boolean) {\r\n if (this._isTrigger === isTrigger) {\r\n return;\r\n }\r\n this._isTrigger = isTrigger;\r\n this._physicsPlugin.setTrigger(this, isTrigger);\r\n }\r\n\r\n public get isTrigger(): boolean {\r\n return this._isTrigger;\r\n }\r\n\r\n /**\r\n * Dispose the shape and release its associated resources.\r\n */\r\n public dispose() {\r\n if (this._isDisposed) {\r\n return;\r\n }\r\n this._physicsPlugin.disposeShape(this);\r\n this._isDisposed = true;\r\n }\r\n}\r\n\r\n/**\r\n * Helper object to create a sphere shape\r\n */\r\nexport class PhysicsShapeSphere extends PhysicsShape {\r\n /**\r\n * Constructor for the Sphere Shape\r\n * @param center local center of the sphere\r\n * @param radius radius\r\n * @param scene scene to attach to\r\n */\r\n constructor(center: Vector3, radius: number, scene: Scene) {\r\n super({ type: PhysicsShapeType.SPHERE, parameters: { center: center, radius: radius } }, scene);\r\n }\r\n\r\n /**\r\n * Derive an approximate sphere from the mesh.\r\n * @param mesh node from which to derive the sphere shape\r\n * @returns PhysicsShapeSphere\r\n */\r\n static FromMesh(mesh: AbstractMesh) {\r\n const bounds = mesh.getBoundingInfo();\r\n const centerLocal = bounds.boundingSphere.center;\r\n const he = bounds.boundingBox.extendSize;\r\n const radius = Math.max(he.x, he.y, he.z);\r\n return new PhysicsShapeSphere(centerLocal, radius, mesh.getScene());\r\n }\r\n}\r\n\r\n/**\r\n * Helper object to create a capsule shape\r\n */\r\nexport class PhysicsShapeCapsule extends PhysicsShape {\r\n /**\r\n *\r\n * @param pointA Starting point that defines the capsule segment\r\n * @param pointB ending point of that same segment\r\n * @param radius radius\r\n * @param scene scene to attach to\r\n */\r\n constructor(pointA: Vector3, pointB: Vector3, radius: number, scene: Scene) {\r\n super({ type: PhysicsShapeType.CAPSULE, parameters: { pointA: pointA, pointB: pointB, radius: radius } }, scene);\r\n }\r\n\r\n /**\r\n * Derive an approximate capsule from the mesh. Note, this is\r\n * not the optimal bounding capsule.\r\n * @param mesh Node from which to derive a cylinder shape\r\n * @returns Physics Shape Capsule\r\n */\r\n static FromMesh(mesh: AbstractMesh): PhysicsShapeCapsule {\r\n const boundsLocal = mesh.getBoundingInfo();\r\n const radius = boundsLocal.boundingBox.extendSize.x;\r\n const pointFromCenter = new Vector3(0, boundsLocal.boundingBox.extendSize.y - radius, 0);\r\n const pointA = boundsLocal.boundingBox.center.add(pointFromCenter);\r\n const pointB = boundsLocal.boundingBox.center.subtract(pointFromCenter);\r\n return new PhysicsShapeCapsule(pointA, pointB, radius, mesh.getScene());\r\n }\r\n}\r\n\r\n/**\r\n * Helper object to create a cylinder shape\r\n */\r\nexport class PhysicsShapeCylinder extends PhysicsShape {\r\n /**\r\n *\r\n * @param pointA Starting point that defines the cylinder segment\r\n * @param pointB ending point of that same segment\r\n * @param radius radius\r\n * @param scene scene to attach to\r\n */\r\n constructor(pointA: Vector3, pointB: Vector3, radius: number, scene: Scene) {\r\n super({ type: PhysicsShapeType.CYLINDER, parameters: { pointA: pointA, pointB: pointB, radius: radius } }, scene);\r\n }\r\n\r\n /**\r\n * Derive an approximate cylinder from the mesh. Note, this is\r\n * not the optimal bounding cylinder.\r\n * @param mesh Node from which to derive a cylinder shape\r\n * @returns Physics Shape Cylinder\r\n */\r\n static FromMesh(mesh: AbstractMesh): PhysicsShapeCylinder {\r\n const boundsLocal = mesh.getBoundingInfo();\r\n const radius = boundsLocal.boundingBox.extendSize.x;\r\n const pointFromCenter = new Vector3(0, boundsLocal.boundingBox.extendSize.y, 0);\r\n const pointA = boundsLocal.boundingBox.center.add(pointFromCenter);\r\n const pointB = boundsLocal.boundingBox.center.subtract(pointFromCenter);\r\n return new PhysicsShapeCylinder(pointA, pointB, radius, mesh.getScene());\r\n }\r\n}\r\n\r\n/**\r\n * Helper object to create a box shape\r\n */\r\nexport class PhysicsShapeBox extends PhysicsShape {\r\n /**\r\n *\r\n * @param center local center of the box\r\n * @param rotation local orientation\r\n * @param extents size of the box in each direction\r\n * @param scene scene to attach to\r\n */\r\n constructor(center: Vector3, rotation: Quaternion, extents: Vector3, scene: Scene) {\r\n super({ type: PhysicsShapeType.BOX, parameters: { center: center, rotation: rotation, extents: extents } }, scene);\r\n }\r\n\r\n /**\r\n *\r\n * @param mesh\r\n * @returns PhysicsShapeBox\r\n */\r\n static FromMesh(mesh: AbstractMesh): PhysicsShapeBox {\r\n const bounds = mesh.getBoundingInfo();\r\n const centerLocal = bounds.boundingBox.center;\r\n const extents = bounds.boundingBox.extendSize.scale(2.0); //<todo.eoin extendSize seems to really be half-extents?\r\n return new PhysicsShapeBox(centerLocal, Quaternion.Identity(), extents, mesh.getScene());\r\n }\r\n}\r\n\r\n/**\r\n * Helper object to create a convex hull shape\r\n */\r\nexport class PhysicsShapeConvexHull extends PhysicsShape {\r\n /**\r\n *\r\n * @param mesh the mesh to be used as topology infos for the convex hull\r\n * @param scene scene to attach to\r\n */\r\n constructor(mesh: Mesh, scene: Scene) {\r\n super({ type: PhysicsShapeType.CONVEX_HULL, parameters: { mesh: mesh } }, scene);\r\n }\r\n}\r\n\r\n/**\r\n * Helper object to create a mesh shape\r\n */\r\nexport class PhysicsShapeMesh extends PhysicsShape {\r\n /**\r\n *\r\n * @param mesh the mesh topology that will be used to create the shape\r\n * @param scene scene to attach to\r\n */\r\n constructor(mesh: Mesh, scene: Scene) {\r\n super({ type: PhysicsShapeType.MESH, parameters: { mesh: mesh } }, scene);\r\n }\r\n}\r\n\r\n/**\r\n * A shape container holds a variable number of shapes. Use AddChild to append to newly created parent container.\r\n */\r\nexport class PhysicsShapeContainer extends PhysicsShape {\r\n /**\r\n * Constructor of the Shape container\r\n * @param scene scene to attach to\r\n */\r\n constructor(scene: Scene) {\r\n super({ type: PhysicsShapeType.CONTAINER, parameters: {} }, scene);\r\n }\r\n}\r\n\r\n/**\r\n * Helper object to create a heightfield Shape\r\n */\r\nexport class PhysicsShapeHeightField extends PhysicsShape {\r\n /**\r\n * Constructor of the Shape heightfield\r\n * @param heightFieldSizeX The size of the heightfield in the X axis\r\n * @param heightFieldSizeZ The size of the heightfield in the Z axis\r\n * @param numHeightFieldSamplesX The number of samples along the X axis\r\n * @param numHeightFieldSamplesZ The number of samples along the Z axis\r\n * @param heightFieldData The data for the heightfield\r\n * @param scene scene to attach to\r\n */\r\n constructor(heightFieldSizeX: number, heightFieldSizeZ: number, numHeightFieldSamplesX: number, numHeightFieldSamplesZ: number, heightFieldData: Float32Array, scene: Scene) {\r\n super(\r\n {\r\n type: PhysicsShapeType.HEIGHTFIELD,\r\n parameters: {\r\n heightFieldSizeX: heightFieldSizeX,\r\n heightFieldSizeZ: heightFieldSizeZ,\r\n numHeightFieldSamplesX: numHeightFieldSamplesX,\r\n numHeightFieldSamplesZ: numHeightFieldSamplesZ,\r\n heightFieldData: heightFieldData,\r\n },\r\n },\r\n scene\r\n );\r\n }\r\n}\r\n\r\n/**\r\n * Helper object to create a ground mesh Shape\r\n */\r\nexport class PhysicsShapeGroundMesh extends PhysicsShape {\r\n /**\r\n * Constructor of the Shape heightfield\r\n * @param groundMesh ground mesh used for display\r\n * @param scene scene to attach to\r\n */\r\n constructor(groundMesh: GroundMesh, scene: Scene) {\r\n super({ type: PhysicsShapeType.HEIGHTFIELD, parameters: { groundMesh: groundMesh } }, scene);\r\n }\r\n}\r\n"]}
@@ -1,8 +1,7 @@
1
1
  import { Vector3, Matrix, TmpVectors, Quaternion } from "../../Maths/math.vector.js";
2
2
  import { PhysicsAggregate } from "./physicsAggregate.js";
3
3
  import { PhysicsConstraint } from "./physicsConstraint.js";
4
- import { Axis, Space } from "../../Maths/math.axis.js";
5
- import { PhysicsShapeType, PhysicsConstraintType, PhysicsMotionType } from "./IPhysicsEnginePlugin.js";
4
+ import { Axis } from "../../Maths/math.axis.js";
6
5
  import { Logger } from "../../Misc/logger.js";
7
6
  import { TransformNode } from "../../Meshes/transformNode.js";
8
7
  /**
@@ -41,7 +40,7 @@ export class Ragdoll {
41
40
  * Pause synchronization between physics and bone position/orientation
42
41
  */
43
42
  this.pauseSync = false;
44
- this._defaultJoint = PhysicsConstraintType.HINGE;
43
+ this._defaultJoint = 3 /* PhysicsConstraintType.HINGE */;
45
44
  this._defaultJointMin = -90;
46
45
  this._defaultJointMax = 90;
47
46
  this._skeleton = skeleton;
@@ -50,7 +49,7 @@ export class Ragdoll {
50
49
  this._config = config; // initial, user defined box configs. May have several box configs jammed into 1 index.
51
50
  this._boxConfigs = []; // final box configs. Every element is a separate box config (this.config may have several configs jammed into 1 index).
52
51
  this._putBoxesInBoneCenter = false;
53
- this._defaultJoint = PhysicsConstraintType.HINGE;
52
+ this._defaultJoint = 3 /* PhysicsConstraintType.HINGE */;
54
53
  this._init();
55
54
  }
56
55
  /**
@@ -111,7 +110,7 @@ export class Ragdoll {
111
110
  transform.position = currentBone.getAbsolutePosition(this._rootTransformNode).add(boneDir.scale(boxOffset));
112
111
  const mass = config[i].mass !== undefined ? config[i].mass : this._mass;
113
112
  const restitution = config[i].restitution !== undefined ? config[i].restitution : this._restitution;
114
- const aggregate = new PhysicsAggregate(transform, PhysicsShapeType.BOX, {
113
+ const aggregate = new PhysicsAggregate(transform, 3 /* PhysicsShapeType.BOX */, {
115
114
  mass: mass,
116
115
  restitution: restitution,
117
116
  friction: 0.6,
@@ -119,14 +118,14 @@ export class Ragdoll {
119
118
  }, this._scene);
120
119
  aggregate.body.setCollisionCallbackEnabled(true);
121
120
  aggregate.body.disablePreStep = false;
122
- aggregate.body.setMotionType(PhysicsMotionType.ANIMATED);
121
+ aggregate.body.setMotionType(1 /* PhysicsMotionType.ANIMATED */);
123
122
  this._aggregates.push(aggregate);
124
123
  this._bones.push(currentBone);
125
124
  this._boneNames.push(currentBone.name);
126
125
  this._transforms.push(transform);
127
126
  this._boxConfigs.push(currentRagdollBoneProperties);
128
- this._initialRotation.push(currentBone.getRotationQuaternion(Space.WORLD, this._rootTransformNode));
129
- this._initialRotation2.push(currentBone.getRotationQuaternion(Space.WORLD));
127
+ this._initialRotation.push(currentBone.getRotationQuaternion(1 /* Space.WORLD */, this._rootTransformNode));
128
+ this._initialRotation2.push(currentBone.getRotationQuaternion(1 /* Space.WORLD */));
130
129
  }
131
130
  }
132
131
  }
@@ -149,7 +148,7 @@ export class Ragdoll {
149
148
  const boneAbsPos = this._bones[i].getAbsolutePosition(this._rootTransformNode);
150
149
  const boxAbsPos = this._transforms[i].position.clone();
151
150
  const myConnectedPivot = boneAbsPos.subtract(boxAbsPos);
152
- const joint = new PhysicsConstraint(PhysicsConstraintType.BALL_AND_SOCKET, {
151
+ const joint = new PhysicsConstraint(1 /* PhysicsConstraintType.BALL_AND_SOCKET */, {
153
152
  pivotA: distanceFromParentBoxToBone,
154
153
  pivotB: myConnectedPivot,
155
154
  axisA: this._boxConfigs[i].rotationAxis,
@@ -180,7 +179,7 @@ export class Ragdoll {
180
179
  const transform = this._aggregates[boneIndex].transformNode;
181
180
  const bone = this._bones[boneIndex];
182
181
  this._initialRotation[boneIndex].conjugateToRef(TmpVectors.Quaternion[0]);
183
- bone.getRotationQuaternionToRef(Space.WORLD, this._rootTransformNode, TmpVectors.Quaternion[1]);
182
+ bone.getRotationQuaternionToRef(1 /* Space.WORLD */, this._rootTransformNode, TmpVectors.Quaternion[1]);
184
183
  TmpVectors.Quaternion[1].multiplyToRef(TmpVectors.Quaternion[0], transform.rotationQuaternion);
185
184
  transform.rotationQuaternion.normalize();
186
185
  }
@@ -211,7 +210,7 @@ export class Ragdoll {
211
210
  const qphys = this._aggregates[boneIndex].body?.transformNode?.rotationQuaternion;
212
211
  qmesh.multiplyToRef(qbind, TmpVectors.Quaternion[1]);
213
212
  qphys.multiplyToRef(TmpVectors.Quaternion[1], TmpVectors.Quaternion[0]);
214
- this._bones[boneIndex].setRotationQuaternion(TmpVectors.Quaternion[0], Space.WORLD, this._rootTransformNode);
213
+ this._bones[boneIndex].setRotationQuaternion(TmpVectors.Quaternion[0], 1 /* Space.WORLD */, this._rootTransformNode);
215
214
  }
216
215
  // Return true if root bone is valid/exists in this.bonesNames. false otherwise.
217
216
  _defineRootBone() {
@@ -263,7 +262,7 @@ export class Ragdoll {
263
262
  this._joints[i].isEnabled = true;
264
263
  }
265
264
  for (let i = 0; i < this._aggregates.length; i++) {
266
- this._aggregates[i].body.setMotionType(PhysicsMotionType.DYNAMIC);
265
+ this._aggregates[i].body.setMotionType(2 /* PhysicsMotionType.DYNAMIC */);
267
266
  }
268
267
  }
269
268
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"ragdoll.js","sourceRoot":"","sources":["../../../../../dev/core/src/Physics/v2/ragdoll.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAElF,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,iCAA6B;AACnD,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAGpG,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D;;;GAGG;AACH,MAAM,OAAO,qBAAqB;CAyCjC;AAED;;;GAGG;AACH,MAAM,OAAO,OAAO;IA8BhB;;;;;OAKG;IACH,YAAY,QAAkB,EAAE,iBAAuC,EAAE,MAA+B;QA/BhG,gBAAW,GAAiC,IAAI,KAAK,EAAyB,CAAC;QAC/E,YAAO,GAA6B,IAAI,KAAK,EAAqB,CAAC;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ion } from \"../../Maths/math.vector\";\r\nimport type { Scene } from \"../../scene\";\r\nimport { PhysicsAggregate } from \"./physicsAggregate\";\r\nimport { PhysicsConstraint } from \"./physicsConstraint\";\r\nimport type { Mesh } from \"../../Meshes/mesh\";\r\nimport { Axis, Space } from \"core/Maths/math.axis\";\r\nimport { PhysicsShapeType, PhysicsConstraintType, PhysicsMotionType } from \"./IPhysicsEnginePlugin\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { Bone } from \"../../Bones/bone\";\r\nimport { Logger } from \"../../Misc/logger\";\r\nimport { TransformNode } from \"../../Meshes/transformNode\";\r\n\r\n/**\r\n * Ragdoll bone properties\r\n * @experimental\r\n */\r\nexport class RagdollBoneProperties {\r\n /**\r\n * Width of the box shape\r\n */\r\n width?: number;\r\n /**\r\n * depth of the box shape\r\n */\r\n depth?: number;\r\n /**\r\n * height of the box shape\r\n */\r\n height?: number;\r\n /**\r\n * size that will be used of width, depth and height of the shape box\r\n */\r\n size?: number;\r\n /**\r\n * Type of Physics Constraint used between bones\r\n */\r\n joint?: number | undefined;\r\n /**\r\n * Main rotation axis used by the constraint, in local space\r\n */\r\n rotationAxis?: Vector3;\r\n /**\r\n * Minimum rotation angle value\r\n */\r\n min?: number;\r\n /**\r\n * Maximum rotation angle value\r\n */\r\n max?: number;\r\n /**\r\n * Offset along local axis\r\n */\r\n boxOffset?: number;\r\n /**\r\n * Axis that need an offset\r\n */\r\n boneOffsetAxis?: Vector3;\r\n}\r\n\r\n/**\r\n * Ragdoll for Physics V2\r\n * @experimental\r\n */\r\nexport class Ragdoll {\r\n private _skeleton: Skeleton;\r\n private _scene: Scene;\r\n private _rootTransformNode: Mesh | TransformNode;\r\n private _config: any;\r\n private _boxConfigs: Array<RagdollBoneProperties> = new Array<RagdollBoneProperties>();\r\n private _joints: Array<PhysicsConstraint> = new Array<PhysicsConstraint>();\r\n private _bones: Array<Bone> = new Array<Bone>();\r\n private _initialRotation: Array<Quaternion> = new Array<Quaternion>();\r\n // without mesh transform, to figure out later\r\n private _initialRotation2: Array<Quaternion> = new Array<Quaternion>();\r\n private _boneNames: string[] = [];\r\n private _transforms: Array<TransformNode> = new Array<TransformNode>();\r\n private _aggregates: Array<PhysicsAggregate> = new Array<PhysicsAggregate>();\r\n private _ragdollMode: boolean = false;\r\n private _rootBoneName: string = \"\";\r\n private _rootBoneIndex: number = -1;\r\n private _mass: number = 10;\r\n private _restitution: number = 0;\r\n\r\n /**\r\n * Pause synchronization between physics and bone position/orientation\r\n */\r\n public pauseSync: boolean = false;\r\n\r\n private _putBoxesInBoneCenter: boolean;\r\n private _defaultJoint: number = PhysicsConstraintType.HINGE;\r\n private _defaultJointMin: number = -90;\r\n private _defaultJointMax: number = 90;\r\n\r\n /**\r\n * Construct a new Ragdoll object. Once ready, it can be made dynamic by calling `Ragdoll` method\r\n * @param skeleton The skeleton containing bones to be physicalized\r\n * @param rootTransformNode The mesh or its transform used by the skeleton\r\n * @param config an array of `RagdollBoneProperties` corresponding to bones and their properties used to instanciate physics bodies\r\n */\r\n constructor(skeleton: Skeleton, rootTransformNode: Mesh | TransformNode, config: RagdollBoneProperties[]) {\r\n this._skeleton = skeleton;\r\n this._scene = skeleton.getScene();\r\n this._rootTransformNode = rootTransformNode;\r\n this._config = config; // initial, user defined box configs. May have several box configs jammed into 1 index.\r\n this._boxConfigs = []; // final box configs. Every element is a separate box config (this.config may have several configs jammed into 1 index).\r\n this._putBoxesInBoneCenter = false;\r\n this._defaultJoint = PhysicsConstraintType.HINGE;\r\n\r\n this._init();\r\n }\r\n\r\n /**\r\n * Returns the aggregate corresponding to the ragdoll bone index\r\n * @param index ragdoll bone aggregate index\r\n * @returns the aggregate for the bone index for the root aggregate if index is invalid\r\n */\r\n public getAggregate(index: number): PhysicsAggregate {\r\n if (index < 0 || index >= this._aggregates.length) {\r\n return this._aggregates[this._rootBoneIndex];\r\n }\r\n return this._aggregates[index];\r\n }\r\n\r\n private _createColliders(): void {\r\n this._rootTransformNode.computeWorldMatrix();\r\n this._skeleton.computeAbsoluteMatrices(true);\r\n this._skeleton.prepare(true);\r\n\r\n const config = this._config;\r\n for (let i = 0; i < config.length; i++) {\r\n const boneNames = config[i].bone !== undefined ? [config[i].bone] : config[i].bones;\r\n\r\n for (let ii = 0; ii < boneNames.length; ii++) {\r\n const currentBone = this._skeleton.bones[this._skeleton.getBoneIndexByName(boneNames[ii])];\r\n if (currentBone == undefined) {\r\n return;\r\n }\r\n\r\n // First define the box dimensions, so we can then use them when calling CreateBox().\r\n const currentRagdollBoneProperties: RagdollBoneProperties = {\r\n width: this._config[i].width,\r\n depth: this._config[i].depth,\r\n height: this._config[i].height,\r\n size: this._config[i].size,\r\n };\r\n\r\n currentRagdollBoneProperties.width = currentRagdollBoneProperties.width ?? currentRagdollBoneProperties.size;\r\n currentRagdollBoneProperties.depth = currentRagdollBoneProperties.depth ?? currentRagdollBoneProperties.size;\r\n currentRagdollBoneProperties.height = currentRagdollBoneProperties.height ?? currentRagdollBoneProperties.size;\r\n const transform = new TransformNode(boneNames[ii] + \"_transform\", this._scene);\r\n\r\n // Define the rest of the box properties.\r\n currentRagdollBoneProperties.joint = config[i].joint !== undefined ? config[i].joint : this._defaultJoint;\r\n currentRagdollBoneProperties.rotationAxis = config[i].rotationAxis !== undefined ? config[i].rotationAxis : Axis.X;\r\n currentRagdollBoneProperties.min = config[i].min !== undefined ? config[i].min : this._defaultJointMin;\r\n currentRagdollBoneProperties.max = config[i].max !== undefined ? config[i].max : this._defaultJointMax;\r\n\r\n // Offset value.\r\n let boxOffset = 0;\r\n if ((config[i].putBoxInBoneCenter !== undefined && config[i].putBoxInBoneCenter) || this._putBoxesInBoneCenter) {\r\n if (currentBone.length === undefined) {\r\n Logger.Log(\"The length property is not defined for bone \" + currentBone.name);\r\n }\r\n boxOffset = currentBone.length / 2;\r\n } else if (config[i].boxOffset !== undefined) {\r\n boxOffset = config[i].boxOffset;\r\n }\r\n currentRagdollBoneProperties.boxOffset = boxOffset;\r\n\r\n // Offset axis.\r\n const boneOffsetAxis = config[i].boneOffsetAxis !== undefined ? config[i].boneOffsetAxis : Axis.Y;\r\n const boneDir = currentBone.getDirection(boneOffsetAxis, this._rootTransformNode);\r\n currentRagdollBoneProperties.boneOffsetAxis = boneOffsetAxis;\r\n\r\n transform.position = currentBone.getAbsolutePosition(this._rootTransformNode).add(boneDir.scale(boxOffset));\r\n\r\n const mass = config[i].mass !== undefined ? config[i].mass : this._mass;\r\n const restitution = config[i].restitution !== undefined ? config[i].restitution : this._restitution;\r\n const aggregate = new PhysicsAggregate(\r\n transform,\r\n PhysicsShapeType.BOX,\r\n {\r\n mass: mass,\r\n restitution: restitution,\r\n friction: 0.6,\r\n extents: new Vector3(currentRagdollBoneProperties.width, currentRagdollBoneProperties.height, currentRagdollBoneProperties.depth),\r\n },\r\n this._scene\r\n );\r\n aggregate.body.setCollisionCallbackEnabled(true);\r\n aggregate.body.disablePreStep = false;\r\n aggregate.body.setMotionType(PhysicsMotionType.ANIMATED);\r\n this._aggregates.push(aggregate);\r\n this._bones.push(currentBone);\r\n this._boneNames.push(currentBone.name);\r\n this._transforms.push(transform);\r\n this._boxConfigs.push(currentRagdollBoneProperties);\r\n this._initialRotation.push(currentBone.getRotationQuaternion(Space.WORLD, this._rootTransformNode));\r\n this._initialRotation2.push(currentBone.getRotationQuaternion(Space.WORLD));\r\n }\r\n }\r\n }\r\n\r\n private _initJoints(): void {\r\n this._rootTransformNode.computeWorldMatrix();\r\n for (let i = 0; i < this._bones.length; i++) {\r\n // The root bone has no joints.\r\n if (i == this._rootBoneIndex) continue;\r\n\r\n const nearestParent = this._findNearestParent(i);\r\n\r\n if (nearestParent == null) {\r\n Logger.Warn(\"Couldn't find a nearest parent bone in the configs for bone called \" + this._boneNames[i]);\r\n return;\r\n }\r\n\r\n const boneParentIndex = this._boneNames.indexOf(nearestParent.name);\r\n\r\n let distanceFromParentBoxToBone = this._bones[i].getAbsolutePosition(this._rootTransformNode).subtract(this._transforms[boneParentIndex].position);\r\n\r\n const wmat = this._transforms[boneParentIndex].computeWorldMatrix();\r\n const invertedWorldMat = Matrix.Invert(wmat);\r\n distanceFromParentBoxToBone = Vector3.TransformCoordinates(this._bones[i].getAbsolutePosition(this._rootTransformNode), invertedWorldMat);\r\n\r\n const boneAbsPos = this._bones[i].getAbsolutePosition(this._rootTransformNode);\r\n const boxAbsPos = this._transforms[i].position.clone();\r\n const myConnectedPivot = boneAbsPos.subtract(boxAbsPos);\r\n\r\n const joint = new PhysicsConstraint(\r\n PhysicsConstraintType.BALL_AND_SOCKET,\r\n {\r\n pivotA: distanceFromParentBoxToBone,\r\n pivotB: myConnectedPivot,\r\n axisA: this._boxConfigs[i].rotationAxis!,\r\n axisB: this._boxConfigs[i].rotationAxis!,\r\n collision: false,\r\n },\r\n this._scene\r\n );\r\n\r\n this._aggregates[boneParentIndex].body.addConstraint(this._aggregates[i].body, joint);\r\n joint.isEnabled = false;\r\n this._joints.push(joint);\r\n }\r\n }\r\n\r\n // set physics body orientation/position from bones\r\n private _syncBonesToPhysics(): void {\r\n const rootMatrix = this._rootTransformNode.getWorldMatrix();\r\n for (let i = 0; i < this._bones.length; i++) {\r\n // position\r\n const transform = this._aggregates[i].transformNode;\r\n const rootPos = this._bones[i].getAbsolutePosition();\r\n Vector3.TransformCoordinatesToRef(rootPos, rootMatrix, transform.position);\r\n\r\n // added offset\r\n this._bones[i].getDirectionToRef(this._boxConfigs[i].boneOffsetAxis!, this._rootTransformNode, TmpVectors.Vector3[0]);\r\n TmpVectors.Vector3[0].scaleInPlace(this._boxConfigs[i].boxOffset ?? 0);\r\n transform.position.addInPlace(TmpVectors.Vector3[0]);\r\n\r\n this._setBoneOrientationToBody(i);\r\n }\r\n }\r\n\r\n private _setBoneOrientationToBody(boneIndex: number): void {\r\n const transform = this._aggregates[boneIndex].transformNode;\r\n const bone = this._bones[boneIndex];\r\n this._initialRotation[boneIndex].conjugateToRef(TmpVectors.Quaternion[0]);\r\n bone.getRotationQuaternionToRef(Space.WORLD, this._rootTransformNode, TmpVectors.Quaternion[1]);\r\n TmpVectors.Quaternion[1].multiplyToRef(TmpVectors.Quaternion[0], transform.rotationQuaternion!);\r\n transform.rotationQuaternion!.normalize();\r\n }\r\n\r\n private _syncBonesAndBoxes(): void {\r\n if (this.pauseSync) {\r\n return;\r\n }\r\n\r\n if (this._ragdollMode) {\r\n this._setBodyOrientationToBone(this._rootBoneIndex);\r\n\r\n const rootPos = this._aggregates[this._rootBoneIndex].body.transformNode.position;\r\n this._rootTransformNode.getWorldMatrix().invertToRef(TmpVectors.Matrix[0]);\r\n\r\n Vector3.TransformCoordinatesToRef(rootPos, TmpVectors.Matrix[0], TmpVectors.Vector3[0]);\r\n this._bones[this._rootBoneIndex].setAbsolutePosition(TmpVectors.Vector3[0]);\r\n\r\n for (let i = 0; i < this._bones.length; i++) {\r\n if (i == this._rootBoneIndex) continue;\r\n this._setBodyOrientationToBone(i);\r\n }\r\n } else {\r\n this._syncBonesToPhysics();\r\n }\r\n }\r\n\r\n private _setBodyOrientationToBone(boneIndex: number): void {\r\n const qmesh =\r\n this._rootTransformNode.rotationQuaternion ??\r\n Quaternion.FromEulerAngles(this._rootTransformNode.rotation.x, this._rootTransformNode.rotation.y, this._rootTransformNode.rotation.z);\r\n const qbind = this._initialRotation2[boneIndex];\r\n const qphys = this._aggregates[boneIndex].body?.transformNode?.rotationQuaternion!;\r\n\r\n qmesh.multiplyToRef(qbind, TmpVectors.Quaternion[1]);\r\n qphys.multiplyToRef(TmpVectors.Quaternion[1], TmpVectors.Quaternion[0]);\r\n\r\n this._bones[boneIndex].setRotationQuaternion(TmpVectors.Quaternion[0], Space.WORLD, this._rootTransformNode);\r\n }\r\n\r\n // Return true if root bone is valid/exists in this.bonesNames. false otherwise.\r\n private _defineRootBone(): boolean {\r\n const skeletonRoots = this._skeleton.getChildren();\r\n if (skeletonRoots.length != 1) {\r\n Logger.Log(\"Ragdoll creation failed: there can only be one root in the skeleton.\");\r\n return false;\r\n }\r\n\r\n this._rootBoneName = skeletonRoots[0].name;\r\n this._rootBoneIndex = this._boneNames.indexOf(this._rootBoneName);\r\n if (this._rootBoneIndex == -1) {\r\n Logger.Log(\"Ragdoll creation failed: the array boneNames doesn't have the root bone. The root bone is \" + this._skeleton.getChildren());\r\n return false;\r\n }\r\n\r\n return true;\r\n }\r\n\r\n private _findNearestParent(boneIndex: number): any {\r\n let nearestParent: Nullable<Bone> | undefined = this._bones[boneIndex].getParent();\r\n do {\r\n if (nearestParent != null && this._boneNames.includes(nearestParent.name)) {\r\n break;\r\n }\r\n\r\n nearestParent = nearestParent?.getParent();\r\n } while (nearestParent != null);\r\n\r\n return nearestParent;\r\n }\r\n\r\n private _init() {\r\n this._createColliders();\r\n\r\n // If this.defineRootBone() returns ... there is not root bone.\r\n if (!this._defineRootBone()) {\r\n return;\r\n }\r\n\r\n this._initJoints();\r\n this._scene.registerBeforeRender(() => {\r\n this._syncBonesAndBoxes();\r\n });\r\n this._syncBonesToPhysics();\r\n }\r\n\r\n /**\r\n * Enable ragdoll mode. Create physics objects and make them dynamic.\r\n */\r\n public ragdoll(): void {\r\n this._ragdollMode = true;\r\n // detach bones with link transform to let physics have control\r\n this._skeleton.bones.forEach((bone) => {\r\n bone.linkTransformNode(null);\r\n });\r\n for (let i = 0; i < this._joints.length; i++) {\r\n this._joints[i].isEnabled = true;\r\n }\r\n for (let i = 0; i < this._aggregates.length; i++) {\r\n this._aggregates[i].body.setMotionType(PhysicsMotionType.DYNAMIC);\r\n }\r\n }\r\n\r\n /**\r\n * Dispose resources and remove physics objects\r\n */\r\n dispose(): void {\r\n this._aggregates.forEach((aggregate: PhysicsAggregate) => {\r\n aggregate.dispose();\r\n });\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"ragdoll.js","sourceRoot":"","sources":["../../../../../dev/core/src/Physics/v2/ragdoll.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAElF,OAAO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L,CAAC;IAED;;OAEG;IACH,OAAO;QACH,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,SAA2B,EAAE,EAAE;YACrD,SAAS,CAAC,OAAO,EAAE,CAAC;QACxB,CAAC,CAAC,CAAC;IACP,CAAC;CACJ","sourcesContent":["import type { Skeleton } from \"../../Bones/skeleton\";\r\nimport { Vector3, Matrix, TmpVectors, Quaternion } from \"../../Maths/math.vector\";\r\nimport type { Scene } from \"../../scene\";\r\nimport { PhysicsAggregate } from \"./physicsAggregate\";\r\nimport { PhysicsConstraint } from \"./physicsConstraint\";\r\nimport type { Mesh } from \"../../Meshes/mesh\";\r\nimport { Axis, Space } from \"core/Maths/math.axis\";\r\nimport { PhysicsShapeType, PhysicsConstraintType, PhysicsMotionType } from \"./IPhysicsEnginePlugin\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { Bone } from \"../../Bones/bone\";\r\nimport { Logger } from \"../../Misc/logger\";\r\nimport { TransformNode } from \"../../Meshes/transformNode\";\r\n\r\n/**\r\n * Ragdoll bone properties\r\n * @experimental\r\n */\r\nexport class RagdollBoneProperties {\r\n /**\r\n * Width of the box shape\r\n */\r\n width?: number;\r\n /**\r\n * depth of the box shape\r\n */\r\n depth?: number;\r\n /**\r\n * height of the box shape\r\n */\r\n height?: number;\r\n /**\r\n * size that will be used of width, depth and height of the shape box\r\n */\r\n size?: number;\r\n /**\r\n * Type of Physics Constraint used between bones\r\n */\r\n joint?: number | undefined;\r\n /**\r\n * Main rotation axis used by the constraint, in local space\r\n */\r\n rotationAxis?: Vector3;\r\n /**\r\n * Minimum rotation angle value\r\n */\r\n min?: number;\r\n /**\r\n * Maximum rotation angle value\r\n */\r\n max?: number;\r\n /**\r\n * Offset along local axis\r\n */\r\n boxOffset?: number;\r\n /**\r\n * Axis that need an offset\r\n */\r\n boneOffsetAxis?: Vector3;\r\n}\r\n\r\n/**\r\n * Ragdoll for Physics V2\r\n * @experimental\r\n */\r\nexport class Ragdoll {\r\n private _skeleton: Skeleton;\r\n private _scene: Scene;\r\n private _rootTransformNode: Mesh | TransformNode;\r\n private _config: any;\r\n private _boxConfigs: Array<RagdollBoneProperties> = new Array<RagdollBoneProperties>();\r\n private _joints: Array<PhysicsConstraint> = new Array<PhysicsConstraint>();\r\n private _bones: Array<Bone> = new Array<Bone>();\r\n private _initialRotation: Array<Quaternion> = new Array<Quaternion>();\r\n // without mesh transform, to figure out later\r\n private _initialRotation2: Array<Quaternion> = new Array<Quaternion>();\r\n private _boneNames: string[] = [];\r\n private _transforms: Array<TransformNode> = new Array<TransformNode>();\r\n private _aggregates: Array<PhysicsAggregate> = new Array<PhysicsAggregate>();\r\n private _ragdollMode: boolean = false;\r\n private _rootBoneName: string = \"\";\r\n private _rootBoneIndex: number = -1;\r\n private _mass: number = 10;\r\n private _restitution: number = 0;\r\n\r\n /**\r\n * Pause synchronization between physics and bone position/orientation\r\n */\r\n public pauseSync: boolean = false;\r\n\r\n private _putBoxesInBoneCenter: boolean;\r\n private _defaultJoint: number = PhysicsConstraintType.HINGE;\r\n private _defaultJointMin: number = -90;\r\n private _defaultJointMax: number = 90;\r\n\r\n /**\r\n * Construct a new Ragdoll object. Once ready, it can be made dynamic by calling `Ragdoll` method\r\n * @param skeleton The skeleton containing bones to be physicalized\r\n * @param rootTransformNode The mesh or its transform used by the skeleton\r\n * @param config an array of `RagdollBoneProperties` corresponding to bones and their properties used to instanciate physics bodies\r\n */\r\n constructor(skeleton: Skeleton, rootTransformNode: Mesh | TransformNode, config: RagdollBoneProperties[]) {\r\n this._skeleton = skeleton;\r\n this._scene = skeleton.getScene();\r\n this._rootTransformNode = rootTransformNode;\r\n this._config = config; // initial, user defined box configs. May have several box configs jammed into 1 index.\r\n this._boxConfigs = []; // final box configs. Every element is a separate box config (this.config may have several configs jammed into 1 index).\r\n this._putBoxesInBoneCenter = false;\r\n this._defaultJoint = PhysicsConstraintType.HINGE;\r\n\r\n this._init();\r\n }\r\n\r\n /**\r\n * Returns the aggregate corresponding to the ragdoll bone index\r\n * @param index ragdoll bone aggregate index\r\n * @returns the aggregate for the bone index for the root aggregate if index is invalid\r\n */\r\n public getAggregate(index: number): PhysicsAggregate {\r\n if (index < 0 || index >= this._aggregates.length) {\r\n return this._aggregates[this._rootBoneIndex];\r\n }\r\n return this._aggregates[index];\r\n }\r\n\r\n private _createColliders(): void {\r\n this._rootTransformNode.computeWorldMatrix();\r\n this._skeleton.computeAbsoluteMatrices(true);\r\n this._skeleton.prepare(true);\r\n\r\n const config = this._config;\r\n for (let i = 0; i < config.length; i++) {\r\n const boneNames = config[i].bone !== undefined ? [config[i].bone] : config[i].bones;\r\n\r\n for (let ii = 0; ii < boneNames.length; ii++) {\r\n const currentBone = this._skeleton.bones[this._skeleton.getBoneIndexByName(boneNames[ii])];\r\n if (currentBone == undefined) {\r\n return;\r\n }\r\n\r\n // First define the box dimensions, so we can then use them when calling CreateBox().\r\n const currentRagdollBoneProperties: RagdollBoneProperties = {\r\n width: this._config[i].width,\r\n depth: this._config[i].depth,\r\n height: this._config[i].height,\r\n size: this._config[i].size,\r\n };\r\n\r\n currentRagdollBoneProperties.width = currentRagdollBoneProperties.width ?? currentRagdollBoneProperties.size;\r\n currentRagdollBoneProperties.depth = currentRagdollBoneProperties.depth ?? currentRagdollBoneProperties.size;\r\n currentRagdollBoneProperties.height = currentRagdollBoneProperties.height ?? currentRagdollBoneProperties.size;\r\n const transform = new TransformNode(boneNames[ii] + \"_transform\", this._scene);\r\n\r\n // Define the rest of the box properties.\r\n currentRagdollBoneProperties.joint = config[i].joint !== undefined ? config[i].joint : this._defaultJoint;\r\n currentRagdollBoneProperties.rotationAxis = config[i].rotationAxis !== undefined ? config[i].rotationAxis : Axis.X;\r\n currentRagdollBoneProperties.min = config[i].min !== undefined ? config[i].min : this._defaultJointMin;\r\n currentRagdollBoneProperties.max = config[i].max !== undefined ? config[i].max : this._defaultJointMax;\r\n\r\n // Offset value.\r\n let boxOffset = 0;\r\n if ((config[i].putBoxInBoneCenter !== undefined && config[i].putBoxInBoneCenter) || this._putBoxesInBoneCenter) {\r\n if (currentBone.length === undefined) {\r\n Logger.Log(\"The length property is not defined for bone \" + currentBone.name);\r\n }\r\n boxOffset = currentBone.length / 2;\r\n } else if (config[i].boxOffset !== undefined) {\r\n boxOffset = config[i].boxOffset;\r\n }\r\n currentRagdollBoneProperties.boxOffset = boxOffset;\r\n\r\n // Offset axis.\r\n const boneOffsetAxis = config[i].boneOffsetAxis !== undefined ? config[i].boneOffsetAxis : Axis.Y;\r\n const boneDir = currentBone.getDirection(boneOffsetAxis, this._rootTransformNode);\r\n currentRagdollBoneProperties.boneOffsetAxis = boneOffsetAxis;\r\n\r\n transform.position = currentBone.getAbsolutePosition(this._rootTransformNode).add(boneDir.scale(boxOffset));\r\n\r\n const mass = config[i].mass !== undefined ? config[i].mass : this._mass;\r\n const restitution = config[i].restitution !== undefined ? config[i].restitution : this._restitution;\r\n const aggregate = new PhysicsAggregate(\r\n transform,\r\n PhysicsShapeType.BOX,\r\n {\r\n mass: mass,\r\n restitution: restitution,\r\n friction: 0.6,\r\n extents: new Vector3(currentRagdollBoneProperties.width, currentRagdollBoneProperties.height, currentRagdollBoneProperties.depth),\r\n },\r\n this._scene\r\n );\r\n aggregate.body.setCollisionCallbackEnabled(true);\r\n aggregate.body.disablePreStep = false;\r\n aggregate.body.setMotionType(PhysicsMotionType.ANIMATED);\r\n this._aggregates.push(aggregate);\r\n this._bones.push(currentBone);\r\n this._boneNames.push(currentBone.name);\r\n this._transforms.push(transform);\r\n this._boxConfigs.push(currentRagdollBoneProperties);\r\n this._initialRotation.push(currentBone.getRotationQuaternion(Space.WORLD, this._rootTransformNode));\r\n this._initialRotation2.push(currentBone.getRotationQuaternion(Space.WORLD));\r\n }\r\n }\r\n }\r\n\r\n private _initJoints(): void {\r\n this._rootTransformNode.computeWorldMatrix();\r\n for (let i = 0; i < this._bones.length; i++) {\r\n // The root bone has no joints.\r\n if (i == this._rootBoneIndex) continue;\r\n\r\n const nearestParent = this._findNearestParent(i);\r\n\r\n if (nearestParent == null) {\r\n Logger.Warn(\"Couldn't find a nearest parent bone in the configs for bone called \" + this._boneNames[i]);\r\n return;\r\n }\r\n\r\n const boneParentIndex = this._boneNames.indexOf(nearestParent.name);\r\n\r\n let distanceFromParentBoxToBone = this._bones[i].getAbsolutePosition(this._rootTransformNode).subtract(this._transforms[boneParentIndex].position);\r\n\r\n const wmat = this._transforms[boneParentIndex].computeWorldMatrix();\r\n const invertedWorldMat = Matrix.Invert(wmat);\r\n distanceFromParentBoxToBone = Vector3.TransformCoordinates(this._bones[i].getAbsolutePosition(this._rootTransformNode), invertedWorldMat);\r\n\r\n const boneAbsPos = this._bones[i].getAbsolutePosition(this._rootTransformNode);\r\n const boxAbsPos = this._transforms[i].position.clone();\r\n const myConnectedPivot = boneAbsPos.subtract(boxAbsPos);\r\n\r\n const joint = new PhysicsConstraint(\r\n PhysicsConstraintType.BALL_AND_SOCKET,\r\n {\r\n pivotA: distanceFromParentBoxToBone,\r\n pivotB: myConnectedPivot,\r\n axisA: this._boxConfigs[i].rotationAxis!,\r\n axisB: this._boxConfigs[i].rotationAxis!,\r\n collision: false,\r\n },\r\n this._scene\r\n );\r\n\r\n this._aggregates[boneParentIndex].body.addConstraint(this._aggregates[i].body, joint);\r\n joint.isEnabled = false;\r\n this._joints.push(joint);\r\n }\r\n }\r\n\r\n // set physics body orientation/position from bones\r\n private _syncBonesToPhysics(): void {\r\n const rootMatrix = this._rootTransformNode.getWorldMatrix();\r\n for (let i = 0; i < this._bones.length; i++) {\r\n // position\r\n const transform = this._aggregates[i].transformNode;\r\n const rootPos = this._bones[i].getAbsolutePosition();\r\n Vector3.TransformCoordinatesToRef(rootPos, rootMatrix, transform.position);\r\n\r\n // added offset\r\n this._bones[i].getDirectionToRef(this._boxConfigs[i].boneOffsetAxis!, this._rootTransformNode, TmpVectors.Vector3[0]);\r\n TmpVectors.Vector3[0].scaleInPlace(this._boxConfigs[i].boxOffset ?? 0);\r\n transform.position.addInPlace(TmpVectors.Vector3[0]);\r\n\r\n this._setBoneOrientationToBody(i);\r\n }\r\n }\r\n\r\n private _setBoneOrientationToBody(boneIndex: number): void {\r\n const transform = this._aggregates[boneIndex].transformNode;\r\n const bone = this._bones[boneIndex];\r\n this._initialRotation[boneIndex].conjugateToRef(TmpVectors.Quaternion[0]);\r\n bone.getRotationQuaternionToRef(Space.WORLD, this._rootTransformNode, TmpVectors.Quaternion[1]);\r\n TmpVectors.Quaternion[1].multiplyToRef(TmpVectors.Quaternion[0], transform.rotationQuaternion!);\r\n transform.rotationQuaternion!.normalize();\r\n }\r\n\r\n private _syncBonesAndBoxes(): void {\r\n if (this.pauseSync) {\r\n return;\r\n }\r\n\r\n if (this._ragdollMode) {\r\n this._setBodyOrientationToBone(this._rootBoneIndex);\r\n\r\n const rootPos = this._aggregates[this._rootBoneIndex].body.transformNode.position;\r\n this._rootTransformNode.getWorldMatrix().invertToRef(TmpVectors.Matrix[0]);\r\n\r\n Vector3.TransformCoordinatesToRef(rootPos, TmpVectors.Matrix[0], TmpVectors.Vector3[0]);\r\n this._bones[this._rootBoneIndex].setAbsolutePosition(TmpVectors.Vector3[0]);\r\n\r\n for (let i = 0; i < this._bones.length; i++) {\r\n if (i == this._rootBoneIndex) continue;\r\n this._setBodyOrientationToBone(i);\r\n }\r\n } else {\r\n this._syncBonesToPhysics();\r\n }\r\n }\r\n\r\n private _setBodyOrientationToBone(boneIndex: number): void {\r\n const qmesh =\r\n this._rootTransformNode.rotationQuaternion ??\r\n Quaternion.FromEulerAngles(this._rootTransformNode.rotation.x, this._rootTransformNode.rotation.y, this._rootTransformNode.rotation.z);\r\n const qbind = this._initialRotation2[boneIndex];\r\n const qphys = this._aggregates[boneIndex].body?.transformNode?.rotationQuaternion!;\r\n\r\n qmesh.multiplyToRef(qbind, TmpVectors.Quaternion[1]);\r\n qphys.multiplyToRef(TmpVectors.Quaternion[1], TmpVectors.Quaternion[0]);\r\n\r\n this._bones[boneIndex].setRotationQuaternion(TmpVectors.Quaternion[0], Space.WORLD, this._rootTransformNode);\r\n }\r\n\r\n // Return true if root bone is valid/exists in this.bonesNames. false otherwise.\r\n private _defineRootBone(): boolean {\r\n const skeletonRoots = this._skeleton.getChildren();\r\n if (skeletonRoots.length != 1) {\r\n Logger.Log(\"Ragdoll creation failed: there can only be one root in the skeleton.\");\r\n return false;\r\n }\r\n\r\n this._rootBoneName = skeletonRoots[0].name;\r\n this._rootBoneIndex = this._boneNames.indexOf(this._rootBoneName);\r\n if (this._rootBoneIndex == -1) {\r\n Logger.Log(\"Ragdoll creation failed: the array boneNames doesn't have the root bone. The root bone is \" + this._skeleton.getChildren());\r\n return false;\r\n }\r\n\r\n return true;\r\n }\r\n\r\n private _findNearestParent(boneIndex: number): any {\r\n let nearestParent: Nullable<Bone> | undefined = this._bones[boneIndex].getParent();\r\n do {\r\n if (nearestParent != null && this._boneNames.includes(nearestParent.name)) {\r\n break;\r\n }\r\n\r\n nearestParent = nearestParent?.getParent();\r\n } while (nearestParent != null);\r\n\r\n return nearestParent;\r\n }\r\n\r\n private _init() {\r\n this._createColliders();\r\n\r\n // If this.defineRootBone() returns ... there is not root bone.\r\n if (!this._defineRootBone()) {\r\n return;\r\n }\r\n\r\n this._initJoints();\r\n this._scene.registerBeforeRender(() => {\r\n this._syncBonesAndBoxes();\r\n });\r\n this._syncBonesToPhysics();\r\n }\r\n\r\n /**\r\n * Enable ragdoll mode. Create physics objects and make them dynamic.\r\n */\r\n public ragdoll(): void {\r\n this._ragdollMode = true;\r\n // detach bones with link transform to let physics have control\r\n this._skeleton.bones.forEach((bone) => {\r\n bone.linkTransformNode(null);\r\n });\r\n for (let i = 0; i < this._joints.length; i++) {\r\n this._joints[i].isEnabled = true;\r\n }\r\n for (let i = 0; i < this._aggregates.length; i++) {\r\n this._aggregates[i].body.setMotionType(PhysicsMotionType.DYNAMIC);\r\n }\r\n }\r\n\r\n /**\r\n * Dispose resources and remove physics objects\r\n */\r\n dispose(): void {\r\n this._aggregates.forEach((aggregate: PhysicsAggregate) => {\r\n aggregate.dispose();\r\n });\r\n }\r\n}\r\n"]}