@onerjs/core 8.42.5 → 8.42.7
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/Animations/animatorAvatar.d.ts +5 -2
- package/Animations/animatorAvatar.js +40 -27
- package/Animations/animatorAvatar.js.map +1 -1
- package/Cameras/Inputs/geospatialCameraMouseWheelInput.d.ts +1 -2
- package/Cameras/Inputs/geospatialCameraMouseWheelInput.js +1 -2
- package/Cameras/Inputs/geospatialCameraMouseWheelInput.js.map +1 -1
- package/Cameras/Inputs/geospatialCameraPointersInput.d.ts +0 -4
- package/Cameras/Inputs/geospatialCameraPointersInput.js +1 -5
- package/Cameras/Inputs/geospatialCameraPointersInput.js.map +1 -1
- package/Cameras/arcRotateCamera.js +9 -9
- package/Cameras/arcRotateCamera.js.map +1 -1
- package/Cameras/cameraMovement.d.ts +1 -4
- package/Cameras/cameraMovement.js +1 -4
- package/Cameras/cameraMovement.js.map +1 -1
- package/Cameras/geospatialCamera.d.ts +22 -4
- package/Cameras/geospatialCamera.js +27 -9
- package/Cameras/geospatialCamera.js.map +1 -1
- package/Cameras/geospatialCameraMovement.d.ts +3 -3
- package/Cameras/geospatialCameraMovement.js +18 -18
- package/Cameras/geospatialCameraMovement.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.debugging.js +35 -13
- package/Engines/WebGPU/Extensions/engine.debugging.js.map +1 -1
- package/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/Engines/engineFeatures.d.ts +0 -2
- package/Engines/engineFeatures.js.map +1 -1
- package/Engines/nullEngine.js +0 -1
- package/Engines/nullEngine.js.map +1 -1
- package/Engines/thinEngine.js +0 -1
- package/Engines/thinEngine.js.map +1 -1
- package/Engines/thinNativeEngine.js +0 -1
- package/Engines/thinNativeEngine.js.map +1 -1
- package/Engines/thinWebGPUEngine.d.ts +9 -4
- package/Engines/thinWebGPUEngine.js +32 -32
- package/Engines/thinWebGPUEngine.js.map +1 -1
- package/Engines/webgpuEngine.d.ts +1 -0
- package/Engines/webgpuEngine.js +24 -165
- package/Engines/webgpuEngine.js.map +1 -1
- package/FrameGraph/Passes/renderPass.js +0 -3
- package/FrameGraph/Passes/renderPass.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/objectRendererTask.d.ts +2 -3
- package/FrameGraph/Tasks/Rendering/objectRendererTask.js +5 -29
- package/FrameGraph/Tasks/Rendering/objectRendererTask.js.map +1 -1
- package/FrameGraph/frameGraph.js +3 -0
- package/FrameGraph/frameGraph.js.map +1 -1
- package/FrameGraph/frameGraphContext.js +1 -1
- package/FrameGraph/frameGraphContext.js.map +1 -1
- package/FrameGraph/frameGraphTask.d.ts +0 -2
- package/FrameGraph/frameGraphTask.js +15 -17
- package/FrameGraph/frameGraphTask.js.map +1 -1
- package/FrameGraph/frameGraphTextureManager.js +1 -1
- package/FrameGraph/frameGraphTextureManager.js.map +1 -1
- package/Gizmos/axisScaleGizmo.js +2 -2
- package/Gizmos/axisScaleGizmo.js.map +1 -1
- package/Gizmos/cameraGizmo.d.ts +1 -1
- package/Gizmos/cameraGizmo.js +1 -1
- package/Gizmos/cameraGizmo.js.map +1 -1
- package/Gizmos/gizmo.d.ts +4 -4
- package/Gizmos/gizmo.js +5 -5
- package/Gizmos/gizmo.js.map +1 -1
- package/Gizmos/gizmoManager.d.ts +2 -2
- package/Gizmos/gizmoManager.js +1 -1
- package/Gizmos/gizmoManager.js.map +1 -1
- package/Gizmos/planeRotationGizmo.d.ts +2 -2
- package/Gizmos/planeRotationGizmo.js +2 -3
- package/Gizmos/planeRotationGizmo.js.map +1 -1
- package/Gizmos/positionGizmo.d.ts +1 -1
- package/Gizmos/positionGizmo.js +2 -2
- package/Gizmos/positionGizmo.js.map +1 -1
- package/Gizmos/rotationGizmo.d.ts +1 -1
- package/Gizmos/rotationGizmo.js +3 -3
- package/Gizmos/rotationGizmo.js.map +1 -1
- package/Gizmos/scaleGizmo.d.ts +1 -1
- package/Gizmos/scaleGizmo.js +1 -1
- package/Gizmos/scaleGizmo.js.map +1 -1
- package/Loading/Plugins/babylonFileLoader.js +44 -14
- package/Loading/Plugins/babylonFileLoader.js.map +1 -1
- package/Materials/GaussianSplatting/gaussianSplattingSolidColorMaterialPlugin.d.ts +12 -3
- package/Materials/GaussianSplatting/gaussianSplattingSolidColorMaterialPlugin.js +33 -8
- package/Materials/GaussianSplatting/gaussianSplattingSolidColorMaterialPlugin.js.map +1 -1
- package/Materials/uniformBuffer.d.ts +0 -4
- package/Materials/uniformBuffer.js +0 -8
- package/Materials/uniformBuffer.js.map +1 -1
- package/Materials/vertexPullingHelper.functions.d.ts +4 -0
- package/Materials/vertexPullingHelper.functions.js +4 -2
- package/Materials/vertexPullingHelper.functions.js.map +1 -1
- package/Maths/index.d.ts +2 -0
- package/Maths/index.js +2 -0
- package/Maths/index.js.map +1 -1
- package/Maths/math.geospatial.d.ts +12 -0
- package/Maths/math.geospatial.functions.d.ts +19 -0
- package/Maths/math.geospatial.functions.js +27 -0
- package/Maths/math.geospatial.functions.js.map +1 -0
- package/Maths/math.geospatial.js +2 -0
- package/Maths/math.geospatial.js.map +1 -0
- package/Meshes/mesh.js +1 -1
- package/Meshes/mesh.js.map +1 -1
- package/Navigation/INavigationEngine.d.ts +2 -2
- package/Navigation/INavigationEngine.js.map +1 -1
- package/Navigation/Plugins/recastJSPlugin.d.ts +2 -2
- package/Navigation/Plugins/recastJSPlugin.js +14 -5
- package/Navigation/Plugins/recastJSPlugin.js.map +1 -1
- package/Physics/castingResult.d.ts +4 -1
- package/Physics/castingResult.js +1 -1
- package/Physics/castingResult.js.map +1 -1
- package/Physics/joinedPhysicsEngineComponent.js +1 -1
- package/Physics/joinedPhysicsEngineComponent.js.map +1 -1
- package/Physics/physicsHelper.d.ts +8 -8
- package/Physics/physicsHelper.js +7 -7
- package/Physics/physicsHelper.js.map +1 -1
- package/Physics/shapeCastResult.d.ts +4 -0
- package/Physics/shapeCastResult.js +7 -0
- package/Physics/shapeCastResult.js.map +1 -1
- package/Physics/v2/IPhysicsEnginePlugin.d.ts +51 -4
- package/Physics/v2/IPhysicsEnginePlugin.js +12 -12
- package/Physics/v2/IPhysicsEnginePlugin.js.map +1 -1
- package/Physics/v2/characterController.js.map +1 -1
- package/Physics/v2/physicsBody.js.map +1 -1
- package/Physics/v2/physicsConstraint.d.ts +1 -1
- package/Physics/v2/physicsConstraint.js +1 -1
- package/Physics/v2/physicsConstraint.js.map +1 -1
- package/Physics/v2/physicsEngine.d.ts +0 -5
- package/Physics/v2/physicsEngine.js +0 -5
- package/Physics/v2/physicsEngine.js.map +1 -1
- package/Physics/v2/physicsEngineComponent.d.ts +1 -1
- package/Physics/v2/physicsEngineComponent.js.map +1 -1
- package/Physics/v2/physicsMaterial.d.ts +6 -0
- package/Physics/v2/physicsMaterial.js +2 -2
- package/Physics/v2/physicsMaterial.js.map +1 -1
- package/Physics/v2/ragdoll.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsVoxelRenderer.js +4 -1
- package/Rendering/IBLShadows/iblShadowsVoxelRenderer.js.map +1 -1
- package/Rendering/edgesRenderer.js +1 -0
- package/Rendering/edgesRenderer.js.map +1 -1
- package/Rendering/objectRenderer.js +8 -4
- package/Rendering/objectRenderer.js.map +1 -1
- package/Rendering/renderingGroup.d.ts +1 -1
- package/Rendering/renderingGroup.js +1 -1
- package/Rendering/renderingGroup.js.map +1 -1
- package/Rendering/renderingManager.d.ts +1 -1
- package/Rendering/renderingManager.js.map +1 -1
- package/Shaders/iblVoxelGrid.fragment.js +4 -1
- package/Shaders/iblVoxelGrid.fragment.js.map +1 -1
- package/ShadersWGSL/background.vertex.js +8 -8
- package/ShadersWGSL/background.vertex.js.map +1 -1
- package/ShadersWGSL/boundingBoxRenderer.vertex.js +2 -2
- package/ShadersWGSL/boundingBoxRenderer.vertex.js.map +1 -1
- package/ShadersWGSL/clearQuad.vertex.js +1 -1
- package/ShadersWGSL/clearQuad.vertex.js.map +1 -1
- package/ShadersWGSL/color.vertex.js +1 -1
- package/ShadersWGSL/color.vertex.js.map +1 -1
- package/ShadersWGSL/depth.vertex.js +3 -3
- package/ShadersWGSL/depth.vertex.js.map +1 -1
- package/ShadersWGSL/fluidRenderingParticleDepth.vertex.js +2 -2
- package/ShadersWGSL/fluidRenderingParticleDepth.vertex.js.map +1 -1
- package/ShadersWGSL/fluidRenderingParticleDiffuse.vertex.js +2 -2
- package/ShadersWGSL/fluidRenderingParticleDiffuse.vertex.js.map +1 -1
- package/ShadersWGSL/fluidRenderingParticleThickness.vertex.js +2 -2
- package/ShadersWGSL/fluidRenderingParticleThickness.vertex.js.map +1 -1
- package/ShadersWGSL/fxaa.vertex.js +1 -1
- package/ShadersWGSL/fxaa.vertex.js.map +1 -1
- package/ShadersWGSL/gaussianSplatting.vertex.js +3 -3
- package/ShadersWGSL/gaussianSplatting.vertex.js.map +1 -1
- package/ShadersWGSL/gaussianSplattingDepth.vertex.js +3 -3
- package/ShadersWGSL/gaussianSplattingDepth.vertex.js.map +1 -1
- package/ShadersWGSL/geometry.vertex.js +4 -4
- package/ShadersWGSL/geometry.vertex.js.map +1 -1
- package/ShadersWGSL/glowMapGeneration.vertex.js +4 -4
- package/ShadersWGSL/glowMapGeneration.vertex.js.map +1 -1
- package/ShadersWGSL/glowMapMerge.vertex.js +1 -1
- package/ShadersWGSL/glowMapMerge.vertex.js.map +1 -1
- package/ShadersWGSL/greasedLine.vertex.js +10 -4
- package/ShadersWGSL/greasedLine.vertex.js.map +1 -1
- package/ShadersWGSL/hdrFiltering.vertex.js +1 -1
- package/ShadersWGSL/hdrFiltering.vertex.js.map +1 -1
- package/ShadersWGSL/hdrIrradianceFiltering.vertex.js +1 -1
- package/ShadersWGSL/hdrIrradianceFiltering.vertex.js.map +1 -1
- package/ShadersWGSL/iblVoxelGrid.vertex.js +53 -44
- package/ShadersWGSL/iblVoxelGrid.vertex.js.map +1 -1
- package/ShadersWGSL/iblVoxelSlabDebug.vertex.js +1 -1
- package/ShadersWGSL/iblVoxelSlabDebug.vertex.js.map +1 -1
- package/ShadersWGSL/kernelBlur.vertex.js +2 -2
- package/ShadersWGSL/kernelBlur.vertex.js.map +1 -1
- package/ShadersWGSL/layer.vertex.js +1 -1
- package/ShadersWGSL/layer.vertex.js.map +1 -1
- package/ShadersWGSL/lensFlare.vertex.js +1 -1
- package/ShadersWGSL/lensFlare.vertex.js.map +1 -1
- package/ShadersWGSL/line.vertex.js +2 -2
- package/ShadersWGSL/line.vertex.js.map +1 -1
- package/ShadersWGSL/meshUVSpaceRenderer.vertex.js +2 -2
- package/ShadersWGSL/meshUVSpaceRenderer.vertex.js.map +1 -1
- package/ShadersWGSL/meshUVSpaceRendererFinaliser.vertex.js +1 -1
- package/ShadersWGSL/meshUVSpaceRendererFinaliser.vertex.js.map +1 -1
- package/ShadersWGSL/meshUVSpaceRendererMasker.vertex.js +1 -1
- package/ShadersWGSL/meshUVSpaceRendererMasker.vertex.js.map +1 -1
- package/ShadersWGSL/particles.vertex.js +9 -9
- package/ShadersWGSL/particles.vertex.js.map +1 -1
- package/ShadersWGSL/picking.vertex.js +2 -2
- package/ShadersWGSL/picking.vertex.js.map +1 -1
- package/ShadersWGSL/procedural.vertex.js +1 -1
- package/ShadersWGSL/procedural.vertex.js.map +1 -1
- package/ShadersWGSL/shadowMap.vertex.js +4 -4
- package/ShadersWGSL/shadowMap.vertex.js.map +1 -1
- package/ShadersWGSL/sprites.vertex.js +3 -3
- package/ShadersWGSL/sprites.vertex.js.map +1 -1
- package/XR/features/WebXRControllerPhysics.js +0 -2
- package/XR/features/WebXRControllerPhysics.js.map +1 -1
- package/XR/features/WebXRControllerTeleportation.js +1 -2
- package/XR/features/WebXRControllerTeleportation.js.map +1 -1
- package/XR/features/WebXRDepthSensing.js +1 -0
- package/XR/features/WebXRDepthSensing.js.map +1 -1
- package/XR/features/WebXRHandTracking.js +4 -7
- package/XR/features/WebXRHandTracking.js.map +1 -1
- package/XR/features/WebXRWalkingLocomotion.js +1 -1
- package/XR/features/WebXRWalkingLocomotion.js.map +1 -1
- package/XR/motionController/webXRMicrosoftMixedRealityController.js +1 -1
- package/XR/motionController/webXRMicrosoftMixedRealityController.js.map +1 -1
- package/XR/motionController/webXRMotionControllerManager.js +2 -2
- package/XR/motionController/webXRMotionControllerManager.js.map +1 -1
- package/XR/webXRCamera.d.ts +1 -0
- package/XR/webXRCamera.js +9 -7
- package/XR/webXRCamera.js.map +1 -1
- package/XR/webXRExperienceHelper.d.ts +4 -0
- package/XR/webXRExperienceHelper.js +25 -5
- package/XR/webXRExperienceHelper.js.map +1 -1
- package/XR/webXRInput.d.ts +1 -0
- package/XR/webXRInput.js +6 -0
- package/XR/webXRInput.js.map +1 -1
- package/XR/webXRSessionManager.js +5 -4
- package/XR/webXRSessionManager.js.map +1 -1
- package/package.json +1 -1
- package/scene.js +2 -1
- package/scene.js.map +1 -1
|
@@ -242,12 +242,12 @@ declare class PhysicsVortexEvent {
|
|
|
242
242
|
*/
|
|
243
243
|
enable(): void;
|
|
244
244
|
/**
|
|
245
|
-
* Disables the
|
|
245
|
+
* Disables the vortex.
|
|
246
246
|
*/
|
|
247
247
|
disable(): void;
|
|
248
248
|
/**
|
|
249
|
-
* Disposes the
|
|
250
|
-
* @param force
|
|
249
|
+
* Disposes the cylinder.
|
|
250
|
+
* @param force Specifies if the vortex should be disposed by force
|
|
251
251
|
*/
|
|
252
252
|
dispose(force?: boolean): void;
|
|
253
253
|
private _getHitData;
|
|
@@ -259,7 +259,7 @@ declare class PhysicsVortexEvent {
|
|
|
259
259
|
private _intersectsWithCylinder;
|
|
260
260
|
}
|
|
261
261
|
/**
|
|
262
|
-
* Options
|
|
262
|
+
* Options for the radial explosion event
|
|
263
263
|
* @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class
|
|
264
264
|
*/
|
|
265
265
|
export declare class PhysicsRadialExplosionEventOptions {
|
|
@@ -283,16 +283,16 @@ export declare class PhysicsRadialExplosionEventOptions {
|
|
|
283
283
|
diameter: number;
|
|
284
284
|
};
|
|
285
285
|
/**
|
|
286
|
-
*
|
|
286
|
+
* Callback that is triggered when the radial explosion affects impostors.
|
|
287
287
|
*/
|
|
288
288
|
affectedImpostorsCallback: (affectedImpostorsWithData: Array<PhysicsAffectedImpostorWithData>) => void;
|
|
289
289
|
/**
|
|
290
|
-
*
|
|
290
|
+
* Callback that is triggered when the radial explosion affects bodies.
|
|
291
291
|
*/
|
|
292
292
|
affectedBodiesCallback: (affectedBodiesWithData: Array<PhysicsAffectedBodyWithData>) => void;
|
|
293
293
|
}
|
|
294
294
|
/**
|
|
295
|
-
* Options
|
|
295
|
+
* Options for the updraft event
|
|
296
296
|
* @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class
|
|
297
297
|
*/
|
|
298
298
|
export declare class PhysicsUpdraftEventOptions {
|
|
@@ -314,7 +314,7 @@ export declare class PhysicsUpdraftEventOptions {
|
|
|
314
314
|
updraftMode: PhysicsUpdraftMode;
|
|
315
315
|
}
|
|
316
316
|
/**
|
|
317
|
-
* Options
|
|
317
|
+
* Options for the vortex event
|
|
318
318
|
* @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class
|
|
319
319
|
*/
|
|
320
320
|
export declare class PhysicsVortexEventOptions {
|
package/Physics/physicsHelper.js
CHANGED
|
@@ -602,7 +602,7 @@ class PhysicsUpdraftEvent {
|
|
|
602
602
|
data.distanceFromOrigin = distanceFromOrigin;
|
|
603
603
|
}
|
|
604
604
|
_getBodyHitData(body, data, instanceIndex) {
|
|
605
|
-
if (HelperTools.HasAppliedForces(body)) {
|
|
605
|
+
if (HelperTools.HasAppliedForces(body, instanceIndex)) {
|
|
606
606
|
return false;
|
|
607
607
|
}
|
|
608
608
|
const center = body.getObjectCenterWorld(instanceIndex);
|
|
@@ -712,14 +712,14 @@ class PhysicsVortexEvent {
|
|
|
712
712
|
this._scene.registerBeforeRender(this._tickCallback);
|
|
713
713
|
}
|
|
714
714
|
/**
|
|
715
|
-
* Disables the
|
|
715
|
+
* Disables the vortex.
|
|
716
716
|
*/
|
|
717
717
|
disable() {
|
|
718
718
|
this._scene.unregisterBeforeRender(this._tickCallback);
|
|
719
719
|
}
|
|
720
720
|
/**
|
|
721
|
-
* Disposes the
|
|
722
|
-
* @param force
|
|
721
|
+
* Disposes the cylinder.
|
|
722
|
+
* @param force Specifies if the vortex should be disposed by force
|
|
723
723
|
*/
|
|
724
724
|
dispose(force = true) {
|
|
725
725
|
if (!this._cylinder) {
|
|
@@ -843,7 +843,7 @@ class PhysicsVortexEvent {
|
|
|
843
843
|
PhysicsVortexEvent._OriginOnPlane = Vector3.Zero();
|
|
844
844
|
PhysicsVortexEvent._HitData = { force: new Vector3(), contactPoint: new Vector3(), distanceFromOrigin: 0 };
|
|
845
845
|
/**
|
|
846
|
-
* Options
|
|
846
|
+
* Options for the radial explosion event
|
|
847
847
|
* @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class
|
|
848
848
|
*/
|
|
849
849
|
export class PhysicsRadialExplosionEventOptions {
|
|
@@ -867,7 +867,7 @@ export class PhysicsRadialExplosionEventOptions {
|
|
|
867
867
|
}
|
|
868
868
|
}
|
|
869
869
|
/**
|
|
870
|
-
* Options
|
|
870
|
+
* Options for the updraft event
|
|
871
871
|
* @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class
|
|
872
872
|
*/
|
|
873
873
|
export class PhysicsUpdraftEventOptions {
|
|
@@ -891,7 +891,7 @@ export class PhysicsUpdraftEventOptions {
|
|
|
891
891
|
}
|
|
892
892
|
}
|
|
893
893
|
/**
|
|
894
|
-
* Options
|
|
894
|
+
* Options for the vortex event
|
|
895
895
|
* @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine#further-functionality-of-the-impostor-class
|
|
896
896
|
*/
|
|
897
897
|
export class PhysicsVortexEventOptions {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"physicsHelper.js","sourceRoot":"","sources":["../../../../dev/core/src/Physics/physicsHelper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAG3D,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AASrC,MAAM,WAAW;IACb;;;OAGG;IACH,MAAM,CAAC,oBAAoB,CAAC,IAAkB,EAAE,MAAe,EAAE,SAAkB,EAAE,MAAe,EAAE,aAAsB;QACxH,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC,gBAAgB,EAAE,CAAC;QAClD,MAAM,aAAa,GAAG,MAAM,EAAE,gBAAgB,EAAE,CAAC;QACjD,IAAI,aAAa,KAAK,CAAC,EAAE,CAAC;YACtB,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;YACvC,MAAM,GAAG,GAAG,GAAG,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;YACrC,IAAI,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,WAAW,EAAE,CAAC;gBAC7B,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;gBACjC,OAAO,IAAI,CAAC;YAChB,CAAC;QACL,CAAC;aAAM,IAAI,aAAa,KAAK,CAAC,EAAE,CAAC;YAC7B,IAAI,CAAC,WAAY,CAAC,yBAAyB,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;YACnE,OAAO,IAAI,CAAC;QAChB,CAAC;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,gBAAgB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C;QAEtB;;WAEG;QACH,YAAO,gDAAqE;QAE5E;;WAEG;QACH,WAAM,GAA2C,EAAE,QAAQ,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC;IAWnF,CAAC;CAAA;AAED;;;GAGG;AACH,MAAM,OAAO,0BAA0B;IAAvC;QACI;;WAEG;QACH,WAAM,GAAW,CAAC,CAAC;QAEnB;;WAEG;QACH,aAAQ,GAAW,EAAE,CAAC;QAEtB;;WAEG;QACH,WAAM,GAAW,EAAE,CAAC;QAEpB;;WAEG;QACH,gBAAW,qCAAiD;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,IAAkB,2BAKjB;AALD,WAAkB,2BAA2B;IACzC,4EAA4E;IAC5E,qFAAQ,CAAA;IACR,uEAAuE;IACvE,iFAAM,CAAA;AACV,CAAC,EALiB,2BAA2B,KAA3B,2BAA2B,QAK5C;AAED;;;GAGG;AACH,MAAM,CAAN,IAAkB,kBAKjB;AALD,WAAkB,kBAAkB;IAChC,wFAAwF;IACxF,+DAAM,CAAA;IACN,2HAA2H;IAC3H,6EAAa,CAAA;AACjB,CAAC,EALiB,kBAAkB,KAAlB,kBAAkB,QAKnC","sourcesContent":["import type { Nullable } from \"../types\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport { TmpVectors, 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\nimport { PhysicsMotionType } from \"./v2/IPhysicsEnginePlugin\";\r\n\r\nclass HelperTools {\r\n /*\r\n * Gets the hit contact point between a mesh and a ray. The method varies between\r\n * the different plugin versions; V1 uses a mesh intersection, V2 uses the physics body instance/object center (to avoid a raycast and improve perf).\r\n */\r\n static GetContactPointToRef(mesh: AbstractMesh, origin: Vector3, direction: Vector3, result: Vector3, instanceIndex?: number): boolean {\r\n const engine = mesh.getScene().getPhysicsEngine();\r\n const pluginVersion = engine?.getPluginVersion();\r\n if (pluginVersion === 1) {\r\n const ray = new Ray(origin, direction);\r\n const hit = ray.intersectsMesh(mesh);\r\n if (hit.hit && hit.pickedPoint) {\r\n result.copyFrom(hit.pickedPoint);\r\n return true;\r\n }\r\n } else if (pluginVersion === 2) {\r\n mesh.physicsBody!.getObjectCenterWorldToRef(result, instanceIndex);\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n /**\r\n * Checks if a body will be affected by forces\r\n * @param body the body to check\r\n * @param instanceIndex for instanced bodies, the index of the instance to check\r\n * @returns\r\n */\r\n static HasAppliedForces(body: PhysicsBody, instanceIndex?: number) {\r\n const mesh = body.transformNode as Mesh;\r\n return (\r\n body.getMotionType(instanceIndex) === PhysicsMotionType.STATIC ||\r\n (body.getMassProperties(instanceIndex)?.mass ?? 0) === 0 ||\r\n (mesh && mesh.getTotalVertices && mesh.getTotalVertices() === 0)\r\n );\r\n }\r\n\r\n /**\r\n * Checks if a point is inside a cylinder\r\n * @param point point to check\r\n * @param origin cylinder origin on the bottom\r\n * @param radius cylinder radius\r\n * @param height cylinder height\r\n * @returns\r\n */\r\n static IsInsideCylinder(point: Vector3, origin: Vector3, radius: number, height: number): boolean {\r\n const distance = TmpVectors.Vector3[0];\r\n point.subtractToRef(origin, distance);\r\n return Math.abs(distance.x) <= radius && Math.abs(distance.z) <= radius && distance.y >= 0 && distance.y <= height;\r\n }\r\n}\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 for (const impostor of impostors) {\r\n if (!event.getImpostorHitData(impostor, origin, hitData)) {\r\n continue;\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 this._applicationForBodies(event, origin, hitData, useCallback, (body: PhysicsBody, hitData: PhysicsHitData) => {\r\n body.applyImpulse(hitData.force, hitData.contactPoint, hitData.instanceIndex);\r\n });\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 for (const impostor of impostors) {\r\n if (!event.getImpostorHitData(impostor, origin, hitData)) {\r\n continue;\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 this._applicationForBodies(event, origin, hitData, useCallback, (body: PhysicsBody, hitData: PhysicsHitData) => {\r\n body.applyForce(hitData.force, hitData.contactPoint, hitData.instanceIndex);\r\n });\r\n }\r\n\r\n event.dispose(false);\r\n\r\n return event;\r\n }\r\n\r\n private _applicationForBodies(\r\n event: PhysicsRadialExplosionEvent,\r\n origin: Vector3,\r\n hitData: PhysicsHitData,\r\n useCallback: boolean,\r\n fnApplication: (body: PhysicsBody, hitData: PhysicsHitData, instanceIndex?: number) => void\r\n ) {\r\n const affectedBodiesWithData = Array<PhysicsAffectedBodyWithData>();\r\n const bodies = (<PhysicsEngineV2>this._physicsEngine).getBodies();\r\n for (const body of bodies) {\r\n body.iterateOverAllInstances((body, instanceIndex) => {\r\n if (!event.getBodyHitData(body, origin, hitData, instanceIndex)) {\r\n return;\r\n }\r\n fnApplication(body, hitData);\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\r\n event.triggerAffectedBodiesCallback(affectedBodiesWithData);\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, instanceIndex: data.instanceIndex };\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(\r\n private _scene: Scene,\r\n private _options: PhysicsRadialExplosionEventOptions\r\n ) {\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 = TmpVectors.Vector3[0];\r\n direction.copyFrom(center).subtractInPlace(origin);\r\n\r\n const contactPoint = TmpVectors.Vector3[1];\r\n const hasContactPoint = HelperTools.GetContactPointToRef(mesh, origin, direction, contactPoint, data.instanceIndex);\r\n\r\n if (!hasContactPoint) {\r\n return false;\r\n }\r\n\r\n const distanceFromOrigin = Vector3.Distance(origin, contactPoint);\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 // Direction x multiplier equals force\r\n direction.scaleInPlace(multiplier);\r\n\r\n data.force.copyFrom(direction);\r\n data.contactPoint.copyFrom(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 where the transform node is an AbstractMesh\r\n * @param origin the origin of the explosion\r\n * @param data the data of the hit\r\n * @param instanceIndex the instance index of the body\r\n * @returns if there was a hit\r\n */\r\n public getBodyHitData(body: PhysicsBody, origin: Vector3, data: PhysicsHitData, instanceIndex?: number): boolean {\r\n // No force will be applied in these cases, so we skip calculation\r\n if (HelperTools.HasAppliedForces(body, instanceIndex)) {\r\n return false;\r\n }\r\n\r\n const mesh = body.transformNode as AbstractMesh;\r\n const bodyObjectCenter = body.getObjectCenterWorld(instanceIndex);\r\n data.instanceIndex = instanceIndex;\r\n return this._getHitData(mesh, bodyObjectCenter, origin, data);\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 * @param data the data of the hit\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 (this._sphere) {\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\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(\r\n private _physicsHelper: PhysicsHelper,\r\n private _scene: Scene,\r\n private _origin: Vector3,\r\n private _options: PhysicsRadialExplosionEventOptions\r\n ) {\r\n this._options = { ...new PhysicsRadialExplosionEventOptions(), ...this._options };\r\n\r\n this._tickCallback = () => this._tick();\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 (!this._sphere) {\r\n return;\r\n }\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 = 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 | undefined;\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(\r\n private _scene: Scene,\r\n private _origin: Vector3,\r\n private _options: PhysicsUpdraftEventOptions\r\n ) {\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();\r\n\r\n if (this._physicsEngine.getPluginVersion() === 1) {\r\n this._prepareCylinder();\r\n }\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 this._cylinder = undefined;\r\n } else {\r\n setTimeout(() => {\r\n if (!this._dataFetched && this._cylinder) {\r\n this._cylinder.dispose();\r\n this._cylinder = undefined;\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.copyFrom(force);\r\n data.contactPoint.copyFrom(center);\r\n data.distanceFromOrigin = distanceFromOrigin;\r\n }\r\n\r\n private _getBodyHitData(body: PhysicsBody, data: PhysicsHitData, instanceIndex?: number): boolean {\r\n if (HelperTools.HasAppliedForces(body)) {\r\n return false;\r\n }\r\n\r\n const center = body.getObjectCenterWorld(instanceIndex);\r\n\r\n if (!HelperTools.IsInsideCylinder(center, this._origin, this._options.radius, this._options.height)) {\r\n return false;\r\n }\r\n\r\n data.instanceIndex = instanceIndex;\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 const impostors = (<PhysicsEngineV1>this._physicsEngine).getImpostors();\r\n for (const impostor of impostors) {\r\n if (!this._getImpostorHitData(impostor, hitData)) {\r\n continue;\r\n }\r\n\r\n impostor.applyForce(hitData.force, hitData.contactPoint);\r\n }\r\n } else {\r\n // V2\r\n const bodies = (<PhysicsEngineV2>this._physicsEngine).getBodies();\r\n for (const body of bodies) {\r\n body.iterateOverAllInstances((body, instanceIndex) => {\r\n if (!this._getBodyHitData(body, hitData, instanceIndex)) {\r\n return;\r\n }\r\n\r\n body.applyForce(hitData.force, hitData.contactPoint, hitData.instanceIndex);\r\n });\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 if (!this._cylinder) {\r\n return false;\r\n }\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(\r\n private _scene: Scene,\r\n private _origin: Vector3,\r\n private _options: PhysicsVortexEventOptions\r\n ) {\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();\r\n\r\n if (this._physicsEngine.getPluginVersion() === 1) {\r\n this._prepareCylinder();\r\n }\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 (!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(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 = TmpVectors.Vector3[0];\r\n center.subtractToRef(originOnPlane, originToImpostorDirection);\r\n\r\n const contactPoint = TmpVectors.Vector3[1];\r\n const hasContactPoint = HelperTools.GetContactPointToRef(mesh, originOnPlane, originToImpostorDirection, contactPoint, data.instanceIndex);\r\n if (!hasContactPoint) {\r\n return false;\r\n }\r\n const distance = Vector3.Distance(contactPoint, originOnPlane);\r\n const absoluteDistanceFromOrigin = distance / this._options.radius;\r\n\r\n const directionToOrigin = TmpVectors.Vector3[2];\r\n contactPoint.normalizeToRef(directionToOrigin);\r\n if (absoluteDistanceFromOrigin > this._options.centripetalForceThreshold) {\r\n directionToOrigin.negateInPlace();\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 const force = TmpVectors.Vector3[3];\r\n force.set(forceX, forceY, forceZ);\r\n force.scaleInPlace(this._options.strength);\r\n\r\n data.force.copyFrom(force);\r\n data.contactPoint.copyFrom(center);\r\n data.distanceFromOrigin = absoluteDistanceFromOrigin;\r\n return true;\r\n }\r\n\r\n private _getBodyHitData(body: PhysicsBody, data: PhysicsHitData, instanceIndex?: number): boolean {\r\n if (HelperTools.HasAppliedForces(body, instanceIndex)) {\r\n return false;\r\n }\r\n\r\n const bodyObject = body.transformNode as AbstractMesh;\r\n const bodyCenter = body.getObjectCenterWorld(instanceIndex);\r\n\r\n if (!HelperTools.IsInsideCylinder(bodyCenter, this._origin, this._options.radius, this._options.height)) {\r\n return false;\r\n }\r\n\r\n data.instanceIndex = instanceIndex;\r\n return this._getHitData(bodyObject, bodyCenter, data);\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 const impostors = (<PhysicsEngineV1>this._physicsEngine).getImpostors();\r\n for (const impostor of impostors) {\r\n if (!this._getImpostorHitData(impostor, hitData)) {\r\n continue;\r\n }\r\n\r\n impostor.applyForce(hitData.force, hitData.contactPoint);\r\n }\r\n } else {\r\n const bodies = (<PhysicsEngineV2>this._physicsEngine).getBodies();\r\n for (const body of bodies) {\r\n body.iterateOverAllInstances((body: PhysicsBody, instanceIndex?: number) => {\r\n if (!this._getBodyHitData(body, hitData, instanceIndex)) {\r\n return;\r\n }\r\n\r\n body.applyForce(hitData.force, hitData.contactPoint, hitData.instanceIndex);\r\n });\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 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 const 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 const 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\n// eslint-disable-next-line @typescript-eslint/naming-convention\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 * For an instanced physics body (mesh with thin instances), the index of the thin instance the hit applies to\r\n */\r\n instanceIndex?: 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\n// eslint-disable-next-line @typescript-eslint/naming-convention\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\n// eslint-disable-next-line @typescript-eslint/naming-convention\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\n// eslint-disable-next-line @typescript-eslint/naming-convention\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\n// eslint-disable-next-line @typescript-eslint/naming-convention\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\n// eslint-disable-next-line @typescript-eslint/naming-convention\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\n// eslint-disable-next-line @typescript-eslint/naming-convention\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"]}
|
|
1
|
+
{"version":3,"file":"physicsHelper.js","sourceRoot":"","sources":["../../../../dev/core/src/Physics/physicsHelper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAG3D,OAAO,EAAE,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AEG;QACH,aAAQ,GAAW,EAAE,CAAC;QAEtB;;WAEG;QACH,WAAM,GAAW,EAAE,CAAC;QAEpB;;WAEG;QACH,gBAAW,qCAAiD;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,IAAkB,2BAKjB;AALD,WAAkB,2BAA2B;IACzC,4EAA4E;IAC5E,qFAAQ,CAAA;IACR,uEAAuE;IACvE,iFAAM,CAAA;AACV,CAAC,EALiB,2BAA2B,KAA3B,2BAA2B,QAK5C;AAED;;;GAGG;AACH,MAAM,CAAN,IAAkB,kBAKjB;AALD,WAAkB,kBAAkB;IAChC,wFAAwF;IACxF,+DAAM,CAAA;IACN,2HAA2H;IAC3H,6EAAa,CAAA;AACjB,CAAC,EALiB,kBAAkB,KAAlB,kBAAkB,QAKnC","sourcesContent":["import type { Nullable } from \"../types\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport { TmpVectors, 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\nimport { PhysicsMotionType } from \"./v2/IPhysicsEnginePlugin\";\r\n\r\nclass HelperTools {\r\n /*\r\n * Gets the hit contact point between a mesh and a ray. The method varies between\r\n * the different plugin versions; V1 uses a mesh intersection, V2 uses the physics body instance/object center (to avoid a raycast and improve perf).\r\n */\r\n static GetContactPointToRef(mesh: AbstractMesh, origin: Vector3, direction: Vector3, result: Vector3, instanceIndex?: number): boolean {\r\n const engine = mesh.getScene().getPhysicsEngine();\r\n const pluginVersion = engine?.getPluginVersion();\r\n if (pluginVersion === 1) {\r\n const ray = new Ray(origin, direction);\r\n const hit = ray.intersectsMesh(mesh);\r\n if (hit.hit && hit.pickedPoint) {\r\n result.copyFrom(hit.pickedPoint);\r\n return true;\r\n }\r\n } else if (pluginVersion === 2) {\r\n mesh.physicsBody!.getObjectCenterWorldToRef(result, instanceIndex);\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n /**\r\n * Checks if a body will be affected by forces\r\n * @param body the body to check\r\n * @param instanceIndex for instanced bodies, the index of the instance to check\r\n * @returns\r\n */\r\n static HasAppliedForces(body: PhysicsBody, instanceIndex?: number) {\r\n const mesh = body.transformNode as Mesh;\r\n return (\r\n body.getMotionType(instanceIndex) === PhysicsMotionType.STATIC ||\r\n (body.getMassProperties(instanceIndex)?.mass ?? 0) === 0 ||\r\n (mesh && mesh.getTotalVertices && mesh.getTotalVertices() === 0)\r\n );\r\n }\r\n\r\n /**\r\n * Checks if a point is inside a cylinder\r\n * @param point point to check\r\n * @param origin cylinder origin on the bottom\r\n * @param radius cylinder radius\r\n * @param height cylinder height\r\n * @returns\r\n */\r\n static IsInsideCylinder(point: Vector3, origin: Vector3, radius: number, height: number): boolean {\r\n const distance = TmpVectors.Vector3[0];\r\n point.subtractToRef(origin, distance);\r\n return Math.abs(distance.x) <= radius && Math.abs(distance.z) <= radius && distance.y >= 0 && distance.y <= height;\r\n }\r\n}\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 for (const impostor of impostors) {\r\n if (!event.getImpostorHitData(impostor, origin, hitData)) {\r\n continue;\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 this._applicationForBodies(event, origin, hitData, useCallback, (body: PhysicsBody, hitData: PhysicsHitData) => {\r\n body.applyImpulse(hitData.force, hitData.contactPoint, hitData.instanceIndex);\r\n });\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 for (const impostor of impostors) {\r\n if (!event.getImpostorHitData(impostor, origin, hitData)) {\r\n continue;\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 this._applicationForBodies(event, origin, hitData, useCallback, (body: PhysicsBody, hitData: PhysicsHitData) => {\r\n body.applyForce(hitData.force, hitData.contactPoint, hitData.instanceIndex);\r\n });\r\n }\r\n\r\n event.dispose(false);\r\n\r\n return event;\r\n }\r\n\r\n private _applicationForBodies(\r\n event: PhysicsRadialExplosionEvent,\r\n origin: Vector3,\r\n hitData: PhysicsHitData,\r\n useCallback: boolean,\r\n fnApplication: (body: PhysicsBody, hitData: PhysicsHitData, instanceIndex?: number) => void\r\n ) {\r\n const affectedBodiesWithData = Array<PhysicsAffectedBodyWithData>();\r\n const bodies = (<PhysicsEngineV2>this._physicsEngine).getBodies();\r\n for (const body of bodies) {\r\n body.iterateOverAllInstances((body, instanceIndex) => {\r\n if (!event.getBodyHitData(body, origin, hitData, instanceIndex)) {\r\n return;\r\n }\r\n fnApplication(body, hitData);\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\r\n event.triggerAffectedBodiesCallback(affectedBodiesWithData);\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, instanceIndex: data.instanceIndex };\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(\r\n private _scene: Scene,\r\n private _options: PhysicsRadialExplosionEventOptions\r\n ) {\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 = TmpVectors.Vector3[0];\r\n direction.copyFrom(center).subtractInPlace(origin);\r\n\r\n const contactPoint = TmpVectors.Vector3[1];\r\n const hasContactPoint = HelperTools.GetContactPointToRef(mesh, origin, direction, contactPoint, data.instanceIndex);\r\n\r\n if (!hasContactPoint) {\r\n return false;\r\n }\r\n\r\n const distanceFromOrigin = Vector3.Distance(origin, contactPoint);\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 // Direction x multiplier equals force\r\n direction.scaleInPlace(multiplier);\r\n\r\n data.force.copyFrom(direction);\r\n data.contactPoint.copyFrom(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 where the transform node is an AbstractMesh\r\n * @param origin the origin of the explosion\r\n * @param data the data of the hit\r\n * @param instanceIndex the instance index of the body\r\n * @returns if there was a hit\r\n */\r\n public getBodyHitData(body: PhysicsBody, origin: Vector3, data: PhysicsHitData, instanceIndex?: number): boolean {\r\n // No force will be applied in these cases, so we skip calculation\r\n if (HelperTools.HasAppliedForces(body, instanceIndex)) {\r\n return false;\r\n }\r\n\r\n const mesh = body.transformNode as AbstractMesh;\r\n const bodyObjectCenter = body.getObjectCenterWorld(instanceIndex);\r\n data.instanceIndex = instanceIndex;\r\n return this._getHitData(mesh, bodyObjectCenter, origin, data);\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 * @param data the data of the hit\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 (this._sphere) {\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\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(\r\n private _physicsHelper: PhysicsHelper,\r\n private _scene: Scene,\r\n private _origin: Vector3,\r\n private _options: PhysicsRadialExplosionEventOptions\r\n ) {\r\n this._options = { ...new PhysicsRadialExplosionEventOptions(), ...this._options };\r\n\r\n this._tickCallback = () => this._tick();\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 (!this._sphere) {\r\n return;\r\n }\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 = 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 | undefined;\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(\r\n private _scene: Scene,\r\n private _origin: Vector3,\r\n private _options: PhysicsUpdraftEventOptions\r\n ) {\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();\r\n\r\n if (this._physicsEngine.getPluginVersion() === 1) {\r\n this._prepareCylinder();\r\n }\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 this._cylinder = undefined;\r\n } else {\r\n setTimeout(() => {\r\n if (!this._dataFetched && this._cylinder) {\r\n this._cylinder.dispose();\r\n this._cylinder = undefined;\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.copyFrom(force);\r\n data.contactPoint.copyFrom(center);\r\n data.distanceFromOrigin = distanceFromOrigin;\r\n }\r\n\r\n private _getBodyHitData(body: PhysicsBody, data: PhysicsHitData, instanceIndex?: number): boolean {\r\n if (HelperTools.HasAppliedForces(body, instanceIndex)) {\r\n return false;\r\n }\r\n\r\n const center = body.getObjectCenterWorld(instanceIndex);\r\n\r\n if (!HelperTools.IsInsideCylinder(center, this._origin, this._options.radius, this._options.height)) {\r\n return false;\r\n }\r\n\r\n data.instanceIndex = instanceIndex;\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 const impostors = (<PhysicsEngineV1>this._physicsEngine).getImpostors();\r\n for (const impostor of impostors) {\r\n if (!this._getImpostorHitData(impostor, hitData)) {\r\n continue;\r\n }\r\n\r\n impostor.applyForce(hitData.force, hitData.contactPoint);\r\n }\r\n } else {\r\n // V2\r\n const bodies = (<PhysicsEngineV2>this._physicsEngine).getBodies();\r\n for (const body of bodies) {\r\n body.iterateOverAllInstances((body, instanceIndex) => {\r\n if (!this._getBodyHitData(body, hitData, instanceIndex)) {\r\n return;\r\n }\r\n\r\n body.applyForce(hitData.force, hitData.contactPoint, hitData.instanceIndex);\r\n });\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 if (!this._cylinder) {\r\n return false;\r\n }\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(\r\n private _scene: Scene,\r\n private _origin: Vector3,\r\n private _options: PhysicsVortexEventOptions\r\n ) {\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();\r\n\r\n if (this._physicsEngine.getPluginVersion() === 1) {\r\n this._prepareCylinder();\r\n }\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 vortex.\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 vortex 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(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 = TmpVectors.Vector3[0];\r\n center.subtractToRef(originOnPlane, originToImpostorDirection);\r\n\r\n const contactPoint = TmpVectors.Vector3[1];\r\n const hasContactPoint = HelperTools.GetContactPointToRef(mesh, originOnPlane, originToImpostorDirection, contactPoint, data.instanceIndex);\r\n if (!hasContactPoint) {\r\n return false;\r\n }\r\n const distance = Vector3.Distance(contactPoint, originOnPlane);\r\n const absoluteDistanceFromOrigin = distance / this._options.radius;\r\n\r\n const directionToOrigin = TmpVectors.Vector3[2];\r\n contactPoint.normalizeToRef(directionToOrigin);\r\n if (absoluteDistanceFromOrigin > this._options.centripetalForceThreshold) {\r\n directionToOrigin.negateInPlace();\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 const force = TmpVectors.Vector3[3];\r\n force.set(forceX, forceY, forceZ);\r\n force.scaleInPlace(this._options.strength);\r\n\r\n data.force.copyFrom(force);\r\n data.contactPoint.copyFrom(center);\r\n data.distanceFromOrigin = absoluteDistanceFromOrigin;\r\n return true;\r\n }\r\n\r\n private _getBodyHitData(body: PhysicsBody, data: PhysicsHitData, instanceIndex?: number): boolean {\r\n if (HelperTools.HasAppliedForces(body, instanceIndex)) {\r\n return false;\r\n }\r\n\r\n const bodyObject = body.transformNode as AbstractMesh;\r\n const bodyCenter = body.getObjectCenterWorld(instanceIndex);\r\n\r\n if (!HelperTools.IsInsideCylinder(bodyCenter, this._origin, this._options.radius, this._options.height)) {\r\n return false;\r\n }\r\n\r\n data.instanceIndex = instanceIndex;\r\n return this._getHitData(bodyObject, bodyCenter, data);\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 const impostors = (<PhysicsEngineV1>this._physicsEngine).getImpostors();\r\n for (const impostor of impostors) {\r\n if (!this._getImpostorHitData(impostor, hitData)) {\r\n continue;\r\n }\r\n\r\n impostor.applyForce(hitData.force, hitData.contactPoint);\r\n }\r\n } else {\r\n const bodies = (<PhysicsEngineV2>this._physicsEngine).getBodies();\r\n for (const body of bodies) {\r\n body.iterateOverAllInstances((body: PhysicsBody, instanceIndex?: number) => {\r\n if (!this._getBodyHitData(body, hitData, instanceIndex)) {\r\n return;\r\n }\r\n\r\n body.applyForce(hitData.force, hitData.contactPoint, hitData.instanceIndex);\r\n });\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 for 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 * Callback that is triggered when the radial explosion affects impostors.\r\n */\r\n affectedImpostorsCallback: (affectedImpostorsWithData: Array<PhysicsAffectedImpostorWithData>) => void;\r\n\r\n /**\r\n * Callback that is triggered when the radial explosion affects bodies.\r\n */\r\n affectedBodiesCallback: (affectedBodiesWithData: Array<PhysicsAffectedBodyWithData>) => void;\r\n}\r\n\r\n/**\r\n * Options for 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 updraft.\r\n */\r\n updraftMode: PhysicsUpdraftMode = PhysicsUpdraftMode.Center;\r\n}\r\n\r\n/**\r\n * Options for 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 const 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 const 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\n// eslint-disable-next-line @typescript-eslint/naming-convention\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 * For an instanced physics body (mesh with thin instances), the index of the thin instance the hit applies to\r\n */\r\n instanceIndex?: 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\n// eslint-disable-next-line @typescript-eslint/naming-convention\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\n// eslint-disable-next-line @typescript-eslint/naming-convention\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\n// eslint-disable-next-line @typescript-eslint/naming-convention\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\n// eslint-disable-next-line @typescript-eslint/naming-convention\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\n// eslint-disable-next-line @typescript-eslint/naming-convention\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\n// eslint-disable-next-line @typescript-eslint/naming-convention\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"]}
|
|
@@ -20,5 +20,12 @@ export class ShapeCastResult extends CastingResult {
|
|
|
20
20
|
setHitFraction(fraction) {
|
|
21
21
|
this._hitFraction = fraction;
|
|
22
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* Resets all the values to default
|
|
25
|
+
*/
|
|
26
|
+
reset() {
|
|
27
|
+
super.reset();
|
|
28
|
+
this._hitFraction = 0;
|
|
29
|
+
}
|
|
23
30
|
}
|
|
24
31
|
//# sourceMappingURL=shapeCastResult.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shapeCastResult.js","sourceRoot":"","sources":["../../../../dev/core/src/Physics/shapeCastResult.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD;;GAEG;AACH,MAAM,OAAO,eAAgB,SAAQ,aAAa;IAAlD;;QACY,iBAAY,GAAW,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"shapeCastResult.js","sourceRoot":"","sources":["../../../../dev/core/src/Physics/shapeCastResult.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD;;GAEG;AACH,MAAM,OAAO,eAAgB,SAAQ,aAAa;IAAlD;;QACY,iBAAY,GAAW,CAAC,CAAC;IAwBrC,CAAC;IAtBG;;OAEG;IACH,IAAI,WAAW;QACX,OAAO,IAAI,CAAC,YAAY,CAAC;IAC7B,CAAC;IAED;;;OAGG;IACI,cAAc,CAAC,QAAgB;QAClC,IAAI,CAAC,YAAY,GAAG,QAAQ,CAAC;IACjC,CAAC;IAED;;OAEG;IACa,KAAK;QACjB,KAAK,CAAC,KAAK,EAAE,CAAC;QACd,IAAI,CAAC,YAAY,GAAG,CAAC,CAAC;IAC1B,CAAC;CACJ","sourcesContent":["import { CastingResult } from \"./castingResult\";\r\n\r\n/**\r\n * Class representing a contact point produced in a shape cast\r\n */\r\nexport class ShapeCastResult extends CastingResult {\r\n private _hitFraction: number = 0;\r\n\r\n /**\r\n * Gets the hit fraction along the casting ray\r\n */\r\n get hitFraction(): number {\r\n return this._hitFraction;\r\n }\r\n\r\n /**\r\n * Sets the hit fraction along the casting ray\r\n * @param fraction\r\n */\r\n public setHitFraction(fraction: number) {\r\n this._hitFraction = fraction;\r\n }\r\n\r\n /**\r\n * Resets all the values to default\r\n */\r\n public override reset() {\r\n super.reset();\r\n this._hitFraction = 0;\r\n }\r\n}\r\n"]}
|
|
@@ -12,18 +12,56 @@ import type { Observable } from "../../Misc/observable.js";
|
|
|
12
12
|
import type { GroundMesh } from "../../Meshes/groundMesh.js";
|
|
13
13
|
/** How a specific axis can be constrained */
|
|
14
14
|
export declare enum PhysicsConstraintAxisLimitMode {
|
|
15
|
+
/**
|
|
16
|
+
* The axis is not restricted at all
|
|
17
|
+
*/
|
|
15
18
|
FREE = 0,
|
|
19
|
+
/**
|
|
20
|
+
* The axis has a minimum/maximum limit
|
|
21
|
+
*/
|
|
16
22
|
LIMITED = 1,
|
|
23
|
+
/**
|
|
24
|
+
* The axis allows no relative movement of the pivots
|
|
25
|
+
*/
|
|
17
26
|
LOCKED = 2
|
|
18
27
|
}
|
|
19
28
|
/** The constraint specific axis to use when setting Friction, `ConstraintAxisLimitMode`, max force, ... */
|
|
20
29
|
export declare enum PhysicsConstraintAxis {
|
|
30
|
+
/**
|
|
31
|
+
* Translation along the primary axis of the constraint (i.e. the
|
|
32
|
+
* direction specified by PhysicsConstraintParameters.axisA/axisB)
|
|
33
|
+
*/
|
|
21
34
|
LINEAR_X = 0,
|
|
35
|
+
/**
|
|
36
|
+
* Translation along the second axis of the constraint (i.e. the
|
|
37
|
+
* direction specified by PhysicsConstraintParameters.perpAxisA/perpAxisB)
|
|
38
|
+
*/
|
|
22
39
|
LINEAR_Y = 1,
|
|
40
|
+
/**
|
|
41
|
+
* Translation along the third axis of the constraint. This axis is
|
|
42
|
+
* computed from the cross product of axisA/axisB and perpAxisA/perpAxisB)
|
|
43
|
+
*/
|
|
23
44
|
LINEAR_Z = 2,
|
|
45
|
+
/**
|
|
46
|
+
* Rotation around the primary axis of the constraint (i.e. the
|
|
47
|
+
* axis specified by PhysicsConstraintParameters.axisA/axisB)
|
|
48
|
+
*/
|
|
24
49
|
ANGULAR_X = 3,
|
|
50
|
+
/**
|
|
51
|
+
* Rotation around the second axis of the constraint (i.e. the
|
|
52
|
+
* axis specified by PhysicsConstraintParameters.perpAxisA/perpAxisB)
|
|
53
|
+
*/
|
|
25
54
|
ANGULAR_Y = 4,
|
|
55
|
+
/**
|
|
56
|
+
* Rotation around the third axis of the constraint. This axis is
|
|
57
|
+
* computed from the cross product of axisA/axisB and perpAxisA/perpAxisB)
|
|
58
|
+
*/
|
|
26
59
|
ANGULAR_Z = 5,
|
|
60
|
+
/**
|
|
61
|
+
* A 3D distance limit; similar to specifying the LINEAR_X/Y/Z axes
|
|
62
|
+
* individually, but the distance calculation uses all three axes
|
|
63
|
+
* simultaneously, instead of individually.
|
|
64
|
+
*/
|
|
27
65
|
LINEAR_DISTANCE = 6
|
|
28
66
|
}
|
|
29
67
|
/** Type of Constraint */
|
|
@@ -54,7 +92,16 @@ export declare enum PhysicsConstraintType {
|
|
|
54
92
|
* up between both bodies, allowing no relative movement.
|
|
55
93
|
*/
|
|
56
94
|
LOCK = 5,
|
|
95
|
+
/**
|
|
96
|
+
* A prismatic will lock the rotations of the bodies, and allow translation
|
|
97
|
+
* only along one axis
|
|
98
|
+
*/
|
|
57
99
|
PRISMATIC = 6,
|
|
100
|
+
/**
|
|
101
|
+
* A generic constraint; this starts with no limits on how the bodies can
|
|
102
|
+
* move relative to each other, but limits can be added via the PhysicsConstraint
|
|
103
|
+
* interfaces. This can be used to specify a large variety of constraints
|
|
104
|
+
*/
|
|
58
105
|
SIX_DOF = 7
|
|
59
106
|
}
|
|
60
107
|
/** Type of Shape */
|
|
@@ -111,7 +158,7 @@ export interface IBasePhysicsCollisionEvent {
|
|
|
111
158
|
*/
|
|
112
159
|
export interface IPhysicsCollisionEvent extends IBasePhysicsCollisionEvent {
|
|
113
160
|
/**
|
|
114
|
-
* World position where the collision
|
|
161
|
+
* World position where the collision occurred
|
|
115
162
|
*/
|
|
116
163
|
point: Nullable<Vector3>;
|
|
117
164
|
/**
|
|
@@ -152,7 +199,7 @@ export interface PhysicsShapeParameters {
|
|
|
152
199
|
*/
|
|
153
200
|
rotation?: Quaternion;
|
|
154
201
|
/**
|
|
155
|
-
*
|
|
202
|
+
* Dimension extents for the box
|
|
156
203
|
*/
|
|
157
204
|
extents?: Vector3;
|
|
158
205
|
/**
|
|
@@ -221,7 +268,7 @@ export interface PhysicsConstraintParameters {
|
|
|
221
268
|
*/
|
|
222
269
|
perpAxisB?: Vector3;
|
|
223
270
|
/**
|
|
224
|
-
* The maximum distance that can
|
|
271
|
+
* The maximum distance that can separate the two pivots.
|
|
225
272
|
* Only used for DISTANCE constraints
|
|
226
273
|
*/
|
|
227
274
|
maxDistance?: number;
|
|
@@ -259,7 +306,7 @@ export interface PhysicsMassProperties {
|
|
|
259
306
|
* The principal moments of inertia of this object
|
|
260
307
|
* for a unit mass. This determines how easy it is
|
|
261
308
|
* for the body to rotate. A value of zero on any
|
|
262
|
-
* axis will be used as infinite
|
|
309
|
+
* axis will be used as infinite inertia about that
|
|
263
310
|
* axis.
|
|
264
311
|
*
|
|
265
312
|
* If not provided, the physics engine will compute
|