@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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"physicsJoint.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Physics/v1/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 \"./IPhysicsEnginePlugin\";\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"]}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import type { Vector3, Quaternion } from "../../Maths/math.vector";
|
|
2
|
+
import type { AbstractMesh } from "../../Meshes/abstractMesh";
|
|
3
|
+
import type { PhysicsRaycastResult } from "../physicsRaycastResult";
|
|
4
|
+
import type { PhysicsBody } from "./physicsBody";
|
|
5
|
+
import type { PhysicsShape } from "./physicsShape";
|
|
6
|
+
import type { PhysicsConstraint } from "./physicsConstraint";
|
|
7
|
+
import type { BoundingBox } from "../../Culling/boundingBox";
|
|
8
|
+
import type { TransformNode } from "../../Meshes/transformNode";
|
|
9
|
+
import type { PhysicsMaterial } from "./physicsMaterial";
|
|
10
|
+
/** @internal */
|
|
11
|
+
export declare enum ConstraintAxisLimitMode {
|
|
12
|
+
FREE = 0,
|
|
13
|
+
LIMITED = 1,
|
|
14
|
+
LOCKED = 2,
|
|
15
|
+
NONE = 3
|
|
16
|
+
}
|
|
17
|
+
/** @internal */
|
|
18
|
+
export declare enum ConstraintAxis {
|
|
19
|
+
LINEAR_X = 0,
|
|
20
|
+
LINEAR_Y = 1,
|
|
21
|
+
LINEAR_Z = 2,
|
|
22
|
+
ANGULAR_X = 3,
|
|
23
|
+
ANGULAR_Y = 4,
|
|
24
|
+
ANGULAR_Z = 5,
|
|
25
|
+
LINEAR_DISTANCE = 6
|
|
26
|
+
}
|
|
27
|
+
/** @internal */
|
|
28
|
+
export declare enum ConstraintType {
|
|
29
|
+
BALL_AND_SOCKET = 0,
|
|
30
|
+
DISTANCE = 1,
|
|
31
|
+
HINGE = 2,
|
|
32
|
+
SLIDER = 3,
|
|
33
|
+
LOCK = 4
|
|
34
|
+
}
|
|
35
|
+
/** @internal */
|
|
36
|
+
export declare enum ShapeType {
|
|
37
|
+
SPHERE = 0,
|
|
38
|
+
CAPSULE = 1,
|
|
39
|
+
CYLINDER = 2,
|
|
40
|
+
BOX = 3,
|
|
41
|
+
CONVEX_HULL = 4,
|
|
42
|
+
CONTAINER = 5,
|
|
43
|
+
MESH = 6
|
|
44
|
+
}
|
|
45
|
+
/** @internal */
|
|
46
|
+
export declare enum ConstraintMotorType {
|
|
47
|
+
NONE = 0,
|
|
48
|
+
VELOCITY = 1,
|
|
49
|
+
POSITION = 2
|
|
50
|
+
}
|
|
51
|
+
/** @internal */
|
|
52
|
+
export interface PhysicsShapeParameters {
|
|
53
|
+
center?: Vector3;
|
|
54
|
+
radius?: number;
|
|
55
|
+
pointA?: Vector3;
|
|
56
|
+
pointB?: Vector3;
|
|
57
|
+
rotation?: Quaternion;
|
|
58
|
+
extents?: Vector3;
|
|
59
|
+
mesh?: AbstractMesh;
|
|
60
|
+
}
|
|
61
|
+
/** @internal */
|
|
62
|
+
export interface PhysicsConstraintParameters {
|
|
63
|
+
pivotA?: Vector3;
|
|
64
|
+
pivotB?: Vector3;
|
|
65
|
+
axisA?: Vector3;
|
|
66
|
+
axisB?: Vector3;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
*
|
|
70
|
+
*/
|
|
71
|
+
/** @internal */
|
|
72
|
+
export interface MassProperties {
|
|
73
|
+
/**
|
|
74
|
+
*
|
|
75
|
+
*/
|
|
76
|
+
centerOfMass: Vector3;
|
|
77
|
+
/**
|
|
78
|
+
*
|
|
79
|
+
*/
|
|
80
|
+
mass: number;
|
|
81
|
+
/**
|
|
82
|
+
*
|
|
83
|
+
*/
|
|
84
|
+
intertia: Vector3;
|
|
85
|
+
/**
|
|
86
|
+
*
|
|
87
|
+
*/
|
|
88
|
+
inertiaOrientation: Quaternion;
|
|
89
|
+
}
|
|
90
|
+
/** @internal */
|
|
91
|
+
export interface IPhysicsEnginePlugin {
|
|
92
|
+
/**
|
|
93
|
+
*
|
|
94
|
+
*/
|
|
95
|
+
world: any;
|
|
96
|
+
/**
|
|
97
|
+
*
|
|
98
|
+
*/
|
|
99
|
+
name: string;
|
|
100
|
+
setGravity(gravity: Vector3): void;
|
|
101
|
+
setTimeStep(timeStep: number): void;
|
|
102
|
+
getTimeStep(): number;
|
|
103
|
+
executeStep(delta: number): void;
|
|
104
|
+
getPluginVersion(): number;
|
|
105
|
+
initBody(body: PhysicsBody): void;
|
|
106
|
+
setShape(body: PhysicsBody, shape: PhysicsShape): void;
|
|
107
|
+
getShape(body: PhysicsBody): PhysicsShape;
|
|
108
|
+
setFilterGroup(body: PhysicsBody, group: number): void;
|
|
109
|
+
getFilterGroup(body: PhysicsBody): number;
|
|
110
|
+
setEventMask(body: PhysicsBody, eventMask: number): void;
|
|
111
|
+
getEventMask(body: PhysicsBody): number;
|
|
112
|
+
setMassProperties(body: PhysicsBody, massProps: MassProperties): void;
|
|
113
|
+
getMassProperties(body: PhysicsBody): MassProperties;
|
|
114
|
+
setLinearDamping(body: PhysicsBody, damping: number): void;
|
|
115
|
+
getLinearDamping(body: PhysicsBody): number;
|
|
116
|
+
setAngularDamping(body: PhysicsBody, damping: number): void;
|
|
117
|
+
getAngularDamping(body: PhysicsBody): number;
|
|
118
|
+
setLinearVelocity(body: PhysicsBody, linVel: Vector3): void;
|
|
119
|
+
getLinearVelocityToRef(body: PhysicsBody, linVel: Vector3): void;
|
|
120
|
+
applyImpulse(body: PhysicsBody, location: Vector3, impulse: Vector3): void;
|
|
121
|
+
setAngularVelocity(body: PhysicsBody, angVel: Vector3): void;
|
|
122
|
+
getAngularVelocityToRef(body: PhysicsBody, angVel: Vector3): void;
|
|
123
|
+
disposeBody(body: PhysicsBody): void;
|
|
124
|
+
initShape(shape: PhysicsShape, type: ShapeType, options: PhysicsShapeParameters): void;
|
|
125
|
+
setFilterLayer(shape: PhysicsShape, layer: number): void;
|
|
126
|
+
getFilterLayer(shape: PhysicsShape): number;
|
|
127
|
+
setMaterial(shape: PhysicsShape, material: PhysicsMaterial): void;
|
|
128
|
+
getMaterial(shape: PhysicsShape): PhysicsMaterial;
|
|
129
|
+
setDensity(shape: PhysicsShape, density: number): void;
|
|
130
|
+
getDensity(shape: PhysicsShape): number;
|
|
131
|
+
addChild(shape: PhysicsShape, newChild: PhysicsShape, childTransform: TransformNode): void;
|
|
132
|
+
removeChild(shape: PhysicsShape, childIndex: number): void;
|
|
133
|
+
getNumChildren(shape: PhysicsShape): number;
|
|
134
|
+
getBoundingBox(shape: PhysicsShape): BoundingBox;
|
|
135
|
+
disposeShape(shape: PhysicsShape): void;
|
|
136
|
+
initMaterial(material: PhysicsMaterial): void;
|
|
137
|
+
setFriction(material: PhysicsMaterial, friction: number): void;
|
|
138
|
+
getFriction(material: PhysicsMaterial): number;
|
|
139
|
+
setRestitution(material: PhysicsMaterial, restitution: number): void;
|
|
140
|
+
getRestitution(material: PhysicsMaterial): number;
|
|
141
|
+
disposeMaterial(material: PhysicsMaterial): void;
|
|
142
|
+
initConstraint(constraint: PhysicsConstraint, type: ConstraintType, options: PhysicsConstraintParameters): void;
|
|
143
|
+
setParentBody(constraint: PhysicsConstraint, body: PhysicsBody): void;
|
|
144
|
+
getParentBody(constraint: PhysicsConstraint): PhysicsBody;
|
|
145
|
+
setChildBody(constraint: PhysicsConstraint, body: PhysicsBody): void;
|
|
146
|
+
getChildBody(constraint: PhysicsConstraint): PhysicsBody;
|
|
147
|
+
setAnchorInParent(constraint: PhysicsConstraint, pivot: Vector3, axisX: Vector3, axisY: Vector3): void;
|
|
148
|
+
setAnchorInChild(constraint: PhysicsConstraint, pivot: Vector3, axisX: Vector3, axisY: Vector3): void;
|
|
149
|
+
setEnabled(constraint: PhysicsConstraint, isEnabled: boolean): void;
|
|
150
|
+
getEnabled(constraint: PhysicsConstraint): boolean;
|
|
151
|
+
setCollisionsEnabled(constraint: PhysicsConstraint, isEnabled: boolean): void;
|
|
152
|
+
getCollisionsEnabled(constraint: PhysicsConstraint): boolean;
|
|
153
|
+
setAxisFriction(constraint: PhysicsConstraint, axis: ConstraintAxis, friction: number): void;
|
|
154
|
+
getAxisFriction(constraint: PhysicsConstraint, axis: ConstraintAxis): number;
|
|
155
|
+
setAxisMode(constraint: PhysicsConstraint, axis: ConstraintAxis, limitMode: ConstraintAxisLimitMode): void;
|
|
156
|
+
getAxisMode(constraint: PhysicsConstraint, axis: ConstraintAxis): ConstraintAxisLimitMode;
|
|
157
|
+
setAxisMinLimit(constraint: PhysicsConstraint, axis: ConstraintAxis, minLimit: number): void;
|
|
158
|
+
getAxisMinLimit(constraint: PhysicsConstraint, axis: ConstraintAxis): number;
|
|
159
|
+
setAxisMaxLimit(constraint: PhysicsConstraint, axis: ConstraintAxis, limit: number): void;
|
|
160
|
+
getAxisMaxLimit(constraint: PhysicsConstraint, axis: ConstraintAxis): number;
|
|
161
|
+
setAxisMotorType(constraint: PhysicsConstraint, axis: ConstraintAxis, motorType: ConstraintMotorType): void;
|
|
162
|
+
getAxisMotorType(constraint: PhysicsConstraint, axis: ConstraintAxis): ConstraintMotorType;
|
|
163
|
+
setAxisMotorTarget(constraint: PhysicsConstraint, axis: ConstraintAxis, target: number): void;
|
|
164
|
+
getAxisMotorTarget(constraint: PhysicsConstraint, axis: ConstraintAxis): number;
|
|
165
|
+
setAxisMotorMaxForce(constraint: PhysicsConstraint, axis: ConstraintAxis, maxForce: number): void;
|
|
166
|
+
getAxisMotorMaxForce(constraint: PhysicsConstraint, axis: ConstraintAxis): number;
|
|
167
|
+
disposeConstraint(constraint: PhysicsConstraint): void;
|
|
168
|
+
raycast(from: Vector3, to: Vector3, result: PhysicsRaycastResult): void;
|
|
169
|
+
dispose(): void;
|
|
170
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/** @internal */
|
|
2
|
+
export var ConstraintAxisLimitMode;
|
|
3
|
+
(function (ConstraintAxisLimitMode) {
|
|
4
|
+
ConstraintAxisLimitMode[ConstraintAxisLimitMode["FREE"] = 0] = "FREE";
|
|
5
|
+
ConstraintAxisLimitMode[ConstraintAxisLimitMode["LIMITED"] = 1] = "LIMITED";
|
|
6
|
+
ConstraintAxisLimitMode[ConstraintAxisLimitMode["LOCKED"] = 2] = "LOCKED";
|
|
7
|
+
ConstraintAxisLimitMode[ConstraintAxisLimitMode["NONE"] = 3] = "NONE";
|
|
8
|
+
})(ConstraintAxisLimitMode || (ConstraintAxisLimitMode = {}));
|
|
9
|
+
/** @internal */
|
|
10
|
+
export var ConstraintAxis;
|
|
11
|
+
(function (ConstraintAxis) {
|
|
12
|
+
ConstraintAxis[ConstraintAxis["LINEAR_X"] = 0] = "LINEAR_X";
|
|
13
|
+
ConstraintAxis[ConstraintAxis["LINEAR_Y"] = 1] = "LINEAR_Y";
|
|
14
|
+
ConstraintAxis[ConstraintAxis["LINEAR_Z"] = 2] = "LINEAR_Z";
|
|
15
|
+
ConstraintAxis[ConstraintAxis["ANGULAR_X"] = 3] = "ANGULAR_X";
|
|
16
|
+
ConstraintAxis[ConstraintAxis["ANGULAR_Y"] = 4] = "ANGULAR_Y";
|
|
17
|
+
ConstraintAxis[ConstraintAxis["ANGULAR_Z"] = 5] = "ANGULAR_Z";
|
|
18
|
+
ConstraintAxis[ConstraintAxis["LINEAR_DISTANCE"] = 6] = "LINEAR_DISTANCE";
|
|
19
|
+
})(ConstraintAxis || (ConstraintAxis = {}));
|
|
20
|
+
/** @internal */
|
|
21
|
+
export var ConstraintType;
|
|
22
|
+
(function (ConstraintType) {
|
|
23
|
+
ConstraintType[ConstraintType["BALL_AND_SOCKET"] = 0] = "BALL_AND_SOCKET";
|
|
24
|
+
ConstraintType[ConstraintType["DISTANCE"] = 1] = "DISTANCE";
|
|
25
|
+
ConstraintType[ConstraintType["HINGE"] = 2] = "HINGE";
|
|
26
|
+
ConstraintType[ConstraintType["SLIDER"] = 3] = "SLIDER";
|
|
27
|
+
ConstraintType[ConstraintType["LOCK"] = 4] = "LOCK";
|
|
28
|
+
})(ConstraintType || (ConstraintType = {}));
|
|
29
|
+
/** @internal */
|
|
30
|
+
export var ShapeType;
|
|
31
|
+
(function (ShapeType) {
|
|
32
|
+
ShapeType[ShapeType["SPHERE"] = 0] = "SPHERE";
|
|
33
|
+
ShapeType[ShapeType["CAPSULE"] = 1] = "CAPSULE";
|
|
34
|
+
ShapeType[ShapeType["CYLINDER"] = 2] = "CYLINDER";
|
|
35
|
+
ShapeType[ShapeType["BOX"] = 3] = "BOX";
|
|
36
|
+
ShapeType[ShapeType["CONVEX_HULL"] = 4] = "CONVEX_HULL";
|
|
37
|
+
ShapeType[ShapeType["CONTAINER"] = 5] = "CONTAINER";
|
|
38
|
+
ShapeType[ShapeType["MESH"] = 6] = "MESH";
|
|
39
|
+
})(ShapeType || (ShapeType = {}));
|
|
40
|
+
/** @internal */
|
|
41
|
+
export var ConstraintMotorType;
|
|
42
|
+
(function (ConstraintMotorType) {
|
|
43
|
+
ConstraintMotorType[ConstraintMotorType["NONE"] = 0] = "NONE";
|
|
44
|
+
ConstraintMotorType[ConstraintMotorType["VELOCITY"] = 1] = "VELOCITY";
|
|
45
|
+
ConstraintMotorType[ConstraintMotorType["POSITION"] = 2] = "POSITION";
|
|
46
|
+
})(ConstraintMotorType || (ConstraintMotorType = {}));
|
|
47
|
+
//# sourceMappingURL=IPhysicsEnginePlugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IPhysicsEnginePlugin.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Physics/v2/IPhysicsEnginePlugin.ts"],"names":[],"mappings":"AAUA,gBAAgB;AAChB,MAAM,CAAN,IAAY,uBAKX;AALD,WAAY,uBAAuB;IAC/B,qEAAI,CAAA;IACJ,2EAAO,CAAA;IACP,yEAAM,CAAA;IACN,qEAAI,CAAA;AACR,CAAC,EALW,uBAAuB,KAAvB,uBAAuB,QAKlC;AAED,gBAAgB;AAChB,MAAM,CAAN,IAAY,cAQX;AARD,WAAY,cAAc;IACtB,2DAAQ,CAAA;IACR,2DAAQ,CAAA;IACR,2DAAQ,CAAA;IACR,6DAAS,CAAA;IACT,6DAAS,CAAA;IACT,6DAAS,CAAA;IACT,yEAAe,CAAA;AACnB,CAAC,EARW,cAAc,KAAd,cAAc,QAQzB;AAED,gBAAgB;AAChB,MAAM,CAAN,IAAY,cAMX;AAND,WAAY,cAAc;IACtB,yEAAe,CAAA;IACf,2DAAQ,CAAA;IACR,qDAAK,CAAA;IACL,uDAAM,CAAA;IACN,mDAAI,CAAA;AACR,CAAC,EANW,cAAc,KAAd,cAAc,QAMzB;AAED,gBAAgB;AAChB,MAAM,CAAN,IAAY,SAQX;AARD,WAAY,SAAS;IACjB,6CAAM,CAAA;IACN,+CAAO,CAAA;IACP,iDAAQ,CAAA;IACR,uCAAG,CAAA;IACH,uDAAW,CAAA;IACX,mDAAS,CAAA;IACT,yCAAI,CAAA;AACR,CAAC,EARW,SAAS,KAAT,SAAS,QAQpB;AAED,gBAAgB;AAChB,MAAM,CAAN,IAAY,mBAIX;AAJD,WAAY,mBAAmB;IAC3B,6DAAI,CAAA;IACJ,qEAAQ,CAAA;IACR,qEAAQ,CAAA;AACZ,CAAC,EAJW,mBAAmB,KAAnB,mBAAmB,QAI9B","sourcesContent":["import type { Vector3, Quaternion } from \"../../Maths/math.vector\";\r\nimport type { AbstractMesh } from \"../../Meshes/abstractMesh\";\r\nimport type { PhysicsRaycastResult } from \"../physicsRaycastResult\";\r\nimport type { PhysicsBody } from \"./physicsBody\";\r\nimport type { PhysicsShape } from \"./physicsShape\";\r\nimport type { PhysicsConstraint } from \"./physicsConstraint\";\r\nimport type { BoundingBox } from \"../../Culling/boundingBox\";\r\nimport type { TransformNode } from \"../../Meshes/transformNode\";\r\nimport type { PhysicsMaterial } from \"./physicsMaterial\";\r\n\r\n/** @internal */\r\nexport enum ConstraintAxisLimitMode {\r\n FREE,\r\n LIMITED,\r\n LOCKED,\r\n NONE,\r\n}\r\n\r\n/** @internal */\r\nexport enum ConstraintAxis {\r\n LINEAR_X,\r\n LINEAR_Y,\r\n LINEAR_Z,\r\n ANGULAR_X,\r\n ANGULAR_Y,\r\n ANGULAR_Z,\r\n LINEAR_DISTANCE,\r\n}\r\n\r\n/** @internal */\r\nexport enum ConstraintType {\r\n BALL_AND_SOCKET,\r\n DISTANCE,\r\n HINGE,\r\n SLIDER,\r\n LOCK,\r\n}\r\n\r\n/** @internal */\r\nexport enum ShapeType {\r\n SPHERE,\r\n CAPSULE,\r\n CYLINDER,\r\n BOX,\r\n CONVEX_HULL,\r\n CONTAINER,\r\n MESH,\r\n}\r\n\r\n/** @internal */\r\nexport enum ConstraintMotorType {\r\n NONE,\r\n VELOCITY,\r\n POSITION,\r\n}\r\n\r\n/** @internal */\r\nexport interface PhysicsShapeParameters {\r\n center?: Vector3;\r\n radius?: number;\r\n pointA?: Vector3;\r\n pointB?: Vector3;\r\n rotation?: Quaternion;\r\n extents?: Vector3;\r\n mesh?: AbstractMesh;\r\n}\r\n\r\n/** @internal */\r\nexport interface PhysicsConstraintParameters {\r\n pivotA?: Vector3;\r\n pivotB?: Vector3;\r\n axisA?: Vector3;\r\n axisB?: Vector3;\r\n}\r\n\r\n/**\r\n *\r\n */\r\n/** @internal */\r\nexport interface MassProperties {\r\n /**\r\n *\r\n */\r\n centerOfMass: Vector3;\r\n /**\r\n *\r\n */\r\n mass: number;\r\n /**\r\n *\r\n */\r\n intertia: Vector3;\r\n /**\r\n *\r\n */\r\n inertiaOrientation: Quaternion;\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): void; //not forgetting pre and post events\r\n getPluginVersion(): number;\r\n\r\n // body\r\n initBody(body: PhysicsBody): void;\r\n setShape(body: PhysicsBody, shape: PhysicsShape): void;\r\n getShape(body: PhysicsBody): PhysicsShape;\r\n setFilterGroup(body: PhysicsBody, group: number): void;\r\n getFilterGroup(body: PhysicsBody): number;\r\n setEventMask(body: PhysicsBody, eventMask: number): void;\r\n getEventMask(body: PhysicsBody): number;\r\n setMassProperties(body: PhysicsBody, massProps: MassProperties): void;\r\n getMassProperties(body: PhysicsBody): MassProperties;\r\n setLinearDamping(body: PhysicsBody, damping: number): void;\r\n getLinearDamping(body: PhysicsBody): number;\r\n setAngularDamping(body: PhysicsBody, damping: number): void;\r\n getAngularDamping(body: PhysicsBody): number;\r\n setLinearVelocity(body: PhysicsBody, linVel: Vector3): void;\r\n getLinearVelocityToRef(body: PhysicsBody, linVel: Vector3): void;\r\n applyImpulse(body: PhysicsBody, location: Vector3, impulse: Vector3): void;\r\n setAngularVelocity(body: PhysicsBody, angVel: Vector3): void;\r\n getAngularVelocityToRef(body: PhysicsBody, angVel: Vector3): void;\r\n disposeBody(body: PhysicsBody): void;\r\n\r\n // shape\r\n initShape(shape: PhysicsShape, type: ShapeType, options: PhysicsShapeParameters): void;\r\n setFilterLayer(shape: PhysicsShape, layer: number): void;\r\n getFilterLayer(shape: PhysicsShape): number;\r\n setMaterial(shape: PhysicsShape, material: PhysicsMaterial): void;\r\n getMaterial(shape: PhysicsShape): PhysicsMaterial;\r\n setDensity(shape: PhysicsShape, density: number): void;\r\n getDensity(shape: PhysicsShape): number;\r\n addChild(shape: PhysicsShape, newChild: PhysicsShape, childTransform: TransformNode): void;\r\n removeChild(shape: PhysicsShape, childIndex: number): void;\r\n getNumChildren(shape: PhysicsShape): number;\r\n getBoundingBox(shape: PhysicsShape): BoundingBox;\r\n disposeShape(shape: PhysicsShape): void;\r\n\r\n // material\r\n initMaterial(material: PhysicsMaterial): void;\r\n setFriction(material: PhysicsMaterial, friction: number): void;\r\n getFriction(material: PhysicsMaterial): number;\r\n setRestitution(material: PhysicsMaterial, restitution: number): void;\r\n getRestitution(material: PhysicsMaterial): number;\r\n disposeMaterial(material: PhysicsMaterial): void;\r\n\r\n // constraint\r\n initConstraint(constraint: PhysicsConstraint, type: ConstraintType, options: PhysicsConstraintParameters): void;\r\n setParentBody(constraint: PhysicsConstraint, body: PhysicsBody): void;\r\n getParentBody(constraint: PhysicsConstraint): PhysicsBody;\r\n setChildBody(constraint: PhysicsConstraint, body: PhysicsBody): void;\r\n getChildBody(constraint: PhysicsConstraint): PhysicsBody;\r\n setAnchorInParent(constraint: PhysicsConstraint, pivot: Vector3, axisX: Vector3, axisY: Vector3): void;\r\n setAnchorInChild(constraint: PhysicsConstraint, pivot: Vector3, axisX: Vector3, axisY: Vector3): void;\r\n setEnabled(constraint: PhysicsConstraint, isEnabled: boolean): void;\r\n getEnabled(constraint: PhysicsConstraint): boolean;\r\n setCollisionsEnabled(constraint: PhysicsConstraint, isEnabled: boolean): void;\r\n getCollisionsEnabled(constraint: PhysicsConstraint): boolean;\r\n setAxisFriction(constraint: PhysicsConstraint, axis: ConstraintAxis, friction: number): void;\r\n getAxisFriction(constraint: PhysicsConstraint, axis: ConstraintAxis): number;\r\n setAxisMode(constraint: PhysicsConstraint, axis: ConstraintAxis, limitMode: ConstraintAxisLimitMode): void;\r\n getAxisMode(constraint: PhysicsConstraint, axis: ConstraintAxis): ConstraintAxisLimitMode;\r\n setAxisMinLimit(constraint: PhysicsConstraint, axis: ConstraintAxis, minLimit: number): void;\r\n getAxisMinLimit(constraint: PhysicsConstraint, axis: ConstraintAxis): number;\r\n setAxisMaxLimit(constraint: PhysicsConstraint, axis: ConstraintAxis, limit: number): void;\r\n getAxisMaxLimit(constraint: PhysicsConstraint, axis: ConstraintAxis): number;\r\n setAxisMotorType(constraint: PhysicsConstraint, axis: ConstraintAxis, motorType: ConstraintMotorType): void;\r\n getAxisMotorType(constraint: PhysicsConstraint, axis: ConstraintAxis): ConstraintMotorType;\r\n setAxisMotorTarget(constraint: PhysicsConstraint, axis: ConstraintAxis, target: number): void;\r\n getAxisMotorTarget(constraint: PhysicsConstraint, axis: ConstraintAxis): number;\r\n setAxisMotorMaxForce(constraint: PhysicsConstraint, axis: ConstraintAxis, maxForce: number): void;\r\n getAxisMotorMaxForce(constraint: PhysicsConstraint, axis: ConstraintAxis): number;\r\n disposeConstraint(constraint: PhysicsConstraint): void;\r\n\r\n // raycast\r\n raycast(from: Vector3, to: Vector3, result: PhysicsRaycastResult): void;\r\n\r\n dispose(): void;\r\n}\r\n"]}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../lts/core/generated/Physics/v2/Plugins/index.ts"],"names":[],"mappings":"AAAA,OAAO","sourcesContent":["// TODO\r\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/* eslint-disable import/no-internal-modules */
|
|
2
|
+
export { PhysicsEngine as PhysicsEngineV2 } from "./physicsEngine.js";
|
|
3
|
+
export * from "./physicsBody.js";
|
|
4
|
+
export * from "./physicsShape.js";
|
|
5
|
+
export * from "./physicsConstraint.js";
|
|
6
|
+
export * from "./physicsMaterial.js";
|
|
7
|
+
export * from "./physicsAggregate.js";
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Physics/v2/index.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,OAAO,EAAE,aAAa,IAAI,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACnE,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC","sourcesContent":["/* eslint-disable import/no-internal-modules */\r\nexport { PhysicsEngine as PhysicsEngineV2 } from \"./physicsEngine\";\r\nexport * from \"./physicsBody\";\r\nexport * from \"./physicsShape\";\r\nexport * from \"./physicsConstraint\";\r\nexport * from \"./physicsMaterial\";\r\nexport * from \"./physicsAggregate\";\r\n"]}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import type { PhysicsBody } from "./physicsBody";
|
|
2
|
+
import { PhysicsMaterial } from "./physicsMaterial";
|
|
3
|
+
import type { PhysicsShape } from "./physicsShape";
|
|
4
|
+
import type { Scene } from "../../scene";
|
|
5
|
+
import type { TransformNode } from "../../Meshes/transformNode";
|
|
6
|
+
/**
|
|
7
|
+
* The interface for the physics aggregate parameters
|
|
8
|
+
*/
|
|
9
|
+
/** @internal */
|
|
10
|
+
export interface PhysicsAggregateParameters {
|
|
11
|
+
/** @internal */
|
|
12
|
+
/**
|
|
13
|
+
* The mass of the physics imposter
|
|
14
|
+
*/
|
|
15
|
+
mass: number;
|
|
16
|
+
/**
|
|
17
|
+
* The friction of the physics imposter
|
|
18
|
+
*/
|
|
19
|
+
friction?: number;
|
|
20
|
+
/**
|
|
21
|
+
* The coefficient of restitution of the physics imposter
|
|
22
|
+
*/
|
|
23
|
+
restitution?: number;
|
|
24
|
+
/**
|
|
25
|
+
* The native options of the physics imposter
|
|
26
|
+
*/
|
|
27
|
+
nativeOptions?: any;
|
|
28
|
+
/**
|
|
29
|
+
* Specifies if the parent should be ignored
|
|
30
|
+
*/
|
|
31
|
+
ignoreParent?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Specifies if bi-directional transformations should be disabled
|
|
34
|
+
*/
|
|
35
|
+
disableBidirectionalTransformation?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* The pressure inside the physics imposter, soft object only
|
|
38
|
+
*/
|
|
39
|
+
pressure?: number;
|
|
40
|
+
/**
|
|
41
|
+
* The stiffness the physics imposter, soft object only
|
|
42
|
+
*/
|
|
43
|
+
stiffness?: number;
|
|
44
|
+
/**
|
|
45
|
+
* The number of iterations used in maintaining consistent vertex velocities, soft object only
|
|
46
|
+
*/
|
|
47
|
+
velocityIterations?: number;
|
|
48
|
+
/**
|
|
49
|
+
* The number of iterations used in maintaining consistent vertex positions, soft object only
|
|
50
|
+
*/
|
|
51
|
+
positionIterations?: number;
|
|
52
|
+
/**
|
|
53
|
+
* The number used to fix points on a cloth (0, 1, 2, 4, 8) or rope (0, 1, 2) only
|
|
54
|
+
* 0 None, 1, back left or top, 2, back right or bottom, 4, front left, 8, front right
|
|
55
|
+
* Add to fix multiple points
|
|
56
|
+
*/
|
|
57
|
+
fixedPoints?: number;
|
|
58
|
+
/**
|
|
59
|
+
* The collision margin around a soft object
|
|
60
|
+
*/
|
|
61
|
+
margin?: number;
|
|
62
|
+
/**
|
|
63
|
+
* The collision margin around a soft object
|
|
64
|
+
*/
|
|
65
|
+
damping?: number;
|
|
66
|
+
/**
|
|
67
|
+
* The path for a rope based on an extrusion
|
|
68
|
+
*/
|
|
69
|
+
path?: any;
|
|
70
|
+
/**
|
|
71
|
+
* The shape of an extrusion used for a rope based on an extrusion
|
|
72
|
+
*/
|
|
73
|
+
shape?: any;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
*
|
|
77
|
+
*/
|
|
78
|
+
export declare class PhysicsAggregate {
|
|
79
|
+
/**
|
|
80
|
+
* The physics-enabled object used as the physics imposter
|
|
81
|
+
*/
|
|
82
|
+
transformNode: TransformNode;
|
|
83
|
+
/**
|
|
84
|
+
* The type of the physics imposter
|
|
85
|
+
*/
|
|
86
|
+
type: number;
|
|
87
|
+
private _options;
|
|
88
|
+
private _scene?;
|
|
89
|
+
/**
|
|
90
|
+
*
|
|
91
|
+
*/
|
|
92
|
+
body: PhysicsBody;
|
|
93
|
+
/**
|
|
94
|
+
*
|
|
95
|
+
*/
|
|
96
|
+
shape: PhysicsShape;
|
|
97
|
+
/**
|
|
98
|
+
*
|
|
99
|
+
*/
|
|
100
|
+
material: PhysicsMaterial;
|
|
101
|
+
constructor(
|
|
102
|
+
/**
|
|
103
|
+
* The physics-enabled object used as the physics imposter
|
|
104
|
+
*/
|
|
105
|
+
transformNode: TransformNode,
|
|
106
|
+
/**
|
|
107
|
+
* The type of the physics imposter
|
|
108
|
+
*/
|
|
109
|
+
type: number, _options?: PhysicsAggregateParameters, _scene?: Scene | undefined);
|
|
110
|
+
/**
|
|
111
|
+
*
|
|
112
|
+
*/
|
|
113
|
+
dispose(): void;
|
|
114
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { PhysicsMaterial } from "./physicsMaterial.js";
|
|
2
|
+
import { Logger } from "../../Misc/logger.js";
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
export class PhysicsAggregate {
|
|
7
|
+
constructor(
|
|
8
|
+
/**
|
|
9
|
+
* The physics-enabled object used as the physics imposter
|
|
10
|
+
*/
|
|
11
|
+
transformNode,
|
|
12
|
+
/**
|
|
13
|
+
* The type of the physics imposter
|
|
14
|
+
*/
|
|
15
|
+
type, _options = { mass: 0 }, _scene) {
|
|
16
|
+
this.transformNode = transformNode;
|
|
17
|
+
this.type = type;
|
|
18
|
+
this._options = _options;
|
|
19
|
+
this._scene = _scene;
|
|
20
|
+
//sanity check!
|
|
21
|
+
if (!this.transformNode) {
|
|
22
|
+
Logger.Error("No object was provided. A physics object is obligatory");
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
if (this.transformNode.parent && this._options.mass !== 0) {
|
|
26
|
+
Logger.Warn("A physics impostor has been created for an object which has a parent. Babylon physics currently works in local space so unexpected issues may occur.");
|
|
27
|
+
}
|
|
28
|
+
// Legacy support for old syntax.
|
|
29
|
+
if (!this._scene && transformNode.getScene) {
|
|
30
|
+
this._scene = transformNode.getScene();
|
|
31
|
+
}
|
|
32
|
+
if (!this._scene) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
this.material = new PhysicsMaterial(this._options.friction ? this._options.friction : 0, this._options.restitution ? this._options.restitution : 0, this._scene);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
*
|
|
39
|
+
*/
|
|
40
|
+
dispose() {
|
|
41
|
+
this.body.dispose();
|
|
42
|
+
this.material.dispose();
|
|
43
|
+
this.shape.dispose();
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=physicsAggregate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"physicsAggregate.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Physics/v2/physicsAggregate.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAyE3C;;GAEG;AACH,MAAM,OAAO,gBAAgB;IAgBzB;IACI;;OAEG;IACI,aAA4B;IACnC;;OAEG;IACI,IAAY,EACX,WAAuC,EAAE,IAAI,EAAE,CAAC,EAAE,EAClD,MAAc;QANf,kBAAa,GAAb,aAAa,CAAe;QAI5B,SAAI,GAAJ,IAAI,CAAQ;QACX,aAAQ,GAAR,QAAQ,CAA0C;QAClD,WAAM,GAAN,MAAM,CAAQ;QAEtB,eAAe;QACf,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE;YACrB,MAAM,CAAC,KAAK,CAAC,wDAAwD,CAAC,CAAC;YACvE,OAAO;SACV;QACD,IAAI,IAAI,CAAC,aAAa,CAAC,MAAM,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,KAAK,CAAC,EAAE;YACvD,MAAM,CAAC,IAAI,CAAC,sJAAsJ,CAAC,CAAC;SACvK;QAED,iCAAiC;QACjC,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,aAAa,CAAC,QAAQ,EAAE;YACxC,IAAI,CAAC,MAAM,GAAG,aAAa,CAAC,QAAQ,EAAE,CAAC;SAC1C;QAED,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;YACd,OAAO;SACV;QAED,IAAI,CAAC,QAAQ,GAAG,IAAI,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACrK,CAAC;IAED;;OAEG;IACI,OAAO;QACV,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;QACpB,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;QACxB,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;IACzB,CAAC;CACJ","sourcesContent":["import type { PhysicsBody } from \"./physicsBody\";\r\nimport { PhysicsMaterial } from \"./physicsMaterial\";\r\nimport type { PhysicsShape } from \"./physicsShape\";\r\nimport { Logger } from \"../../Misc/logger\";\r\nimport type { Scene } from \"../../scene\";\r\nimport type { TransformNode } from \"../../Meshes/transformNode\";\r\n\r\n/**\r\n * The interface for the physics aggregate parameters\r\n */\r\n/** @internal */\r\nexport interface PhysicsAggregateParameters {\r\n /** @internal */\r\n /**\r\n * The mass of the physics imposter\r\n */\r\n mass: number;\r\n /**\r\n * The friction of the physics imposter\r\n */\r\n friction?: number;\r\n /**\r\n * The coefficient of restitution of the physics imposter\r\n */\r\n restitution?: number;\r\n /**\r\n * The native options of the physics imposter\r\n */\r\n nativeOptions?: any;\r\n /**\r\n * Specifies if the parent should be ignored\r\n */\r\n ignoreParent?: boolean;\r\n /**\r\n * Specifies if bi-directional transformations should be disabled\r\n */\r\n disableBidirectionalTransformation?: boolean;\r\n /**\r\n * The pressure inside the physics imposter, soft object only\r\n */\r\n pressure?: number;\r\n /**\r\n * The stiffness the physics imposter, soft object only\r\n */\r\n stiffness?: number;\r\n /**\r\n * The number of iterations used in maintaining consistent vertex velocities, soft object only\r\n */\r\n velocityIterations?: number;\r\n /**\r\n * The number of iterations used in maintaining consistent vertex positions, soft object only\r\n */\r\n positionIterations?: number;\r\n /**\r\n * The number used to fix points on a cloth (0, 1, 2, 4, 8) or rope (0, 1, 2) only\r\n * 0 None, 1, back left or top, 2, back right or bottom, 4, front left, 8, front right\r\n * Add to fix multiple points\r\n */\r\n fixedPoints?: number;\r\n /**\r\n * The collision margin around a soft object\r\n */\r\n margin?: number;\r\n /**\r\n * The collision margin around a soft object\r\n */\r\n damping?: number;\r\n /**\r\n * The path for a rope based on an extrusion\r\n */\r\n path?: any;\r\n /**\r\n * The shape of an extrusion used for a rope based on an extrusion\r\n */\r\n shape?: any;\r\n}\r\n/**\r\n *\r\n */\r\nexport class PhysicsAggregate {\r\n /**\r\n *\r\n */\r\n public body: PhysicsBody;\r\n\r\n /**\r\n *\r\n */\r\n public shape: PhysicsShape;\r\n\r\n /**\r\n *\r\n */\r\n public material: PhysicsMaterial;\r\n\r\n constructor(\r\n /**\r\n * The physics-enabled object used as the physics imposter\r\n */\r\n public transformNode: TransformNode,\r\n /**\r\n * The type of the physics imposter\r\n */\r\n public type: number,\r\n private _options: PhysicsAggregateParameters = { mass: 0 },\r\n private _scene?: Scene\r\n ) {\r\n //sanity check!\r\n if (!this.transformNode) {\r\n Logger.Error(\"No object was provided. A physics object is obligatory\");\r\n return;\r\n }\r\n if (this.transformNode.parent && this._options.mass !== 0) {\r\n Logger.Warn(\"A physics impostor has been created for an object which has a parent. Babylon physics currently works in local space so unexpected issues may occur.\");\r\n }\r\n\r\n // Legacy support for old syntax.\r\n if (!this._scene && transformNode.getScene) {\r\n this._scene = transformNode.getScene();\r\n }\r\n\r\n if (!this._scene) {\r\n return;\r\n }\r\n\r\n this.material = new PhysicsMaterial(this._options.friction ? this._options.friction : 0, this._options.restitution ? this._options.restitution : 0, this._scene);\r\n }\r\n\r\n /**\r\n *\r\n */\r\n public dispose(): void {\r\n this.body.dispose();\r\n this.material.dispose();\r\n this.shape.dispose();\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import type { MassProperties } from "./IPhysicsEnginePlugin";
|
|
2
|
+
import type { PhysicsShape } from "./physicsShape";
|
|
3
|
+
import type { Vector3 } from "../../Maths/math.vector";
|
|
4
|
+
import type { Scene } from "../../scene";
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
/** @internal */
|
|
9
|
+
export declare class PhysicsBody {
|
|
10
|
+
/** @internal */
|
|
11
|
+
_pluginData: any;
|
|
12
|
+
private _physicsPlugin;
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* @param scene
|
|
16
|
+
* @returns
|
|
17
|
+
*/
|
|
18
|
+
constructor(scene: Scene);
|
|
19
|
+
/**
|
|
20
|
+
*
|
|
21
|
+
* @param shape
|
|
22
|
+
*/
|
|
23
|
+
setShape(shape: PhysicsShape): void;
|
|
24
|
+
/**
|
|
25
|
+
*
|
|
26
|
+
* @returns
|
|
27
|
+
*/
|
|
28
|
+
getShape(): PhysicsShape | undefined;
|
|
29
|
+
/**
|
|
30
|
+
*
|
|
31
|
+
* @param group
|
|
32
|
+
*/
|
|
33
|
+
setFilterGroup(group: number): void;
|
|
34
|
+
/**
|
|
35
|
+
*
|
|
36
|
+
* @returns
|
|
37
|
+
*/
|
|
38
|
+
getFilterGroup(): number;
|
|
39
|
+
/**
|
|
40
|
+
*
|
|
41
|
+
* @param eventMask
|
|
42
|
+
*/
|
|
43
|
+
setEventMask(eventMask: number): void;
|
|
44
|
+
/**
|
|
45
|
+
*
|
|
46
|
+
* @returns
|
|
47
|
+
*/
|
|
48
|
+
getEventMask(): number;
|
|
49
|
+
/**
|
|
50
|
+
*
|
|
51
|
+
* @param massProps
|
|
52
|
+
*/
|
|
53
|
+
setMassProperties(massProps: MassProperties): void;
|
|
54
|
+
/**
|
|
55
|
+
*
|
|
56
|
+
* @returns
|
|
57
|
+
*/
|
|
58
|
+
getMassProperties(): MassProperties | undefined;
|
|
59
|
+
/**
|
|
60
|
+
*
|
|
61
|
+
* @param damping
|
|
62
|
+
*/
|
|
63
|
+
setLinearDamping(damping: number): void;
|
|
64
|
+
/**
|
|
65
|
+
*
|
|
66
|
+
* @returns
|
|
67
|
+
*/
|
|
68
|
+
getLinearDamping(): number;
|
|
69
|
+
/**
|
|
70
|
+
*
|
|
71
|
+
* @param damping
|
|
72
|
+
*/
|
|
73
|
+
setAngularDamping(damping: number): void;
|
|
74
|
+
/**
|
|
75
|
+
*
|
|
76
|
+
* @returns
|
|
77
|
+
*/
|
|
78
|
+
getAngularDamping(): number;
|
|
79
|
+
/**
|
|
80
|
+
*
|
|
81
|
+
* @param linVel
|
|
82
|
+
*/
|
|
83
|
+
setLinearVelocity(linVel: Vector3): void;
|
|
84
|
+
/**
|
|
85
|
+
*
|
|
86
|
+
* @returns
|
|
87
|
+
*/
|
|
88
|
+
getLinearVelocityToRef(linVel: Vector3): void;
|
|
89
|
+
/**
|
|
90
|
+
*
|
|
91
|
+
* @param angVel
|
|
92
|
+
*/
|
|
93
|
+
setAngularVelocity(angVel: Vector3): void;
|
|
94
|
+
/**
|
|
95
|
+
*
|
|
96
|
+
* @returns
|
|
97
|
+
*/
|
|
98
|
+
getAngularVelocityToRef(angVel: Vector3): void;
|
|
99
|
+
/**
|
|
100
|
+
*
|
|
101
|
+
* @param location
|
|
102
|
+
* @param impulse
|
|
103
|
+
*/
|
|
104
|
+
applyImpulse(location: Vector3, impulse: Vector3): void;
|
|
105
|
+
/**
|
|
106
|
+
*
|
|
107
|
+
*/
|
|
108
|
+
dispose(): void;
|
|
109
|
+
}
|