@babylonjs/core 5.35.0 → 5.36.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/Audio/sound.d.ts +5 -0
- package/Audio/sound.js +7 -0
- package/Audio/sound.js.map +1 -1
- package/Debug/physicsViewer.d.ts +4 -3
- package/Debug/physicsViewer.js +2 -2
- package/Debug/physicsViewer.js.map +1 -1
- package/Engines/Extensions/engine.renderTarget.js +15 -15
- package/Engines/Extensions/engine.renderTarget.js.map +1 -1
- package/Engines/Extensions/engine.renderTargetCube.d.ts +1 -1
- package/Engines/Extensions/engine.renderTargetCube.js.map +1 -1
- package/Engines/Extensions/engine.views.d.ts +4 -0
- package/Engines/Extensions/engine.views.js +61 -42
- package/Engines/Extensions/engine.views.js.map +1 -1
- package/Engines/Native/nativeHardwareTexture.d.ts +14 -0
- package/Engines/Native/nativeHardwareTexture.js +24 -0
- package/Engines/Native/nativeHardwareTexture.js.map +1 -0
- package/Engines/Native/nativeInterfaces.d.ts +22 -15
- package/Engines/Native/nativeInterfaces.js.map +1 -1
- package/Engines/Native/nativePipelineContext.d.ts +252 -0
- package/Engines/Native/nativePipelineContext.js +502 -0
- package/Engines/Native/nativePipelineContext.js.map +1 -0
- package/Engines/Native/nativeRenderTargetWrapper.d.ts +16 -0
- package/Engines/Native/nativeRenderTargetWrapper.js +33 -0
- package/Engines/Native/nativeRenderTargetWrapper.js.map +1 -0
- package/Engines/WebGPU/Extensions/engine.renderTarget.js +3 -3
- package/Engines/WebGPU/Extensions/engine.renderTarget.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.renderTargetCube.js.map +1 -1
- package/Engines/engine.d.ts +1 -0
- package/Engines/engine.js +24 -18
- package/Engines/engine.js.map +1 -1
- package/Engines/nativeEngine.d.ts +18 -17
- package/Engines/nativeEngine.js +100 -598
- package/Engines/nativeEngine.js.map +1 -1
- package/Engines/nullEngine.d.ts +1 -1
- package/Engines/nullEngine.js.map +1 -1
- package/Engines/thinEngine.d.ts +1 -1
- package/Engines/thinEngine.js +41 -38
- package/Engines/thinEngine.js.map +1 -1
- package/Engines/webgpuEngine.js.map +1 -1
- package/Gizmos/planeRotationGizmo.js +3 -1
- package/Gizmos/planeRotationGizmo.js.map +1 -1
- package/Inputs/scene.inputManager.js +4 -4
- package/Inputs/scene.inputManager.js.map +1 -1
- package/Loading/Plugins/babylonFileLoader.js +3 -3
- package/Loading/Plugins/babylonFileLoader.js.map +1 -1
- package/Materials/Node/Blocks/Dual/textureBlock.js +1 -1
- package/Materials/Node/Blocks/Dual/textureBlock.js.map +1 -1
- package/Materials/Node/nodeMaterial.d.ts +19 -1
- package/Materials/Node/nodeMaterial.js +30 -0
- package/Materials/Node/nodeMaterial.js.map +1 -1
- package/Materials/Node/nodeMaterialBuildStateSharedData.d.ts +2 -8
- package/Materials/Node/nodeMaterialBuildStateSharedData.js.map +1 -1
- package/Materials/Textures/baseTexture.d.ts +2 -1
- package/Materials/Textures/baseTexture.js +3 -2
- package/Materials/Textures/baseTexture.js.map +1 -1
- package/Materials/Textures/internalTexture.d.ts +2 -0
- package/Materials/Textures/internalTexture.js +4 -0
- package/Materials/Textures/internalTexture.js.map +1 -1
- package/Materials/Textures/mirrorTexture.js +0 -2
- package/Materials/Textures/mirrorTexture.js.map +1 -1
- package/Materials/Textures/renderTargetTexture.d.ts +53 -3
- package/Materials/Textures/renderTargetTexture.js +25 -25
- package/Materials/Textures/renderTargetTexture.js.map +1 -1
- package/Materials/Textures/texture.d.ts +2 -0
- package/Materials/Textures/texture.js +35 -7
- package/Materials/Textures/texture.js.map +1 -1
- package/Materials/Textures/textureCreationOptions.d.ts +4 -1
- package/Materials/Textures/textureCreationOptions.js.map +1 -1
- package/Materials/material.js +1 -1
- package/Materials/material.js.map +1 -1
- package/Meshes/abstractMesh.d.ts +4 -4
- package/Meshes/abstractMesh.js +4 -4
- package/Meshes/abstractMesh.js.map +1 -1
- package/Meshes/mesh.d.ts +2 -2
- package/Meshes/mesh.js +1 -1
- package/Meshes/mesh.js.map +1 -1
- package/Misc/copyTextureToTexture.d.ts +9 -2
- package/Misc/copyTextureToTexture.js +23 -1
- package/Misc/copyTextureToTexture.js.map +1 -1
- package/Particles/IParticleSystem.d.ts +15 -1
- package/Particles/IParticleSystem.js.map +1 -1
- package/Particles/gpuParticleSystem.d.ts +24 -2
- package/Particles/gpuParticleSystem.js +98 -43
- package/Particles/gpuParticleSystem.js.map +1 -1
- package/Particles/particleSystem.d.ts +6 -1
- package/Particles/particleSystem.js +7 -2
- package/Particles/particleSystem.js.map +1 -1
- package/Physics/IPhysicsEngine.d.ts +8 -108
- package/Physics/IPhysicsEngine.js.map +1 -1
- package/Physics/Plugins/ammoJSPlugin.d.ts +1 -389
- package/Physics/Plugins/ammoJSPlugin.js +2 -1414
- package/Physics/Plugins/ammoJSPlugin.js.map +1 -1
- package/Physics/Plugins/cannonJSPlugin.d.ts +1 -75
- package/Physics/Plugins/cannonJSPlugin.js +2 -664
- package/Physics/Plugins/cannonJSPlugin.js.map +1 -1
- package/Physics/Plugins/oimoJSPlugin.d.ts +1 -59
- package/Physics/Plugins/oimoJSPlugin.js +2 -432
- package/Physics/Plugins/oimoJSPlugin.js.map +1 -1
- package/Physics/index.d.ts +3 -6
- package/Physics/index.js +3 -6
- package/Physics/index.js.map +1 -1
- package/Physics/physicsEngine.d.ts +1 -135
- package/Physics/physicsEngine.js +2 -221
- package/Physics/physicsEngine.js.map +1 -1
- package/Physics/physicsEngineComponent.d.ts +7 -42
- package/Physics/physicsEngineComponent.js +11 -71
- package/Physics/physicsEngineComponent.js.map +1 -1
- package/Physics/physicsHelper.d.ts +1 -411
- package/Physics/physicsHelper.js +2 -708
- package/Physics/physicsHelper.js.map +1 -1
- package/Physics/physicsImpostor.d.ts +1 -640
- package/Physics/physicsImpostor.js +2 -1004
- package/Physics/physicsImpostor.js.map +1 -1
- package/Physics/physicsJoint.d.ts +1 -275
- package/Physics/physicsJoint.js +2 -222
- package/Physics/physicsJoint.js.map +1 -1
- package/Physics/v1/IPhysicsEnginePlugin.d.ts +73 -0
- package/Physics/v1/IPhysicsEnginePlugin.js +2 -0
- package/Physics/v1/IPhysicsEnginePlugin.js.map +1 -0
- package/Physics/v1/Plugins/ammoJSPlugin.d.ts +401 -0
- package/Physics/v1/Plugins/ammoJSPlugin.js +1431 -0
- package/Physics/v1/Plugins/ammoJSPlugin.js.map +1 -0
- package/Physics/v1/Plugins/cannonJSPlugin.d.ts +87 -0
- package/Physics/v1/Plugins/cannonJSPlugin.js +683 -0
- package/Physics/v1/Plugins/cannonJSPlugin.js.map +1 -0
- package/Physics/{Plugins → v1/Plugins}/index.d.ts +0 -0
- package/Physics/{Plugins → v1/Plugins}/index.js +0 -0
- package/Physics/v1/Plugins/index.js.map +1 -0
- package/Physics/v1/Plugins/oimoJSPlugin.d.ts +71 -0
- package/Physics/v1/Plugins/oimoJSPlugin.js +450 -0
- package/Physics/v1/Plugins/oimoJSPlugin.js.map +1 -0
- package/Physics/v1/index.d.ts +7 -0
- package/Physics/v1/index.js +9 -0
- package/Physics/v1/index.js.map +1 -0
- package/Physics/v1/physicsEngine.d.ts +147 -0
- package/Physics/v1/physicsEngine.js +237 -0
- package/Physics/v1/physicsEngine.js.map +1 -0
- package/Physics/v1/physicsEngineComponent.d.ts +45 -0
- package/Physics/v1/physicsEngineComponent.js +70 -0
- package/Physics/v1/physicsEngineComponent.js.map +1 -0
- package/Physics/v1/physicsHelper.d.ts +411 -0
- package/Physics/v1/physicsHelper.js +709 -0
- package/Physics/v1/physicsHelper.js.map +1 -0
- package/Physics/v1/physicsImpostor.d.ts +636 -0
- package/Physics/v1/physicsImpostor.js +1001 -0
- package/Physics/v1/physicsImpostor.js.map +1 -0
- package/Physics/v1/physicsJoint.d.ts +275 -0
- package/Physics/v1/physicsJoint.js +223 -0
- package/Physics/v1/physicsJoint.js.map +1 -0
- package/Physics/v2/IPhysicsEnginePlugin.d.ts +170 -0
- package/Physics/v2/IPhysicsEnginePlugin.js +47 -0
- package/Physics/v2/IPhysicsEnginePlugin.js.map +1 -0
- package/Physics/v2/Plugins/index.d.ts +0 -0
- package/Physics/v2/Plugins/index.js +2 -0
- package/Physics/v2/Plugins/index.js.map +1 -0
- package/Physics/v2/index.d.ts +6 -0
- package/Physics/v2/index.js +8 -0
- package/Physics/v2/index.js.map +1 -0
- package/Physics/v2/physicsAggregate.d.ts +114 -0
- package/Physics/v2/physicsAggregate.js +46 -0
- package/Physics/v2/physicsAggregate.js.map +1 -0
- package/Physics/v2/physicsBody.d.ts +109 -0
- package/Physics/v2/physicsBody.js +158 -0
- package/Physics/v2/physicsBody.js.map +1 -0
- package/Physics/v2/physicsConstraint.d.ts +184 -0
- package/Physics/v2/physicsConstraint.js +257 -0
- package/Physics/v2/physicsConstraint.js.map +1 -0
- package/Physics/v2/physicsEngine.d.ts +103 -0
- package/Physics/v2/physicsEngine.js +146 -0
- package/Physics/v2/physicsEngine.js.map +1 -0
- package/Physics/v2/physicsEngineComponent.d.ts +31 -0
- package/Physics/v2/physicsEngineComponent.js +50 -0
- package/Physics/v2/physicsEngineComponent.js.map +1 -0
- package/Physics/v2/physicsMaterial.d.ts +45 -0
- package/Physics/v2/physicsMaterial.js +67 -0
- package/Physics/v2/physicsMaterial.js.map +1 -0
- package/Physics/v2/physicsShape.d.ts +182 -0
- package/Physics/v2/physicsShape.js +229 -0
- package/Physics/v2/physicsShape.js.map +1 -0
- package/PostProcesses/postProcess.d.ts +3 -1
- package/PostProcesses/postProcess.js +4 -1
- package/PostProcesses/postProcess.js.map +1 -1
- package/Rendering/fluidRenderer/fluidRenderer.d.ts +153 -0
- package/Rendering/fluidRenderer/fluidRenderer.js +410 -0
- package/Rendering/fluidRenderer/fluidRenderer.js.map +1 -0
- package/Rendering/fluidRenderer/fluidRenderingDepthTextureCopy.d.ts +13 -0
- package/Rendering/fluidRenderer/fluidRenderingDepthTextureCopy.js +31 -0
- package/Rendering/fluidRenderer/fluidRenderingDepthTextureCopy.js.map +1 -0
- package/Rendering/fluidRenderer/fluidRenderingObject.d.ts +81 -0
- package/Rendering/fluidRenderer/fluidRenderingObject.js +180 -0
- package/Rendering/fluidRenderer/fluidRenderingObject.js.map +1 -0
- package/Rendering/fluidRenderer/fluidRenderingObjectCustomParticles.d.ts +63 -0
- package/Rendering/fluidRenderer/fluidRenderingObjectCustomParticles.js +130 -0
- package/Rendering/fluidRenderer/fluidRenderingObjectCustomParticles.js.map +1 -0
- package/Rendering/fluidRenderer/fluidRenderingObjectParticleSystem.d.ts +64 -0
- package/Rendering/fluidRenderer/fluidRenderingObjectParticleSystem.js +104 -0
- package/Rendering/fluidRenderer/fluidRenderingObjectParticleSystem.js.map +1 -0
- package/Rendering/fluidRenderer/fluidRenderingTargetRenderer.d.ts +234 -0
- package/Rendering/fluidRenderer/fluidRenderingTargetRenderer.js +690 -0
- package/Rendering/fluidRenderer/fluidRenderingTargetRenderer.js.map +1 -0
- package/Rendering/fluidRenderer/fluidRenderingTextures.d.ts +56 -0
- package/Rendering/fluidRenderer/fluidRenderingTextures.js +261 -0
- package/Rendering/fluidRenderer/fluidRenderingTextures.js.map +1 -0
- package/Rendering/fluidRenderer/index.d.ts +5 -0
- package/Rendering/fluidRenderer/index.js +6 -0
- package/Rendering/fluidRenderer/index.js.map +1 -0
- package/Rendering/index.d.ts +1 -0
- package/Rendering/index.js +2 -0
- package/Rendering/index.js.map +1 -1
- package/Shaders/copyTextureToTexture.fragment.js +4 -1
- package/Shaders/copyTextureToTexture.fragment.js.map +1 -1
- package/Shaders/fluidRenderingBilateralBlur.fragment.d.ts +5 -0
- package/Shaders/fluidRenderingBilateralBlur.fragment.js +9 -0
- package/Shaders/fluidRenderingBilateralBlur.fragment.js.map +1 -0
- package/Shaders/fluidRenderingParticleDepth.fragment.d.ts +5 -0
- package/Shaders/fluidRenderingParticleDepth.fragment.js +17 -0
- package/Shaders/fluidRenderingParticleDepth.fragment.js.map +1 -0
- package/Shaders/fluidRenderingParticleDepth.vertex.d.ts +5 -0
- package/Shaders/fluidRenderingParticleDepth.vertex.js +13 -0
- package/Shaders/fluidRenderingParticleDepth.vertex.js.map +1 -0
- package/Shaders/fluidRenderingParticleDiffuse.fragment.d.ts +5 -0
- package/Shaders/fluidRenderingParticleDiffuse.fragment.js +9 -0
- package/Shaders/fluidRenderingParticleDiffuse.fragment.js.map +1 -0
- package/Shaders/fluidRenderingParticleDiffuse.vertex.d.ts +5 -0
- package/Shaders/fluidRenderingParticleDiffuse.vertex.js +4 -0
- package/Shaders/fluidRenderingParticleDiffuse.vertex.js.map +1 -0
- package/Shaders/fluidRenderingParticleThickness.fragment.d.ts +5 -0
- package/Shaders/fluidRenderingParticleThickness.fragment.js +9 -0
- package/Shaders/fluidRenderingParticleThickness.fragment.js.map +1 -0
- package/Shaders/fluidRenderingParticleThickness.vertex.d.ts +5 -0
- package/Shaders/fluidRenderingParticleThickness.vertex.js +9 -0
- package/Shaders/fluidRenderingParticleThickness.vertex.js.map +1 -0
- package/Shaders/fluidRenderingRender.fragment.d.ts +5 -0
- package/Shaders/fluidRenderingRender.fragment.js +46 -0
- package/Shaders/fluidRenderingRender.fragment.js.map +1 -0
- package/Shaders/fluidRenderingStandardBlur.fragment.d.ts +5 -0
- package/Shaders/fluidRenderingStandardBlur.fragment.js +9 -0
- package/Shaders/fluidRenderingStandardBlur.fragment.js.map +1 -0
- package/XR/features/WebXRControllerPhysics.d.ts +1 -1
- package/XR/features/WebXRControllerPhysics.js +1 -1
- package/XR/features/WebXRControllerPhysics.js.map +1 -1
- package/XR/features/WebXRHandTracking.js +1 -1
- package/XR/features/WebXRHandTracking.js.map +1 -1
- package/package.json +1 -1
- package/scene.js +6 -1
- package/scene.js.map +1 -1
- package/sceneComponent.d.ts +3 -0
- package/sceneComponent.js +3 -0
- package/sceneComponent.js.map +1 -1
- package/Physics/Plugins/index.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"physicsJoint.js","sourceRoot":"","sources":["../../../../lts/core/generated/Physics/physicsJoint.ts"],"names":[],"mappings":"AAkCA;;;;GAIG;AACH,MAAM,OAAO,YAAY;IAIrB;;;;OAIG;IACH;IACI;;OAEG;IACI,IAAY;IACnB;;OAEG;IACI,SAA2B;QAJ3B,SAAI,GAAJ,IAAI,CAAQ;QAIZ,cAAS,GAAT,SAAS,CAAkB;QAElC,SAAS,CAAC,YAAY,GAAG,SAAS,CAAC,YAAY,IAAI,EAAE,CAAC;IAC1D,CAAC;IAED;;OAEG;IACH,IAAW,YAAY;QACnB,OAAO,IAAI,CAAC,aAAa,CAAC;IAC9B,CAAC;IAED;;OAEG;IACH,IAAW,YAAY,CAAC,QAAa;QACjC,IAAI,IAAI,CAAC,aAAa,EAAE;YACpB,uBAAuB;SAC1B;QAED,IAAI,CAAC,aAAa,GAAG,QAAQ,CAAC;IAClC,CAAC;IAED;;OAEG;IACH,IAAW,aAAa,CAAC,aAAmC;QACxD,IAAI,CAAC,cAAc,GAAG,aAAa,CAAC;IACxC,CAAC;IAED;;;;OAIG;IACI,qBAAqB,CAAC,IAA6C;QACtE,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;IACxD,CAAC;;AAED,8CAA8C;AAE9C,aAAa;AACb;;GAEG;AACW,0BAAa,GAAG,CAAC,CAAC;AAChC;;GAEG;AACW,uBAAU,GAAG,CAAC,CAAC;AAC7B;;GAEG;AACW,+BAAkB,GAAG,CAAC,CAAC;AACrC;;GAEG;AACW,uBAAU,GAAG,CAAC,CAAC;AAC7B;;GAEG;AACW,wBAAW,GAAG,CAAC,CAAC;AAC9B,MAAM;AACN;;GAEG;AACW,2BAAc,GAAG,CAAC,CAAC;AACjC,EAAE;AACF;;;GAGG;AACW,2BAAc,GAAG,CAAC,CAAC;AACjC;;GAEG;AACW,wBAAW,GAAG,YAAY,CAAC,UAAU,CAAC;AACpD,QAAQ;AACR;;GAEG;AACW,8BAAiB,GAAG,CAAC,CAAC;AACpC,2BAA2B;AAC3B;;GAEG;AACW,wBAAW,GAAG,CAAC,CAAC;AAC9B;;GAEG;AACW,sBAAS,GAAG,EAAE,CAAC;AAGjC;;;GAGG;AACH,MAAM,OAAO,aAAc,SAAQ,YAAY;IAC3C;;;OAGG;IACH,YAAY,SAA4B;QACpC,KAAK,CAAC,YAAY,CAAC,aAAa,EAAE,SAAS,CAAC,CAAC;IACjD,CAAC;IAED;;;;OAIG;IACI,cAAc,CAAC,WAAmB,EAAE,WAAoB;QAC3D,IAAI,CAAC,cAAc,CAAC,mBAAmB,CAAC,IAAI,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC;IAC5E,CAAC;CACJ;AAED;;;GAGG;AACH,MAAM,OAAO,iBAAkB,SAAQ,YAAY;IAC/C;;;;OAIG;IACH,YAAY,IAAY,EAAE,SAA2B;QACjD,KAAK,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IAC3B,CAAC;IAED;;;;;OAKG;IACI,QAAQ,CAAC,KAAc,EAAE,QAAiB;QAC7C,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,IAAI,EAAE,KAAK,IAAI,CAAC,EAAE,QAAQ,CAAC,CAAC;IAC7D,CAAC;IAED;;;;;OAKG;IACI,QAAQ,CAAC,UAAkB,EAAE,UAAmB;QACnD,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,IAAI,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;IAC/D,CAAC;CACJ;AAED;;;GAGG;AACH,MAAM,OAAO,UAAW,SAAQ,iBAAiB;IAC7C;;;OAGG;IACH,YAAY,SAA2B;QACnC,KAAK,CAAC,YAAY,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;IAC9C,CAAC;IAED;;;;;OAKG;IACI,QAAQ,CAAC,KAAc,EAAE,QAAiB;QAC7C,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,IAAI,EAAE,KAAK,IAAI,CAAC,EAAE,QAAQ,CAAC,CAAC;IAC7D,CAAC;IAED;;;;;OAKG;IACI,QAAQ,CAAC,UAAkB,EAAE,UAAmB;QACnD,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,IAAI,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;IAC/D,CAAC;CACJ;AAED;;;GAGG;AACH,MAAM,OAAO,WAAY,SAAQ,iBAAiB;IAC9C;;;OAGG;IACH,YAAY,SAA2B;QACnC,KAAK,CAAC,YAAY,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;IAC/C,CAAC;IAED;;;;;;OAMG;IACI,QAAQ,CAAC,WAAoB,EAAE,QAAiB,EAAE,aAAqB,CAAC;QAC3E,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,IAAI,EAAE,WAAW,IAAI,CAAC,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;IAC/E,CAAC;IAED;;;;;;OAMG;IACI,QAAQ,CAAC,UAAkB,EAAE,UAAmB,EAAE,aAAqB,CAAC;QAC3E,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;IAC3E,CAAC;CACJ","sourcesContent":["import type { Vector3 } from \"../Maths/math.vector\";\r\nimport type { IPhysicsEnginePlugin } from \"./IPhysicsEngine\";\r\n/**\r\n * Interface for Physics-Joint data\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine\r\n */\r\nexport interface PhysicsJointData {\r\n //Important for some engines, optional!\r\n /**\r\n * The main pivot of the joint\r\n */\r\n mainPivot?: Vector3;\r\n /**\r\n * The connected pivot of the joint\r\n */\r\n connectedPivot?: Vector3;\r\n /**\r\n * The main axis of the joint\r\n */\r\n mainAxis?: Vector3;\r\n /**\r\n * The connected axis of the joint\r\n */\r\n connectedAxis?: Vector3;\r\n /**\r\n * The collision of the joint\r\n */\r\n collision?: boolean;\r\n /**\r\n * Native Oimo/Cannon/Energy data\r\n */\r\n nativeParams?: any;\r\n}\r\n\r\n/**\r\n * This is a holder class for the physics joint created by the physics plugin\r\n * It holds a set of functions to control the underlying joint\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine\r\n */\r\nexport class PhysicsJoint {\r\n private _physicsJoint: any;\r\n protected _physicsPlugin: IPhysicsEnginePlugin;\r\n\r\n /**\r\n * Initializes the physics joint\r\n * @param type The type of the physics joint\r\n * @param jointData The data for the physics joint\r\n */\r\n constructor(\r\n /**\r\n * The type of the physics joint\r\n */\r\n public type: number,\r\n /**\r\n * The data for the physics joint\r\n */\r\n public jointData: PhysicsJointData\r\n ) {\r\n jointData.nativeParams = jointData.nativeParams || {};\r\n }\r\n\r\n /**\r\n * Gets the physics joint\r\n */\r\n public get physicsJoint(): any {\r\n return this._physicsJoint;\r\n }\r\n\r\n /**\r\n * Sets the physics joint\r\n */\r\n public set physicsJoint(newJoint: any) {\r\n if (this._physicsJoint) {\r\n //remove from the world\r\n }\r\n\r\n this._physicsJoint = newJoint;\r\n }\r\n\r\n /**\r\n * Sets the physics plugin\r\n */\r\n public set physicsPlugin(physicsPlugin: IPhysicsEnginePlugin) {\r\n this._physicsPlugin = physicsPlugin;\r\n }\r\n\r\n /**\r\n * Execute a function that is physics-plugin specific.\r\n * @param {Function} func the function that will be executed.\r\n * It accepts two parameters: the physics world and the physics joint\r\n */\r\n public executeNativeFunction(func: (world: any, physicsJoint: any) => void) {\r\n func(this._physicsPlugin.world, this._physicsJoint);\r\n }\r\n\r\n //TODO check if the native joints are the same\r\n\r\n //Joint Types\r\n /**\r\n * Distance-Joint type\r\n */\r\n public static DistanceJoint = 0;\r\n /**\r\n * Hinge-Joint type\r\n */\r\n public static HingeJoint = 1;\r\n /**\r\n * Ball-and-Socket joint type\r\n */\r\n public static BallAndSocketJoint = 2;\r\n /**\r\n * Wheel-Joint type\r\n */\r\n public static WheelJoint = 3;\r\n /**\r\n * Slider-Joint type\r\n */\r\n public static SliderJoint = 4;\r\n //OIMO\r\n /**\r\n * Prismatic-Joint type\r\n */\r\n public static PrismaticJoint = 5;\r\n //\r\n /**\r\n * Universal-Joint type\r\n * ENERGY FTW! (compare with this - @see http://ode-wiki.org/wiki/index.php?title=Manual:_Joint_Types_and_Functions)\r\n */\r\n public static UniversalJoint = 6;\r\n /**\r\n * Hinge-Joint 2 type\r\n */\r\n public static Hinge2Joint = PhysicsJoint.WheelJoint;\r\n //Cannon\r\n /**\r\n * Point to Point Joint type. Similar to a Ball-Joint. Different in parameters\r\n */\r\n public static PointToPointJoint = 8;\r\n //Cannon only at the moment\r\n /**\r\n * Spring-Joint type\r\n */\r\n public static SpringJoint = 9;\r\n /**\r\n * Lock-Joint type\r\n */\r\n public static LockJoint = 10;\r\n}\r\n\r\n/**\r\n * A class representing a physics distance joint\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine\r\n */\r\nexport class DistanceJoint extends PhysicsJoint {\r\n /**\r\n *\r\n * @param jointData The data for the Distance-Joint\r\n */\r\n constructor(jointData: DistanceJointData) {\r\n super(PhysicsJoint.DistanceJoint, jointData);\r\n }\r\n\r\n /**\r\n * Update the predefined distance.\r\n * @param maxDistance The maximum preferred distance\r\n * @param minDistance The minimum preferred distance\r\n */\r\n public updateDistance(maxDistance: number, minDistance?: number) {\r\n this._physicsPlugin.updateDistanceJoint(this, maxDistance, minDistance);\r\n }\r\n}\r\n\r\n/**\r\n * Represents a Motor-Enabled Joint\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine\r\n */\r\nexport class MotorEnabledJoint extends PhysicsJoint implements IMotorEnabledJoint {\r\n /**\r\n * Initializes the Motor-Enabled Joint\r\n * @param type The type of the joint\r\n * @param jointData The physical joint data for the joint\r\n */\r\n constructor(type: number, jointData: PhysicsJointData) {\r\n super(type, jointData);\r\n }\r\n\r\n /**\r\n * Set the motor values.\r\n * Attention, this function is plugin specific. Engines won't react 100% the same.\r\n * @param force the force to apply\r\n * @param maxForce max force for this motor.\r\n */\r\n public setMotor(force?: number, maxForce?: number) {\r\n this._physicsPlugin.setMotor(this, force || 0, maxForce);\r\n }\r\n\r\n /**\r\n * Set the motor's limits.\r\n * Attention, this function is plugin specific. Engines won't react 100% the same.\r\n * @param upperLimit The upper limit of the motor\r\n * @param lowerLimit The lower limit of the motor\r\n */\r\n public setLimit(upperLimit: number, lowerLimit?: number) {\r\n this._physicsPlugin.setLimit(this, upperLimit, lowerLimit);\r\n }\r\n}\r\n\r\n/**\r\n * This class represents a single physics Hinge-Joint\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine\r\n */\r\nexport class HingeJoint extends MotorEnabledJoint {\r\n /**\r\n * Initializes the Hinge-Joint\r\n * @param jointData The joint data for the Hinge-Joint\r\n */\r\n constructor(jointData: PhysicsJointData) {\r\n super(PhysicsJoint.HingeJoint, jointData);\r\n }\r\n\r\n /**\r\n * Set the motor values.\r\n * Attention, this function is plugin specific. Engines won't react 100% the same.\r\n * @param {number} force the force to apply\r\n * @param {number} maxForce max force for this motor.\r\n */\r\n public setMotor(force?: number, maxForce?: number) {\r\n this._physicsPlugin.setMotor(this, force || 0, maxForce);\r\n }\r\n\r\n /**\r\n * Set the motor's limits.\r\n * Attention, this function is plugin specific. Engines won't react 100% the same.\r\n * @param upperLimit The upper limit of the motor\r\n * @param lowerLimit The lower limit of the motor\r\n */\r\n public setLimit(upperLimit: number, lowerLimit?: number) {\r\n this._physicsPlugin.setLimit(this, upperLimit, lowerLimit);\r\n }\r\n}\r\n\r\n/**\r\n * This class represents a dual hinge physics joint (same as wheel joint)\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine\r\n */\r\nexport class Hinge2Joint extends MotorEnabledJoint {\r\n /**\r\n * Initializes the Hinge2-Joint\r\n * @param jointData The joint data for the Hinge2-Joint\r\n */\r\n constructor(jointData: PhysicsJointData) {\r\n super(PhysicsJoint.Hinge2Joint, jointData);\r\n }\r\n\r\n /**\r\n * Set the motor values.\r\n * Attention, this function is plugin specific. Engines won't react 100% the same.\r\n * @param targetSpeed the speed the motor is to reach\r\n * @param maxForce max force for this motor.\r\n * @param motorIndex motor's index, 0 or 1.\r\n */\r\n public setMotor(targetSpeed?: number, maxForce?: number, motorIndex: number = 0) {\r\n this._physicsPlugin.setMotor(this, targetSpeed || 0, maxForce, motorIndex);\r\n }\r\n\r\n /**\r\n * Set the motor limits.\r\n * Attention, this function is plugin specific. Engines won't react 100% the same.\r\n * @param upperLimit the upper limit\r\n * @param lowerLimit lower limit\r\n * @param motorIndex the motor's index, 0 or 1.\r\n */\r\n public setLimit(upperLimit: number, lowerLimit?: number, motorIndex: number = 0) {\r\n this._physicsPlugin.setLimit(this, upperLimit, lowerLimit, motorIndex);\r\n }\r\n}\r\n\r\n/**\r\n * Interface for a motor enabled joint\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine\r\n */\r\nexport interface IMotorEnabledJoint {\r\n /**\r\n * Physics joint\r\n */\r\n physicsJoint: any;\r\n /**\r\n * Sets the motor of the motor-enabled joint\r\n * @param force The force of the motor\r\n * @param maxForce The maximum force of the motor\r\n * @param motorIndex The index of the motor\r\n */\r\n setMotor(force?: number, maxForce?: number, motorIndex?: number): void;\r\n /**\r\n * Sets the limit of the motor\r\n * @param upperLimit The upper limit of the motor\r\n * @param lowerLimit The lower limit of the motor\r\n * @param motorIndex The index of the motor\r\n */\r\n setLimit(upperLimit: number, lowerLimit?: number, motorIndex?: number): void;\r\n}\r\n\r\n/**\r\n * Joint data for a Distance-Joint\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine\r\n */\r\nexport interface DistanceJointData extends PhysicsJointData {\r\n /**\r\n * Max distance the 2 joint objects can be apart\r\n */\r\n maxDistance: number;\r\n //Oimo - minDistance\r\n //Cannon - maxForce\r\n}\r\n\r\n/**\r\n * Joint data from a spring joint\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine\r\n */\r\nexport interface SpringJointData extends PhysicsJointData {\r\n /**\r\n * Length of the spring\r\n */\r\n length: number;\r\n /**\r\n * Stiffness of the spring\r\n */\r\n stiffness: number;\r\n /**\r\n * Damping of the spring\r\n */\r\n damping: number;\r\n /** this callback will be called when applying the force to the impostors. */\r\n forceApplicationCallback: () => void;\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"physicsJoint.js","sourceRoot":"","sources":["../../../../lts/core/generated/Physics/physicsJoint.ts"],"names":[],"mappings":"AAAA,qBAAqB;AACrB,cAAc,mBAAmB,CAAC","sourcesContent":["// ES 6 Compatibility\r\nexport * from \"./v1/physicsJoint\";\r\n"]}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { Nullable } from "../../types";
|
|
2
|
+
import type { Vector3, Quaternion } from "../../Maths/math.vector";
|
|
3
|
+
import type { AbstractMesh } from "../../Meshes/abstractMesh";
|
|
4
|
+
import type { PhysicsImpostor } from "./physicsImpostor";
|
|
5
|
+
import type { PhysicsJoint, IMotorEnabledJoint } from "./physicsJoint";
|
|
6
|
+
import type { PhysicsRaycastResult } from "../physicsRaycastResult";
|
|
7
|
+
/**
|
|
8
|
+
* Interface used to describe a physics joint
|
|
9
|
+
*/
|
|
10
|
+
export interface PhysicsImpostorJoint {
|
|
11
|
+
/** Defines the main impostor to which the joint is linked */
|
|
12
|
+
mainImpostor: PhysicsImpostor;
|
|
13
|
+
/** Defines the impostor that is connected to the main impostor using this joint */
|
|
14
|
+
connectedImpostor: PhysicsImpostor;
|
|
15
|
+
/** Defines the joint itself */
|
|
16
|
+
joint: PhysicsJoint;
|
|
17
|
+
}
|
|
18
|
+
/** @internal */
|
|
19
|
+
export interface IPhysicsEnginePlugin {
|
|
20
|
+
/**
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
world: any;
|
|
24
|
+
/**
|
|
25
|
+
*
|
|
26
|
+
*/
|
|
27
|
+
name: string;
|
|
28
|
+
setGravity(gravity: Vector3): void;
|
|
29
|
+
setTimeStep(timeStep: number): void;
|
|
30
|
+
getTimeStep(): number;
|
|
31
|
+
executeStep(delta: number, impostors: Array<PhysicsImpostor>): void;
|
|
32
|
+
getPluginVersion(): number;
|
|
33
|
+
applyImpulse(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): void;
|
|
34
|
+
applyForce(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): void;
|
|
35
|
+
generatePhysicsBody(impostor: PhysicsImpostor): void;
|
|
36
|
+
removePhysicsBody(impostor: PhysicsImpostor): void;
|
|
37
|
+
generateJoint(joint: PhysicsImpostorJoint): void;
|
|
38
|
+
removeJoint(joint: PhysicsImpostorJoint): void;
|
|
39
|
+
isSupported(): boolean;
|
|
40
|
+
setTransformationFromPhysicsBody(impostor: PhysicsImpostor): void;
|
|
41
|
+
setPhysicsBodyTransformation(impostor: PhysicsImpostor, newPosition: Vector3, newRotation: Quaternion): void;
|
|
42
|
+
setLinearVelocity(impostor: PhysicsImpostor, velocity: Nullable<Vector3>): void;
|
|
43
|
+
setAngularVelocity(impostor: PhysicsImpostor, velocity: Nullable<Vector3>): void;
|
|
44
|
+
getLinearVelocity(impostor: PhysicsImpostor): Nullable<Vector3>;
|
|
45
|
+
getAngularVelocity(impostor: PhysicsImpostor): Nullable<Vector3>;
|
|
46
|
+
setBodyMass(impostor: PhysicsImpostor, mass: number): void;
|
|
47
|
+
getBodyMass(impostor: PhysicsImpostor): number;
|
|
48
|
+
getBodyFriction(impostor: PhysicsImpostor): number;
|
|
49
|
+
setBodyFriction(impostor: PhysicsImpostor, friction: number): void;
|
|
50
|
+
getBodyRestitution(impostor: PhysicsImpostor): number;
|
|
51
|
+
setBodyRestitution(impostor: PhysicsImpostor, restitution: number): void;
|
|
52
|
+
getBodyPressure?(impostor: PhysicsImpostor): number;
|
|
53
|
+
setBodyPressure?(impostor: PhysicsImpostor, pressure: number): void;
|
|
54
|
+
getBodyStiffness?(impostor: PhysicsImpostor): number;
|
|
55
|
+
setBodyStiffness?(impostor: PhysicsImpostor, stiffness: number): void;
|
|
56
|
+
getBodyVelocityIterations?(impostor: PhysicsImpostor): number;
|
|
57
|
+
setBodyVelocityIterations?(impostor: PhysicsImpostor, velocityIterations: number): void;
|
|
58
|
+
getBodyPositionIterations?(impostor: PhysicsImpostor): number;
|
|
59
|
+
setBodyPositionIterations?(impostor: PhysicsImpostor, positionIterations: number): void;
|
|
60
|
+
appendAnchor?(impostor: PhysicsImpostor, otherImpostor: PhysicsImpostor, width: number, height: number, influence: number, noCollisionBetweenLinkedBodies: boolean): void;
|
|
61
|
+
appendHook?(impostor: PhysicsImpostor, otherImpostor: PhysicsImpostor, length: number, influence: number, noCollisionBetweenLinkedBodies: boolean): void;
|
|
62
|
+
sleepBody(impostor: PhysicsImpostor): void;
|
|
63
|
+
wakeUpBody(impostor: PhysicsImpostor): void;
|
|
64
|
+
raycast(from: Vector3, to: Vector3): PhysicsRaycastResult;
|
|
65
|
+
raycastToRef(from: Vector3, to: Vector3, result: PhysicsRaycastResult): void;
|
|
66
|
+
updateDistanceJoint(joint: PhysicsJoint, maxDistance: number, minDistance?: number): void;
|
|
67
|
+
setMotor(joint: IMotorEnabledJoint, speed: number, maxForce?: number, motorIndex?: number): void;
|
|
68
|
+
setLimit(joint: IMotorEnabledJoint, upperLimit: number, lowerLimit?: number, motorIndex?: number): void;
|
|
69
|
+
getRadius(impostor: PhysicsImpostor): number;
|
|
70
|
+
getBoxSizeToRef(impostor: PhysicsImpostor, result: Vector3): void;
|
|
71
|
+
syncMeshWithImpostor(mesh: AbstractMesh, impostor: PhysicsImpostor): void;
|
|
72
|
+
dispose(): void;
|
|
73
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IPhysicsEnginePlugin.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Physics/v1/IPhysicsEnginePlugin.ts"],"names":[],"mappings":"","sourcesContent":["import type { Nullable } from \"../../types\";\r\nimport type { Vector3, Quaternion } from \"../../Maths/math.vector\";\r\nimport type { AbstractMesh } from \"../../Meshes/abstractMesh\";\r\nimport type { PhysicsImpostor } from \"./physicsImpostor\";\r\nimport type { PhysicsJoint, IMotorEnabledJoint } from \"./physicsJoint\";\r\nimport type { PhysicsRaycastResult } from \"../physicsRaycastResult\";\r\n\r\n/**\r\n * Interface used to describe a physics joint\r\n */\r\nexport interface PhysicsImpostorJoint {\r\n /** Defines the main impostor to which the joint is linked */\r\n mainImpostor: PhysicsImpostor;\r\n /** Defines the impostor that is connected to the main impostor using this joint */\r\n connectedImpostor: PhysicsImpostor;\r\n /** Defines the joint itself */\r\n joint: PhysicsJoint;\r\n}\r\n\r\n/** @internal */\r\nexport interface IPhysicsEnginePlugin {\r\n /**\r\n *\r\n */\r\n world: any;\r\n /**\r\n *\r\n */\r\n name: string;\r\n setGravity(gravity: Vector3): void;\r\n setTimeStep(timeStep: number): void;\r\n getTimeStep(): number;\r\n executeStep(delta: number, impostors: Array<PhysicsImpostor>): void; //not forgetting pre and post events\r\n getPluginVersion(): number;\r\n applyImpulse(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): void;\r\n applyForce(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): void;\r\n generatePhysicsBody(impostor: PhysicsImpostor): void;\r\n removePhysicsBody(impostor: PhysicsImpostor): void;\r\n generateJoint(joint: PhysicsImpostorJoint): void;\r\n removeJoint(joint: PhysicsImpostorJoint): void;\r\n isSupported(): boolean;\r\n setTransformationFromPhysicsBody(impostor: PhysicsImpostor): void;\r\n setPhysicsBodyTransformation(impostor: PhysicsImpostor, newPosition: Vector3, newRotation: Quaternion): void;\r\n setLinearVelocity(impostor: PhysicsImpostor, velocity: Nullable<Vector3>): void;\r\n setAngularVelocity(impostor: PhysicsImpostor, velocity: Nullable<Vector3>): void;\r\n getLinearVelocity(impostor: PhysicsImpostor): Nullable<Vector3>;\r\n getAngularVelocity(impostor: PhysicsImpostor): Nullable<Vector3>;\r\n setBodyMass(impostor: PhysicsImpostor, mass: number): void;\r\n getBodyMass(impostor: PhysicsImpostor): number;\r\n getBodyFriction(impostor: PhysicsImpostor): number;\r\n setBodyFriction(impostor: PhysicsImpostor, friction: number): void;\r\n getBodyRestitution(impostor: PhysicsImpostor): number;\r\n setBodyRestitution(impostor: PhysicsImpostor, restitution: number): void;\r\n getBodyPressure?(impostor: PhysicsImpostor): number;\r\n setBodyPressure?(impostor: PhysicsImpostor, pressure: number): void;\r\n getBodyStiffness?(impostor: PhysicsImpostor): number;\r\n setBodyStiffness?(impostor: PhysicsImpostor, stiffness: number): void;\r\n getBodyVelocityIterations?(impostor: PhysicsImpostor): number;\r\n setBodyVelocityIterations?(impostor: PhysicsImpostor, velocityIterations: number): void;\r\n getBodyPositionIterations?(impostor: PhysicsImpostor): number;\r\n setBodyPositionIterations?(impostor: PhysicsImpostor, positionIterations: number): void;\r\n appendAnchor?(impostor: PhysicsImpostor, otherImpostor: PhysicsImpostor, width: number, height: number, influence: number, noCollisionBetweenLinkedBodies: boolean): void;\r\n appendHook?(impostor: PhysicsImpostor, otherImpostor: PhysicsImpostor, length: number, influence: number, noCollisionBetweenLinkedBodies: boolean): void;\r\n sleepBody(impostor: PhysicsImpostor): void;\r\n wakeUpBody(impostor: PhysicsImpostor): void;\r\n raycast(from: Vector3, to: Vector3): PhysicsRaycastResult;\r\n raycastToRef(from: Vector3, to: Vector3, result: PhysicsRaycastResult): void;\r\n\r\n //Joint Update\r\n updateDistanceJoint(joint: PhysicsJoint, maxDistance: number, minDistance?: number): void;\r\n setMotor(joint: IMotorEnabledJoint, speed: number, maxForce?: number, motorIndex?: number): void;\r\n setLimit(joint: IMotorEnabledJoint, upperLimit: number, lowerLimit?: number, motorIndex?: number): void;\r\n getRadius(impostor: PhysicsImpostor): number;\r\n getBoxSizeToRef(impostor: PhysicsImpostor, result: Vector3): void;\r\n syncMeshWithImpostor(mesh: AbstractMesh, impostor: PhysicsImpostor): void;\r\n dispose(): void;\r\n}\r\n"]}
|
|
@@ -0,0 +1,401 @@
|
|
|
1
|
+
import { Quaternion, Vector3 } from "../../../Maths/math.vector";
|
|
2
|
+
import type { IPhysicsEnginePlugin, PhysicsImpostorJoint } from "../IPhysicsEnginePlugin";
|
|
3
|
+
import { PhysicsImpostor } from "../physicsImpostor";
|
|
4
|
+
import type { IMotorEnabledJoint } from "..//physicsJoint";
|
|
5
|
+
import type { Nullable } from "../../../types";
|
|
6
|
+
import type { AbstractMesh } from "../../../Meshes/abstractMesh";
|
|
7
|
+
import { PhysicsRaycastResult } from "../../physicsRaycastResult";
|
|
8
|
+
/**
|
|
9
|
+
* AmmoJS Physics plugin
|
|
10
|
+
* @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine
|
|
11
|
+
* @see https://github.com/kripken/ammo.js/
|
|
12
|
+
*/
|
|
13
|
+
export declare class AmmoJSPlugin implements IPhysicsEnginePlugin {
|
|
14
|
+
private _useDeltaForWorldStep;
|
|
15
|
+
/**
|
|
16
|
+
* Reference to the Ammo library
|
|
17
|
+
*/
|
|
18
|
+
bjsAMMO: any;
|
|
19
|
+
/**
|
|
20
|
+
* Created ammoJS world which physics bodies are added to
|
|
21
|
+
*/
|
|
22
|
+
world: any;
|
|
23
|
+
/**
|
|
24
|
+
* Name of the plugin
|
|
25
|
+
*/
|
|
26
|
+
name: string;
|
|
27
|
+
private _timeStep;
|
|
28
|
+
private _fixedTimeStep;
|
|
29
|
+
private _maxSteps;
|
|
30
|
+
private _tmpQuaternion;
|
|
31
|
+
private _tmpAmmoTransform;
|
|
32
|
+
private _tmpAmmoQuaternion;
|
|
33
|
+
private _tmpAmmoConcreteContactResultCallback;
|
|
34
|
+
private _collisionConfiguration;
|
|
35
|
+
private _dispatcher;
|
|
36
|
+
private _overlappingPairCache;
|
|
37
|
+
private _solver;
|
|
38
|
+
private _softBodySolver;
|
|
39
|
+
private _tmpAmmoVectorA;
|
|
40
|
+
private _tmpAmmoVectorB;
|
|
41
|
+
private _tmpAmmoVectorC;
|
|
42
|
+
private _tmpAmmoVectorD;
|
|
43
|
+
private _tmpContactCallbackResult;
|
|
44
|
+
private _tmpAmmoVectorRCA;
|
|
45
|
+
private _tmpAmmoVectorRCB;
|
|
46
|
+
private _raycastResult;
|
|
47
|
+
private _tmpContactPoint;
|
|
48
|
+
private _tmpContactNormal;
|
|
49
|
+
private _tmpContactDistance;
|
|
50
|
+
private _tmpContactImpulse;
|
|
51
|
+
private _tmpVec3;
|
|
52
|
+
private static readonly _DISABLE_COLLISION_FLAG;
|
|
53
|
+
private static readonly _KINEMATIC_FLAG;
|
|
54
|
+
private static readonly _DISABLE_DEACTIVATION_FLAG;
|
|
55
|
+
/**
|
|
56
|
+
* Initializes the ammoJS plugin
|
|
57
|
+
* @param _useDeltaForWorldStep if the time between frames should be used when calculating physics steps (Default: true)
|
|
58
|
+
* @param ammoInjection can be used to inject your own ammo reference
|
|
59
|
+
* @param overlappingPairCache can be used to specify your own overlapping pair cache
|
|
60
|
+
*/
|
|
61
|
+
constructor(_useDeltaForWorldStep?: boolean, ammoInjection?: any, overlappingPairCache?: any);
|
|
62
|
+
/**
|
|
63
|
+
*
|
|
64
|
+
* @returns plugin version
|
|
65
|
+
*/
|
|
66
|
+
getPluginVersion(): number;
|
|
67
|
+
/**
|
|
68
|
+
* Sets the gravity of the physics world (m/(s^2))
|
|
69
|
+
* @param gravity Gravity to set
|
|
70
|
+
*/
|
|
71
|
+
setGravity(gravity: Vector3): void;
|
|
72
|
+
/**
|
|
73
|
+
* Amount of time to step forward on each frame (only used if useDeltaForWorldStep is false in the constructor)
|
|
74
|
+
* @param timeStep timestep to use in seconds
|
|
75
|
+
*/
|
|
76
|
+
setTimeStep(timeStep: number): void;
|
|
77
|
+
/**
|
|
78
|
+
* Increment to step forward in the physics engine (If timeStep is set to 1/60 and fixedTimeStep is set to 1/120 the physics engine should run 2 steps per frame) (Default: 1/60)
|
|
79
|
+
* @param fixedTimeStep fixedTimeStep to use in seconds
|
|
80
|
+
*/
|
|
81
|
+
setFixedTimeStep(fixedTimeStep: number): void;
|
|
82
|
+
/**
|
|
83
|
+
* Sets the maximum number of steps by the physics engine per frame (Default: 5)
|
|
84
|
+
* @param maxSteps the maximum number of steps by the physics engine per frame
|
|
85
|
+
*/
|
|
86
|
+
setMaxSteps(maxSteps: number): void;
|
|
87
|
+
/**
|
|
88
|
+
* Gets the current timestep (only used if useDeltaForWorldStep is false in the constructor)
|
|
89
|
+
* @returns the current timestep in seconds
|
|
90
|
+
*/
|
|
91
|
+
getTimeStep(): number;
|
|
92
|
+
/**
|
|
93
|
+
* The create custom shape handler function to be called when using BABYLON.PhysicsImposter.CustomImpostor
|
|
94
|
+
*/
|
|
95
|
+
onCreateCustomShape: (impostor: PhysicsImpostor) => any;
|
|
96
|
+
/**
|
|
97
|
+
* The create custom mesh impostor handler function to support building custom mesh impostor vertex data
|
|
98
|
+
*/
|
|
99
|
+
onCreateCustomMeshImpostor: (impostor: PhysicsImpostor) => any;
|
|
100
|
+
/**
|
|
101
|
+
* The create custom convex hull impostor handler function to support building custom convex hull impostor vertex data
|
|
102
|
+
*/
|
|
103
|
+
onCreateCustomConvexHullImpostor: (impostor: PhysicsImpostor) => any;
|
|
104
|
+
private _isImpostorInContact;
|
|
105
|
+
private _isImpostorPairInContact;
|
|
106
|
+
private _stepSimulation;
|
|
107
|
+
/**
|
|
108
|
+
* Moves the physics simulation forward delta seconds and updates the given physics imposters
|
|
109
|
+
* Prior to the step the imposters physics location is set to the position of the babylon meshes
|
|
110
|
+
* After the step the babylon meshes are set to the position of the physics imposters
|
|
111
|
+
* @param delta amount of time to step forward
|
|
112
|
+
* @param impostors array of imposters to update before/after the step
|
|
113
|
+
*/
|
|
114
|
+
executeStep(delta: number, impostors: Array<PhysicsImpostor>): void;
|
|
115
|
+
/**
|
|
116
|
+
* Update babylon mesh to match physics world object
|
|
117
|
+
* @param impostor imposter to match
|
|
118
|
+
*/
|
|
119
|
+
private _afterSoftStep;
|
|
120
|
+
/**
|
|
121
|
+
* Update babylon mesh vertices vertices to match physics world softbody or cloth
|
|
122
|
+
* @param impostor imposter to match
|
|
123
|
+
*/
|
|
124
|
+
private _ropeStep;
|
|
125
|
+
/**
|
|
126
|
+
* Update babylon mesh vertices vertices to match physics world softbody or cloth
|
|
127
|
+
* @param impostor imposter to match
|
|
128
|
+
*/
|
|
129
|
+
private _softbodyOrClothStep;
|
|
130
|
+
private _tmpMatrix;
|
|
131
|
+
/**
|
|
132
|
+
* Applies an impulse on the imposter
|
|
133
|
+
* @param impostor imposter to apply impulse to
|
|
134
|
+
* @param force amount of force to be applied to the imposter
|
|
135
|
+
* @param contactPoint the location to apply the impulse on the imposter
|
|
136
|
+
*/
|
|
137
|
+
applyImpulse(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): void;
|
|
138
|
+
/**
|
|
139
|
+
* Applies a force on the imposter
|
|
140
|
+
* @param impostor imposter to apply force
|
|
141
|
+
* @param force amount of force to be applied to the imposter
|
|
142
|
+
* @param contactPoint the location to apply the force on the imposter
|
|
143
|
+
*/
|
|
144
|
+
applyForce(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): void;
|
|
145
|
+
/**
|
|
146
|
+
* Creates a physics body using the plugin
|
|
147
|
+
* @param impostor the imposter to create the physics body on
|
|
148
|
+
*/
|
|
149
|
+
generatePhysicsBody(impostor: PhysicsImpostor): void;
|
|
150
|
+
/**
|
|
151
|
+
* Removes the physics body from the imposter and disposes of the body's memory
|
|
152
|
+
* @param impostor imposter to remove the physics body from
|
|
153
|
+
*/
|
|
154
|
+
removePhysicsBody(impostor: PhysicsImpostor): void;
|
|
155
|
+
/**
|
|
156
|
+
* Generates a joint
|
|
157
|
+
* @param impostorJoint the imposter joint to create the joint with
|
|
158
|
+
*/
|
|
159
|
+
generateJoint(impostorJoint: PhysicsImpostorJoint): void;
|
|
160
|
+
/**
|
|
161
|
+
* Removes a joint
|
|
162
|
+
* @param impostorJoint the imposter joint to remove the joint from
|
|
163
|
+
*/
|
|
164
|
+
removeJoint(impostorJoint: PhysicsImpostorJoint): void;
|
|
165
|
+
private _addMeshVerts;
|
|
166
|
+
/**
|
|
167
|
+
* Initialise the soft body vertices to match its object's (mesh) vertices
|
|
168
|
+
* Softbody vertices (nodes) are in world space and to match this
|
|
169
|
+
* The object's position and rotation is set to zero and so its vertices are also then set in world space
|
|
170
|
+
* @param impostor to create the softbody for
|
|
171
|
+
*/
|
|
172
|
+
private _softVertexData;
|
|
173
|
+
/**
|
|
174
|
+
* Create an impostor's soft body
|
|
175
|
+
* @param impostor to create the softbody for
|
|
176
|
+
*/
|
|
177
|
+
private _createSoftbody;
|
|
178
|
+
/**
|
|
179
|
+
* Create cloth for an impostor
|
|
180
|
+
* @param impostor to create the softbody for
|
|
181
|
+
*/
|
|
182
|
+
private _createCloth;
|
|
183
|
+
/**
|
|
184
|
+
* Create rope for an impostor
|
|
185
|
+
* @param impostor to create the softbody for
|
|
186
|
+
*/
|
|
187
|
+
private _createRope;
|
|
188
|
+
/**
|
|
189
|
+
* Create a custom physics impostor shape using the plugin's onCreateCustomShape handler
|
|
190
|
+
* @param impostor to create the custom physics shape for
|
|
191
|
+
*/
|
|
192
|
+
private _createCustom;
|
|
193
|
+
private _addHullVerts;
|
|
194
|
+
private _createShape;
|
|
195
|
+
/**
|
|
196
|
+
* Sets the mesh body position/rotation from the babylon impostor
|
|
197
|
+
* @param impostor imposter containing the physics body and babylon object
|
|
198
|
+
*/
|
|
199
|
+
setTransformationFromPhysicsBody(impostor: PhysicsImpostor): void;
|
|
200
|
+
/**
|
|
201
|
+
* Sets the babylon object's position/rotation from the physics body's position/rotation
|
|
202
|
+
* @param impostor imposter containing the physics body and babylon object
|
|
203
|
+
* @param newPosition new position
|
|
204
|
+
* @param newRotation new rotation
|
|
205
|
+
*/
|
|
206
|
+
setPhysicsBodyTransformation(impostor: PhysicsImpostor, newPosition: Vector3, newRotation: Quaternion): void;
|
|
207
|
+
/**
|
|
208
|
+
* If this plugin is supported
|
|
209
|
+
* @returns true if its supported
|
|
210
|
+
*/
|
|
211
|
+
isSupported(): boolean;
|
|
212
|
+
/**
|
|
213
|
+
* Sets the linear velocity of the physics body
|
|
214
|
+
* @param impostor imposter to set the velocity on
|
|
215
|
+
* @param velocity velocity to set
|
|
216
|
+
*/
|
|
217
|
+
setLinearVelocity(impostor: PhysicsImpostor, velocity: Vector3): void;
|
|
218
|
+
/**
|
|
219
|
+
* Sets the angular velocity of the physics body
|
|
220
|
+
* @param impostor imposter to set the velocity on
|
|
221
|
+
* @param velocity velocity to set
|
|
222
|
+
*/
|
|
223
|
+
setAngularVelocity(impostor: PhysicsImpostor, velocity: Vector3): void;
|
|
224
|
+
/**
|
|
225
|
+
* gets the linear velocity
|
|
226
|
+
* @param impostor imposter to get linear velocity from
|
|
227
|
+
* @returns linear velocity
|
|
228
|
+
*/
|
|
229
|
+
getLinearVelocity(impostor: PhysicsImpostor): Nullable<Vector3>;
|
|
230
|
+
/**
|
|
231
|
+
* gets the angular velocity
|
|
232
|
+
* @param impostor imposter to get angular velocity from
|
|
233
|
+
* @returns angular velocity
|
|
234
|
+
*/
|
|
235
|
+
getAngularVelocity(impostor: PhysicsImpostor): Nullable<Vector3>;
|
|
236
|
+
/**
|
|
237
|
+
* Sets the mass of physics body
|
|
238
|
+
* @param impostor imposter to set the mass on
|
|
239
|
+
* @param mass mass to set
|
|
240
|
+
*/
|
|
241
|
+
setBodyMass(impostor: PhysicsImpostor, mass: number): void;
|
|
242
|
+
/**
|
|
243
|
+
* Gets the mass of the physics body
|
|
244
|
+
* @param impostor imposter to get the mass from
|
|
245
|
+
* @returns mass
|
|
246
|
+
*/
|
|
247
|
+
getBodyMass(impostor: PhysicsImpostor): number;
|
|
248
|
+
/**
|
|
249
|
+
* Gets friction of the impostor
|
|
250
|
+
* @param impostor impostor to get friction from
|
|
251
|
+
* @returns friction value
|
|
252
|
+
*/
|
|
253
|
+
getBodyFriction(impostor: PhysicsImpostor): number;
|
|
254
|
+
/**
|
|
255
|
+
* Sets friction of the impostor
|
|
256
|
+
* @param impostor impostor to set friction on
|
|
257
|
+
* @param friction friction value
|
|
258
|
+
*/
|
|
259
|
+
setBodyFriction(impostor: PhysicsImpostor, friction: number): void;
|
|
260
|
+
/**
|
|
261
|
+
* Gets restitution of the impostor
|
|
262
|
+
* @param impostor impostor to get restitution from
|
|
263
|
+
* @returns restitution value
|
|
264
|
+
*/
|
|
265
|
+
getBodyRestitution(impostor: PhysicsImpostor): number;
|
|
266
|
+
/**
|
|
267
|
+
* Sets restitution of the impostor
|
|
268
|
+
* @param impostor impostor to set resitution on
|
|
269
|
+
* @param restitution resitution value
|
|
270
|
+
*/
|
|
271
|
+
setBodyRestitution(impostor: PhysicsImpostor, restitution: number): void;
|
|
272
|
+
/**
|
|
273
|
+
* Gets pressure inside the impostor
|
|
274
|
+
* @param impostor impostor to get pressure from
|
|
275
|
+
* @returns pressure value
|
|
276
|
+
*/
|
|
277
|
+
getBodyPressure(impostor: PhysicsImpostor): number;
|
|
278
|
+
/**
|
|
279
|
+
* Sets pressure inside a soft body impostor
|
|
280
|
+
* Cloth and rope must remain 0 pressure
|
|
281
|
+
* @param impostor impostor to set pressure on
|
|
282
|
+
* @param pressure pressure value
|
|
283
|
+
*/
|
|
284
|
+
setBodyPressure(impostor: PhysicsImpostor, pressure: number): void;
|
|
285
|
+
/**
|
|
286
|
+
* Gets stiffness of the impostor
|
|
287
|
+
* @param impostor impostor to get stiffness from
|
|
288
|
+
* @returns pressure value
|
|
289
|
+
*/
|
|
290
|
+
getBodyStiffness(impostor: PhysicsImpostor): number;
|
|
291
|
+
/**
|
|
292
|
+
* Sets stiffness of the impostor
|
|
293
|
+
* @param impostor impostor to set stiffness on
|
|
294
|
+
* @param stiffness stiffness value from 0 to 1
|
|
295
|
+
*/
|
|
296
|
+
setBodyStiffness(impostor: PhysicsImpostor, stiffness: number): void;
|
|
297
|
+
/**
|
|
298
|
+
* Gets velocityIterations of the impostor
|
|
299
|
+
* @param impostor impostor to get velocity iterations from
|
|
300
|
+
* @returns velocityIterations value
|
|
301
|
+
*/
|
|
302
|
+
getBodyVelocityIterations(impostor: PhysicsImpostor): number;
|
|
303
|
+
/**
|
|
304
|
+
* Sets velocityIterations of the impostor
|
|
305
|
+
* @param impostor impostor to set velocity iterations on
|
|
306
|
+
* @param velocityIterations velocityIterations value
|
|
307
|
+
*/
|
|
308
|
+
setBodyVelocityIterations(impostor: PhysicsImpostor, velocityIterations: number): void;
|
|
309
|
+
/**
|
|
310
|
+
* Gets positionIterations of the impostor
|
|
311
|
+
* @param impostor impostor to get position iterations from
|
|
312
|
+
* @returns positionIterations value
|
|
313
|
+
*/
|
|
314
|
+
getBodyPositionIterations(impostor: PhysicsImpostor): number;
|
|
315
|
+
/**
|
|
316
|
+
* Sets positionIterations of the impostor
|
|
317
|
+
* @param impostor impostor to set position on
|
|
318
|
+
* @param positionIterations positionIterations value
|
|
319
|
+
*/
|
|
320
|
+
setBodyPositionIterations(impostor: PhysicsImpostor, positionIterations: number): void;
|
|
321
|
+
/**
|
|
322
|
+
* Append an anchor to a cloth object
|
|
323
|
+
* @param impostor is the cloth impostor to add anchor to
|
|
324
|
+
* @param otherImpostor is the rigid impostor to anchor to
|
|
325
|
+
* @param width ratio across width from 0 to 1
|
|
326
|
+
* @param height ratio up height from 0 to 1
|
|
327
|
+
* @param influence the elasticity between cloth impostor and anchor from 0, very stretchy to 1, little stretch
|
|
328
|
+
* @param noCollisionBetweenLinkedBodies when true collisions between soft impostor and anchor are ignored; default false
|
|
329
|
+
*/
|
|
330
|
+
appendAnchor(impostor: PhysicsImpostor, otherImpostor: PhysicsImpostor, width: number, height: number, influence?: number, noCollisionBetweenLinkedBodies?: boolean): void;
|
|
331
|
+
/**
|
|
332
|
+
* Append an hook to a rope object
|
|
333
|
+
* @param impostor is the rope impostor to add hook to
|
|
334
|
+
* @param otherImpostor is the rigid impostor to hook to
|
|
335
|
+
* @param length ratio along the rope from 0 to 1
|
|
336
|
+
* @param influence the elasticity between soft impostor and anchor from 0, very stretchy to 1, little stretch
|
|
337
|
+
* @param noCollisionBetweenLinkedBodies when true collisions between soft impostor and anchor are ignored; default false
|
|
338
|
+
*/
|
|
339
|
+
appendHook(impostor: PhysicsImpostor, otherImpostor: PhysicsImpostor, length: number, influence?: number, noCollisionBetweenLinkedBodies?: boolean): void;
|
|
340
|
+
/**
|
|
341
|
+
* Sleeps the physics body and stops it from being active
|
|
342
|
+
* @param impostor impostor to sleep
|
|
343
|
+
*/
|
|
344
|
+
sleepBody(impostor: PhysicsImpostor): void;
|
|
345
|
+
/**
|
|
346
|
+
* Activates the physics body
|
|
347
|
+
* @param impostor impostor to activate
|
|
348
|
+
*/
|
|
349
|
+
wakeUpBody(impostor: PhysicsImpostor): void;
|
|
350
|
+
/**
|
|
351
|
+
* Updates the distance parameters of the joint
|
|
352
|
+
*/
|
|
353
|
+
updateDistanceJoint(): void;
|
|
354
|
+
/**
|
|
355
|
+
* Sets a motor on the joint
|
|
356
|
+
* @param joint joint to set motor on
|
|
357
|
+
* @param speed speed of the motor
|
|
358
|
+
* @param maxForce maximum force of the motor
|
|
359
|
+
*/
|
|
360
|
+
setMotor(joint: IMotorEnabledJoint, speed?: number, maxForce?: number): void;
|
|
361
|
+
/**
|
|
362
|
+
* Sets the motors limit
|
|
363
|
+
*/
|
|
364
|
+
setLimit(): void;
|
|
365
|
+
/**
|
|
366
|
+
* Syncs the position and rotation of a mesh with the impostor
|
|
367
|
+
* @param mesh mesh to sync
|
|
368
|
+
* @param impostor impostor to update the mesh with
|
|
369
|
+
*/
|
|
370
|
+
syncMeshWithImpostor(mesh: AbstractMesh, impostor: PhysicsImpostor): void;
|
|
371
|
+
/**
|
|
372
|
+
* Gets the radius of the impostor
|
|
373
|
+
* @param impostor impostor to get radius from
|
|
374
|
+
* @returns the radius
|
|
375
|
+
*/
|
|
376
|
+
getRadius(impostor: PhysicsImpostor): number;
|
|
377
|
+
/**
|
|
378
|
+
* Gets the box size of the impostor
|
|
379
|
+
* @param impostor impostor to get box size from
|
|
380
|
+
* @param result the resulting box size
|
|
381
|
+
*/
|
|
382
|
+
getBoxSizeToRef(impostor: PhysicsImpostor, result: Vector3): void;
|
|
383
|
+
/**
|
|
384
|
+
* Disposes of the impostor
|
|
385
|
+
*/
|
|
386
|
+
dispose(): void;
|
|
387
|
+
/**
|
|
388
|
+
* Does a raycast in the physics world
|
|
389
|
+
* @param from where should the ray start?
|
|
390
|
+
* @param to where should the ray end?
|
|
391
|
+
* @returns PhysicsRaycastResult
|
|
392
|
+
*/
|
|
393
|
+
raycast(from: Vector3, to: Vector3): PhysicsRaycastResult;
|
|
394
|
+
/**
|
|
395
|
+
* Does a raycast in the physics world
|
|
396
|
+
* @param from when should the ray start?
|
|
397
|
+
* @param to when should the ray end?
|
|
398
|
+
* @param result resulting PhysicsRaycastResult
|
|
399
|
+
*/
|
|
400
|
+
raycastToRef(from: Vector3, to: Vector3, result: PhysicsRaycastResult): void;
|
|
401
|
+
}
|