@babylonjs/core 5.45.2 → 5.47.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/actionManager.js +6 -1
- package/Actions/actionManager.js.map +1 -1
- 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/physicsViewer.js +3 -3
- package/Debug/physicsViewer.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/eventFactory.d.ts +1 -1
- package/DeviceInput/eventFactory.js +4 -4
- package/DeviceInput/eventFactory.js.map +1 -1
- package/DeviceInput/internalDeviceSourceManager.d.ts +2 -2
- package/DeviceInput/webDeviceInputSystem.js +2 -2
- package/DeviceInput/webDeviceInputSystem.js.map +1 -1
- 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 +10 -10
- 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.d.ts +4 -3
- package/Inputs/scene.inputManager.js +12 -11
- 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 +53 -55
- 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.js +41 -41
- 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 +27 -7
- package/Maths/math.vector.js +75 -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 +166 -166
- 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/particleSystemComponent.js +5 -0
- package/Particles/particleSystemComponent.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/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 +6 -8
- package/Physics/v2/IPhysicsEnginePlugin.js +1 -0
- package/Physics/v2/IPhysicsEnginePlugin.js.map +1 -1
- package/Physics/v2/physicsBody.d.ts +10 -1
- package/Physics/v2/physicsBody.js +13 -1
- package/Physics/v2/physicsBody.js.map +1 -1
- package/Physics/v2/physicsConstraint.d.ts +139 -66
- package/Physics/v2/physicsConstraint.js +145 -78
- package/Physics/v2/physicsConstraint.js.map +1 -1
- package/Physics/v2/physicsEngine.js +14 -14
- package/Physics/v2/physicsEngine.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js +137 -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 +22 -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 +71 -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 +173 -168
- 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/pbrBlockSubSurface.js +1 -1
- package/Shaders/ShadersInclude/pbrBlockSubSurface.js.map +1 -1
- package/Shaders/fluidRenderingParticleDepth.fragment.js +5 -1
- package/Shaders/fluidRenderingParticleDepth.fragment.js.map +1 -1
- package/Shaders/fluidRenderingRender.fragment.js +7 -2
- package/Shaders/fluidRenderingRender.fragment.js.map +1 -1
- package/Shaders/geometry.fragment.d.ts +2 -0
- package/Shaders/geometry.fragment.js +5 -1
- package/Shaders/geometry.fragment.js.map +1 -1
- package/Shaders/geometry.vertex.d.ts +2 -0
- package/Shaders/geometry.vertex.js +8 -4
- package/Shaders/geometry.vertex.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
|
@@ -34,240 +34,307 @@ export class PhysicsConstraint {
|
|
|
34
34
|
throw new Error("No Physics Plugin available.");
|
|
35
35
|
}
|
|
36
36
|
this._physicsPlugin = physicsPlugin;
|
|
37
|
-
this.
|
|
37
|
+
this._options = options;
|
|
38
|
+
this._type = type;
|
|
38
39
|
}
|
|
39
40
|
/**
|
|
40
|
-
*
|
|
41
|
-
* @param body - The parent body to set.
|
|
41
|
+
* Gets the type of the constraint.
|
|
42
42
|
*
|
|
43
|
-
*
|
|
44
|
-
* This allows the engine to accurately simulate the motion of the body in relation to its parent body.
|
|
45
|
-
* For example, if the parent body is a planet, the engine can accurately simulate the motion of the body in relation to the planet's gravity.
|
|
46
|
-
*/
|
|
47
|
-
setParentBody(body) {
|
|
48
|
-
this._physicsPlugin.setParentBody(this, body);
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Retrieves the parent body of the current physics constraint.
|
|
52
|
-
*
|
|
53
|
-
* @returns The parent body of the current physics constraint, or `undefined` if the
|
|
54
|
-
* current constraint does not have a parent body.
|
|
55
|
-
*/
|
|
56
|
-
getParentBody() {
|
|
57
|
-
return this._physicsPlugin.getParentBody(this);
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Sets the child body of the current body.
|
|
61
|
-
*
|
|
62
|
-
* @param body - The child body to set.
|
|
43
|
+
* @returns The type of the constraint.
|
|
63
44
|
*
|
|
64
|
-
* This method is useful for setting the child body of the current body in a physics engine.
|
|
65
|
-
* This allows for the creation of complex structures of bodies that interact with each other in a realistic way.
|
|
66
45
|
*/
|
|
67
|
-
|
|
68
|
-
this.
|
|
46
|
+
getType() {
|
|
47
|
+
return this._type;
|
|
69
48
|
}
|
|
70
49
|
/**
|
|
71
|
-
* Retrieves the
|
|
50
|
+
* Retrieves the options of the physics constraint.
|
|
72
51
|
*
|
|
73
|
-
* @returns The
|
|
74
|
-
* child body is present.
|
|
75
|
-
*/
|
|
76
|
-
getChildBody() {
|
|
77
|
-
return this._physicsPlugin.getChildBody(this);
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
*
|
|
81
|
-
* @param pivot +
|
|
82
|
-
* @param axisX
|
|
83
|
-
* @param axisY
|
|
84
|
-
*/
|
|
85
|
-
setAnchorInParent(pivot, axisX, axisY) {
|
|
86
|
-
this._physicsPlugin.setAnchorInParent(this, pivot, axisX, axisY);
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
52
|
+
* @returns The physics constraint parameters.
|
|
89
53
|
*
|
|
90
|
-
* @param pivot
|
|
91
|
-
* @param axisX
|
|
92
|
-
* @param axisY
|
|
93
54
|
*/
|
|
94
|
-
|
|
95
|
-
this.
|
|
55
|
+
getOptions() {
|
|
56
|
+
return this._options;
|
|
96
57
|
}
|
|
97
58
|
/**
|
|
98
|
-
*
|
|
99
|
-
* @param isEnabled
|
|
59
|
+
* Enable/disable the constraint
|
|
60
|
+
* @param isEnabled value for the constraint
|
|
100
61
|
*/
|
|
101
62
|
setEnabled(isEnabled) {
|
|
102
63
|
this._physicsPlugin.setEnabled(this, isEnabled);
|
|
103
64
|
}
|
|
104
65
|
/**
|
|
105
66
|
*
|
|
106
|
-
* @returns
|
|
67
|
+
* @returns true if constraint is enabled
|
|
107
68
|
*/
|
|
108
69
|
getEnabled() {
|
|
109
70
|
return this._physicsPlugin.getEnabled(this);
|
|
110
71
|
}
|
|
111
72
|
/**
|
|
73
|
+
* Enables or disables collisions for the physics engine.
|
|
74
|
+
*
|
|
75
|
+
* @param isEnabled - A boolean value indicating whether collisions should be enabled or disabled.
|
|
112
76
|
*
|
|
113
|
-
* @param isEnabled
|
|
114
77
|
*/
|
|
115
78
|
setCollisionsEnabled(isEnabled) {
|
|
116
79
|
this._physicsPlugin.setCollisionsEnabled(this, isEnabled);
|
|
117
80
|
}
|
|
118
81
|
/**
|
|
82
|
+
* Gets whether collisions are enabled for this physics object.
|
|
83
|
+
*
|
|
84
|
+
* @returns `true` if collisions are enabled, `false` otherwise.
|
|
119
85
|
*
|
|
120
|
-
* @returns
|
|
121
86
|
*/
|
|
122
87
|
getCollisionsEnabled() {
|
|
123
88
|
return this._physicsPlugin.getCollisionsEnabled(this);
|
|
124
89
|
}
|
|
125
90
|
/**
|
|
91
|
+
* Sets the friction of the given axis of the physics engine.
|
|
92
|
+
* @param axis - The axis of the physics engine to set the friction for.
|
|
93
|
+
* @param friction - The friction to set for the given axis.
|
|
126
94
|
*
|
|
127
|
-
* @param axis
|
|
128
|
-
* @param friction
|
|
129
95
|
*/
|
|
130
96
|
setAxisFriction(axis, friction) {
|
|
131
97
|
this._physicsPlugin.setAxisFriction(this, axis, friction);
|
|
132
98
|
}
|
|
133
99
|
/**
|
|
100
|
+
* Gets the friction of the given axis of the physics engine.
|
|
101
|
+
* @param axis - The axis of the physics engine.
|
|
102
|
+
* @returns The friction of the given axis.
|
|
134
103
|
*
|
|
135
|
-
* @param axis
|
|
136
|
-
* @returns
|
|
137
104
|
*/
|
|
138
105
|
getAxisFriction(axis) {
|
|
139
106
|
return this._physicsPlugin.getAxisFriction(this, axis);
|
|
140
107
|
}
|
|
141
108
|
/**
|
|
109
|
+
* Sets the limit mode for the given axis of the constraint.
|
|
110
|
+
* @param axis The axis to set the limit mode for.
|
|
111
|
+
* @param limitMode The limit mode to set.
|
|
142
112
|
*
|
|
143
|
-
*
|
|
144
|
-
*
|
|
113
|
+
* This method is useful for setting the limit mode for a given axis of the constraint. This is important for
|
|
114
|
+
* controlling the behavior of the physics engine when the constraint is reached. By setting the limit mode,
|
|
115
|
+
* the engine can be configured to either stop the motion of the objects, or to allow them to continue
|
|
116
|
+
* moving beyond the constraint.
|
|
145
117
|
*/
|
|
146
118
|
setAxisMode(axis, limitMode) {
|
|
147
119
|
this._physicsPlugin.setAxisMode(this, axis, limitMode);
|
|
148
120
|
}
|
|
149
121
|
/**
|
|
122
|
+
* Gets the limit mode of the given axis of the constraint.
|
|
123
|
+
*
|
|
124
|
+
* @param axis - The axis of the constraint.
|
|
125
|
+
* @returns The limit mode of the given axis.
|
|
150
126
|
*
|
|
151
|
-
* @param axis
|
|
152
127
|
*/
|
|
153
128
|
getAxisMode(axis) {
|
|
154
129
|
return this._physicsPlugin.getAxisMode(this, axis);
|
|
155
130
|
}
|
|
156
131
|
/**
|
|
132
|
+
* Sets the minimum limit of a given axis of a constraint.
|
|
133
|
+
* @param axis - The axis of the constraint.
|
|
134
|
+
* @param minLimit - The minimum limit of the axis.
|
|
157
135
|
*
|
|
158
136
|
*/
|
|
159
137
|
setAxisMinLimit(axis, minLimit) {
|
|
160
138
|
this._physicsPlugin.setAxisMinLimit(this, axis, minLimit);
|
|
161
139
|
}
|
|
162
140
|
/**
|
|
141
|
+
* Gets the minimum limit of the given axis of the physics engine.
|
|
142
|
+
* @param axis - The axis of the physics engine.
|
|
143
|
+
* @returns The minimum limit of the given axis.
|
|
163
144
|
*
|
|
164
145
|
*/
|
|
165
146
|
getAxisMinLimit(axis) {
|
|
166
147
|
return this._physicsPlugin.getAxisMinLimit(this, axis);
|
|
167
148
|
}
|
|
168
149
|
/**
|
|
150
|
+
* Sets the maximum limit of the given axis for the physics engine.
|
|
151
|
+
* @param axis - The axis to set the limit for.
|
|
152
|
+
* @param limit - The maximum limit of the axis.
|
|
169
153
|
*
|
|
154
|
+
* This method is useful for setting the maximum limit of the given axis for the physics engine,
|
|
155
|
+
* which can be used to control the movement of the physics object. This helps to ensure that the
|
|
156
|
+
* physics object does not move beyond the given limit.
|
|
170
157
|
*/
|
|
171
158
|
setAxisMaxLimit(axis, limit) {
|
|
172
159
|
this._physicsPlugin.setAxisMaxLimit(this, axis, limit);
|
|
173
160
|
}
|
|
174
161
|
/**
|
|
162
|
+
* Gets the maximum limit of the given axis of the physics engine.
|
|
163
|
+
* @param axis - The axis of the physics engine.
|
|
164
|
+
* @returns The maximum limit of the given axis.
|
|
175
165
|
*
|
|
176
166
|
*/
|
|
177
167
|
getAxisMaxLimit(axis) {
|
|
178
168
|
return this._physicsPlugin.getAxisMaxLimit(this, axis);
|
|
179
169
|
}
|
|
180
170
|
/**
|
|
171
|
+
* Sets the motor type of the given axis of the constraint.
|
|
172
|
+
* @param axis - The axis of the constraint.
|
|
173
|
+
* @param motorType - The type of motor to use.
|
|
174
|
+
* @returns void
|
|
181
175
|
*
|
|
182
176
|
*/
|
|
183
177
|
setAxisMotorType(axis, motorType) {
|
|
184
178
|
this._physicsPlugin.setAxisMotorType(this, axis, motorType);
|
|
185
179
|
}
|
|
186
180
|
/**
|
|
181
|
+
* Gets the motor type of the specified axis of the constraint.
|
|
182
|
+
*
|
|
183
|
+
* @param axis - The axis of the constraint.
|
|
184
|
+
* @returns The motor type of the specified axis.
|
|
187
185
|
*
|
|
188
186
|
*/
|
|
189
187
|
getAxisMotorType(axis) {
|
|
190
188
|
return this._physicsPlugin.getAxisMotorType(this, axis);
|
|
191
189
|
}
|
|
192
190
|
/**
|
|
191
|
+
* Sets the target velocity of the motor associated with the given axis of the constraint.
|
|
192
|
+
* @param axis - The axis of the constraint.
|
|
193
|
+
* @param target - The target velocity of the motor.
|
|
193
194
|
*
|
|
195
|
+
* This method is useful for setting the target velocity of the motor associated with the given axis of the constraint.
|
|
194
196
|
*/
|
|
195
197
|
setAxisMotorTarget(axis, target) {
|
|
196
198
|
this._physicsPlugin.setAxisMotorTarget(this, axis, target);
|
|
197
199
|
}
|
|
198
200
|
/**
|
|
201
|
+
* Gets the target velocity of the motor associated to the given constraint axis.
|
|
202
|
+
* @param axis - The constraint axis associated to the motor.
|
|
203
|
+
* @returns The target velocity of the motor.
|
|
199
204
|
*
|
|
200
205
|
*/
|
|
201
206
|
getAxisMotorTarget(axis) {
|
|
202
207
|
return this._physicsPlugin.getAxisMotorTarget(this, axis);
|
|
203
208
|
}
|
|
204
209
|
/**
|
|
210
|
+
* Sets the maximum force of the motor of the given axis of the constraint.
|
|
211
|
+
* @param axis - The axis of the constraint.
|
|
212
|
+
* @param maxForce - The maximum force of the motor.
|
|
205
213
|
*
|
|
206
214
|
*/
|
|
207
215
|
setAxisMotorMaxForce(axis, maxForce) {
|
|
208
216
|
this._physicsPlugin.setAxisMotorMaxForce(this, axis, maxForce);
|
|
209
217
|
}
|
|
210
218
|
/**
|
|
219
|
+
* Gets the maximum force of the motor of the given axis of the constraint.
|
|
220
|
+
* @param axis - The axis of the constraint.
|
|
221
|
+
* @returns The maximum force of the motor.
|
|
211
222
|
*
|
|
212
223
|
*/
|
|
213
224
|
getAxisMotorMaxForce(axis) {
|
|
214
225
|
return this._physicsPlugin.getAxisMotorMaxForce(this, axis);
|
|
215
226
|
}
|
|
216
227
|
/**
|
|
228
|
+
* Disposes the constraint from the physics engine.
|
|
217
229
|
*
|
|
230
|
+
* This method is useful for cleaning up the physics engine when a body is no longer needed. Disposing the body will free up resources and prevent memory leaks.
|
|
218
231
|
*/
|
|
219
232
|
dispose() {
|
|
220
233
|
this._physicsPlugin.disposeConstraint(this);
|
|
221
234
|
}
|
|
222
235
|
}
|
|
223
236
|
/**
|
|
237
|
+
* Represents a Ball and Socket Constraint, used to simulate a joint
|
|
224
238
|
*
|
|
239
|
+
* @param pivotA - The first pivot, defined locally in the first body frame
|
|
240
|
+
* @param pivotB - The second pivot, defined locally in the second body frame
|
|
241
|
+
* @param axisA - The axis of the first body
|
|
242
|
+
* @param axisB - The axis of the second body
|
|
243
|
+
* @param scene - The scene the constraint is applied to
|
|
244
|
+
* @returns The Ball and Socket Constraint
|
|
245
|
+
*
|
|
246
|
+
* This class is useful for simulating a joint between two bodies in a physics engine.
|
|
247
|
+
* It allows for the two bodies to move relative to each other in a way that mimics a ball and socket joint, such as a shoulder or hip joint.
|
|
225
248
|
*/
|
|
226
|
-
|
|
227
|
-
export class PhysicsConstraintBallAndSocket extends PhysicsConstraint {
|
|
228
|
-
/** @internal */
|
|
249
|
+
export class BallAndSocketConstraint extends PhysicsConstraint {
|
|
229
250
|
constructor(pivotA, pivotB, axisA, axisB, scene) {
|
|
230
251
|
super(ConstraintType.BALL_AND_SOCKET, { pivotA: pivotA, pivotB: pivotB, axisA: axisA, axisB: axisB }, scene);
|
|
231
252
|
}
|
|
232
253
|
}
|
|
233
254
|
/**
|
|
255
|
+
* Creates a distance constraint.
|
|
256
|
+
* @param maxDistance distance between bodies
|
|
257
|
+
* @param scene The scene the constraint belongs to
|
|
258
|
+
* @returns DistanceConstraint
|
|
234
259
|
*
|
|
260
|
+
* This code is useful for creating a distance constraint in a physics engine.
|
|
261
|
+
* A distance constraint is a type of constraint that keeps two objects at a certain distance from each other.
|
|
262
|
+
* The scene is used to add the constraint to the physics engine.
|
|
235
263
|
*/
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
constructor(pivotA, pivotB, axisA, axisB, scene) {
|
|
240
|
-
super(ConstraintType.DISTANCE, { pivotA: pivotA, pivotB: pivotB, axisA: axisA, axisB: axisB }, scene);
|
|
264
|
+
export class DistanceConstraint extends PhysicsConstraint {
|
|
265
|
+
constructor(maxDistance, scene) {
|
|
266
|
+
super(ConstraintType.DISTANCE, { maxDistance: maxDistance }, scene);
|
|
241
267
|
}
|
|
242
268
|
}
|
|
243
269
|
/**
|
|
270
|
+
* Creates a HingeConstraint, which is a type of PhysicsConstraint.
|
|
244
271
|
*
|
|
272
|
+
* @param pivotA - The first pivot point, in world space.
|
|
273
|
+
* @param pivotB - The second pivot point, in world space.
|
|
274
|
+
* @param scene - The scene the constraint is used in.
|
|
275
|
+
* @returns The new HingeConstraint.
|
|
276
|
+
*
|
|
277
|
+
* This code is useful for creating a HingeConstraint, which is a type of PhysicsConstraint.
|
|
278
|
+
* This constraint is used to simulate a hinge joint between two rigid bodies, allowing them to rotate around a single axis.
|
|
245
279
|
*/
|
|
246
|
-
|
|
247
|
-
export class PhysicsConstraintHinge extends PhysicsConstraint {
|
|
248
|
-
/** @internal */
|
|
280
|
+
export class HingeConstraint extends PhysicsConstraint {
|
|
249
281
|
constructor(pivotA, pivotB, axisA, axisB, scene) {
|
|
250
282
|
super(ConstraintType.HINGE, { pivotA: pivotA, pivotB: pivotB, axisA: axisA, axisB: axisB }, scene);
|
|
251
283
|
}
|
|
252
284
|
}
|
|
253
285
|
/**
|
|
286
|
+
* Creates a SliderConstraint, which is a type of PhysicsConstraint.
|
|
287
|
+
*
|
|
288
|
+
* @param pivotA - The first pivot of the constraint, in world space.
|
|
289
|
+
* @param pivotB - The second pivot of the constraint, in world space.
|
|
290
|
+
* @param axisA - The first axis of the constraint, in world space.
|
|
291
|
+
* @param axisB - The second axis of the constraint, in world space.
|
|
292
|
+
* @param scene - The scene the constraint belongs to.
|
|
293
|
+
* @returns The created SliderConstraint.
|
|
254
294
|
*
|
|
295
|
+
* This code is useful for creating a SliderConstraint, which is a type of PhysicsConstraint.
|
|
296
|
+
* It allows the user to specify the two pivots and two axes of the constraint in world space, as well as the scene the constraint belongs to.
|
|
297
|
+
* This is useful for creating a constraint between two rigid bodies that allows them to move along a certain axis.
|
|
255
298
|
*/
|
|
256
|
-
|
|
257
|
-
export class PhysicsConstraintSlider extends PhysicsConstraint {
|
|
258
|
-
/** @internal */
|
|
299
|
+
export class SliderConstraint extends PhysicsConstraint {
|
|
259
300
|
constructor(pivotA, pivotB, axisA, axisB, scene) {
|
|
260
301
|
super(ConstraintType.SLIDER, { pivotA: pivotA, pivotB: pivotB, axisA: axisA, axisB: axisB }, scene);
|
|
261
302
|
}
|
|
262
303
|
}
|
|
263
304
|
/**
|
|
305
|
+
* Creates a LockConstraint, which is a type of PhysicsConstraint.
|
|
264
306
|
*
|
|
307
|
+
* @param pivotA - The first pivot of the constraint in local space.
|
|
308
|
+
* @param pivotB - The second pivot of the constraint in local space.
|
|
309
|
+
* @param axisA - The first axis of the constraint in local space.
|
|
310
|
+
* @param axisB - The second axis of the constraint in local space.
|
|
311
|
+
* @param scene - The scene the constraint belongs to.
|
|
312
|
+
* @returns The created LockConstraint.
|
|
313
|
+
*
|
|
314
|
+
* This code is useful for creating a LockConstraint, which is a type of PhysicsConstraint.
|
|
315
|
+
* It takes in two pivots and two axes in local space, as well as the scene the constraint belongs to, and creates a LockConstraint.
|
|
265
316
|
*/
|
|
266
|
-
|
|
267
|
-
export class PhysicsConstraintLock extends PhysicsConstraint {
|
|
268
|
-
/** @internal */
|
|
317
|
+
export class LockConstraint extends PhysicsConstraint {
|
|
269
318
|
constructor(pivotA, pivotB, axisA, axisB, scene) {
|
|
270
319
|
super(ConstraintType.LOCK, { pivotA: pivotA, pivotB: pivotB, axisA: axisA, axisB: axisB }, scene);
|
|
271
320
|
}
|
|
272
321
|
}
|
|
322
|
+
/**
|
|
323
|
+
* Creates a PrismaticConstraint, which is a type of PhysicsConstraint.
|
|
324
|
+
*
|
|
325
|
+
* @param pivotA - The first pivot of the constraint in local space.
|
|
326
|
+
* @param pivotB - The second pivot of the constraint in local space.
|
|
327
|
+
* @param axisA - The first axis of the constraint in local space.
|
|
328
|
+
* @param axisB - The second axis of the constraint in local space.
|
|
329
|
+
* @param scene - The scene the constraint belongs to.
|
|
330
|
+
* @returns The created LockConstraint.
|
|
331
|
+
*
|
|
332
|
+
* This code is useful for creating a PrismaticConstraint, which is a type of PhysicsConstraint.
|
|
333
|
+
* It takes in two pivots and two axes in local space, as well as the scene the constraint belongs to, and creates a PrismaticConstraint.
|
|
334
|
+
*/
|
|
335
|
+
export class PrismaticConstraint extends PhysicsConstraint {
|
|
336
|
+
constructor(pivotA, pivotB, axisA, axisB, scene) {
|
|
337
|
+
super(ConstraintType.PRISMATIC, { pivotA: pivotA, pivotB: pivotB, axisA: axisA, axisB: axisB }, scene);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
273
340
|
//# sourceMappingURL=physicsConstraint.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"physicsConstraint.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Physics/v2/physicsConstraint.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAGxD;;;;GAIG;AACH,MAAM,OAAO,iBAAiB;IAU1B;;;;;;;;OAQG;IACH,YAAY,IAAoB,EAAE,OAAoC,EAAE,KAAY;QAlBpF;;WAEG;QACI,gBAAW,GAAQ,SAAS,CAAC;QAgBhC,IAAI,CAAC,KAAK,EAAE;YACR,OAAO;SACV;QACD,MAAM,aAAa,GAAG,KAAK,CAAC,gBAAgB,EAAE,CAAC;QAC/C,IAAI,CAAC,aAAa,E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AAc,EAAE,KAAY;QACtF,KAAK,CAAC,cAAc,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,KAAK,CAAC,CAAC;IACxG,CAAC;CACJ;AAED;;GAEG;AACH,gBAAgB;AAChB,MAAM,OAAO,qBAAsB,SAAQ,iBAAiB;IACxD,gBAAgB;IAChB,YAAY,MAAe,EAAE,MAAe,EAAE,KAAc,EAAE,KAAc,EAAE,KAAY;QACtF,KAAK,CAAC,cAAc,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,KAAK,CAAC,CAAC;IACtG,CAAC;CACJ","sourcesContent":["import type { Scene } from \"../../scene\";\r\nimport type { Vector3 } from \"../../Maths/math.vector\";\r\nimport type { IPhysicsEnginePluginV2, ConstraintAxis, PhysicsConstraintParameters, ConstraintAxisLimitMode, ConstraintMotorType } from \"./IPhysicsEnginePlugin\";\r\nimport { ConstraintType } from \"./IPhysicsEnginePlugin\";\r\nimport type { PhysicsBody } from \"./physicsBody\";\r\n\r\n/**\r\n * This is a holder class for the physics constraint created by the physics plugin\r\n * It holds a set of functions to control the underlying constraint\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine\r\n */\r\nexport class PhysicsConstraint {\r\n /**\r\n * V2 Physics plugin private data for a physics material\r\n */\r\n public _pluginData: any = undefined;\r\n /**\r\n * The V2 plugin used to create and manage this Physics Body\r\n */\r\n protected _physicsPlugin: IPhysicsEnginePluginV2;\r\n\r\n /**\r\n * Constructs a new constraint for the physics constraint.\r\n * @param type The type of constraint to create.\r\n * @param options The options for the constraint.\r\n * @param scene The scene the constraint belongs to.\r\n *\r\n * This code is useful for creating a new constraint for the physics engine. It checks if the scene has a physics engine, and if the plugin version is correct.\r\n * If all checks pass, it initializes the constraint with the given type and options.\r\n */\r\n constructor(type: ConstraintType, options: PhysicsConstraintParameters, scene: Scene) {\r\n if (!scene) {\r\n return;\r\n }\r\n const physicsEngine = scene.getPhysicsEngine();\r\n if (!physicsEngine) {\r\n throw new Error(\"No Physics Engine available.\");\r\n }\r\n if (physicsEngine.getPluginVersion() != 2) {\r\n throw new Error(\"Plugin version is incorrect. Expected version 2.\");\r\n }\r\n const physicsPlugin = physicsEngine.getPhysicsPlugin();\r\n if (!physicsPlugin) {\r\n throw new Error(\"No Physics Plugin available.\");\r\n }\r\n\r\n this._physicsPlugin = physicsPlugin as IPhysicsEnginePluginV2;\r\n this._physicsPlugin.initConstraint(this, type, options);\r\n }\r\n\r\n /**\r\n * Sets the parent body of this body.\r\n * @param body - The parent body to set.\r\n *\r\n * This method is useful for setting the parent body of a physics body in a physics engine.\r\n * This allows the engine to accurately simulate the motion of the body in relation to its parent body.\r\n * For example, if the parent body is a planet, the engine can accurately simulate the motion of the body in relation to the planet's gravity.\r\n */\r\n public setParentBody(body: PhysicsBody): void {\r\n this._physicsPlugin.setParentBody(this, body);\r\n }\r\n\r\n /**\r\n * Retrieves the parent body of the current physics constraint.\r\n *\r\n * @returns The parent body of the current physics constraint, or `undefined` if the\r\n * current constraint does not have a parent body.\r\n */\r\n public getParentBody(): PhysicsBody | undefined {\r\n return this._physicsPlugin.getParentBody(this);\r\n }\r\n\r\n /**\r\n * Sets the child body of the current body.\r\n *\r\n * @param body - The child body to set.\r\n *\r\n * This method is useful for setting the child body of the current body in a physics engine.\r\n * This allows for the creation of complex structures of bodies that interact with each other in a realistic way.\r\n */\r\n public setChildBody(body: PhysicsBody): void {\r\n this._physicsPlugin.setChildBody(this, body);\r\n }\r\n\r\n /**\r\n * Retrieves the child body of the current physics constraint.\r\n *\r\n * @returns The child body of the current physics constraint, or `undefined` if no\r\n * child body is present.\r\n */\r\n public getChildBody(): PhysicsBody | undefined {\r\n return this._physicsPlugin.getChildBody(this);\r\n }\r\n\r\n /**\r\n *\r\n * @param pivot +\r\n * @param axisX\r\n * @param axisY\r\n */\r\n public setAnchorInParent(pivot: Vector3, axisX: Vector3, axisY: Vector3): void {\r\n this._physicsPlugin.setAnchorInParent(this, pivot, axisX, axisY);\r\n }\r\n\r\n /**\r\n *\r\n * @param pivot\r\n * @param axisX\r\n * @param axisY\r\n */\r\n public setAnchorInChild(pivot: Vector3, axisX: Vector3, axisY: Vector3): void {\r\n this._physicsPlugin.setAnchorInChild(this, pivot, axisX, axisY);\r\n }\r\n\r\n /**\r\n *\r\n * @param isEnabled\r\n */\r\n public setEnabled(isEnabled: boolean): void {\r\n this._physicsPlugin.setEnabled(this, isEnabled);\r\n }\r\n\r\n /**\r\n *\r\n * @returns\r\n */\r\n public getEnabled(): boolean {\r\n return this._physicsPlugin.getEnabled(this);\r\n }\r\n\r\n /**\r\n *\r\n * @param isEnabled\r\n */\r\n public setCollisionsEnabled(isEnabled: boolean): void {\r\n this._physicsPlugin.setCollisionsEnabled(this, isEnabled);\r\n }\r\n\r\n /**\r\n *\r\n * @returns\r\n */\r\n public getCollisionsEnabled(): boolean {\r\n return this._physicsPlugin.getCollisionsEnabled(this);\r\n }\r\n\r\n /**\r\n *\r\n * @param axis\r\n * @param friction\r\n */\r\n public setAxisFriction(axis: ConstraintAxis, friction: number): void {\r\n this._physicsPlugin.setAxisFriction(this, axis, friction);\r\n }\r\n\r\n /**\r\n *\r\n * @param axis\r\n * @returns\r\n */\r\n public getAxisFriction(axis: ConstraintAxis): number {\r\n return this._physicsPlugin.getAxisFriction(this, axis);\r\n }\r\n\r\n /**\r\n *\r\n * @param axis\r\n * @param limitMode\r\n */\r\n public setAxisMode(axis: ConstraintAxis, limitMode: ConstraintAxisLimitMode): void {\r\n this._physicsPlugin.setAxisMode(this, axis, limitMode);\r\n }\r\n /**\r\n *\r\n * @param axis\r\n */\r\n public getAxisMode(axis: ConstraintAxis): ConstraintAxisLimitMode {\r\n return this._physicsPlugin.getAxisMode(this, axis);\r\n }\r\n\r\n /**\r\n *\r\n */\r\n public setAxisMinLimit(axis: ConstraintAxis, minLimit: number): void {\r\n this._physicsPlugin.setAxisMinLimit(this, axis, minLimit);\r\n }\r\n\r\n /**\r\n *\r\n */\r\n public getAxisMinLimit(axis: ConstraintAxis): number {\r\n return this._physicsPlugin.getAxisMinLimit(this, axis);\r\n }\r\n\r\n /**\r\n *\r\n */\r\n public setAxisMaxLimit(axis: ConstraintAxis, limit: number): void {\r\n this._physicsPlugin.setAxisMaxLimit(this, axis, limit);\r\n }\r\n\r\n /**\r\n *\r\n */\r\n public getAxisMaxLimit(axis: ConstraintAxis): number {\r\n return this._physicsPlugin.getAxisMaxLimit(this, axis);\r\n }\r\n\r\n /**\r\n *\r\n */\r\n public setAxisMotorType(axis: ConstraintAxis, motorType: ConstraintMotorType): void {\r\n this._physicsPlugin.setAxisMotorType(this, axis, motorType);\r\n }\r\n\r\n /**\r\n *\r\n */\r\n public getAxisMotorType(axis: ConstraintAxis): ConstraintMotorType {\r\n return this._physicsPlugin.getAxisMotorType(this, axis);\r\n }\r\n\r\n /**\r\n *\r\n */\r\n public setAxisMotorTarget(axis: ConstraintAxis, target: number): void {\r\n this._physicsPlugin.setAxisMotorTarget(this, axis, target);\r\n }\r\n\r\n /**\r\n *\r\n */\r\n public getAxisMotorTarget(axis: ConstraintAxis): number {\r\n return this._physicsPlugin.getAxisMotorTarget(this, axis);\r\n }\r\n\r\n /**\r\n *\r\n */\r\n public setAxisMotorMaxForce(axis: ConstraintAxis, maxForce: number): void {\r\n this._physicsPlugin.setAxisMotorMaxForce(this, axis, maxForce);\r\n }\r\n\r\n /**\r\n *\r\n */\r\n public getAxisMotorMaxForce(axis: ConstraintAxis): number {\r\n return this._physicsPlugin.getAxisMotorMaxForce(this, axis);\r\n }\r\n\r\n /**\r\n *\r\n */\r\n public dispose(): void {\r\n this._physicsPlugin.disposeConstraint(this);\r\n }\r\n}\r\n\r\n/**\r\n *\r\n */\r\n/** @internal */\r\nexport class PhysicsConstraintBallAndSocket extends PhysicsConstraint {\r\n /** @internal */\r\n constructor(pivotA: Vector3, pivotB: Vector3, axisA: Vector3, axisB: Vector3, scene: Scene) {\r\n super(ConstraintType.BALL_AND_SOCKET, { pivotA: pivotA, pivotB: pivotB, axisA: axisA, axisB: axisB }, scene);\r\n }\r\n}\r\n\r\n/**\r\n *\r\n */\r\n/** @internal */\r\nexport class PhysicsConstraintDistance extends PhysicsConstraint {\r\n /** @internal */\r\n constructor(pivotA: Vector3, pivotB: Vector3, axisA: Vector3, axisB: Vector3, scene: Scene) {\r\n super(ConstraintType.DISTANCE, { pivotA: pivotA, pivotB: pivotB, axisA: axisA, axisB: axisB }, scene);\r\n }\r\n}\r\n\r\n/**\r\n *\r\n */\r\n/** @internal */\r\nexport class PhysicsConstraintHinge extends PhysicsConstraint {\r\n /** @internal */\r\n constructor(pivotA: Vector3, pivotB: Vector3, axisA: Vector3, axisB: Vector3, scene: Scene) {\r\n super(ConstraintType.HINGE, { pivotA: pivotA, pivotB: pivotB, axisA: axisA, axisB: axisB }, scene);\r\n }\r\n}\r\n\r\n/**\r\n *\r\n */\r\n/** @internal */\r\nexport class PhysicsConstraintSlider extends PhysicsConstraint {\r\n /** @internal */\r\n constructor(pivotA: Vector3, pivotB: Vector3, axisA: Vector3, axisB: Vector3, scene: Scene) {\r\n super(ConstraintType.SLIDER, { pivotA: pivotA, pivotB: pivotB, axisA: axisA, axisB: axisB }, scene);\r\n }\r\n}\r\n\r\n/**\r\n *\r\n */\r\n/** @internal */\r\nexport class PhysicsConstraintLock extends PhysicsConstraint {\r\n /** @internal */\r\n constructor(pivotA: Vector3, pivotB: Vector3, axisA: Vector3, axisB: Vector3, scene: Scene) {\r\n super(ConstraintType.LOCK, { pivotA: pivotA, pivotB: pivotB, axisA: axisA, axisB: axisB }, scene);\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"physicsConstraint.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Physics/v2/phys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KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,KAAK,CAAC,CAAC;IACtG,CAAC;CACJ;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,mBAAoB,SAAQ,iBAAiB;IACtD,YAAY,MAAe,EAAE,MAAe,EAAE,KAAc,EAAE,KAAc,EAAE,KAAY;QACtF,KAAK,CAAC,cAAc,CAAC,SAAS,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,KAAK,CAAC,CAAC;IAC3G,CAAC;CACJ","sourcesContent":["import type { Scene } from \"../../scene\";\r\nimport type { Vector3 } from \"../../Maths/math.vector\";\r\nimport type { IPhysicsEnginePluginV2, ConstraintAxis, PhysicsConstraintParameters, ConstraintAxisLimitMode, ConstraintMotorType } from \"./IPhysicsEnginePlugin\";\r\nimport { ConstraintType } from \"./IPhysicsEnginePlugin\";\r\n\r\n/**\r\n * This is a holder class for the physics constraint created by the physics plugin\r\n * It holds a set of functions to control the underlying constraint\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine\r\n */\r\nexport class PhysicsConstraint {\r\n /**\r\n * V2 Physics plugin private data for a physics material\r\n */\r\n public _pluginData: any = undefined;\r\n /**\r\n * The V2 plugin used to create and manage this Physics Body\r\n */\r\n protected _physicsPlugin: IPhysicsEnginePluginV2;\r\n protected _options: PhysicsConstraintParameters;\r\n protected _type: ConstraintType;\r\n\r\n /**\r\n * Constructs a new constraint for the physics constraint.\r\n * @param type The type of constraint to create.\r\n * @param options The options for the constraint.\r\n * @param scene The scene the constraint belongs to.\r\n *\r\n * This code is useful for creating a new constraint for the physics engine. It checks if the scene has a physics engine, and if the plugin version is correct.\r\n * If all checks pass, it initializes the constraint with the given type and options.\r\n */\r\n constructor(type: ConstraintType, options: PhysicsConstraintParameters, scene: Scene) {\r\n if (!scene) {\r\n return;\r\n }\r\n const physicsEngine = scene.getPhysicsEngine();\r\n if (!physicsEngine) {\r\n throw new Error(\"No Physics Engine available.\");\r\n }\r\n if (physicsEngine.getPluginVersion() != 2) {\r\n throw new Error(\"Plugin version is incorrect. Expected version 2.\");\r\n }\r\n const physicsPlugin = physicsEngine.getPhysicsPlugin();\r\n if (!physicsPlugin) {\r\n throw new Error(\"No Physics Plugin available.\");\r\n }\r\n\r\n this._physicsPlugin = physicsPlugin as IPhysicsEnginePluginV2;\r\n this._options = options;\r\n this._type = type;\r\n }\r\n\r\n /**\r\n * Gets the type of the constraint.\r\n *\r\n * @returns The type of the constraint.\r\n *\r\n */\r\n public getType(): ConstraintType {\r\n return this._type;\r\n }\r\n\r\n /**\r\n * Retrieves the options of the physics constraint.\r\n *\r\n * @returns The physics constraint parameters.\r\n *\r\n */\r\n public getOptions(): PhysicsConstraintParameters {\r\n return this._options;\r\n }\r\n\r\n /**\r\n * Enable/disable the constraint\r\n * @param isEnabled value for the constraint\r\n */\r\n public setEnabled(isEnabled: boolean): void {\r\n this._physicsPlugin.setEnabled(this, isEnabled);\r\n }\r\n\r\n /**\r\n *\r\n * @returns true if constraint is enabled\r\n */\r\n public getEnabled(): boolean {\r\n return this._physicsPlugin.getEnabled(this);\r\n }\r\n\r\n /**\r\n * Enables or disables collisions for the physics engine.\r\n *\r\n * @param isEnabled - A boolean value indicating whether collisions should be enabled or disabled.\r\n *\r\n */\r\n public setCollisionsEnabled(isEnabled: boolean): void {\r\n this._physicsPlugin.setCollisionsEnabled(this, isEnabled);\r\n }\r\n\r\n /**\r\n * Gets whether collisions are enabled for this physics object.\r\n *\r\n * @returns `true` if collisions are enabled, `false` otherwise.\r\n *\r\n */\r\n public getCollisionsEnabled(): boolean {\r\n return this._physicsPlugin.getCollisionsEnabled(this);\r\n }\r\n\r\n /**\r\n * Sets the friction of the given axis of the physics engine.\r\n * @param axis - The axis of the physics engine to set the friction for.\r\n * @param friction - The friction to set for the given axis.\r\n *\r\n */\r\n public setAxisFriction(axis: ConstraintAxis, friction: number): void {\r\n this._physicsPlugin.setAxisFriction(this, axis, friction);\r\n }\r\n\r\n /**\r\n * Gets the friction of the given axis of the physics engine.\r\n * @param axis - The axis of the physics engine.\r\n * @returns The friction of the given axis.\r\n *\r\n */\r\n public getAxisFriction(axis: ConstraintAxis): number {\r\n return this._physicsPlugin.getAxisFriction(this, axis);\r\n }\r\n\r\n /**\r\n * Sets the limit mode for the given axis of the constraint.\r\n * @param axis The axis to set the limit mode for.\r\n * @param limitMode The limit mode to set.\r\n *\r\n * This method is useful for setting the limit mode for a given axis of the constraint. This is important for\r\n * controlling the behavior of the physics engine when the constraint is reached. By setting the limit mode,\r\n * the engine can be configured to either stop the motion of the objects, or to allow them to continue\r\n * moving beyond the constraint.\r\n */\r\n public setAxisMode(axis: ConstraintAxis, limitMode: ConstraintAxisLimitMode): void {\r\n this._physicsPlugin.setAxisMode(this, axis, limitMode);\r\n }\r\n\r\n /**\r\n * Gets the limit mode of the given axis of the constraint.\r\n *\r\n * @param axis - The axis of the constraint.\r\n * @returns The limit mode of the given axis.\r\n *\r\n */\r\n public getAxisMode(axis: ConstraintAxis): ConstraintAxisLimitMode {\r\n return this._physicsPlugin.getAxisMode(this, axis);\r\n }\r\n\r\n /**\r\n * Sets the minimum limit of a given axis of a constraint.\r\n * @param axis - The axis of the constraint.\r\n * @param minLimit - The minimum limit of the axis.\r\n *\r\n */\r\n public setAxisMinLimit(axis: ConstraintAxis, minLimit: number): void {\r\n this._physicsPlugin.setAxisMinLimit(this, axis, minLimit);\r\n }\r\n\r\n /**\r\n * Gets the minimum limit of the given axis of the physics engine.\r\n * @param axis - The axis of the physics engine.\r\n * @returns The minimum limit of the given axis.\r\n *\r\n */\r\n public getAxisMinLimit(axis: ConstraintAxis): number {\r\n return this._physicsPlugin.getAxisMinLimit(this, axis);\r\n }\r\n\r\n /**\r\n * Sets the maximum limit of the given axis for the physics engine.\r\n * @param axis - The axis to set the limit for.\r\n * @param limit - The maximum limit of the axis.\r\n *\r\n * This method is useful for setting the maximum limit of the given axis for the physics engine,\r\n * which can be used to control the movement of the physics object. This helps to ensure that the\r\n * physics object does not move beyond the given limit.\r\n */\r\n public setAxisMaxLimit(axis: ConstraintAxis, limit: number): void {\r\n this._physicsPlugin.setAxisMaxLimit(this, axis, limit);\r\n }\r\n\r\n /**\r\n * Gets the maximum limit of the given axis of the physics engine.\r\n * @param axis - The axis of the physics engine.\r\n * @returns The maximum limit of the given axis.\r\n *\r\n */\r\n public getAxisMaxLimit(axis: ConstraintAxis): number {\r\n return this._physicsPlugin.getAxisMaxLimit(this, axis);\r\n }\r\n\r\n /**\r\n * Sets the motor type of the given axis of the constraint.\r\n * @param axis - The axis of the constraint.\r\n * @param motorType - The type of motor to use.\r\n * @returns void\r\n *\r\n */\r\n public setAxisMotorType(axis: ConstraintAxis, motorType: ConstraintMotorType): void {\r\n this._physicsPlugin.setAxisMotorType(this, axis, motorType);\r\n }\r\n\r\n /**\r\n * Gets the motor type of the specified axis of the constraint.\r\n *\r\n * @param axis - The axis of the constraint.\r\n * @returns The motor type of the specified axis.\r\n *\r\n */\r\n public getAxisMotorType(axis: ConstraintAxis): ConstraintMotorType {\r\n return this._physicsPlugin.getAxisMotorType(this, axis);\r\n }\r\n\r\n /**\r\n * Sets the target velocity of the motor associated with the given axis of the constraint.\r\n * @param axis - The axis of the constraint.\r\n * @param target - The target velocity of the motor.\r\n *\r\n * This method is useful for setting the target velocity of the motor associated with the given axis of the constraint.\r\n */\r\n public setAxisMotorTarget(axis: ConstraintAxis, target: number): void {\r\n this._physicsPlugin.setAxisMotorTarget(this, axis, target);\r\n }\r\n\r\n /**\r\n * Gets the target velocity of the motor associated to the given constraint axis.\r\n * @param axis - The constraint axis associated to the motor.\r\n * @returns The target velocity of the motor.\r\n *\r\n */\r\n public getAxisMotorTarget(axis: ConstraintAxis): number {\r\n return this._physicsPlugin.getAxisMotorTarget(this, axis);\r\n }\r\n\r\n /**\r\n * Sets the maximum force of the motor of the given axis of the constraint.\r\n * @param axis - The axis of the constraint.\r\n * @param maxForce - The maximum force of the motor.\r\n *\r\n */\r\n public setAxisMotorMaxForce(axis: ConstraintAxis, maxForce: number): void {\r\n this._physicsPlugin.setAxisMotorMaxForce(this, axis, maxForce);\r\n }\r\n\r\n /**\r\n * Gets the maximum force of the motor of the given axis of the constraint.\r\n * @param axis - The axis of the constraint.\r\n * @returns The maximum force of the motor.\r\n *\r\n */\r\n public getAxisMotorMaxForce(axis: ConstraintAxis): number {\r\n return this._physicsPlugin.getAxisMotorMaxForce(this, axis);\r\n }\r\n\r\n /**\r\n * Disposes the constraint from the physics engine.\r\n *\r\n * This method is useful for cleaning up the physics engine when a body is no longer needed. Disposing the body will free up resources and prevent memory leaks.\r\n */\r\n public dispose(): void {\r\n this._physicsPlugin.disposeConstraint(this);\r\n }\r\n}\r\n\r\n/**\r\n * Represents a Ball and Socket Constraint, used to simulate a joint\r\n *\r\n * @param pivotA - The first pivot, defined locally in the first body frame\r\n * @param pivotB - The second pivot, defined locally in the second body frame\r\n * @param axisA - The axis of the first body\r\n * @param axisB - The axis of the second body\r\n * @param scene - The scene the constraint is applied to\r\n * @returns The Ball and Socket Constraint\r\n *\r\n * This class is useful for simulating a joint between two bodies in a physics engine.\r\n * It allows for the two bodies to move relative to each other in a way that mimics a ball and socket joint, such as a shoulder or hip joint.\r\n */\r\nexport class BallAndSocketConstraint extends PhysicsConstraint {\r\n constructor(pivotA: Vector3, pivotB: Vector3, axisA: Vector3, axisB: Vector3, scene: Scene) {\r\n super(ConstraintType.BALL_AND_SOCKET, { pivotA: pivotA, pivotB: pivotB, axisA: axisA, axisB: axisB }, scene);\r\n }\r\n}\r\n\r\n/**\r\n * Creates a distance constraint.\r\n * @param maxDistance distance between bodies\r\n * @param scene The scene the constraint belongs to\r\n * @returns DistanceConstraint\r\n *\r\n * This code is useful for creating a distance constraint in a physics engine.\r\n * A distance constraint is a type of constraint that keeps two objects at a certain distance from each other.\r\n * The scene is used to add the constraint to the physics engine.\r\n */\r\nexport class DistanceConstraint extends PhysicsConstraint {\r\n constructor(maxDistance: number, scene: Scene) {\r\n super(ConstraintType.DISTANCE, { maxDistance: maxDistance }, scene);\r\n }\r\n}\r\n\r\n/**\r\n * Creates a HingeConstraint, which is a type of PhysicsConstraint.\r\n *\r\n * @param pivotA - The first pivot point, in world space.\r\n * @param pivotB - The second pivot point, in world space.\r\n * @param scene - The scene the constraint is used in.\r\n * @returns The new HingeConstraint.\r\n *\r\n * This code is useful for creating a HingeConstraint, which is a type of PhysicsConstraint.\r\n * This constraint is used to simulate a hinge joint between two rigid bodies, allowing them to rotate around a single axis.\r\n */\r\nexport class HingeConstraint extends PhysicsConstraint {\r\n constructor(pivotA: Vector3, pivotB: Vector3, axisA: Vector3, axisB: Vector3, scene: Scene) {\r\n super(ConstraintType.HINGE, { pivotA: pivotA, pivotB: pivotB, axisA: axisA, axisB: axisB }, scene);\r\n }\r\n}\r\n\r\n/**\r\n * Creates a SliderConstraint, which is a type of PhysicsConstraint.\r\n *\r\n * @param pivotA - The first pivot of the constraint, in world space.\r\n * @param pivotB - The second pivot of the constraint, in world space.\r\n * @param axisA - The first axis of the constraint, in world space.\r\n * @param axisB - The second axis of the constraint, in world space.\r\n * @param scene - The scene the constraint belongs to.\r\n * @returns The created SliderConstraint.\r\n *\r\n * This code is useful for creating a SliderConstraint, which is a type of PhysicsConstraint.\r\n * It allows the user to specify the two pivots and two axes of the constraint in world space, as well as the scene the constraint belongs to.\r\n * This is useful for creating a constraint between two rigid bodies that allows them to move along a certain axis.\r\n */\r\nexport class SliderConstraint extends PhysicsConstraint {\r\n constructor(pivotA: Vector3, pivotB: Vector3, axisA: Vector3, axisB: Vector3, scene: Scene) {\r\n super(ConstraintType.SLIDER, { pivotA: pivotA, pivotB: pivotB, axisA: axisA, axisB: axisB }, scene);\r\n }\r\n}\r\n\r\n/**\r\n * Creates a LockConstraint, which is a type of PhysicsConstraint.\r\n *\r\n * @param pivotA - The first pivot of the constraint in local space.\r\n * @param pivotB - The second pivot of the constraint in local space.\r\n * @param axisA - The first axis of the constraint in local space.\r\n * @param axisB - The second axis of the constraint in local space.\r\n * @param scene - The scene the constraint belongs to.\r\n * @returns The created LockConstraint.\r\n *\r\n * This code is useful for creating a LockConstraint, which is a type of PhysicsConstraint.\r\n * It takes in two pivots and two axes in local space, as well as the scene the constraint belongs to, and creates a LockConstraint.\r\n */\r\nexport class LockConstraint extends PhysicsConstraint {\r\n constructor(pivotA: Vector3, pivotB: Vector3, axisA: Vector3, axisB: Vector3, scene: Scene) {\r\n super(ConstraintType.LOCK, { pivotA: pivotA, pivotB: pivotB, axisA: axisA, axisB: axisB }, scene);\r\n }\r\n}\r\n\r\n/**\r\n * Creates a PrismaticConstraint, which is a type of PhysicsConstraint.\r\n *\r\n * @param pivotA - The first pivot of the constraint in local space.\r\n * @param pivotB - The second pivot of the constraint in local space.\r\n * @param axisA - The first axis of the constraint in local space.\r\n * @param axisB - The second axis of the constraint in local space.\r\n * @param scene - The scene the constraint belongs to.\r\n * @returns The created LockConstraint.\r\n *\r\n * This code is useful for creating a PrismaticConstraint, which is a type of PhysicsConstraint.\r\n * It takes in two pivots and two axes in local space, as well as the scene the constraint belongs to, and creates a PrismaticConstraint.\r\n */\r\nexport class PrismaticConstraint extends PhysicsConstraint {\r\n constructor(pivotA: Vector3, pivotB: Vector3, axisA: Vector3, axisB: Vector3, scene: Scene) {\r\n super(ConstraintType.PRISMATIC, { pivotA: pivotA, pivotB: pivotB, axisA: axisA, axisB: axisB }, scene);\r\n }\r\n}\r\n"]}
|
|
@@ -7,20 +7,6 @@ import { _WarnImport } from "../../Misc/devTools.js";
|
|
|
7
7
|
*/
|
|
8
8
|
/** @internal */
|
|
9
9
|
export class PhysicsEngine {
|
|
10
|
-
/**
|
|
11
|
-
* Creates a new Physics Engine
|
|
12
|
-
* @param gravity defines the gravity vector used by the simulation
|
|
13
|
-
* @param _physicsPlugin defines the plugin to use (CannonJS by default)
|
|
14
|
-
*/
|
|
15
|
-
constructor(gravity, _physicsPlugin = PhysicsEngine.DefaultPluginFactory()) {
|
|
16
|
-
this._physicsPlugin = _physicsPlugin;
|
|
17
|
-
/** @internal */
|
|
18
|
-
this._physicsBodies = [];
|
|
19
|
-
this._subTimeStep = 0;
|
|
20
|
-
gravity = gravity || new Vector3(0, -9.807, 0);
|
|
21
|
-
this.setGravity(gravity);
|
|
22
|
-
this.setTimeStep();
|
|
23
|
-
}
|
|
24
10
|
/**
|
|
25
11
|
*
|
|
26
12
|
* @returns physics plugin version
|
|
@@ -35,6 +21,20 @@ export class PhysicsEngine {
|
|
|
35
21
|
static DefaultPluginFactory() {
|
|
36
22
|
throw _WarnImport("");
|
|
37
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Creates a new Physics Engine
|
|
26
|
+
* @param gravity defines the gravity vector used by the simulation
|
|
27
|
+
* @param _physicsPlugin defines the plugin to use (CannonJS by default)
|
|
28
|
+
*/
|
|
29
|
+
constructor(gravity, _physicsPlugin = PhysicsEngine.DefaultPluginFactory()) {
|
|
30
|
+
this._physicsPlugin = _physicsPlugin;
|
|
31
|
+
/** @internal */
|
|
32
|
+
this._physicsBodies = [];
|
|
33
|
+
this._subTimeStep = 0;
|
|
34
|
+
gravity = gravity || new Vector3(0, -9.807, 0);
|
|
35
|
+
this.setGravity(gravity);
|
|
36
|
+
this.setTimeStep();
|
|
37
|
+
}
|
|
38
38
|
/**
|
|
39
39
|
* Sets the gravity vector used by the simulation
|
|
40
40
|
* @param gravity defines the gravity vector to use
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"physicsEngine.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Physics/v2/physicsEngine.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAGlD,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAGlD;;;GAGG;AACH,gBAAgB;AAChB,MAAM,OAAO,aAAa;
|
|
1
|
+
{"version":3,"file":"physicsEngine.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Physics/v2/physicsEngine.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAGlD,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAGlD;;;GAGG;AACH,gBAAgB;AAChB,MAAM,OAAO,aAAa;IAWtB;;;OAGG;IACI,gBAAgB;QACnB,OAAO,IAAI,CAAC,cAAc,CAAC,gBAAgB,EAAE,CAAC;IAClD,CAAC;IACD;;;OAGG;IACI,MAAM,CAAC,oBAAoB;QAC9B,MAAM,WAAW,CAAC,EAAE,CAAC,CAAC;IAC1B,CAAC;IAED;;;;OAIG;IACH,YAAY,OAA0B,EAAU,iBAAyC,aAAa,CAAC,oBAAoB,EAAE;QAA7E,mBAAc,GAAd,cAAc,CAA+D;QA9B7H,gBAAgB;QACR,mBAAc,GAAuB,EAAE,CAAC;QACxC,iBAAY,GAAW,CAAC,CAAC;QA6B7B,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;IAED;;;OAGG;IACI,UAAU,CAAC,OAAgB;QAC9B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACjD,CAAC;IAED;;;;;;OAMG;IACI,WAAW,CAAC,cAAsB,CAAC,GAAG,EAAE;QAC3C,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;IACjD,CAAC;IAED;;;OAGG;IACI,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AC;IAED;;;;;OAKG;IACI,YAAY,CAAC,IAAa,EAAE,EAAW,EAAE,MAA4B;QACxE,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,EAAE,MAAM,CAAC,CAAC;IAClD,CAAC;IAED;;;;;OAKG;IACI,OAAO,CAAC,IAAa,EAAE,EAAW;QACrC,MAAM,MAAM,GAAG,IAAI,oBAAoB,EAAE,CAAC;QAC1C,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,EAAE,MAAM,CAAC,CAAC;QAC9C,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ","sourcesContent":["import type { Nullable } from \"../../types\";\r\nimport { Vector3 } from \"../../Maths/math.vector\";\r\nimport type { IPhysicsEngine } from \"../IPhysicsEngine\";\r\nimport type { IPhysicsEnginePluginV2 } from \"./IPhysicsEnginePlugin\";\r\nimport { PhysicsRaycastResult } from \"../physicsRaycastResult\";\r\nimport { _WarnImport } from \"../../Misc/devTools\";\r\nimport type { PhysicsBody } from \"./physicsBody\";\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\n/** @internal */\r\nexport class PhysicsEngine implements IPhysicsEngine {\r\n /** @internal */\r\n private _physicsBodies: Array<PhysicsBody> = [];\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 physics plugin 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(): IPhysicsEnginePluginV2 {\r\n throw _WarnImport(\"\");\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: IPhysicsEnginePluginV2 = PhysicsEngine.DefaultPluginFactory()) {\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._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\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 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._physicsBodies);\r\n }\r\n\r\n /**\r\n * Add a body as an active component of this engine\r\n * @param body\r\n */\r\n public addBody(physicsBody: PhysicsBody): void {\r\n this._physicsBodies.push(physicsBody);\r\n }\r\n /**\r\n * Removes a particular body from this engine\r\n */\r\n public removeBody(physicsBody: PhysicsBody): void {\r\n const index = this._physicsBodies.indexOf(physicsBody);\r\n if (index > -1) {\r\n /*const removed =*/ this._physicsBodies.splice(index, 1);\r\n }\r\n }\r\n /**\r\n * Returns an array of bodies added to this engine\r\n\r\n */\r\n public getBodies(): Array<PhysicsBody> {\r\n return this._physicsBodies;\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(): IPhysicsEnginePluginV2 {\r\n return this._physicsPlugin;\r\n }\r\n\r\n /**\r\n * Does a raycast in the physics world\r\n * @param from when should the ray start?\r\n * @param to when should the ray end?\r\n * @param result resulting PhysicsRaycastResult\r\n */\r\n public raycastToRef(from: Vector3, to: Vector3, result: PhysicsRaycastResult): void {\r\n this._physicsPlugin.raycast(from, to, result);\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 const result = new PhysicsRaycastResult();\r\n this._physicsPlugin.raycast(from, to, result);\r\n return result;\r\n }\r\n}\r\n"]}
|