@babylonjs/core 5.45.1 → 5.46.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Actions/condition.js +23 -23
- package/Actions/condition.js.map +1 -1
- package/Animations/animatable.js +48 -48
- package/Animations/animatable.js.map +1 -1
- package/Animations/animation.js +53 -53
- package/Animations/animation.js.map +1 -1
- package/Animations/animationGroup.js +53 -53
- package/Animations/animationGroup.js.map +1 -1
- package/Animations/runtimeAnimation.js +36 -36
- package/Animations/runtimeAnimation.js.map +1 -1
- package/Audio/audioEngine.js +14 -14
- package/Audio/audioEngine.js.map +1 -1
- package/Audio/audioSceneComponent.js +14 -14
- package/Audio/audioSceneComponent.js.map +1 -1
- package/Audio/sound.js +47 -47
- package/Audio/sound.js.map +1 -1
- package/Behaviors/Meshes/baseSixDofDragBehavior.d.ts +1 -1
- package/Behaviors/Meshes/fadeInOutBehavior.js +11 -11
- package/Behaviors/Meshes/fadeInOutBehavior.js.map +1 -1
- package/Behaviors/Meshes/pointerDragBehavior.js +34 -34
- package/Behaviors/Meshes/pointerDragBehavior.js.map +1 -1
- package/Bones/bone.js +15 -15
- package/Bones/bone.js.map +1 -1
- package/Bones/boneIKController.js +9 -9
- package/Bones/boneIKController.js.map +1 -1
- package/Bones/boneLookController.js +50 -50
- package/Bones/boneLookController.js.map +1 -1
- package/Bones/skeleton.js +35 -35
- package/Bones/skeleton.js.map +1 -1
- package/Buffers/buffer.js +14 -14
- package/Buffers/buffer.js.map +1 -1
- package/Buffers/dataBuffer.js +6 -6
- package/Buffers/dataBuffer.js.map +1 -1
- package/Cameras/Inputs/freeCameraDeviceOrientationInput.js +42 -42
- package/Cameras/Inputs/freeCameraDeviceOrientationInput.js.map +1 -1
- package/Cameras/Stereoscopic/stereoscopicScreenUniversalCamera.js +18 -18
- package/Cameras/Stereoscopic/stereoscopicScreenUniversalCamera.js.map +1 -1
- package/Cameras/VR/vrExperienceHelper.js +178 -178
- package/Cameras/VR/vrExperienceHelper.js.map +1 -1
- package/Cameras/arcRotateCamera.js +176 -176
- package/Cameras/arcRotateCamera.js.map +1 -1
- package/Cameras/camera.js +90 -90
- package/Cameras/camera.js.map +1 -1
- package/Cameras/flyCamera.js +82 -82
- package/Cameras/flyCamera.js.map +1 -1
- package/Cameras/freeCamera.js +54 -54
- package/Cameras/freeCamera.js.map +1 -1
- package/Compute/computeShader.js +12 -12
- package/Compute/computeShader.js.map +1 -1
- package/Culling/ray.d.ts +1 -1
- package/Debug/axesViewer.js +12 -12
- package/Debug/axesViewer.js.map +1 -1
- package/Debug/debugLayer.js +21 -21
- package/Debug/debugLayer.js.map +1 -1
- package/Debug/directionalLightFrustumViewer.js +20 -20
- package/Debug/directionalLightFrustumViewer.js.map +1 -1
- package/Debug/rayHelper.js +10 -10
- package/Debug/rayHelper.js.map +1 -1
- package/Debug/skeletonViewer.js +81 -81
- package/Debug/skeletonViewer.js.map +1 -1
- package/DeviceInput/InputDevices/deviceSource.d.ts +1 -1
- package/DeviceInput/InputDevices/deviceSourceManager.js +31 -31
- package/DeviceInput/InputDevices/deviceSourceManager.js.map +1 -1
- package/DeviceInput/InputDevices/deviceTypes.d.ts +1 -1
- package/DeviceInput/internalDeviceSourceManager.d.ts +2 -2
- package/Engines/Extensions/engine.computeShader.d.ts +3 -3
- package/Engines/Extensions/engine.multiRender.js +1 -1
- package/Engines/Extensions/engine.multiRender.js.map +1 -1
- package/Engines/Extensions/engine.query.d.ts +1 -1
- package/Engines/Extensions/engine.renderTarget.d.ts +1 -1
- package/Engines/Extensions/engine.renderTarget.js +1 -1
- package/Engines/Extensions/engine.renderTarget.js.map +1 -1
- package/Engines/Native/nativeDataStream.d.ts +1 -1
- package/Engines/Native/nativeHardwareTexture.js +3 -3
- package/Engines/Native/nativeHardwareTexture.js.map +1 -1
- package/Engines/Native/nativeInterfaces.d.ts +5 -5
- package/Engines/Native/nativePipelineContext.js +7 -7
- package/Engines/Native/nativePipelineContext.js.map +1 -1
- package/Engines/Native/nativeRenderTargetWrapper.js +6 -6
- package/Engines/Native/nativeRenderTargetWrapper.js.map +1 -1
- package/Engines/Processors/shaderCodeInliner.js +4 -4
- package/Engines/Processors/shaderCodeInliner.js.map +1 -1
- package/Engines/Processors/shaderProcessingOptions.d.ts +1 -1
- package/Engines/WebGL/webGLHardwareTexture.js +3 -3
- package/Engines/WebGL/webGLHardwareTexture.js.map +1 -1
- package/Engines/WebGPU/webgpuBufferManager.js +3 -3
- package/Engines/WebGPU/webgpuBufferManager.js.map +1 -1
- package/Engines/WebGPU/webgpuCacheBindGroups.js +6 -6
- package/Engines/WebGPU/webgpuCacheBindGroups.js.map +1 -1
- package/Engines/WebGPU/webgpuCacheRenderPipelineTree.js +5 -5
- package/Engines/WebGPU/webgpuCacheRenderPipelineTree.js.map +1 -1
- package/Engines/WebGPU/webgpuClearQuad.js +11 -11
- package/Engines/WebGPU/webgpuClearQuad.js.map +1 -1
- package/Engines/WebGPU/webgpuComputeContext.js +7 -7
- package/Engines/WebGPU/webgpuComputeContext.js.map +1 -1
- package/Engines/WebGPU/webgpuComputePipelineContext.js +4 -4
- package/Engines/WebGPU/webgpuComputePipelineContext.js.map +1 -1
- package/Engines/WebGPU/webgpuDrawContext.js +7 -7
- package/Engines/WebGPU/webgpuDrawContext.js.map +1 -1
- package/Engines/WebGPU/webgpuHardwareTexture.js +9 -9
- package/Engines/WebGPU/webgpuHardwareTexture.js.map +1 -1
- package/Engines/WebGPU/webgpuMaterialContext.js +5 -5
- package/Engines/WebGPU/webgpuMaterialContext.js.map +1 -1
- package/Engines/WebGPU/webgpuOcclusionQuery.js +10 -10
- package/Engines/WebGPU/webgpuOcclusionQuery.js.map +1 -1
- package/Engines/WebGPU/webgpuPipelineContext.js +6 -6
- package/Engines/WebGPU/webgpuPipelineContext.js.map +1 -1
- package/Engines/WebGPU/webgpuQuerySet.js +3 -3
- package/Engines/WebGPU/webgpuQuerySet.js.map +1 -1
- package/Engines/WebGPU/webgpuShaderProcessingContext.js +3 -3
- package/Engines/WebGPU/webgpuShaderProcessingContext.js.map +1 -1
- package/Engines/WebGPU/webgpuTextureHelper.js +3 -3
- package/Engines/WebGPU/webgpuTextureHelper.js.map +1 -1
- package/Engines/WebGPU/webgpuTimestampQuery.js +3 -3
- package/Engines/WebGPU/webgpuTimestampQuery.js.map +1 -1
- package/Engines/engine.js +134 -134
- package/Engines/engine.js.map +1 -1
- package/Engines/nativeEngine.js +6 -6
- package/Engines/nativeEngine.js.map +1 -1
- package/Engines/nullEngine.js +25 -25
- package/Engines/nullEngine.js.map +1 -1
- package/Engines/renderTargetWrapper.js +25 -25
- package/Engines/renderTargetWrapper.js.map +1 -1
- package/Engines/thinEngine.js +243 -243
- package/Engines/thinEngine.js.map +1 -1
- package/Engines/webgpuEngine.js +132 -132
- package/Engines/webgpuEngine.js.map +1 -1
- package/Events/keyboardEvents.js +10 -10
- package/Events/keyboardEvents.js.map +1 -1
- package/Events/pointerEvents.js +9 -9
- package/Events/pointerEvents.js.map +1 -1
- package/Gamepads/Controllers/poseEnabledController.js +9 -9
- package/Gamepads/Controllers/poseEnabledController.js.map +1 -1
- package/Gamepads/Controllers/webVRController.js +13 -13
- package/Gamepads/Controllers/webVRController.js.map +1 -1
- package/Gamepads/gamepad.js +20 -20
- package/Gamepads/gamepad.js.map +1 -1
- package/Gizmos/axisDragGizmo.js +45 -45
- package/Gizmos/axisDragGizmo.js.map +1 -1
- package/Gizmos/axisScaleGizmo.js +12 -12
- package/Gizmos/axisScaleGizmo.js.map +1 -1
- package/Gizmos/boundingBoxGizmo.js +74 -74
- package/Gizmos/boundingBoxGizmo.js.map +1 -1
- package/Gizmos/gizmo.js +34 -34
- package/Gizmos/gizmo.js.map +1 -1
- package/Gizmos/gizmoManager.js +40 -40
- package/Gizmos/gizmoManager.js.map +1 -1
- package/Gizmos/planeDragGizmo.js +23 -23
- package/Gizmos/planeDragGizmo.js.map +1 -1
- package/Gizmos/planeRotationGizmo.js +12 -12
- package/Gizmos/planeRotationGizmo.js.map +1 -1
- package/Gizmos/positionGizmo.js +40 -40
- package/Gizmos/positionGizmo.js.map +1 -1
- package/Gizmos/rotationGizmo.js +47 -47
- package/Gizmos/rotationGizmo.js.map +1 -1
- package/Gizmos/scaleGizmo.js +41 -41
- package/Gizmos/scaleGizmo.js.map +1 -1
- package/Helpers/environmentHelper.js +18 -18
- package/Helpers/environmentHelper.js.map +1 -1
- package/Helpers/textureDome.js +96 -96
- package/Helpers/textureDome.js.map +1 -1
- package/IAccessibilityTag.d.ts +2 -2
- package/Inputs/scene.inputManager.js +12 -1
- package/Inputs/scene.inputManager.js.map +1 -1
- package/Instrumentation/engineInstrumentation.js +21 -21
- package/Instrumentation/engineInstrumentation.js.map +1 -1
- package/Instrumentation/sceneInstrumentation.js +90 -90
- package/Instrumentation/sceneInstrumentation.js.map +1 -1
- package/Layers/effectLayer.js +48 -48
- package/Layers/effectLayer.js.map +1 -1
- package/Layers/glowLayer.js +32 -32
- package/Layers/glowLayer.js.map +1 -1
- package/Layers/highlightLayer.js +26 -26
- package/Layers/highlightLayer.js.map +1 -1
- package/Layers/layer.js +40 -40
- package/Layers/layer.js.map +1 -1
- package/LensFlares/lensFlare.js +15 -15
- package/LensFlares/lensFlare.js.map +1 -1
- package/LensFlares/lensFlareSystem.js +4 -4
- package/LensFlares/lensFlareSystem.js.map +1 -1
- package/Lights/Shadows/cascadedShadowGenerator.js +18 -18
- package/Lights/Shadows/cascadedShadowGenerator.js.map +1 -1
- package/Lights/Shadows/shadowGenerator.js +115 -115
- package/Lights/Shadows/shadowGenerator.js.map +1 -1
- package/Lights/directionalLight.js +31 -31
- package/Lights/directionalLight.js.map +1 -1
- package/Lights/light.js +72 -72
- package/Lights/light.js.map +1 -1
- package/Lights/pointLight.js +18 -18
- package/Lights/pointLight.js.map +1 -1
- package/Lights/spotLight.js +30 -30
- package/Lights/spotLight.js.map +1 -1
- package/Loading/sceneLoader.d.ts +1 -1
- package/Materials/Background/backgroundMaterial.js +124 -124
- package/Materials/Background/backgroundMaterial.js.map +1 -1
- package/Materials/Node/Blocks/Dual/imageSourceBlock.js +8 -8
- package/Materials/Node/Blocks/Dual/imageSourceBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/lightBlock.js +14 -14
- package/Materials/Node/Blocks/Dual/lightBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js +9 -9
- package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js.map +1 -1
- package/Materials/Node/Blocks/Dual/textureBlock.js +26 -26
- package/Materials/Node/Blocks/Dual/textureBlock.js.map +1 -1
- package/Materials/Node/Blocks/Input/inputBlock.js +34 -34
- package/Materials/Node/Blocks/Input/inputBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js +14 -14
- package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js.map +1 -1
- package/Materials/Node/Blocks/PBR/reflectionBlock.js +16 -16
- package/Materials/Node/Blocks/PBR/reflectionBlock.js.map +1 -1
- package/Materials/Node/Blocks/customBlock.js +7 -7
- package/Materials/Node/Blocks/customBlock.js.map +1 -1
- package/Materials/Node/Blocks/gradientBlock.js +13 -13
- package/Materials/Node/Blocks/gradientBlock.js.map +1 -1
- package/Materials/Node/Blocks/triPlanarBlock.js +30 -30
- package/Materials/Node/Blocks/triPlanarBlock.js.map +1 -1
- package/Materials/Node/nodeMaterial.d.ts +1 -1
- package/Materials/Node/nodeMaterial.js +60 -60
- package/Materials/Node/nodeMaterial.js.map +1 -1
- package/Materials/Node/nodeMaterialBlock.js +35 -35
- package/Materials/Node/nodeMaterialBlock.js.map +1 -1
- package/Materials/Node/nodeMaterialBlockConnectionPoint.js +50 -50
- package/Materials/Node/nodeMaterialBlockConnectionPoint.js.map +1 -1
- package/Materials/PBR/pbrAnisotropicConfiguration.js +5 -5
- package/Materials/PBR/pbrAnisotropicConfiguration.js.map +1 -1
- package/Materials/PBR/pbrBRDFConfiguration.js +4 -4
- package/Materials/PBR/pbrBRDFConfiguration.js.map +1 -1
- package/Materials/PBR/pbrBaseMaterial.js +52 -52
- package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
- package/Materials/PBR/pbrBaseSimpleMaterial.js +17 -17
- package/Materials/PBR/pbrBaseSimpleMaterial.js.map +1 -1
- package/Materials/PBR/pbrClearCoatConfiguration.js +5 -5
- package/Materials/PBR/pbrClearCoatConfiguration.js.map +1 -1
- package/Materials/PBR/pbrIridescenceConfiguration.js +5 -5
- package/Materials/PBR/pbrIridescenceConfiguration.js.map +1 -1
- package/Materials/PBR/pbrMaterial.js +209 -209
- package/Materials/PBR/pbrMaterial.js.map +1 -1
- package/Materials/PBR/pbrSheenConfiguration.js +5 -5
- package/Materials/PBR/pbrSheenConfiguration.js.map +1 -1
- package/Materials/PBR/pbrSpecularGlossinessMaterial.js +6 -6
- package/Materials/PBR/pbrSpecularGlossinessMaterial.js.map +1 -1
- package/Materials/PBR/pbrSubSurfaceConfiguration.js +51 -51
- package/Materials/PBR/pbrSubSurfaceConfiguration.js.map +1 -1
- package/Materials/Textures/baseTexture.js +99 -99
- package/Materials/Textures/baseTexture.js.map +1 -1
- package/Materials/Textures/cubeTexture.js +61 -61
- package/Materials/Textures/cubeTexture.js.map +1 -1
- package/Materials/Textures/externalTexture.js +16 -16
- package/Materials/Textures/externalTexture.js.map +1 -1
- package/Materials/Textures/hdrCubeTexture.js +44 -44
- package/Materials/Textures/hdrCubeTexture.js.map +1 -1
- package/Materials/Textures/internalTexture.js +31 -31
- package/Materials/Textures/internalTexture.js.map +1 -1
- package/Materials/Textures/mirrorTexture.js +73 -73
- package/Materials/Textures/mirrorTexture.js.map +1 -1
- package/Materials/Textures/multiRenderTarget.js +47 -47
- package/Materials/Textures/multiRenderTarget.js.map +1 -1
- package/Materials/Textures/rawTexture2DArray.js +6 -6
- package/Materials/Textures/rawTexture2DArray.js.map +1 -1
- package/Materials/Textures/renderTargetTexture.js +142 -142
- package/Materials/Textures/renderTargetTexture.js.map +1 -1
- package/Materials/Textures/texture.d.ts +1 -1
- package/Materials/Textures/texture.js +26 -26
- package/Materials/Textures/texture.js.map +1 -1
- package/Materials/Textures/textureCreationOptions.d.ts +1 -1
- package/Materials/Textures/textureSampler.js +20 -20
- package/Materials/Textures/textureSampler.js.map +1 -1
- package/Materials/Textures/thinRenderTargetTexture.js +6 -6
- package/Materials/Textures/thinRenderTargetTexture.js.map +1 -1
- package/Materials/Textures/thinTexture.js +39 -39
- package/Materials/Textures/thinTexture.js.map +1 -1
- package/Materials/Textures/videoTexture.d.ts +1 -0
- package/Materials/Textures/videoTexture.js +59 -48
- package/Materials/Textures/videoTexture.js.map +1 -1
- package/Materials/drawWrapper.js +6 -6
- package/Materials/drawWrapper.js.map +1 -1
- package/Materials/effect.js +18 -18
- package/Materials/effect.js.map +1 -1
- package/Materials/effectRenderer.js +9 -9
- package/Materials/effectRenderer.js.map +1 -1
- package/Materials/fresnelParameters.d.ts +2 -2
- package/Materials/fresnelParameters.js +13 -13
- package/Materials/fresnelParameters.js.map +1 -1
- package/Materials/material.detailMapConfiguration.js +5 -5
- package/Materials/material.detailMapConfiguration.js.map +1 -1
- package/Materials/material.js +223 -223
- package/Materials/material.js.map +1 -1
- package/Materials/materialPluginBase.js +5 -5
- package/Materials/materialPluginBase.js.map +1 -1
- package/Materials/materialPluginEvent.d.ts +14 -14
- package/Materials/materialPluginManager.d.ts +1 -1
- package/Materials/multiMaterial.js +16 -16
- package/Materials/multiMaterial.js.map +1 -1
- package/Materials/shadowDepthWrapper.js +14 -14
- package/Materials/shadowDepthWrapper.js.map +1 -1
- package/Materials/standardMaterial.js +100 -100
- package/Materials/standardMaterial.js.map +1 -1
- package/Materials/uniformBufferEffectCommonAccessor.js +3 -3
- package/Materials/uniformBufferEffectCommonAccessor.js.map +1 -1
- package/Maths/math.functions.js +2 -0
- package/Maths/math.functions.js.map +1 -1
- package/Maths/math.path.js +11 -11
- package/Maths/math.path.js.map +1 -1
- package/Maths/math.vector.d.ts +6 -7
- package/Maths/math.vector.js +48 -48
- package/Maths/math.vector.js.map +1 -1
- package/Meshes/Builders/goldbergBuilder.d.ts +2 -2
- package/Meshes/Compression/dracoCompression.js +23 -23
- package/Meshes/Compression/dracoCompression.js.map +1 -1
- package/Meshes/Compression/meshoptCompression.js +9 -9
- package/Meshes/Compression/meshoptCompression.js.map +1 -1
- package/Meshes/abstractMesh.js +179 -179
- package/Meshes/abstractMesh.js.map +1 -1
- package/Meshes/geometry.js +32 -32
- package/Meshes/geometry.js.map +1 -1
- package/Meshes/goldbergMesh.d.ts +1 -1
- package/Meshes/linesMesh.js +3 -3
- package/Meshes/linesMesh.js.map +1 -1
- package/Meshes/mesh.js +165 -165
- package/Meshes/mesh.js.map +1 -1
- package/Meshes/mesh.vertexData.js.map +1 -1
- package/Meshes/polygonMesh.js +5 -5
- package/Meshes/polygonMesh.js.map +1 -1
- package/Meshes/subMesh.js +59 -59
- package/Meshes/subMesh.js.map +1 -1
- package/Meshes/transformNode.js +52 -52
- package/Meshes/transformNode.js.map +1 -1
- package/Misc/PerformanceViewer/performanceViewerCollectionStrategies.d.ts +1 -1
- package/Misc/PerformanceViewer/performanceViewerCollector.js +12 -12
- package/Misc/PerformanceViewer/performanceViewerCollector.js.map +1 -1
- package/Misc/arrayTools.d.ts +1 -1
- package/Misc/copyTextureToTexture.js +3 -3
- package/Misc/copyTextureToTexture.js.map +1 -1
- package/Misc/coroutine.d.ts +5 -5
- package/Misc/deferred.js +9 -9
- package/Misc/deferred.js.map +1 -1
- package/Misc/depthReducer.js +7 -7
- package/Misc/depthReducer.js.map +1 -1
- package/Misc/environmentTextureTools.d.ts +1 -1
- package/Misc/error.d.ts +1 -1
- package/Misc/fileTools.d.ts +5 -5
- package/Misc/filesInput.js +6 -6
- package/Misc/filesInput.js.map +1 -1
- package/Misc/khronosTextureContainer2.js +9 -9
- package/Misc/khronosTextureContainer2.js.map +1 -1
- package/Misc/observable.js +12 -12
- package/Misc/observable.js.map +1 -1
- package/Misc/perfCounter.js +16 -16
- package/Misc/perfCounter.js.map +1 -1
- package/Misc/sceneOptimizer.js +76 -76
- package/Misc/sceneOptimizer.js.map +1 -1
- package/Misc/stringDictionary.d.ts +1 -1
- package/Misc/trajectoryClassifier.js +67 -67
- package/Misc/trajectoryClassifier.js.map +1 -1
- package/Misc/videoRecorder.js +15 -15
- package/Misc/videoRecorder.js.map +1 -1
- package/Misc/virtualJoystick.js +12 -12
- package/Misc/virtualJoystick.js.map +1 -1
- package/Morph/morphTarget.js +28 -28
- package/Morph/morphTarget.js.map +1 -1
- package/Morph/morphTargetManager.js +18 -18
- package/Morph/morphTargetManager.js.map +1 -1
- package/Offline/database.js +12 -12
- package/Offline/database.js.map +1 -1
- package/Particles/EmitterTypes/coneParticleEmitter.js +25 -25
- package/Particles/EmitterTypes/coneParticleEmitter.js.map +1 -1
- package/Particles/EmitterTypes/meshParticleEmitter.js +20 -20
- package/Particles/EmitterTypes/meshParticleEmitter.js.map +1 -1
- package/Particles/baseParticleSystem.js +232 -232
- package/Particles/baseParticleSystem.js.map +1 -1
- package/Particles/cloudPoint.js +9 -9
- package/Particles/cloudPoint.js.map +1 -1
- package/Particles/gpuParticleSystem.js +123 -123
- package/Particles/gpuParticleSystem.js.map +1 -1
- package/Particles/particleSystem.js +102 -102
- package/Particles/particleSystem.js.map +1 -1
- package/Particles/pointsCloudSystem.js +18 -18
- package/Particles/pointsCloudSystem.js.map +1 -1
- package/Particles/solidParticle.js +23 -23
- package/Particles/solidParticle.js.map +1 -1
- package/Physics/index.d.ts +1 -0
- package/Physics/index.js +1 -0
- package/Physics/index.js.map +1 -1
- package/Physics/physicsHelper.d.ts +452 -1
- package/Physics/physicsHelper.js +877 -2
- package/Physics/physicsHelper.js.map +1 -1
- package/Physics/v1/index.d.ts +0 -1
- package/Physics/v1/index.js +0 -1
- package/Physics/v1/index.js.map +1 -1
- package/Physics/v1/physicsEngine.js +14 -14
- package/Physics/v1/physicsEngine.js.map +1 -1
- package/Physics/v1/physicsImpostor.js +149 -149
- package/Physics/v1/physicsImpostor.js.map +1 -1
- package/Physics/v2/IPhysicsEnginePlugin.d.ts +2 -1
- package/Physics/v2/IPhysicsEnginePlugin.js.map +1 -1
- package/Physics/v2/index.d.ts +1 -0
- package/Physics/v2/index.js +1 -0
- package/Physics/v2/index.js.map +1 -1
- package/Physics/v2/physicsAggregate.d.ts +18 -0
- package/Physics/v2/physicsAggregate.js +44 -2
- package/Physics/v2/physicsAggregate.js.map +1 -1
- package/Physics/v2/physicsBody.d.ts +22 -1
- package/Physics/v2/physicsBody.js +54 -1
- package/Physics/v2/physicsBody.js.map +1 -1
- package/Physics/v2/physicsEngine.d.ts +7 -2
- package/Physics/v2/physicsEngine.js +23 -16
- package/Physics/v2/physicsEngine.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js +129 -129
- package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js +68 -68
- package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssaoRenderingPipeline.js +6 -6
- package/PostProcesses/RenderPipeline/Pipelines/ssaoRenderingPipeline.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/standardRenderingPipeline.js +226 -225
- package/PostProcesses/RenderPipeline/Pipelines/standardRenderingPipeline.js.map +1 -1
- package/PostProcesses/RenderPipeline/postProcessRenderPipeline.js +10 -10
- package/PostProcesses/RenderPipeline/postProcessRenderPipeline.js.map +1 -1
- package/PostProcesses/anaglyphPostProcess.js +7 -7
- package/PostProcesses/anaglyphPostProcess.js.map +1 -1
- package/PostProcesses/blackAndWhitePostProcess.js +7 -7
- package/PostProcesses/blackAndWhitePostProcess.js.map +1 -1
- package/PostProcesses/bloomEffect.js +28 -28
- package/PostProcesses/bloomEffect.js.map +1 -1
- package/PostProcesses/bloomMergePostProcess.js +7 -7
- package/PostProcesses/bloomMergePostProcess.js.map +1 -1
- package/PostProcesses/blurPostProcess.js +32 -32
- package/PostProcesses/blurPostProcess.js.map +1 -1
- package/PostProcesses/chromaticAberrationPostProcess.js +7 -7
- package/PostProcesses/chromaticAberrationPostProcess.js.map +1 -1
- package/PostProcesses/circleOfConfusionPostProcess.js +7 -7
- package/PostProcesses/circleOfConfusionPostProcess.js.map +1 -1
- package/PostProcesses/colorCorrectionPostProcess.js +7 -7
- package/PostProcesses/colorCorrectionPostProcess.js.map +1 -1
- package/PostProcesses/convolutionPostProcess.js +7 -7
- package/PostProcesses/convolutionPostProcess.js.map +1 -1
- package/PostProcesses/depthOfFieldBlurPostProcess.js +7 -7
- package/PostProcesses/depthOfFieldBlurPostProcess.js.map +1 -1
- package/PostProcesses/depthOfFieldEffect.js +36 -36
- package/PostProcesses/depthOfFieldEffect.js.map +1 -1
- package/PostProcesses/depthOfFieldMergePostProcess.js +7 -7
- package/PostProcesses/depthOfFieldMergePostProcess.js.map +1 -1
- package/PostProcesses/extractHighlightsPostProcess.js +7 -7
- package/PostProcesses/extractHighlightsPostProcess.js.map +1 -1
- package/PostProcesses/filterPostProcess.js +7 -7
- package/PostProcesses/filterPostProcess.js.map +1 -1
- package/PostProcesses/grainPostProcess.js +7 -7
- package/PostProcesses/grainPostProcess.js.map +1 -1
- package/PostProcesses/imageProcessingPostProcess.js +42 -42
- package/PostProcesses/imageProcessingPostProcess.js.map +1 -1
- package/PostProcesses/motionBlurPostProcess.js +41 -41
- package/PostProcesses/motionBlurPostProcess.js.map +1 -1
- package/PostProcesses/passPostProcess.js +15 -15
- package/PostProcesses/passPostProcess.js.map +1 -1
- package/PostProcesses/postProcess.d.ts +2 -2
- package/PostProcesses/postProcess.js +123 -123
- package/PostProcesses/postProcess.js.map +1 -1
- package/PostProcesses/refractionPostProcess.js +21 -21
- package/PostProcesses/refractionPostProcess.js.map +1 -1
- package/PostProcesses/screenSpaceCurvaturePostProcess.js +7 -7
- package/PostProcesses/screenSpaceCurvaturePostProcess.js.map +1 -1
- package/PostProcesses/screenSpaceReflectionPostProcess.js +19 -19
- package/PostProcesses/screenSpaceReflectionPostProcess.js.map +1 -1
- package/PostProcesses/sharpenPostProcess.js +7 -7
- package/PostProcesses/sharpenPostProcess.js.map +1 -1
- package/PostProcesses/stereoscopicInterlacePostProcess.js +14 -14
- package/PostProcesses/stereoscopicInterlacePostProcess.js.map +1 -1
- package/PostProcesses/tonemapPostProcess.js +7 -7
- package/PostProcesses/tonemapPostProcess.js.map +1 -1
- package/PostProcesses/volumetricLightScatteringPostProcess.js +11 -11
- package/PostProcesses/volumetricLightScatteringPostProcess.js.map +1 -1
- package/PostProcesses/vrDistortionCorrectionPostProcess.js +7 -7
- package/PostProcesses/vrDistortionCorrectionPostProcess.js.map +1 -1
- package/Rendering/depthPeelingRenderer.js +36 -36
- package/Rendering/depthPeelingRenderer.js.map +1 -1
- package/Rendering/depthRenderer.js +8 -8
- package/Rendering/depthRenderer.js.map +1 -1
- package/Rendering/edgesRenderer.js +34 -34
- package/Rendering/edgesRenderer.js.map +1 -1
- package/Rendering/fluidRenderer/fluidRenderer.js +8 -8
- package/Rendering/fluidRenderer/fluidRenderer.js.map +1 -1
- package/Rendering/fluidRenderer/fluidRenderingDepthTextureCopy.js +3 -3
- package/Rendering/fluidRenderer/fluidRenderingDepthTextureCopy.js.map +1 -1
- package/Rendering/fluidRenderer/fluidRenderingObject.js +19 -19
- package/Rendering/fluidRenderer/fluidRenderingObject.js.map +1 -1
- package/Rendering/fluidRenderer/fluidRenderingObjectCustomParticles.js +12 -12
- package/Rendering/fluidRenderer/fluidRenderingObjectCustomParticles.js.map +1 -1
- package/Rendering/fluidRenderer/fluidRenderingObjectParticleSystem.js +18 -18
- package/Rendering/fluidRenderer/fluidRenderingObjectParticleSystem.js.map +1 -1
- package/Rendering/fluidRenderer/fluidRenderingTargetRenderer.js +68 -68
- package/Rendering/fluidRenderer/fluidRenderingTargetRenderer.js.map +1 -1
- package/Rendering/fluidRenderer/fluidRenderingTextures.js +29 -29
- package/Rendering/fluidRenderer/fluidRenderingTextures.js.map +1 -1
- package/Rendering/geometryBufferRenderer.js +44 -44
- package/Rendering/geometryBufferRenderer.js.map +1 -1
- package/Rendering/prePassRenderer.js +51 -51
- package/Rendering/prePassRenderer.js.map +1 -1
- package/Rendering/renderingGroup.js +25 -25
- package/Rendering/renderingGroup.js.map +1 -1
- package/Rendering/renderingManager.js +21 -21
- package/Rendering/renderingManager.js.map +1 -1
- package/Rendering/subSurfaceConfiguration.js +18 -18
- package/Rendering/subSurfaceConfiguration.js.map +1 -1
- package/Rendering/utilityLayerRenderer.js +76 -76
- package/Rendering/utilityLayerRenderer.js.map +1 -1
- package/Shaders/ShadersInclude/bumpFragmentMainFunctions.js +4 -1
- package/Shaders/ShadersInclude/bumpFragmentMainFunctions.js.map +1 -1
- package/Sprites/sprite.js +16 -16
- package/Sprites/sprite.js.map +1 -1
- package/Sprites/spriteManager.js +81 -81
- package/Sprites/spriteManager.js.map +1 -1
- package/Sprites/spriteMap.js +32 -32
- package/Sprites/spriteMap.js.map +1 -1
- package/Sprites/spriteRenderer.js +6 -6
- package/Sprites/spriteRenderer.js.map +1 -1
- package/Sprites/thinSprite.js +22 -22
- package/Sprites/thinSprite.js.map +1 -1
- package/States/stencilStateComposer.js +10 -10
- package/States/stencilStateComposer.js.map +1 -1
- package/XR/features/WebXRAnchorSystem.js +7 -7
- package/XR/features/WebXRAnchorSystem.js.map +1 -1
- package/XR/features/WebXRControllerMovement.d.ts +3 -3
- package/XR/features/WebXRControllerMovement.js +97 -97
- package/XR/features/WebXRControllerMovement.js.map +1 -1
- package/XR/features/WebXRControllerPhysics.js +24 -24
- package/XR/features/WebXRControllerPhysics.js.map +1 -1
- package/XR/features/WebXRControllerTeleportation.js +26 -26
- package/XR/features/WebXRControllerTeleportation.js.map +1 -1
- package/XR/features/WebXRDOMOverlay.d.ts +1 -1
- package/XR/features/WebXRFeaturePointSystem.js +6 -6
- package/XR/features/WebXRFeaturePointSystem.js.map +1 -1
- package/XR/features/WebXRHandTracking.d.ts +1 -1
- package/XR/features/WebXRHandTracking.js +95 -95
- package/XR/features/WebXRHandTracking.js.map +1 -1
- package/XR/features/WebXRWalkingLocomotion.js +21 -21
- package/XR/features/WebXRWalkingLocomotion.js.map +1 -1
- package/XR/motionController/webXRAbstractMotionController.d.ts +3 -3
- package/XR/motionController/webXRMotionControllerManager.d.ts +1 -1
- package/XR/native/nativeXRFrame.js +3 -3
- package/XR/native/nativeXRFrame.js.map +1 -1
- package/XR/webXRFeaturesManager.d.ts +1 -1
- package/XR/webXRLayerWrapper.d.ts +2 -2
- package/XR/webXRLayerWrapper.js +17 -17
- package/XR/webXRLayerWrapper.js.map +1 -1
- package/abstractScene.d.ts +2 -2
- package/node.d.ts +1 -1
- package/node.js +71 -71
- package/node.js.map +1 -1
- package/package.json +1 -1
- package/scene.js +777 -777
- package/scene.js.map +1 -1
- package/sceneComponent.d.ts +12 -12
- package/types.d.ts +11 -11
- package/Physics/v1/physicsHelper.d.ts +0 -411
- package/Physics/v1/physicsHelper.js +0 -709
- package/Physics/v1/physicsHelper.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"physicsHelper.js","sourceRoot":"","sources":["../../../../lts/core/generated/Physics/physicsHelper.ts"],"names":[],"mappings":"AAAA,qBAAqB;AACrB,cAAc,oBAAoB,CAAC","sourcesContent":["// ES 6 Compatibility\r\nexport * from \"./v1/physicsHelper\";\r\n"]}
|
|
1
|
+
{"version":3,"file":"physicsHelper.js","sourceRoot":"","sources":["../../../../lts/core/generated/Physics/physicsHelper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAG/C,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO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I;;WAEG;QACH,WAAM,GAAW,CAAC,CAAC;QAEnB;;WAEG;QACH,aAAQ,GAAW,EAAE,CAAC;QAEtB;;WAEG;QACH,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 { 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\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 const affectedBodiesWithData = Array<PhysicsAffectedBodyWithData>();\r\n const bodies = (<PhysicsEngineV2>this._physicsEngine).getBodies();\r\n bodies.forEach((body: PhysicsBody) => {\r\n if (!event.getBodyHitData(body, origin, hitData)) {\r\n return;\r\n }\r\n\r\n body.applyImpulse(hitData.force, hitData.contactPoint);\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 event.triggerAffectedBodiesCallback(affectedBodiesWithData);\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 const affectedBodiesWithData = Array<PhysicsAffectedBodyWithData>();\r\n const bodies = (<PhysicsEngineV2>this._physicsEngine).getBodies();\r\n bodies.forEach((body: PhysicsBody) => {\r\n if (!event.getBodyHitData(body, origin, hitData)) {\r\n return;\r\n }\r\n\r\n body.applyForce(hitData.force, hitData.contactPoint);\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 event.triggerAffectedBodiesCallback(affectedBodiesWithData);\r\n }\r\n\r\n event.dispose(false);\r\n\r\n return event;\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 };\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(private _scene: Scene, private _options: PhysicsRadialExplosionEventOptions) {\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 = center.subtract(origin);\r\n\r\n const ray = new Ray(origin, direction, this._options.radius);\r\n const hit = ray.intersectsMesh(mesh);\r\n\r\n const contactPoint = hit.pickedPoint;\r\n if (!contactPoint) {\r\n return false;\r\n }\r\n\r\n const distanceFromOrigin = Vector3.Distance(origin, contactPoint);\r\n\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 const force = direction.multiplyByFloats(multiplier, multiplier, multiplier);\r\n\r\n data.force = force;\r\n data.contactPoint = 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\r\n * @param origin the origin of the explosion\r\n * @returns A physics force and contact point, or null\r\n */\r\n public getBodyHitData(body: PhysicsBody, origin: Vector3, data: PhysicsHitData): boolean {\r\n if (body.transformNode.getClassName() !== \"Mesh\" && body.transformNode.getClassName() !== \"InstancedMesh\") {\r\n return false;\r\n }\r\n\r\n const mesh = body.transformNode as AbstractMesh;\r\n if (!this._intersectsWithSphere(mesh, origin, this._options.radius)) {\r\n return false;\r\n }\r\n\r\n const bodyObjectCenter = body.getObjectCenter();\r\n this._getHitData(mesh, bodyObjectCenter, origin, data);\r\n return true;\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 * @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 (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 /*** 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(private _physicsHelper: PhysicsHelper, private _scene: Scene, private _origin: Vector3, private _options: PhysicsRadialExplosionEventOptions) {\r\n this._options = { ...new PhysicsRadialExplosionEventOptions(), ...this._options };\r\n\r\n this._tickCallback = this._tick.bind(this);\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 (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;\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(private _scene: Scene, private _origin: Vector3, private _options: PhysicsUpdraftEventOptions) {\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.bind(this);\r\n\r\n this._prepareCylinder();\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 } 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(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 = force;\r\n data.contactPoint = center;\r\n data.distanceFromOrigin = distanceFromOrigin;\r\n }\r\n\r\n private _getBodyHitData(body: PhysicsBody, data: PhysicsHitData): boolean {\r\n if (body.transformNode.getClassName() !== \"Mesh\" && body.transformNode.getClassName() !== \"InstancedMesh\") {\r\n return false;\r\n }\r\n const bodyObject = body.transformNode as AbstractMesh;\r\n if (!this._intersectsWithCylinder(bodyObject)) {\r\n return false;\r\n }\r\n\r\n const center = body.getObjectCenter();\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 if (!this._getBodyHitData(body, hitData)) {\r\n return;\r\n }\r\n\r\n body.applyForce(hitData.force, hitData.contactPoint);\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 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(private _scene: Scene, private _origin: Vector3, private _options: PhysicsVortexEventOptions) {\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.bind(this);\r\n\r\n this._prepareCylinder();\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 (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 = center.subtract(originOnPlane);\r\n\r\n const ray = new Ray(originOnPlane, originToImpostorDirection, this._options.radius);\r\n const hit = ray.intersectsMesh(mesh);\r\n const contactPoint = hit.pickedPoint;\r\n if (!contactPoint) {\r\n return false;\r\n }\r\n const absoluteDistanceFromOrigin = hit.distance / this._options.radius;\r\n\r\n let directionToOrigin = contactPoint.normalize();\r\n if (absoluteDistanceFromOrigin > this._options.centripetalForceThreshold) {\r\n directionToOrigin = directionToOrigin.negate();\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 let force = new Vector3(forceX, forceY, forceZ);\r\n force = force.multiplyByFloats(this._options.strength, this._options.strength, this._options.strength);\r\n\r\n data.force = force;\r\n data.contactPoint = center;\r\n data.distanceFromOrigin = absoluteDistanceFromOrigin;\r\n return true;\r\n }\r\n\r\n private _getBodyHitData(body: PhysicsBody, data: PhysicsHitData): boolean {\r\n if (body.transformNode.getClassName() !== \"Mesh\" && body.transformNode.getClassName() !== \"InstancedMesh\") {\r\n return false;\r\n }\r\n\r\n const bodyObject = body.transformNode as AbstractMesh;\r\n\r\n if (!this._intersectsWithCylinder(bodyObject)) {\r\n return false;\r\n }\r\n\r\n const bodyCenter = body.getObjectCenter();\r\n this._getHitData(bodyObject, bodyCenter, 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 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 if (!this._getBodyHitData(body, hitData)) {\r\n return;\r\n }\r\n\r\n body.applyForce(hitData.force, hitData.contactPoint);\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 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\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"]}
|
package/Physics/v1/index.d.ts
CHANGED
package/Physics/v1/index.js
CHANGED
package/Physics/v1/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Physics/v1/index.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC;AAChC,cAAc,0BAA0B,CAAC;AACzC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Physics/v1/index.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC;AAChC,cAAc,0BAA0B,CAAC;AACzC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC","sourcesContent":["/* eslint-disable import/no-internal-modules */\r\nexport * from \"./IPhysicsEnginePlugin\";\r\nexport * from \"./physicsEngine\";\r\nexport * from \"./physicsEngineComponent\";\r\nexport * from \"./physicsImpostor\";\r\nexport * from \"./physicsJoint\";\r\nexport * from \"./Plugins/index\";\r\n"]}
|
|
@@ -5,6 +5,20 @@ import { _WarnImport } from "../../Misc/devTools.js";
|
|
|
5
5
|
* @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine
|
|
6
6
|
*/
|
|
7
7
|
export class PhysicsEngine {
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
* @returns version
|
|
11
|
+
*/
|
|
12
|
+
getPluginVersion() {
|
|
13
|
+
return this._physicsPlugin.getPluginVersion();
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Factory used to create the default physics plugin.
|
|
17
|
+
* @returns The default physics plugin
|
|
18
|
+
*/
|
|
19
|
+
static DefaultPluginFactory() {
|
|
20
|
+
throw _WarnImport("CannonJSPlugin");
|
|
21
|
+
}
|
|
8
22
|
/**
|
|
9
23
|
* Creates a new Physics Engine
|
|
10
24
|
* @param gravity defines the gravity vector used by the simulation
|
|
@@ -26,20 +40,6 @@ export class PhysicsEngine {
|
|
|
26
40
|
this.setGravity(gravity);
|
|
27
41
|
this.setTimeStep();
|
|
28
42
|
}
|
|
29
|
-
/**
|
|
30
|
-
*
|
|
31
|
-
* @returns version
|
|
32
|
-
*/
|
|
33
|
-
getPluginVersion() {
|
|
34
|
-
return this._physicsPlugin.getPluginVersion();
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Factory used to create the default physics plugin.
|
|
38
|
-
* @returns The default physics plugin
|
|
39
|
-
*/
|
|
40
|
-
static DefaultPluginFactory() {
|
|
41
|
-
throw _WarnImport("CannonJSPlugin");
|
|
42
|
-
}
|
|
43
43
|
/**
|
|
44
44
|
* Sets the gravity vector used by the simulation
|
|
45
45
|
* @param gravity defines the gravity vector to use
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"physicsEngine.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Physics/v1/physicsEngine.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAMlD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElD;;;GAGG;AACH,MAAM,OAAO,aAAa;IA6BtB;;;;OAIG;IACH,YAAY,OAA0B,EAAU,iBAAuC,aAAa,CAAC,oBAAoB,EAAE;QAA3E,mBAAc,GAAd,cAAc,CAA6D;QAjC3H;;WAEG;QACK,eAAU,GAA2B,EAAE,CAAC;QACxC,YAAO,GAAgC,EAAE,CAAC;QAC1C,iBAAY,GAAW,CAAC,CAAC;QACzB,qBAAgB,GAAG,CAAC,CAAC;QA4BzB,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,WAAW,EAAE,EAAE;YACpC,MAAM,IAAI,KAAK,CAAC,iBAAiB,GAAG,IAAI,CAAC,cAAc,CAAC,IAAI,GAAG,oBAAoB,GAAG,kCAAkC,CAAC,CAAC;SAC7H;QACD,OAAO,GAAG,OAAO,IAAI,IAAI,OAAO,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QAC/C,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QACzB,IAAI,CAAC,WAAW,EAAE,CAAC;IACvB,CAAC;IA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AI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,WAAW,KAAK,IAAI,EAAE;gBACzC,OAAO,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;aAC7B;SACJ;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;;;;OAKG;IACI,OAAO,CAAC,IAAa,EAAE,EAAW;QACrC,OAAO,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IACjD,CAAC;IAED;;;;;OAKG;IACI,YAAY,CAAC,IAAa,EAAE,EAAW,EAAE,MAA4B;QACxE,OAAO,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC,IAAI,EAAE,EAAE,EAAE,MAAM,CAAC,CAAC;IAC9D,CAAC;CACJ","sourcesContent":["import type { Nullable } from \"../../types\";\r\nimport { Vector3 } from \"../../Maths/math.vector\";\r\nimport type { PhysicsImpostorJoint, IPhysicsEnginePlugin } from \"./IPhysicsEnginePlugin\";\r\nimport type { IPhysicsEngine } from \"../IPhysicsEngine\";\r\nimport type { PhysicsImpostor, IPhysicsEnabledObject } from \"./physicsImpostor\";\r\nimport type { PhysicsJoint } from \"./physicsJoint\";\r\nimport type { PhysicsRaycastResult } from \"../physicsRaycastResult\";\r\nimport { _WarnImport } from \"../../Misc/devTools\";\r\n\r\n/**\r\n * Class used to control physics engine\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine\r\n */\r\nexport class PhysicsEngine implements IPhysicsEngine {\r\n /**\r\n * Global value used to control the smallest number supported by the simulation\r\n */\r\n private _impostors: Array<PhysicsImpostor> = [];\r\n private _joints: Array<PhysicsImpostorJoint> = [];\r\n private _subTimeStep: number = 0;\r\n private _uniqueIdCounter = 0;\r\n\r\n /**\r\n * Gets the gravity vector used by the simulation\r\n */\r\n public gravity: Vector3;\r\n\r\n /**\r\n *\r\n * @returns version\r\n */\r\n public getPluginVersion(): number {\r\n return this._physicsPlugin.getPluginVersion();\r\n }\r\n /**\r\n * Factory used to create the default physics plugin.\r\n * @returns The default physics plugin\r\n */\r\n public static DefaultPluginFactory(): IPhysicsEnginePlugin {\r\n throw _WarnImport(\"CannonJSPlugin\");\r\n }\r\n\r\n /**\r\n * Creates a new Physics Engine\r\n * @param gravity defines the gravity vector used by the simulation\r\n * @param _physicsPlugin defines the plugin to use (CannonJS by default)\r\n */\r\n constructor(gravity: Nullable<Vector3>, private _physicsPlugin: IPhysicsEnginePlugin = PhysicsEngine.DefaultPluginFactory()) {\r\n if (!this._physicsPlugin.isSupported()) {\r\n throw new Error(\"Physics Engine \" + this._physicsPlugin.name + \" cannot be found. \" + \"Please make sure it is included.\");\r\n }\r\n gravity = gravity || new Vector3(0, -9.807, 0);\r\n this.setGravity(gravity);\r\n this.setTimeStep();\r\n }\r\n\r\n /**\r\n * Sets the gravity vector used by the simulation\r\n * @param gravity defines the gravity vector to use\r\n */\r\n public setGravity(gravity: Vector3): void {\r\n this.gravity = gravity;\r\n this._physicsPlugin.setGravity(this.gravity);\r\n }\r\n\r\n /**\r\n * Set the time step of the physics engine.\r\n * Default is 1/60.\r\n * To slow it down, enter 1/600 for example.\r\n * To speed it up, 1/30\r\n * @param newTimeStep defines the new timestep to apply to this world.\r\n */\r\n public setTimeStep(newTimeStep: number = 1 / 60) {\r\n this._physicsPlugin.setTimeStep(newTimeStep);\r\n }\r\n\r\n /**\r\n * Get the time step of the physics engine.\r\n * @returns the current time step\r\n */\r\n public getTimeStep(): number {\r\n return this._physicsPlugin.getTimeStep();\r\n }\r\n\r\n /**\r\n * Set the sub time step of the physics engine.\r\n * Default is 0 meaning there is no sub steps\r\n * To increase physics resolution precision, set a small value (like 1 ms)\r\n * @param subTimeStep defines the new sub timestep used for physics resolution.\r\n */\r\n public setSubTimeStep(subTimeStep: number = 0) {\r\n this._subTimeStep = subTimeStep;\r\n }\r\n\r\n /**\r\n * Get the sub time step of the physics engine.\r\n * @returns the current sub time step\r\n */\r\n public getSubTimeStep() {\r\n return this._subTimeStep;\r\n }\r\n\r\n /**\r\n * Release all resources\r\n */\r\n public dispose(): void {\r\n this._impostors.forEach(function (impostor) {\r\n impostor.dispose();\r\n });\r\n this._physicsPlugin.dispose();\r\n }\r\n\r\n /**\r\n * Gets the name of the current physics plugin\r\n * @returns the name of the plugin\r\n */\r\n public getPhysicsPluginName(): string {\r\n return this._physicsPlugin.name;\r\n }\r\n\r\n /**\r\n * Adding a new impostor for the impostor tracking.\r\n * This will be done by the impostor itself.\r\n * @param impostor the impostor to add\r\n */\r\n public addImpostor(impostor: PhysicsImpostor) {\r\n this._impostors.push(impostor);\r\n impostor.uniqueId = this._uniqueIdCounter++;\r\n //if no parent, generate the body\r\n if (!impostor.parent) {\r\n this._physicsPlugin.generatePhysicsBody(impostor);\r\n }\r\n }\r\n\r\n /**\r\n * Remove an impostor from the engine.\r\n * This impostor and its mesh will not longer be updated by the physics engine.\r\n * @param impostor the impostor to remove\r\n */\r\n public removeImpostor(impostor: PhysicsImpostor) {\r\n const index = this._impostors.indexOf(impostor);\r\n if (index > -1) {\r\n const removed = this._impostors.splice(index, 1);\r\n //Is it needed?\r\n if (removed.length) {\r\n this.getPhysicsPlugin().removePhysicsBody(impostor);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Add a joint to the physics engine\r\n * @param mainImpostor defines the main impostor to which the joint is added.\r\n * @param connectedImpostor defines the impostor that is connected to the main impostor using this joint\r\n * @param joint defines the joint that will connect both impostors.\r\n */\r\n public addJoint(mainImpostor: PhysicsImpostor, connectedImpostor: PhysicsImpostor, joint: PhysicsJoint) {\r\n const impostorJoint = {\r\n mainImpostor: mainImpostor,\r\n connectedImpostor: connectedImpostor,\r\n joint: joint,\r\n };\r\n joint.physicsPlugin = this._physicsPlugin;\r\n this._joints.push(impostorJoint);\r\n this._physicsPlugin.generateJoint(impostorJoint);\r\n }\r\n\r\n /**\r\n * Removes a joint from the simulation\r\n * @param mainImpostor defines the impostor used with the joint\r\n * @param connectedImpostor defines the other impostor connected to the main one by the joint\r\n * @param joint defines the joint to remove\r\n */\r\n public removeJoint(mainImpostor: PhysicsImpostor, connectedImpostor: PhysicsImpostor, joint: PhysicsJoint) {\r\n const matchingJoints = this._joints.filter(function (impostorJoint) {\r\n return impostorJoint.connectedImpostor === connectedImpostor && impostorJoint.joint === joint && impostorJoint.mainImpostor === mainImpostor;\r\n });\r\n if (matchingJoints.length) {\r\n this._physicsPlugin.removeJoint(matchingJoints[0]);\r\n //TODO remove it from the list as well\r\n }\r\n }\r\n\r\n /**\r\n * Called by the scene. No need to call it.\r\n * @param delta defines the timespan between frames\r\n */\r\n public _step(delta: number) {\r\n //check if any mesh has no body / requires an update\r\n this._impostors.forEach((impostor) => {\r\n if (impostor.isBodyInitRequired()) {\r\n this._physicsPlugin.generatePhysicsBody(impostor);\r\n }\r\n });\r\n\r\n if (delta > 0.1) {\r\n delta = 0.1;\r\n } else if (delta <= 0) {\r\n delta = 1.0 / 60.0;\r\n }\r\n\r\n this._physicsPlugin.executeStep(delta, this._impostors);\r\n }\r\n\r\n /**\r\n * Gets the current plugin used to run the simulation\r\n * @returns current plugin\r\n */\r\n public getPhysicsPlugin(): IPhysicsEnginePlugin {\r\n return this._physicsPlugin;\r\n }\r\n\r\n /**\r\n * Gets the list of physic impostors\r\n * @returns an array of PhysicsImpostor\r\n */\r\n public getImpostors(): Array<PhysicsImpostor> {\r\n return this._impostors;\r\n }\r\n\r\n /**\r\n * Gets the impostor for a physics enabled object\r\n * @param object defines the object impersonated by the impostor\r\n * @returns the PhysicsImpostor or null if not found\r\n */\r\n public getImpostorForPhysicsObject(object: IPhysicsEnabledObject): Nullable<PhysicsImpostor> {\r\n for (let i = 0; i < this._impostors.length; ++i) {\r\n if (this._impostors[i].object === object) {\r\n return this._impostors[i];\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Gets the impostor for a physics body object\r\n * @param body defines physics body used by the impostor\r\n * @returns the PhysicsImpostor or null if not found\r\n */\r\n public getImpostorWithPhysicsBody(body: any): Nullable<PhysicsImpostor> {\r\n for (let i = 0; i < this._impostors.length; ++i) {\r\n if (this._impostors[i].physicsBody === body) {\r\n return this._impostors[i];\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Does a raycast in the physics world\r\n * @param from when should the ray start?\r\n * @param to when should the ray end?\r\n * @returns PhysicsRaycastResult\r\n */\r\n public raycast(from: Vector3, to: Vector3): PhysicsRaycastResult {\r\n return this._physicsPlugin.raycast(from, to);\r\n }\r\n\r\n /**\r\n * Does a raycast in the physics world\r\n * @param from when should the ray start?\r\n * @param to when should the ray end?\r\n * @param result resulting PhysicsRaycastResult\r\n */\r\n public raycastToRef(from: Vector3, to: Vector3, result: PhysicsRaycastResult) {\r\n return this._physicsPlugin.raycastToRef(from, to, result);\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"physicsEngine.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Physics/v1/physicsEngine.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAMlD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElD;;;GAGG;AACH,MAAM,OAAO,aAAa;IActB;;;OAGG;IACI,gBAAgB;QACnB,OAAO,IAAI,CAAC,cAAc,CAAC,gBAAgB,EAAE,CAAC;IAClD,CAAC;IACD;;;OAGG;IACI,MAAM,CAAC,oBAAoB;QAC9B,MAAM,WAAW,CAAC,gBAAgB,CAAC,CAAC;IACxC,CAAC;IAED;;;;OAIG;IACH,YAAY,OAA0B,EAAU,iBAAuC,aAAa,CAAC,oBAAoB,EAAE;QAA3E,mBAAc,GAAd,cAAc,CAA6D;QAjC3H;;WAEG;QACK,eAAU,GAA2B,EAAE,CAAC;QACxC,YAAO,GAAgC,EAAE,CAAC;QAC1C,iBAAY,GAAW,CAAC,CAAC;QACzB,qBAAgB,GAAG,CAAC,CAAC;QA4BzB,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,WA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,CAAC,IAAS;QACvC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE;YAC7C,IAAI,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,WAAW,KAAK,IAAI,EAAE;gBACzC,OAAO,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;aAC7B;SACJ;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;;;;OAKG;IACI,OAAO,CAAC,IAAa,EAAE,EAAW;QACrC,OAAO,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IACjD,CAAC;IAED;;;;;OAKG;IACI,YAAY,CAAC,IAAa,EAAE,EAAW,EAAE,MAA4B;QACxE,OAAO,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC,IAAI,EAAE,EAAE,EAAE,MAAM,CAAC,CAAC;IAC9D,CAAC;CACJ","sourcesContent":["import type { Nullable } from \"../../types\";\r\nimport { Vector3 } from \"../../Maths/math.vector\";\r\nimport type { PhysicsImpostorJoint, IPhysicsEnginePlugin } from \"./IPhysicsEnginePlugin\";\r\nimport type { IPhysicsEngine } from \"../IPhysicsEngine\";\r\nimport type { PhysicsImpostor, IPhysicsEnabledObject } from \"./physicsImpostor\";\r\nimport type { PhysicsJoint } from \"./physicsJoint\";\r\nimport type { PhysicsRaycastResult } from \"../physicsRaycastResult\";\r\nimport { _WarnImport } from \"../../Misc/devTools\";\r\n\r\n/**\r\n * Class used to control physics engine\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine\r\n */\r\nexport class PhysicsEngine implements IPhysicsEngine {\r\n /**\r\n * Global value used to control the smallest number supported by the simulation\r\n */\r\n private _impostors: Array<PhysicsImpostor> = [];\r\n private _joints: Array<PhysicsImpostorJoint> = [];\r\n private _subTimeStep: number = 0;\r\n private _uniqueIdCounter = 0;\r\n\r\n /**\r\n * Gets the gravity vector used by the simulation\r\n */\r\n public gravity: Vector3;\r\n\r\n /**\r\n *\r\n * @returns version\r\n */\r\n public getPluginVersion(): number {\r\n return this._physicsPlugin.getPluginVersion();\r\n }\r\n /**\r\n * Factory used to create the default physics plugin.\r\n * @returns The default physics plugin\r\n */\r\n public static DefaultPluginFactory(): IPhysicsEnginePlugin {\r\n throw _WarnImport(\"CannonJSPlugin\");\r\n }\r\n\r\n /**\r\n * Creates a new Physics Engine\r\n * @param gravity defines the gravity vector used by the simulation\r\n * @param _physicsPlugin defines the plugin to use (CannonJS by default)\r\n */\r\n constructor(gravity: Nullable<Vector3>, private _physicsPlugin: IPhysicsEnginePlugin = PhysicsEngine.DefaultPluginFactory()) {\r\n if (!this._physicsPlugin.isSupported()) {\r\n throw new Error(\"Physics Engine \" + this._physicsPlugin.name + \" cannot be found. \" + \"Please make sure it is included.\");\r\n }\r\n gravity = gravity || new Vector3(0, -9.807, 0);\r\n this.setGravity(gravity);\r\n this.setTimeStep();\r\n }\r\n\r\n /**\r\n * Sets the gravity vector used by the simulation\r\n * @param gravity defines the gravity vector to use\r\n */\r\n public setGravity(gravity: Vector3): void {\r\n this.gravity = gravity;\r\n this._physicsPlugin.setGravity(this.gravity);\r\n }\r\n\r\n /**\r\n * Set the time step of the physics engine.\r\n * Default is 1/60.\r\n * To slow it down, enter 1/600 for example.\r\n * To speed it up, 1/30\r\n * @param newTimeStep defines the new timestep to apply to this world.\r\n */\r\n public setTimeStep(newTimeStep: number = 1 / 60) {\r\n this._physicsPlugin.setTimeStep(newTimeStep);\r\n }\r\n\r\n /**\r\n * Get the time step of the physics engine.\r\n * @returns the current time step\r\n */\r\n public getTimeStep(): number {\r\n return this._physicsPlugin.getTimeStep();\r\n }\r\n\r\n /**\r\n * Set the sub time step of the physics engine.\r\n * Default is 0 meaning there is no sub steps\r\n * To increase physics resolution precision, set a small value (like 1 ms)\r\n * @param subTimeStep defines the new sub timestep used for physics resolution.\r\n */\r\n public setSubTimeStep(subTimeStep: number = 0) {\r\n this._subTimeStep = subTimeStep;\r\n }\r\n\r\n /**\r\n * Get the sub time step of the physics engine.\r\n * @returns the current sub time step\r\n */\r\n public getSubTimeStep() {\r\n return this._subTimeStep;\r\n }\r\n\r\n /**\r\n * Release all resources\r\n */\r\n public dispose(): void {\r\n this._impostors.forEach(function (impostor) {\r\n impostor.dispose();\r\n });\r\n this._physicsPlugin.dispose();\r\n }\r\n\r\n /**\r\n * Gets the name of the current physics plugin\r\n * @returns the name of the plugin\r\n */\r\n public getPhysicsPluginName(): string {\r\n return this._physicsPlugin.name;\r\n }\r\n\r\n /**\r\n * Adding a new impostor for the impostor tracking.\r\n * This will be done by the impostor itself.\r\n * @param impostor the impostor to add\r\n */\r\n public addImpostor(impostor: PhysicsImpostor) {\r\n this._impostors.push(impostor);\r\n impostor.uniqueId = this._uniqueIdCounter++;\r\n //if no parent, generate the body\r\n if (!impostor.parent) {\r\n this._physicsPlugin.generatePhysicsBody(impostor);\r\n }\r\n }\r\n\r\n /**\r\n * Remove an impostor from the engine.\r\n * This impostor and its mesh will not longer be updated by the physics engine.\r\n * @param impostor the impostor to remove\r\n */\r\n public removeImpostor(impostor: PhysicsImpostor) {\r\n const index = this._impostors.indexOf(impostor);\r\n if (index > -1) {\r\n const removed = this._impostors.splice(index, 1);\r\n //Is it needed?\r\n if (removed.length) {\r\n this.getPhysicsPlugin().removePhysicsBody(impostor);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Add a joint to the physics engine\r\n * @param mainImpostor defines the main impostor to which the joint is added.\r\n * @param connectedImpostor defines the impostor that is connected to the main impostor using this joint\r\n * @param joint defines the joint that will connect both impostors.\r\n */\r\n public addJoint(mainImpostor: PhysicsImpostor, connectedImpostor: PhysicsImpostor, joint: PhysicsJoint) {\r\n const impostorJoint = {\r\n mainImpostor: mainImpostor,\r\n connectedImpostor: connectedImpostor,\r\n joint: joint,\r\n };\r\n joint.physicsPlugin = this._physicsPlugin;\r\n this._joints.push(impostorJoint);\r\n this._physicsPlugin.generateJoint(impostorJoint);\r\n }\r\n\r\n /**\r\n * Removes a joint from the simulation\r\n * @param mainImpostor defines the impostor used with the joint\r\n * @param connectedImpostor defines the other impostor connected to the main one by the joint\r\n * @param joint defines the joint to remove\r\n */\r\n public removeJoint(mainImpostor: PhysicsImpostor, connectedImpostor: PhysicsImpostor, joint: PhysicsJoint) {\r\n const matchingJoints = this._joints.filter(function (impostorJoint) {\r\n return impostorJoint.connectedImpostor === connectedImpostor && impostorJoint.joint === joint && impostorJoint.mainImpostor === mainImpostor;\r\n });\r\n if (matchingJoints.length) {\r\n this._physicsPlugin.removeJoint(matchingJoints[0]);\r\n //TODO remove it from the list as well\r\n }\r\n }\r\n\r\n /**\r\n * Called by the scene. No need to call it.\r\n * @param delta defines the timespan between frames\r\n */\r\n public _step(delta: number) {\r\n //check if any mesh has no body / requires an update\r\n this._impostors.forEach((impostor) => {\r\n if (impostor.isBodyInitRequired()) {\r\n this._physicsPlugin.generatePhysicsBody(impostor);\r\n }\r\n });\r\n\r\n if (delta > 0.1) {\r\n delta = 0.1;\r\n } else if (delta <= 0) {\r\n delta = 1.0 / 60.0;\r\n }\r\n\r\n this._physicsPlugin.executeStep(delta, this._impostors);\r\n }\r\n\r\n /**\r\n * Gets the current plugin used to run the simulation\r\n * @returns current plugin\r\n */\r\n public getPhysicsPlugin(): IPhysicsEnginePlugin {\r\n return this._physicsPlugin;\r\n }\r\n\r\n /**\r\n * Gets the list of physic impostors\r\n * @returns an array of PhysicsImpostor\r\n */\r\n public getImpostors(): Array<PhysicsImpostor> {\r\n return this._impostors;\r\n }\r\n\r\n /**\r\n * Gets the impostor for a physics enabled object\r\n * @param object defines the object impersonated by the impostor\r\n * @returns the PhysicsImpostor or null if not found\r\n */\r\n public getImpostorForPhysicsObject(object: IPhysicsEnabledObject): Nullable<PhysicsImpostor> {\r\n for (let i = 0; i < this._impostors.length; ++i) {\r\n if (this._impostors[i].object === object) {\r\n return this._impostors[i];\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Gets the impostor for a physics body object\r\n * @param body defines physics body used by the impostor\r\n * @returns the PhysicsImpostor or null if not found\r\n */\r\n public getImpostorWithPhysicsBody(body: any): Nullable<PhysicsImpostor> {\r\n for (let i = 0; i < this._impostors.length; ++i) {\r\n if (this._impostors[i].physicsBody === body) {\r\n return this._impostors[i];\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Does a raycast in the physics world\r\n * @param from when should the ray start?\r\n * @param to when should the ray end?\r\n * @returns PhysicsRaycastResult\r\n */\r\n public raycast(from: Vector3, to: Vector3): PhysicsRaycastResult {\r\n return this._physicsPlugin.raycast(from, to);\r\n }\r\n\r\n /**\r\n * Does a raycast in the physics world\r\n * @param from when should the ray start?\r\n * @param to when should the ray end?\r\n * @param result resulting PhysicsRaycastResult\r\n */\r\n public raycastToRef(from: Vector3, to: Vector3, result: PhysicsRaycastResult) {\r\n return this._physicsPlugin.raycastToRef(from, to, result);\r\n }\r\n}\r\n"]}
|
|
@@ -17,6 +17,155 @@ Mesh._PhysicsImpostorParser = function (scene, physicObject, jsonObject) {
|
|
|
17
17
|
* @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine
|
|
18
18
|
*/
|
|
19
19
|
export class PhysicsImpostor {
|
|
20
|
+
/**
|
|
21
|
+
* Specifies if the physics imposter is disposed
|
|
22
|
+
*/
|
|
23
|
+
get isDisposed() {
|
|
24
|
+
return this._isDisposed;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Gets the mass of the physics imposter
|
|
28
|
+
*/
|
|
29
|
+
get mass() {
|
|
30
|
+
return this._physicsEngine ? this._physicsEngine.getPhysicsPlugin().getBodyMass(this) : 0;
|
|
31
|
+
}
|
|
32
|
+
set mass(value) {
|
|
33
|
+
this.setMass(value);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Gets the coefficient of friction
|
|
37
|
+
*/
|
|
38
|
+
get friction() {
|
|
39
|
+
return this._physicsEngine ? this._physicsEngine.getPhysicsPlugin().getBodyFriction(this) : 0;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Sets the coefficient of friction
|
|
43
|
+
*/
|
|
44
|
+
set friction(value) {
|
|
45
|
+
if (!this._physicsEngine) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
this._physicsEngine.getPhysicsPlugin().setBodyFriction(this, value);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Gets the coefficient of restitution
|
|
52
|
+
*/
|
|
53
|
+
get restitution() {
|
|
54
|
+
return this._physicsEngine ? this._physicsEngine.getPhysicsPlugin().getBodyRestitution(this) : 0;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Sets the coefficient of restitution
|
|
58
|
+
*/
|
|
59
|
+
set restitution(value) {
|
|
60
|
+
if (!this._physicsEngine) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
this._physicsEngine.getPhysicsPlugin().setBodyRestitution(this, value);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Gets the pressure of a soft body; only supported by the AmmoJSPlugin
|
|
67
|
+
*/
|
|
68
|
+
get pressure() {
|
|
69
|
+
if (!this._physicsEngine) {
|
|
70
|
+
return 0;
|
|
71
|
+
}
|
|
72
|
+
const plugin = this._physicsEngine.getPhysicsPlugin();
|
|
73
|
+
if (!plugin.setBodyPressure) {
|
|
74
|
+
return 0;
|
|
75
|
+
}
|
|
76
|
+
return plugin.getBodyPressure(this);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Sets the pressure of a soft body; only supported by the AmmoJSPlugin
|
|
80
|
+
*/
|
|
81
|
+
set pressure(value) {
|
|
82
|
+
if (!this._physicsEngine) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
const plugin = this._physicsEngine.getPhysicsPlugin();
|
|
86
|
+
if (!plugin.setBodyPressure) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
plugin.setBodyPressure(this, value);
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Gets the stiffness of a soft body; only supported by the AmmoJSPlugin
|
|
93
|
+
*/
|
|
94
|
+
get stiffness() {
|
|
95
|
+
if (!this._physicsEngine) {
|
|
96
|
+
return 0;
|
|
97
|
+
}
|
|
98
|
+
const plugin = this._physicsEngine.getPhysicsPlugin();
|
|
99
|
+
if (!plugin.getBodyStiffness) {
|
|
100
|
+
return 0;
|
|
101
|
+
}
|
|
102
|
+
return plugin.getBodyStiffness(this);
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Sets the stiffness of a soft body; only supported by the AmmoJSPlugin
|
|
106
|
+
*/
|
|
107
|
+
set stiffness(value) {
|
|
108
|
+
if (!this._physicsEngine) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
const plugin = this._physicsEngine.getPhysicsPlugin();
|
|
112
|
+
if (!plugin.setBodyStiffness) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
plugin.setBodyStiffness(this, value);
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Gets the velocityIterations of a soft body; only supported by the AmmoJSPlugin
|
|
119
|
+
*/
|
|
120
|
+
get velocityIterations() {
|
|
121
|
+
if (!this._physicsEngine) {
|
|
122
|
+
return 0;
|
|
123
|
+
}
|
|
124
|
+
const plugin = this._physicsEngine.getPhysicsPlugin();
|
|
125
|
+
if (!plugin.getBodyVelocityIterations) {
|
|
126
|
+
return 0;
|
|
127
|
+
}
|
|
128
|
+
return plugin.getBodyVelocityIterations(this);
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Sets the velocityIterations of a soft body; only supported by the AmmoJSPlugin
|
|
132
|
+
*/
|
|
133
|
+
set velocityIterations(value) {
|
|
134
|
+
if (!this._physicsEngine) {
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
const plugin = this._physicsEngine.getPhysicsPlugin();
|
|
138
|
+
if (!plugin.setBodyVelocityIterations) {
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
plugin.setBodyVelocityIterations(this, value);
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Gets the positionIterations of a soft body; only supported by the AmmoJSPlugin
|
|
145
|
+
*/
|
|
146
|
+
get positionIterations() {
|
|
147
|
+
if (!this._physicsEngine) {
|
|
148
|
+
return 0;
|
|
149
|
+
}
|
|
150
|
+
const plugin = this._physicsEngine.getPhysicsPlugin();
|
|
151
|
+
if (!plugin.getBodyPositionIterations) {
|
|
152
|
+
return 0;
|
|
153
|
+
}
|
|
154
|
+
return plugin.getBodyPositionIterations(this);
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Sets the positionIterations of a soft body; only supported by the AmmoJSPlugin
|
|
158
|
+
*/
|
|
159
|
+
set positionIterations(value) {
|
|
160
|
+
if (!this._physicsEngine) {
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
const plugin = this._physicsEngine.getPhysicsPlugin();
|
|
164
|
+
if (!plugin.setBodyPositionIterations) {
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
plugin.setBodyPositionIterations(this, value);
|
|
168
|
+
}
|
|
20
169
|
/**
|
|
21
170
|
* Initializes the physics imposter
|
|
22
171
|
* @param object The physics-enabled object used as the physics imposter
|
|
@@ -204,155 +353,6 @@ export class PhysicsImpostor {
|
|
|
204
353
|
}
|
|
205
354
|
}
|
|
206
355
|
}
|
|
207
|
-
/**
|
|
208
|
-
* Specifies if the physics imposter is disposed
|
|
209
|
-
*/
|
|
210
|
-
get isDisposed() {
|
|
211
|
-
return this._isDisposed;
|
|
212
|
-
}
|
|
213
|
-
/**
|
|
214
|
-
* Gets the mass of the physics imposter
|
|
215
|
-
*/
|
|
216
|
-
get mass() {
|
|
217
|
-
return this._physicsEngine ? this._physicsEngine.getPhysicsPlugin().getBodyMass(this) : 0;
|
|
218
|
-
}
|
|
219
|
-
set mass(value) {
|
|
220
|
-
this.setMass(value);
|
|
221
|
-
}
|
|
222
|
-
/**
|
|
223
|
-
* Gets the coefficient of friction
|
|
224
|
-
*/
|
|
225
|
-
get friction() {
|
|
226
|
-
return this._physicsEngine ? this._physicsEngine.getPhysicsPlugin().getBodyFriction(this) : 0;
|
|
227
|
-
}
|
|
228
|
-
/**
|
|
229
|
-
* Sets the coefficient of friction
|
|
230
|
-
*/
|
|
231
|
-
set friction(value) {
|
|
232
|
-
if (!this._physicsEngine) {
|
|
233
|
-
return;
|
|
234
|
-
}
|
|
235
|
-
this._physicsEngine.getPhysicsPlugin().setBodyFriction(this, value);
|
|
236
|
-
}
|
|
237
|
-
/**
|
|
238
|
-
* Gets the coefficient of restitution
|
|
239
|
-
*/
|
|
240
|
-
get restitution() {
|
|
241
|
-
return this._physicsEngine ? this._physicsEngine.getPhysicsPlugin().getBodyRestitution(this) : 0;
|
|
242
|
-
}
|
|
243
|
-
/**
|
|
244
|
-
* Sets the coefficient of restitution
|
|
245
|
-
*/
|
|
246
|
-
set restitution(value) {
|
|
247
|
-
if (!this._physicsEngine) {
|
|
248
|
-
return;
|
|
249
|
-
}
|
|
250
|
-
this._physicsEngine.getPhysicsPlugin().setBodyRestitution(this, value);
|
|
251
|
-
}
|
|
252
|
-
/**
|
|
253
|
-
* Gets the pressure of a soft body; only supported by the AmmoJSPlugin
|
|
254
|
-
*/
|
|
255
|
-
get pressure() {
|
|
256
|
-
if (!this._physicsEngine) {
|
|
257
|
-
return 0;
|
|
258
|
-
}
|
|
259
|
-
const plugin = this._physicsEngine.getPhysicsPlugin();
|
|
260
|
-
if (!plugin.setBodyPressure) {
|
|
261
|
-
return 0;
|
|
262
|
-
}
|
|
263
|
-
return plugin.getBodyPressure(this);
|
|
264
|
-
}
|
|
265
|
-
/**
|
|
266
|
-
* Sets the pressure of a soft body; only supported by the AmmoJSPlugin
|
|
267
|
-
*/
|
|
268
|
-
set pressure(value) {
|
|
269
|
-
if (!this._physicsEngine) {
|
|
270
|
-
return;
|
|
271
|
-
}
|
|
272
|
-
const plugin = this._physicsEngine.getPhysicsPlugin();
|
|
273
|
-
if (!plugin.setBodyPressure) {
|
|
274
|
-
return;
|
|
275
|
-
}
|
|
276
|
-
plugin.setBodyPressure(this, value);
|
|
277
|
-
}
|
|
278
|
-
/**
|
|
279
|
-
* Gets the stiffness of a soft body; only supported by the AmmoJSPlugin
|
|
280
|
-
*/
|
|
281
|
-
get stiffness() {
|
|
282
|
-
if (!this._physicsEngine) {
|
|
283
|
-
return 0;
|
|
284
|
-
}
|
|
285
|
-
const plugin = this._physicsEngine.getPhysicsPlugin();
|
|
286
|
-
if (!plugin.getBodyStiffness) {
|
|
287
|
-
return 0;
|
|
288
|
-
}
|
|
289
|
-
return plugin.getBodyStiffness(this);
|
|
290
|
-
}
|
|
291
|
-
/**
|
|
292
|
-
* Sets the stiffness of a soft body; only supported by the AmmoJSPlugin
|
|
293
|
-
*/
|
|
294
|
-
set stiffness(value) {
|
|
295
|
-
if (!this._physicsEngine) {
|
|
296
|
-
return;
|
|
297
|
-
}
|
|
298
|
-
const plugin = this._physicsEngine.getPhysicsPlugin();
|
|
299
|
-
if (!plugin.setBodyStiffness) {
|
|
300
|
-
return;
|
|
301
|
-
}
|
|
302
|
-
plugin.setBodyStiffness(this, value);
|
|
303
|
-
}
|
|
304
|
-
/**
|
|
305
|
-
* Gets the velocityIterations of a soft body; only supported by the AmmoJSPlugin
|
|
306
|
-
*/
|
|
307
|
-
get velocityIterations() {
|
|
308
|
-
if (!this._physicsEngine) {
|
|
309
|
-
return 0;
|
|
310
|
-
}
|
|
311
|
-
const plugin = this._physicsEngine.getPhysicsPlugin();
|
|
312
|
-
if (!plugin.getBodyVelocityIterations) {
|
|
313
|
-
return 0;
|
|
314
|
-
}
|
|
315
|
-
return plugin.getBodyVelocityIterations(this);
|
|
316
|
-
}
|
|
317
|
-
/**
|
|
318
|
-
* Sets the velocityIterations of a soft body; only supported by the AmmoJSPlugin
|
|
319
|
-
*/
|
|
320
|
-
set velocityIterations(value) {
|
|
321
|
-
if (!this._physicsEngine) {
|
|
322
|
-
return;
|
|
323
|
-
}
|
|
324
|
-
const plugin = this._physicsEngine.getPhysicsPlugin();
|
|
325
|
-
if (!plugin.setBodyVelocityIterations) {
|
|
326
|
-
return;
|
|
327
|
-
}
|
|
328
|
-
plugin.setBodyVelocityIterations(this, value);
|
|
329
|
-
}
|
|
330
|
-
/**
|
|
331
|
-
* Gets the positionIterations of a soft body; only supported by the AmmoJSPlugin
|
|
332
|
-
*/
|
|
333
|
-
get positionIterations() {
|
|
334
|
-
if (!this._physicsEngine) {
|
|
335
|
-
return 0;
|
|
336
|
-
}
|
|
337
|
-
const plugin = this._physicsEngine.getPhysicsPlugin();
|
|
338
|
-
if (!plugin.getBodyPositionIterations) {
|
|
339
|
-
return 0;
|
|
340
|
-
}
|
|
341
|
-
return plugin.getBodyPositionIterations(this);
|
|
342
|
-
}
|
|
343
|
-
/**
|
|
344
|
-
* Sets the positionIterations of a soft body; only supported by the AmmoJSPlugin
|
|
345
|
-
*/
|
|
346
|
-
set positionIterations(value) {
|
|
347
|
-
if (!this._physicsEngine) {
|
|
348
|
-
return;
|
|
349
|
-
}
|
|
350
|
-
const plugin = this._physicsEngine.getPhysicsPlugin();
|
|
351
|
-
if (!plugin.setBodyPositionIterations) {
|
|
352
|
-
return;
|
|
353
|
-
}
|
|
354
|
-
plugin.setBodyPositionIterations(this, value);
|
|
355
|
-
}
|
|
356
356
|
/**
|
|
357
357
|
* This function will completely initialize this impostor.
|
|
358
358
|
* It will create a new body - but only if this mesh has no parent.
|