@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":"cannonJSPlugin.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Physics/Plug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AAE;YAClC,gDAAgD;YAChD,IAAI,CAAC,cAAc,CAAC,UAAU,CAC1B;gBACI,CAAC,EAAE,IAAI,CAAC,oBAAoB,CAAC,cAAc,CAAC,CAAC;gBAC7C,CAAC,EAAE,IAAI,CAAC,oBAAoB,CAAC,cAAc,CAAC,CAAC;gBAC7C,CAAC,EAAE,IAAI,CAAC,oBAAoB,CAAC,cAAc,CAAC,CAAC;aAChD,EACD;gBACI,CAAC,EAAE,IAAI,CAAC,oBAAoB,CAAC,aAAa,CAAC,CAAC;gBAC5C,CAAC,EAAE,IAAI,CAAC,oBAAoB,CAAC,aAAa,CAAC,CAAC;gBAC5C,CAAC,EAAE,IAAI,CAAC,oBAAoB,CAAC,aAAa,CAAC,CAAC;aAC/C,CACJ,CAAC;YACF,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,IAAI,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAC;SAC1E;QAED,OAAO,IAAI,CAAC,cAAc,CAAC;IAC/B,CAAC;CACJ;AAED,aAAa,CAAC,oBAAoB,GAAG,GAAG,EAAE;IACtC,OAAO,IAAI,cAAc,EAAE,CAAC;AAChC,CAAC,CAAC","sourcesContent":["import type { Nullable, FloatArray } from \"../../types\";\r\nimport { Logger } from \"../../Misc/logger\";\r\nimport { Vector3, Matrix, Quaternion } from \"../../Maths/math.vector\";\r\nimport { VertexBuffer } from \"../../Buffers/buffer\";\r\nimport type { AbstractMesh } from \"../../Meshes/abstractMesh\";\r\nimport type { IPhysicsEnginePlugin, PhysicsImpostorJoint } from \"../../Physics/IPhysicsEngine\";\r\nimport type { IPhysicsEnabledObject } from \"../../Physics/physicsImpostor\";\r\nimport { PhysicsImpostor } from \"../../Physics/physicsImpostor\";\r\nimport type { IMotorEnabledJoint, DistanceJointData, SpringJointData } from \"../../Physics/physicsJoint\";\r\nimport { PhysicsJoint } from \"../../Physics/physicsJoint\";\r\nimport { PhysicsEngine } from \"../../Physics/physicsEngine\";\r\nimport { PhysicsRaycastResult } from \"../physicsRaycastResult\";\r\nimport type { TransformNode } from \"../../Meshes/transformNode\";\r\n\r\n//declare var require: any;\r\ndeclare let CANNON: any;\r\n\r\n/** @internal */\r\nexport class CannonJSPlugin implements IPhysicsEnginePlugin {\r\n public world: any;\r\n public name: string = \"CannonJSPlugin\";\r\n private _physicsMaterials = new Array();\r\n private _fixedTimeStep: number = 1 / 60;\r\n private _cannonRaycastResult: any;\r\n private _raycastResult: PhysicsRaycastResult;\r\n private _physicsBodiesToRemoveAfterStep = new Array<any>();\r\n private _firstFrame = true;\r\n private _tmpQuaternion: Quaternion = new Quaternion();\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n public BJSCANNON: any;\r\n\r\n public constructor(private _useDeltaForWorldStep: boolean = true, iterations: number = 10, cannonInjection = CANNON) {\r\n this.BJSCANNON = cannonInjection;\r\n if (!this.isSupported()) {\r\n Logger.Error(\"CannonJS is not available. Please make sure you included the js file.\");\r\n return;\r\n }\r\n\r\n this._extendNamespace();\r\n\r\n this.world = new this.BJSCANNON.World();\r\n this.world.broadphase = new this.BJSCANNON.NaiveBroadphase();\r\n this.world.solver.iterations = iterations;\r\n this._cannonRaycastResult = new this.BJSCANNON.RaycastResult();\r\n this._raycastResult = new PhysicsRaycastResult();\r\n }\r\n\r\n public setGravity(gravity: Vector3): void {\r\n const vec = gravity;\r\n this.world.gravity.set(vec.x, vec.y, vec.z);\r\n }\r\n\r\n public setTimeStep(timeStep: number) {\r\n this._fixedTimeStep = timeStep;\r\n }\r\n\r\n public getTimeStep(): number {\r\n return this._fixedTimeStep;\r\n }\r\n\r\n public executeStep(delta: number, impostors: Array<PhysicsImpostor>): void {\r\n // due to cannon's architecture, the first frame's before-step is skipped.\r\n if (this._firstFrame) {\r\n this._firstFrame = false;\r\n for (const impostor of impostors) {\r\n if (!(impostor.type == PhysicsImpostor.HeightmapImpostor || impostor.type === PhysicsImpostor.PlaneImpostor)) {\r\n impostor.beforeStep();\r\n }\r\n }\r\n }\r\n this.world.step(this._useDeltaForWorldStep ? delta : this._fixedTimeStep);\r\n this._removeMarkedPhysicsBodiesFromWorld();\r\n }\r\n\r\n private _removeMarkedPhysicsBodiesFromWorld(): void {\r\n if (this._physicsBodiesToRemoveAfterStep.length > 0) {\r\n this._physicsBodiesToRemoveAfterStep.forEach((physicsBody) => {\r\n if (typeof this.world.removeBody === \"function\") {\r\n this.world.removeBody(physicsBody);\r\n } else {\r\n this.world.remove(physicsBody);\r\n }\r\n });\r\n this._physicsBodiesToRemoveAfterStep.length = 0;\r\n }\r\n }\r\n\r\n public applyImpulse(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3) {\r\n const worldPoint = new this.BJSCANNON.Vec3(contactPoint.x, contactPoint.y, contactPoint.z);\r\n const impulse = new this.BJSCANNON.Vec3(force.x, force.y, force.z);\r\n\r\n impostor.physicsBody.applyImpulse(impulse, worldPoint);\r\n }\r\n\r\n public applyForce(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3) {\r\n const worldPoint = new this.BJSCANNON.Vec3(contactPoint.x, contactPoint.y, contactPoint.z);\r\n const impulse = new this.BJSCANNON.Vec3(force.x, force.y, force.z);\r\n\r\n impostor.physicsBody.applyForce(impulse, worldPoint);\r\n }\r\n\r\n public generatePhysicsBody(impostor: PhysicsImpostor) {\r\n // When calling forceUpdate generatePhysicsBody is called again, ensure that the updated body does not instantly collide with removed body\r\n this._removeMarkedPhysicsBodiesFromWorld();\r\n\r\n //parent-child relationship. Does this impostor have a parent impostor?\r\n if (impostor.parent) {\r\n if (impostor.physicsBody) {\r\n this.removePhysicsBody(impostor);\r\n //TODO is that needed?\r\n impostor.forceUpdate();\r\n }\r\n return;\r\n }\r\n\r\n //should a new body be created for this impostor?\r\n if (impostor.isBodyInitRequired()) {\r\n const shape = this._createShape(impostor);\r\n if (!shape) {\r\n Logger.Warn(\"It was not possible to create a physics body for this object.\");\r\n return;\r\n }\r\n\r\n //unregister events if body is being changed\r\n const oldBody = impostor.physicsBody;\r\n if (oldBody) {\r\n this.removePhysicsBody(impostor);\r\n }\r\n\r\n //create the body and material\r\n const material = this._addMaterial(\"mat-\" + impostor.uniqueId, impostor.getParam(\"friction\"), impostor.getParam(\"restitution\"));\r\n\r\n const bodyCreationObject = {\r\n mass: impostor.getParam(\"mass\"),\r\n material: material,\r\n };\r\n // A simple extend, in case native options were used.\r\n const nativeOptions = impostor.getParam(\"nativeOptions\");\r\n for (const key in nativeOptions) {\r\n if (Object.prototype.hasOwnProperty.call(nativeOptions, key)) {\r\n (<any>bodyCreationObject)[key] = nativeOptions[key];\r\n }\r\n }\r\n impostor.physicsBody = new this.BJSCANNON.Body(bodyCreationObject);\r\n impostor.physicsBody.addEventListener(\"collide\", impostor.onCollide);\r\n this.world.addEventListener(\"preStep\", impostor.beforeStep);\r\n this.world.addEventListener(\"postStep\", impostor.afterStep);\r\n impostor.physicsBody.addShape(shape);\r\n if (typeof this.world.addBody === \"function\") {\r\n this.world.addBody(impostor.physicsBody);\r\n } else {\r\n this.world.add(impostor.physicsBody);\r\n }\r\n\r\n //try to keep the body moving in the right direction by taking old properties.\r\n //Should be tested!\r\n if (oldBody) {\r\n [\"force\", \"torque\", \"velocity\", \"angularVelocity\"].forEach(function (param) {\r\n const vec = oldBody[param];\r\n impostor.physicsBody[param].set(vec.x, vec.y, vec.z);\r\n });\r\n }\r\n this._processChildMeshes(impostor);\r\n }\r\n\r\n //now update the body's transformation\r\n this._updatePhysicsBodyTransformation(impostor);\r\n }\r\n\r\n private _processChildMeshes(mainImpostor: PhysicsImpostor) {\r\n const meshChildren = mainImpostor.object.getChildMeshes ? mainImpostor.object.getChildMeshes(true) : [];\r\n const mainRotation: Nullable<Quaternion> = mainImpostor.object.rotationQuaternion;\r\n if (mainRotation) {\r\n mainRotation.conjugateToRef(this._tmpQuaternion);\r\n } else {\r\n this._tmpQuaternion.set(0, 0, 0, 1);\r\n }\r\n\r\n if (meshChildren.length) {\r\n const processMesh = (mesh: AbstractMesh) => {\r\n if (!mesh.rotationQuaternion) {\r\n return;\r\n }\r\n\r\n const childImpostor = mesh.getPhysicsImpostor();\r\n if (childImpostor) {\r\n const parent = childImpostor.parent;\r\n if (parent !== mainImpostor && mesh.parent) {\r\n const pPosition = mesh.getAbsolutePosition().subtract((mesh.parent as TransformNode).getAbsolutePosition());\r\n const q = mesh.rotationQuaternion.multiply(this._tmpQuaternion);\r\n\r\n if (childImpostor.physicsBody) {\r\n this.removePhysicsBody(childImpostor);\r\n childImpostor.physicsBody = null;\r\n }\r\n childImpostor.parent = mainImpostor;\r\n childImpostor.resetUpdateFlags();\r\n mainImpostor.physicsBody.addShape(\r\n this._createShape(childImpostor),\r\n new this.BJSCANNON.Vec3(pPosition.x, pPosition.y, pPosition.z),\r\n new this.BJSCANNON.Quaternion(q.x, q.y, q.z, q.w)\r\n );\r\n //Add the mass of the children.\r\n mainImpostor.physicsBody.mass += childImpostor.getParam(\"mass\");\r\n }\r\n }\r\n mesh.getChildMeshes(true)\r\n .filter((m) => !!m.physicsImpostor)\r\n .forEach(processMesh);\r\n };\r\n meshChildren.filter((m) => !!m.physicsImpostor).forEach(processMesh);\r\n }\r\n }\r\n\r\n public removePhysicsBody(impostor: PhysicsImpostor) {\r\n impostor.physicsBody.removeEventListener(\"collide\", impostor.onCollide);\r\n this.world.removeEventListener(\"preStep\", impostor.beforeStep);\r\n this.world.removeEventListener(\"postStep\", impostor.afterStep);\r\n\r\n // Only remove the physics body after the physics step to avoid disrupting cannon's internal state\r\n if (this._physicsBodiesToRemoveAfterStep.indexOf(impostor.physicsBody) === -1) {\r\n this._physicsBodiesToRemoveAfterStep.push(impostor.physicsBody);\r\n }\r\n }\r\n\r\n public generateJoint(impostorJoint: PhysicsImpostorJoint) {\r\n const mainBody = impostorJoint.mainImpostor.physicsBody;\r\n const connectedBody = impostorJoint.connectedImpostor.physicsBody;\r\n if (!mainBody || !connectedBody) {\r\n return;\r\n }\r\n let constraint: any;\r\n const jointData = impostorJoint.joint.jointData;\r\n //TODO - https://github.com/schteppe/this.BJSCANNON.js/blob/gh-pages/demos/collisionFilter.html\r\n const constraintData = {\r\n pivotA: jointData.mainPivot ? new this.BJSCANNON.Vec3().set(jointData.mainPivot.x, jointData.mainPivot.y, jointData.mainPivot.z) : null,\r\n pivotB: jointData.connectedPivot ? new this.BJSCANNON.Vec3().set(jointData.connectedPivot.x, jointData.connectedPivot.y, jointData.connectedPivot.z) : null,\r\n axisA: jointData.mainAxis ? new this.BJSCANNON.Vec3().set(jointData.mainAxis.x, jointData.mainAxis.y, jointData.mainAxis.z) : null,\r\n axisB: jointData.connectedAxis ? new this.BJSCANNON.Vec3().set(jointData.connectedAxis.x, jointData.connectedAxis.y, jointData.connectedAxis.z) : null,\r\n maxForce: jointData.nativeParams.maxForce,\r\n collideConnected: !!jointData.collision,\r\n };\r\n switch (impostorJoint.joint.type) {\r\n case PhysicsJoint.HingeJoint:\r\n case PhysicsJoint.Hinge2Joint:\r\n constraint = new this.BJSCANNON.HingeConstraint(mainBody, connectedBody, constraintData);\r\n break;\r\n case PhysicsJoint.DistanceJoint:\r\n constraint = new this.BJSCANNON.DistanceConstraint(mainBody, connectedBody, (<DistanceJointData>jointData).maxDistance || 2);\r\n break;\r\n case PhysicsJoint.SpringJoint: {\r\n const springData = <SpringJointData>jointData;\r\n constraint = new this.BJSCANNON.Spring(mainBody, connectedBody, {\r\n restLength: springData.length,\r\n stiffness: springData.stiffness,\r\n damping: springData.damping,\r\n localAnchorA: constraintData.pivotA,\r\n localAnchorB: constraintData.pivotB,\r\n });\r\n break;\r\n }\r\n case PhysicsJoint.LockJoint:\r\n constraint = new this.BJSCANNON.LockConstraint(mainBody, connectedBody, constraintData);\r\n break;\r\n case PhysicsJoint.PointToPointJoint:\r\n case PhysicsJoint.BallAndSocketJoint:\r\n default:\r\n constraint = new this.BJSCANNON.PointToPointConstraint(mainBody, constraintData.pivotA, connectedBody, constraintData.pivotB, constraintData.maxForce);\r\n break;\r\n }\r\n //set the collideConnected flag after the creation, since DistanceJoint ignores it.\r\n constraint.collideConnected = !!jointData.collision;\r\n impostorJoint.joint.physicsJoint = constraint;\r\n //don't add spring as constraint, as it is not one.\r\n if (impostorJoint.joint.type !== PhysicsJoint.SpringJoint) {\r\n this.world.addConstraint(constraint);\r\n } else {\r\n (<SpringJointData>impostorJoint.joint.jointData).forceApplicationCallback =\r\n (<SpringJointData>impostorJoint.joint.jointData).forceApplicationCallback ||\r\n function () {\r\n constraint.applyForce();\r\n };\r\n impostorJoint.mainImpostor.registerAfterPhysicsStep((<SpringJointData>impostorJoint.joint.jointData).forceApplicationCallback);\r\n }\r\n }\r\n\r\n public removeJoint(impostorJoint: PhysicsImpostorJoint) {\r\n if (impostorJoint.joint.type !== PhysicsJoint.SpringJoint) {\r\n this.world.removeConstraint(impostorJoint.joint.physicsJoint);\r\n } else {\r\n impostorJoint.mainImpostor.unregisterAfterPhysicsStep((<SpringJointData>impostorJoint.joint.jointData).forceApplicationCallback);\r\n }\r\n }\r\n\r\n private _addMaterial(name: string, friction: number, restitution: number) {\r\n let index;\r\n let mat;\r\n\r\n for (index = 0; index < this._physicsMaterials.length; index++) {\r\n mat = this._physicsMaterials[index];\r\n\r\n if (mat.friction === friction && mat.restitution === restitution) {\r\n return mat;\r\n }\r\n }\r\n\r\n const currentMat = new this.BJSCANNON.Material(name);\r\n currentMat.friction = friction;\r\n currentMat.restitution = restitution;\r\n\r\n this._physicsMaterials.push(currentMat);\r\n return currentMat;\r\n }\r\n\r\n private _checkWithEpsilon(value: number): number {\r\n return value < PhysicsEngine.Epsilon ? PhysicsEngine.Epsilon : value;\r\n }\r\n\r\n private _createShape(impostor: PhysicsImpostor) {\r\n const object = impostor.object;\r\n\r\n let returnValue;\r\n const impostorExtents = impostor.getObjectExtents();\r\n switch (impostor.type) {\r\n case PhysicsImpostor.SphereImpostor: {\r\n const radiusX = impostorExtents.x;\r\n const radiusY = impostorExtents.y;\r\n const radiusZ = impostorExtents.z;\r\n\r\n returnValue = new this.BJSCANNON.Sphere(Math.max(this._checkWithEpsilon(radiusX), this._checkWithEpsilon(radiusY), this._checkWithEpsilon(radiusZ)) / 2);\r\n\r\n break;\r\n }\r\n //TMP also for cylinder - TODO Cannon supports cylinder natively.\r\n case PhysicsImpostor.CylinderImpostor: {\r\n let nativeParams = impostor.getParam(\"nativeOptions\");\r\n if (!nativeParams) {\r\n nativeParams = {};\r\n }\r\n const radiusTop = nativeParams.radiusTop !== undefined ? nativeParams.radiusTop : this._checkWithEpsilon(impostorExtents.x) / 2;\r\n const radiusBottom = nativeParams.radiusBottom !== undefined ? nativeParams.radiusBottom : this._checkWithEpsilon(impostorExtents.x) / 2;\r\n const height = nativeParams.height !== undefined ? nativeParams.height : this._checkWithEpsilon(impostorExtents.y);\r\n const numSegments = nativeParams.numSegments !== undefined ? nativeParams.numSegments : 16;\r\n returnValue = new this.BJSCANNON.Cylinder(radiusTop, radiusBottom, height, numSegments);\r\n\r\n // Rotate 90 degrees as this shape is horizontal in cannon\r\n const quat = new this.BJSCANNON.Quaternion();\r\n quat.setFromAxisAngle(new this.BJSCANNON.Vec3(1, 0, 0), -Math.PI / 2);\r\n const translation = new this.BJSCANNON.Vec3(0, 0, 0);\r\n returnValue.transformAllPoints(translation, quat);\r\n break;\r\n }\r\n case PhysicsImpostor.BoxImpostor: {\r\n const box = impostorExtents.scale(0.5);\r\n returnValue = new this.BJSCANNON.Box(new this.BJSCANNON.Vec3(this._checkWithEpsilon(box.x), this._checkWithEpsilon(box.y), this._checkWithEpsilon(box.z)));\r\n break;\r\n }\r\n case PhysicsImpostor.PlaneImpostor:\r\n Logger.Warn(\"Attention, PlaneImposter might not behave as you expect. Consider using BoxImposter instead\");\r\n returnValue = new this.BJSCANNON.Plane();\r\n break;\r\n case PhysicsImpostor.MeshImpostor: {\r\n // should transform the vertex data to world coordinates!!\r\n const rawVerts = object.getVerticesData ? object.getVerticesData(VertexBuffer.PositionKind) : [];\r\n const rawFaces = object.getIndices ? object.getIndices() : [];\r\n if (!rawVerts) {\r\n Logger.Warn(\"Tried to create a MeshImpostor for an object without vertices. This will fail.\");\r\n return;\r\n }\r\n // get only scale! so the object could transform correctly.\r\n const oldPosition = object.position.clone();\r\n const oldRotation = object.rotation && object.rotation.clone();\r\n const oldQuaternion = object.rotationQuaternion && object.rotationQuaternion.clone();\r\n object.position.copyFromFloats(0, 0, 0);\r\n object.rotation && object.rotation.copyFromFloats(0, 0, 0);\r\n object.rotationQuaternion && object.rotationQuaternion.copyFrom(impostor.getParentsRotation());\r\n\r\n object.rotationQuaternion && object.parent && object.rotationQuaternion.conjugateInPlace();\r\n\r\n const transform = object.computeWorldMatrix(true);\r\n // convert rawVerts to object space\r\n const transformedVertices = new Array<number>();\r\n let index: number;\r\n for (index = 0; index < rawVerts.length; index += 3) {\r\n Vector3.TransformCoordinates(Vector3.FromArray(rawVerts, index), transform).toArray(transformedVertices, index);\r\n }\r\n\r\n Logger.Warn(\"MeshImpostor only collides against spheres.\");\r\n returnValue = new this.BJSCANNON.Trimesh(transformedVertices, <number[]>rawFaces);\r\n //now set back the transformation!\r\n object.position.copyFrom(oldPosition);\r\n oldRotation && object.rotation && object.rotation.copyFrom(oldRotation);\r\n oldQuaternion && object.rotationQuaternion && object.rotationQuaternion.copyFrom(oldQuaternion);\r\n break;\r\n }\r\n case PhysicsImpostor.HeightmapImpostor: {\r\n const oldPosition2 = object.position.clone();\r\n const oldRotation2 = object.rotation && object.rotation.clone();\r\n const oldQuaternion2 = object.rotationQuaternion && object.rotationQuaternion.clone();\r\n object.position.copyFromFloats(0, 0, 0);\r\n object.rotation && object.rotation.copyFromFloats(0, 0, 0);\r\n object.rotationQuaternion && object.rotationQuaternion.copyFrom(impostor.getParentsRotation());\r\n object.rotationQuaternion && object.parent && object.rotationQuaternion.conjugateInPlace();\r\n object.rotationQuaternion && object.rotationQuaternion.multiplyInPlace(this._minus90X);\r\n\r\n returnValue = this._createHeightmap(object);\r\n object.position.copyFrom(oldPosition2);\r\n oldRotation2 && object.rotation && object.rotation.copyFrom(oldRotation2);\r\n oldQuaternion2 && object.rotationQuaternion && object.rotationQuaternion.copyFrom(oldQuaternion2);\r\n object.computeWorldMatrix(true);\r\n break;\r\n }\r\n case PhysicsImpostor.ParticleImpostor:\r\n returnValue = new this.BJSCANNON.Particle();\r\n break;\r\n case PhysicsImpostor.NoImpostor:\r\n returnValue = new this.BJSCANNON.Box(new this.BJSCANNON.Vec3(0, 0, 0));\r\n break;\r\n }\r\n\r\n return returnValue;\r\n }\r\n\r\n private _createHeightmap(object: IPhysicsEnabledObject, pointDepth?: number) {\r\n let pos = <FloatArray>object.getVerticesData(VertexBuffer.PositionKind);\r\n const transform = object.computeWorldMatrix(true);\r\n // convert rawVerts to object space\r\n const transformedVertices = new Array<number>();\r\n let index: number;\r\n for (index = 0; index < pos.length; index += 3) {\r\n Vector3.TransformCoordinates(Vector3.FromArray(pos, index), transform).toArray(transformedVertices, index);\r\n }\r\n pos = transformedVertices;\r\n const matrix = new Array<Array<any>>();\r\n\r\n //For now pointDepth will not be used and will be automatically calculated.\r\n //Future reference - try and find the best place to add a reference to the pointDepth variable.\r\n const arraySize = pointDepth || ~~(Math.sqrt(pos.length / 3) - 1);\r\n const boundingInfo = object.getBoundingInfo();\r\n const dim = Math.min(boundingInfo.boundingBox.extendSizeWorld.x, boundingInfo.boundingBox.extendSizeWorld.y);\r\n const minY = boundingInfo.boundingBox.extendSizeWorld.z;\r\n\r\n const elementSize = (dim * 2) / arraySize;\r\n\r\n for (let i = 0; i < pos.length; i = i + 3) {\r\n const x = Math.round(pos[i + 0] / elementSize + arraySize / 2);\r\n const z = Math.round((pos[i + 1] / elementSize - arraySize / 2) * -1);\r\n const y = -pos[i + 2] + minY;\r\n if (!matrix[x]) {\r\n matrix[x] = [];\r\n }\r\n if (!matrix[x][z]) {\r\n matrix[x][z] = y;\r\n }\r\n matrix[x][z] = Math.max(y, matrix[x][z]);\r\n }\r\n\r\n for (let x = 0; x <= arraySize; ++x) {\r\n if (!matrix[x]) {\r\n let loc = 1;\r\n while (!matrix[(x + loc) % arraySize]) {\r\n loc++;\r\n }\r\n matrix[x] = matrix[(x + loc) % arraySize].slice();\r\n //console.log(\"missing x\", x);\r\n }\r\n for (let z = 0; z <= arraySize; ++z) {\r\n if (!matrix[x][z]) {\r\n let loc = 1;\r\n let newValue;\r\n while (newValue === undefined) {\r\n newValue = matrix[x][(z + loc++) % arraySize];\r\n }\r\n matrix[x][z] = newValue;\r\n }\r\n }\r\n }\r\n\r\n const shape = new this.BJSCANNON.Heightfield(matrix, {\r\n elementSize: elementSize,\r\n });\r\n\r\n //For future reference, needed for body transformation\r\n shape.minY = minY;\r\n\r\n return shape;\r\n }\r\n\r\n private _minus90X = new Quaternion(-0.7071067811865475, 0, 0, 0.7071067811865475);\r\n private _plus90X = new Quaternion(0.7071067811865475, 0, 0, 0.7071067811865475);\r\n private _tmpPosition: Vector3 = Vector3.Zero();\r\n private _tmpDeltaPosition: Vector3 = Vector3.Zero();\r\n private _tmpUnityRotation: Quaternion = new Quaternion();\r\n\r\n private _updatePhysicsBodyTransformation(impostor: PhysicsImpostor) {\r\n const object = impostor.object;\r\n //make sure it is updated...\r\n object.computeWorldMatrix && object.computeWorldMatrix(true);\r\n if (!object.getBoundingInfo()) {\r\n return;\r\n }\r\n const center = impostor.getObjectCenter();\r\n //m.getAbsolutePosition().subtract(m.getBoundingInfo().boundingBox.centerWorld)\r\n // The delta between the mesh position and the mesh bounding box center\r\n this._tmpDeltaPosition.copyFrom(object.getAbsolutePivotPoint().subtract(center));\r\n this._tmpDeltaPosition.divideInPlace(impostor.object.scaling);\r\n this._tmpPosition.copyFrom(center);\r\n let quaternion = object.rotationQuaternion;\r\n\r\n if (!quaternion) {\r\n return;\r\n }\r\n\r\n //is shape is a plane or a heightmap, it must be rotated 90 degs in the X axis.\r\n //ideally these would be rotated at time of creation like cylinder but they dont extend ConvexPolyhedron\r\n if (impostor.type === PhysicsImpostor.PlaneImpostor || impostor.type === PhysicsImpostor.HeightmapImpostor) {\r\n //-90 DEG in X, precalculated\r\n quaternion = quaternion.multiply(this._minus90X);\r\n //Invert! (Precalculated, 90 deg in X)\r\n //No need to clone. this will never change.\r\n impostor.setDeltaRotation(this._plus90X);\r\n }\r\n\r\n //If it is a heightfield, if should be centered.\r\n if (impostor.type === PhysicsImpostor.HeightmapImpostor) {\r\n const mesh = <AbstractMesh>(<any>object);\r\n let boundingInfo = mesh.getBoundingInfo();\r\n //calculate the correct body position:\r\n const rotationQuaternion = mesh.rotationQuaternion;\r\n mesh.rotationQuaternion = this._tmpUnityRotation;\r\n mesh.computeWorldMatrix(true);\r\n\r\n //get original center with no rotation\r\n const c = center.clone();\r\n\r\n let oldPivot = mesh.getPivotMatrix();\r\n if (oldPivot) {\r\n // create a copy the pivot Matrix as it is modified in place\r\n oldPivot = oldPivot.clone();\r\n } else {\r\n oldPivot = Matrix.Identity();\r\n }\r\n\r\n //calculate the new center using a pivot (since this.BJSCANNON.js doesn't center height maps)\r\n const p = Matrix.Translation(boundingInfo.boundingBox.extendSizeWorld.x, 0, -boundingInfo.boundingBox.extendSizeWorld.z);\r\n mesh.setPreTransformMatrix(p);\r\n mesh.computeWorldMatrix(true);\r\n // force bounding box recomputation\r\n boundingInfo = mesh.getBoundingInfo();\r\n\r\n //calculate the translation\r\n const translation = boundingInfo.boundingBox.centerWorld.subtract(center).subtract(mesh.position).negate();\r\n\r\n this._tmpPosition.copyFromFloats(translation.x, translation.y - boundingInfo.boundingBox.extendSizeWorld.y, translation.z);\r\n //add it inverted to the delta\r\n this._tmpDeltaPosition.copyFrom(boundingInfo.boundingBox.centerWorld.subtract(c));\r\n this._tmpDeltaPosition.y += boundingInfo.boundingBox.extendSizeWorld.y;\r\n //rotation is back\r\n mesh.rotationQuaternion = rotationQuaternion;\r\n\r\n mesh.setPreTransformMatrix(oldPivot);\r\n mesh.computeWorldMatrix(true);\r\n } else if (impostor.type === PhysicsImpostor.MeshImpostor) {\r\n this._tmpDeltaPosition.copyFromFloats(0, 0, 0);\r\n }\r\n\r\n impostor.setDeltaPosition(this._tmpDeltaPosition);\r\n //Now update the impostor object\r\n impostor.physicsBody.position.set(this._tmpPosition.x, this._tmpPosition.y, this._tmpPosition.z);\r\n impostor.physicsBody.quaternion.set(quaternion.x, quaternion.y, quaternion.z, quaternion.w);\r\n }\r\n\r\n public setTransformationFromPhysicsBody(impostor: PhysicsImpostor) {\r\n impostor.object.position.set(impostor.physicsBody.position.x, impostor.physicsBody.position.y, impostor.physicsBody.position.z);\r\n if (impostor.object.rotationQuaternion) {\r\n const q = impostor.physicsBody.quaternion;\r\n impostor.object.rotationQuaternion.set(q.x, q.y, q.z, q.w);\r\n }\r\n }\r\n\r\n public setPhysicsBodyTransformation(impostor: PhysicsImpostor, newPosition: Vector3, newRotation: Quaternion) {\r\n impostor.physicsBody.position.set(newPosition.x, newPosition.y, newPosition.z);\r\n impostor.physicsBody.quaternion.set(newRotation.x, newRotation.y, newRotation.z, newRotation.w);\r\n }\r\n\r\n public isSupported(): boolean {\r\n return this.BJSCANNON !== undefined;\r\n }\r\n\r\n public setLinearVelocity(impostor: PhysicsImpostor, velocity: Vector3) {\r\n impostor.physicsBody.velocity.set(velocity.x, velocity.y, velocity.z);\r\n }\r\n\r\n public setAngularVelocity(impostor: PhysicsImpostor, velocity: Vector3) {\r\n impostor.physicsBody.angularVelocity.set(velocity.x, velocity.y, velocity.z);\r\n }\r\n\r\n public getLinearVelocity(impostor: PhysicsImpostor): Nullable<Vector3> {\r\n const v = impostor.physicsBody.velocity;\r\n if (!v) {\r\n return null;\r\n }\r\n return new Vector3(v.x, v.y, v.z);\r\n }\r\n public getAngularVelocity(impostor: PhysicsImpostor): Nullable<Vector3> {\r\n const v = impostor.physicsBody.angularVelocity;\r\n if (!v) {\r\n return null;\r\n }\r\n return new Vector3(v.x, v.y, v.z);\r\n }\r\n\r\n public setBodyMass(impostor: PhysicsImpostor, mass: number) {\r\n impostor.physicsBody.mass = mass;\r\n impostor.physicsBody.updateMassProperties();\r\n }\r\n\r\n public getBodyMass(impostor: PhysicsImpostor): number {\r\n return impostor.physicsBody.mass;\r\n }\r\n\r\n public getBodyFriction(impostor: PhysicsImpostor): number {\r\n return impostor.physicsBody.material.friction;\r\n }\r\n\r\n public setBodyFriction(impostor: PhysicsImpostor, friction: number) {\r\n impostor.physicsBody.material.friction = friction;\r\n }\r\n\r\n public getBodyRestitution(impostor: PhysicsImpostor): number {\r\n return impostor.physicsBody.material.restitution;\r\n }\r\n\r\n public setBodyRestitution(impostor: PhysicsImpostor, restitution: number) {\r\n impostor.physicsBody.material.restitution = restitution;\r\n }\r\n\r\n public sleepBody(impostor: PhysicsImpostor) {\r\n impostor.physicsBody.sleep();\r\n }\r\n\r\n public wakeUpBody(impostor: PhysicsImpostor) {\r\n impostor.physicsBody.wakeUp();\r\n }\r\n\r\n public updateDistanceJoint(joint: PhysicsJoint, maxDistance: number) {\r\n joint.physicsJoint.distance = maxDistance;\r\n }\r\n\r\n public setMotor(joint: IMotorEnabledJoint, speed?: number, maxForce?: number, motorIndex?: number) {\r\n if (!motorIndex) {\r\n joint.physicsJoint.enableMotor();\r\n joint.physicsJoint.setMotorSpeed(speed);\r\n if (maxForce) {\r\n this.setLimit(joint, maxForce);\r\n }\r\n }\r\n }\r\n\r\n public setLimit(joint: IMotorEnabledJoint, minForce: number, maxForce?: number) {\r\n joint.physicsJoint.motorEquation.maxForce = maxForce;\r\n joint.physicsJoint.motorEquation.minForce = minForce === void 0 ? -minForce : minForce;\r\n }\r\n\r\n public syncMeshWithImpostor(mesh: AbstractMesh, impostor: PhysicsImpostor) {\r\n const body = impostor.physicsBody;\r\n\r\n mesh.position.x = body.position.x;\r\n mesh.position.y = body.position.y;\r\n mesh.position.z = body.position.z;\r\n\r\n if (mesh.rotationQuaternion) {\r\n mesh.rotationQuaternion.x = body.quaternion.x;\r\n mesh.rotationQuaternion.y = body.quaternion.y;\r\n mesh.rotationQuaternion.z = body.quaternion.z;\r\n mesh.rotationQuaternion.w = body.quaternion.w;\r\n }\r\n }\r\n\r\n public getRadius(impostor: PhysicsImpostor): number {\r\n const shape = impostor.physicsBody.shapes[0];\r\n return shape.boundingSphereRadius;\r\n }\r\n\r\n public getBoxSizeToRef(impostor: PhysicsImpostor, result: Vector3): void {\r\n const shape = impostor.physicsBody.shapes[0];\r\n result.x = shape.halfExtents.x * 2;\r\n result.y = shape.halfExtents.y * 2;\r\n result.z = shape.halfExtents.z * 2;\r\n }\r\n\r\n public dispose() {}\r\n\r\n private _extendNamespace() {\r\n //this will force cannon to execute at least one step when using interpolation\r\n const step_tmp1 = new this.BJSCANNON.Vec3();\r\n const engine = this.BJSCANNON;\r\n this.BJSCANNON.World.prototype.step = function (dt: number, timeSinceLastCalled: number, maxSubSteps: number) {\r\n maxSubSteps = maxSubSteps || 10;\r\n timeSinceLastCalled = timeSinceLastCalled || 0;\r\n if (timeSinceLastCalled === 0) {\r\n this.internalStep(dt);\r\n this.time += dt;\r\n } else {\r\n let internalSteps = Math.floor((this.time + timeSinceLastCalled) / dt) - Math.floor(this.time / dt);\r\n internalSteps = Math.min(internalSteps, maxSubSteps) || 1;\r\n const t0 = performance.now();\r\n for (let i = 0; i !== internalSteps; i++) {\r\n this.internalStep(dt);\r\n if (performance.now() - t0 > dt * 1000) {\r\n break;\r\n }\r\n }\r\n this.time += timeSinceLastCalled;\r\n const h = this.time % dt;\r\n const h_div_dt = h / dt;\r\n const interpvelo = step_tmp1;\r\n const bodies = this.bodies;\r\n for (let j = 0; j !== bodies.length; j++) {\r\n const b = bodies[j];\r\n if (b.type !== engine.Body.STATIC && b.sleepState !== engine.Body.SLEEPING) {\r\n b.position.vsub(b.previousPosition, interpvelo);\r\n interpvelo.scale(h_div_dt, interpvelo);\r\n b.position.vadd(interpvelo, b.interpolatedPosition);\r\n } else {\r\n b.interpolatedPosition.set(b.position.x, b.position.y, b.position.z);\r\n b.interpolatedQuaternion.set(b.quaternion.x, b.quaternion.y, b.quaternion.z, b.quaternion.w);\r\n }\r\n }\r\n }\r\n };\r\n }\r\n\r\n /**\r\n * Does a raycast in the physics world\r\n * @param from when should the ray start?\r\n * @param to when should the ray end?\r\n * @returns PhysicsRaycastResult\r\n */\r\n public raycast(from: Vector3, to: Vector3): PhysicsRaycastResult {\r\n this._cannonRaycastResult.reset();\r\n this.world.raycastClosest(from, to, {}, this._cannonRaycastResult);\r\n\r\n this._raycastResult.reset(from, to);\r\n if (this._cannonRaycastResult.hasHit) {\r\n // TODO: do we also want to get the body it hit?\r\n this._raycastResult.setHitData(\r\n {\r\n x: this._cannonRaycastResult.hitNormalWorld.x,\r\n y: this._cannonRaycastResult.hitNormalWorld.y,\r\n z: this._cannonRaycastResult.hitNormalWorld.z,\r\n },\r\n {\r\n x: this._cannonRaycastResult.hitPointWorld.x,\r\n y: this._cannonRaycastResult.hitPointWorld.y,\r\n z: this._cannonRaycastResult.hitPointWorld.z,\r\n }\r\n );\r\n this._raycastResult.setHitDistance(this._cannonRaycastResult.distance);\r\n }\r\n\r\n return this._raycastResult;\r\n }\r\n}\r\n\r\nPhysicsEngine.DefaultPluginFactory = () => {\r\n return new CannonJSPlugin();\r\n};\r\n"]}
|
|
1
|
+
{"version":3,"file":"cannonJSPlugin.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Physics/Plugins/cannonJSPlugin.ts"],"names":[],"mappings":"AAAA,qBAAqB;AACrB,cAAc,8BAA8B,CAAC","sourcesContent":["// ES 6 Compatibility\r\nexport * from \"../v1/Plugins/cannonJSPlugin\";\r\n"]}
|
|
@@ -1,59 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { PhysicsImpostor } from "../../Physics/physicsImpostor";
|
|
3
|
-
import type { IMotorEnabledJoint } from "../../Physics/physicsJoint";
|
|
4
|
-
import { PhysicsJoint } from "../../Physics/physicsJoint";
|
|
5
|
-
import type { AbstractMesh } from "../../Meshes/abstractMesh";
|
|
6
|
-
import { Vector3, Quaternion } from "../../Maths/math.vector";
|
|
7
|
-
import type { Nullable } from "../../types";
|
|
8
|
-
import { PhysicsRaycastResult } from "../physicsRaycastResult";
|
|
9
|
-
/** @internal */
|
|
10
|
-
export declare class OimoJSPlugin implements IPhysicsEnginePlugin {
|
|
11
|
-
private _useDeltaForWorldStep;
|
|
12
|
-
world: any;
|
|
13
|
-
name: string;
|
|
14
|
-
BJSOIMO: any;
|
|
15
|
-
private _raycastResult;
|
|
16
|
-
private _fixedTimeStep;
|
|
17
|
-
constructor(_useDeltaForWorldStep?: boolean, iterations?: number, oimoInjection?: any);
|
|
18
|
-
setGravity(gravity: Vector3): void;
|
|
19
|
-
setTimeStep(timeStep: number): void;
|
|
20
|
-
getTimeStep(): number;
|
|
21
|
-
private _tmpImpostorsArray;
|
|
22
|
-
executeStep(delta: number, impostors: Array<PhysicsImpostor>): void;
|
|
23
|
-
applyImpulse(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): void;
|
|
24
|
-
applyForce(impostor: PhysicsImpostor, force: Vector3, contactPoint: Vector3): void;
|
|
25
|
-
generatePhysicsBody(impostor: PhysicsImpostor): void;
|
|
26
|
-
private _tmpPositionVector;
|
|
27
|
-
removePhysicsBody(impostor: PhysicsImpostor): void;
|
|
28
|
-
generateJoint(impostorJoint: PhysicsImpostorJoint): void;
|
|
29
|
-
removeJoint(impostorJoint: PhysicsImpostorJoint): void;
|
|
30
|
-
isSupported(): boolean;
|
|
31
|
-
setTransformationFromPhysicsBody(impostor: PhysicsImpostor): void;
|
|
32
|
-
setPhysicsBodyTransformation(impostor: PhysicsImpostor, newPosition: Vector3, newRotation: Quaternion): void;
|
|
33
|
-
setLinearVelocity(impostor: PhysicsImpostor, velocity: Vector3): void;
|
|
34
|
-
setAngularVelocity(impostor: PhysicsImpostor, velocity: Vector3): void;
|
|
35
|
-
getLinearVelocity(impostor: PhysicsImpostor): Nullable<Vector3>;
|
|
36
|
-
getAngularVelocity(impostor: PhysicsImpostor): Nullable<Vector3>;
|
|
37
|
-
setBodyMass(impostor: PhysicsImpostor, mass: number): void;
|
|
38
|
-
getBodyMass(impostor: PhysicsImpostor): number;
|
|
39
|
-
getBodyFriction(impostor: PhysicsImpostor): number;
|
|
40
|
-
setBodyFriction(impostor: PhysicsImpostor, friction: number): void;
|
|
41
|
-
getBodyRestitution(impostor: PhysicsImpostor): number;
|
|
42
|
-
setBodyRestitution(impostor: PhysicsImpostor, restitution: number): void;
|
|
43
|
-
sleepBody(impostor: PhysicsImpostor): void;
|
|
44
|
-
wakeUpBody(impostor: PhysicsImpostor): void;
|
|
45
|
-
updateDistanceJoint(joint: PhysicsJoint, maxDistance: number, minDistance?: number): void;
|
|
46
|
-
setMotor(joint: IMotorEnabledJoint, speed: number, force?: number, motorIndex?: number): void;
|
|
47
|
-
setLimit(joint: IMotorEnabledJoint, upperLimit: number, lowerLimit?: number, motorIndex?: number): void;
|
|
48
|
-
syncMeshWithImpostor(mesh: AbstractMesh, impostor: PhysicsImpostor): void;
|
|
49
|
-
getRadius(impostor: PhysicsImpostor): number;
|
|
50
|
-
getBoxSizeToRef(impostor: PhysicsImpostor, result: Vector3): void;
|
|
51
|
-
dispose(): void;
|
|
52
|
-
/**
|
|
53
|
-
* Does a raycast in the physics world
|
|
54
|
-
* @param from when should the ray start?
|
|
55
|
-
* @param to when should the ray end?
|
|
56
|
-
* @returns PhysicsRaycastResult
|
|
57
|
-
*/
|
|
58
|
-
raycast(from: Vector3, to: Vector3): PhysicsRaycastResult;
|
|
59
|
-
}
|
|
1
|
+
export * from "../v1/Plugins/oimoJSPlugin";
|
|
@@ -1,433 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { PhysicsEngine } from "../../Physics/physicsEngine.js";
|
|
4
|
-
import { Vector3, Quaternion } from "../../Maths/math.vector.js";
|
|
5
|
-
import { Logger } from "../../Misc/logger.js";
|
|
6
|
-
import { PhysicsRaycastResult } from "../physicsRaycastResult.js";
|
|
7
|
-
/** @internal */
|
|
8
|
-
export class OimoJSPlugin {
|
|
9
|
-
constructor(_useDeltaForWorldStep = true, iterations, oimoInjection = OIMO) {
|
|
10
|
-
this._useDeltaForWorldStep = _useDeltaForWorldStep;
|
|
11
|
-
this.name = "OimoJSPlugin";
|
|
12
|
-
this._fixedTimeStep = 1 / 60;
|
|
13
|
-
this._tmpImpostorsArray = [];
|
|
14
|
-
this._tmpPositionVector = Vector3.Zero();
|
|
15
|
-
this.BJSOIMO = oimoInjection;
|
|
16
|
-
this.world = new this.BJSOIMO.World({
|
|
17
|
-
iterations: iterations,
|
|
18
|
-
});
|
|
19
|
-
this.world.clear();
|
|
20
|
-
this._raycastResult = new PhysicsRaycastResult();
|
|
21
|
-
}
|
|
22
|
-
setGravity(gravity) {
|
|
23
|
-
this.world.gravity.set(gravity.x, gravity.y, gravity.z);
|
|
24
|
-
}
|
|
25
|
-
setTimeStep(timeStep) {
|
|
26
|
-
this.world.timeStep = timeStep;
|
|
27
|
-
}
|
|
28
|
-
getTimeStep() {
|
|
29
|
-
return this.world.timeStep;
|
|
30
|
-
}
|
|
31
|
-
executeStep(delta, impostors) {
|
|
32
|
-
impostors.forEach(function (impostor) {
|
|
33
|
-
impostor.beforeStep();
|
|
34
|
-
});
|
|
35
|
-
this.world.timeStep = this._useDeltaForWorldStep ? delta : this._fixedTimeStep;
|
|
36
|
-
this.world.step();
|
|
37
|
-
impostors.forEach((impostor) => {
|
|
38
|
-
impostor.afterStep();
|
|
39
|
-
//update the ordered impostors array
|
|
40
|
-
this._tmpImpostorsArray[impostor.uniqueId] = impostor;
|
|
41
|
-
});
|
|
42
|
-
//check for collisions
|
|
43
|
-
let contact = this.world.contacts;
|
|
44
|
-
while (contact !== null) {
|
|
45
|
-
if (contact.touching && !contact.body1.sleeping && !contact.body2.sleeping) {
|
|
46
|
-
contact = contact.next;
|
|
47
|
-
continue;
|
|
48
|
-
}
|
|
49
|
-
//is this body colliding with any other? get the impostor
|
|
50
|
-
const mainImpostor = this._tmpImpostorsArray[+contact.body1.name];
|
|
51
|
-
const collidingImpostor = this._tmpImpostorsArray[+contact.body2.name];
|
|
52
|
-
if (!mainImpostor || !collidingImpostor) {
|
|
53
|
-
contact = contact.next;
|
|
54
|
-
continue;
|
|
55
|
-
}
|
|
56
|
-
mainImpostor.onCollide({ body: collidingImpostor.physicsBody, point: null, distance: 0, impulse: 0, normal: null });
|
|
57
|
-
collidingImpostor.onCollide({ body: mainImpostor.physicsBody, point: null, distance: 0, impulse: 0, normal: null });
|
|
58
|
-
contact = contact.next;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
applyImpulse(impostor, force, contactPoint) {
|
|
62
|
-
const mass = impostor.physicsBody.mass;
|
|
63
|
-
impostor.physicsBody.applyImpulse(contactPoint.scale(this.world.invScale), force.scale(this.world.invScale * mass));
|
|
64
|
-
}
|
|
65
|
-
applyForce(impostor, force, contactPoint) {
|
|
66
|
-
Logger.Warn("Oimo doesn't support applying force. Using impulse instead.");
|
|
67
|
-
this.applyImpulse(impostor, force, contactPoint);
|
|
68
|
-
}
|
|
69
|
-
generatePhysicsBody(impostor) {
|
|
70
|
-
//parent-child relationship. Does this impostor has a parent impostor?
|
|
71
|
-
if (impostor.parent) {
|
|
72
|
-
if (impostor.physicsBody) {
|
|
73
|
-
this.removePhysicsBody(impostor);
|
|
74
|
-
//TODO is that needed?
|
|
75
|
-
impostor.forceUpdate();
|
|
76
|
-
}
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
if (impostor.isBodyInitRequired()) {
|
|
80
|
-
const bodyConfig = {
|
|
81
|
-
name: impostor.uniqueId,
|
|
82
|
-
//Oimo must have mass, also for static objects.
|
|
83
|
-
config: [impostor.getParam("mass") || 0.001, impostor.getParam("friction"), impostor.getParam("restitution")],
|
|
84
|
-
size: [],
|
|
85
|
-
type: [],
|
|
86
|
-
pos: [],
|
|
87
|
-
posShape: [],
|
|
88
|
-
rot: [],
|
|
89
|
-
rotShape: [],
|
|
90
|
-
move: impostor.getParam("mass") !== 0,
|
|
91
|
-
density: impostor.getParam("mass"),
|
|
92
|
-
friction: impostor.getParam("friction"),
|
|
93
|
-
restitution: impostor.getParam("restitution"),
|
|
94
|
-
//Supporting older versions of Oimo
|
|
95
|
-
world: this.world,
|
|
96
|
-
};
|
|
97
|
-
const impostors = [impostor];
|
|
98
|
-
const addToArray = (parent) => {
|
|
99
|
-
if (!parent.getChildMeshes) {
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
parent.getChildMeshes().forEach(function (m) {
|
|
103
|
-
if (m.physicsImpostor) {
|
|
104
|
-
impostors.push(m.physicsImpostor);
|
|
105
|
-
//m.physicsImpostor._init();
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
};
|
|
109
|
-
addToArray(impostor.object);
|
|
110
|
-
const checkWithEpsilon = (value) => {
|
|
111
|
-
return Math.max(value, PhysicsEngine.Epsilon);
|
|
112
|
-
};
|
|
113
|
-
const globalQuaternion = new Quaternion();
|
|
114
|
-
impostors.forEach((i) => {
|
|
115
|
-
if (!i.object.rotationQuaternion) {
|
|
116
|
-
return;
|
|
117
|
-
}
|
|
118
|
-
//get the correct bounding box
|
|
119
|
-
const oldQuaternion = i.object.rotationQuaternion;
|
|
120
|
-
globalQuaternion.copyFrom(oldQuaternion);
|
|
121
|
-
i.object.rotationQuaternion.set(0, 0, 0, 1);
|
|
122
|
-
i.object.computeWorldMatrix(true);
|
|
123
|
-
const rot = globalQuaternion.toEulerAngles();
|
|
124
|
-
const impostorExtents = i.getObjectExtents();
|
|
125
|
-
// eslint-disable-next-line no-loss-of-precision
|
|
126
|
-
const radToDeg = 57.295779513082320876;
|
|
127
|
-
if (i === impostor) {
|
|
128
|
-
const center = impostor.getObjectCenter();
|
|
129
|
-
impostor.object.getAbsolutePivotPoint().subtractToRef(center, this._tmpPositionVector);
|
|
130
|
-
this._tmpPositionVector.divideInPlace(impostor.object.scaling);
|
|
131
|
-
//Can also use Array.prototype.push.apply
|
|
132
|
-
bodyConfig.pos.push(center.x);
|
|
133
|
-
bodyConfig.pos.push(center.y);
|
|
134
|
-
bodyConfig.pos.push(center.z);
|
|
135
|
-
bodyConfig.posShape.push(0, 0, 0);
|
|
136
|
-
bodyConfig.rotShape.push(0, 0, 0);
|
|
137
|
-
}
|
|
138
|
-
else {
|
|
139
|
-
const localPosition = i.object.position.clone();
|
|
140
|
-
bodyConfig.posShape.push(localPosition.x);
|
|
141
|
-
bodyConfig.posShape.push(localPosition.y);
|
|
142
|
-
bodyConfig.posShape.push(localPosition.z);
|
|
143
|
-
// bodyConfig.pos.push(0, 0, 0);
|
|
144
|
-
bodyConfig.rotShape.push(rot.x * radToDeg, rot.y * radToDeg, rot.z * radToDeg);
|
|
145
|
-
}
|
|
146
|
-
i.object.rotationQuaternion.copyFrom(globalQuaternion);
|
|
147
|
-
// register mesh
|
|
148
|
-
switch (i.type) {
|
|
149
|
-
case PhysicsImpostor.ParticleImpostor:
|
|
150
|
-
Logger.Warn("No Particle support in OIMO.js. using SphereImpostor instead");
|
|
151
|
-
// eslint-disable-next-line no-fallthrough
|
|
152
|
-
case PhysicsImpostor.SphereImpostor: {
|
|
153
|
-
const radiusX = impostorExtents.x;
|
|
154
|
-
const radiusY = impostorExtents.y;
|
|
155
|
-
const radiusZ = impostorExtents.z;
|
|
156
|
-
const size = Math.max(checkWithEpsilon(radiusX), checkWithEpsilon(radiusY), checkWithEpsilon(radiusZ)) / 2;
|
|
157
|
-
bodyConfig.type.push("sphere");
|
|
158
|
-
//due to the way oimo works with compounds, add 3 times
|
|
159
|
-
bodyConfig.size.push(size);
|
|
160
|
-
bodyConfig.size.push(size);
|
|
161
|
-
bodyConfig.size.push(size);
|
|
162
|
-
break;
|
|
163
|
-
}
|
|
164
|
-
case PhysicsImpostor.CylinderImpostor: {
|
|
165
|
-
const sizeX = checkWithEpsilon(impostorExtents.x) / 2;
|
|
166
|
-
const sizeY = checkWithEpsilon(impostorExtents.y);
|
|
167
|
-
bodyConfig.type.push("cylinder");
|
|
168
|
-
bodyConfig.size.push(sizeX);
|
|
169
|
-
bodyConfig.size.push(sizeY);
|
|
170
|
-
//due to the way oimo works with compounds, add one more value.
|
|
171
|
-
bodyConfig.size.push(sizeY);
|
|
172
|
-
break;
|
|
173
|
-
}
|
|
174
|
-
case PhysicsImpostor.PlaneImpostor:
|
|
175
|
-
case PhysicsImpostor.BoxImpostor:
|
|
176
|
-
default: {
|
|
177
|
-
const sizeX = checkWithEpsilon(impostorExtents.x);
|
|
178
|
-
const sizeY = checkWithEpsilon(impostorExtents.y);
|
|
179
|
-
const sizeZ = checkWithEpsilon(impostorExtents.z);
|
|
180
|
-
bodyConfig.type.push("box");
|
|
181
|
-
//if (i === impostor) {
|
|
182
|
-
bodyConfig.size.push(sizeX);
|
|
183
|
-
bodyConfig.size.push(sizeY);
|
|
184
|
-
bodyConfig.size.push(sizeZ);
|
|
185
|
-
//} else {
|
|
186
|
-
// bodyConfig.size.push(0,0,0);
|
|
187
|
-
//}
|
|
188
|
-
break;
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
//actually not needed, but hey...
|
|
192
|
-
i.object.rotationQuaternion = oldQuaternion;
|
|
193
|
-
});
|
|
194
|
-
impostor.physicsBody = this.world.add(bodyConfig);
|
|
195
|
-
// set the quaternion, ignoring the previously defined (euler) rotation
|
|
196
|
-
impostor.physicsBody.resetQuaternion(globalQuaternion);
|
|
197
|
-
// update with delta 0, so the body will receive the new rotation.
|
|
198
|
-
impostor.physicsBody.updatePosition(0);
|
|
199
|
-
}
|
|
200
|
-
else {
|
|
201
|
-
this._tmpPositionVector.copyFromFloats(0, 0, 0);
|
|
202
|
-
}
|
|
203
|
-
impostor.setDeltaPosition(this._tmpPositionVector);
|
|
204
|
-
//this._tmpPositionVector.addInPlace(impostor.mesh.getBoundingInfo().boundingBox.center);
|
|
205
|
-
//this.setPhysicsBodyTransformation(impostor, this._tmpPositionVector, impostor.mesh.rotationQuaternion);
|
|
206
|
-
}
|
|
207
|
-
removePhysicsBody(impostor) {
|
|
208
|
-
//impostor.physicsBody.dispose();
|
|
209
|
-
this.world.removeRigidBody(impostor.physicsBody);
|
|
210
|
-
}
|
|
211
|
-
generateJoint(impostorJoint) {
|
|
212
|
-
const mainBody = impostorJoint.mainImpostor.physicsBody;
|
|
213
|
-
const connectedBody = impostorJoint.connectedImpostor.physicsBody;
|
|
214
|
-
if (!mainBody || !connectedBody) {
|
|
215
|
-
return;
|
|
216
|
-
}
|
|
217
|
-
const jointData = impostorJoint.joint.jointData;
|
|
218
|
-
const options = jointData.nativeParams || {};
|
|
219
|
-
let type;
|
|
220
|
-
const nativeJointData = {
|
|
221
|
-
body1: mainBody,
|
|
222
|
-
body2: connectedBody,
|
|
223
|
-
axe1: options.axe1 || (jointData.mainAxis ? jointData.mainAxis.asArray() : null),
|
|
224
|
-
axe2: options.axe2 || (jointData.connectedAxis ? jointData.connectedAxis.asArray() : null),
|
|
225
|
-
pos1: options.pos1 || (jointData.mainPivot ? jointData.mainPivot.asArray() : null),
|
|
226
|
-
pos2: options.pos2 || (jointData.connectedPivot ? jointData.connectedPivot.asArray() : null),
|
|
227
|
-
min: options.min,
|
|
228
|
-
max: options.max,
|
|
229
|
-
collision: options.collision || jointData.collision,
|
|
230
|
-
spring: options.spring,
|
|
231
|
-
//supporting older version of Oimo
|
|
232
|
-
world: this.world,
|
|
233
|
-
};
|
|
234
|
-
switch (impostorJoint.joint.type) {
|
|
235
|
-
case PhysicsJoint.BallAndSocketJoint:
|
|
236
|
-
type = "jointBall";
|
|
237
|
-
break;
|
|
238
|
-
case PhysicsJoint.SpringJoint: {
|
|
239
|
-
Logger.Warn("OIMO.js doesn't support Spring Constraint. Simulating using DistanceJoint instead");
|
|
240
|
-
const springData = jointData;
|
|
241
|
-
nativeJointData.min = springData.length || nativeJointData.min;
|
|
242
|
-
//Max should also be set, just make sure it is at least min
|
|
243
|
-
nativeJointData.max = Math.max(nativeJointData.min, nativeJointData.max);
|
|
244
|
-
}
|
|
245
|
-
// eslint-disable-next-line no-fallthrough
|
|
246
|
-
case PhysicsJoint.DistanceJoint:
|
|
247
|
-
type = "jointDistance";
|
|
248
|
-
nativeJointData.max = jointData.maxDistance;
|
|
249
|
-
break;
|
|
250
|
-
case PhysicsJoint.PrismaticJoint:
|
|
251
|
-
type = "jointPrisme";
|
|
252
|
-
break;
|
|
253
|
-
case PhysicsJoint.SliderJoint:
|
|
254
|
-
type = "jointSlide";
|
|
255
|
-
break;
|
|
256
|
-
case PhysicsJoint.WheelJoint:
|
|
257
|
-
type = "jointWheel";
|
|
258
|
-
break;
|
|
259
|
-
case PhysicsJoint.HingeJoint:
|
|
260
|
-
default:
|
|
261
|
-
type = "jointHinge";
|
|
262
|
-
break;
|
|
263
|
-
}
|
|
264
|
-
nativeJointData.type = type;
|
|
265
|
-
impostorJoint.joint.physicsJoint = this.world.add(nativeJointData);
|
|
266
|
-
}
|
|
267
|
-
removeJoint(impostorJoint) {
|
|
268
|
-
//Bug in Oimo prevents us from disposing a joint in the playground
|
|
269
|
-
//joint.joint.physicsJoint.dispose();
|
|
270
|
-
//So we will bruteforce it!
|
|
271
|
-
try {
|
|
272
|
-
this.world.removeJoint(impostorJoint.joint.physicsJoint);
|
|
273
|
-
}
|
|
274
|
-
catch (e) {
|
|
275
|
-
Logger.Warn(e);
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
isSupported() {
|
|
279
|
-
return this.BJSOIMO !== undefined;
|
|
280
|
-
}
|
|
281
|
-
setTransformationFromPhysicsBody(impostor) {
|
|
282
|
-
if (!impostor.physicsBody.sleeping) {
|
|
283
|
-
if (impostor.physicsBody.shapes.next) {
|
|
284
|
-
let parent = impostor.physicsBody.shapes;
|
|
285
|
-
while (parent.next) {
|
|
286
|
-
parent = parent.next;
|
|
287
|
-
}
|
|
288
|
-
impostor.object.position.set(parent.position.x, parent.position.y, parent.position.z);
|
|
289
|
-
}
|
|
290
|
-
else {
|
|
291
|
-
const pos = impostor.physicsBody.getPosition();
|
|
292
|
-
impostor.object.position.set(pos.x, pos.y, pos.z);
|
|
293
|
-
}
|
|
294
|
-
if (impostor.object.rotationQuaternion) {
|
|
295
|
-
const quat = impostor.physicsBody.getQuaternion();
|
|
296
|
-
impostor.object.rotationQuaternion.set(quat.x, quat.y, quat.z, quat.w);
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
setPhysicsBodyTransformation(impostor, newPosition, newRotation) {
|
|
301
|
-
const body = impostor.physicsBody;
|
|
302
|
-
// disable bidirectional for compound meshes
|
|
303
|
-
if (impostor.physicsBody.shapes.next) {
|
|
304
|
-
return;
|
|
305
|
-
}
|
|
306
|
-
body.position.set(newPosition.x, newPosition.y, newPosition.z);
|
|
307
|
-
body.orientation.set(newRotation.x, newRotation.y, newRotation.z, newRotation.w);
|
|
308
|
-
body.syncShapes();
|
|
309
|
-
body.awake();
|
|
310
|
-
}
|
|
311
|
-
/*private _getLastShape(body: any): any {
|
|
312
|
-
var lastShape = body.shapes;
|
|
313
|
-
while (lastShape.next) {
|
|
314
|
-
lastShape = lastShape.next;
|
|
315
|
-
}
|
|
316
|
-
return lastShape;
|
|
317
|
-
}*/
|
|
318
|
-
setLinearVelocity(impostor, velocity) {
|
|
319
|
-
impostor.physicsBody.linearVelocity.set(velocity.x, velocity.y, velocity.z);
|
|
320
|
-
}
|
|
321
|
-
setAngularVelocity(impostor, velocity) {
|
|
322
|
-
impostor.physicsBody.angularVelocity.set(velocity.x, velocity.y, velocity.z);
|
|
323
|
-
}
|
|
324
|
-
getLinearVelocity(impostor) {
|
|
325
|
-
const v = impostor.physicsBody.linearVelocity;
|
|
326
|
-
if (!v) {
|
|
327
|
-
return null;
|
|
328
|
-
}
|
|
329
|
-
return new Vector3(v.x, v.y, v.z);
|
|
330
|
-
}
|
|
331
|
-
getAngularVelocity(impostor) {
|
|
332
|
-
const v = impostor.physicsBody.angularVelocity;
|
|
333
|
-
if (!v) {
|
|
334
|
-
return null;
|
|
335
|
-
}
|
|
336
|
-
return new Vector3(v.x, v.y, v.z);
|
|
337
|
-
}
|
|
338
|
-
setBodyMass(impostor, mass) {
|
|
339
|
-
const staticBody = mass === 0;
|
|
340
|
-
//this will actually set the body's density and not its mass.
|
|
341
|
-
//But this is how oimo treats the mass variable.
|
|
342
|
-
impostor.physicsBody.shapes.density = staticBody ? 1 : mass;
|
|
343
|
-
impostor.physicsBody.setupMass(staticBody ? 0x2 : 0x1);
|
|
344
|
-
}
|
|
345
|
-
getBodyMass(impostor) {
|
|
346
|
-
return impostor.physicsBody.shapes.density;
|
|
347
|
-
}
|
|
348
|
-
getBodyFriction(impostor) {
|
|
349
|
-
return impostor.physicsBody.shapes.friction;
|
|
350
|
-
}
|
|
351
|
-
setBodyFriction(impostor, friction) {
|
|
352
|
-
impostor.physicsBody.shapes.friction = friction;
|
|
353
|
-
}
|
|
354
|
-
getBodyRestitution(impostor) {
|
|
355
|
-
return impostor.physicsBody.shapes.restitution;
|
|
356
|
-
}
|
|
357
|
-
setBodyRestitution(impostor, restitution) {
|
|
358
|
-
impostor.physicsBody.shapes.restitution = restitution;
|
|
359
|
-
}
|
|
360
|
-
sleepBody(impostor) {
|
|
361
|
-
impostor.physicsBody.sleep();
|
|
362
|
-
}
|
|
363
|
-
wakeUpBody(impostor) {
|
|
364
|
-
impostor.physicsBody.awake();
|
|
365
|
-
}
|
|
366
|
-
updateDistanceJoint(joint, maxDistance, minDistance) {
|
|
367
|
-
joint.physicsJoint.limitMotor.upperLimit = maxDistance;
|
|
368
|
-
if (minDistance !== void 0) {
|
|
369
|
-
joint.physicsJoint.limitMotor.lowerLimit = minDistance;
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
setMotor(joint, speed, force, motorIndex) {
|
|
373
|
-
if (force !== undefined) {
|
|
374
|
-
Logger.Warn("OimoJS plugin currently has unexpected behavior when using setMotor with force parameter");
|
|
375
|
-
}
|
|
376
|
-
else {
|
|
377
|
-
force = 1e6;
|
|
378
|
-
}
|
|
379
|
-
speed *= -1;
|
|
380
|
-
//TODO separate rotational and transational motors.
|
|
381
|
-
const motor = motorIndex
|
|
382
|
-
? joint.physicsJoint.rotationalLimitMotor2
|
|
383
|
-
: joint.physicsJoint.rotationalLimitMotor1 || joint.physicsJoint.rotationalLimitMotor || joint.physicsJoint.limitMotor;
|
|
384
|
-
if (motor) {
|
|
385
|
-
motor.setMotor(speed, force);
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
setLimit(joint, upperLimit, lowerLimit, motorIndex) {
|
|
389
|
-
//TODO separate rotational and transational motors.
|
|
390
|
-
const motor = motorIndex
|
|
391
|
-
? joint.physicsJoint.rotationalLimitMotor2
|
|
392
|
-
: joint.physicsJoint.rotationalLimitMotor1 || joint.physicsJoint.rotationalLimitMotor || joint.physicsJoint.limitMotor;
|
|
393
|
-
if (motor) {
|
|
394
|
-
motor.setLimit(upperLimit, lowerLimit === void 0 ? -upperLimit : lowerLimit);
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
syncMeshWithImpostor(mesh, impostor) {
|
|
398
|
-
const body = impostor.physicsBody;
|
|
399
|
-
mesh.position.x = body.position.x;
|
|
400
|
-
mesh.position.y = body.position.y;
|
|
401
|
-
mesh.position.z = body.position.z;
|
|
402
|
-
if (mesh.rotationQuaternion) {
|
|
403
|
-
mesh.rotationQuaternion.x = body.orientation.x;
|
|
404
|
-
mesh.rotationQuaternion.y = body.orientation.y;
|
|
405
|
-
mesh.rotationQuaternion.z = body.orientation.z;
|
|
406
|
-
mesh.rotationQuaternion.w = body.orientation.w;
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
getRadius(impostor) {
|
|
410
|
-
return impostor.physicsBody.shapes.radius;
|
|
411
|
-
}
|
|
412
|
-
getBoxSizeToRef(impostor, result) {
|
|
413
|
-
const shape = impostor.physicsBody.shapes;
|
|
414
|
-
result.x = shape.halfWidth * 2;
|
|
415
|
-
result.y = shape.halfHeight * 2;
|
|
416
|
-
result.z = shape.halfDepth * 2;
|
|
417
|
-
}
|
|
418
|
-
dispose() {
|
|
419
|
-
this.world.clear();
|
|
420
|
-
}
|
|
421
|
-
/**
|
|
422
|
-
* Does a raycast in the physics world
|
|
423
|
-
* @param from when should the ray start?
|
|
424
|
-
* @param to when should the ray end?
|
|
425
|
-
* @returns PhysicsRaycastResult
|
|
426
|
-
*/
|
|
427
|
-
raycast(from, to) {
|
|
428
|
-
Logger.Warn("raycast is not currently supported by the Oimo physics plugin");
|
|
429
|
-
this._raycastResult.reset(from, to);
|
|
430
|
-
return this._raycastResult;
|
|
431
|
-
}
|
|
432
|
-
}
|
|
1
|
+
// ES 6 Compatibility
|
|
2
|
+
export * from "../v1/Plugins/oimoJSPlugin.js";
|
|
433
3
|
//# sourceMappingURL=oimoJSPlugin.js.map
|