@babylonjs/core 5.45.0 → 5.45.2
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/Engines/thinEngine.js +2 -2
- package/Engines/thinEngine.js.map +1 -1
- package/Inputs/scene.inputManager.js +12 -1
- package/Inputs/scene.inputManager.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/perturbNormalBlock.d.ts +7 -0
- package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js +30 -1
- package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js.map +1 -1
- package/Materials/Textures/texture.d.ts +2 -2
- package/Materials/Textures/texture.js +2 -2
- package/Materials/Textures/texture.js.map +1 -1
- package/Materials/Textures/videoTexture.d.ts +1 -0
- package/Materials/Textures/videoTexture.js +19 -8
- package/Materials/Textures/videoTexture.js.map +1 -1
- package/Materials/clipPlaneMaterialHelper.js +22 -19
- package/Materials/clipPlaneMaterialHelper.js.map +1 -1
- package/Misc/khronosTextureContainer2.js +3 -5
- package/Misc/khronosTextureContainer2.js.map +1 -1
- package/Physics/index.d.ts +1 -0
- package/Physics/index.js +1 -0
- package/Physics/index.js.map +1 -1
- package/Physics/physicsHelper.d.ts +452 -1
- package/Physics/physicsHelper.js +877 -2
- package/Physics/physicsHelper.js.map +1 -1
- package/Physics/v1/index.d.ts +0 -1
- package/Physics/v1/index.js +0 -1
- package/Physics/v1/index.js.map +1 -1
- package/Physics/v2/IPhysicsEnginePlugin.d.ts +8 -1
- package/Physics/v2/IPhysicsEnginePlugin.js.map +1 -1
- package/Physics/v2/index.d.ts +1 -0
- package/Physics/v2/index.js +1 -0
- package/Physics/v2/index.js.map +1 -1
- package/Physics/v2/physicsAggregate.d.ts +39 -19
- package/Physics/v2/physicsAggregate.js +61 -5
- package/Physics/v2/physicsAggregate.js.map +1 -1
- package/Physics/v2/physicsBody.d.ts +37 -1
- package/Physics/v2/physicsBody.js +71 -1
- package/Physics/v2/physicsBody.js.map +1 -1
- package/Physics/v2/physicsEngine.d.ts +7 -2
- package/Physics/v2/physicsEngine.js +9 -2
- package/Physics/v2/physicsEngine.js.map +1 -1
- package/Physics/v2/physicsShape.d.ts +30 -44
- package/Physics/v2/physicsShape.js +30 -44
- package/Physics/v2/physicsShape.js.map +1 -1
- package/Shaders/ShadersInclude/bumpFragment.js +1 -0
- package/Shaders/ShadersInclude/bumpFragment.js.map +1 -1
- package/Shaders/ShadersInclude/bumpFragmentMainFunctions.js +4 -1
- package/Shaders/ShadersInclude/bumpFragmentMainFunctions.js.map +1 -1
- package/Shaders/sprites.fragment.js +1 -1
- package/Shaders/sprites.fragment.js.map +1 -1
- package/assetContainer.js +1 -1
- package/assetContainer.js.map +1 -1
- package/package.json +1 -1
- package/Physics/v1/physicsHelper.d.ts +0 -411
- package/Physics/v1/physicsHelper.js +0 -709
- package/Physics/v1/physicsHelper.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"physicsHelper.js","sourceRoot":"","sources":["../../../../lts/core/generated/Physics/physicsHelper.ts"],"names":[],"mappings":"AAAA,qBAAqB;AACrB,cAAc,oBAAoB,CAAC","sourcesContent":["// ES 6 Compatibility\r\nexport * from \"./v1/physicsHelper\";\r\n"]}
|
|
1
|
+
{"version":3,"file":"physicsHelper.js","sourceRoot":"","sources":["../../../../lts/core/generated/Physics/physicsHelper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAG/C,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAQrC;;;GAGG;AACH,MAAM,OAAO,aAAa;IAKtB;;;OAGG;IACH,YAAY,KAAY;QANhB,aAAQ,GAAmB,EAAE,KAAK,EAAE,IAAI,OAAO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kBAAkB,CAAC,MAAM,CAAC;IAChE,CAAC;CAAA;AAED;;;GAGG;AACH,MAAM,OAAO,yBAAyB;IAAtC;QACI;;WAEG;QACH,WAAM,GAAW,CAAC,CAAC;QAEnB;;WAEG;QACH,aAAQ,GAAW,EAAE,CAAC;QAEtB;;WAEG;QACH,WAAM,GAAW,EAAE,CAAC;QAEpB;;WAEG;QACH,8BAAyB,GAAW,GAAG,CAAC;QAExC;;WAEG;QACH,+BAA0B,GAAW,CAAC,CAAC;QAEvC;;WAEG;QACH,+BAA0B,GAAW,GAAG,CAAC;QAEzC;;WAEG;QACH,2BAAsB,GAAW,IAAI,CAAC;IAC1C,CAAC;CAAA;AAED;;;GAGG;AACH,MAAM,CAAN,IAAY,2BAKX;AALD,WAAY,2BAA2B;IACnC,4EAA4E;IAC5E,qFAAQ,CAAA;IACR,uEAAuE;IACvE,iFAAM,CAAA;AACV,CAAC,EALW,2BAA2B,KAA3B,2BAA2B,QAKtC;AAED;;;GAGG;AACH,MAAM,CAAN,IAAY,kBAKX;AALD,WAAY,kBAAkB;IAC1B,wFAAwF;IACxF,+DAAM,CAAA;IACN,2HAA2H;IAC3H,6EAAa,CAAA;AACjB,CAAC,EALW,kBAAkB,KAAlB,kBAAkB,QAK7B","sourcesContent":["import type { Nullable } from \"../types\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport { Vector3 } from \"../Maths/math.vector\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport type { Mesh } from \"../Meshes/mesh\";\r\nimport { CreateSphere } from \"../Meshes/Builders/sphereBuilder\";\r\nimport { CreateCylinder } from \"../Meshes/Builders/cylinderBuilder\";\r\nimport { Ray } from \"../Culling/ray\";\r\nimport type { Scene } from \"../scene\";\r\nimport type { PhysicsEngine as PhysicsEngineV1 } from \"./physicsEngine\";\r\nimport type { PhysicsEngine as PhysicsEngineV2 } from \"./v2/physicsEngine\";\r\nimport type { IPhysicsEngine } from \"./IPhysicsEngine\";\r\nimport type { PhysicsImpostor } from \"./v1/physicsImpostor\";\r\nimport type { PhysicsBody } from \"./v2/physicsBody\";\r\n\r\n/**\r\n * A helper for physics simulations\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class\r\n */\r\nexport class PhysicsHelper {\r\n private _scene: Scene;\r\n private _physicsEngine: Nullable<IPhysicsEngine>;\r\n private _hitData: PhysicsHitData = { force: new Vector3(), contactPoint: new Vector3(), distanceFromOrigin: 0 };\r\n\r\n /**\r\n * Initializes the Physics helper\r\n * @param scene Babylon.js scene\r\n */\r\n constructor(scene: Scene) {\r\n this._scene = scene;\r\n this._physicsEngine = this._scene.getPhysicsEngine();\r\n\r\n if (!this._physicsEngine) {\r\n Logger.Warn(\"Physics engine not enabled. Please enable the physics before you can use the methods.\");\r\n return;\r\n }\r\n }\r\n\r\n /**\r\n * Applies a radial explosion impulse\r\n * @param origin the origin of the explosion\r\n * @param radiusOrEventOptions the radius or the options of radial explosion\r\n * @param strength the explosion strength\r\n * @param falloff possible options: Constant & Linear. Defaults to Constant\r\n * @returns A physics radial explosion event, or null\r\n */\r\n public applyRadialExplosionImpulse(\r\n origin: Vector3,\r\n radiusOrEventOptions: number | PhysicsRadialExplosionEventOptions,\r\n strength?: number,\r\n falloff?: PhysicsRadialImpulseFalloff\r\n ): Nullable<PhysicsRadialExplosionEvent> {\r\n if (!this._physicsEngine) {\r\n Logger.Warn(\"Physics engine not enabled. Please enable the physics before you call this method.\");\r\n return null;\r\n }\r\n\r\n if (this._physicsEngine.getPluginVersion() === 1 && (<PhysicsEngineV1>this._physicsEngine).getImpostors().length === 0) {\r\n return null;\r\n }\r\n\r\n if (this._physicsEngine.getPluginVersion() === 2 && (<PhysicsEngineV2>this._physicsEngine).getBodies().length === 0) {\r\n return null;\r\n }\r\n\r\n let useCallback = false;\r\n if (typeof radiusOrEventOptions === \"number\") {\r\n const r = radiusOrEventOptions;\r\n radiusOrEventOptions = new PhysicsRadialExplosionEventOptions();\r\n radiusOrEventOptions.radius = r;\r\n radiusOrEventOptions.strength = strength ?? radiusOrEventOptions.strength;\r\n radiusOrEventOptions.falloff = falloff ?? radiusOrEventOptions.falloff;\r\n } else {\r\n useCallback = !!(radiusOrEventOptions.affectedImpostorsCallback || radiusOrEventOptions.affectedBodiesCallback);\r\n }\r\n\r\n const event = new PhysicsRadialExplosionEvent(this._scene, radiusOrEventOptions);\r\n\r\n const hitData = this._hitData;\r\n if (this._physicsEngine.getPluginVersion() === 1) {\r\n const affectedImpostorsWithData = Array<PhysicsAffectedImpostorWithData>();\r\n const impostors = (<PhysicsEngineV1>this._physicsEngine).getImpostors();\r\n impostors.forEach((impostor: PhysicsImpostor) => {\r\n if (!event.getImpostorHitData(impostor, origin, hitData)) {\r\n return;\r\n }\r\n\r\n impostor.applyImpulse(hitData.force, hitData.contactPoint);\r\n\r\n if (useCallback) {\r\n affectedImpostorsWithData.push({\r\n impostor: impostor,\r\n hitData: this._copyPhysicsHitData(hitData),\r\n });\r\n }\r\n });\r\n\r\n event.triggerAffectedImpostorsCallback(affectedImpostorsWithData);\r\n } else {\r\n const affectedBodiesWithData = Array<PhysicsAffectedBodyWithData>();\r\n const bodies = (<PhysicsEngineV2>this._physicsEngine).getBodies();\r\n bodies.forEach((body: PhysicsBody) => {\r\n if (!event.getBodyHitData(body, origin, hitData)) {\r\n return;\r\n }\r\n\r\n body.applyImpulse(hitData.force, hitData.contactPoint);\r\n\r\n if (useCallback) {\r\n affectedBodiesWithData.push({\r\n body: body,\r\n hitData: this._copyPhysicsHitData(hitData),\r\n });\r\n }\r\n });\r\n\r\n event.triggerAffectedBodiesCallback(affectedBodiesWithData);\r\n }\r\n\r\n event.dispose(false);\r\n\r\n return event;\r\n }\r\n\r\n /**\r\n * Applies a radial explosion force\r\n * @param origin the origin of the explosion\r\n * @param radiusOrEventOptions the radius or the options of radial explosion\r\n * @param strength the explosion strength\r\n * @param falloff possible options: Constant & Linear. Defaults to Constant\r\n * @returns A physics radial explosion event, or null\r\n */\r\n public applyRadialExplosionForce(\r\n origin: Vector3,\r\n radiusOrEventOptions: number | PhysicsRadialExplosionEventOptions,\r\n strength?: number,\r\n falloff?: PhysicsRadialImpulseFalloff\r\n ): Nullable<PhysicsRadialExplosionEvent> {\r\n if (!this._physicsEngine) {\r\n Logger.Warn(\"Physics engine not enabled. Please enable the physics before you call the PhysicsHelper.\");\r\n return null;\r\n }\r\n\r\n if (this._physicsEngine.getPluginVersion() === 1 && (<PhysicsEngineV1>this._physicsEngine).getImpostors().length === 0) {\r\n return null;\r\n }\r\n\r\n if (this._physicsEngine.getPluginVersion() === 2 && (<PhysicsEngineV2>this._physicsEngine).getBodies().length === 0) {\r\n return null;\r\n }\r\n\r\n let useCallback = false;\r\n if (typeof radiusOrEventOptions === \"number\") {\r\n const r = radiusOrEventOptions;\r\n radiusOrEventOptions = new PhysicsRadialExplosionEventOptions();\r\n radiusOrEventOptions.radius = r;\r\n radiusOrEventOptions.strength = strength ?? radiusOrEventOptions.strength;\r\n radiusOrEventOptions.falloff = falloff ?? radiusOrEventOptions.falloff;\r\n } else {\r\n useCallback = !!(radiusOrEventOptions.affectedImpostorsCallback || radiusOrEventOptions.affectedBodiesCallback);\r\n }\r\n\r\n const event = new PhysicsRadialExplosionEvent(this._scene, radiusOrEventOptions);\r\n\r\n const hitData = this._hitData;\r\n if (this._physicsEngine.getPluginVersion() === 1) {\r\n const affectedImpostorsWithData = Array<PhysicsAffectedImpostorWithData>();\r\n const impostors = (<PhysicsEngineV1>this._physicsEngine).getImpostors();\r\n impostors.forEach((impostor: PhysicsImpostor) => {\r\n if (!event.getImpostorHitData(impostor, origin, hitData)) {\r\n return;\r\n }\r\n\r\n impostor.applyForce(hitData.force, hitData.contactPoint);\r\n\r\n if (useCallback) {\r\n affectedImpostorsWithData.push({\r\n impostor: impostor,\r\n hitData: this._copyPhysicsHitData(hitData),\r\n });\r\n }\r\n });\r\n\r\n event.triggerAffectedImpostorsCallback(affectedImpostorsWithData);\r\n } else {\r\n const affectedBodiesWithData = Array<PhysicsAffectedBodyWithData>();\r\n const bodies = (<PhysicsEngineV2>this._physicsEngine).getBodies();\r\n bodies.forEach((body: PhysicsBody) => {\r\n if (!event.getBodyHitData(body, origin, hitData)) {\r\n return;\r\n }\r\n\r\n body.applyForce(hitData.force, hitData.contactPoint);\r\n\r\n if (useCallback) {\r\n affectedBodiesWithData.push({\r\n body: body,\r\n hitData: this._copyPhysicsHitData(hitData),\r\n });\r\n }\r\n });\r\n\r\n event.triggerAffectedBodiesCallback(affectedBodiesWithData);\r\n }\r\n\r\n event.dispose(false);\r\n\r\n return event;\r\n }\r\n\r\n /**\r\n * Creates a gravitational field\r\n * @param origin the origin of the gravitational field\r\n * @param radiusOrEventOptions the radius or the options of radial gravitational field\r\n * @param strength the gravitational field strength\r\n * @param falloff possible options: Constant & Linear. Defaults to Constant\r\n * @returns A physics gravitational field event, or null\r\n */\r\n public gravitationalField(\r\n origin: Vector3,\r\n radiusOrEventOptions: number | PhysicsRadialExplosionEventOptions,\r\n strength?: number,\r\n falloff?: PhysicsRadialImpulseFalloff\r\n ): Nullable<PhysicsGravitationalFieldEvent> {\r\n if (!this._physicsEngine) {\r\n Logger.Warn(\"Physics engine not enabled. Please enable the physics before you call the PhysicsHelper.\");\r\n return null;\r\n }\r\n\r\n if (this._physicsEngine.getPluginVersion() === 1 && (<PhysicsEngineV1>this._physicsEngine).getImpostors().length === 0) {\r\n return null;\r\n }\r\n\r\n if (this._physicsEngine.getPluginVersion() === 2 && (<PhysicsEngineV2>this._physicsEngine).getBodies().length === 0) {\r\n return null;\r\n }\r\n\r\n if (typeof radiusOrEventOptions === \"number\") {\r\n const r = radiusOrEventOptions;\r\n radiusOrEventOptions = new PhysicsRadialExplosionEventOptions();\r\n radiusOrEventOptions.radius = r;\r\n radiusOrEventOptions.strength = strength ?? radiusOrEventOptions.strength;\r\n radiusOrEventOptions.falloff = falloff ?? radiusOrEventOptions.falloff;\r\n }\r\n\r\n const event = new PhysicsGravitationalFieldEvent(this, this._scene, origin, radiusOrEventOptions);\r\n\r\n event.dispose(false);\r\n\r\n return event;\r\n }\r\n\r\n /**\r\n * Creates a physics updraft event\r\n * @param origin the origin of the updraft\r\n * @param radiusOrEventOptions the radius or the options of the updraft\r\n * @param strength the strength of the updraft\r\n * @param height the height of the updraft\r\n * @param updraftMode possible options: Center & Perpendicular. Defaults to Center\r\n * @returns A physics updraft event, or null\r\n */\r\n public updraft(\r\n origin: Vector3,\r\n radiusOrEventOptions: number | PhysicsUpdraftEventOptions,\r\n strength?: number,\r\n height?: number,\r\n updraftMode?: PhysicsUpdraftMode\r\n ): Nullable<PhysicsUpdraftEvent> {\r\n if (!this._physicsEngine) {\r\n Logger.Warn(\"Physics engine not enabled. Please enable the physics before you call the PhysicsHelper.\");\r\n return null;\r\n }\r\n\r\n if (this._physicsEngine.getPluginVersion() === 1 && (<PhysicsEngineV1>this._physicsEngine).getImpostors().length === 0) {\r\n return null;\r\n }\r\n\r\n if (this._physicsEngine.getPluginVersion() === 2 && (<PhysicsEngineV2>this._physicsEngine).getBodies().length === 0) {\r\n return null;\r\n }\r\n\r\n if (typeof radiusOrEventOptions === \"number\") {\r\n const r = radiusOrEventOptions;\r\n radiusOrEventOptions = new PhysicsUpdraftEventOptions();\r\n radiusOrEventOptions.radius = r;\r\n radiusOrEventOptions.strength = strength ?? radiusOrEventOptions.strength;\r\n radiusOrEventOptions.height = height ?? radiusOrEventOptions.height;\r\n radiusOrEventOptions.updraftMode = updraftMode ?? radiusOrEventOptions.updraftMode;\r\n }\r\n\r\n const event = new PhysicsUpdraftEvent(this._scene, origin, radiusOrEventOptions);\r\n\r\n event.dispose(false);\r\n\r\n return event;\r\n }\r\n\r\n /**\r\n * Creates a physics vortex event\r\n * @param origin the of the vortex\r\n * @param radiusOrEventOptions the radius or the options of the vortex\r\n * @param strength the strength of the vortex\r\n * @param height the height of the vortex\r\n * @returns a Physics vortex event, or null\r\n * A physics vortex event or null\r\n */\r\n public vortex(origin: Vector3, radiusOrEventOptions: number | PhysicsVortexEventOptions, strength?: number, height?: number): Nullable<PhysicsVortexEvent> {\r\n if (!this._physicsEngine) {\r\n Logger.Warn(\"Physics engine not enabled. Please enable the physics before you call the PhysicsHelper.\");\r\n return null;\r\n }\r\n\r\n if (this._physicsEngine.getPluginVersion() === 1 && (<PhysicsEngineV1>this._physicsEngine).getImpostors().length === 0) {\r\n return null;\r\n }\r\n\r\n if (this._physicsEngine.getPluginVersion() === 2 && (<PhysicsEngineV2>this._physicsEngine).getBodies().length === 0) {\r\n return null;\r\n }\r\n\r\n if (typeof radiusOrEventOptions === \"number\") {\r\n const r = radiusOrEventOptions;\r\n radiusOrEventOptions = new PhysicsVortexEventOptions();\r\n radiusOrEventOptions.radius = r;\r\n radiusOrEventOptions.strength = strength ?? radiusOrEventOptions.strength;\r\n radiusOrEventOptions.height = height ?? radiusOrEventOptions.height;\r\n }\r\n\r\n const event = new PhysicsVortexEvent(this._scene, origin, radiusOrEventOptions);\r\n\r\n event.dispose(false);\r\n\r\n return event;\r\n }\r\n\r\n private _copyPhysicsHitData(data: PhysicsHitData): PhysicsHitData {\r\n return { force: data.force.clone(), contactPoint: data.contactPoint.clone(), distanceFromOrigin: data.distanceFromOrigin };\r\n }\r\n}\r\n\r\n/**\r\n * Represents a physics radial explosion event\r\n */\r\nclass PhysicsRadialExplosionEvent {\r\n private _sphere: Mesh; // create a sphere, so we can get the intersecting meshes inside\r\n private _dataFetched: boolean = false; // check if the data has been fetched. If not, do cleanup\r\n\r\n /**\r\n * Initializes a radial explosion event\r\n * @param _scene BabylonJS scene\r\n * @param _options The options for the vortex event\r\n */\r\n constructor(private _scene: Scene, private _options: PhysicsRadialExplosionEventOptions) {\r\n this._options = { ...new PhysicsRadialExplosionEventOptions(), ...this._options };\r\n }\r\n\r\n /**\r\n * Returns the data related to the radial explosion event (sphere).\r\n * @returns The radial explosion event data\r\n */\r\n public getData(): PhysicsRadialExplosionEventData {\r\n this._dataFetched = true;\r\n\r\n return {\r\n sphere: this._sphere,\r\n };\r\n }\r\n\r\n private _getHitData(mesh: AbstractMesh, center: Vector3, origin: Vector3, data: PhysicsHitData): boolean {\r\n const direction = center.subtract(origin);\r\n\r\n const ray = new Ray(origin, direction, this._options.radius);\r\n const hit = ray.intersectsMesh(mesh);\r\n\r\n const contactPoint = hit.pickedPoint;\r\n if (!contactPoint) {\r\n return false;\r\n }\r\n\r\n const distanceFromOrigin = Vector3.Distance(origin, contactPoint);\r\n\r\n if (distanceFromOrigin > this._options.radius) {\r\n return false;\r\n }\r\n\r\n const multiplier =\r\n this._options.falloff === PhysicsRadialImpulseFalloff.Constant ? this._options.strength : this._options.strength * (1 - distanceFromOrigin / this._options.radius);\r\n\r\n const force = direction.multiplyByFloats(multiplier, multiplier, multiplier);\r\n\r\n data.force = force;\r\n data.contactPoint = contactPoint;\r\n data.distanceFromOrigin = distanceFromOrigin;\r\n return true;\r\n }\r\n\r\n /**\r\n * Returns the force and contact point of the body or false, if the body is not affected by the force/impulse.\r\n * @param body A physics body\r\n * @param origin the origin of the explosion\r\n * @returns A physics force and contact point, or null\r\n */\r\n public getBodyHitData(body: PhysicsBody, origin: Vector3, data: PhysicsHitData): boolean {\r\n if (body.transformNode.getClassName() !== \"Mesh\" && body.transformNode.getClassName() !== \"InstancedMesh\") {\r\n return false;\r\n }\r\n\r\n const mesh = body.transformNode as AbstractMesh;\r\n if (!this._intersectsWithSphere(mesh, origin, this._options.radius)) {\r\n return false;\r\n }\r\n\r\n const bodyObjectCenter = body.getObjectCenter();\r\n this._getHitData(mesh, bodyObjectCenter, origin, data);\r\n return true;\r\n }\r\n /**\r\n * Returns the force and contact point of the impostor or false, if the impostor is not affected by the force/impulse.\r\n * @param impostor A physics imposter\r\n * @param origin the origin of the explosion\r\n * @returns A physics force and contact point, or null\r\n */\r\n public getImpostorHitData(impostor: PhysicsImpostor, origin: Vector3, data: PhysicsHitData): boolean {\r\n if (impostor.mass === 0) {\r\n return false;\r\n }\r\n\r\n if (impostor.object.getClassName() !== \"Mesh\" && impostor.object.getClassName() !== \"InstancedMesh\") {\r\n return false;\r\n }\r\n\r\n const mesh = impostor.object as AbstractMesh;\r\n if (!this._intersectsWithSphere(mesh, origin, this._options.radius)) {\r\n return false;\r\n }\r\n\r\n const impostorObjectCenter = impostor.getObjectCenter();\r\n\r\n this._getHitData(mesh, impostorObjectCenter, origin, data);\r\n return true;\r\n }\r\n\r\n /**\r\n * Triggers affected impostors callbacks\r\n * @param affectedImpostorsWithData defines the list of affected impostors (including associated data)\r\n */\r\n public triggerAffectedImpostorsCallback(affectedImpostorsWithData: Array<PhysicsAffectedImpostorWithData>) {\r\n if (this._options.affectedImpostorsCallback) {\r\n this._options.affectedImpostorsCallback(affectedImpostorsWithData);\r\n }\r\n }\r\n\r\n /**\r\n * Triggers affected bodies callbacks\r\n * @param affectedBodiesWithData defines the list of affected bodies (including associated data)\r\n */\r\n public triggerAffectedBodiesCallback(affectedBodiesWithData: Array<PhysicsAffectedBodyWithData>) {\r\n if (this._options.affectedBodiesCallback) {\r\n this._options.affectedBodiesCallback(affectedBodiesWithData);\r\n }\r\n }\r\n /**\r\n * Disposes the sphere.\r\n * @param force Specifies if the sphere should be disposed by force\r\n */\r\n public dispose(force: boolean = true) {\r\n if (force) {\r\n this._sphere.dispose();\r\n } else {\r\n setTimeout(() => {\r\n if (!this._dataFetched) {\r\n this._sphere.dispose();\r\n }\r\n }, 0);\r\n }\r\n }\r\n\r\n /*** Helpers ***/\r\n\r\n private _prepareSphere(): void {\r\n if (!this._sphere) {\r\n this._sphere = CreateSphere(\"radialExplosionEventSphere\", this._options.sphere, this._scene);\r\n this._sphere.isVisible = false;\r\n }\r\n }\r\n\r\n private _intersectsWithSphere(mesh: AbstractMesh, origin: Vector3, radius: number): boolean {\r\n this._prepareSphere();\r\n\r\n this._sphere.position = origin;\r\n this._sphere.scaling.setAll(radius * 2);\r\n this._sphere._updateBoundingInfo();\r\n this._sphere.computeWorldMatrix(true);\r\n\r\n return this._sphere.intersectsMesh(mesh, true);\r\n }\r\n}\r\n\r\n/**\r\n * Represents a gravitational field event\r\n */\r\nclass PhysicsGravitationalFieldEvent {\r\n private _tickCallback: any;\r\n private _sphere: Mesh;\r\n private _dataFetched: boolean = false; // check if the has been fetched the data. If not, do cleanup\r\n\r\n /**\r\n * Initializes the physics gravitational field event\r\n * @param _physicsHelper A physics helper\r\n * @param _scene BabylonJS scene\r\n * @param _origin The origin position of the gravitational field event\r\n * @param _options The options for the vortex event\r\n */\r\n constructor(private _physicsHelper: PhysicsHelper, private _scene: Scene, private _origin: Vector3, private _options: PhysicsRadialExplosionEventOptions) {\r\n this._options = { ...new PhysicsRadialExplosionEventOptions(), ...this._options };\r\n\r\n this._tickCallback = this._tick.bind(this);\r\n\r\n this._options.strength = this._options.strength * -1;\r\n }\r\n\r\n /**\r\n * Returns the data related to the gravitational field event (sphere).\r\n * @returns A gravitational field event\r\n */\r\n public getData(): PhysicsGravitationalFieldEventData {\r\n this._dataFetched = true;\r\n\r\n return {\r\n sphere: this._sphere,\r\n };\r\n }\r\n\r\n /**\r\n * Enables the gravitational field.\r\n */\r\n public enable() {\r\n this._tickCallback.call(this);\r\n this._scene.registerBeforeRender(this._tickCallback);\r\n }\r\n\r\n /**\r\n * Disables the gravitational field.\r\n */\r\n public disable() {\r\n this._scene.unregisterBeforeRender(this._tickCallback);\r\n }\r\n\r\n /**\r\n * Disposes the sphere.\r\n * @param force The force to dispose from the gravitational field event\r\n */\r\n public dispose(force: boolean = true) {\r\n if (force) {\r\n this._sphere.dispose();\r\n } else {\r\n setTimeout(() => {\r\n if (!this._dataFetched) {\r\n this._sphere.dispose();\r\n }\r\n }, 0);\r\n }\r\n }\r\n\r\n private _tick() {\r\n // Since the params won't change, we fetch the event only once\r\n if (this._sphere) {\r\n this._physicsHelper.applyRadialExplosionForce(this._origin, this._options);\r\n } else {\r\n const radialExplosionEvent = this._physicsHelper.applyRadialExplosionForce(this._origin, this._options);\r\n if (radialExplosionEvent) {\r\n this._sphere = <Mesh>radialExplosionEvent.getData().sphere.clone(\"radialExplosionEventSphereClone\");\r\n }\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Represents a physics updraft event\r\n */\r\nclass PhysicsUpdraftEvent {\r\n private _physicsEngine: PhysicsEngineV1 | PhysicsEngineV2;\r\n private _originTop: Vector3 = Vector3.Zero(); // the most upper part of the cylinder\r\n private _originDirection: Vector3 = Vector3.Zero(); // used if the updraftMode is perpendicular\r\n private _tickCallback: any;\r\n private _cylinder: Mesh;\r\n private _cylinderPosition: Vector3 = Vector3.Zero(); // to keep the cylinders position, because normally the origin is in the center and not on the bottom\r\n private _dataFetched: boolean = false; // check if the has been fetched the data. If not, do cleanup\r\n private static hitData: PhysicsHitData = { force: new Vector3(), contactPoint: new Vector3(), distanceFromOrigin: 0 };\r\n /**\r\n * Initializes the physics updraft event\r\n * @param _scene BabylonJS scene\r\n * @param _origin The origin position of the updraft\r\n * @param _options The options for the updraft event\r\n */\r\n constructor(private _scene: Scene, private _origin: Vector3, private _options: PhysicsUpdraftEventOptions) {\r\n this._physicsEngine = this._scene.getPhysicsEngine() as PhysicsEngineV1 | PhysicsEngineV2;\r\n this._options = { ...new PhysicsUpdraftEventOptions(), ...this._options };\r\n\r\n this._origin.addToRef(new Vector3(0, this._options.height / 2, 0), this._cylinderPosition);\r\n this._origin.addToRef(new Vector3(0, this._options.height, 0), this._originTop);\r\n\r\n if (this._options.updraftMode === PhysicsUpdraftMode.Perpendicular) {\r\n this._originDirection = this._origin.subtract(this._originTop).normalize();\r\n }\r\n\r\n this._tickCallback = this._tick.bind(this);\r\n\r\n this._prepareCylinder();\r\n }\r\n\r\n /**\r\n * Returns the data related to the updraft event (cylinder).\r\n * @returns A physics updraft event\r\n */\r\n public getData(): PhysicsUpdraftEventData {\r\n this._dataFetched = true;\r\n\r\n return {\r\n cylinder: this._cylinder,\r\n };\r\n }\r\n\r\n /**\r\n * Enables the updraft.\r\n */\r\n public enable() {\r\n this._tickCallback.call(this);\r\n this._scene.registerBeforeRender(this._tickCallback);\r\n }\r\n\r\n /**\r\n * Disables the updraft.\r\n */\r\n public disable() {\r\n this._scene.unregisterBeforeRender(this._tickCallback);\r\n }\r\n\r\n /**\r\n * Disposes the cylinder.\r\n * @param force Specifies if the updraft should be disposed by force\r\n */\r\n public dispose(force: boolean = true) {\r\n if (!this._cylinder) {\r\n return;\r\n }\r\n if (force) {\r\n this._cylinder.dispose();\r\n } else {\r\n setTimeout(() => {\r\n if (!this._dataFetched) {\r\n this._cylinder.dispose();\r\n }\r\n }, 0);\r\n }\r\n }\r\n\r\n private _getHitData(center: Vector3, data: PhysicsHitData): void {\r\n let direction: Vector3;\r\n if (this._options.updraftMode === PhysicsUpdraftMode.Perpendicular) {\r\n direction = this._originDirection;\r\n } else {\r\n direction = center.subtract(this._originTop);\r\n }\r\n\r\n const distanceFromOrigin = Vector3.Distance(this._origin, center);\r\n\r\n const multiplier = this._options.strength * -1;\r\n\r\n const force = direction.multiplyByFloats(multiplier, multiplier, multiplier);\r\n\r\n data.force = force;\r\n data.contactPoint = center;\r\n data.distanceFromOrigin = distanceFromOrigin;\r\n }\r\n\r\n private _getBodyHitData(body: PhysicsBody, data: PhysicsHitData): boolean {\r\n if (body.transformNode.getClassName() !== \"Mesh\" && body.transformNode.getClassName() !== \"InstancedMesh\") {\r\n return false;\r\n }\r\n const bodyObject = body.transformNode as AbstractMesh;\r\n if (!this._intersectsWithCylinder(bodyObject)) {\r\n return false;\r\n }\r\n\r\n const center = body.getObjectCenter();\r\n this._getHitData(center, data);\r\n return true;\r\n }\r\n\r\n private _getImpostorHitData(impostor: PhysicsImpostor, data: PhysicsHitData): boolean {\r\n if (impostor.mass === 0) {\r\n return false;\r\n }\r\n\r\n const impostorObject = <AbstractMesh>impostor.object;\r\n if (!this._intersectsWithCylinder(impostorObject)) {\r\n return false;\r\n }\r\n\r\n const center = impostor.getObjectCenter();\r\n this._getHitData(center, data);\r\n return true;\r\n }\r\n\r\n private _tick() {\r\n const hitData = PhysicsUpdraftEvent.hitData;\r\n if (this._physicsEngine.getPluginVersion() === 1) {\r\n (<PhysicsEngineV1>this._physicsEngine).getImpostors().forEach((impostor: PhysicsImpostor) => {\r\n if (!this._getImpostorHitData(impostor, hitData)) {\r\n return;\r\n }\r\n\r\n impostor.applyForce(hitData.force, hitData.contactPoint);\r\n });\r\n } else {\r\n // V2\r\n (<PhysicsEngineV2>this._physicsEngine).getBodies().forEach((body: PhysicsBody) => {\r\n if (!this._getBodyHitData(body, hitData)) {\r\n return;\r\n }\r\n\r\n body.applyForce(hitData.force, hitData.contactPoint);\r\n });\r\n }\r\n }\r\n\r\n /*** Helpers ***/\r\n\r\n private _prepareCylinder(): void {\r\n if (!this._cylinder) {\r\n this._cylinder = CreateCylinder(\r\n \"updraftEventCylinder\",\r\n {\r\n height: this._options.height,\r\n diameter: this._options.radius * 2,\r\n },\r\n this._scene\r\n );\r\n this._cylinder.isVisible = false;\r\n }\r\n }\r\n\r\n private _intersectsWithCylinder(mesh: AbstractMesh): boolean {\r\n this._cylinder.position = this._cylinderPosition;\r\n return this._cylinder.intersectsMesh(mesh, true);\r\n }\r\n}\r\n\r\n/**\r\n * Represents a physics vortex event\r\n */\r\nclass PhysicsVortexEvent {\r\n private _physicsEngine: PhysicsEngineV1 | PhysicsEngineV2;\r\n private _originTop: Vector3 = Vector3.Zero(); // the most upper part of the cylinder\r\n private _tickCallback: any;\r\n private _cylinder: Mesh;\r\n private _cylinderPosition: Vector3 = Vector3.Zero(); // to keep the cylinders position, because normally the origin is in the center and not on the bottom\r\n private _dataFetched: boolean = false; // check if the has been fetched the data. If not, do cleanup\r\n private static originOnPlane: Vector3 = Vector3.Zero();\r\n private static hitData: PhysicsHitData = { force: new Vector3(), contactPoint: new Vector3(), distanceFromOrigin: 0 };\r\n\r\n /**\r\n * Initializes the physics vortex event\r\n * @param _scene The BabylonJS scene\r\n * @param _origin The origin position of the vortex\r\n * @param _options The options for the vortex event\r\n */\r\n constructor(private _scene: Scene, private _origin: Vector3, private _options: PhysicsVortexEventOptions) {\r\n this._physicsEngine = this._scene.getPhysicsEngine() as PhysicsEngineV1 | PhysicsEngineV2;\r\n this._options = { ...new PhysicsVortexEventOptions(), ...this._options };\r\n\r\n this._origin.addToRef(new Vector3(0, this._options.height / 2, 0), this._cylinderPosition);\r\n this._origin.addToRef(new Vector3(0, this._options.height, 0), this._originTop);\r\n\r\n this._tickCallback = this._tick.bind(this);\r\n\r\n this._prepareCylinder();\r\n }\r\n\r\n /**\r\n * Returns the data related to the vortex event (cylinder).\r\n * @returns The physics vortex event data\r\n */\r\n public getData(): PhysicsVortexEventData {\r\n this._dataFetched = true;\r\n\r\n return {\r\n cylinder: this._cylinder,\r\n };\r\n }\r\n\r\n /**\r\n * Enables the vortex.\r\n */\r\n public enable() {\r\n this._tickCallback.call(this);\r\n this._scene.registerBeforeRender(this._tickCallback);\r\n }\r\n\r\n /**\r\n * Disables the cortex.\r\n */\r\n public disable() {\r\n this._scene.unregisterBeforeRender(this._tickCallback);\r\n }\r\n\r\n /**\r\n * Disposes the sphere.\r\n * @param force\r\n */\r\n public dispose(force: boolean = true) {\r\n if (force) {\r\n this._cylinder.dispose();\r\n } else {\r\n setTimeout(() => {\r\n if (!this._dataFetched) {\r\n this._cylinder.dispose();\r\n }\r\n }, 0);\r\n }\r\n }\r\n\r\n private _getHitData(mesh: AbstractMesh, center: Vector3, data: PhysicsHitData): boolean {\r\n const originOnPlane = PhysicsVortexEvent.originOnPlane;\r\n originOnPlane.set(this._origin.x, center.y, this._origin.z); // the distance to the origin as if both objects were on a plane (Y-axis)\r\n const originToImpostorDirection = center.subtract(originOnPlane);\r\n\r\n const ray = new Ray(originOnPlane, originToImpostorDirection, this._options.radius);\r\n const hit = ray.intersectsMesh(mesh);\r\n const contactPoint = hit.pickedPoint;\r\n if (!contactPoint) {\r\n return false;\r\n }\r\n const absoluteDistanceFromOrigin = hit.distance / this._options.radius;\r\n\r\n let directionToOrigin = contactPoint.normalize();\r\n if (absoluteDistanceFromOrigin > this._options.centripetalForceThreshold) {\r\n directionToOrigin = directionToOrigin.negate();\r\n }\r\n\r\n let forceX: number;\r\n let forceY: number;\r\n let forceZ: number;\r\n\r\n if (absoluteDistanceFromOrigin > this._options.centripetalForceThreshold) {\r\n forceX = directionToOrigin.x * this._options.centripetalForceMultiplier;\r\n forceY = directionToOrigin.y * this._options.updraftForceMultiplier;\r\n forceZ = directionToOrigin.z * this._options.centripetalForceMultiplier;\r\n } else {\r\n const perpendicularDirection = Vector3.Cross(originOnPlane, center).normalize();\r\n\r\n forceX = (perpendicularDirection.x + directionToOrigin.x) * this._options.centrifugalForceMultiplier;\r\n forceY = this._originTop.y * this._options.updraftForceMultiplier;\r\n forceZ = (perpendicularDirection.z + directionToOrigin.z) * this._options.centrifugalForceMultiplier;\r\n }\r\n\r\n let force = new Vector3(forceX, forceY, forceZ);\r\n force = force.multiplyByFloats(this._options.strength, this._options.strength, this._options.strength);\r\n\r\n data.force = force;\r\n data.contactPoint = center;\r\n data.distanceFromOrigin = absoluteDistanceFromOrigin;\r\n return true;\r\n }\r\n\r\n private _getBodyHitData(body: PhysicsBody, data: PhysicsHitData): boolean {\r\n if (body.transformNode.getClassName() !== \"Mesh\" && body.transformNode.getClassName() !== \"InstancedMesh\") {\r\n return false;\r\n }\r\n\r\n const bodyObject = body.transformNode as AbstractMesh;\r\n\r\n if (!this._intersectsWithCylinder(bodyObject)) {\r\n return false;\r\n }\r\n\r\n const bodyCenter = body.getObjectCenter();\r\n this._getHitData(bodyObject, bodyCenter, data);\r\n return true;\r\n }\r\n\r\n private _getImpostorHitData(impostor: PhysicsImpostor, data: PhysicsHitData): boolean {\r\n if (impostor.mass === 0) {\r\n return false;\r\n }\r\n\r\n if (impostor.object.getClassName() !== \"Mesh\" && impostor.object.getClassName() !== \"InstancedMesh\") {\r\n return false;\r\n }\r\n\r\n const impostorObject = impostor.object as AbstractMesh;\r\n if (!this._intersectsWithCylinder(impostorObject)) {\r\n return false;\r\n }\r\n\r\n const impostorObjectCenter = impostor.getObjectCenter();\r\n this._getHitData(impostorObject, impostorObjectCenter, data);\r\n return true;\r\n }\r\n\r\n private _tick() {\r\n const hitData = PhysicsVortexEvent.hitData;\r\n if (this._physicsEngine.getPluginVersion() === 1) {\r\n (<PhysicsEngineV1>this._physicsEngine).getImpostors().forEach((impostor: PhysicsImpostor) => {\r\n if (!this._getImpostorHitData(impostor, hitData)) {\r\n return;\r\n }\r\n\r\n impostor.applyForce(hitData.force, hitData.contactPoint);\r\n });\r\n } else {\r\n (<PhysicsEngineV2>this._physicsEngine).getBodies().forEach((body: PhysicsBody) => {\r\n if (!this._getBodyHitData(body, hitData)) {\r\n return;\r\n }\r\n\r\n body.applyForce(hitData.force, hitData.contactPoint);\r\n });\r\n }\r\n }\r\n\r\n /*** Helpers ***/\r\n\r\n private _prepareCylinder(): void {\r\n if (!this._cylinder) {\r\n this._cylinder = CreateCylinder(\r\n \"vortexEventCylinder\",\r\n {\r\n height: this._options.height,\r\n diameter: this._options.radius * 2,\r\n },\r\n this._scene\r\n );\r\n this._cylinder.isVisible = false;\r\n }\r\n }\r\n\r\n private _intersectsWithCylinder(mesh: AbstractMesh): boolean {\r\n this._cylinder.position = this._cylinderPosition;\r\n\r\n return this._cylinder.intersectsMesh(mesh, true);\r\n }\r\n}\r\n\r\n/**\r\n * Options fot the radial explosion event\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class\r\n */\r\nexport class PhysicsRadialExplosionEventOptions {\r\n /**\r\n * The radius of the sphere for the radial explosion.\r\n */\r\n radius: number = 5;\r\n\r\n /**\r\n * The strength of the explosion.\r\n */\r\n strength: number = 10;\r\n\r\n /**\r\n * The strength of the force in correspondence to the distance of the affected object\r\n */\r\n falloff: PhysicsRadialImpulseFalloff = PhysicsRadialImpulseFalloff.Constant;\r\n\r\n /**\r\n * Sphere options for the radial explosion.\r\n */\r\n sphere: { segments: number; diameter: number } = { segments: 32, diameter: 1 };\r\n\r\n /**\r\n * Sphere options for the radial explosion.\r\n */\r\n affectedImpostorsCallback: (affectedImpostorsWithData: Array<PhysicsAffectedImpostorWithData>) => void;\r\n\r\n /**\r\n * Sphere options for the radial explosion.\r\n */\r\n affectedBodiesCallback: (affectedBodiesWithData: Array<PhysicsAffectedBodyWithData>) => void;\r\n}\r\n\r\n/**\r\n * Options fot the updraft event\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class\r\n */\r\nexport class PhysicsUpdraftEventOptions {\r\n /**\r\n * The radius of the cylinder for the vortex\r\n */\r\n radius: number = 5;\r\n\r\n /**\r\n * The strength of the updraft.\r\n */\r\n strength: number = 10;\r\n\r\n /**\r\n * The height of the cylinder for the updraft.\r\n */\r\n height: number = 10;\r\n\r\n /**\r\n * The mode for the the updraft.\r\n */\r\n updraftMode: PhysicsUpdraftMode = PhysicsUpdraftMode.Center;\r\n}\r\n\r\n/**\r\n * Options fot the vortex event\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class\r\n */\r\nexport class PhysicsVortexEventOptions {\r\n /**\r\n * The radius of the cylinder for the vortex\r\n */\r\n radius: number = 5;\r\n\r\n /**\r\n * The strength of the vortex.\r\n */\r\n strength: number = 10;\r\n\r\n /**\r\n * The height of the cylinder for the vortex.\r\n */\r\n height: number = 10;\r\n\r\n /**\r\n * At which distance, relative to the radius the centripetal forces should kick in? Range: 0-1\r\n */\r\n centripetalForceThreshold: number = 0.7;\r\n\r\n /**\r\n * This multiplier determines with how much force the objects will be pushed sideways/around the vortex, when below the threshold.\r\n */\r\n centripetalForceMultiplier: number = 5;\r\n\r\n /**\r\n * This multiplier determines with how much force the objects will be pushed sideways/around the vortex, when above the threshold.\r\n */\r\n centrifugalForceMultiplier: number = 0.5;\r\n\r\n /**\r\n * This multiplier determines with how much force the objects will be pushed upwards, when in the vortex.\r\n */\r\n updraftForceMultiplier: number = 0.02;\r\n}\r\n\r\n/**\r\n * The strength of the force in correspondence to the distance of the affected object\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class\r\n */\r\nexport enum PhysicsRadialImpulseFalloff {\r\n /** Defines that impulse is constant in strength across it's whole radius */\r\n Constant,\r\n /** Defines that impulse gets weaker if it's further from the origin */\r\n Linear,\r\n}\r\n\r\n/**\r\n * The strength of the force in correspondence to the distance of the affected object\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class\r\n */\r\nexport enum PhysicsUpdraftMode {\r\n /** Defines that the upstream forces will pull towards the top center of the cylinder */\r\n Center,\r\n /** Defines that once a impostor is inside the cylinder, it will shoot out perpendicular from the ground of the cylinder */\r\n Perpendicular,\r\n}\r\n\r\n/**\r\n * Interface for a physics hit data\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class\r\n */\r\nexport interface PhysicsHitData {\r\n /**\r\n * The force applied at the contact point\r\n */\r\n force: Vector3;\r\n /**\r\n * The contact point\r\n */\r\n contactPoint: Vector3;\r\n /**\r\n * The distance from the origin to the contact point\r\n */\r\n distanceFromOrigin: number;\r\n}\r\n\r\n/**\r\n * Interface for radial explosion event data\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class\r\n */\r\nexport interface PhysicsRadialExplosionEventData {\r\n /**\r\n * A sphere used for the radial explosion event\r\n */\r\n sphere: Mesh;\r\n}\r\n\r\n/**\r\n * Interface for gravitational field event data\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class\r\n */\r\nexport interface PhysicsGravitationalFieldEventData {\r\n /**\r\n * A sphere mesh used for the gravitational field event\r\n */\r\n sphere: Mesh;\r\n}\r\n\r\n/**\r\n * Interface for updraft event data\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class\r\n */\r\nexport interface PhysicsUpdraftEventData {\r\n /**\r\n * A cylinder used for the updraft event\r\n */\r\n cylinder: Mesh;\r\n}\r\n\r\n/**\r\n * Interface for vortex event data\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class\r\n */\r\nexport interface PhysicsVortexEventData {\r\n /**\r\n * A cylinder used for the vortex event\r\n */\r\n cylinder: Mesh;\r\n}\r\n\r\n/**\r\n * Interface for an affected physics impostor\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class\r\n */\r\nexport interface PhysicsAffectedImpostorWithData {\r\n /**\r\n * The impostor affected by the effect\r\n */\r\n impostor: PhysicsImpostor;\r\n\r\n /**\r\n * The data about the hit/force from the explosion\r\n */\r\n hitData: PhysicsHitData;\r\n}\r\n\r\n/**\r\n * Interface for an affected physics body\r\n * @see\r\n */\r\nexport interface PhysicsAffectedBodyWithData {\r\n /**\r\n * The impostor affected by the effect\r\n */\r\n body: PhysicsBody;\r\n\r\n /**\r\n * The data about the hit/force from the explosion\r\n */\r\n hitData: PhysicsHitData;\r\n}\r\n"]}
|
package/Physics/v1/index.d.ts
CHANGED
package/Physics/v1/index.js
CHANGED
package/Physics/v1/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Physics/v1/index.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC;AAChC,cAAc,0BAA0B,CAAC;AACzC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Physics/v1/index.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC;AAChC,cAAc,0BAA0B,CAAC;AACzC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC","sourcesContent":["/* eslint-disable import/no-internal-modules */\r\nexport * from \"./IPhysicsEnginePlugin\";\r\nexport * from \"./physicsEngine\";\r\nexport * from \"./physicsEngineComponent\";\r\nexport * from \"./physicsImpostor\";\r\nexport * from \"./physicsJoint\";\r\nexport * from \"./Plugins/index\";\r\n"]}
|
|
@@ -7,6 +7,7 @@ import type { BoundingBox } from "../../Culling/boundingBox";
|
|
|
7
7
|
import type { TransformNode } from "../../Meshes/transformNode";
|
|
8
8
|
import type { PhysicsMaterial } from "./physicsMaterial";
|
|
9
9
|
import type { Mesh } from "../../Meshes/mesh";
|
|
10
|
+
import type { Nullable } from "../../types.js";
|
|
10
11
|
/** @internal */
|
|
11
12
|
export declare enum ConstraintAxisLimitMode {
|
|
12
13
|
FREE = 0,
|
|
@@ -83,7 +84,7 @@ export interface MassProperties {
|
|
|
83
84
|
/**
|
|
84
85
|
*
|
|
85
86
|
*/
|
|
86
|
-
|
|
87
|
+
inertia: Vector3;
|
|
87
88
|
/**
|
|
88
89
|
*
|
|
89
90
|
*/
|
|
@@ -104,8 +105,11 @@ export interface IPhysicsEnginePluginV2 {
|
|
|
104
105
|
getTimeStep(): number;
|
|
105
106
|
executeStep(delta: number, bodies: Array<PhysicsBody>): void;
|
|
106
107
|
getPluginVersion(): number;
|
|
108
|
+
registerOnCollide(func: (collider: PhysicsBody, collidedAgainst: PhysicsBody, point: Nullable<Vector3>) => void): void;
|
|
109
|
+
unregisterOnCollide(func: (collider: PhysicsBody, collidedAgainst: PhysicsBody, point: Nullable<Vector3>) => void): void;
|
|
107
110
|
initBody(body: PhysicsBody, position: Vector3, orientation: Quaternion): void;
|
|
108
111
|
initBodyInstances(body: PhysicsBody, mesh: Mesh): void;
|
|
112
|
+
removeBody(body: PhysicsBody): void;
|
|
109
113
|
sync(body: PhysicsBody): void;
|
|
110
114
|
syncTransform(body: PhysicsBody, transformNode: TransformNode): void;
|
|
111
115
|
setShape(body: PhysicsBody, shape: PhysicsShape): void;
|
|
@@ -123,10 +127,13 @@ export interface IPhysicsEnginePluginV2 {
|
|
|
123
127
|
setLinearVelocity(body: PhysicsBody, linVel: Vector3): void;
|
|
124
128
|
getLinearVelocityToRef(body: PhysicsBody, linVel: Vector3): void;
|
|
125
129
|
applyImpulse(body: PhysicsBody, location: Vector3, impulse: Vector3): void;
|
|
130
|
+
applyForce(body: PhysicsBody, location: Vector3, force: Vector3): void;
|
|
126
131
|
setAngularVelocity(body: PhysicsBody, angVel: Vector3): void;
|
|
127
132
|
getAngularVelocityToRef(body: PhysicsBody, angVel: Vector3): void;
|
|
128
133
|
getBodyGeometry(body: PhysicsBody): {};
|
|
129
134
|
disposeBody(body: PhysicsBody): void;
|
|
135
|
+
registerOnBodyCollide(body: PhysicsBody, func: (collider: PhysicsBody, collidedAgainst: PhysicsBody, point: Nullable<Vector3>) => void): void;
|
|
136
|
+
unregisterOnBodyCollide(body: PhysicsBody, func: (collider: PhysicsBody, collidedAgainst: PhysicsBody, point: Nullable<Vector3>) => void): void;
|
|
130
137
|
initShape(shape: PhysicsShape, type: ShapeType, options: PhysicsShapeParameters): void;
|
|
131
138
|
setFilterLayer(shape: PhysicsShape, layer: number): void;
|
|
132
139
|
getFilterLayer(shape: PhysicsShape): number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IPhysicsEnginePlugin.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Physics/v2/IPhysicsEnginePlugin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"IPhysicsEnginePlugin.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Physics/v2/IPhysicsEnginePlugin.ts"],"names":[],"mappings":"AAWA,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,SASX;AATD,WAAY,SAAS;IACjB,6CAAM,CAAA;IACN,+CAAO,CAAA;IACP,iDAAQ,CAAA;IACR,uCAAG,CAAA;IACH,uDAAW,CAAA;IACX,mDAAS,CAAA;IACT,yCAAI,CAAA;IACJ,uDAAW,CAAA;AACf,CAAC,EATW,SAAS,KAAT,SAAS,QASpB;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 { 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\nimport type { Mesh } from \"../../Meshes/mesh\";\r\nimport type { Nullable } from \"core/types\";\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 HEIGHTFIELD,\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?: Mesh;\r\n includeChildMeshes?: boolean;\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 inertia: Vector3;\r\n /**\r\n *\r\n */\r\n inertiaOrientation: Quaternion;\r\n}\r\n\r\n/** @internal */\r\nexport interface IPhysicsEnginePluginV2 {\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, bodies: Array<PhysicsBody>): void; //not forgetting pre and post events\r\n getPluginVersion(): number;\r\n registerOnCollide(func: (collider: PhysicsBody, collidedAgainst: PhysicsBody, point: Nullable<Vector3>) => void): void;\r\n unregisterOnCollide(func: (collider: PhysicsBody, collidedAgainst: PhysicsBody, point: Nullable<Vector3>) => void): void;\r\n\r\n // body\r\n initBody(body: PhysicsBody, position: Vector3, orientation: Quaternion): void;\r\n initBodyInstances(body: PhysicsBody, mesh: Mesh): void;\r\n removeBody(body: PhysicsBody): void;\r\n sync(body: PhysicsBody): void;\r\n syncTransform(body: PhysicsBody, transformNode: TransformNode): 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 applyForce(body: PhysicsBody, location: Vector3, force: Vector3): void;\r\n setAngularVelocity(body: PhysicsBody, angVel: Vector3): void;\r\n getAngularVelocityToRef(body: PhysicsBody, angVel: Vector3): void;\r\n getBodyGeometry(body: PhysicsBody): {};\r\n disposeBody(body: PhysicsBody): void;\r\n registerOnBodyCollide(body: PhysicsBody, func: (collider: PhysicsBody, collidedAgainst: PhysicsBody, point: Nullable<Vector3>) => void): void;\r\n unregisterOnBodyCollide(body: PhysicsBody, func: (collider: PhysicsBody, collidedAgainst: PhysicsBody, point: Nullable<Vector3>) => void): 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"]}
|
package/Physics/v2/index.d.ts
CHANGED
package/Physics/v2/index.js
CHANGED
package/Physics/v2/index.js.map
CHANGED
|
@@ -1 +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"]}
|
|
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;AACnC,cAAc,wBAAwB,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\nexport * from \"./IPhysicsEnginePlugin\";\r\n"]}
|
|
@@ -1,28 +1,27 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { PhysicsBody } from "./physicsBody";
|
|
2
2
|
import { PhysicsMaterial } from "./physicsMaterial";
|
|
3
|
-
import
|
|
3
|
+
import { PhysicsShape } from "./physicsShape";
|
|
4
4
|
import type { Scene } from "../../scene";
|
|
5
5
|
import type { TransformNode } from "../../Meshes/transformNode";
|
|
6
|
+
import { Vector3 } from "../../Maths/math.vector";
|
|
6
7
|
/**
|
|
7
8
|
* The interface for the physics aggregate parameters
|
|
8
9
|
*/
|
|
9
|
-
/** @internal */
|
|
10
10
|
export interface PhysicsAggregateParameters {
|
|
11
|
-
/** @internal */
|
|
12
11
|
/**
|
|
13
|
-
* The mass of the physics
|
|
12
|
+
* The mass of the physics aggregate
|
|
14
13
|
*/
|
|
15
14
|
mass: number;
|
|
16
15
|
/**
|
|
17
|
-
* The friction of the physics
|
|
16
|
+
* The friction of the physics aggregate
|
|
18
17
|
*/
|
|
19
18
|
friction?: number;
|
|
20
19
|
/**
|
|
21
|
-
* The coefficient of restitution of the physics
|
|
20
|
+
* The coefficient of restitution of the physics aggregate
|
|
22
21
|
*/
|
|
23
22
|
restitution?: number;
|
|
24
23
|
/**
|
|
25
|
-
* The native options of the physics
|
|
24
|
+
* The native options of the physics aggregate
|
|
26
25
|
*/
|
|
27
26
|
nativeOptions?: any;
|
|
28
27
|
/**
|
|
@@ -34,11 +33,11 @@ export interface PhysicsAggregateParameters {
|
|
|
34
33
|
*/
|
|
35
34
|
disableBidirectionalTransformation?: boolean;
|
|
36
35
|
/**
|
|
37
|
-
* The pressure inside the physics
|
|
36
|
+
* The pressure inside the physics aggregate, soft object only
|
|
38
37
|
*/
|
|
39
38
|
pressure?: number;
|
|
40
39
|
/**
|
|
41
|
-
* The stiffness the physics
|
|
40
|
+
* The stiffness the physics aggregate, soft object only
|
|
42
41
|
*/
|
|
43
42
|
stiffness?: number;
|
|
44
43
|
/**
|
|
@@ -71,44 +70,65 @@ export interface PhysicsAggregateParameters {
|
|
|
71
70
|
* The shape of an extrusion used for a rope based on an extrusion
|
|
72
71
|
*/
|
|
73
72
|
shape?: any;
|
|
73
|
+
/**
|
|
74
|
+
* Radius for sphere, cylinder and capsule
|
|
75
|
+
*/
|
|
76
|
+
radius?: number;
|
|
77
|
+
/**
|
|
78
|
+
* Starting point for cylinder/capsule
|
|
79
|
+
*/
|
|
80
|
+
pointA?: Vector3;
|
|
81
|
+
/**
|
|
82
|
+
* Ending point for cylinder/capsule
|
|
83
|
+
*/
|
|
84
|
+
pointB?: Vector3;
|
|
85
|
+
/**
|
|
86
|
+
* Extents for box
|
|
87
|
+
*/
|
|
88
|
+
extents?: Vector3;
|
|
74
89
|
}
|
|
75
90
|
/**
|
|
76
|
-
*
|
|
91
|
+
* Helper class to create and interact with a PhysicsAggregate.
|
|
92
|
+
* This is a transition object that works like Physics Plugin V1 Impostors.
|
|
93
|
+
* This helper instanciate all mandatory physics objects to get a body/shape and material.
|
|
94
|
+
* It's less efficient that handling body and shapes independently but for prototyping or
|
|
95
|
+
* a small numbers of physics objects, it's good enough.
|
|
77
96
|
*/
|
|
78
97
|
export declare class PhysicsAggregate {
|
|
79
98
|
/**
|
|
80
|
-
* The physics-enabled object used as the physics
|
|
99
|
+
* The physics-enabled object used as the physics aggregate
|
|
81
100
|
*/
|
|
82
101
|
transformNode: TransformNode;
|
|
83
102
|
/**
|
|
84
|
-
* The type of the physics
|
|
103
|
+
* The type of the physics aggregate
|
|
85
104
|
*/
|
|
86
105
|
type: number;
|
|
87
106
|
private _options;
|
|
88
107
|
private _scene?;
|
|
89
108
|
/**
|
|
90
|
-
*
|
|
109
|
+
* The body that is associated with this aggregate
|
|
91
110
|
*/
|
|
92
111
|
body: PhysicsBody;
|
|
93
112
|
/**
|
|
94
|
-
*
|
|
113
|
+
* The shape that is associated with this aggregate
|
|
95
114
|
*/
|
|
96
115
|
shape: PhysicsShape;
|
|
97
116
|
/**
|
|
98
|
-
*
|
|
117
|
+
* The material that is associated with this aggregate
|
|
99
118
|
*/
|
|
100
119
|
material: PhysicsMaterial;
|
|
101
120
|
constructor(
|
|
102
121
|
/**
|
|
103
|
-
* The physics-enabled object used as the physics
|
|
122
|
+
* The physics-enabled object used as the physics aggregate
|
|
104
123
|
*/
|
|
105
124
|
transformNode: TransformNode,
|
|
106
125
|
/**
|
|
107
|
-
* The type of the physics
|
|
126
|
+
* The type of the physics aggregate
|
|
108
127
|
*/
|
|
109
128
|
type: number, _options?: PhysicsAggregateParameters, _scene?: Scene | undefined);
|
|
129
|
+
private _addSizeOptions;
|
|
110
130
|
/**
|
|
111
|
-
*
|
|
131
|
+
* Releases the body, shape and material
|
|
112
132
|
*/
|
|
113
133
|
dispose(): void;
|
|
114
134
|
}
|
|
@@ -1,16 +1,25 @@
|
|
|
1
|
+
import { PhysicsBody } from "./physicsBody.js";
|
|
1
2
|
import { PhysicsMaterial } from "./physicsMaterial.js";
|
|
3
|
+
import { PhysicsShape } from "./physicsShape.js";
|
|
2
4
|
import { Logger } from "../../Misc/logger.js";
|
|
5
|
+
import { Quaternion, Vector3 } from "../../Maths/math.vector.js";
|
|
6
|
+
import { Scalar } from "../../Maths/math.scalar.js";
|
|
7
|
+
import { ShapeType } from "./IPhysicsEnginePlugin.js";
|
|
3
8
|
/**
|
|
4
|
-
*
|
|
9
|
+
* Helper class to create and interact with a PhysicsAggregate.
|
|
10
|
+
* This is a transition object that works like Physics Plugin V1 Impostors.
|
|
11
|
+
* This helper instanciate all mandatory physics objects to get a body/shape and material.
|
|
12
|
+
* It's less efficient that handling body and shapes independently but for prototyping or
|
|
13
|
+
* a small numbers of physics objects, it's good enough.
|
|
5
14
|
*/
|
|
6
15
|
export class PhysicsAggregate {
|
|
7
16
|
constructor(
|
|
8
17
|
/**
|
|
9
|
-
* The physics-enabled object used as the physics
|
|
18
|
+
* The physics-enabled object used as the physics aggregate
|
|
10
19
|
*/
|
|
11
20
|
transformNode,
|
|
12
21
|
/**
|
|
13
|
-
* The type of the physics
|
|
22
|
+
* The type of the physics aggregate
|
|
14
23
|
*/
|
|
15
24
|
type, _options = { mass: 0 }, _scene) {
|
|
16
25
|
this.transformNode = transformNode;
|
|
@@ -32,10 +41,57 @@ export class PhysicsAggregate {
|
|
|
32
41
|
if (!this._scene) {
|
|
33
42
|
return;
|
|
34
43
|
}
|
|
35
|
-
|
|
44
|
+
//default options params
|
|
45
|
+
this._options.mass = _options.mass === void 0 ? 0 : _options.mass;
|
|
46
|
+
this._options.friction = _options.friction === void 0 ? 0.2 : _options.friction;
|
|
47
|
+
this._options.restitution = _options.restitution === void 0 ? 0.2 : _options.restitution;
|
|
48
|
+
this.body = new PhysicsBody(transformNode, this._scene);
|
|
49
|
+
this._addSizeOptions();
|
|
50
|
+
this.shape = new PhysicsShape(type, this._options, this._scene);
|
|
51
|
+
this.material = new PhysicsMaterial(this._options.friction, this._options.restitution, this._scene);
|
|
52
|
+
this.body.setShape(this.shape);
|
|
53
|
+
this.shape.setMaterial(this.material);
|
|
54
|
+
this.body.setMassProperties({ centerOfMass: new Vector3(0, 0, 0), mass: this._options.mass, inertia: new Vector3(1, 1, 1), inertiaOrientation: Quaternion.Identity() });
|
|
55
|
+
}
|
|
56
|
+
_addSizeOptions() {
|
|
57
|
+
var _a, _b, _c;
|
|
58
|
+
const impostorExtents = this.body.getObjectExtents();
|
|
59
|
+
switch (this.type) {
|
|
60
|
+
case ShapeType.SPHERE:
|
|
61
|
+
if (Scalar.WithinEpsilon(impostorExtents.x, impostorExtents.y, 0.0001) && Scalar.WithinEpsilon(impostorExtents.x, impostorExtents.z, 0.0001)) {
|
|
62
|
+
this._options.radius = this._options.radius ? this._options.radius : impostorExtents.x / 2;
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
Logger.Warn("Non uniform scaling is unsupported for sphere shapes.");
|
|
66
|
+
}
|
|
67
|
+
break;
|
|
68
|
+
case ShapeType.CAPSULE:
|
|
69
|
+
{
|
|
70
|
+
const capRadius = impostorExtents.x / 2;
|
|
71
|
+
this._options.radius = (_a = this._options.radius) !== null && _a !== void 0 ? _a : capRadius;
|
|
72
|
+
this._options.pointA = (_b = this._options.pointA) !== null && _b !== void 0 ? _b : new Vector3(0, -impostorExtents.y * 0.5 + capRadius, 0);
|
|
73
|
+
this._options.pointB = (_c = this._options.pointB) !== null && _c !== void 0 ? _c : new Vector3(0, impostorExtents.y * 0.5 - capRadius, 0);
|
|
74
|
+
}
|
|
75
|
+
break;
|
|
76
|
+
case ShapeType.CYLINDER:
|
|
77
|
+
{
|
|
78
|
+
const capRadius = impostorExtents.x / 2;
|
|
79
|
+
this._options.radius = this._options.radius ? this._options.radius : capRadius;
|
|
80
|
+
this._options.pointA = this._options.pointA ? this._options.pointA : new Vector3(0, -impostorExtents.y * 0.5, 0);
|
|
81
|
+
this._options.pointB = this._options.pointB ? this._options.pointB : new Vector3(0, impostorExtents.y * 0.5, 0);
|
|
82
|
+
}
|
|
83
|
+
break;
|
|
84
|
+
case ShapeType.BOX:
|
|
85
|
+
this._options.extents = this._options.extents ? this._options.extents : new Vector3(impostorExtents.x, impostorExtents.y, impostorExtents.z);
|
|
86
|
+
break;
|
|
87
|
+
case ShapeType.MESH:
|
|
88
|
+
case ShapeType.CONVEX_HULL: {
|
|
89
|
+
break;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
36
92
|
}
|
|
37
93
|
/**
|
|
38
|
-
*
|
|
94
|
+
* Releases the body, shape and material
|
|
39
95
|
*/
|
|
40
96
|
dispose() {
|
|
41
97
|
this.body.dispose();
|
|
@@ -1 +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"]}
|
|
1
|
+
{"version":3,"file":"physicsAggregate.js","sourceRoot":"","sources":["../../../../../lts/core/generated/Physics/v2/physicsAggregate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAG3C,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAyFnD;;;;;;GAMG;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;Q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AAe,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,CAAC,CAAC;iBACnH;gBACD,MAAM;YACV,KAAK,SAAS,CAAC,GAAG;gBACd,IAAI,CAAC,QAAQ,CAAC,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,eAAe,CAAC,CAAC,EAAE,eAAe,CAAC,CAAC,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC;gBAC7I,MAAM;YACV,KAAK,SAAS,CAAC,IAAI,CAAC;YACpB,KAAK,SAAS,CAAC,WAAW,CAAC,CAAC;gBACxB,MAAM;aACT;SACJ;IACL,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 { PhysicsBody } from \"./physicsBody\";\r\nimport { PhysicsMaterial } from \"./physicsMaterial\";\r\nimport { PhysicsShape } from \"./physicsShape\";\r\nimport { Logger } from \"../../Misc/logger\";\r\nimport type { Scene } from \"../../scene\";\r\nimport type { TransformNode } from \"../../Meshes/transformNode\";\r\nimport { Quaternion, Vector3 } from \"../../Maths/math.vector\";\r\nimport { Scalar } from \"../../Maths/math.scalar\";\r\nimport { ShapeType } from \"./IPhysicsEnginePlugin\";\r\n\r\n/**\r\n * The interface for the physics aggregate parameters\r\n */\r\nexport interface PhysicsAggregateParameters {\r\n /**\r\n * The mass of the physics aggregate\r\n */\r\n mass: number;\r\n /**\r\n * The friction of the physics aggregate\r\n */\r\n friction?: number;\r\n /**\r\n * The coefficient of restitution of the physics aggregate\r\n */\r\n restitution?: number;\r\n /**\r\n * The native options of the physics aggregate\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 aggregate, soft object only\r\n */\r\n pressure?: number;\r\n /**\r\n * The stiffness the physics aggregate, 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 * Radius for sphere, cylinder and capsule\r\n */\r\n radius?: number;\r\n\r\n /**\r\n * Starting point for cylinder/capsule\r\n */\r\n pointA?: Vector3;\r\n\r\n /**\r\n * Ending point for cylinder/capsule\r\n */\r\n pointB?: Vector3;\r\n\r\n /**\r\n * Extents for box\r\n */\r\n extents?: Vector3;\r\n}\r\n/**\r\n * Helper class to create and interact with a PhysicsAggregate.\r\n * This is a transition object that works like Physics Plugin V1 Impostors.\r\n * This helper instanciate all mandatory physics objects to get a body/shape and material.\r\n * It's less efficient that handling body and shapes independently but for prototyping or\r\n * a small numbers of physics objects, it's good enough.\r\n */\r\nexport class PhysicsAggregate {\r\n /**\r\n * The body that is associated with this aggregate\r\n */\r\n public body: PhysicsBody;\r\n\r\n /**\r\n * The shape that is associated with this aggregate\r\n */\r\n public shape: PhysicsShape;\r\n\r\n /**\r\n * The material that is associated with this aggregate\r\n */\r\n public material: PhysicsMaterial;\r\n\r\n constructor(\r\n /**\r\n * The physics-enabled object used as the physics aggregate\r\n */\r\n public transformNode: TransformNode,\r\n /**\r\n * The type of the physics aggregate\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 //default options params\r\n this._options.mass = _options.mass === void 0 ? 0 : _options.mass;\r\n this._options.friction = _options.friction === void 0 ? 0.2 : _options.friction;\r\n this._options.restitution = _options.restitution === void 0 ? 0.2 : _options.restitution;\r\n\r\n this.body = new PhysicsBody(transformNode, this._scene);\r\n this._addSizeOptions();\r\n this.shape = new PhysicsShape(type, this._options as any, this._scene);\r\n\r\n this.material = new PhysicsMaterial(this._options.friction, this._options.restitution, this._scene);\r\n this.body.setShape(this.shape);\r\n this.shape.setMaterial(this.material);\r\n this.body.setMassProperties({ centerOfMass: new Vector3(0, 0, 0), mass: this._options.mass, inertia: new Vector3(1, 1, 1), inertiaOrientation: Quaternion.Identity() });\r\n }\r\n\r\n private _addSizeOptions(): void {\r\n const impostorExtents = this.body.getObjectExtents();\r\n\r\n switch (this.type) {\r\n case ShapeType.SPHERE:\r\n if (Scalar.WithinEpsilon(impostorExtents.x, impostorExtents.y, 0.0001) && Scalar.WithinEpsilon(impostorExtents.x, impostorExtents.z, 0.0001)) {\r\n this._options.radius = this._options.radius ? this._options.radius : impostorExtents.x / 2;\r\n } else {\r\n Logger.Warn(\"Non uniform scaling is unsupported for sphere shapes.\");\r\n }\r\n break;\r\n case ShapeType.CAPSULE:\r\n {\r\n const capRadius = impostorExtents.x / 2;\r\n this._options.radius = this._options.radius ?? capRadius;\r\n this._options.pointA = this._options.pointA ?? new Vector3(0, -impostorExtents.y * 0.5 + capRadius, 0);\r\n this._options.pointB = this._options.pointB ?? new Vector3(0, impostorExtents.y * 0.5 - capRadius, 0);\r\n }\r\n break;\r\n case ShapeType.CYLINDER:\r\n {\r\n const capRadius = impostorExtents.x / 2;\r\n this._options.radius = this._options.radius ? this._options.radius : capRadius;\r\n this._options.pointA = this._options.pointA ? this._options.pointA : new Vector3(0, -impostorExtents.y * 0.5, 0);\r\n this._options.pointB = this._options.pointB ? this._options.pointB : new Vector3(0, impostorExtents.y * 0.5, 0);\r\n }\r\n break;\r\n case ShapeType.BOX:\r\n this._options.extents = this._options.extents ? this._options.extents : new Vector3(impostorExtents.x, impostorExtents.y, impostorExtents.z);\r\n break;\r\n case ShapeType.MESH:\r\n case ShapeType.CONVEX_HULL: {\r\n break;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Releases the body, shape and material\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"]}
|