@babylonjs/core 6.41.0 → 6.41.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Animations/animatable.js +1 -2
- package/Animations/animatable.js.map +1 -1
- package/Animations/animation.js +4 -6
- package/Animations/animation.js.map +1 -1
- package/Animations/animationGroup.js +3 -3
- package/Animations/animationGroup.js.map +1 -1
- package/Animations/runtimeAnimation.js +1 -1
- package/Animations/runtimeAnimation.js.map +1 -1
- package/Audio/audioEngine.js +3 -5
- package/Audio/audioEngine.js.map +1 -1
- package/Audio/audioSceneComponent.js +1 -2
- package/Audio/audioSceneComponent.js.map +1 -1
- package/Audio/sound.js +48 -74
- package/Audio/sound.js.map +1 -1
- package/Audio/soundTrack.js +6 -12
- package/Audio/soundTrack.js.map +1 -1
- package/BakedVertexAnimation/bakedVertexAnimationManager.js +1 -2
- package/BakedVertexAnimation/bakedVertexAnimationManager.js.map +1 -1
- package/Behaviors/Cameras/autoRotationBehavior.js +1 -1
- package/Behaviors/Cameras/autoRotationBehavior.js.map +1 -1
- package/Behaviors/Meshes/fadeInOutBehavior.js +2 -4
- package/Behaviors/Meshes/fadeInOutBehavior.js.map +1 -1
- package/Behaviors/Meshes/followBehavior.js +1 -2
- package/Behaviors/Meshes/followBehavior.js.map +1 -1
- package/Behaviors/Meshes/handConstraintBehavior.js +2 -2
- package/Behaviors/Meshes/handConstraintBehavior.js.map +1 -1
- package/Bones/bone.js +4 -6
- package/Bones/bone.js.map +1 -1
- package/Bones/skeleton.js +2 -3
- package/Bones/skeleton.js.map +1 -1
- package/Buffers/buffer.align.js +5 -8
- package/Buffers/buffer.align.js.map +1 -1
- package/Buffers/buffer.js +6 -8
- package/Buffers/buffer.js.map +1 -1
- package/Cameras/Inputs/BaseCameraPointersInput.js +3 -4
- package/Cameras/Inputs/BaseCameraPointersInput.js.map +1 -1
- package/Cameras/Inputs/arcRotateCameraMouseWheelInput.js +3 -5
- package/Cameras/Inputs/arcRotateCameraMouseWheelInput.js.map +1 -1
- package/Cameras/Inputs/flyCameraMouseInput.js +2 -2
- package/Cameras/Inputs/flyCameraMouseInput.js.map +1 -1
- package/Cameras/Inputs/freeCameraMouseInput.js +2 -2
- package/Cameras/Inputs/freeCameraMouseInput.js.map +1 -1
- package/Cameras/arcRotateCamera.js +1 -2
- package/Cameras/arcRotateCamera.js.map +1 -1
- package/Cameras/camera.d.ts +5 -0
- package/Cameras/camera.js +18 -11
- package/Cameras/camera.js.map +1 -1
- package/Collisions/pickingInfo.js +1 -1
- package/Collisions/pickingInfo.js.map +1 -1
- package/Compute/computeEffect.js +5 -8
- package/Compute/computeEffect.js.map +1 -1
- package/Compute/computeShader.js +12 -9
- package/Compute/computeShader.js.map +1 -1
- package/Culling/Octrees/octreeSceneComponent.js +1 -2
- package/Culling/Octrees/octreeSceneComponent.js.map +1 -1
- package/Culling/boundingBox.js +2 -3
- package/Culling/boundingBox.js.map +1 -1
- package/Culling/ray.d.ts +6 -1
- package/Culling/ray.js +9 -4
- package/Culling/ray.js.map +1 -1
- package/Debug/debugLayer.js +4 -1
- package/Debug/debugLayer.js.map +1 -1
- package/Debug/directionalLightFrustumViewer.js +7 -9
- package/Debug/directionalLightFrustumViewer.js.map +1 -1
- package/Debug/physicsViewer.js +5 -7
- package/Debug/physicsViewer.js.map +1 -1
- package/Debug/rayHelper.js +1 -2
- package/Debug/rayHelper.js.map +1 -1
- package/Debug/skeletonViewer.js +26 -31
- package/Debug/skeletonViewer.js.map +1 -1
- package/Decorators/nodeDecorator.js +1 -1
- package/Decorators/nodeDecorator.js.map +1 -1
- package/DeviceInput/InputDevices/deviceSourceManager.js +3 -5
- package/DeviceInput/InputDevices/deviceSourceManager.js.map +1 -1
- package/DeviceInput/eventFactory.js +1 -1
- package/DeviceInput/eventFactory.js.map +1 -1
- package/DeviceInput/internalDeviceSourceManager.js +1 -2
- package/DeviceInput/internalDeviceSourceManager.js.map +1 -1
- package/DeviceInput/webDeviceInputSystem.js +9 -12
- package/DeviceInput/webDeviceInputSystem.js.map +1 -1
- package/Engines/Extensions/engine.cubeTexture.js +6 -1
- package/Engines/Extensions/engine.cubeTexture.js.map +1 -1
- package/Engines/Extensions/engine.multiRender.js +3 -4
- package/Engines/Extensions/engine.multiRender.js.map +1 -1
- package/Engines/Extensions/engine.rawTexture.js +4 -4
- package/Engines/Extensions/engine.rawTexture.js.map +1 -1
- package/Engines/Extensions/engine.readTexture.js +2 -3
- package/Engines/Extensions/engine.readTexture.js.map +1 -1
- package/Engines/Extensions/engine.renderTarget.js +9 -5
- package/Engines/Extensions/engine.renderTarget.js.map +1 -1
- package/Engines/Extensions/engine.renderTargetCube.js +9 -1
- package/Engines/Extensions/engine.renderTargetCube.js.map +1 -1
- package/Engines/Extensions/engine.views.js +1 -2
- package/Engines/Extensions/engine.views.js.map +1 -1
- package/Engines/Processors/shaderCodeNode.js +6 -7
- package/Engines/Processors/shaderCodeNode.js.map +1 -1
- package/Engines/Processors/shaderProcessor.js +6 -11
- package/Engines/Processors/shaderProcessor.js.map +1 -1
- package/Engines/WebGL/webGLHardwareTexture.js +1 -2
- package/Engines/WebGL/webGLHardwareTexture.js.map +1 -1
- package/Engines/WebGL/webGLRenderTargetWrapper.js +3 -5
- package/Engines/WebGL/webGLRenderTargetWrapper.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.cubeTexture.js +9 -2
- package/Engines/WebGPU/Extensions/engine.cubeTexture.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.dynamicTexture.js +1 -2
- package/Engines/WebGPU/Extensions/engine.dynamicTexture.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.multiRender.js +5 -6
- package/Engines/WebGPU/Extensions/engine.multiRender.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.query.js +2 -4
- package/Engines/WebGPU/Extensions/engine.query.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.rawTexture.js +4 -4
- package/Engines/WebGPU/Extensions/engine.rawTexture.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.renderTarget.js +11 -5
- package/Engines/WebGPU/Extensions/engine.renderTarget.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.renderTargetCube.js +11 -3
- package/Engines/WebGPU/Extensions/engine.renderTargetCube.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.storageBuffer.js +2 -3
- package/Engines/WebGPU/Extensions/engine.storageBuffer.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.textureSampler.js +1 -2
- package/Engines/WebGPU/Extensions/engine.textureSampler.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.videoTexture.js +1 -2
- package/Engines/WebGPU/Extensions/engine.videoTexture.js.map +1 -1
- package/Engines/WebGPU/webgpuBufferManager.js +1 -1
- package/Engines/WebGPU/webgpuBufferManager.js.map +1 -1
- package/Engines/WebGPU/webgpuCacheBindGroups.js +6 -7
- package/Engines/WebGPU/webgpuCacheBindGroups.js.map +1 -1
- package/Engines/WebGPU/webgpuCacheRenderPipeline.js +15 -20
- package/Engines/WebGPU/webgpuCacheRenderPipeline.js.map +1 -1
- package/Engines/WebGPU/webgpuCacheSampler.js +10 -5
- package/Engines/WebGPU/webgpuCacheSampler.js.map +1 -1
- package/Engines/WebGPU/webgpuClearQuad.js +2 -3
- package/Engines/WebGPU/webgpuClearQuad.js.map +1 -1
- package/Engines/WebGPU/webgpuComputePipelineContext.js +1 -2
- package/Engines/WebGPU/webgpuComputePipelineContext.js.map +1 -1
- package/Engines/WebGPU/webgpuDepthCullingState.js +2 -2
- package/Engines/WebGPU/webgpuDepthCullingState.js.map +1 -1
- package/Engines/WebGPU/webgpuDrawContext.js +1 -2
- package/Engines/WebGPU/webgpuDrawContext.js.map +1 -1
- package/Engines/WebGPU/webgpuHardwareTexture.js +4 -6
- package/Engines/WebGPU/webgpuHardwareTexture.js.map +1 -1
- package/Engines/WebGPU/webgpuMaterialContext.js +2 -3
- package/Engines/WebGPU/webgpuMaterialContext.js.map +1 -1
- package/Engines/WebGPU/webgpuOcclusionQuery.js +3 -5
- package/Engines/WebGPU/webgpuOcclusionQuery.js.map +1 -1
- package/Engines/WebGPU/webgpuPipelineContext.js +2 -4
- package/Engines/WebGPU/webgpuPipelineContext.js.map +1 -1
- package/Engines/WebGPU/webgpuQuerySet.js +1 -1
- package/Engines/WebGPU/webgpuQuerySet.js.map +1 -1
- package/Engines/WebGPU/webgpuShaderProcessingContext.js +2 -4
- package/Engines/WebGPU/webgpuShaderProcessingContext.js.map +1 -1
- package/Engines/WebGPU/webgpuShaderProcessorsGLSL.js +2 -4
- package/Engines/WebGPU/webgpuShaderProcessorsGLSL.js.map +1 -1
- package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js +5 -4
- package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js.map +1 -1
- package/Engines/WebGPU/webgpuStencilStateComposer.js +1 -2
- package/Engines/WebGPU/webgpuStencilStateComposer.js.map +1 -1
- package/Engines/WebGPU/webgpuTextureManager.js +40 -43
- package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
- package/Engines/WebGPU/webgpuTimestampQuery.js +12 -7
- package/Engines/WebGPU/webgpuTimestampQuery.js.map +1 -1
- package/Engines/WebGPU/webgpuTintWASM.js +4 -1
- package/Engines/WebGPU/webgpuTintWASM.js.map +1 -1
- package/Engines/engine.js +4 -7
- package/Engines/engine.js.map +1 -1
- package/Engines/nativeEngine.js +16 -22
- package/Engines/nativeEngine.js.map +1 -1
- package/Engines/nullEngine.js +9 -1
- package/Engines/nullEngine.js.map +1 -1
- package/Engines/renderTargetWrapper.js +11 -16
- package/Engines/renderTargetWrapper.js.map +1 -1
- package/Engines/thinEngine.js +32 -44
- package/Engines/thinEngine.js.map +1 -1
- package/Engines/webgpuEngine.js +77 -95
- package/Engines/webgpuEngine.js.map +1 -1
- package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.js +2 -3
- package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.js +3 -6
- package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCounterBlock.js +1 -2
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCounterBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphMultiGateBlock.js +1 -2
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphMultiGateBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWhileLoopBlock.js +2 -4
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWhileLoopBlock.js.map +1 -1
- package/FlowGraph/flowGraph.js +1 -2
- package/FlowGraph/flowGraph.js.map +1 -1
- package/FlowGraph/flowGraphBlock.js +2 -4
- package/FlowGraph/flowGraphBlock.js.map +1 -1
- package/FlowGraph/flowGraphContext.js +1 -2
- package/FlowGraph/flowGraphContext.js.map +1 -1
- package/FlowGraph/flowGraphCoordinator.js +4 -7
- package/FlowGraph/flowGraphCoordinator.js.map +1 -1
- package/FlowGraph/flowGraphSignalConnection.js +1 -2
- package/FlowGraph/flowGraphSignalConnection.js.map +1 -1
- package/FlowGraph/serialization.js +2 -3
- package/FlowGraph/serialization.js.map +1 -1
- package/Gamepads/gamepadManager.js +1 -1
- package/Gamepads/gamepadManager.js.map +1 -1
- package/Gizmos/axisDragGizmo.js +2 -4
- package/Gizmos/axisDragGizmo.js.map +1 -1
- package/Gizmos/axisScaleGizmo.js +5 -8
- package/Gizmos/axisScaleGizmo.js.map +1 -1
- package/Gizmos/boundingBoxGizmo.js +1 -1
- package/Gizmos/boundingBoxGizmo.js.map +1 -1
- package/Gizmos/cameraGizmo.js +2 -3
- package/Gizmos/cameraGizmo.js.map +1 -1
- package/Gizmos/gizmo.js +4 -7
- package/Gizmos/gizmo.js.map +1 -1
- package/Gizmos/gizmoManager.js +3 -4
- package/Gizmos/gizmoManager.js.map +1 -1
- package/Gizmos/planeDragGizmo.js +2 -4
- package/Gizmos/planeDragGizmo.js.map +1 -1
- package/Gizmos/planeRotationGizmo.js +2 -4
- package/Gizmos/planeRotationGizmo.js.map +1 -1
- package/Helpers/environmentHelper.js +8 -2
- package/Helpers/environmentHelper.js.map +1 -1
- package/Helpers/videoDome.js +1 -2
- package/Helpers/videoDome.js.map +1 -1
- package/Inputs/scene.inputManager.js +8 -10
- package/Inputs/scene.inputManager.js.map +1 -1
- package/Layers/effectLayer.js +16 -10
- package/Layers/effectLayer.js.map +1 -1
- package/Layers/glowLayer.js +16 -6
- package/Layers/glowLayer.js.map +1 -1
- package/Layers/highlightLayer.js +12 -3
- package/Layers/highlightLayer.js.map +1 -1
- package/Layers/layer.js +1 -2
- package/Layers/layer.js.map +1 -1
- package/LensFlares/lensFlareSystem.js +1 -2
- package/LensFlares/lensFlareSystem.js.map +1 -1
- package/Lights/Shadows/cascadedShadowGenerator.js +21 -25
- package/Lights/Shadows/cascadedShadowGenerator.js.map +1 -1
- package/Lights/Shadows/shadowGenerator.js +18 -21
- package/Lights/Shadows/shadowGenerator.js.map +1 -1
- package/Lights/light.js +2 -4
- package/Lights/light.js.map +1 -1
- package/Lights/shadowLight.js +1 -1
- package/Lights/shadowLight.js.map +1 -1
- package/Loading/Plugins/babylonFileLoader.js +1 -2
- package/Loading/Plugins/babylonFileLoader.js.map +1 -1
- package/Loading/sceneLoader.js +1 -1
- package/Loading/sceneLoader.js.map +1 -1
- package/Materials/GreasedLine/greasedLinePluginMaterial.js +26 -32
- package/Materials/GreasedLine/greasedLinePluginMaterial.js.map +1 -1
- package/Materials/GreasedLine/greasedLineSimpleMaterial.js +22 -27
- package/Materials/GreasedLine/greasedLineSimpleMaterial.js.map +1 -1
- package/Materials/Node/Blocks/Dual/clipPlanesBlock.js +6 -7
- package/Materials/Node/Blocks/Dual/clipPlanesBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/imageSourceBlock.js +1 -2
- package/Materials/Node/Blocks/Dual/imageSourceBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js +1 -2
- package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/sceneDepthBlock.js +1 -1
- package/Materials/Node/Blocks/Dual/sceneDepthBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/textureBlock.js +10 -16
- package/Materials/Node/Blocks/Dual/textureBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/TBNBlock.js +2 -3
- package/Materials/Node/Blocks/Fragment/TBNBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js +1 -2
- package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/imageProcessingBlock.js +2 -4
- package/Materials/Node/Blocks/Fragment/imageProcessingBlock.js.map +1 -1
- package/Materials/Node/Blocks/Input/inputBlock.js +1 -2
- package/Materials/Node/Blocks/Input/inputBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/clearCoatBlock.js +24 -26
- package/Materials/Node/Blocks/PBR/clearCoatBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/iridescenceBlock.js +3 -3
- package/Materials/Node/Blocks/PBR/iridescenceBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js +45 -49
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/reflectionBlock.js +1 -2
- package/Materials/Node/Blocks/PBR/reflectionBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/refractionBlock.js +1 -2
- package/Materials/Node/Blocks/PBR/refractionBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/sheenBlock.js +13 -13
- package/Materials/Node/Blocks/PBR/sheenBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/subSurfaceBlock.js +27 -28
- package/Materials/Node/Blocks/PBR/subSurfaceBlock.js.map +1 -1
- package/Materials/Node/Blocks/Teleport/teleportOutBlock.js +1 -2
- package/Materials/Node/Blocks/Teleport/teleportOutBlock.js.map +1 -1
- package/Materials/Node/Blocks/Vertex/instancesBlock.js +2 -2
- package/Materials/Node/Blocks/Vertex/instancesBlock.js.map +1 -1
- package/Materials/Node/Blocks/Vertex/morphTargetsBlock.js +43 -33
- package/Materials/Node/Blocks/Vertex/morphTargetsBlock.js.map +1 -1
- package/Materials/Node/Blocks/biPlanarBlock.js +1 -2
- package/Materials/Node/Blocks/biPlanarBlock.js.map +1 -1
- package/Materials/Node/Blocks/cloudBlock.js +2 -3
- package/Materials/Node/Blocks/cloudBlock.js.map +1 -1
- package/Materials/Node/Blocks/colorMergerBlock.js +4 -5
- package/Materials/Node/Blocks/colorMergerBlock.js.map +1 -1
- package/Materials/Node/Blocks/customBlock.js +4 -6
- package/Materials/Node/Blocks/customBlock.js.map +1 -1
- package/Materials/Node/Blocks/meshAttributeExistsBlock.js +2 -4
- package/Materials/Node/Blocks/meshAttributeExistsBlock.js.map +1 -1
- package/Materials/Node/Blocks/triPlanarBlock.js +14 -23
- package/Materials/Node/Blocks/triPlanarBlock.js.map +1 -1
- package/Materials/Node/Blocks/vectorMergerBlock.js +4 -5
- package/Materials/Node/Blocks/vectorMergerBlock.js.map +1 -1
- package/Materials/Node/nodeMaterial.js +16 -11
- package/Materials/Node/nodeMaterial.js.map +1 -1
- package/Materials/Node/nodeMaterialBlock.js +3 -4
- package/Materials/Node/nodeMaterialBlock.js.map +1 -1
- package/Materials/Node/nodeMaterialBuildState.js +1 -1
- package/Materials/Node/nodeMaterialBuildState.js.map +1 -1
- package/Materials/PBR/pbrBaseMaterial.js +25 -28
- package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
- package/Materials/PBR/pbrClearCoatConfiguration.js +6 -9
- package/Materials/PBR/pbrClearCoatConfiguration.js.map +1 -1
- package/Materials/PBR/pbrIridescenceConfiguration.js +4 -7
- package/Materials/PBR/pbrIridescenceConfiguration.js.map +1 -1
- package/Materials/PBR/pbrSheenConfiguration.js +4 -7
- package/Materials/PBR/pbrSheenConfiguration.js.map +1 -1
- package/Materials/Textures/Loaders/envTextureLoader.js +2 -2
- package/Materials/Textures/Loaders/envTextureLoader.js.map +1 -1
- package/Materials/Textures/Packer/packer.js +13 -14
- package/Materials/Textures/Packer/packer.js.map +1 -1
- package/Materials/Textures/Procedurals/noiseProceduralTexture.js +1 -2
- package/Materials/Textures/Procedurals/noiseProceduralTexture.js.map +1 -1
- package/Materials/Textures/Procedurals/proceduralTexture.js +19 -11
- package/Materials/Textures/Procedurals/proceduralTexture.js.map +1 -1
- package/Materials/Textures/baseTexture.js +2 -4
- package/Materials/Textures/baseTexture.js.map +1 -1
- package/Materials/Textures/cubeTexture.js +7 -13
- package/Materials/Textures/cubeTexture.js.map +1 -1
- package/Materials/Textures/dynamicTexture.js +1 -2
- package/Materials/Textures/dynamicTexture.js.map +1 -1
- package/Materials/Textures/hdrCubeTexture.js +2 -4
- package/Materials/Textures/hdrCubeTexture.js.map +1 -1
- package/Materials/Textures/htmlElementTexture.js +5 -3
- package/Materials/Textures/htmlElementTexture.js.map +1 -1
- package/Materials/Textures/internalTexture.js +3 -5
- package/Materials/Textures/internalTexture.js.map +1 -1
- package/Materials/Textures/mirrorTexture.js +3 -6
- package/Materials/Textures/mirrorTexture.js.map +1 -1
- package/Materials/Textures/multiRenderTarget.js +5 -8
- package/Materials/Textures/multiRenderTarget.js.map +1 -1
- package/Materials/Textures/rawTexture.js +1 -1
- package/Materials/Textures/rawTexture.js.map +1 -1
- package/Materials/Textures/renderTargetTexture.js +22 -34
- package/Materials/Textures/renderTargetTexture.js.map +1 -1
- package/Materials/Textures/texture.js +16 -21
- package/Materials/Textures/texture.js.map +1 -1
- package/Materials/Textures/thinRenderTargetTexture.js +2 -4
- package/Materials/Textures/thinRenderTargetTexture.js.map +1 -1
- package/Materials/Textures/thinTexture.js +1 -1
- package/Materials/Textures/thinTexture.js.map +1 -1
- package/Materials/Textures/videoTexture.js +12 -10
- package/Materials/Textures/videoTexture.js.map +1 -1
- package/Materials/clipPlaneMaterialHelper.js +18 -21
- package/Materials/clipPlaneMaterialHelper.js.map +1 -1
- package/Materials/drawWrapper.js +2 -4
- package/Materials/drawWrapper.js.map +1 -1
- package/Materials/effect.d.ts +4 -0
- package/Materials/effect.js +18 -18
- package/Materials/effect.js.map +1 -1
- package/Materials/effectRenderer.js +2 -3
- package/Materials/effectRenderer.js.map +1 -1
- package/Materials/material.decalMapConfiguration.js +3 -3
- package/Materials/material.decalMapConfiguration.js.map +1 -1
- package/Materials/material.detailMapConfiguration.js +1 -2
- package/Materials/material.detailMapConfiguration.js.map +1 -1
- package/Materials/material.js +7 -4
- package/Materials/material.js.map +1 -1
- package/Materials/materialDefines.js +5 -6
- package/Materials/materialDefines.js.map +1 -1
- package/Materials/materialHelper.d.ts +1 -1
- package/Materials/materialHelper.js +3 -4
- package/Materials/materialHelper.js.map +1 -1
- package/Materials/materialPluginManager.js +3 -5
- package/Materials/materialPluginManager.js.map +1 -1
- package/Materials/meshDebugPluginMaterial.js +13 -14
- package/Materials/meshDebugPluginMaterial.js.map +1 -1
- package/Materials/multiMaterial.js +1 -2
- package/Materials/multiMaterial.js.map +1 -1
- package/Materials/shaderMaterial.d.ts +1 -1
- package/Materials/shaderMaterial.js +64 -32
- package/Materials/shaderMaterial.js.map +1 -1
- package/Materials/shadowDepthWrapper.js +24 -23
- package/Materials/shadowDepthWrapper.js.map +1 -1
- package/Materials/standardMaterial.js +10 -12
- package/Materials/standardMaterial.js.map +1 -1
- package/Materials/uniformBuffer.js +1 -1
- package/Materials/uniformBuffer.js.map +1 -1
- package/Maths/math.vector.js +1 -2
- package/Maths/math.vector.js.map +1 -1
- package/Meshes/Builders/decalBuilder.js +26 -29
- package/Meshes/Builders/decalBuilder.js.map +1 -1
- package/Meshes/Builders/greasedLineBuilder.js +16 -16
- package/Meshes/Builders/greasedLineBuilder.js.map +1 -1
- package/Meshes/Builders/groundBuilder.d.ts +5 -1
- package/Meshes/Builders/groundBuilder.js +13 -2
- package/Meshes/Builders/groundBuilder.js.map +1 -1
- package/Meshes/Builders/textBuilder.js +2 -3
- package/Meshes/Builders/textBuilder.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.d.ts +9 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +141 -12
- package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
- package/Meshes/GreasedLine/greasedLineBaseMesh.js +8 -11
- package/Meshes/GreasedLine/greasedLineBaseMesh.js.map +1 -1
- package/Meshes/GreasedLine/greasedLineMesh.js +3 -5
- package/Meshes/GreasedLine/greasedLineMesh.js.map +1 -1
- package/Meshes/GreasedLine/greasedLineRibbonMesh.js +13 -18
- package/Meshes/GreasedLine/greasedLineRibbonMesh.js.map +1 -1
- package/Meshes/Node/Blocks/Teleport/teleportOutBlock.js +1 -2
- package/Meshes/Node/Blocks/Teleport/teleportOutBlock.js.map +1 -1
- package/Meshes/Node/Blocks/geometryTrigonometryBlock.d.ts +18 -18
- package/Meshes/Node/Blocks/geometryTrigonometryBlock.js +18 -18
- package/Meshes/Node/Blocks/geometryTrigonometryBlock.js.map +1 -1
- package/Meshes/Node/nodeGeometry.js +6 -3
- package/Meshes/Node/nodeGeometry.js.map +1 -1
- package/Meshes/Node/nodeGeometryBlock.js +1 -1
- package/Meshes/Node/nodeGeometryBlock.js.map +1 -1
- package/Meshes/Node/nodeGeometryBlockConnectionPoint.js +1 -2
- package/Meshes/Node/nodeGeometryBlockConnectionPoint.js.map +1 -1
- package/Meshes/Node/nodeGeometryBuildState.js +1 -2
- package/Meshes/Node/nodeGeometryBuildState.js.map +1 -1
- package/Meshes/abstractMesh.js +6 -10
- package/Meshes/abstractMesh.js.map +1 -1
- package/Meshes/csg.js +1 -2
- package/Meshes/csg.js.map +1 -1
- package/Meshes/geometry.js +1 -1
- package/Meshes/geometry.js.map +1 -1
- package/Meshes/instancedMesh.js +5 -10
- package/Meshes/instancedMesh.js.map +1 -1
- package/Meshes/mesh.js +13 -22
- package/Meshes/mesh.js.map +1 -1
- package/Meshes/mesh.vertexData.js +3 -4
- package/Meshes/mesh.vertexData.js.map +1 -1
- package/Meshes/meshUVSpaceRenderer.js +18 -15
- package/Meshes/meshUVSpaceRenderer.js.map +1 -1
- package/Meshes/subMesh.js +8 -14
- package/Meshes/subMesh.js.map +1 -1
- package/Meshes/thinInstanceMesh.js +12 -18
- package/Meshes/thinInstanceMesh.js.map +1 -1
- package/Meshes/trailMesh.js +2 -3
- package/Meshes/trailMesh.js.map +1 -1
- package/Misc/HighDynamicRange/cubemapToSphericalPolynomial.js +1 -2
- package/Misc/HighDynamicRange/cubemapToSphericalPolynomial.js.map +1 -1
- package/Misc/PerformanceViewer/performanceViewerCollectionStrategies.js +9 -14
- package/Misc/PerformanceViewer/performanceViewerCollectionStrategies.js.map +1 -1
- package/Misc/PerformanceViewer/performanceViewerCollector.js +2 -3
- package/Misc/PerformanceViewer/performanceViewerCollector.js.map +1 -1
- package/Misc/arrayTools.js +1 -1
- package/Misc/arrayTools.js.map +1 -1
- package/Misc/basis.js +2 -3
- package/Misc/basis.js.map +1 -1
- package/Misc/dataStorage.js +1 -1
- package/Misc/dataStorage.js.map +1 -1
- package/Misc/deepCopier.js +1 -1
- package/Misc/deepCopier.js.map +1 -1
- package/Misc/environmentTextureTools.js +3 -4
- package/Misc/environmentTextureTools.js.map +1 -1
- package/Misc/equirectangularCapture.js +2 -3
- package/Misc/equirectangularCapture.js.map +1 -1
- package/Misc/fileTools.js +4 -4
- package/Misc/fileTools.js.map +1 -1
- package/Misc/greasedLineTools.js +3 -5
- package/Misc/greasedLineTools.js.map +1 -1
- package/Misc/logger.js +1 -2
- package/Misc/logger.js.map +1 -1
- package/Misc/minMaxReducer.js +2 -3
- package/Misc/minMaxReducer.js.map +1 -1
- package/Misc/pressureObserverWrapper.js +5 -8
- package/Misc/pressureObserverWrapper.js.map +1 -1
- package/Misc/sceneRecorder.js +1 -1
- package/Misc/sceneRecorder.js.map +1 -1
- package/Misc/screenshotTools.js +1 -1
- package/Misc/screenshotTools.js.map +1 -1
- package/Misc/textureTools.js +5 -5
- package/Misc/textureTools.js.map +1 -1
- package/Misc/timer.js +3 -5
- package/Misc/timer.js.map +1 -1
- package/Misc/tools.d.ts +3 -2
- package/Misc/tools.js +6 -5
- package/Misc/tools.js.map +1 -1
- package/Misc/trajectoryClassifier.js +3 -3
- package/Misc/trajectoryClassifier.js.map +1 -1
- package/Misc/videoRecorder.js +6 -4
- package/Misc/videoRecorder.js.map +1 -1
- package/Misc/virtualJoystick.js +4 -1
- package/Misc/virtualJoystick.js.map +1 -1
- package/Morph/morphTargetManager.js +1 -2
- package/Morph/morphTargetManager.js.map +1 -1
- package/Particles/EmitterTypes/meshParticleEmitter.js +1 -2
- package/Particles/EmitterTypes/meshParticleEmitter.js.map +1 -1
- package/Particles/baseParticleSystem.d.ts +4 -0
- package/Particles/baseParticleSystem.js +4 -0
- package/Particles/baseParticleSystem.js.map +1 -1
- package/Particles/computeShaderParticleSystem.js +3 -6
- package/Particles/computeShaderParticleSystem.js.map +1 -1
- package/Particles/gpuParticleSystem.d.ts +2 -2
- package/Particles/gpuParticleSystem.js +30 -20
- package/Particles/gpuParticleSystem.js.map +1 -1
- package/Particles/particleSystem.d.ts +3 -2
- package/Particles/particleSystem.js +33 -30
- package/Particles/particleSystem.js.map +1 -1
- package/Particles/particleSystemComponent.js +2 -3
- package/Particles/particleSystemComponent.js.map +1 -1
- package/Particles/pointsCloudSystem.js +5 -8
- package/Particles/pointsCloudSystem.js.map +1 -1
- package/Particles/solidParticleSystem.js +5 -7
- package/Particles/solidParticleSystem.js.map +1 -1
- package/Particles/webgl2ParticleSystem.js +1 -2
- package/Particles/webgl2ParticleSystem.js.map +1 -1
- package/Physics/castingResult.js +1 -1
- package/Physics/castingResult.js.map +1 -1
- package/Physics/joinedPhysicsEngineComponent.js +2 -2
- package/Physics/joinedPhysicsEngineComponent.js.map +1 -1
- package/Physics/physicsHelper.js +19 -21
- package/Physics/physicsHelper.js.map +1 -1
- package/Physics/v2/IPhysicsEnginePlugin.d.ts +20 -0
- package/Physics/v2/IPhysicsEnginePlugin.js.map +1 -1
- package/Physics/v2/Plugins/havokPlugin.js +48 -35
- package/Physics/v2/Plugins/havokPlugin.js.map +1 -1
- package/Physics/v2/physicsAggregate.js +10 -12
- package/Physics/v2/physicsAggregate.js.map +1 -1
- package/Physics/v2/physicsBody.js +2 -4
- package/Physics/v2/physicsBody.js.map +1 -1
- package/Physics/v2/physicsShape.js +1 -2
- package/Physics/v2/physicsShape.js.map +1 -1
- package/Physics/v2/ragdoll.js +6 -8
- package/Physics/v2/ragdoll.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js +6 -8
- package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssrRenderingPipeline.js +14 -22
- package/PostProcesses/RenderPipeline/Pipelines/ssrRenderingPipeline.js.map +1 -1
- package/PostProcesses/colorCorrectionPostProcess.js +1 -1
- package/PostProcesses/colorCorrectionPostProcess.js.map +1 -1
- package/PostProcesses/postProcess.js +28 -34
- package/PostProcesses/postProcess.js.map +1 -1
- package/PostProcesses/postProcessManager.js +4 -6
- package/PostProcesses/postProcessManager.js.map +1 -1
- package/PostProcesses/screenSpaceReflectionPostProcess.js +2 -2
- package/PostProcesses/screenSpaceReflectionPostProcess.js.map +1 -1
- package/PostProcesses/volumetricLightScatteringPostProcess.js +4 -7
- package/PostProcesses/volumetricLightScatteringPostProcess.js.map +1 -1
- package/PostProcesses/vrMultiviewToSingleviewPostProcess.js +1 -1
- package/PostProcesses/vrMultiviewToSingleviewPostProcess.js.map +1 -1
- package/Probes/reflectionProbe.js +2 -4
- package/Probes/reflectionProbe.js.map +1 -1
- package/Rendering/GlobalIllumination/giRSMManager.js +22 -19
- package/Rendering/GlobalIllumination/giRSMManager.js.map +1 -1
- package/Rendering/boundingBoxRenderer.js +2 -3
- package/Rendering/boundingBoxRenderer.js.map +1 -1
- package/Rendering/depthPeelingRenderer.js +2 -4
- package/Rendering/depthPeelingRenderer.js.map +1 -1
- package/Rendering/depthPeelingSceneComponent.js +2 -4
- package/Rendering/depthPeelingSceneComponent.js.map +1 -1
- package/Rendering/depthRenderer.js +10 -13
- package/Rendering/depthRenderer.js.map +1 -1
- package/Rendering/edgesRenderer.js +8 -11
- package/Rendering/edgesRenderer.js.map +1 -1
- package/Rendering/fluidRenderer/fluidRenderer.js +6 -11
- package/Rendering/fluidRenderer/fluidRenderer.js.map +1 -1
- package/Rendering/fluidRenderer/fluidRenderingObject.js +3 -5
- package/Rendering/fluidRenderer/fluidRenderingObject.js.map +1 -1
- package/Rendering/fluidRenderer/fluidRenderingObjectCustomParticles.js +2 -4
- package/Rendering/fluidRenderer/fluidRenderingObjectCustomParticles.js.map +1 -1
- package/Rendering/fluidRenderer/fluidRenderingTargetRenderer.js +30 -36
- package/Rendering/fluidRenderer/fluidRenderingTargetRenderer.js.map +1 -1
- package/Rendering/fluidRenderer/fluidRenderingTextures.js +5 -7
- package/Rendering/fluidRenderer/fluidRenderingTextures.js.map +1 -1
- package/Rendering/geometryBufferRenderer.js +3 -2
- package/Rendering/geometryBufferRenderer.js.map +1 -1
- package/Rendering/outlineRenderer.js +5 -4
- package/Rendering/outlineRenderer.js.map +1 -1
- package/Rendering/prePassRenderer.js +3 -6
- package/Rendering/prePassRenderer.js.map +1 -1
- package/Rendering/reflectiveShadowMap.d.ts +1 -0
- package/Rendering/reflectiveShadowMap.js +5 -5
- package/Rendering/reflectiveShadowMap.js.map +1 -1
- package/Shaders/color.fragment.d.ts +2 -0
- package/Shaders/color.fragment.js +4 -0
- package/Shaders/color.fragment.js.map +1 -1
- package/Shaders/color.vertex.d.ts +2 -0
- package/Shaders/color.vertex.js +7 -0
- package/Shaders/color.vertex.js.map +1 -1
- package/Shaders/gpuRenderParticles.fragment.d.ts +2 -0
- package/Shaders/gpuRenderParticles.fragment.js +4 -0
- package/Shaders/gpuRenderParticles.fragment.js.map +1 -1
- package/Shaders/gpuRenderParticles.vertex.d.ts +2 -0
- package/Shaders/gpuRenderParticles.vertex.js +5 -1
- package/Shaders/gpuRenderParticles.vertex.js.map +1 -1
- package/Shaders/particles.fragment.d.ts +2 -0
- package/Shaders/particles.fragment.js +4 -0
- package/Shaders/particles.fragment.js.map +1 -1
- package/Shaders/particles.vertex.d.ts +2 -0
- package/Shaders/particles.vertex.js +5 -1
- package/Shaders/particles.vertex.js.map +1 -1
- package/Sprites/spriteManager.js +1 -2
- package/Sprites/spriteManager.js.map +1 -1
- package/Sprites/spriteRenderer.js +5 -7
- package/Sprites/spriteRenderer.js.map +1 -1
- package/States/stencilStateComposer.js +2 -4
- package/States/stencilStateComposer.js.map +1 -1
- package/XR/features/WebXRAbstractFeature.js +6 -2
- package/XR/features/WebXRAbstractFeature.js.map +1 -1
- package/XR/features/WebXRAnchorSystem.js +1 -2
- package/XR/features/WebXRAnchorSystem.js.map +1 -1
- package/XR/features/WebXRControllerMovement.js +6 -7
- package/XR/features/WebXRControllerMovement.js.map +1 -1
- package/XR/features/WebXRControllerPhysics.js +17 -10
- package/XR/features/WebXRControllerPhysics.js.map +1 -1
- package/XR/features/WebXRControllerPointerSelection.js +1 -2
- package/XR/features/WebXRControllerPointerSelection.js.map +1 -1
- package/XR/features/WebXRControllerTeleportation.d.ts +1 -0
- package/XR/features/WebXRControllerTeleportation.js +6 -3
- package/XR/features/WebXRControllerTeleportation.js.map +1 -1
- package/XR/features/WebXRDepthSensing.js +3 -5
- package/XR/features/WebXRDepthSensing.js.map +1 -1
- package/XR/features/WebXRHandTracking.d.ts +1 -0
- package/XR/features/WebXRHandTracking.js +31 -28
- package/XR/features/WebXRHandTracking.js.map +1 -1
- package/XR/features/WebXRLayers.js +9 -11
- package/XR/features/WebXRLayers.js.map +1 -1
- package/XR/features/WebXRLightEstimation.js +3 -6
- package/XR/features/WebXRLightEstimation.js.map +1 -1
- package/XR/features/WebXRMeshDetector.js +2 -4
- package/XR/features/WebXRMeshDetector.js.map +1 -1
- package/XR/features/WebXRNearInteraction.js +21 -18
- package/XR/features/WebXRNearInteraction.js.map +1 -1
- package/XR/features/WebXRPlaneDetector.js +1 -2
- package/XR/features/WebXRPlaneDetector.js.map +1 -1
- package/XR/features/WebXRRawCameraAccess.js +2 -3
- package/XR/features/WebXRRawCameraAccess.js.map +1 -1
- package/XR/features/WebXRSpaceWarp.js +1 -1
- package/XR/features/WebXRSpaceWarp.js.map +1 -1
- package/XR/motionController/webXRAbstractMotionController.js +4 -1
- package/XR/motionController/webXRAbstractMotionController.js.map +1 -1
- package/XR/native/nativeXRFrame.js +1 -2
- package/XR/native/nativeXRFrame.js.map +1 -1
- package/XR/webXRCamera.js +1 -2
- package/XR/webXRCamera.js.map +1 -1
- package/XR/webXRDefaultExperience.js +28 -6
- package/XR/webXRDefaultExperience.js.map +1 -1
- package/XR/webXRExperienceHelper.js +5 -7
- package/XR/webXRExperienceHelper.js.map +1 -1
- package/XR/webXRFeaturesManager.js +4 -1
- package/XR/webXRFeaturesManager.js.map +1 -1
- package/XR/webXRInput.js +6 -1
- package/XR/webXRInput.js.map +1 -1
- package/XR/webXRInputSource.js +1 -2
- package/XR/webXRInputSource.js.map +1 -1
- package/XR/webXRSessionManager.js +16 -29
- package/XR/webXRSessionManager.js.map +1 -1
- package/assetContainer.js +4 -1
- package/assetContainer.js.map +1 -1
- package/package.json +1 -1
- package/scene.js +18 -17
- package/scene.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"physicsHelper.js","sourceRoot":"","sources":["../../../../dev/core/src/Physics/physicsHelper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAG3D,OAAO,EAAE,YAAY,EAAE,M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QAK7B","sourcesContent":["import type { Nullable } from \"../types\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport { TmpVectors, Vector3 } from \"../Maths/math.vector\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport type { Mesh } from \"../Meshes/mesh\";\r\nimport { CreateSphere } from \"../Meshes/Builders/sphereBuilder\";\r\nimport { CreateCylinder } from \"../Meshes/Builders/cylinderBuilder\";\r\nimport { Ray } from \"../Culling/ray\";\r\nimport type { Scene } from \"../scene\";\r\nimport type { PhysicsEngine as PhysicsEngineV1 } from \"./physicsEngine\";\r\nimport type { PhysicsEngine as PhysicsEngineV2 } from \"./v2/physicsEngine\";\r\nimport type { IPhysicsEngine } from \"./IPhysicsEngine\";\r\nimport type { PhysicsImpostor } from \"./v1/physicsImpostor\";\r\nimport type { PhysicsBody } from \"./v2/physicsBody\";\r\nimport { PhysicsMotionType } from \"./v2/IPhysicsEnginePlugin\";\r\n\r\nclass HelperTools {\r\n /*\r\n * Gets the hit contact point between a mesh and a ray. The method varies between\r\n * the different plugin versions; V1 uses a mesh intersection, V2 uses the physics body instance/object center (to avoid a raycast and improve perf).\r\n */\r\n static GetContactPointToRef(mesh: AbstractMesh, origin: Vector3, direction: Vector3, result: Vector3, instanceIndex?: number): boolean {\r\n const engine = mesh.getScene().getPhysicsEngine();\r\n const pluginVersion = engine?.getPluginVersion();\r\n if (pluginVersion === 1) {\r\n const ray = new Ray(origin, direction);\r\n const hit = ray.intersectsMesh(mesh);\r\n if (hit.hit && hit.pickedPoint) {\r\n result.copyFrom(hit.pickedPoint);\r\n return true;\r\n }\r\n } else if (pluginVersion === 2) {\r\n mesh.physicsBody!.getObjectCenterWorldToRef(result, instanceIndex);\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n /**\r\n * Checks if a body will be affected by forces\r\n * @param body the body to check\r\n * @param instanceIndex for instanced bodies, the index of the instance to check\r\n * @returns\r\n */\r\n static HasAppliedForces(body: PhysicsBody, instanceIndex?: number) {\r\n return (\r\n body.getMotionType(instanceIndex) === PhysicsMotionType.STATIC ||\r\n (body.getMassProperties(instanceIndex)?.mass ?? 0) === 0 ||\r\n (body.transformNode as Mesh)?.getTotalVertices() === 0\r\n );\r\n }\r\n\r\n /**\r\n * Checks if a point is inside a cylinder\r\n * @param point point to check\r\n * @param origin cylinder origin on the bottom\r\n * @param radius cylinder radius\r\n * @param height cylinder height\r\n * @returns\r\n */\r\n static IsInsideCylinder(point: Vector3, origin: Vector3, radius: number, height: number): boolean {\r\n const distance = TmpVectors.Vector3[0];\r\n point.subtractToRef(origin, distance);\r\n return Math.abs(distance.x) <= radius && Math.abs(distance.z) <= radius && distance.y >= 0 && distance.y <= height;\r\n }\r\n}\r\n\r\n/**\r\n * A helper for physics simulations\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class\r\n */\r\nexport class PhysicsHelper {\r\n private _scene: Scene;\r\n private _physicsEngine: Nullable<IPhysicsEngine>;\r\n private _hitData: PhysicsHitData = { force: new Vector3(), contactPoint: new Vector3(), distanceFromOrigin: 0 };\r\n\r\n /**\r\n * Initializes the Physics helper\r\n * @param scene Babylon.js scene\r\n */\r\n constructor(scene: Scene) {\r\n this._scene = scene;\r\n this._physicsEngine = this._scene.getPhysicsEngine();\r\n\r\n if (!this._physicsEngine) {\r\n Logger.Warn(\"Physics engine not enabled. Please enable the physics before you can use the methods.\");\r\n return;\r\n }\r\n }\r\n\r\n /**\r\n * Applies a radial explosion impulse\r\n * @param origin the origin of the explosion\r\n * @param radiusOrEventOptions the radius or the options of radial explosion\r\n * @param strength the explosion strength\r\n * @param falloff possible options: Constant & Linear. Defaults to Constant\r\n * @returns A physics radial explosion event, or null\r\n */\r\n public applyRadialExplosionImpulse(\r\n origin: Vector3,\r\n radiusOrEventOptions: number | PhysicsRadialExplosionEventOptions,\r\n strength?: number,\r\n falloff?: PhysicsRadialImpulseFalloff\r\n ): Nullable<PhysicsRadialExplosionEvent> {\r\n if (!this._physicsEngine) {\r\n Logger.Warn(\"Physics engine not enabled. Please enable the physics before you call this method.\");\r\n return null;\r\n }\r\n\r\n if (this._physicsEngine.getPluginVersion() === 1 && (<PhysicsEngineV1>this._physicsEngine).getImpostors().length === 0) {\r\n return null;\r\n }\r\n\r\n if (this._physicsEngine.getPluginVersion() === 2 && (<PhysicsEngineV2>this._physicsEngine).getBodies().length === 0) {\r\n return null;\r\n }\r\n\r\n let useCallback = false;\r\n if (typeof radiusOrEventOptions === \"number\") {\r\n const r = radiusOrEventOptions;\r\n radiusOrEventOptions = new PhysicsRadialExplosionEventOptions();\r\n radiusOrEventOptions.radius = r;\r\n radiusOrEventOptions.strength = strength ?? radiusOrEventOptions.strength;\r\n radiusOrEventOptions.falloff = falloff ?? radiusOrEventOptions.falloff;\r\n } else {\r\n useCallback = !!(radiusOrEventOptions.affectedImpostorsCallback || radiusOrEventOptions.affectedBodiesCallback);\r\n }\r\n\r\n const event = new PhysicsRadialExplosionEvent(this._scene, radiusOrEventOptions);\r\n\r\n const hitData = this._hitData;\r\n if (this._physicsEngine.getPluginVersion() === 1) {\r\n const affectedImpostorsWithData = Array<PhysicsAffectedImpostorWithData>();\r\n const impostors = (<PhysicsEngineV1>this._physicsEngine).getImpostors();\r\n impostors.forEach((impostor: PhysicsImpostor) => {\r\n if (!event.getImpostorHitData(impostor, origin, hitData)) {\r\n return;\r\n }\r\n\r\n impostor.applyImpulse(hitData.force, hitData.contactPoint);\r\n\r\n if (useCallback) {\r\n affectedImpostorsWithData.push({\r\n impostor: impostor,\r\n hitData: this._copyPhysicsHitData(hitData),\r\n });\r\n }\r\n });\r\n\r\n event.triggerAffectedImpostorsCallback(affectedImpostorsWithData);\r\n } else {\r\n this._applicationForBodies(event, origin, hitData, useCallback, (body: PhysicsBody, hitData: PhysicsHitData) => {\r\n body.applyImpulse(hitData.force, hitData.contactPoint, hitData.instanceIndex);\r\n });\r\n }\r\n\r\n event.dispose(false);\r\n\r\n return event;\r\n }\r\n\r\n /**\r\n * Applies a radial explosion force\r\n * @param origin the origin of the explosion\r\n * @param radiusOrEventOptions the radius or the options of radial explosion\r\n * @param strength the explosion strength\r\n * @param falloff possible options: Constant & Linear. Defaults to Constant\r\n * @returns A physics radial explosion event, or null\r\n */\r\n public applyRadialExplosionForce(\r\n origin: Vector3,\r\n radiusOrEventOptions: number | PhysicsRadialExplosionEventOptions,\r\n strength?: number,\r\n falloff?: PhysicsRadialImpulseFalloff\r\n ): Nullable<PhysicsRadialExplosionEvent> {\r\n if (!this._physicsEngine) {\r\n Logger.Warn(\"Physics engine not enabled. Please enable the physics before you call the PhysicsHelper.\");\r\n return null;\r\n }\r\n\r\n if (this._physicsEngine.getPluginVersion() === 1 && (<PhysicsEngineV1>this._physicsEngine).getImpostors().length === 0) {\r\n return null;\r\n }\r\n\r\n if (this._physicsEngine.getPluginVersion() === 2 && (<PhysicsEngineV2>this._physicsEngine).getBodies().length === 0) {\r\n return null;\r\n }\r\n\r\n let useCallback = false;\r\n if (typeof radiusOrEventOptions === \"number\") {\r\n const r = radiusOrEventOptions;\r\n radiusOrEventOptions = new PhysicsRadialExplosionEventOptions();\r\n radiusOrEventOptions.radius = r;\r\n radiusOrEventOptions.strength = strength ?? radiusOrEventOptions.strength;\r\n radiusOrEventOptions.falloff = falloff ?? radiusOrEventOptions.falloff;\r\n } else {\r\n useCallback = !!(radiusOrEventOptions.affectedImpostorsCallback || radiusOrEventOptions.affectedBodiesCallback);\r\n }\r\n\r\n const event = new PhysicsRadialExplosionEvent(this._scene, radiusOrEventOptions);\r\n\r\n const hitData = this._hitData;\r\n if (this._physicsEngine.getPluginVersion() === 1) {\r\n const affectedImpostorsWithData = Array<PhysicsAffectedImpostorWithData>();\r\n const impostors = (<PhysicsEngineV1>this._physicsEngine).getImpostors();\r\n impostors.forEach((impostor: PhysicsImpostor) => {\r\n if (!event.getImpostorHitData(impostor, origin, hitData)) {\r\n return;\r\n }\r\n\r\n impostor.applyForce(hitData.force, hitData.contactPoint);\r\n\r\n if (useCallback) {\r\n affectedImpostorsWithData.push({\r\n impostor: impostor,\r\n hitData: this._copyPhysicsHitData(hitData),\r\n });\r\n }\r\n });\r\n\r\n event.triggerAffectedImpostorsCallback(affectedImpostorsWithData);\r\n } else {\r\n this._applicationForBodies(event, origin, hitData, useCallback, (body: PhysicsBody, hitData: PhysicsHitData) => {\r\n body.applyForce(hitData.force, hitData.contactPoint, hitData.instanceIndex);\r\n });\r\n }\r\n\r\n event.dispose(false);\r\n\r\n return event;\r\n }\r\n\r\n private _applicationForBodies(\r\n event: PhysicsRadialExplosionEvent,\r\n origin: Vector3,\r\n hitData: PhysicsHitData,\r\n useCallback: boolean,\r\n fnApplication: (body: PhysicsBody, hitData: PhysicsHitData, instanceIndex?: number) => void\r\n ) {\r\n const affectedBodiesWithData = Array<PhysicsAffectedBodyWithData>();\r\n const bodies = (<PhysicsEngineV2>this._physicsEngine).getBodies();\r\n for (const body of bodies) {\r\n body.iterateOverAllInstances((body, instanceIndex) => {\r\n if (!event.getBodyHitData(body, origin, hitData, instanceIndex)) {\r\n return;\r\n }\r\n fnApplication(body, hitData);\r\n\r\n if (useCallback) {\r\n affectedBodiesWithData.push({\r\n body: body,\r\n hitData: this._copyPhysicsHitData(hitData),\r\n });\r\n }\r\n });\r\n }\r\n\r\n event.triggerAffectedBodiesCallback(affectedBodiesWithData);\r\n }\r\n\r\n /**\r\n * Creates a gravitational field\r\n * @param origin the origin of the gravitational field\r\n * @param radiusOrEventOptions the radius or the options of radial gravitational field\r\n * @param strength the gravitational field strength\r\n * @param falloff possible options: Constant & Linear. Defaults to Constant\r\n * @returns A physics gravitational field event, or null\r\n */\r\n public gravitationalField(\r\n origin: Vector3,\r\n radiusOrEventOptions: number | PhysicsRadialExplosionEventOptions,\r\n strength?: number,\r\n falloff?: PhysicsRadialImpulseFalloff\r\n ): Nullable<PhysicsGravitationalFieldEvent> {\r\n if (!this._physicsEngine) {\r\n Logger.Warn(\"Physics engine not enabled. Please enable the physics before you call the PhysicsHelper.\");\r\n return null;\r\n }\r\n\r\n if (this._physicsEngine.getPluginVersion() === 1 && (<PhysicsEngineV1>this._physicsEngine).getImpostors().length === 0) {\r\n return null;\r\n }\r\n\r\n if (this._physicsEngine.getPluginVersion() === 2 && (<PhysicsEngineV2>this._physicsEngine).getBodies().length === 0) {\r\n return null;\r\n }\r\n\r\n if (typeof radiusOrEventOptions === \"number\") {\r\n const r = radiusOrEventOptions;\r\n radiusOrEventOptions = new PhysicsRadialExplosionEventOptions();\r\n radiusOrEventOptions.radius = r;\r\n radiusOrEventOptions.strength = strength ?? radiusOrEventOptions.strength;\r\n radiusOrEventOptions.falloff = falloff ?? radiusOrEventOptions.falloff;\r\n }\r\n\r\n const event = new PhysicsGravitationalFieldEvent(this, this._scene, origin, radiusOrEventOptions);\r\n\r\n event.dispose(false);\r\n\r\n return event;\r\n }\r\n\r\n /**\r\n * Creates a physics updraft event\r\n * @param origin the origin of the updraft\r\n * @param radiusOrEventOptions the radius or the options of the updraft\r\n * @param strength the strength of the updraft\r\n * @param height the height of the updraft\r\n * @param updraftMode possible options: Center & Perpendicular. Defaults to Center\r\n * @returns A physics updraft event, or null\r\n */\r\n public updraft(\r\n origin: Vector3,\r\n radiusOrEventOptions: number | PhysicsUpdraftEventOptions,\r\n strength?: number,\r\n height?: number,\r\n updraftMode?: PhysicsUpdraftMode\r\n ): Nullable<PhysicsUpdraftEvent> {\r\n if (!this._physicsEngine) {\r\n Logger.Warn(\"Physics engine not enabled. Please enable the physics before you call the PhysicsHelper.\");\r\n return null;\r\n }\r\n\r\n if (this._physicsEngine.getPluginVersion() === 1 && (<PhysicsEngineV1>this._physicsEngine).getImpostors().length === 0) {\r\n return null;\r\n }\r\n\r\n if (this._physicsEngine.getPluginVersion() === 2 && (<PhysicsEngineV2>this._physicsEngine).getBodies().length === 0) {\r\n return null;\r\n }\r\n\r\n if (typeof radiusOrEventOptions === \"number\") {\r\n const r = radiusOrEventOptions;\r\n radiusOrEventOptions = new PhysicsUpdraftEventOptions();\r\n radiusOrEventOptions.radius = r;\r\n radiusOrEventOptions.strength = strength ?? radiusOrEventOptions.strength;\r\n radiusOrEventOptions.height = height ?? radiusOrEventOptions.height;\r\n radiusOrEventOptions.updraftMode = updraftMode ?? radiusOrEventOptions.updraftMode;\r\n }\r\n\r\n const event = new PhysicsUpdraftEvent(this._scene, origin, radiusOrEventOptions);\r\n\r\n event.dispose(false);\r\n\r\n return event;\r\n }\r\n\r\n /**\r\n * Creates a physics vortex event\r\n * @param origin the of the vortex\r\n * @param radiusOrEventOptions the radius or the options of the vortex\r\n * @param strength the strength of the vortex\r\n * @param height the height of the vortex\r\n * @returns a Physics vortex event, or null\r\n * A physics vortex event or null\r\n */\r\n public vortex(origin: Vector3, radiusOrEventOptions: number | PhysicsVortexEventOptions, strength?: number, height?: number): Nullable<PhysicsVortexEvent> {\r\n if (!this._physicsEngine) {\r\n Logger.Warn(\"Physics engine not enabled. Please enable the physics before you call the PhysicsHelper.\");\r\n return null;\r\n }\r\n\r\n if (this._physicsEngine.getPluginVersion() === 1 && (<PhysicsEngineV1>this._physicsEngine).getImpostors().length === 0) {\r\n return null;\r\n }\r\n\r\n if (this._physicsEngine.getPluginVersion() === 2 && (<PhysicsEngineV2>this._physicsEngine).getBodies().length === 0) {\r\n return null;\r\n }\r\n\r\n if (typeof radiusOrEventOptions === \"number\") {\r\n const r = radiusOrEventOptions;\r\n radiusOrEventOptions = new PhysicsVortexEventOptions();\r\n radiusOrEventOptions.radius = r;\r\n radiusOrEventOptions.strength = strength ?? radiusOrEventOptions.strength;\r\n radiusOrEventOptions.height = height ?? radiusOrEventOptions.height;\r\n }\r\n\r\n const event = new PhysicsVortexEvent(this._scene, origin, radiusOrEventOptions);\r\n\r\n event.dispose(false);\r\n\r\n return event;\r\n }\r\n\r\n private _copyPhysicsHitData(data: PhysicsHitData): PhysicsHitData {\r\n return { force: data.force.clone(), contactPoint: data.contactPoint.clone(), distanceFromOrigin: data.distanceFromOrigin, instanceIndex: data.instanceIndex };\r\n }\r\n}\r\n\r\n/**\r\n * Represents a physics radial explosion event\r\n */\r\nclass PhysicsRadialExplosionEvent {\r\n private _sphere: Mesh; // create a sphere, so we can get the intersecting meshes inside\r\n private _dataFetched: boolean = false; // check if the data has been fetched. If not, do cleanup\r\n\r\n /**\r\n * Initializes a radial explosion event\r\n * @param _scene BabylonJS scene\r\n * @param _options The options for the vortex event\r\n */\r\n constructor(\r\n private _scene: Scene,\r\n private _options: PhysicsRadialExplosionEventOptions\r\n ) {\r\n this._options = { ...new PhysicsRadialExplosionEventOptions(), ...this._options };\r\n }\r\n\r\n /**\r\n * Returns the data related to the radial explosion event (sphere).\r\n * @returns The radial explosion event data\r\n */\r\n public getData(): PhysicsRadialExplosionEventData {\r\n this._dataFetched = true;\r\n\r\n return {\r\n sphere: this._sphere,\r\n };\r\n }\r\n\r\n private _getHitData(mesh: AbstractMesh, center: Vector3, origin: Vector3, data: PhysicsHitData): boolean {\r\n const direction = TmpVectors.Vector3[0];\r\n direction.copyFrom(center).subtractInPlace(origin);\r\n\r\n const contactPoint = TmpVectors.Vector3[1];\r\n const hasContactPoint = HelperTools.GetContactPointToRef(mesh, origin, direction, contactPoint, data.instanceIndex);\r\n\r\n if (!hasContactPoint) {\r\n return false;\r\n }\r\n\r\n const distanceFromOrigin = Vector3.Distance(origin, contactPoint);\r\n if (distanceFromOrigin > this._options.radius) {\r\n return false;\r\n }\r\n\r\n const multiplier =\r\n this._options.falloff === PhysicsRadialImpulseFalloff.Constant ? this._options.strength : this._options.strength * (1 - distanceFromOrigin / this._options.radius);\r\n\r\n // Direction x multiplier equals force\r\n direction.scaleInPlace(multiplier);\r\n\r\n data.force.copyFrom(direction);\r\n data.contactPoint.copyFrom(contactPoint);\r\n data.distanceFromOrigin = distanceFromOrigin;\r\n return true;\r\n }\r\n\r\n /**\r\n * Returns the force and contact point of the body or false, if the body is not affected by the force/impulse.\r\n * @param body A physics body where the transform node is an AbstractMesh\r\n * @param origin the origin of the explosion\r\n * @param data the data of the hit\r\n * @param instanceIndex the instance index of the body\r\n * @returns if there was a hit\r\n */\r\n public getBodyHitData(body: PhysicsBody, origin: Vector3, data: PhysicsHitData, instanceIndex?: number): boolean {\r\n // No force will be applied in these cases, so we skip calculation\r\n if (HelperTools.HasAppliedForces(body, instanceIndex)) {\r\n return false;\r\n }\r\n\r\n const mesh = body.transformNode as AbstractMesh;\r\n const bodyObjectCenter = body.getObjectCenterWorld(instanceIndex);\r\n data.instanceIndex = instanceIndex;\r\n return this._getHitData(mesh, bodyObjectCenter, origin, data);\r\n }\r\n /**\r\n * Returns the force and contact point of the impostor or false, if the impostor is not affected by the force/impulse.\r\n * @param impostor A physics imposter\r\n * @param origin the origin of the explosion\r\n * @param data the data of the hit\r\n * @returns A physics force and contact point, or null\r\n */\r\n public getImpostorHitData(impostor: PhysicsImpostor, origin: Vector3, data: PhysicsHitData): boolean {\r\n if (impostor.mass === 0) {\r\n return false;\r\n }\r\n\r\n if (impostor.object.getClassName() !== \"Mesh\" && impostor.object.getClassName() !== \"InstancedMesh\") {\r\n return false;\r\n }\r\n\r\n const mesh = impostor.object as AbstractMesh;\r\n if (!this._intersectsWithSphere(mesh, origin, this._options.radius)) {\r\n return false;\r\n }\r\n\r\n const impostorObjectCenter = impostor.getObjectCenter();\r\n\r\n this._getHitData(mesh, impostorObjectCenter, origin, data);\r\n return true;\r\n }\r\n\r\n /**\r\n * Triggers affected impostors callbacks\r\n * @param affectedImpostorsWithData defines the list of affected impostors (including associated data)\r\n */\r\n public triggerAffectedImpostorsCallback(affectedImpostorsWithData: Array<PhysicsAffectedImpostorWithData>) {\r\n if (this._options.affectedImpostorsCallback) {\r\n this._options.affectedImpostorsCallback(affectedImpostorsWithData);\r\n }\r\n }\r\n\r\n /**\r\n * Triggers affected bodies callbacks\r\n * @param affectedBodiesWithData defines the list of affected bodies (including associated data)\r\n */\r\n public triggerAffectedBodiesCallback(affectedBodiesWithData: Array<PhysicsAffectedBodyWithData>) {\r\n if (this._options.affectedBodiesCallback) {\r\n this._options.affectedBodiesCallback(affectedBodiesWithData);\r\n }\r\n }\r\n /**\r\n * Disposes the sphere.\r\n * @param force Specifies if the sphere should be disposed by force\r\n */\r\n public dispose(force: boolean = true) {\r\n if (this._sphere) {\r\n if (force) {\r\n this._sphere.dispose();\r\n } else {\r\n setTimeout(() => {\r\n if (!this._dataFetched) {\r\n this._sphere.dispose();\r\n }\r\n }, 0);\r\n }\r\n }\r\n }\r\n\r\n /*** Helpers ***/\r\n\r\n private _prepareSphere(): void {\r\n if (!this._sphere) {\r\n this._sphere = CreateSphere(\"radialExplosionEventSphere\", this._options.sphere, this._scene);\r\n this._sphere.isVisible = false;\r\n }\r\n }\r\n\r\n private _intersectsWithSphere(mesh: AbstractMesh, origin: Vector3, radius: number): boolean {\r\n this._prepareSphere();\r\n\r\n this._sphere.position = origin;\r\n this._sphere.scaling.setAll(radius * 2);\r\n this._sphere._updateBoundingInfo();\r\n this._sphere.computeWorldMatrix(true);\r\n\r\n return this._sphere.intersectsMesh(mesh, true);\r\n }\r\n}\r\n\r\n/**\r\n * Represents a gravitational field event\r\n */\r\nclass PhysicsGravitationalFieldEvent {\r\n private _tickCallback: any;\r\n private _sphere: Mesh;\r\n private _dataFetched: boolean = false; // check if the has been fetched the data. If not, do cleanup\r\n\r\n /**\r\n * Initializes the physics gravitational field event\r\n * @param _physicsHelper A physics helper\r\n * @param _scene BabylonJS scene\r\n * @param _origin The origin position of the gravitational field event\r\n * @param _options The options for the vortex event\r\n */\r\n constructor(\r\n private _physicsHelper: PhysicsHelper,\r\n private _scene: Scene,\r\n private _origin: Vector3,\r\n private _options: PhysicsRadialExplosionEventOptions\r\n ) {\r\n this._options = { ...new PhysicsRadialExplosionEventOptions(), ...this._options };\r\n\r\n this._tickCallback = () => this._tick();\r\n\r\n this._options.strength = this._options.strength * -1;\r\n }\r\n\r\n /**\r\n * Returns the data related to the gravitational field event (sphere).\r\n * @returns A gravitational field event\r\n */\r\n public getData(): PhysicsGravitationalFieldEventData {\r\n this._dataFetched = true;\r\n\r\n return {\r\n sphere: this._sphere,\r\n };\r\n }\r\n\r\n /**\r\n * Enables the gravitational field.\r\n */\r\n public enable() {\r\n this._tickCallback.call(this);\r\n this._scene.registerBeforeRender(this._tickCallback);\r\n }\r\n\r\n /**\r\n * Disables the gravitational field.\r\n */\r\n public disable() {\r\n this._scene.unregisterBeforeRender(this._tickCallback);\r\n }\r\n\r\n /**\r\n * Disposes the sphere.\r\n * @param force The force to dispose from the gravitational field event\r\n */\r\n public dispose(force: boolean = true) {\r\n if (!this._sphere) {\r\n return;\r\n }\r\n if (force) {\r\n this._sphere.dispose();\r\n } else {\r\n setTimeout(() => {\r\n if (!this._dataFetched) {\r\n this._sphere.dispose();\r\n }\r\n }, 0);\r\n }\r\n }\r\n\r\n private _tick() {\r\n // Since the params won't change, we fetch the event only once\r\n if (this._sphere) {\r\n this._physicsHelper.applyRadialExplosionForce(this._origin, this._options);\r\n } else {\r\n const radialExplosionEvent = this._physicsHelper.applyRadialExplosionForce(this._origin, this._options);\r\n if (radialExplosionEvent) {\r\n this._sphere = <Mesh>radialExplosionEvent.getData().sphere?.clone(\"radialExplosionEventSphereClone\");\r\n }\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Represents a physics updraft event\r\n */\r\nclass PhysicsUpdraftEvent {\r\n private _physicsEngine: PhysicsEngineV1 | PhysicsEngineV2;\r\n private _originTop: Vector3 = Vector3.Zero(); // the most upper part of the cylinder\r\n private _originDirection: Vector3 = Vector3.Zero(); // used if the updraftMode is perpendicular\r\n private _tickCallback: any;\r\n private _cylinder: Mesh | undefined;\r\n private _cylinderPosition: Vector3 = Vector3.Zero(); // to keep the cylinders position, because normally the origin is in the center and not on the bottom\r\n private _dataFetched: boolean = false; // check if the has been fetched the data. If not, do cleanup\r\n private static _HitData: PhysicsHitData = { force: new Vector3(), contactPoint: new Vector3(), distanceFromOrigin: 0 };\r\n /**\r\n * Initializes the physics updraft event\r\n * @param _scene BabylonJS scene\r\n * @param _origin The origin position of the updraft\r\n * @param _options The options for the updraft event\r\n */\r\n constructor(\r\n private _scene: Scene,\r\n private _origin: Vector3,\r\n private _options: PhysicsUpdraftEventOptions\r\n ) {\r\n this._physicsEngine = this._scene.getPhysicsEngine() as PhysicsEngineV1 | PhysicsEngineV2;\r\n this._options = { ...new PhysicsUpdraftEventOptions(), ...this._options };\r\n\r\n this._origin.addToRef(new Vector3(0, this._options.height / 2, 0), this._cylinderPosition);\r\n this._origin.addToRef(new Vector3(0, this._options.height, 0), this._originTop);\r\n\r\n if (this._options.updraftMode === PhysicsUpdraftMode.Perpendicular) {\r\n this._originDirection = this._origin.subtract(this._originTop).normalize();\r\n }\r\n\r\n this._tickCallback = () => this._tick();\r\n\r\n if (this._physicsEngine.getPluginVersion() === 1) {\r\n this._prepareCylinder();\r\n }\r\n }\r\n\r\n /**\r\n * Returns the data related to the updraft event (cylinder).\r\n * @returns A physics updraft event\r\n */\r\n public getData(): PhysicsUpdraftEventData {\r\n this._dataFetched = true;\r\n\r\n return {\r\n cylinder: this._cylinder,\r\n };\r\n }\r\n\r\n /**\r\n * Enables the updraft.\r\n */\r\n public enable() {\r\n this._tickCallback.call(this);\r\n this._scene.registerBeforeRender(this._tickCallback);\r\n }\r\n\r\n /**\r\n * Disables the updraft.\r\n */\r\n public disable() {\r\n this._scene.unregisterBeforeRender(this._tickCallback);\r\n }\r\n\r\n /**\r\n * Disposes the cylinder.\r\n * @param force Specifies if the updraft should be disposed by force\r\n */\r\n public dispose(force: boolean = true) {\r\n if (!this._cylinder) {\r\n return;\r\n }\r\n if (force) {\r\n this._cylinder.dispose();\r\n this._cylinder = undefined;\r\n } else {\r\n setTimeout(() => {\r\n if (!this._dataFetched && this._cylinder) {\r\n this._cylinder.dispose();\r\n this._cylinder = undefined;\r\n }\r\n }, 0);\r\n }\r\n }\r\n\r\n private _getHitData(center: Vector3, data: PhysicsHitData): void {\r\n let direction: Vector3;\r\n if (this._options.updraftMode === PhysicsUpdraftMode.Perpendicular) {\r\n direction = this._originDirection;\r\n } else {\r\n direction = center.subtract(this._originTop);\r\n }\r\n\r\n const distanceFromOrigin = Vector3.Distance(this._origin, center);\r\n\r\n const multiplier = this._options.strength * -1;\r\n\r\n const force = direction.multiplyByFloats(multiplier, multiplier, multiplier);\r\n\r\n data.force.copyFrom(force);\r\n data.contactPoint.copyFrom(center);\r\n data.distanceFromOrigin = distanceFromOrigin;\r\n }\r\n\r\n private _getBodyHitData(body: PhysicsBody, data: PhysicsHitData, instanceIndex?: number): boolean {\r\n if (HelperTools.HasAppliedForces(body)) {\r\n return false;\r\n }\r\n\r\n const center = body.getObjectCenterWorld(instanceIndex);\r\n\r\n if (!HelperTools.IsInsideCylinder(center, this._origin, this._options.radius, this._options.height)) {\r\n return false;\r\n }\r\n\r\n data.instanceIndex = instanceIndex;\r\n this._getHitData(center, data);\r\n return true;\r\n }\r\n\r\n private _getImpostorHitData(impostor: PhysicsImpostor, data: PhysicsHitData): boolean {\r\n if (impostor.mass === 0) {\r\n return false;\r\n }\r\n\r\n const impostorObject = <AbstractMesh>impostor.object;\r\n if (!this._intersectsWithCylinder(impostorObject)) {\r\n return false;\r\n }\r\n\r\n const center = impostor.getObjectCenter();\r\n this._getHitData(center, data);\r\n return true;\r\n }\r\n\r\n private _tick() {\r\n const hitData = PhysicsUpdraftEvent._HitData;\r\n if (this._physicsEngine.getPluginVersion() === 1) {\r\n (<PhysicsEngineV1>this._physicsEngine).getImpostors().forEach((impostor: PhysicsImpostor) => {\r\n if (!this._getImpostorHitData(impostor, hitData)) {\r\n return;\r\n }\r\n\r\n impostor.applyForce(hitData.force, hitData.contactPoint);\r\n });\r\n } else {\r\n // V2\r\n (<PhysicsEngineV2>this._physicsEngine).getBodies().forEach((body: PhysicsBody) => {\r\n body.iterateOverAllInstances((body, instanceIndex) => {\r\n if (!this._getBodyHitData(body, hitData, instanceIndex)) {\r\n return;\r\n }\r\n\r\n body.applyForce(hitData.force, hitData.contactPoint, hitData.instanceIndex);\r\n });\r\n });\r\n }\r\n }\r\n\r\n /*** Helpers ***/\r\n\r\n private _prepareCylinder(): void {\r\n if (!this._cylinder) {\r\n this._cylinder = CreateCylinder(\r\n \"updraftEventCylinder\",\r\n {\r\n height: this._options.height,\r\n diameter: this._options.radius * 2,\r\n },\r\n this._scene\r\n );\r\n this._cylinder.isVisible = false;\r\n }\r\n }\r\n\r\n private _intersectsWithCylinder(mesh: AbstractMesh): boolean {\r\n if (!this._cylinder) {\r\n return false;\r\n }\r\n this._cylinder.position = this._cylinderPosition;\r\n return this._cylinder.intersectsMesh(mesh, true);\r\n }\r\n}\r\n\r\n/**\r\n * Represents a physics vortex event\r\n */\r\nclass PhysicsVortexEvent {\r\n private _physicsEngine: PhysicsEngineV1 | PhysicsEngineV2;\r\n private _originTop: Vector3 = Vector3.Zero(); // the most upper part of the cylinder\r\n private _tickCallback: any;\r\n private _cylinder: Mesh;\r\n private _cylinderPosition: Vector3 = Vector3.Zero(); // to keep the cylinders position, because normally the origin is in the center and not on the bottom\r\n private _dataFetched: boolean = false; // check if the has been fetched the data. If not, do cleanup\r\n private static _OriginOnPlane: Vector3 = Vector3.Zero();\r\n private static _HitData: PhysicsHitData = { force: new Vector3(), contactPoint: new Vector3(), distanceFromOrigin: 0 };\r\n\r\n /**\r\n * Initializes the physics vortex event\r\n * @param _scene The BabylonJS scene\r\n * @param _origin The origin position of the vortex\r\n * @param _options The options for the vortex event\r\n */\r\n constructor(\r\n private _scene: Scene,\r\n private _origin: Vector3,\r\n private _options: PhysicsVortexEventOptions\r\n ) {\r\n this._physicsEngine = this._scene.getPhysicsEngine() as PhysicsEngineV1 | PhysicsEngineV2;\r\n this._options = { ...new PhysicsVortexEventOptions(), ...this._options };\r\n\r\n this._origin.addToRef(new Vector3(0, this._options.height / 2, 0), this._cylinderPosition);\r\n this._origin.addToRef(new Vector3(0, this._options.height, 0), this._originTop);\r\n\r\n this._tickCallback = () => this._tick();\r\n\r\n if (this._physicsEngine.getPluginVersion() === 1) {\r\n this._prepareCylinder();\r\n }\r\n }\r\n\r\n /**\r\n * Returns the data related to the vortex event (cylinder).\r\n * @returns The physics vortex event data\r\n */\r\n public getData(): PhysicsVortexEventData {\r\n this._dataFetched = true;\r\n\r\n return {\r\n cylinder: this._cylinder,\r\n };\r\n }\r\n\r\n /**\r\n * Enables the vortex.\r\n */\r\n public enable() {\r\n this._tickCallback.call(this);\r\n this._scene.registerBeforeRender(this._tickCallback);\r\n }\r\n\r\n /**\r\n * Disables the cortex.\r\n */\r\n public disable() {\r\n this._scene.unregisterBeforeRender(this._tickCallback);\r\n }\r\n\r\n /**\r\n * Disposes the sphere.\r\n * @param force\r\n */\r\n public dispose(force: boolean = true) {\r\n if (!this._cylinder) {\r\n return;\r\n }\r\n if (force) {\r\n this._cylinder.dispose();\r\n } else {\r\n setTimeout(() => {\r\n if (!this._dataFetched) {\r\n this._cylinder.dispose();\r\n }\r\n }, 0);\r\n }\r\n }\r\n\r\n private _getHitData(mesh: AbstractMesh, center: Vector3, data: PhysicsHitData): boolean {\r\n const originOnPlane = PhysicsVortexEvent._OriginOnPlane;\r\n originOnPlane.set(this._origin.x, center.y, this._origin.z); // the distance to the origin as if both objects were on a plane (Y-axis)\r\n const originToImpostorDirection = TmpVectors.Vector3[0];\r\n center.subtractToRef(originOnPlane, originToImpostorDirection);\r\n\r\n const contactPoint = TmpVectors.Vector3[1];\r\n const hasContactPoint = HelperTools.GetContactPointToRef(mesh, originOnPlane, originToImpostorDirection, contactPoint, data.instanceIndex);\r\n if (!hasContactPoint) {\r\n return false;\r\n }\r\n const distance = Vector3.Distance(contactPoint, originOnPlane);\r\n const absoluteDistanceFromOrigin = distance / this._options.radius;\r\n\r\n const directionToOrigin = TmpVectors.Vector3[2];\r\n contactPoint.normalizeToRef(directionToOrigin);\r\n if (absoluteDistanceFromOrigin > this._options.centripetalForceThreshold) {\r\n directionToOrigin.negateInPlace();\r\n }\r\n\r\n let forceX: number;\r\n let forceY: number;\r\n let forceZ: number;\r\n\r\n if (absoluteDistanceFromOrigin > this._options.centripetalForceThreshold) {\r\n forceX = directionToOrigin.x * this._options.centripetalForceMultiplier;\r\n forceY = directionToOrigin.y * this._options.updraftForceMultiplier;\r\n forceZ = directionToOrigin.z * this._options.centripetalForceMultiplier;\r\n } else {\r\n const perpendicularDirection = Vector3.Cross(originOnPlane, center).normalize();\r\n\r\n forceX = (perpendicularDirection.x + directionToOrigin.x) * this._options.centrifugalForceMultiplier;\r\n forceY = this._originTop.y * this._options.updraftForceMultiplier;\r\n forceZ = (perpendicularDirection.z + directionToOrigin.z) * this._options.centrifugalForceMultiplier;\r\n }\r\n\r\n const force = TmpVectors.Vector3[3];\r\n force.set(forceX, forceY, forceZ);\r\n force.scaleInPlace(this._options.strength);\r\n\r\n data.force.copyFrom(force);\r\n data.contactPoint.copyFrom(center);\r\n data.distanceFromOrigin = absoluteDistanceFromOrigin;\r\n return true;\r\n }\r\n\r\n private _getBodyHitData(body: PhysicsBody, data: PhysicsHitData, instanceIndex?: number): boolean {\r\n if (HelperTools.HasAppliedForces(body, instanceIndex)) {\r\n return false;\r\n }\r\n\r\n const bodyObject = body.transformNode as AbstractMesh;\r\n const bodyCenter = body.getObjectCenterWorld(instanceIndex);\r\n\r\n if (!HelperTools.IsInsideCylinder(bodyCenter, this._origin, this._options.radius, this._options.height)) {\r\n return false;\r\n }\r\n\r\n data.instanceIndex = instanceIndex;\r\n return this._getHitData(bodyObject, bodyCenter, data);\r\n }\r\n\r\n private _getImpostorHitData(impostor: PhysicsImpostor, data: PhysicsHitData): boolean {\r\n if (impostor.mass === 0) {\r\n return false;\r\n }\r\n\r\n if (impostor.object.getClassName() !== \"Mesh\" && impostor.object.getClassName() !== \"InstancedMesh\") {\r\n return false;\r\n }\r\n\r\n const impostorObject = impostor.object as AbstractMesh;\r\n if (!this._intersectsWithCylinder(impostorObject)) {\r\n return false;\r\n }\r\n\r\n const impostorObjectCenter = impostor.getObjectCenter();\r\n this._getHitData(impostorObject, impostorObjectCenter, data);\r\n return true;\r\n }\r\n\r\n private _tick() {\r\n const hitData = PhysicsVortexEvent._HitData;\r\n if (this._physicsEngine.getPluginVersion() === 1) {\r\n (<PhysicsEngineV1>this._physicsEngine).getImpostors().forEach((impostor: PhysicsImpostor) => {\r\n if (!this._getImpostorHitData(impostor, hitData)) {\r\n return;\r\n }\r\n\r\n impostor.applyForce(hitData.force, hitData.contactPoint);\r\n });\r\n } else {\r\n (<PhysicsEngineV2>this._physicsEngine).getBodies().forEach((body: PhysicsBody) => {\r\n body.iterateOverAllInstances((body: PhysicsBody, instanceIndex?: number) => {\r\n if (!this._getBodyHitData(body, hitData, instanceIndex)) {\r\n return;\r\n }\r\n\r\n body.applyForce(hitData.force, hitData.contactPoint, hitData.instanceIndex);\r\n });\r\n });\r\n }\r\n }\r\n\r\n /*** Helpers ***/\r\n\r\n private _prepareCylinder(): void {\r\n if (!this._cylinder) {\r\n this._cylinder = CreateCylinder(\r\n \"vortexEventCylinder\",\r\n {\r\n height: this._options.height,\r\n diameter: this._options.radius * 2,\r\n },\r\n this._scene\r\n );\r\n this._cylinder.isVisible = false;\r\n }\r\n }\r\n\r\n private _intersectsWithCylinder(mesh: AbstractMesh): boolean {\r\n this._cylinder.position = this._cylinderPosition;\r\n\r\n return this._cylinder.intersectsMesh(mesh, true);\r\n }\r\n}\r\n\r\n/**\r\n * Options fot the radial explosion event\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class\r\n */\r\nexport class PhysicsRadialExplosionEventOptions {\r\n /**\r\n * The radius of the sphere for the radial explosion.\r\n */\r\n radius: number = 5;\r\n\r\n /**\r\n * The strength of the explosion.\r\n */\r\n strength: number = 10;\r\n\r\n /**\r\n * The strength of the force in correspondence to the distance of the affected object\r\n */\r\n falloff: PhysicsRadialImpulseFalloff = PhysicsRadialImpulseFalloff.Constant;\r\n\r\n /**\r\n * Sphere options for the radial explosion.\r\n */\r\n sphere: { segments: number; diameter: number } = { segments: 32, diameter: 1 };\r\n\r\n /**\r\n * Sphere options for the radial explosion.\r\n */\r\n affectedImpostorsCallback: (affectedImpostorsWithData: Array<PhysicsAffectedImpostorWithData>) => void;\r\n\r\n /**\r\n * Sphere options for the radial explosion.\r\n */\r\n affectedBodiesCallback: (affectedBodiesWithData: Array<PhysicsAffectedBodyWithData>) => void;\r\n}\r\n\r\n/**\r\n * Options fot the updraft event\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class\r\n */\r\nexport class PhysicsUpdraftEventOptions {\r\n /**\r\n * The radius of the cylinder for the vortex\r\n */\r\n radius: number = 5;\r\n\r\n /**\r\n * The strength of the updraft.\r\n */\r\n strength: number = 10;\r\n\r\n /**\r\n * The height of the cylinder for the updraft.\r\n */\r\n height: number = 10;\r\n\r\n /**\r\n * The mode for the updraft.\r\n */\r\n updraftMode: PhysicsUpdraftMode = PhysicsUpdraftMode.Center;\r\n}\r\n\r\n/**\r\n * Options fot the vortex event\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class\r\n */\r\nexport class PhysicsVortexEventOptions {\r\n /**\r\n * The radius of the cylinder for the vortex\r\n */\r\n radius: number = 5;\r\n\r\n /**\r\n * The strength of the vortex.\r\n */\r\n strength: number = 10;\r\n\r\n /**\r\n * The height of the cylinder for the vortex.\r\n */\r\n height: number = 10;\r\n\r\n /**\r\n * At which distance, relative to the radius the centripetal forces should kick in? Range: 0-1\r\n */\r\n centripetalForceThreshold: number = 0.7;\r\n\r\n /**\r\n * This multiplier determines with how much force the objects will be pushed sideways/around the vortex, when below the threshold.\r\n */\r\n centripetalForceMultiplier: number = 5;\r\n\r\n /**\r\n * This multiplier determines with how much force the objects will be pushed sideways/around the vortex, when above the threshold.\r\n */\r\n centrifugalForceMultiplier: number = 0.5;\r\n\r\n /**\r\n * This multiplier determines with how much force the objects will be pushed upwards, when in the vortex.\r\n */\r\n updraftForceMultiplier: number = 0.02;\r\n}\r\n\r\n/**\r\n * The strength of the force in correspondence to the distance of the affected object\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class\r\n */\r\nexport enum PhysicsRadialImpulseFalloff {\r\n /** Defines that impulse is constant in strength across it's whole radius */\r\n Constant,\r\n /** Defines that impulse gets weaker if it's further from the origin */\r\n Linear,\r\n}\r\n\r\n/**\r\n * The strength of the force in correspondence to the distance of the affected object\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class\r\n */\r\nexport enum PhysicsUpdraftMode {\r\n /** Defines that the upstream forces will pull towards the top center of the cylinder */\r\n Center,\r\n /** Defines that once a impostor is inside the cylinder, it will shoot out perpendicular from the ground of the cylinder */\r\n Perpendicular,\r\n}\r\n\r\n/**\r\n * Interface for a physics hit data\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class\r\n */\r\nexport interface PhysicsHitData {\r\n /**\r\n * The force applied at the contact point\r\n */\r\n force: Vector3;\r\n /**\r\n * The contact point\r\n */\r\n contactPoint: Vector3;\r\n /**\r\n * The distance from the origin to the contact point\r\n */\r\n distanceFromOrigin: number;\r\n /**\r\n * For an instanced physics body (mesh with thin instances), the index of the thin instance the hit applies to\r\n */\r\n instanceIndex?: number;\r\n}\r\n\r\n/**\r\n * Interface for radial explosion event data\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class\r\n */\r\nexport interface PhysicsRadialExplosionEventData {\r\n /**\r\n * A sphere used for the radial explosion event\r\n */\r\n sphere: Mesh;\r\n}\r\n\r\n/**\r\n * Interface for gravitational field event data\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class\r\n */\r\nexport interface PhysicsGravitationalFieldEventData {\r\n /**\r\n * A sphere mesh used for the gravitational field event\r\n */\r\n sphere: Mesh;\r\n}\r\n\r\n/**\r\n * Interface for updraft event data\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class\r\n */\r\nexport interface PhysicsUpdraftEventData {\r\n /**\r\n * A cylinder used for the updraft event\r\n */\r\n cylinder?: Mesh;\r\n}\r\n\r\n/**\r\n * Interface for vortex event data\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class\r\n */\r\nexport interface PhysicsVortexEventData {\r\n /**\r\n * A cylinder used for the vortex event\r\n */\r\n cylinder: Mesh;\r\n}\r\n\r\n/**\r\n * Interface for an affected physics impostor\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class\r\n */\r\nexport interface PhysicsAffectedImpostorWithData {\r\n /**\r\n * The impostor affected by the effect\r\n */\r\n impostor: PhysicsImpostor;\r\n\r\n /**\r\n * The data about the hit/force from the explosion\r\n */\r\n hitData: PhysicsHitData;\r\n}\r\n\r\n/**\r\n * Interface for an affected physics body\r\n * @see\r\n */\r\nexport interface PhysicsAffectedBodyWithData {\r\n /**\r\n * The impostor affected by the effect\r\n */\r\n body: PhysicsBody;\r\n\r\n /**\r\n * The data about the hit/force from the explosion\r\n */\r\n hitData: PhysicsHitData;\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"physicsHelper.js","sourceRoot":"","sources":["../../../../dev/core/src/Physics/physicsHelper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAG3D,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAOr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H,WAAM,GAAW,EAAE,CAAC;QAEpB;;WAEG;QACH,gBAAW,GAAuB,kBAAkB,CAAC,MAAM,CAAC;IAChE,CAAC;CAAA;AAED;;;GAGG;AACH,MAAM,OAAO,yBAAyB;IAAtC;QACI;;WAEG;QACH,WAAM,GAAW,CAAC,CAAC;QAEnB;;WAEG;QACH,aAAQ,GAAW,EAAE,CAAC;QAEtB;;WAEG;QACH,WAAM,GAAW,EAAE,CAAC;QAEpB;;WAEG;QACH,8BAAyB,GAAW,GAAG,CAAC;QAExC;;WAEG;QACH,+BAA0B,GAAW,CAAC,CAAC;QAEvC;;WAEG;QACH,+BAA0B,GAAW,GAAG,CAAC;QAEzC;;WAEG;QACH,2BAAsB,GAAW,IAAI,CAAC;IAC1C,CAAC;CAAA;AAED;;;GAGG;AACH,MAAM,CAAN,IAAY,2BAKX;AALD,WAAY,2BAA2B;IACnC,4EAA4E;IAC5E,qFAAQ,CAAA;IACR,uEAAuE;IACvE,iFAAM,CAAA;AACV,CAAC,EALW,2BAA2B,KAA3B,2BAA2B,QAKtC;AAED;;;GAGG;AACH,MAAM,CAAN,IAAY,kBAKX;AALD,WAAY,kBAAkB;IAC1B,wFAAwF;IACxF,+DAAM,CAAA;IACN,2HAA2H;IAC3H,6EAAa,CAAA;AACjB,CAAC,EALW,kBAAkB,KAAlB,kBAAkB,QAK7B","sourcesContent":["import type { Nullable } from \"../types\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport { TmpVectors, Vector3 } from \"../Maths/math.vector\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport type { Mesh } from \"../Meshes/mesh\";\r\nimport { CreateSphere } from \"../Meshes/Builders/sphereBuilder\";\r\nimport { CreateCylinder } from \"../Meshes/Builders/cylinderBuilder\";\r\nimport { Ray } from \"../Culling/ray\";\r\nimport type { Scene } from \"../scene\";\r\nimport type { PhysicsEngine as PhysicsEngineV1 } from \"./physicsEngine\";\r\nimport type { PhysicsEngine as PhysicsEngineV2 } from \"./v2/physicsEngine\";\r\nimport type { IPhysicsEngine } from \"./IPhysicsEngine\";\r\nimport type { PhysicsImpostor } from \"./v1/physicsImpostor\";\r\nimport type { PhysicsBody } from \"./v2/physicsBody\";\r\nimport { PhysicsMotionType } from \"./v2/IPhysicsEnginePlugin\";\r\n\r\nclass HelperTools {\r\n /*\r\n * Gets the hit contact point between a mesh and a ray. The method varies between\r\n * the different plugin versions; V1 uses a mesh intersection, V2 uses the physics body instance/object center (to avoid a raycast and improve perf).\r\n */\r\n static GetContactPointToRef(mesh: AbstractMesh, origin: Vector3, direction: Vector3, result: Vector3, instanceIndex?: number): boolean {\r\n const engine = mesh.getScene().getPhysicsEngine();\r\n const pluginVersion = engine?.getPluginVersion();\r\n if (pluginVersion === 1) {\r\n const ray = new Ray(origin, direction);\r\n const hit = ray.intersectsMesh(mesh);\r\n if (hit.hit && hit.pickedPoint) {\r\n result.copyFrom(hit.pickedPoint);\r\n return true;\r\n }\r\n } else if (pluginVersion === 2) {\r\n mesh.physicsBody!.getObjectCenterWorldToRef(result, instanceIndex);\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n /**\r\n * Checks if a body will be affected by forces\r\n * @param body the body to check\r\n * @param instanceIndex for instanced bodies, the index of the instance to check\r\n * @returns\r\n */\r\n static HasAppliedForces(body: PhysicsBody, instanceIndex?: number) {\r\n return (\r\n body.getMotionType(instanceIndex) === PhysicsMotionType.STATIC ||\r\n (body.getMassProperties(instanceIndex)?.mass ?? 0) === 0 ||\r\n (body.transformNode as Mesh)?.getTotalVertices() === 0\r\n );\r\n }\r\n\r\n /**\r\n * Checks if a point is inside a cylinder\r\n * @param point point to check\r\n * @param origin cylinder origin on the bottom\r\n * @param radius cylinder radius\r\n * @param height cylinder height\r\n * @returns\r\n */\r\n static IsInsideCylinder(point: Vector3, origin: Vector3, radius: number, height: number): boolean {\r\n const distance = TmpVectors.Vector3[0];\r\n point.subtractToRef(origin, distance);\r\n return Math.abs(distance.x) <= radius && Math.abs(distance.z) <= radius && distance.y >= 0 && distance.y <= height;\r\n }\r\n}\r\n\r\n/**\r\n * A helper for physics simulations\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class\r\n */\r\nexport class PhysicsHelper {\r\n private _scene: Scene;\r\n private _physicsEngine: Nullable<IPhysicsEngine>;\r\n private _hitData: PhysicsHitData = { force: new Vector3(), contactPoint: new Vector3(), distanceFromOrigin: 0 };\r\n\r\n /**\r\n * Initializes the Physics helper\r\n * @param scene Babylon.js scene\r\n */\r\n constructor(scene: Scene) {\r\n this._scene = scene;\r\n this._physicsEngine = this._scene.getPhysicsEngine();\r\n\r\n if (!this._physicsEngine) {\r\n Logger.Warn(\"Physics engine not enabled. Please enable the physics before you can use the methods.\");\r\n return;\r\n }\r\n }\r\n\r\n /**\r\n * Applies a radial explosion impulse\r\n * @param origin the origin of the explosion\r\n * @param radiusOrEventOptions the radius or the options of radial explosion\r\n * @param strength the explosion strength\r\n * @param falloff possible options: Constant & Linear. Defaults to Constant\r\n * @returns A physics radial explosion event, or null\r\n */\r\n public applyRadialExplosionImpulse(\r\n origin: Vector3,\r\n radiusOrEventOptions: number | PhysicsRadialExplosionEventOptions,\r\n strength?: number,\r\n falloff?: PhysicsRadialImpulseFalloff\r\n ): Nullable<PhysicsRadialExplosionEvent> {\r\n if (!this._physicsEngine) {\r\n Logger.Warn(\"Physics engine not enabled. Please enable the physics before you call this method.\");\r\n return null;\r\n }\r\n\r\n if (this._physicsEngine.getPluginVersion() === 1 && (<PhysicsEngineV1>this._physicsEngine).getImpostors().length === 0) {\r\n return null;\r\n }\r\n\r\n if (this._physicsEngine.getPluginVersion() === 2 && (<PhysicsEngineV2>this._physicsEngine).getBodies().length === 0) {\r\n return null;\r\n }\r\n\r\n let useCallback = false;\r\n if (typeof radiusOrEventOptions === \"number\") {\r\n const r = radiusOrEventOptions;\r\n radiusOrEventOptions = new PhysicsRadialExplosionEventOptions();\r\n radiusOrEventOptions.radius = r;\r\n radiusOrEventOptions.strength = strength ?? radiusOrEventOptions.strength;\r\n radiusOrEventOptions.falloff = falloff ?? radiusOrEventOptions.falloff;\r\n } else {\r\n useCallback = !!(radiusOrEventOptions.affectedImpostorsCallback || radiusOrEventOptions.affectedBodiesCallback);\r\n }\r\n\r\n const event = new PhysicsRadialExplosionEvent(this._scene, radiusOrEventOptions);\r\n\r\n const hitData = this._hitData;\r\n if (this._physicsEngine.getPluginVersion() === 1) {\r\n const affectedImpostorsWithData = Array<PhysicsAffectedImpostorWithData>();\r\n const impostors = (<PhysicsEngineV1>this._physicsEngine).getImpostors();\r\n impostors.forEach((impostor: PhysicsImpostor) => {\r\n if (!event.getImpostorHitData(impostor, origin, hitData)) {\r\n return;\r\n }\r\n\r\n impostor.applyImpulse(hitData.force, hitData.contactPoint);\r\n\r\n if (useCallback) {\r\n affectedImpostorsWithData.push({\r\n impostor: impostor,\r\n hitData: this._copyPhysicsHitData(hitData),\r\n });\r\n }\r\n });\r\n\r\n event.triggerAffectedImpostorsCallback(affectedImpostorsWithData);\r\n } else {\r\n this._applicationForBodies(event, origin, hitData, useCallback, (body: PhysicsBody, hitData: PhysicsHitData) => {\r\n body.applyImpulse(hitData.force, hitData.contactPoint, hitData.instanceIndex);\r\n });\r\n }\r\n\r\n event.dispose(false);\r\n\r\n return event;\r\n }\r\n\r\n /**\r\n * Applies a radial explosion force\r\n * @param origin the origin of the explosion\r\n * @param radiusOrEventOptions the radius or the options of radial explosion\r\n * @param strength the explosion strength\r\n * @param falloff possible options: Constant & Linear. Defaults to Constant\r\n * @returns A physics radial explosion event, or null\r\n */\r\n public applyRadialExplosionForce(\r\n origin: Vector3,\r\n radiusOrEventOptions: number | PhysicsRadialExplosionEventOptions,\r\n strength?: number,\r\n falloff?: PhysicsRadialImpulseFalloff\r\n ): Nullable<PhysicsRadialExplosionEvent> {\r\n if (!this._physicsEngine) {\r\n Logger.Warn(\"Physics engine not enabled. Please enable the physics before you call the PhysicsHelper.\");\r\n return null;\r\n }\r\n\r\n if (this._physicsEngine.getPluginVersion() === 1 && (<PhysicsEngineV1>this._physicsEngine).getImpostors().length === 0) {\r\n return null;\r\n }\r\n\r\n if (this._physicsEngine.getPluginVersion() === 2 && (<PhysicsEngineV2>this._physicsEngine).getBodies().length === 0) {\r\n return null;\r\n }\r\n\r\n let useCallback = false;\r\n if (typeof radiusOrEventOptions === \"number\") {\r\n const r = radiusOrEventOptions;\r\n radiusOrEventOptions = new PhysicsRadialExplosionEventOptions();\r\n radiusOrEventOptions.radius = r;\r\n radiusOrEventOptions.strength = strength ?? radiusOrEventOptions.strength;\r\n radiusOrEventOptions.falloff = falloff ?? radiusOrEventOptions.falloff;\r\n } else {\r\n useCallback = !!(radiusOrEventOptions.affectedImpostorsCallback || radiusOrEventOptions.affectedBodiesCallback);\r\n }\r\n\r\n const event = new PhysicsRadialExplosionEvent(this._scene, radiusOrEventOptions);\r\n\r\n const hitData = this._hitData;\r\n if (this._physicsEngine.getPluginVersion() === 1) {\r\n const affectedImpostorsWithData = Array<PhysicsAffectedImpostorWithData>();\r\n const impostors = (<PhysicsEngineV1>this._physicsEngine).getImpostors();\r\n impostors.forEach((impostor: PhysicsImpostor) => {\r\n if (!event.getImpostorHitData(impostor, origin, hitData)) {\r\n return;\r\n }\r\n\r\n impostor.applyForce(hitData.force, hitData.contactPoint);\r\n\r\n if (useCallback) {\r\n affectedImpostorsWithData.push({\r\n impostor: impostor,\r\n hitData: this._copyPhysicsHitData(hitData),\r\n });\r\n }\r\n });\r\n\r\n event.triggerAffectedImpostorsCallback(affectedImpostorsWithData);\r\n } else {\r\n this._applicationForBodies(event, origin, hitData, useCallback, (body: PhysicsBody, hitData: PhysicsHitData) => {\r\n body.applyForce(hitData.force, hitData.contactPoint, hitData.instanceIndex);\r\n });\r\n }\r\n\r\n event.dispose(false);\r\n\r\n return event;\r\n }\r\n\r\n private _applicationForBodies(\r\n event: PhysicsRadialExplosionEvent,\r\n origin: Vector3,\r\n hitData: PhysicsHitData,\r\n useCallback: boolean,\r\n fnApplication: (body: PhysicsBody, hitData: PhysicsHitData, instanceIndex?: number) => void\r\n ) {\r\n const affectedBodiesWithData = Array<PhysicsAffectedBodyWithData>();\r\n const bodies = (<PhysicsEngineV2>this._physicsEngine).getBodies();\r\n for (const body of bodies) {\r\n body.iterateOverAllInstances((body, instanceIndex) => {\r\n if (!event.getBodyHitData(body, origin, hitData, instanceIndex)) {\r\n return;\r\n }\r\n fnApplication(body, hitData);\r\n\r\n if (useCallback) {\r\n affectedBodiesWithData.push({\r\n body: body,\r\n hitData: this._copyPhysicsHitData(hitData),\r\n });\r\n }\r\n });\r\n }\r\n\r\n event.triggerAffectedBodiesCallback(affectedBodiesWithData);\r\n }\r\n\r\n /**\r\n * Creates a gravitational field\r\n * @param origin the origin of the gravitational field\r\n * @param radiusOrEventOptions the radius or the options of radial gravitational field\r\n * @param strength the gravitational field strength\r\n * @param falloff possible options: Constant & Linear. Defaults to Constant\r\n * @returns A physics gravitational field event, or null\r\n */\r\n public gravitationalField(\r\n origin: Vector3,\r\n radiusOrEventOptions: number | PhysicsRadialExplosionEventOptions,\r\n strength?: number,\r\n falloff?: PhysicsRadialImpulseFalloff\r\n ): Nullable<PhysicsGravitationalFieldEvent> {\r\n if (!this._physicsEngine) {\r\n Logger.Warn(\"Physics engine not enabled. Please enable the physics before you call the PhysicsHelper.\");\r\n return null;\r\n }\r\n\r\n if (this._physicsEngine.getPluginVersion() === 1 && (<PhysicsEngineV1>this._physicsEngine).getImpostors().length === 0) {\r\n return null;\r\n }\r\n\r\n if (this._physicsEngine.getPluginVersion() === 2 && (<PhysicsEngineV2>this._physicsEngine).getBodies().length === 0) {\r\n return null;\r\n }\r\n\r\n if (typeof radiusOrEventOptions === \"number\") {\r\n const r = radiusOrEventOptions;\r\n radiusOrEventOptions = new PhysicsRadialExplosionEventOptions();\r\n radiusOrEventOptions.radius = r;\r\n radiusOrEventOptions.strength = strength ?? radiusOrEventOptions.strength;\r\n radiusOrEventOptions.falloff = falloff ?? radiusOrEventOptions.falloff;\r\n }\r\n\r\n const event = new PhysicsGravitationalFieldEvent(this, this._scene, origin, radiusOrEventOptions);\r\n\r\n event.dispose(false);\r\n\r\n return event;\r\n }\r\n\r\n /**\r\n * Creates a physics updraft event\r\n * @param origin the origin of the updraft\r\n * @param radiusOrEventOptions the radius or the options of the updraft\r\n * @param strength the strength of the updraft\r\n * @param height the height of the updraft\r\n * @param updraftMode possible options: Center & Perpendicular. Defaults to Center\r\n * @returns A physics updraft event, or null\r\n */\r\n public updraft(\r\n origin: Vector3,\r\n radiusOrEventOptions: number | PhysicsUpdraftEventOptions,\r\n strength?: number,\r\n height?: number,\r\n updraftMode?: PhysicsUpdraftMode\r\n ): Nullable<PhysicsUpdraftEvent> {\r\n if (!this._physicsEngine) {\r\n Logger.Warn(\"Physics engine not enabled. Please enable the physics before you call the PhysicsHelper.\");\r\n return null;\r\n }\r\n\r\n if (this._physicsEngine.getPluginVersion() === 1 && (<PhysicsEngineV1>this._physicsEngine).getImpostors().length === 0) {\r\n return null;\r\n }\r\n\r\n if (this._physicsEngine.getPluginVersion() === 2 && (<PhysicsEngineV2>this._physicsEngine).getBodies().length === 0) {\r\n return null;\r\n }\r\n\r\n if (typeof radiusOrEventOptions === \"number\") {\r\n const r = radiusOrEventOptions;\r\n radiusOrEventOptions = new PhysicsUpdraftEventOptions();\r\n radiusOrEventOptions.radius = r;\r\n radiusOrEventOptions.strength = strength ?? radiusOrEventOptions.strength;\r\n radiusOrEventOptions.height = height ?? radiusOrEventOptions.height;\r\n radiusOrEventOptions.updraftMode = updraftMode ?? radiusOrEventOptions.updraftMode;\r\n }\r\n\r\n const event = new PhysicsUpdraftEvent(this._scene, origin, radiusOrEventOptions);\r\n\r\n event.dispose(false);\r\n\r\n return event;\r\n }\r\n\r\n /**\r\n * Creates a physics vortex event\r\n * @param origin the of the vortex\r\n * @param radiusOrEventOptions the radius or the options of the vortex\r\n * @param strength the strength of the vortex\r\n * @param height the height of the vortex\r\n * @returns a Physics vortex event, or null\r\n * A physics vortex event or null\r\n */\r\n public vortex(origin: Vector3, radiusOrEventOptions: number | PhysicsVortexEventOptions, strength?: number, height?: number): Nullable<PhysicsVortexEvent> {\r\n if (!this._physicsEngine) {\r\n Logger.Warn(\"Physics engine not enabled. Please enable the physics before you call the PhysicsHelper.\");\r\n return null;\r\n }\r\n\r\n if (this._physicsEngine.getPluginVersion() === 1 && (<PhysicsEngineV1>this._physicsEngine).getImpostors().length === 0) {\r\n return null;\r\n }\r\n\r\n if (this._physicsEngine.getPluginVersion() === 2 && (<PhysicsEngineV2>this._physicsEngine).getBodies().length === 0) {\r\n return null;\r\n }\r\n\r\n if (typeof radiusOrEventOptions === \"number\") {\r\n const r = radiusOrEventOptions;\r\n radiusOrEventOptions = new PhysicsVortexEventOptions();\r\n radiusOrEventOptions.radius = r;\r\n radiusOrEventOptions.strength = strength ?? radiusOrEventOptions.strength;\r\n radiusOrEventOptions.height = height ?? radiusOrEventOptions.height;\r\n }\r\n\r\n const event = new PhysicsVortexEvent(this._scene, origin, radiusOrEventOptions);\r\n\r\n event.dispose(false);\r\n\r\n return event;\r\n }\r\n\r\n private _copyPhysicsHitData(data: PhysicsHitData): PhysicsHitData {\r\n return { force: data.force.clone(), contactPoint: data.contactPoint.clone(), distanceFromOrigin: data.distanceFromOrigin, instanceIndex: data.instanceIndex };\r\n }\r\n}\r\n\r\n/**\r\n * Represents a physics radial explosion event\r\n */\r\nclass PhysicsRadialExplosionEvent {\r\n private _sphere: Mesh; // create a sphere, so we can get the intersecting meshes inside\r\n private _dataFetched: boolean = false; // check if the data has been fetched. If not, do cleanup\r\n\r\n /**\r\n * Initializes a radial explosion event\r\n * @param _scene BabylonJS scene\r\n * @param _options The options for the vortex event\r\n */\r\n constructor(\r\n private _scene: Scene,\r\n private _options: PhysicsRadialExplosionEventOptions\r\n ) {\r\n this._options = { ...new PhysicsRadialExplosionEventOptions(), ...this._options };\r\n }\r\n\r\n /**\r\n * Returns the data related to the radial explosion event (sphere).\r\n * @returns The radial explosion event data\r\n */\r\n public getData(): PhysicsRadialExplosionEventData {\r\n this._dataFetched = true;\r\n\r\n return {\r\n sphere: this._sphere,\r\n };\r\n }\r\n\r\n private _getHitData(mesh: AbstractMesh, center: Vector3, origin: Vector3, data: PhysicsHitData): boolean {\r\n const direction = TmpVectors.Vector3[0];\r\n direction.copyFrom(center).subtractInPlace(origin);\r\n\r\n const contactPoint = TmpVectors.Vector3[1];\r\n const hasContactPoint = HelperTools.GetContactPointToRef(mesh, origin, direction, contactPoint, data.instanceIndex);\r\n\r\n if (!hasContactPoint) {\r\n return false;\r\n }\r\n\r\n const distanceFromOrigin = Vector3.Distance(origin, contactPoint);\r\n if (distanceFromOrigin > this._options.radius) {\r\n return false;\r\n }\r\n\r\n const multiplier =\r\n this._options.falloff === PhysicsRadialImpulseFalloff.Constant ? this._options.strength : this._options.strength * (1 - distanceFromOrigin / this._options.radius);\r\n\r\n // Direction x multiplier equals force\r\n direction.scaleInPlace(multiplier);\r\n\r\n data.force.copyFrom(direction);\r\n data.contactPoint.copyFrom(contactPoint);\r\n data.distanceFromOrigin = distanceFromOrigin;\r\n return true;\r\n }\r\n\r\n /**\r\n * Returns the force and contact point of the body or false, if the body is not affected by the force/impulse.\r\n * @param body A physics body where the transform node is an AbstractMesh\r\n * @param origin the origin of the explosion\r\n * @param data the data of the hit\r\n * @param instanceIndex the instance index of the body\r\n * @returns if there was a hit\r\n */\r\n public getBodyHitData(body: PhysicsBody, origin: Vector3, data: PhysicsHitData, instanceIndex?: number): boolean {\r\n // No force will be applied in these cases, so we skip calculation\r\n if (HelperTools.HasAppliedForces(body, instanceIndex)) {\r\n return false;\r\n }\r\n\r\n const mesh = body.transformNode as AbstractMesh;\r\n const bodyObjectCenter = body.getObjectCenterWorld(instanceIndex);\r\n data.instanceIndex = instanceIndex;\r\n return this._getHitData(mesh, bodyObjectCenter, origin, data);\r\n }\r\n /**\r\n * Returns the force and contact point of the impostor or false, if the impostor is not affected by the force/impulse.\r\n * @param impostor A physics imposter\r\n * @param origin the origin of the explosion\r\n * @param data the data of the hit\r\n * @returns A physics force and contact point, or null\r\n */\r\n public getImpostorHitData(impostor: PhysicsImpostor, origin: Vector3, data: PhysicsHitData): boolean {\r\n if (impostor.mass === 0) {\r\n return false;\r\n }\r\n\r\n if (impostor.object.getClassName() !== \"Mesh\" && impostor.object.getClassName() !== \"InstancedMesh\") {\r\n return false;\r\n }\r\n\r\n const mesh = impostor.object as AbstractMesh;\r\n if (!this._intersectsWithSphere(mesh, origin, this._options.radius)) {\r\n return false;\r\n }\r\n\r\n const impostorObjectCenter = impostor.getObjectCenter();\r\n\r\n this._getHitData(mesh, impostorObjectCenter, origin, data);\r\n return true;\r\n }\r\n\r\n /**\r\n * Triggers affected impostors callbacks\r\n * @param affectedImpostorsWithData defines the list of affected impostors (including associated data)\r\n */\r\n public triggerAffectedImpostorsCallback(affectedImpostorsWithData: Array<PhysicsAffectedImpostorWithData>) {\r\n if (this._options.affectedImpostorsCallback) {\r\n this._options.affectedImpostorsCallback(affectedImpostorsWithData);\r\n }\r\n }\r\n\r\n /**\r\n * Triggers affected bodies callbacks\r\n * @param affectedBodiesWithData defines the list of affected bodies (including associated data)\r\n */\r\n public triggerAffectedBodiesCallback(affectedBodiesWithData: Array<PhysicsAffectedBodyWithData>) {\r\n if (this._options.affectedBodiesCallback) {\r\n this._options.affectedBodiesCallback(affectedBodiesWithData);\r\n }\r\n }\r\n /**\r\n * Disposes the sphere.\r\n * @param force Specifies if the sphere should be disposed by force\r\n */\r\n public dispose(force: boolean = true) {\r\n if (this._sphere) {\r\n if (force) {\r\n this._sphere.dispose();\r\n } else {\r\n setTimeout(() => {\r\n if (!this._dataFetched) {\r\n this._sphere.dispose();\r\n }\r\n }, 0);\r\n }\r\n }\r\n }\r\n\r\n /*** Helpers ***/\r\n\r\n private _prepareSphere(): void {\r\n if (!this._sphere) {\r\n this._sphere = CreateSphere(\"radialExplosionEventSphere\", this._options.sphere, this._scene);\r\n this._sphere.isVisible = false;\r\n }\r\n }\r\n\r\n private _intersectsWithSphere(mesh: AbstractMesh, origin: Vector3, radius: number): boolean {\r\n this._prepareSphere();\r\n\r\n this._sphere.position = origin;\r\n this._sphere.scaling.setAll(radius * 2);\r\n this._sphere._updateBoundingInfo();\r\n this._sphere.computeWorldMatrix(true);\r\n\r\n return this._sphere.intersectsMesh(mesh, true);\r\n }\r\n}\r\n\r\n/**\r\n * Represents a gravitational field event\r\n */\r\nclass PhysicsGravitationalFieldEvent {\r\n private _tickCallback: any;\r\n private _sphere: Mesh;\r\n private _dataFetched: boolean = false; // check if the has been fetched the data. If not, do cleanup\r\n\r\n /**\r\n * Initializes the physics gravitational field event\r\n * @param _physicsHelper A physics helper\r\n * @param _scene BabylonJS scene\r\n * @param _origin The origin position of the gravitational field event\r\n * @param _options The options for the vortex event\r\n */\r\n constructor(\r\n private _physicsHelper: PhysicsHelper,\r\n private _scene: Scene,\r\n private _origin: Vector3,\r\n private _options: PhysicsRadialExplosionEventOptions\r\n ) {\r\n this._options = { ...new PhysicsRadialExplosionEventOptions(), ...this._options };\r\n\r\n this._tickCallback = () => this._tick();\r\n\r\n this._options.strength = this._options.strength * -1;\r\n }\r\n\r\n /**\r\n * Returns the data related to the gravitational field event (sphere).\r\n * @returns A gravitational field event\r\n */\r\n public getData(): PhysicsGravitationalFieldEventData {\r\n this._dataFetched = true;\r\n\r\n return {\r\n sphere: this._sphere,\r\n };\r\n }\r\n\r\n /**\r\n * Enables the gravitational field.\r\n */\r\n public enable() {\r\n this._tickCallback.call(this);\r\n this._scene.registerBeforeRender(this._tickCallback);\r\n }\r\n\r\n /**\r\n * Disables the gravitational field.\r\n */\r\n public disable() {\r\n this._scene.unregisterBeforeRender(this._tickCallback);\r\n }\r\n\r\n /**\r\n * Disposes the sphere.\r\n * @param force The force to dispose from the gravitational field event\r\n */\r\n public dispose(force: boolean = true) {\r\n if (!this._sphere) {\r\n return;\r\n }\r\n if (force) {\r\n this._sphere.dispose();\r\n } else {\r\n setTimeout(() => {\r\n if (!this._dataFetched) {\r\n this._sphere.dispose();\r\n }\r\n }, 0);\r\n }\r\n }\r\n\r\n private _tick() {\r\n // Since the params won't change, we fetch the event only once\r\n if (this._sphere) {\r\n this._physicsHelper.applyRadialExplosionForce(this._origin, this._options);\r\n } else {\r\n const radialExplosionEvent = this._physicsHelper.applyRadialExplosionForce(this._origin, this._options);\r\n if (radialExplosionEvent) {\r\n this._sphere = <Mesh>radialExplosionEvent.getData().sphere?.clone(\"radialExplosionEventSphereClone\");\r\n }\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Represents a physics updraft event\r\n */\r\nclass PhysicsUpdraftEvent {\r\n private _physicsEngine: PhysicsEngineV1 | PhysicsEngineV2;\r\n private _originTop: Vector3 = Vector3.Zero(); // the most upper part of the cylinder\r\n private _originDirection: Vector3 = Vector3.Zero(); // used if the updraftMode is perpendicular\r\n private _tickCallback: any;\r\n private _cylinder: Mesh | undefined;\r\n private _cylinderPosition: Vector3 = Vector3.Zero(); // to keep the cylinders position, because normally the origin is in the center and not on the bottom\r\n private _dataFetched: boolean = false; // check if the has been fetched the data. If not, do cleanup\r\n private static _HitData: PhysicsHitData = { force: new Vector3(), contactPoint: new Vector3(), distanceFromOrigin: 0 };\r\n /**\r\n * Initializes the physics updraft event\r\n * @param _scene BabylonJS scene\r\n * @param _origin The origin position of the updraft\r\n * @param _options The options for the updraft event\r\n */\r\n constructor(\r\n private _scene: Scene,\r\n private _origin: Vector3,\r\n private _options: PhysicsUpdraftEventOptions\r\n ) {\r\n this._physicsEngine = this._scene.getPhysicsEngine() as PhysicsEngineV1 | PhysicsEngineV2;\r\n this._options = { ...new PhysicsUpdraftEventOptions(), ...this._options };\r\n\r\n this._origin.addToRef(new Vector3(0, this._options.height / 2, 0), this._cylinderPosition);\r\n this._origin.addToRef(new Vector3(0, this._options.height, 0), this._originTop);\r\n\r\n if (this._options.updraftMode === PhysicsUpdraftMode.Perpendicular) {\r\n this._originDirection = this._origin.subtract(this._originTop).normalize();\r\n }\r\n\r\n this._tickCallback = () => this._tick();\r\n\r\n if (this._physicsEngine.getPluginVersion() === 1) {\r\n this._prepareCylinder();\r\n }\r\n }\r\n\r\n /**\r\n * Returns the data related to the updraft event (cylinder).\r\n * @returns A physics updraft event\r\n */\r\n public getData(): PhysicsUpdraftEventData {\r\n this._dataFetched = true;\r\n\r\n return {\r\n cylinder: this._cylinder,\r\n };\r\n }\r\n\r\n /**\r\n * Enables the updraft.\r\n */\r\n public enable() {\r\n this._tickCallback.call(this);\r\n this._scene.registerBeforeRender(this._tickCallback);\r\n }\r\n\r\n /**\r\n * Disables the updraft.\r\n */\r\n public disable() {\r\n this._scene.unregisterBeforeRender(this._tickCallback);\r\n }\r\n\r\n /**\r\n * Disposes the cylinder.\r\n * @param force Specifies if the updraft should be disposed by force\r\n */\r\n public dispose(force: boolean = true) {\r\n if (!this._cylinder) {\r\n return;\r\n }\r\n if (force) {\r\n this._cylinder.dispose();\r\n this._cylinder = undefined;\r\n } else {\r\n setTimeout(() => {\r\n if (!this._dataFetched && this._cylinder) {\r\n this._cylinder.dispose();\r\n this._cylinder = undefined;\r\n }\r\n }, 0);\r\n }\r\n }\r\n\r\n private _getHitData(center: Vector3, data: PhysicsHitData): void {\r\n let direction: Vector3;\r\n if (this._options.updraftMode === PhysicsUpdraftMode.Perpendicular) {\r\n direction = this._originDirection;\r\n } else {\r\n direction = center.subtract(this._originTop);\r\n }\r\n\r\n const distanceFromOrigin = Vector3.Distance(this._origin, center);\r\n\r\n const multiplier = this._options.strength * -1;\r\n\r\n const force = direction.multiplyByFloats(multiplier, multiplier, multiplier);\r\n\r\n data.force.copyFrom(force);\r\n data.contactPoint.copyFrom(center);\r\n data.distanceFromOrigin = distanceFromOrigin;\r\n }\r\n\r\n private _getBodyHitData(body: PhysicsBody, data: PhysicsHitData, instanceIndex?: number): boolean {\r\n if (HelperTools.HasAppliedForces(body)) {\r\n return false;\r\n }\r\n\r\n const center = body.getObjectCenterWorld(instanceIndex);\r\n\r\n if (!HelperTools.IsInsideCylinder(center, this._origin, this._options.radius, this._options.height)) {\r\n return false;\r\n }\r\n\r\n data.instanceIndex = instanceIndex;\r\n this._getHitData(center, data);\r\n return true;\r\n }\r\n\r\n private _getImpostorHitData(impostor: PhysicsImpostor, data: PhysicsHitData): boolean {\r\n if (impostor.mass === 0) {\r\n return false;\r\n }\r\n\r\n const impostorObject = <AbstractMesh>impostor.object;\r\n if (!this._intersectsWithCylinder(impostorObject)) {\r\n return false;\r\n }\r\n\r\n const center = impostor.getObjectCenter();\r\n this._getHitData(center, data);\r\n return true;\r\n }\r\n\r\n private _tick() {\r\n const hitData = PhysicsUpdraftEvent._HitData;\r\n if (this._physicsEngine.getPluginVersion() === 1) {\r\n (<PhysicsEngineV1>this._physicsEngine).getImpostors().forEach((impostor: PhysicsImpostor) => {\r\n if (!this._getImpostorHitData(impostor, hitData)) {\r\n return;\r\n }\r\n\r\n impostor.applyForce(hitData.force, hitData.contactPoint);\r\n });\r\n } else {\r\n // V2\r\n (<PhysicsEngineV2>this._physicsEngine).getBodies().forEach((body: PhysicsBody) => {\r\n body.iterateOverAllInstances((body, instanceIndex) => {\r\n if (!this._getBodyHitData(body, hitData, instanceIndex)) {\r\n return;\r\n }\r\n\r\n body.applyForce(hitData.force, hitData.contactPoint, hitData.instanceIndex);\r\n });\r\n });\r\n }\r\n }\r\n\r\n /*** Helpers ***/\r\n\r\n private _prepareCylinder(): void {\r\n if (!this._cylinder) {\r\n this._cylinder = CreateCylinder(\r\n \"updraftEventCylinder\",\r\n {\r\n height: this._options.height,\r\n diameter: this._options.radius * 2,\r\n },\r\n this._scene\r\n );\r\n this._cylinder.isVisible = false;\r\n }\r\n }\r\n\r\n private _intersectsWithCylinder(mesh: AbstractMesh): boolean {\r\n if (!this._cylinder) {\r\n return false;\r\n }\r\n this._cylinder.position = this._cylinderPosition;\r\n return this._cylinder.intersectsMesh(mesh, true);\r\n }\r\n}\r\n\r\n/**\r\n * Represents a physics vortex event\r\n */\r\nclass PhysicsVortexEvent {\r\n private _physicsEngine: PhysicsEngineV1 | PhysicsEngineV2;\r\n private _originTop: Vector3 = Vector3.Zero(); // the most upper part of the cylinder\r\n private _tickCallback: any;\r\n private _cylinder: Mesh;\r\n private _cylinderPosition: Vector3 = Vector3.Zero(); // to keep the cylinders position, because normally the origin is in the center and not on the bottom\r\n private _dataFetched: boolean = false; // check if the has been fetched the data. If not, do cleanup\r\n private static _OriginOnPlane: Vector3 = Vector3.Zero();\r\n private static _HitData: PhysicsHitData = { force: new Vector3(), contactPoint: new Vector3(), distanceFromOrigin: 0 };\r\n\r\n /**\r\n * Initializes the physics vortex event\r\n * @param _scene The BabylonJS scene\r\n * @param _origin The origin position of the vortex\r\n * @param _options The options for the vortex event\r\n */\r\n constructor(\r\n private _scene: Scene,\r\n private _origin: Vector3,\r\n private _options: PhysicsVortexEventOptions\r\n ) {\r\n this._physicsEngine = this._scene.getPhysicsEngine() as PhysicsEngineV1 | PhysicsEngineV2;\r\n this._options = { ...new PhysicsVortexEventOptions(), ...this._options };\r\n\r\n this._origin.addToRef(new Vector3(0, this._options.height / 2, 0), this._cylinderPosition);\r\n this._origin.addToRef(new Vector3(0, this._options.height, 0), this._originTop);\r\n\r\n this._tickCallback = () => this._tick();\r\n\r\n if (this._physicsEngine.getPluginVersion() === 1) {\r\n this._prepareCylinder();\r\n }\r\n }\r\n\r\n /**\r\n * Returns the data related to the vortex event (cylinder).\r\n * @returns The physics vortex event data\r\n */\r\n public getData(): PhysicsVortexEventData {\r\n this._dataFetched = true;\r\n\r\n return {\r\n cylinder: this._cylinder,\r\n };\r\n }\r\n\r\n /**\r\n * Enables the vortex.\r\n */\r\n public enable() {\r\n this._tickCallback.call(this);\r\n this._scene.registerBeforeRender(this._tickCallback);\r\n }\r\n\r\n /**\r\n * Disables the cortex.\r\n */\r\n public disable() {\r\n this._scene.unregisterBeforeRender(this._tickCallback);\r\n }\r\n\r\n /**\r\n * Disposes the sphere.\r\n * @param force\r\n */\r\n public dispose(force: boolean = true) {\r\n if (!this._cylinder) {\r\n return;\r\n }\r\n if (force) {\r\n this._cylinder.dispose();\r\n } else {\r\n setTimeout(() => {\r\n if (!this._dataFetched) {\r\n this._cylinder.dispose();\r\n }\r\n }, 0);\r\n }\r\n }\r\n\r\n private _getHitData(mesh: AbstractMesh, center: Vector3, data: PhysicsHitData): boolean {\r\n const originOnPlane = PhysicsVortexEvent._OriginOnPlane;\r\n originOnPlane.set(this._origin.x, center.y, this._origin.z); // the distance to the origin as if both objects were on a plane (Y-axis)\r\n const originToImpostorDirection = TmpVectors.Vector3[0];\r\n center.subtractToRef(originOnPlane, originToImpostorDirection);\r\n\r\n const contactPoint = TmpVectors.Vector3[1];\r\n const hasContactPoint = HelperTools.GetContactPointToRef(mesh, originOnPlane, originToImpostorDirection, contactPoint, data.instanceIndex);\r\n if (!hasContactPoint) {\r\n return false;\r\n }\r\n const distance = Vector3.Distance(contactPoint, originOnPlane);\r\n const absoluteDistanceFromOrigin = distance / this._options.radius;\r\n\r\n const directionToOrigin = TmpVectors.Vector3[2];\r\n contactPoint.normalizeToRef(directionToOrigin);\r\n if (absoluteDistanceFromOrigin > this._options.centripetalForceThreshold) {\r\n directionToOrigin.negateInPlace();\r\n }\r\n\r\n let forceX: number;\r\n let forceY: number;\r\n let forceZ: number;\r\n\r\n if (absoluteDistanceFromOrigin > this._options.centripetalForceThreshold) {\r\n forceX = directionToOrigin.x * this._options.centripetalForceMultiplier;\r\n forceY = directionToOrigin.y * this._options.updraftForceMultiplier;\r\n forceZ = directionToOrigin.z * this._options.centripetalForceMultiplier;\r\n } else {\r\n const perpendicularDirection = Vector3.Cross(originOnPlane, center).normalize();\r\n\r\n forceX = (perpendicularDirection.x + directionToOrigin.x) * this._options.centrifugalForceMultiplier;\r\n forceY = this._originTop.y * this._options.updraftForceMultiplier;\r\n forceZ = (perpendicularDirection.z + directionToOrigin.z) * this._options.centrifugalForceMultiplier;\r\n }\r\n\r\n const force = TmpVectors.Vector3[3];\r\n force.set(forceX, forceY, forceZ);\r\n force.scaleInPlace(this._options.strength);\r\n\r\n data.force.copyFrom(force);\r\n data.contactPoint.copyFrom(center);\r\n data.distanceFromOrigin = absoluteDistanceFromOrigin;\r\n return true;\r\n }\r\n\r\n private _getBodyHitData(body: PhysicsBody, data: PhysicsHitData, instanceIndex?: number): boolean {\r\n if (HelperTools.HasAppliedForces(body, instanceIndex)) {\r\n return false;\r\n }\r\n\r\n const bodyObject = body.transformNode as AbstractMesh;\r\n const bodyCenter = body.getObjectCenterWorld(instanceIndex);\r\n\r\n if (!HelperTools.IsInsideCylinder(bodyCenter, this._origin, this._options.radius, this._options.height)) {\r\n return false;\r\n }\r\n\r\n data.instanceIndex = instanceIndex;\r\n return this._getHitData(bodyObject, bodyCenter, data);\r\n }\r\n\r\n private _getImpostorHitData(impostor: PhysicsImpostor, data: PhysicsHitData): boolean {\r\n if (impostor.mass === 0) {\r\n return false;\r\n }\r\n\r\n if (impostor.object.getClassName() !== \"Mesh\" && impostor.object.getClassName() !== \"InstancedMesh\") {\r\n return false;\r\n }\r\n\r\n const impostorObject = impostor.object as AbstractMesh;\r\n if (!this._intersectsWithCylinder(impostorObject)) {\r\n return false;\r\n }\r\n\r\n const impostorObjectCenter = impostor.getObjectCenter();\r\n this._getHitData(impostorObject, impostorObjectCenter, data);\r\n return true;\r\n }\r\n\r\n private _tick() {\r\n const hitData = PhysicsVortexEvent._HitData;\r\n if (this._physicsEngine.getPluginVersion() === 1) {\r\n (<PhysicsEngineV1>this._physicsEngine).getImpostors().forEach((impostor: PhysicsImpostor) => {\r\n if (!this._getImpostorHitData(impostor, hitData)) {\r\n return;\r\n }\r\n\r\n impostor.applyForce(hitData.force, hitData.contactPoint);\r\n });\r\n } else {\r\n (<PhysicsEngineV2>this._physicsEngine).getBodies().forEach((body: PhysicsBody) => {\r\n body.iterateOverAllInstances((body: PhysicsBody, instanceIndex?: number) => {\r\n if (!this._getBodyHitData(body, hitData, instanceIndex)) {\r\n return;\r\n }\r\n\r\n body.applyForce(hitData.force, hitData.contactPoint, hitData.instanceIndex);\r\n });\r\n });\r\n }\r\n }\r\n\r\n /*** Helpers ***/\r\n\r\n private _prepareCylinder(): void {\r\n if (!this._cylinder) {\r\n this._cylinder = CreateCylinder(\r\n \"vortexEventCylinder\",\r\n {\r\n height: this._options.height,\r\n diameter: this._options.radius * 2,\r\n },\r\n this._scene\r\n );\r\n this._cylinder.isVisible = false;\r\n }\r\n }\r\n\r\n private _intersectsWithCylinder(mesh: AbstractMesh): boolean {\r\n this._cylinder.position = this._cylinderPosition;\r\n\r\n return this._cylinder.intersectsMesh(mesh, true);\r\n }\r\n}\r\n\r\n/**\r\n * Options fot the radial explosion event\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class\r\n */\r\nexport class PhysicsRadialExplosionEventOptions {\r\n /**\r\n * The radius of the sphere for the radial explosion.\r\n */\r\n radius: number = 5;\r\n\r\n /**\r\n * The strength of the explosion.\r\n */\r\n strength: number = 10;\r\n\r\n /**\r\n * The strength of the force in correspondence to the distance of the affected object\r\n */\r\n falloff: PhysicsRadialImpulseFalloff = PhysicsRadialImpulseFalloff.Constant;\r\n\r\n /**\r\n * Sphere options for the radial explosion.\r\n */\r\n sphere: { segments: number; diameter: number } = { segments: 32, diameter: 1 };\r\n\r\n /**\r\n * Sphere options for the radial explosion.\r\n */\r\n affectedImpostorsCallback: (affectedImpostorsWithData: Array<PhysicsAffectedImpostorWithData>) => void;\r\n\r\n /**\r\n * Sphere options for the radial explosion.\r\n */\r\n affectedBodiesCallback: (affectedBodiesWithData: Array<PhysicsAffectedBodyWithData>) => void;\r\n}\r\n\r\n/**\r\n * Options fot the updraft event\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class\r\n */\r\nexport class PhysicsUpdraftEventOptions {\r\n /**\r\n * The radius of the cylinder for the vortex\r\n */\r\n radius: number = 5;\r\n\r\n /**\r\n * The strength of the updraft.\r\n */\r\n strength: number = 10;\r\n\r\n /**\r\n * The height of the cylinder for the updraft.\r\n */\r\n height: number = 10;\r\n\r\n /**\r\n * The mode for the updraft.\r\n */\r\n updraftMode: PhysicsUpdraftMode = PhysicsUpdraftMode.Center;\r\n}\r\n\r\n/**\r\n * Options fot the vortex event\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class\r\n */\r\nexport class PhysicsVortexEventOptions {\r\n /**\r\n * The radius of the cylinder for the vortex\r\n */\r\n radius: number = 5;\r\n\r\n /**\r\n * The strength of the vortex.\r\n */\r\n strength: number = 10;\r\n\r\n /**\r\n * The height of the cylinder for the vortex.\r\n */\r\n height: number = 10;\r\n\r\n /**\r\n * At which distance, relative to the radius the centripetal forces should kick in? Range: 0-1\r\n */\r\n centripetalForceThreshold: number = 0.7;\r\n\r\n /**\r\n * This multiplier determines with how much force the objects will be pushed sideways/around the vortex, when below the threshold.\r\n */\r\n centripetalForceMultiplier: number = 5;\r\n\r\n /**\r\n * This multiplier determines with how much force the objects will be pushed sideways/around the vortex, when above the threshold.\r\n */\r\n centrifugalForceMultiplier: number = 0.5;\r\n\r\n /**\r\n * This multiplier determines with how much force the objects will be pushed upwards, when in the vortex.\r\n */\r\n updraftForceMultiplier: number = 0.02;\r\n}\r\n\r\n/**\r\n * The strength of the force in correspondence to the distance of the affected object\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class\r\n */\r\nexport enum PhysicsRadialImpulseFalloff {\r\n /** Defines that impulse is constant in strength across it's whole radius */\r\n Constant,\r\n /** Defines that impulse gets weaker if it's further from the origin */\r\n Linear,\r\n}\r\n\r\n/**\r\n * The strength of the force in correspondence to the distance of the affected object\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class\r\n */\r\nexport enum PhysicsUpdraftMode {\r\n /** Defines that the upstream forces will pull towards the top center of the cylinder */\r\n Center,\r\n /** Defines that once a impostor is inside the cylinder, it will shoot out perpendicular from the ground of the cylinder */\r\n Perpendicular,\r\n}\r\n\r\n/**\r\n * Interface for a physics hit data\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class\r\n */\r\nexport interface PhysicsHitData {\r\n /**\r\n * The force applied at the contact point\r\n */\r\n force: Vector3;\r\n /**\r\n * The contact point\r\n */\r\n contactPoint: Vector3;\r\n /**\r\n * The distance from the origin to the contact point\r\n */\r\n distanceFromOrigin: number;\r\n /**\r\n * For an instanced physics body (mesh with thin instances), the index of the thin instance the hit applies to\r\n */\r\n instanceIndex?: number;\r\n}\r\n\r\n/**\r\n * Interface for radial explosion event data\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class\r\n */\r\nexport interface PhysicsRadialExplosionEventData {\r\n /**\r\n * A sphere used for the radial explosion event\r\n */\r\n sphere: Mesh;\r\n}\r\n\r\n/**\r\n * Interface for gravitational field event data\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class\r\n */\r\nexport interface PhysicsGravitationalFieldEventData {\r\n /**\r\n * A sphere mesh used for the gravitational field event\r\n */\r\n sphere: Mesh;\r\n}\r\n\r\n/**\r\n * Interface for updraft event data\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class\r\n */\r\nexport interface PhysicsUpdraftEventData {\r\n /**\r\n * A cylinder used for the updraft event\r\n */\r\n cylinder?: Mesh;\r\n}\r\n\r\n/**\r\n * Interface for vortex event data\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class\r\n */\r\nexport interface PhysicsVortexEventData {\r\n /**\r\n * A cylinder used for the vortex event\r\n */\r\n cylinder: Mesh;\r\n}\r\n\r\n/**\r\n * Interface for an affected physics impostor\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class\r\n */\r\nexport interface PhysicsAffectedImpostorWithData {\r\n /**\r\n * The impostor affected by the effect\r\n */\r\n impostor: PhysicsImpostor;\r\n\r\n /**\r\n * The data about the hit/force from the explosion\r\n */\r\n hitData: PhysicsHitData;\r\n}\r\n\r\n/**\r\n * Interface for an affected physics body\r\n * @see\r\n */\r\nexport interface PhysicsAffectedBodyWithData {\r\n /**\r\n * The impostor affected by the effect\r\n */\r\n body: PhysicsBody;\r\n\r\n /**\r\n * The data about the hit/force from the explosion\r\n */\r\n hitData: PhysicsHitData;\r\n}\r\n"]}
|
|
@@ -162,6 +162,26 @@ export interface PhysicsShapeParameters {
|
|
|
162
162
|
* Use children hierarchy
|
|
163
163
|
*/
|
|
164
164
|
includeChildMeshes?: boolean;
|
|
165
|
+
/**
|
|
166
|
+
* The size of the heightfield in the X axis
|
|
167
|
+
*/
|
|
168
|
+
heightFieldSizeX?: number;
|
|
169
|
+
/**
|
|
170
|
+
* The size of the heightfield in the Z axis
|
|
171
|
+
*/
|
|
172
|
+
heightFieldSizeZ?: number;
|
|
173
|
+
/**
|
|
174
|
+
* The number of samples along the X axis
|
|
175
|
+
*/
|
|
176
|
+
numHeightFieldSamplesX?: number;
|
|
177
|
+
/**
|
|
178
|
+
* The number of samples along the Z axis
|
|
179
|
+
*/
|
|
180
|
+
numHeightFieldSamplesZ?: number;
|
|
181
|
+
/**
|
|
182
|
+
* The data for the heightfield
|
|
183
|
+
*/
|
|
184
|
+
heightFieldData?: Float32Array;
|
|
165
185
|
}
|
|
166
186
|
/**
|
|
167
187
|
* Parameters used to describe a Constraint
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IPhysicsEnginePlugin.js","sourceRoot":"","sources":["../../../../../dev/core/src/Physics/v2/IPhysicsEnginePlugin.ts"],"names":[],"mappings":"A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;IACJ,mFAAQ,CAAA;IACR,mFAAQ,CAAA;AACZ,CAAC,EAJW,0BAA0B,KAA1B,0BAA0B,QAIrC;AAED,MAAM,CAAN,IAAY,gBAMX;AAND,WAAY,gBAAgB;IACxB,2DAAuC,CAAA;IACvC,+DAA2C,CAAA;IAC3C,6DAAyC,CAAA;IACzC,uDAAmC,CAAA;IACnC,qDAAiC,CAAA;AACrC,CAAC,EANW,gBAAgB,KAAhB,gBAAgB,QAM3B;AAyLD;;GAEG;AACH,MAAM,CAAN,IAAY,iBAIX;AAJD,WAAY,iBAAiB;IACzB,6DAAM,CAAA;IACN,iEAAQ,CAAA;IACR,+DAAO,CAAA;AACX,CAAC,EAJW,iBAAiB,KAAjB,iBAAiB,QAI5B","sourcesContent":["import type { Vector3, Quaternion } from \"../../Maths/math.vector\";\r\nimport type { IRaycastQuery, PhysicsRaycastResult } from \"../physicsRaycastResult\";\r\nimport type { PhysicsBody } from \"./physicsBody\";\r\nimport type { PhysicsShape } from \"./physicsShape\";\r\nimport type { PhysicsConstraint } from \"./physicsConstraint\";\r\nimport type { BoundingBox } from \"../../Culling/boundingBox\";\r\nimport type { TransformNode } from \"../../Meshes/transformNode\";\r\nimport type { PhysicsMaterial } from \"./physicsMaterial\";\r\nimport type { Mesh } from \"../../Meshes/mesh\";\r\nimport type { Nullable } from \"core/types\";\r\nimport type { Observable } from \"core/Misc/observable\";\r\n\r\n/** How a specific axis can be constrained */\r\nexport enum PhysicsConstraintAxisLimitMode {\r\n /*\r\n * The axis is not restricted at all\r\n */\r\n FREE,\r\n /*\r\n * The axis has a minimum/maximum limit\r\n */\r\n LIMITED,\r\n /*\r\n * The axis allows no relative movement of the pivots\r\n */\r\n LOCKED,\r\n}\r\n\r\n/** The constraint specific axis to use when setting Friction, `ConstraintAxisLimitMode`, max force, ... */\r\nexport enum PhysicsConstraintAxis {\r\n /*\r\n * Translation along the primary axis of the constraint (i.e. the\r\n * direction specified by PhysicsConstraintParameters.axisA/axisB)\r\n */\r\n LINEAR_X,\r\n /*\r\n * Translation along the second axis of the constraint (i.e. the\r\n * direction specified by PhysicsConstraintParameters.perpAxisA/perpAxisB)\r\n */\r\n LINEAR_Y,\r\n /*\r\n * Translation along the third axis of the constraint. This axis is\r\n * computed from the cross product of axisA/axisB and perpAxisA/perpAxisB)\r\n */\r\n LINEAR_Z,\r\n /*\r\n * Rotation around the primary axis of the constraint (i.e. the\r\n * axis specified by PhysicsConstraintParameters.axisA/axisB)\r\n */\r\n ANGULAR_X,\r\n /*\r\n * Rotation around the second axis of the constraint (i.e. the\r\n * axis specified by PhysicsConstraintParameters.perpAxisA/perpAxisB)\r\n */\r\n ANGULAR_Y,\r\n /*\r\n * Rotation around the third axis of the constraint. This axis is\r\n * computed from the cross product of axisA/axisB and perpAxisA/perpAxisB)\r\n */\r\n ANGULAR_Z,\r\n /*\r\n * A 3D distance limit; similar to specifying the LINEAR_X/Y/Z axes\r\n * individually, but the distance calculation uses all three axes\r\n * simultaneously, instead of individually.\r\n */\r\n LINEAR_DISTANCE,\r\n}\r\n\r\n/** Type of Constraint */\r\nexport enum PhysicsConstraintType {\r\n /**\r\n * A ball and socket constraint will attempt to line up the pivot\r\n * positions in each body, and have no restrictions on rotation\r\n */\r\n BALL_AND_SOCKET = 1,\r\n /**\r\n * A distance constraint will attempt to keep the pivot locations\r\n * within a specified distance.\r\n */\r\n DISTANCE = 2,\r\n /**\r\n * A hinge constraint will keep the pivot positions aligned as well\r\n * as two angular axes. The remaining angular axis will be free to rotate.\r\n */\r\n HINGE = 3,\r\n /**\r\n * A slider constraint allows bodies to translate along one axis and\r\n * rotate about the same axis. The remaining two axes are locked in\r\n * place\r\n */\r\n SLIDER = 4,\r\n /**\r\n * A lock constraint will attempt to keep the pivots completely lined\r\n * up between both bodies, allowing no relative movement.\r\n */\r\n LOCK = 5,\r\n /*\r\n * A prismatic will lock the rotations of the bodies, and allow translation\r\n * only along one axis\r\n */\r\n PRISMATIC = 6,\r\n /*\r\n * A generic constraint; this starts with no limits on how the bodies can\r\n * move relative to each other, but limits can be added via the PhysicsConstraint\r\n * interfaces. This can be used to specify a large variety of constraints\r\n */\r\n SIX_DOF = 7,\r\n}\r\n\r\n/** Type of Shape */\r\nexport enum PhysicsShapeType {\r\n SPHERE,\r\n CAPSULE,\r\n CYLINDER,\r\n BOX,\r\n CONVEX_HULL,\r\n CONTAINER,\r\n MESH,\r\n HEIGHTFIELD,\r\n}\r\n\r\n/** Optional motor which attempts to move a body at a specific velocity, or at a specific position */\r\nexport enum PhysicsConstraintMotorType {\r\n NONE,\r\n VELOCITY,\r\n POSITION,\r\n}\r\n\r\nexport enum PhysicsEventType {\r\n COLLISION_STARTED = \"COLLISION_STARTED\",\r\n COLLISION_CONTINUED = \"COLLISION_CONTINUED\",\r\n COLLISION_FINISHED = \"COLLISION_FINISHED\",\r\n TRIGGER_ENTERED = \"TRIGGER_ENTERED\",\r\n TRIGGER_EXITED = \"TRIGGER_EXITED\",\r\n}\r\n\r\n/**\r\n * Base collision object\r\n */\r\nexport interface IBasePhysicsCollisionEvent {\r\n /**\r\n * 1st physics body that collided\r\n */\r\n collider: PhysicsBody;\r\n /**\r\n * 2nd physics body that collided\r\n */\r\n collidedAgainst: PhysicsBody;\r\n /**\r\n * index in instances array for the collider\r\n */\r\n colliderIndex: number;\r\n /**\r\n * index in instances array for the collidedAgainst\r\n */\r\n collidedAgainstIndex: number;\r\n /**\r\n * Event type\r\n */\r\n type: PhysicsEventType;\r\n}\r\n\r\n/**\r\n * Collision object that is the parameter when notification for collision fires.\r\n */\r\nexport interface IPhysicsCollisionEvent extends IBasePhysicsCollisionEvent {\r\n /**\r\n * World position where the collision occured\r\n */\r\n point: Nullable<Vector3>;\r\n /**\r\n * Penetration distance\r\n */\r\n distance: number;\r\n /**\r\n * Impulse value computed by the solver response\r\n */\r\n impulse: number;\r\n /**\r\n * Collision world normal direction\r\n */\r\n normal: Nullable<Vector3>;\r\n}\r\n\r\n/**\r\n * Parameters used to describe the Shape\r\n */\r\nexport interface PhysicsShapeParameters {\r\n /**\r\n * Shape center position\r\n */\r\n center?: Vector3;\r\n /**\r\n * Radius for cylinder, shape and capsule\r\n */\r\n radius?: number;\r\n /**\r\n * First point position that defines the cylinder or capsule\r\n */\r\n pointA?: Vector3;\r\n /**\r\n * Second point position that defines the cylinder or capsule\r\n */\r\n pointB?: Vector3;\r\n /**\r\n * Shape orientation\r\n */\r\n rotation?: Quaternion;\r\n /**\r\n * Dimesion extention for the box\r\n */\r\n extents?: Vector3;\r\n /**\r\n * Mesh used for Mesh shape or convex hull. It can be different than the mesh the body is attached to.\r\n */\r\n mesh?: Mesh;\r\n /**\r\n * Use children hierarchy\r\n */\r\n includeChildMeshes?: boolean;\r\n}\r\n\r\n/**\r\n * Parameters used to describe a Constraint\r\n */\r\nexport interface PhysicsConstraintParameters {\r\n /**\r\n * Location of the constraint pivot in the space of first body\r\n */\r\n pivotA?: Vector3;\r\n /**\r\n * Location of the constraint pivot in the space of the second body\r\n */\r\n pivotB?: Vector3;\r\n /**\r\n * An axis in the space of the first body which determines how\r\n * distances/angles are measured for LINEAR_X/ANGULAR_X limits.\r\n */\r\n axisA?: Vector3;\r\n /**\r\n * An axis in the space of the second body which determines how\r\n * distances/angles are measured for LINEAR_X/ANGULAR_X limits.\r\n */\r\n axisB?: Vector3;\r\n\r\n /**\r\n * An axis in the space of the first body which determines how\r\n * distances/angles are measured for LINEAR_Y/ANGULAR_Y limits.\r\n */\r\n perpAxisA?: Vector3;\r\n\r\n /**\r\n * An axis in the space of the second body which determines how\r\n * distances/angles are measured for LINEAR_Y/ANGULAR_Y limits.\r\n */\r\n perpAxisB?: Vector3;\r\n\r\n /**\r\n * The maximum distance that can seperate the two pivots.\r\n * Only used for DISTANCE constraints\r\n */\r\n maxDistance?: number;\r\n\r\n /**\r\n * Determines if the connected bodies should collide. Generally,\r\n * it is preferable to set this to false, especially if the constraint\r\n * positions the bodies so that they overlap. Otherwise, the constraint\r\n * will \"fight\" the collision detection and may cause jitter.\r\n */\r\n collision?: boolean;\r\n}\r\n\r\n/**\r\n * Parameters used to describe mass and inertia of the Physics Body\r\n */\r\nexport interface PhysicsMassProperties {\r\n /**\r\n * The center of mass, in local space. This is The\r\n * point the body will rotate around when applying\r\n * an angular velocity.\r\n *\r\n * If not provided, the physics engine will compute\r\n * an appropriate value.\r\n */\r\n centerOfMass?: Vector3;\r\n /**\r\n * The total mass of this object, in kilograms. This\r\n * affects how easy it is to move the body. A value\r\n * of zero will be used as an infinite mass.\r\n *\r\n * If not provided, the physics engine will compute\r\n * an appropriate value.\r\n */\r\n mass?: number;\r\n /**\r\n * The principal moments of inertia of this object\r\n * for a unit mass. This determines how easy it is\r\n * for the body to rotate. A value of zero on any\r\n * axis will be used as infinite interia about that\r\n * axis.\r\n *\r\n * If not provided, the physics engine will compute\r\n * an appropriate value.\r\n */\r\n inertia?: Vector3;\r\n /**\r\n * The rotation rotating from inertia major axis space\r\n * to parent space (i.e., the rotation which, when\r\n * applied to the 3x3 inertia tensor causes the inertia\r\n * tensor to become a diagonal matrix). This determines\r\n * how the values of inertia are aligned with the parent\r\n * object.\r\n *\r\n * If not provided, the physics engine will compute\r\n * an appropriate value.\r\n */\r\n inertiaOrientation?: Quaternion;\r\n}\r\n\r\n/**\r\n * Indicates how the body will behave.\r\n */\r\nexport enum PhysicsMotionType {\r\n STATIC,\r\n ANIMATED,\r\n DYNAMIC,\r\n}\r\n\r\n/**\r\n * Represents a pair of bodies connected by a constraint.\r\n */\r\nexport type ConstrainedBodyPair = { parentBody: PhysicsBody; parentBodyIndex: number; childBody: PhysicsBody; childBodyIndex: number };\r\n\r\n/** @internal */\r\nexport interface IPhysicsEnginePluginV2 {\r\n /**\r\n * Physics plugin world instance\r\n */\r\n world: any;\r\n /**\r\n * Physics plugin name\r\n */\r\n name: string;\r\n\r\n /**\r\n * Collision observable\r\n */\r\n onCollisionObservable: Observable<IPhysicsCollisionEvent>;\r\n /**\r\n * Collision ended observable\r\n */\r\n onCollisionEndedObservable: Observable<IBasePhysicsCollisionEvent>;\r\n /**\r\n * Trigger observable\r\n */\r\n onTriggerCollisionObservable: Observable<IBasePhysicsCollisionEvent>;\r\n\r\n setGravity(gravity: Vector3): void;\r\n setTimeStep(timeStep: number): void;\r\n getTimeStep(): number;\r\n executeStep(delta: number, bodies: Array<PhysicsBody>): void; //not forgetting pre and post events\r\n getPluginVersion(): number;\r\n\r\n // body\r\n initBody(body: PhysicsBody, motionType: PhysicsMotionType, position: Vector3, orientation: Quaternion): void;\r\n initBodyInstances(body: PhysicsBody, motionType: PhysicsMotionType, mesh: Mesh): void;\r\n updateBodyInstances(body: PhysicsBody, mesh: Mesh): void;\r\n removeBody(body: PhysicsBody): void;\r\n sync(body: PhysicsBody): void;\r\n syncTransform(body: PhysicsBody, transformNode: TransformNode): void;\r\n setShape(body: PhysicsBody, shape: Nullable<PhysicsShape>): void;\r\n getShape(body: PhysicsBody): Nullable<PhysicsShape>;\r\n getShapeType(shape: PhysicsShape): PhysicsShapeType;\r\n setEventMask(body: PhysicsBody, eventMask: number, instanceIndex?: number): void;\r\n getEventMask(body: PhysicsBody, instanceIndex?: number): number;\r\n setMotionType(body: PhysicsBody, motionType: PhysicsMotionType, instanceIndex?: number): void;\r\n getMotionType(body: PhysicsBody, instanceIndex?: number): PhysicsMotionType;\r\n computeMassProperties(body: PhysicsBody, instanceIndex?: number): PhysicsMassProperties;\r\n setMassProperties(body: PhysicsBody, massProps: PhysicsMassProperties, instanceIndex?: number): void;\r\n getMassProperties(body: PhysicsBody, instanceIndex?: number): PhysicsMassProperties;\r\n setLinearDamping(body: PhysicsBody, damping: number, instanceIndex?: number): void;\r\n getLinearDamping(body: PhysicsBody, instanceIndex?: number): number;\r\n setAngularDamping(body: PhysicsBody, damping: number, instanceIndex?: number): void;\r\n getAngularDamping(body: PhysicsBody, instanceIndex?: number): number;\r\n setLinearVelocity(body: PhysicsBody, linVel: Vector3, instanceIndex?: number): void;\r\n getLinearVelocityToRef(body: PhysicsBody, linVel: Vector3, instanceIndex?: number): void;\r\n applyImpulse(body: PhysicsBody, impulse: Vector3, location: Vector3, instanceIndex?: number): void;\r\n applyForce(body: PhysicsBody, force: Vector3, location: Vector3, instanceIndex?: number): void;\r\n setAngularVelocity(body: PhysicsBody, angVel: Vector3, instanceIndex?: number): void;\r\n getAngularVelocityToRef(body: PhysicsBody, angVel: Vector3, instanceIndex?: number): void;\r\n getBodyGeometry(body: PhysicsBody): {};\r\n disposeBody(body: PhysicsBody): void;\r\n setCollisionCallbackEnabled(body: PhysicsBody, enabled: boolean, instanceIndex?: number): void;\r\n setCollisionEndedCallbackEnabled(body: PhysicsBody, enabled: boolean, instanceIndex?: number): void;\r\n addConstraint(body: PhysicsBody, childBody: PhysicsBody, constraint: PhysicsConstraint, instanceIndex?: number, childInstanceIndex?: number): void;\r\n getCollisionObservable(body: PhysicsBody, instanceIndex?: number): Observable<IPhysicsCollisionEvent>;\r\n getCollisionEndedObservable(body: PhysicsBody, instanceIndex?: number): Observable<IBasePhysicsCollisionEvent>;\r\n setGravityFactor(body: PhysicsBody, factor: number, instanceIndex?: number): void;\r\n getGravityFactor(body: PhysicsBody, instanceIndex?: number): number;\r\n setTargetTransform(body: PhysicsBody, position: Vector3, rotation: Quaternion, instanceIndex?: number): void;\r\n\r\n // shape\r\n initShape(shape: PhysicsShape, type: PhysicsShapeType, options: PhysicsShapeParameters): void;\r\n setShapeFilterMembershipMask(shape: PhysicsShape, membershipMask: number): void;\r\n getShapeFilterMembershipMask(shape: PhysicsShape): number;\r\n setShapeFilterCollideMask(shape: PhysicsShape, collideMask: number): void;\r\n getShapeFilterCollideMask(shape: PhysicsShape): number;\r\n setMaterial(shape: PhysicsShape, material: PhysicsMaterial): void;\r\n getMaterial(shape: PhysicsShape): PhysicsMaterial;\r\n setDensity(shape: PhysicsShape, density: number): void;\r\n getDensity(shape: PhysicsShape): number;\r\n addChild(shape: PhysicsShape, newChild: PhysicsShape, translation?: Vector3, rotation?: Quaternion, scale?: Vector3): void;\r\n removeChild(shape: PhysicsShape, childIndex: number): void;\r\n getNumChildren(shape: PhysicsShape): number;\r\n getBoundingBox(shape: PhysicsShape): BoundingBox;\r\n disposeShape(shape: PhysicsShape): void;\r\n setTrigger(shape: PhysicsShape, isTrigger: boolean): void;\r\n\r\n // constraint\r\n initConstraint(constraint: PhysicsConstraint, body: PhysicsBody, childBody: PhysicsBody): void;\r\n setEnabled(constraint: PhysicsConstraint, isEnabled: boolean): void;\r\n getEnabled(constraint: PhysicsConstraint): boolean;\r\n setCollisionsEnabled(constraint: PhysicsConstraint, isEnabled: boolean): void;\r\n getCollisionsEnabled(constraint: PhysicsConstraint): boolean;\r\n setAxisFriction(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis, friction: number): void;\r\n getAxisFriction(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis): Nullable<number>;\r\n setAxisMode(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis, limitMode: PhysicsConstraintAxisLimitMode): void;\r\n getAxisMode(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis): Nullable<PhysicsConstraintAxisLimitMode>;\r\n setAxisMinLimit(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis, minLimit: number): void;\r\n getAxisMinLimit(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis): Nullable<number>;\r\n setAxisMaxLimit(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis, limit: number): void;\r\n getAxisMaxLimit(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis): Nullable<number>;\r\n setAxisMotorType(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis, motorType: PhysicsConstraintMotorType): void;\r\n getAxisMotorType(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis): Nullable<PhysicsConstraintMotorType>;\r\n setAxisMotorTarget(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis, target: number): void;\r\n getAxisMotorTarget(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis): Nullable<number>;\r\n setAxisMotorMaxForce(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis, maxForce: number): void;\r\n getAxisMotorMaxForce(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis): Nullable<number>;\r\n disposeConstraint(constraint: PhysicsConstraint): void;\r\n getBodiesUsingConstraint(constraint: PhysicsConstraint): ConstrainedBodyPair[];\r\n\r\n // raycast\r\n raycast(from: Vector3, to: Vector3, result: PhysicsRaycastResult, query?: IRaycastQuery): void;\r\n\r\n dispose(): void;\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"IPhysicsEnginePlugin.js","sourceRoot":"","sources":["../../../../../dev/core/src/Physics/v2/IPhysicsEnginePlugin.ts"],"names":[],"mappings":"AAYA,6CAA6C;AAC7C,MAAM,CAAN,IAAY,8BAaX;AAbD,WAAY,8BAA8B;IACtC;;OAEG;IACH,mFAAI,CAAA;IACJ;;OAEG;IACH,yFAAO,CAAA;IACP;;OAEG;IACH,uFAAM,CAAA;AACV,CAAC,EAbW,8BAA8B,KAA9B,8BAA8B,QAazC;AAED,2GAA2G;AAC3G,MAAM,CAAN,IAAY,qBAqCX;AArCD,WAAY,qBAAqB;IAC7B;;;OAGG;IACH,yEAAQ,CAAA;IACR;;;OAGG;IACH,yEAAQ,CAAA;IACR;;;OAGG;IACH,yEAAQ,CAAA;IACR;;;OAGG;IACH,2EAAS,CAAA;IACT;;;OAGG;IACH,2EAAS,CAAA;IACT;;;OAGG;IACH,2EAAS,CAAA;IACT;;;;OAIG;IACH,uFAAe,CAAA;AACnB,CAAC,EArCW,qBAAqB,KAArB,qBAAqB,QAqChC;AAED,yBAAyB;AACzB,MAAM,CAAN,IAAY,qBAsCX;AAtCD,WAAY,qBAAqB;IAC7B;;;OAGG;IACH,uFAAmB,CAAA;IACnB;;;OAGG;IACH,yEAAY,CAAA;IACZ;;;OAGG;IACH,mEAAS,CAAA;IACT;;;;OAIG;IACH,qEAAU,CAAA;IACV;;;OAGG;IACH,iEAAQ,CAAA;IACR;;;OAGG;IACH,2EAAa,CAAA;IACb;;;;OAIG;IACH,uEAAW,CAAA;AACf,CAAC,EAtCW,qBAAqB,KAArB,qBAAqB,QAsChC;AAED,oBAAoB;AACpB,MAAM,CAAN,IAAY,gBASX;AATD,WAAY,gBAAgB;IACxB,2DAAM,CAAA;IACN,6DAAO,CAAA;IACP,+DAAQ,CAAA;IACR,qDAAG,CAAA;IACH,qEAAW,CAAA;IACX,iEAAS,CAAA;IACT,uDAAI,CAAA;IACJ,qEAAW,CAAA;AACf,CAAC,EATW,gBAAgB,KAAhB,gBAAgB,QAS3B;AAED,qGAAqG;AACrG,MAAM,CAAN,IAAY,0BAIX;AAJD,WAAY,0BAA0B;IAClC,2EAAI,CAAA;IACJ,mFAAQ,CAAA;IACR,mFAAQ,CAAA;AACZ,CAAC,EAJW,0BAA0B,KAA1B,0BAA0B,QAIrC;AAED,MAAM,CAAN,IAAY,gBAMX;AAND,WAAY,gBAAgB;IACxB,2DAAuC,CAAA;IACvC,+DAA2C,CAAA;IAC3C,6DAAyC,CAAA;IACzC,uDAAmC,CAAA;IACnC,qDAAiC,CAAA;AACrC,CAAC,EANW,gBAAgB,KAAhB,gBAAgB,QAM3B;AA6MD;;GAEG;AACH,MAAM,CAAN,IAAY,iBAIX;AAJD,WAAY,iBAAiB;IACzB,6DAAM,CAAA;IACN,iEAAQ,CAAA;IACR,+DAAO,CAAA;AACX,CAAC,EAJW,iBAAiB,KAAjB,iBAAiB,QAI5B","sourcesContent":["import type { Vector3, Quaternion } from \"../../Maths/math.vector\";\r\nimport type { IRaycastQuery, PhysicsRaycastResult } from \"../physicsRaycastResult\";\r\nimport type { PhysicsBody } from \"./physicsBody\";\r\nimport type { PhysicsShape } from \"./physicsShape\";\r\nimport type { PhysicsConstraint } from \"./physicsConstraint\";\r\nimport type { BoundingBox } from \"../../Culling/boundingBox\";\r\nimport type { TransformNode } from \"../../Meshes/transformNode\";\r\nimport type { PhysicsMaterial } from \"./physicsMaterial\";\r\nimport type { Mesh } from \"../../Meshes/mesh\";\r\nimport type { Nullable } from \"core/types\";\r\nimport type { Observable } from \"core/Misc/observable\";\r\n\r\n/** How a specific axis can be constrained */\r\nexport enum PhysicsConstraintAxisLimitMode {\r\n /*\r\n * The axis is not restricted at all\r\n */\r\n FREE,\r\n /*\r\n * The axis has a minimum/maximum limit\r\n */\r\n LIMITED,\r\n /*\r\n * The axis allows no relative movement of the pivots\r\n */\r\n LOCKED,\r\n}\r\n\r\n/** The constraint specific axis to use when setting Friction, `ConstraintAxisLimitMode`, max force, ... */\r\nexport enum PhysicsConstraintAxis {\r\n /*\r\n * Translation along the primary axis of the constraint (i.e. the\r\n * direction specified by PhysicsConstraintParameters.axisA/axisB)\r\n */\r\n LINEAR_X,\r\n /*\r\n * Translation along the second axis of the constraint (i.e. the\r\n * direction specified by PhysicsConstraintParameters.perpAxisA/perpAxisB)\r\n */\r\n LINEAR_Y,\r\n /*\r\n * Translation along the third axis of the constraint. This axis is\r\n * computed from the cross product of axisA/axisB and perpAxisA/perpAxisB)\r\n */\r\n LINEAR_Z,\r\n /*\r\n * Rotation around the primary axis of the constraint (i.e. the\r\n * axis specified by PhysicsConstraintParameters.axisA/axisB)\r\n */\r\n ANGULAR_X,\r\n /*\r\n * Rotation around the second axis of the constraint (i.e. the\r\n * axis specified by PhysicsConstraintParameters.perpAxisA/perpAxisB)\r\n */\r\n ANGULAR_Y,\r\n /*\r\n * Rotation around the third axis of the constraint. This axis is\r\n * computed from the cross product of axisA/axisB and perpAxisA/perpAxisB)\r\n */\r\n ANGULAR_Z,\r\n /*\r\n * A 3D distance limit; similar to specifying the LINEAR_X/Y/Z axes\r\n * individually, but the distance calculation uses all three axes\r\n * simultaneously, instead of individually.\r\n */\r\n LINEAR_DISTANCE,\r\n}\r\n\r\n/** Type of Constraint */\r\nexport enum PhysicsConstraintType {\r\n /**\r\n * A ball and socket constraint will attempt to line up the pivot\r\n * positions in each body, and have no restrictions on rotation\r\n */\r\n BALL_AND_SOCKET = 1,\r\n /**\r\n * A distance constraint will attempt to keep the pivot locations\r\n * within a specified distance.\r\n */\r\n DISTANCE = 2,\r\n /**\r\n * A hinge constraint will keep the pivot positions aligned as well\r\n * as two angular axes. The remaining angular axis will be free to rotate.\r\n */\r\n HINGE = 3,\r\n /**\r\n * A slider constraint allows bodies to translate along one axis and\r\n * rotate about the same axis. The remaining two axes are locked in\r\n * place\r\n */\r\n SLIDER = 4,\r\n /**\r\n * A lock constraint will attempt to keep the pivots completely lined\r\n * up between both bodies, allowing no relative movement.\r\n */\r\n LOCK = 5,\r\n /*\r\n * A prismatic will lock the rotations of the bodies, and allow translation\r\n * only along one axis\r\n */\r\n PRISMATIC = 6,\r\n /*\r\n * A generic constraint; this starts with no limits on how the bodies can\r\n * move relative to each other, but limits can be added via the PhysicsConstraint\r\n * interfaces. This can be used to specify a large variety of constraints\r\n */\r\n SIX_DOF = 7,\r\n}\r\n\r\n/** Type of Shape */\r\nexport enum PhysicsShapeType {\r\n SPHERE,\r\n CAPSULE,\r\n CYLINDER,\r\n BOX,\r\n CONVEX_HULL,\r\n CONTAINER,\r\n MESH,\r\n HEIGHTFIELD,\r\n}\r\n\r\n/** Optional motor which attempts to move a body at a specific velocity, or at a specific position */\r\nexport enum PhysicsConstraintMotorType {\r\n NONE,\r\n VELOCITY,\r\n POSITION,\r\n}\r\n\r\nexport enum PhysicsEventType {\r\n COLLISION_STARTED = \"COLLISION_STARTED\",\r\n COLLISION_CONTINUED = \"COLLISION_CONTINUED\",\r\n COLLISION_FINISHED = \"COLLISION_FINISHED\",\r\n TRIGGER_ENTERED = \"TRIGGER_ENTERED\",\r\n TRIGGER_EXITED = \"TRIGGER_EXITED\",\r\n}\r\n\r\n/**\r\n * Base collision object\r\n */\r\nexport interface IBasePhysicsCollisionEvent {\r\n /**\r\n * 1st physics body that collided\r\n */\r\n collider: PhysicsBody;\r\n /**\r\n * 2nd physics body that collided\r\n */\r\n collidedAgainst: PhysicsBody;\r\n /**\r\n * index in instances array for the collider\r\n */\r\n colliderIndex: number;\r\n /**\r\n * index in instances array for the collidedAgainst\r\n */\r\n collidedAgainstIndex: number;\r\n /**\r\n * Event type\r\n */\r\n type: PhysicsEventType;\r\n}\r\n\r\n/**\r\n * Collision object that is the parameter when notification for collision fires.\r\n */\r\nexport interface IPhysicsCollisionEvent extends IBasePhysicsCollisionEvent {\r\n /**\r\n * World position where the collision occured\r\n */\r\n point: Nullable<Vector3>;\r\n /**\r\n * Penetration distance\r\n */\r\n distance: number;\r\n /**\r\n * Impulse value computed by the solver response\r\n */\r\n impulse: number;\r\n /**\r\n * Collision world normal direction\r\n */\r\n normal: Nullable<Vector3>;\r\n}\r\n\r\n/**\r\n * Parameters used to describe the Shape\r\n */\r\nexport interface PhysicsShapeParameters {\r\n /**\r\n * Shape center position\r\n */\r\n center?: Vector3;\r\n /**\r\n * Radius for cylinder, shape and capsule\r\n */\r\n radius?: number;\r\n /**\r\n * First point position that defines the cylinder or capsule\r\n */\r\n pointA?: Vector3;\r\n /**\r\n * Second point position that defines the cylinder or capsule\r\n */\r\n pointB?: Vector3;\r\n /**\r\n * Shape orientation\r\n */\r\n rotation?: Quaternion;\r\n /**\r\n * Dimesion extention for the box\r\n */\r\n extents?: Vector3;\r\n /**\r\n * Mesh used for Mesh shape or convex hull. It can be different than the mesh the body is attached to.\r\n */\r\n mesh?: Mesh;\r\n /**\r\n * Use children hierarchy\r\n */\r\n includeChildMeshes?: boolean;\r\n /**\r\n * The size of the heightfield in the X axis\r\n */\r\n heightFieldSizeX?: number;\r\n /**\r\n * The size of the heightfield in the Z axis\r\n */\r\n heightFieldSizeZ?: number;\r\n /**\r\n * The number of samples along the X axis\r\n */\r\n numHeightFieldSamplesX?: number;\r\n /**\r\n * The number of samples along the Z axis\r\n */\r\n numHeightFieldSamplesZ?: number;\r\n /**\r\n * The data for the heightfield\r\n */\r\n heightFieldData?: Float32Array;\r\n}\r\n\r\n/**\r\n * Parameters used to describe a Constraint\r\n */\r\nexport interface PhysicsConstraintParameters {\r\n /**\r\n * Location of the constraint pivot in the space of first body\r\n */\r\n pivotA?: Vector3;\r\n /**\r\n * Location of the constraint pivot in the space of the second body\r\n */\r\n pivotB?: Vector3;\r\n /**\r\n * An axis in the space of the first body which determines how\r\n * distances/angles are measured for LINEAR_X/ANGULAR_X limits.\r\n */\r\n axisA?: Vector3;\r\n /**\r\n * An axis in the space of the second body which determines how\r\n * distances/angles are measured for LINEAR_X/ANGULAR_X limits.\r\n */\r\n axisB?: Vector3;\r\n\r\n /**\r\n * An axis in the space of the first body which determines how\r\n * distances/angles are measured for LINEAR_Y/ANGULAR_Y limits.\r\n */\r\n perpAxisA?: Vector3;\r\n\r\n /**\r\n * An axis in the space of the second body which determines how\r\n * distances/angles are measured for LINEAR_Y/ANGULAR_Y limits.\r\n */\r\n perpAxisB?: Vector3;\r\n\r\n /**\r\n * The maximum distance that can seperate the two pivots.\r\n * Only used for DISTANCE constraints\r\n */\r\n maxDistance?: number;\r\n\r\n /**\r\n * Determines if the connected bodies should collide. Generally,\r\n * it is preferable to set this to false, especially if the constraint\r\n * positions the bodies so that they overlap. Otherwise, the constraint\r\n * will \"fight\" the collision detection and may cause jitter.\r\n */\r\n collision?: boolean;\r\n}\r\n\r\n/**\r\n * Parameters used to describe mass and inertia of the Physics Body\r\n */\r\nexport interface PhysicsMassProperties {\r\n /**\r\n * The center of mass, in local space. This is The\r\n * point the body will rotate around when applying\r\n * an angular velocity.\r\n *\r\n * If not provided, the physics engine will compute\r\n * an appropriate value.\r\n */\r\n centerOfMass?: Vector3;\r\n /**\r\n * The total mass of this object, in kilograms. This\r\n * affects how easy it is to move the body. A value\r\n * of zero will be used as an infinite mass.\r\n *\r\n * If not provided, the physics engine will compute\r\n * an appropriate value.\r\n */\r\n mass?: number;\r\n /**\r\n * The principal moments of inertia of this object\r\n * for a unit mass. This determines how easy it is\r\n * for the body to rotate. A value of zero on any\r\n * axis will be used as infinite interia about that\r\n * axis.\r\n *\r\n * If not provided, the physics engine will compute\r\n * an appropriate value.\r\n */\r\n inertia?: Vector3;\r\n /**\r\n * The rotation rotating from inertia major axis space\r\n * to parent space (i.e., the rotation which, when\r\n * applied to the 3x3 inertia tensor causes the inertia\r\n * tensor to become a diagonal matrix). This determines\r\n * how the values of inertia are aligned with the parent\r\n * object.\r\n *\r\n * If not provided, the physics engine will compute\r\n * an appropriate value.\r\n */\r\n inertiaOrientation?: Quaternion;\r\n}\r\n\r\n/**\r\n * Indicates how the body will behave.\r\n */\r\nexport enum PhysicsMotionType {\r\n STATIC,\r\n ANIMATED,\r\n DYNAMIC,\r\n}\r\n\r\n/**\r\n * Represents a pair of bodies connected by a constraint.\r\n */\r\nexport type ConstrainedBodyPair = { parentBody: PhysicsBody; parentBodyIndex: number; childBody: PhysicsBody; childBodyIndex: number };\r\n\r\n/** @internal */\r\nexport interface IPhysicsEnginePluginV2 {\r\n /**\r\n * Physics plugin world instance\r\n */\r\n world: any;\r\n /**\r\n * Physics plugin name\r\n */\r\n name: string;\r\n\r\n /**\r\n * Collision observable\r\n */\r\n onCollisionObservable: Observable<IPhysicsCollisionEvent>;\r\n /**\r\n * Collision ended observable\r\n */\r\n onCollisionEndedObservable: Observable<IBasePhysicsCollisionEvent>;\r\n /**\r\n * Trigger observable\r\n */\r\n onTriggerCollisionObservable: Observable<IBasePhysicsCollisionEvent>;\r\n\r\n setGravity(gravity: Vector3): void;\r\n setTimeStep(timeStep: number): void;\r\n getTimeStep(): number;\r\n executeStep(delta: number, bodies: Array<PhysicsBody>): void; //not forgetting pre and post events\r\n getPluginVersion(): number;\r\n\r\n // body\r\n initBody(body: PhysicsBody, motionType: PhysicsMotionType, position: Vector3, orientation: Quaternion): void;\r\n initBodyInstances(body: PhysicsBody, motionType: PhysicsMotionType, mesh: Mesh): void;\r\n updateBodyInstances(body: PhysicsBody, mesh: Mesh): void;\r\n removeBody(body: PhysicsBody): void;\r\n sync(body: PhysicsBody): void;\r\n syncTransform(body: PhysicsBody, transformNode: TransformNode): void;\r\n setShape(body: PhysicsBody, shape: Nullable<PhysicsShape>): void;\r\n getShape(body: PhysicsBody): Nullable<PhysicsShape>;\r\n getShapeType(shape: PhysicsShape): PhysicsShapeType;\r\n setEventMask(body: PhysicsBody, eventMask: number, instanceIndex?: number): void;\r\n getEventMask(body: PhysicsBody, instanceIndex?: number): number;\r\n setMotionType(body: PhysicsBody, motionType: PhysicsMotionType, instanceIndex?: number): void;\r\n getMotionType(body: PhysicsBody, instanceIndex?: number): PhysicsMotionType;\r\n computeMassProperties(body: PhysicsBody, instanceIndex?: number): PhysicsMassProperties;\r\n setMassProperties(body: PhysicsBody, massProps: PhysicsMassProperties, instanceIndex?: number): void;\r\n getMassProperties(body: PhysicsBody, instanceIndex?: number): PhysicsMassProperties;\r\n setLinearDamping(body: PhysicsBody, damping: number, instanceIndex?: number): void;\r\n getLinearDamping(body: PhysicsBody, instanceIndex?: number): number;\r\n setAngularDamping(body: PhysicsBody, damping: number, instanceIndex?: number): void;\r\n getAngularDamping(body: PhysicsBody, instanceIndex?: number): number;\r\n setLinearVelocity(body: PhysicsBody, linVel: Vector3, instanceIndex?: number): void;\r\n getLinearVelocityToRef(body: PhysicsBody, linVel: Vector3, instanceIndex?: number): void;\r\n applyImpulse(body: PhysicsBody, impulse: Vector3, location: Vector3, instanceIndex?: number): void;\r\n applyForce(body: PhysicsBody, force: Vector3, location: Vector3, instanceIndex?: number): void;\r\n setAngularVelocity(body: PhysicsBody, angVel: Vector3, instanceIndex?: number): void;\r\n getAngularVelocityToRef(body: PhysicsBody, angVel: Vector3, instanceIndex?: number): void;\r\n getBodyGeometry(body: PhysicsBody): {};\r\n disposeBody(body: PhysicsBody): void;\r\n setCollisionCallbackEnabled(body: PhysicsBody, enabled: boolean, instanceIndex?: number): void;\r\n setCollisionEndedCallbackEnabled(body: PhysicsBody, enabled: boolean, instanceIndex?: number): void;\r\n addConstraint(body: PhysicsBody, childBody: PhysicsBody, constraint: PhysicsConstraint, instanceIndex?: number, childInstanceIndex?: number): void;\r\n getCollisionObservable(body: PhysicsBody, instanceIndex?: number): Observable<IPhysicsCollisionEvent>;\r\n getCollisionEndedObservable(body: PhysicsBody, instanceIndex?: number): Observable<IBasePhysicsCollisionEvent>;\r\n setGravityFactor(body: PhysicsBody, factor: number, instanceIndex?: number): void;\r\n getGravityFactor(body: PhysicsBody, instanceIndex?: number): number;\r\n setTargetTransform(body: PhysicsBody, position: Vector3, rotation: Quaternion, instanceIndex?: number): void;\r\n\r\n // shape\r\n initShape(shape: PhysicsShape, type: PhysicsShapeType, options: PhysicsShapeParameters): void;\r\n setShapeFilterMembershipMask(shape: PhysicsShape, membershipMask: number): void;\r\n getShapeFilterMembershipMask(shape: PhysicsShape): number;\r\n setShapeFilterCollideMask(shape: PhysicsShape, collideMask: number): void;\r\n getShapeFilterCollideMask(shape: PhysicsShape): number;\r\n setMaterial(shape: PhysicsShape, material: PhysicsMaterial): void;\r\n getMaterial(shape: PhysicsShape): PhysicsMaterial;\r\n setDensity(shape: PhysicsShape, density: number): void;\r\n getDensity(shape: PhysicsShape): number;\r\n addChild(shape: PhysicsShape, newChild: PhysicsShape, translation?: Vector3, rotation?: Quaternion, scale?: Vector3): void;\r\n removeChild(shape: PhysicsShape, childIndex: number): void;\r\n getNumChildren(shape: PhysicsShape): number;\r\n getBoundingBox(shape: PhysicsShape): BoundingBox;\r\n disposeShape(shape: PhysicsShape): void;\r\n setTrigger(shape: PhysicsShape, isTrigger: boolean): void;\r\n\r\n // constraint\r\n initConstraint(constraint: PhysicsConstraint, body: PhysicsBody, childBody: PhysicsBody): void;\r\n setEnabled(constraint: PhysicsConstraint, isEnabled: boolean): void;\r\n getEnabled(constraint: PhysicsConstraint): boolean;\r\n setCollisionsEnabled(constraint: PhysicsConstraint, isEnabled: boolean): void;\r\n getCollisionsEnabled(constraint: PhysicsConstraint): boolean;\r\n setAxisFriction(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis, friction: number): void;\r\n getAxisFriction(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis): Nullable<number>;\r\n setAxisMode(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis, limitMode: PhysicsConstraintAxisLimitMode): void;\r\n getAxisMode(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis): Nullable<PhysicsConstraintAxisLimitMode>;\r\n setAxisMinLimit(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis, minLimit: number): void;\r\n getAxisMinLimit(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis): Nullable<number>;\r\n setAxisMaxLimit(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis, limit: number): void;\r\n getAxisMaxLimit(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis): Nullable<number>;\r\n setAxisMotorType(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis, motorType: PhysicsConstraintMotorType): void;\r\n getAxisMotorType(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis): Nullable<PhysicsConstraintMotorType>;\r\n setAxisMotorTarget(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis, target: number): void;\r\n getAxisMotorTarget(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis): Nullable<number>;\r\n setAxisMotorMaxForce(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis, maxForce: number): void;\r\n getAxisMotorMaxForce(constraint: PhysicsConstraint, axis: PhysicsConstraintAxis): Nullable<number>;\r\n disposeConstraint(constraint: PhysicsConstraint): void;\r\n getBodiesUsingConstraint(constraint: PhysicsConstraint): ConstrainedBodyPair[];\r\n\r\n // raycast\r\n raycast(from: Vector3, to: Vector3, result: PhysicsRaycastResult, query?: IRaycastQuery): void;\r\n\r\n dispose(): void;\r\n}\r\n"]}
|