@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
|
@@ -133,7 +133,7 @@ export interface INavigationEnginePlugin {
|
|
|
133
133
|
getTimeStep(): number;
|
|
134
134
|
/**
|
|
135
135
|
* If delta time in navigation tick update is greater than the time step
|
|
136
|
-
* a number of sub iterations are done. If more iterations are
|
|
136
|
+
* a number of sub iterations are done. If more iterations are needed to reach deltatime
|
|
137
137
|
* they will be discarded.
|
|
138
138
|
* A value of 0 will set to no maximum and update will use as many substeps as needed
|
|
139
139
|
* @param newStepCount the maximum number of iterations
|
|
@@ -410,7 +410,7 @@ export interface INavMeshParameters {
|
|
|
410
410
|
*/
|
|
411
411
|
detailSampleMaxError: number;
|
|
412
412
|
/**
|
|
413
|
-
* If using obstacles, the navmesh must be subdivided
|
|
413
|
+
* If using obstacles, the navmesh must be subdivided internally by tiles.
|
|
414
414
|
* This member defines the tile cube side length in world units.
|
|
415
415
|
* If no obstacles are needed, leave it undefined or 0.
|
|
416
416
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"INavigationEngine.js","sourceRoot":"","sources":["../../../../dev/core/src/Navigation/INavigationEngine.ts"],"names":[],"mappings":"","sourcesContent":["import type { TransformNode } from \"../Meshes/transformNode\";\r\nimport type { Vector3 } from \"../Maths/math\";\r\nimport type { Mesh } from \"../Meshes/mesh\";\r\nimport type { Scene } from \"../scene\";\r\nimport type { Nullable } from \"../types\";\r\n\r\n/**\r\n * Navigation plugin interface to add navigation constrained by a navigation mesh\r\n */\r\nexport interface INavigationEnginePlugin {\r\n /**\r\n * plugin name\r\n */\r\n name: string;\r\n\r\n /**\r\n * Creates a navigation mesh\r\n * @param meshes array of all the geometry used to compute the navigation mesh\r\n * @param parameters bunch of parameters used to filter geometry\r\n */\r\n createNavMesh(meshes: Array<Mesh>, parameters: INavMeshParameters): void;\r\n\r\n /**\r\n * Create a navigation mesh debug mesh\r\n * @param scene is where the mesh will be added\r\n * @returns debug display mesh\r\n */\r\n createDebugNavMesh(scene: Scene): Mesh;\r\n\r\n /**\r\n * Get a navigation mesh constrained position, closest to the parameter position\r\n * @param position world position\r\n * @returns the closest point to position constrained by the navigation mesh\r\n */\r\n getClosestPoint(position: Vector3): Vector3;\r\n\r\n /**\r\n * Get a navigation mesh constrained position, closest to the parameter position\r\n * @param position world position\r\n * @param result output the closest point to position constrained by the navigation mesh\r\n */\r\n getClosestPointToRef(position: Vector3, result: Vector3): void;\r\n\r\n /**\r\n * Get a navigation mesh constrained position, within a particular radius\r\n * @param position world position\r\n * @param maxRadius the maximum distance to the constrained world position\r\n * @returns the closest point to position constrained by the navigation mesh\r\n */\r\n getRandomPointAround(position: Vector3, maxRadius: number): Vector3;\r\n\r\n /**\r\n * Get a navigation mesh constrained position, within a particular radius\r\n * @param position world position\r\n * @param maxRadius the maximum distance to the constrained world position\r\n * @param result output the closest point to position constrained by the navigation mesh\r\n */\r\n getRandomPointAroundToRef(position: Vector3, maxRadius: number, result: Vector3): void;\r\n\r\n /**\r\n * Compute the final position from a segment made of destination-position\r\n * @param position world position\r\n * @param destination world position\r\n * @returns the resulting point along the navmesh\r\n */\r\n moveAlong(position: Vector3, destination: Vector3): Vector3;\r\n\r\n /**\r\n * Compute the final position from a segment made of destination-position\r\n * @param position world position\r\n * @param destination world position\r\n * @param result output the resulting point along the navmesh\r\n */\r\n moveAlongToRef(position: Vector3, destination: Vector3, result: Vector3): void;\r\n\r\n /**\r\n * Compute a navigation path from start to end. Returns an empty array if no path can be computed.\r\n * Path is straight.\r\n * @param start world position\r\n * @param end world position\r\n * @returns array containing world position composing the path\r\n */\r\n computePath(start: Vector3, end: Vector3): Vector3[];\r\n\r\n /**\r\n * Compute a navigation path from start to end. Returns an empty array if no path can be computed.\r\n * Path follows navigation mesh geometry.\r\n * @param start world position\r\n * @param end world position\r\n * @returns array containing world position composing the path\r\n */\r\n computePathSmooth(start: Vector3, end: Vector3): Vector3[];\r\n\r\n /**\r\n * If this plugin is supported\r\n * @returns true if plugin is supported\r\n */\r\n isSupported(): boolean;\r\n\r\n /**\r\n * Create a new Crowd so you can add agents\r\n * @param maxAgents the maximum agent count in the crowd\r\n * @param maxAgentRadius the maximum radius an agent can have\r\n * @param scene to attach the crowd to\r\n * @returns the crowd you can add agents to\r\n */\r\n createCrowd(maxAgents: number, maxAgentRadius: number, scene: Scene): ICrowd;\r\n\r\n /**\r\n * Set the Bounding box extent for doing spatial queries (getClosestPoint, getRandomPointAround, ...)\r\n * The queries will try to find a solution within those bounds\r\n * default is (1,1,1)\r\n * @param extent x,y,z value that define the extent around the queries point of reference\r\n */\r\n setDefaultQueryExtent(extent: Vector3): void;\r\n\r\n /**\r\n * Get the Bounding box extent specified by setDefaultQueryExtent\r\n * @returns the box extent values\r\n */\r\n getDefaultQueryExtent(): Vector3;\r\n\r\n /**\r\n * build the navmesh from a previously saved state using getNavmeshData\r\n * @param data the Uint8Array returned by getNavmeshData\r\n */\r\n buildFromNavmeshData(data: Uint8Array): void;\r\n\r\n /**\r\n * returns the navmesh data that can be used later. The navmesh must be built before retrieving the data\r\n * @returns data the Uint8Array that can be saved and reused\r\n */\r\n getNavmeshData(): Uint8Array;\r\n\r\n /**\r\n * Get the Bounding box extent result specified by setDefaultQueryExtent\r\n * @param result output the box extent values\r\n */\r\n getDefaultQueryExtentToRef(result: Vector3): void;\r\n\r\n /**\r\n * Set the time step of the navigation tick update.\r\n * Default is 1/60.\r\n * A value of 0 will disable fixed time update\r\n * @param newTimeStep the new timestep to apply to this world.\r\n */\r\n setTimeStep(newTimeStep: number): void;\r\n\r\n /**\r\n * Get the time step of the navigation tick update.\r\n * @returns the current time step\r\n */\r\n getTimeStep(): number;\r\n\r\n /**\r\n * If delta time in navigation tick update is greater than the time step\r\n * a number of sub iterations are done. If more iterations are need to reach deltatime\r\n * they will be discarded.\r\n * A value of 0 will set to no maximum and update will use as many substeps as needed\r\n * @param newStepCount the maximum number of iterations\r\n */\r\n setMaximumSubStepCount(newStepCount: number): void;\r\n\r\n /**\r\n * Get the maximum number of iterations per navigation tick update\r\n * @returns the maximum number of iterations\r\n */\r\n getMaximumSubStepCount(): number;\r\n\r\n /**\r\n * Creates a cylinder obstacle and add it to the navigation\r\n * @param position world position\r\n * @param radius cylinder radius\r\n * @param height cylinder height\r\n * @returns the obstacle freshly created\r\n */\r\n addCylinderObstacle(position: Vector3, radius: number, height: number): Nullable<IObstacle>;\r\n\r\n /**\r\n * Creates an oriented box obstacle and add it to the navigation\r\n * @param position world position\r\n * @param extent box size\r\n * @param angle angle in radians of the box orientation on Y axis\r\n * @returns the obstacle freshly created\r\n */\r\n addBoxObstacle(position: Vector3, extent: Vector3, angle: number): Nullable<IObstacle>;\r\n\r\n /**\r\n * Removes an obstacle created by addCylinderObstacle or addBoxObstacle\r\n * @param obstacle obstacle to remove from the navigation\r\n */\r\n removeObstacle(obstacle: IObstacle): void;\r\n\r\n /**\r\n * Release all resources\r\n */\r\n dispose(): void;\r\n}\r\n\r\n/**\r\n * Obstacle type\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport type IObstacle =\r\n | {\r\n type: \"box\";\r\n ref: unknown;\r\n position: Vector3;\r\n halfExtents: Vector3;\r\n angle: number;\r\n }\r\n | {\r\n type: \"cylinder\";\r\n ref: unknown;\r\n position: Vector3;\r\n radius: number;\r\n height: number;\r\n };\r\n\r\n/**\r\n * Crowd Interface. A Crowd is a collection of moving agents constrained by a navigation mesh\r\n */\r\nexport interface ICrowd {\r\n /**\r\n * Add a new agent to the crowd with the specified parameter a corresponding transformNode.\r\n * You can attach anything to that node. The node position is updated in the scene update tick.\r\n * @param pos world position that will be constrained by the navigation mesh\r\n * @param parameters agent parameters\r\n * @param transform hooked to the agent that will be update by the scene\r\n * @returns agent index\r\n */\r\n addAgent(pos: Vector3, parameters: IAgentParameters, transform: TransformNode): number;\r\n\r\n /**\r\n * Returns the agent position in world space\r\n * @param index agent index returned by addAgent\r\n * @returns world space position\r\n */\r\n getAgentPosition(index: number): Vector3;\r\n\r\n /**\r\n * Gets the agent position result in world space\r\n * @param index agent index returned by addAgent\r\n * @param result output world space position\r\n */\r\n getAgentPositionToRef(index: number, result: Vector3): void;\r\n\r\n /**\r\n * Gets the agent velocity in world space\r\n * @param index agent index returned by addAgent\r\n * @returns world space velocity\r\n */\r\n getAgentVelocity(index: number): Vector3;\r\n\r\n /**\r\n * Gets the agent velocity result in world space\r\n * @param index agent index returned by addAgent\r\n * @param result output world space velocity\r\n */\r\n getAgentVelocityToRef(index: number, result: Vector3): void;\r\n\r\n /**\r\n * Gets the agent next target point on the path\r\n * @param index agent index returned by addAgent\r\n * @returns world space position\r\n */\r\n getAgentNextTargetPath(index: number): Vector3;\r\n\r\n /**\r\n * Gets the agent state\r\n * @param index agent index returned by addAgent\r\n * @returns agent state\r\n */\r\n getAgentState(index: number): number;\r\n\r\n /**\r\n * returns true if the agent in over an off mesh link connection\r\n * @param index agent index returned by addAgent\r\n * @returns true if over an off mesh link connection\r\n */\r\n overOffmeshConnection(index: number): boolean;\r\n\r\n /**\r\n * Gets the agent next target point on the path\r\n * @param index agent index returned by addAgent\r\n * @param result output world space position\r\n */\r\n getAgentNextTargetPathToRef(index: number, result: Vector3): void;\r\n\r\n /**\r\n * remove a particular agent previously created\r\n * @param index agent index returned by addAgent\r\n */\r\n removeAgent(index: number): void;\r\n\r\n /**\r\n * get the list of all agents attached to this crowd\r\n * @returns list of agent indices\r\n */\r\n getAgents(): number[];\r\n\r\n /**\r\n * Tick update done by the Scene. Agent position/velocity/acceleration is updated by this function\r\n * @param deltaTime in seconds\r\n */\r\n update(deltaTime: number): void;\r\n\r\n /**\r\n * Asks a particular agent to go to a destination. That destination is constrained by the navigation mesh\r\n * @param index agent index returned by addAgent\r\n * @param destination targeted world position\r\n */\r\n agentGoto(index: number, destination: Vector3): void;\r\n\r\n /**\r\n * Teleport the agent to a new position\r\n * @param index agent index returned by addAgent\r\n * @param destination targeted world position\r\n */\r\n agentTeleport(index: number, destination: Vector3): void;\r\n\r\n /**\r\n * Update agent parameters\r\n * @param index agent index returned by addAgent\r\n * @param parameters agent parameters\r\n */\r\n updateAgentParameters(index: number, parameters: IAgentParameters): void;\r\n\r\n /**\r\n * Set the Bounding box extent for doing spatial queries (getClosestPoint, getRandomPointAround, ...)\r\n * The queries will try to find a solution within those bounds\r\n * default is (1,1,1)\r\n * @param extent x,y,z value that define the extent around the queries point of reference\r\n */\r\n setDefaultQueryExtent(extent: Vector3): void;\r\n\r\n /**\r\n * Get the Bounding box extent specified by setDefaultQueryExtent\r\n * @returns the box extent values\r\n */\r\n getDefaultQueryExtent(): Vector3;\r\n\r\n /**\r\n * Get the Bounding box extent result specified by setDefaultQueryExtent\r\n * @param result output the box extent values\r\n */\r\n getDefaultQueryExtentToRef(result: Vector3): void;\r\n\r\n /**\r\n * Get the next corner points composing the path (max 4 points)\r\n * @param index agent index returned by addAgent\r\n * @returns array containing world position composing the path\r\n */\r\n getCorners(index: number): Vector3[];\r\n\r\n /**\r\n * Release all resources\r\n */\r\n dispose(): void;\r\n}\r\n\r\n/**\r\n * Configures an agent\r\n */\r\nexport interface IAgentParameters {\r\n /**\r\n * Agent radius. [Limit: >= 0]\r\n */\r\n radius: number;\r\n\r\n /**\r\n * Agent height. [Limit: > 0]\r\n */\r\n height: number;\r\n\r\n /**\r\n * Maximum allowed acceleration. [Limit: >= 0]\r\n */\r\n maxAcceleration: number;\r\n\r\n /**\r\n * Maximum allowed speed. [Limit: >= 0]\r\n */\r\n maxSpeed: number;\r\n\r\n /**\r\n * Defines how close a collision element must be before it is considered for steering behaviors. [Limits: > 0]\r\n */\r\n collisionQueryRange: number;\r\n\r\n /**\r\n * The path visibility optimization range. [Limit: > 0]\r\n */\r\n pathOptimizationRange: number;\r\n\r\n /**\r\n * How aggressive the agent manager should be at avoiding collisions with this agent. [Limit: >= 0]\r\n */\r\n separationWeight: number;\r\n\r\n /**\r\n * Observers will be notified when agent gets inside the virtual circle with this Radius around destination point.\r\n * Default is agent radius\r\n */\r\n reachRadius?: number;\r\n}\r\n\r\n/**\r\n * Configures the navigation mesh creation\r\n */\r\nexport interface INavMeshParameters {\r\n /**\r\n * The xz-plane cell size to use for fields. [Limit: > 0] [Units: wu]\r\n */\r\n cs: number;\r\n\r\n /**\r\n * The y-axis cell size to use for fields. [Limit: > 0] [Units: wu]\r\n */\r\n ch: number;\r\n\r\n /**\r\n * The maximum slope that is considered walkable. [Limits: 0 <= value < 90] [Units: Degrees]\r\n */\r\n walkableSlopeAngle: number;\r\n\r\n /**\r\n * Minimum floor to 'ceiling' height that will still allow the floor area to\r\n * be considered walkable. [Limit: >= 3] [Units: vx]\r\n */\r\n walkableHeight: number;\r\n\r\n /**\r\n * Maximum ledge height that is considered to still be traversable. [Limit: >=0] [Units: vx]\r\n */\r\n walkableClimb: number;\r\n\r\n /**\r\n * The distance to erode/shrink the walkable area of the heightfield away from\r\n * obstructions. [Limit: >=0] [Units: vx]\r\n */\r\n walkableRadius: number;\r\n\r\n /**\r\n * The maximum allowed length for contour edges along the border of the mesh. [Limit: >=0] [Units: vx]\r\n */\r\n maxEdgeLen: number;\r\n\r\n /**\r\n * The maximum distance a simplified contour's border edges should deviate\r\n * the original raw contour. [Limit: >=0] [Units: vx]\r\n */\r\n maxSimplificationError: number;\r\n\r\n /**\r\n * The minimum number of cells allowed to form isolated island areas. [Limit: >=0] [Units: vx]\r\n */\r\n minRegionArea: number;\r\n\r\n /**\r\n * Any regions with a span count smaller than this value will, if possible,\r\n * be merged with larger regions. [Limit: >=0] [Units: vx]\r\n */\r\n mergeRegionArea: number;\r\n\r\n /**\r\n * The maximum number of vertices allowed for polygons generated during the\r\n * contour to polygon conversion process. [Limit: >= 3]\r\n */\r\n maxVertsPerPoly: number;\r\n\r\n /**\r\n * Sets the sampling distance to use when generating the detail mesh.\r\n * (For height detail only.) [Limits: 0 or >= 0.9] [Units: wu]\r\n */\r\n detailSampleDist: number;\r\n\r\n /**\r\n * The maximum distance the detail mesh surface should deviate from heightfield\r\n * data. (For height detail only.) [Limit: >=0] [Units: wu]\r\n */\r\n detailSampleMaxError: number;\r\n\r\n /**\r\n * If using obstacles, the navmesh must be subdivided internaly by tiles.\r\n * This member defines the tile cube side length in world units.\r\n * If no obstacles are needed, leave it undefined or 0.\r\n */\r\n tileSize?: number;\r\n\r\n /**\r\n * The size of the non-navigable border around the heightfield.\r\n */\r\n borderSize?: number;\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"INavigationEngine.js","sourceRoot":"","sources":["../../../../dev/core/src/Navigation/INavigationEngine.ts"],"names":[],"mappings":"","sourcesContent":["import type { TransformNode } from \"../Meshes/transformNode\";\r\nimport type { Vector3 } from \"../Maths/math\";\r\nimport type { Mesh } from \"../Meshes/mesh\";\r\nimport type { Scene } from \"../scene\";\r\nimport type { Nullable } from \"../types\";\r\n\r\n/**\r\n * Navigation plugin interface to add navigation constrained by a navigation mesh\r\n */\r\nexport interface INavigationEnginePlugin {\r\n /**\r\n * plugin name\r\n */\r\n name: string;\r\n\r\n /**\r\n * Creates a navigation mesh\r\n * @param meshes array of all the geometry used to compute the navigation mesh\r\n * @param parameters bunch of parameters used to filter geometry\r\n */\r\n createNavMesh(meshes: Array<Mesh>, parameters: INavMeshParameters): void;\r\n\r\n /**\r\n * Create a navigation mesh debug mesh\r\n * @param scene is where the mesh will be added\r\n * @returns debug display mesh\r\n */\r\n createDebugNavMesh(scene: Scene): Mesh;\r\n\r\n /**\r\n * Get a navigation mesh constrained position, closest to the parameter position\r\n * @param position world position\r\n * @returns the closest point to position constrained by the navigation mesh\r\n */\r\n getClosestPoint(position: Vector3): Vector3;\r\n\r\n /**\r\n * Get a navigation mesh constrained position, closest to the parameter position\r\n * @param position world position\r\n * @param result output the closest point to position constrained by the navigation mesh\r\n */\r\n getClosestPointToRef(position: Vector3, result: Vector3): void;\r\n\r\n /**\r\n * Get a navigation mesh constrained position, within a particular radius\r\n * @param position world position\r\n * @param maxRadius the maximum distance to the constrained world position\r\n * @returns the closest point to position constrained by the navigation mesh\r\n */\r\n getRandomPointAround(position: Vector3, maxRadius: number): Vector3;\r\n\r\n /**\r\n * Get a navigation mesh constrained position, within a particular radius\r\n * @param position world position\r\n * @param maxRadius the maximum distance to the constrained world position\r\n * @param result output the closest point to position constrained by the navigation mesh\r\n */\r\n getRandomPointAroundToRef(position: Vector3, maxRadius: number, result: Vector3): void;\r\n\r\n /**\r\n * Compute the final position from a segment made of destination-position\r\n * @param position world position\r\n * @param destination world position\r\n * @returns the resulting point along the navmesh\r\n */\r\n moveAlong(position: Vector3, destination: Vector3): Vector3;\r\n\r\n /**\r\n * Compute the final position from a segment made of destination-position\r\n * @param position world position\r\n * @param destination world position\r\n * @param result output the resulting point along the navmesh\r\n */\r\n moveAlongToRef(position: Vector3, destination: Vector3, result: Vector3): void;\r\n\r\n /**\r\n * Compute a navigation path from start to end. Returns an empty array if no path can be computed.\r\n * Path is straight.\r\n * @param start world position\r\n * @param end world position\r\n * @returns array containing world position composing the path\r\n */\r\n computePath(start: Vector3, end: Vector3): Vector3[];\r\n\r\n /**\r\n * Compute a navigation path from start to end. Returns an empty array if no path can be computed.\r\n * Path follows navigation mesh geometry.\r\n * @param start world position\r\n * @param end world position\r\n * @returns array containing world position composing the path\r\n */\r\n computePathSmooth(start: Vector3, end: Vector3): Vector3[];\r\n\r\n /**\r\n * If this plugin is supported\r\n * @returns true if plugin is supported\r\n */\r\n isSupported(): boolean;\r\n\r\n /**\r\n * Create a new Crowd so you can add agents\r\n * @param maxAgents the maximum agent count in the crowd\r\n * @param maxAgentRadius the maximum radius an agent can have\r\n * @param scene to attach the crowd to\r\n * @returns the crowd you can add agents to\r\n */\r\n createCrowd(maxAgents: number, maxAgentRadius: number, scene: Scene): ICrowd;\r\n\r\n /**\r\n * Set the Bounding box extent for doing spatial queries (getClosestPoint, getRandomPointAround, ...)\r\n * The queries will try to find a solution within those bounds\r\n * default is (1,1,1)\r\n * @param extent x,y,z value that define the extent around the queries point of reference\r\n */\r\n setDefaultQueryExtent(extent: Vector3): void;\r\n\r\n /**\r\n * Get the Bounding box extent specified by setDefaultQueryExtent\r\n * @returns the box extent values\r\n */\r\n getDefaultQueryExtent(): Vector3;\r\n\r\n /**\r\n * build the navmesh from a previously saved state using getNavmeshData\r\n * @param data the Uint8Array returned by getNavmeshData\r\n */\r\n buildFromNavmeshData(data: Uint8Array): void;\r\n\r\n /**\r\n * returns the navmesh data that can be used later. The navmesh must be built before retrieving the data\r\n * @returns data the Uint8Array that can be saved and reused\r\n */\r\n getNavmeshData(): Uint8Array;\r\n\r\n /**\r\n * Get the Bounding box extent result specified by setDefaultQueryExtent\r\n * @param result output the box extent values\r\n */\r\n getDefaultQueryExtentToRef(result: Vector3): void;\r\n\r\n /**\r\n * Set the time step of the navigation tick update.\r\n * Default is 1/60.\r\n * A value of 0 will disable fixed time update\r\n * @param newTimeStep the new timestep to apply to this world.\r\n */\r\n setTimeStep(newTimeStep: number): void;\r\n\r\n /**\r\n * Get the time step of the navigation tick update.\r\n * @returns the current time step\r\n */\r\n getTimeStep(): number;\r\n\r\n /**\r\n * If delta time in navigation tick update is greater than the time step\r\n * a number of sub iterations are done. If more iterations are needed to reach deltatime\r\n * they will be discarded.\r\n * A value of 0 will set to no maximum and update will use as many substeps as needed\r\n * @param newStepCount the maximum number of iterations\r\n */\r\n setMaximumSubStepCount(newStepCount: number): void;\r\n\r\n /**\r\n * Get the maximum number of iterations per navigation tick update\r\n * @returns the maximum number of iterations\r\n */\r\n getMaximumSubStepCount(): number;\r\n\r\n /**\r\n * Creates a cylinder obstacle and add it to the navigation\r\n * @param position world position\r\n * @param radius cylinder radius\r\n * @param height cylinder height\r\n * @returns the obstacle freshly created\r\n */\r\n addCylinderObstacle(position: Vector3, radius: number, height: number): Nullable<IObstacle>;\r\n\r\n /**\r\n * Creates an oriented box obstacle and add it to the navigation\r\n * @param position world position\r\n * @param extent box size\r\n * @param angle angle in radians of the box orientation on Y axis\r\n * @returns the obstacle freshly created\r\n */\r\n addBoxObstacle(position: Vector3, extent: Vector3, angle: number): Nullable<IObstacle>;\r\n\r\n /**\r\n * Removes an obstacle created by addCylinderObstacle or addBoxObstacle\r\n * @param obstacle obstacle to remove from the navigation\r\n */\r\n removeObstacle(obstacle: IObstacle): void;\r\n\r\n /**\r\n * Release all resources\r\n */\r\n dispose(): void;\r\n}\r\n\r\n/**\r\n * Obstacle type\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport type IObstacle =\r\n | {\r\n type: \"box\";\r\n ref: unknown;\r\n position: Vector3;\r\n halfExtents: Vector3;\r\n angle: number;\r\n }\r\n | {\r\n type: \"cylinder\";\r\n ref: unknown;\r\n position: Vector3;\r\n radius: number;\r\n height: number;\r\n };\r\n\r\n/**\r\n * Crowd Interface. A Crowd is a collection of moving agents constrained by a navigation mesh\r\n */\r\nexport interface ICrowd {\r\n /**\r\n * Add a new agent to the crowd with the specified parameter a corresponding transformNode.\r\n * You can attach anything to that node. The node position is updated in the scene update tick.\r\n * @param pos world position that will be constrained by the navigation mesh\r\n * @param parameters agent parameters\r\n * @param transform hooked to the agent that will be update by the scene\r\n * @returns agent index\r\n */\r\n addAgent(pos: Vector3, parameters: IAgentParameters, transform: TransformNode): number;\r\n\r\n /**\r\n * Returns the agent position in world space\r\n * @param index agent index returned by addAgent\r\n * @returns world space position\r\n */\r\n getAgentPosition(index: number): Vector3;\r\n\r\n /**\r\n * Gets the agent position result in world space\r\n * @param index agent index returned by addAgent\r\n * @param result output world space position\r\n */\r\n getAgentPositionToRef(index: number, result: Vector3): void;\r\n\r\n /**\r\n * Gets the agent velocity in world space\r\n * @param index agent index returned by addAgent\r\n * @returns world space velocity\r\n */\r\n getAgentVelocity(index: number): Vector3;\r\n\r\n /**\r\n * Gets the agent velocity result in world space\r\n * @param index agent index returned by addAgent\r\n * @param result output world space velocity\r\n */\r\n getAgentVelocityToRef(index: number, result: Vector3): void;\r\n\r\n /**\r\n * Gets the agent next target point on the path\r\n * @param index agent index returned by addAgent\r\n * @returns world space position\r\n */\r\n getAgentNextTargetPath(index: number): Vector3;\r\n\r\n /**\r\n * Gets the agent state\r\n * @param index agent index returned by addAgent\r\n * @returns agent state\r\n */\r\n getAgentState(index: number): number;\r\n\r\n /**\r\n * returns true if the agent in over an off mesh link connection\r\n * @param index agent index returned by addAgent\r\n * @returns true if over an off mesh link connection\r\n */\r\n overOffmeshConnection(index: number): boolean;\r\n\r\n /**\r\n * Gets the agent next target point on the path\r\n * @param index agent index returned by addAgent\r\n * @param result output world space position\r\n */\r\n getAgentNextTargetPathToRef(index: number, result: Vector3): void;\r\n\r\n /**\r\n * remove a particular agent previously created\r\n * @param index agent index returned by addAgent\r\n */\r\n removeAgent(index: number): void;\r\n\r\n /**\r\n * get the list of all agents attached to this crowd\r\n * @returns list of agent indices\r\n */\r\n getAgents(): number[];\r\n\r\n /**\r\n * Tick update done by the Scene. Agent position/velocity/acceleration is updated by this function\r\n * @param deltaTime in seconds\r\n */\r\n update(deltaTime: number): void;\r\n\r\n /**\r\n * Asks a particular agent to go to a destination. That destination is constrained by the navigation mesh\r\n * @param index agent index returned by addAgent\r\n * @param destination targeted world position\r\n */\r\n agentGoto(index: number, destination: Vector3): void;\r\n\r\n /**\r\n * Teleport the agent to a new position\r\n * @param index agent index returned by addAgent\r\n * @param destination targeted world position\r\n */\r\n agentTeleport(index: number, destination: Vector3): void;\r\n\r\n /**\r\n * Update agent parameters\r\n * @param index agent index returned by addAgent\r\n * @param parameters agent parameters\r\n */\r\n updateAgentParameters(index: number, parameters: IAgentParameters): void;\r\n\r\n /**\r\n * Set the Bounding box extent for doing spatial queries (getClosestPoint, getRandomPointAround, ...)\r\n * The queries will try to find a solution within those bounds\r\n * default is (1,1,1)\r\n * @param extent x,y,z value that define the extent around the queries point of reference\r\n */\r\n setDefaultQueryExtent(extent: Vector3): void;\r\n\r\n /**\r\n * Get the Bounding box extent specified by setDefaultQueryExtent\r\n * @returns the box extent values\r\n */\r\n getDefaultQueryExtent(): Vector3;\r\n\r\n /**\r\n * Get the Bounding box extent result specified by setDefaultQueryExtent\r\n * @param result output the box extent values\r\n */\r\n getDefaultQueryExtentToRef(result: Vector3): void;\r\n\r\n /**\r\n * Get the next corner points composing the path (max 4 points)\r\n * @param index agent index returned by addAgent\r\n * @returns array containing world position composing the path\r\n */\r\n getCorners(index: number): Vector3[];\r\n\r\n /**\r\n * Release all resources\r\n */\r\n dispose(): void;\r\n}\r\n\r\n/**\r\n * Configures an agent\r\n */\r\nexport interface IAgentParameters {\r\n /**\r\n * Agent radius. [Limit: >= 0]\r\n */\r\n radius: number;\r\n\r\n /**\r\n * Agent height. [Limit: > 0]\r\n */\r\n height: number;\r\n\r\n /**\r\n * Maximum allowed acceleration. [Limit: >= 0]\r\n */\r\n maxAcceleration: number;\r\n\r\n /**\r\n * Maximum allowed speed. [Limit: >= 0]\r\n */\r\n maxSpeed: number;\r\n\r\n /**\r\n * Defines how close a collision element must be before it is considered for steering behaviors. [Limits: > 0]\r\n */\r\n collisionQueryRange: number;\r\n\r\n /**\r\n * The path visibility optimization range. [Limit: > 0]\r\n */\r\n pathOptimizationRange: number;\r\n\r\n /**\r\n * How aggressive the agent manager should be at avoiding collisions with this agent. [Limit: >= 0]\r\n */\r\n separationWeight: number;\r\n\r\n /**\r\n * Observers will be notified when agent gets inside the virtual circle with this Radius around destination point.\r\n * Default is agent radius\r\n */\r\n reachRadius?: number;\r\n}\r\n\r\n/**\r\n * Configures the navigation mesh creation\r\n */\r\nexport interface INavMeshParameters {\r\n /**\r\n * The xz-plane cell size to use for fields. [Limit: > 0] [Units: wu]\r\n */\r\n cs: number;\r\n\r\n /**\r\n * The y-axis cell size to use for fields. [Limit: > 0] [Units: wu]\r\n */\r\n ch: number;\r\n\r\n /**\r\n * The maximum slope that is considered walkable. [Limits: 0 <= value < 90] [Units: Degrees]\r\n */\r\n walkableSlopeAngle: number;\r\n\r\n /**\r\n * Minimum floor to 'ceiling' height that will still allow the floor area to\r\n * be considered walkable. [Limit: >= 3] [Units: vx]\r\n */\r\n walkableHeight: number;\r\n\r\n /**\r\n * Maximum ledge height that is considered to still be traversable. [Limit: >=0] [Units: vx]\r\n */\r\n walkableClimb: number;\r\n\r\n /**\r\n * The distance to erode/shrink the walkable area of the heightfield away from\r\n * obstructions. [Limit: >=0] [Units: vx]\r\n */\r\n walkableRadius: number;\r\n\r\n /**\r\n * The maximum allowed length for contour edges along the border of the mesh. [Limit: >=0] [Units: vx]\r\n */\r\n maxEdgeLen: number;\r\n\r\n /**\r\n * The maximum distance a simplified contour's border edges should deviate\r\n * the original raw contour. [Limit: >=0] [Units: vx]\r\n */\r\n maxSimplificationError: number;\r\n\r\n /**\r\n * The minimum number of cells allowed to form isolated island areas. [Limit: >=0] [Units: vx]\r\n */\r\n minRegionArea: number;\r\n\r\n /**\r\n * Any regions with a span count smaller than this value will, if possible,\r\n * be merged with larger regions. [Limit: >=0] [Units: vx]\r\n */\r\n mergeRegionArea: number;\r\n\r\n /**\r\n * The maximum number of vertices allowed for polygons generated during the\r\n * contour to polygon conversion process. [Limit: >= 3]\r\n */\r\n maxVertsPerPoly: number;\r\n\r\n /**\r\n * Sets the sampling distance to use when generating the detail mesh.\r\n * (For height detail only.) [Limits: 0 or >= 0.9] [Units: wu]\r\n */\r\n detailSampleDist: number;\r\n\r\n /**\r\n * The maximum distance the detail mesh surface should deviate from heightfield\r\n * data. (For height detail only.) [Limit: >=0] [Units: wu]\r\n */\r\n detailSampleMaxError: number;\r\n\r\n /**\r\n * If using obstacles, the navmesh must be subdivided internally by tiles.\r\n * This member defines the tile cube side length in world units.\r\n * If no obstacles are needed, leave it undefined or 0.\r\n */\r\n tileSize?: number;\r\n\r\n /**\r\n * The size of the non-navigable border around the heightfield.\r\n */\r\n borderSize?: number;\r\n}\r\n"]}
|
|
@@ -52,7 +52,7 @@ export declare class RecastJSPlugin implements INavigationEnginePlugin {
|
|
|
52
52
|
getTimeStep(): number;
|
|
53
53
|
/**
|
|
54
54
|
* If delta time in navigation tick update is greater than the time step
|
|
55
|
-
* a number of sub iterations are done. If more iterations are
|
|
55
|
+
* a number of sub iterations are done. If more iterations are needed to reach deltatime
|
|
56
56
|
* they will be discarded.
|
|
57
57
|
* A value of 0 will set to no maximum and update will use as many substeps as needed
|
|
58
58
|
* @param newStepCount the maximum number of iterations
|
|
@@ -179,7 +179,7 @@ export declare class RecastJSPlugin implements INavigationEnginePlugin {
|
|
|
179
179
|
*/
|
|
180
180
|
getDefaultQueryExtentToRef(result: Vector3): void;
|
|
181
181
|
/**
|
|
182
|
-
* Disposes
|
|
182
|
+
* Disposes of the plugin resources
|
|
183
183
|
*/
|
|
184
184
|
dispose(): void;
|
|
185
185
|
/**
|
|
@@ -70,7 +70,7 @@ export class RecastJSPlugin {
|
|
|
70
70
|
}
|
|
71
71
|
/**
|
|
72
72
|
* If delta time in navigation tick update is greater than the time step
|
|
73
|
-
* a number of sub iterations are done. If more iterations are
|
|
73
|
+
* a number of sub iterations are done. If more iterations are needed to reach deltatime
|
|
74
74
|
* they will be discarded.
|
|
75
75
|
* A value of 0 will set to no maximum and update will use as many substeps as needed
|
|
76
76
|
* @param newStepCount the maximum number of iterations
|
|
@@ -107,10 +107,10 @@ export class RecastJSPlugin {
|
|
|
107
107
|
*/
|
|
108
108
|
createNavMesh(meshes, parameters, completion) {
|
|
109
109
|
if (this._worker && !completion) {
|
|
110
|
-
Logger.Warn("A worker is
|
|
110
|
+
Logger.Warn("A worker is available but no completion callback. Defaulting to blocking navmesh creation");
|
|
111
111
|
}
|
|
112
112
|
else if (!this._worker && completion) {
|
|
113
|
-
Logger.Warn("A completion callback is
|
|
113
|
+
Logger.Warn("A completion callback is available but no worker. Defaulting to blocking navmesh creation");
|
|
114
114
|
}
|
|
115
115
|
this.navMesh = new this.bjsRECAST.NavMesh();
|
|
116
116
|
let index;
|
|
@@ -414,9 +414,18 @@ export class RecastJSPlugin {
|
|
|
414
414
|
result.set(p.x, p.y, p.z);
|
|
415
415
|
}
|
|
416
416
|
/**
|
|
417
|
-
* Disposes
|
|
417
|
+
* Disposes of the plugin resources
|
|
418
418
|
*/
|
|
419
|
-
dispose() {
|
|
419
|
+
dispose() {
|
|
420
|
+
if (this._worker) {
|
|
421
|
+
// Clear handlers and terminate the worker to avoid leaks
|
|
422
|
+
this._worker.onmessage = null;
|
|
423
|
+
// Clear other handlers if they were used
|
|
424
|
+
this._worker.onerror = null;
|
|
425
|
+
this._worker.terminate();
|
|
426
|
+
}
|
|
427
|
+
this._worker = null;
|
|
428
|
+
}
|
|
420
429
|
/**
|
|
421
430
|
* Creates a cylinder obstacle and add it to the navigation
|
|
422
431
|
* @param position world position
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recastJSPlugin.js","sourceRoot":"","sources":["../../../../../dev/core/src/Navigation/Plugins/recastJSPlugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEzC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAG5D,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OA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AK,CAAC,CAAC;QACnD,MAAM,UAAU,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;QAC3C,MAAM,SAAS,GAAG,EAAE,CAAC;QACrB,KAAK,EAAE,GAAG,CAAC,EAAE,EAAE,GAAG,UAAU,EAAE,EAAE,EAAE,EAAE,CAAC;YACjC,MAAM,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;YAC/B,SAAS,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC/C,CAAC;QACD,OAAO,SAAS,CAAC;IACrB,CAAC;IAED;;OAEG;IACH,OAAO;QACH,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;QAC3B,IAAI,CAAC,MAAM,CAAC,4BAA4B,CAAC,MAAM,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;QAClF,IAAI,CAAC,2BAA2B,GAAG,IAAI,CAAC;QACxC,IAAI,CAAC,uBAAuB,CAAC,KAAK,EAAE,CAAC;IACzC,CAAC;CACJ","sourcesContent":["import type { INavigationEnginePlugin, ICrowd, IAgentParameters, INavMeshParameters, IObstacle } from \"../../Navigation/INavigationEngine\";\r\nimport { Logger } from \"../../Misc/logger\";\r\nimport { VertexData } from \"../../Meshes/mesh.vertexData\";\r\nimport { Mesh } from \"../../Meshes/mesh\";\r\nimport type { Scene } from \"../../scene\";\r\nimport { Epsilon, Vector3, Matrix } from \"../../Maths/math\";\r\nimport type { TransformNode } from \"../../Meshes/transformNode\";\r\nimport type { Observer } from \"../../Misc/observable\";\r\nimport { Observable } from \"../../Misc/observable\";\r\nimport type { Nullable } from \"../../types\";\r\nimport { VertexBuffer } from \"../../Buffers/buffer\";\r\n\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\ndeclare let Recast: any;\r\n\r\n/**\r\n * RecastJS navigation plugin\r\n */\r\nexport class RecastJSPlugin implements INavigationEnginePlugin {\r\n /**\r\n * Reference to the Recast library\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n public bjsRECAST: any = {};\r\n\r\n /**\r\n * plugin name\r\n */\r\n public name: string = \"RecastJSPlugin\";\r\n\r\n /**\r\n * the first navmesh created. We might extend this to support multiple navmeshes\r\n */\r\n public navMesh: any;\r\n\r\n private _maximumSubStepCount: number = 10;\r\n private _timeStep: number = 1 / 60;\r\n private _timeFactor: number = 1;\r\n\r\n private _tempVec1: any;\r\n private _tempVec2: any;\r\n\r\n private _worker: Nullable<Worker> = null;\r\n\r\n /**\r\n * Initializes the recastJS plugin\r\n * @param recastInjection can be used to inject your own recast reference\r\n */\r\n public constructor(recastInjection: any = Recast) {\r\n if (typeof recastInjection === \"function\") {\r\n Logger.Error(\"RecastJS is not ready. Please make sure you await Recast() before using the plugin.\");\r\n } else {\r\n this.bjsRECAST = recastInjection;\r\n }\r\n\r\n if (!this.isSupported()) {\r\n Logger.Error(\"RecastJS is not available. Please make sure you included the js file.\");\r\n return;\r\n }\r\n this.setTimeStep();\r\n\r\n this._tempVec1 = new this.bjsRECAST.Vec3();\r\n this._tempVec2 = new this.bjsRECAST.Vec3();\r\n }\r\n\r\n /**\r\n * Set worker URL to be used when generating a new navmesh\r\n * @param workerURL url string\r\n * @returns boolean indicating if worker is created\r\n */\r\n public setWorkerURL(workerURL: string | URL): boolean {\r\n if (window && window.Worker) {\r\n this._worker = new Worker(workerURL);\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n /**\r\n * Set the time step of the navigation tick update.\r\n * Default is 1/60.\r\n * A value of 0 will disable fixed time update\r\n * @param newTimeStep the new timestep to apply to this world.\r\n */\r\n setTimeStep(newTimeStep: number = 1 / 60): void {\r\n this._timeStep = newTimeStep;\r\n }\r\n\r\n /**\r\n * Get the time step of the navigation tick update.\r\n * @returns the current time step\r\n */\r\n getTimeStep(): number {\r\n return this._timeStep;\r\n }\r\n\r\n /**\r\n * If delta time in navigation tick update is greater than the time step\r\n * a number of sub iterations are done. If more iterations are need to reach deltatime\r\n * they will be discarded.\r\n * A value of 0 will set to no maximum and update will use as many substeps as needed\r\n * @param newStepCount the maximum number of iterations\r\n */\r\n setMaximumSubStepCount(newStepCount: number = 10): void {\r\n this._maximumSubStepCount = newStepCount;\r\n }\r\n\r\n /**\r\n * Get the maximum number of iterations per navigation tick update\r\n * @returns the maximum number of iterations\r\n */\r\n getMaximumSubStepCount(): number {\r\n return this._maximumSubStepCount;\r\n }\r\n\r\n /**\r\n * Time factor applied when updating crowd agents (default 1). A value of 0 will pause crowd updates.\r\n * @param value the time factor applied at update\r\n */\r\n public set timeFactor(value: number) {\r\n this._timeFactor = Math.max(value, 0);\r\n }\r\n\r\n /**\r\n * Get the time factor used for crowd agent update\r\n * @returns the time factor\r\n */\r\n public get timeFactor(): number {\r\n return this._timeFactor;\r\n }\r\n\r\n /**\r\n * Creates a navigation mesh\r\n * @param meshes array of all the geometry used to compute the navigation mesh\r\n * @param parameters bunch of parameters used to filter geometry\r\n * @param completion callback when data is available from the worker. Not used without a worker\r\n */\r\n createNavMesh(meshes: Array<Mesh>, parameters: INavMeshParameters, completion?: (navmeshData: Uint8Array) => void): void {\r\n if (this._worker && !completion) {\r\n Logger.Warn(\"A worker is avaible but no completion callback. Defaulting to blocking navmesh creation\");\r\n } else if (!this._worker && completion) {\r\n Logger.Warn(\"A completion callback is avaible but no worker. Defaulting to blocking navmesh creation\");\r\n }\r\n\r\n this.navMesh = new this.bjsRECAST.NavMesh();\r\n\r\n let index: number;\r\n let tri: number;\r\n let pt: number;\r\n\r\n const indices = [];\r\n const positions = [];\r\n let offset = 0;\r\n for (index = 0; index < meshes.length; index++) {\r\n if (meshes[index]) {\r\n const mesh = meshes[index];\r\n\r\n const meshIndices = mesh.getIndices();\r\n if (!meshIndices) {\r\n continue;\r\n }\r\n const meshPositions = mesh.getVerticesData(VertexBuffer.PositionKind, false, false);\r\n if (!meshPositions) {\r\n continue;\r\n }\r\n\r\n const worldMatrices = [];\r\n const worldMatrix = mesh.computeWorldMatrix(true);\r\n\r\n if (mesh.hasThinInstances) {\r\n const thinMatrices = mesh.thinInstanceGetWorldMatrices();\r\n for (let instanceIndex = 0; instanceIndex < thinMatrices.length; instanceIndex++) {\r\n const tmpMatrix = new Matrix();\r\n const thinMatrix = thinMatrices[instanceIndex];\r\n thinMatrix.multiplyToRef(worldMatrix, tmpMatrix);\r\n worldMatrices.push(tmpMatrix);\r\n }\r\n } else {\r\n worldMatrices.push(worldMatrix);\r\n }\r\n\r\n for (let matrixIndex = 0; matrixIndex < worldMatrices.length; matrixIndex++) {\r\n const wm = worldMatrices[matrixIndex];\r\n for (tri = 0; tri < meshIndices.length; tri++) {\r\n indices.push(meshIndices[tri] + offset);\r\n }\r\n\r\n const transformed = Vector3.Zero();\r\n const position = Vector3.Zero();\r\n for (pt = 0; pt < meshPositions.length; pt += 3) {\r\n Vector3.FromArrayToRef(meshPositions, pt, position);\r\n Vector3.TransformCoordinatesToRef(position, wm, transformed);\r\n positions.push(transformed.x, transformed.y, transformed.z);\r\n }\r\n\r\n offset += meshPositions.length / 3;\r\n }\r\n }\r\n }\r\n\r\n if (this._worker && completion) {\r\n // spawn worker and send message\r\n this._worker.postMessage([positions, offset, indices, indices.length, parameters]);\r\n this._worker.onmessage = function (e) {\r\n completion(e.data);\r\n };\r\n } else {\r\n // blocking calls\r\n const rc = new this.bjsRECAST.rcConfig();\r\n rc.cs = parameters.cs;\r\n rc.ch = parameters.ch;\r\n rc.borderSize = parameters.borderSize ? parameters.borderSize : 0;\r\n rc.tileSize = parameters.tileSize ? parameters.tileSize : 0;\r\n rc.walkableSlopeAngle = parameters.walkableSlopeAngle;\r\n rc.walkableHeight = parameters.walkableHeight;\r\n rc.walkableClimb = parameters.walkableClimb;\r\n rc.walkableRadius = parameters.walkableRadius;\r\n rc.maxEdgeLen = parameters.maxEdgeLen;\r\n rc.maxSimplificationError = parameters.maxSimplificationError;\r\n rc.minRegionArea = parameters.minRegionArea;\r\n rc.mergeRegionArea = parameters.mergeRegionArea;\r\n rc.maxVertsPerPoly = parameters.maxVertsPerPoly;\r\n rc.detailSampleDist = parameters.detailSampleDist;\r\n rc.detailSampleMaxError = parameters.detailSampleMaxError;\r\n\r\n this.navMesh.build(positions, offset, indices, indices.length, rc);\r\n }\r\n }\r\n\r\n /**\r\n * Create a navigation mesh debug mesh\r\n * @param scene is where the mesh will be added\r\n * @returns debug display mesh\r\n */\r\n createDebugNavMesh(scene: Scene): Mesh {\r\n let tri: number;\r\n let pt: number;\r\n const debugNavMesh = this.navMesh.getDebugNavMesh();\r\n const triangleCount = debugNavMesh.getTriangleCount();\r\n\r\n const indices = [];\r\n const positions = [];\r\n for (tri = 0; tri < triangleCount * 3; tri++) {\r\n indices.push(tri);\r\n }\r\n for (tri = 0; tri < triangleCount; tri++) {\r\n for (pt = 0; pt < 3; pt++) {\r\n const point = debugNavMesh.getTriangle(tri).getPoint(pt);\r\n positions.push(point.x, point.y, point.z);\r\n }\r\n }\r\n\r\n const mesh = new Mesh(\"NavMeshDebug\", scene);\r\n const vertexData = new VertexData();\r\n\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n vertexData.applyToMesh(mesh, false);\r\n return mesh;\r\n }\r\n\r\n /**\r\n * Get a navigation mesh constrained position, closest to the parameter position\r\n * @param position world position\r\n * @returns the closest point to position constrained by the navigation mesh\r\n */\r\n getClosestPoint(position: Vector3): Vector3 {\r\n this._tempVec1.x = position.x;\r\n this._tempVec1.y = position.y;\r\n this._tempVec1.z = position.z;\r\n const ret = this.navMesh.getClosestPoint(this._tempVec1);\r\n const pr = new Vector3(ret.x, ret.y, ret.z);\r\n return pr;\r\n }\r\n\r\n /**\r\n * Get a navigation mesh constrained position, closest to the parameter position\r\n * @param position world position\r\n * @param result output the closest point to position constrained by the navigation mesh\r\n */\r\n getClosestPointToRef(position: Vector3, result: Vector3): void {\r\n this._tempVec1.x = position.x;\r\n this._tempVec1.y = position.y;\r\n this._tempVec1.z = position.z;\r\n const ret = this.navMesh.getClosestPoint(this._tempVec1);\r\n result.set(ret.x, ret.y, ret.z);\r\n }\r\n\r\n /**\r\n * Get a navigation mesh constrained position, within a particular radius\r\n * @param position world position\r\n * @param maxRadius the maximum distance to the constrained world position\r\n * @returns the closest point to position constrained by the navigation mesh\r\n */\r\n getRandomPointAround(position: Vector3, maxRadius: number): Vector3 {\r\n this._tempVec1.x = position.x;\r\n this._tempVec1.y = position.y;\r\n this._tempVec1.z = position.z;\r\n const ret = this.navMesh.getRandomPointAround(this._tempVec1, maxRadius);\r\n const pr = new Vector3(ret.x, ret.y, ret.z);\r\n return pr;\r\n }\r\n\r\n /**\r\n * Get a navigation mesh constrained position, within a particular radius\r\n * @param position world position\r\n * @param maxRadius the maximum distance to the constrained world position\r\n * @param result output the closest point to position constrained by the navigation mesh\r\n */\r\n getRandomPointAroundToRef(position: Vector3, maxRadius: number, result: Vector3): void {\r\n this._tempVec1.x = position.x;\r\n this._tempVec1.y = position.y;\r\n this._tempVec1.z = position.z;\r\n const ret = this.navMesh.getRandomPointAround(this._tempVec1, maxRadius);\r\n result.set(ret.x, ret.y, ret.z);\r\n }\r\n\r\n /**\r\n * Compute the final position from a segment made of destination-position\r\n * @param position world position\r\n * @param destination world position\r\n * @returns the resulting point along the navmesh\r\n */\r\n moveAlong(position: Vector3, destination: Vector3): Vector3 {\r\n this._tempVec1.x = position.x;\r\n this._tempVec1.y = position.y;\r\n this._tempVec1.z = position.z;\r\n this._tempVec2.x = destination.x;\r\n this._tempVec2.y = destination.y;\r\n this._tempVec2.z = destination.z;\r\n const ret = this.navMesh.moveAlong(this._tempVec1, this._tempVec2);\r\n const pr = new Vector3(ret.x, ret.y, ret.z);\r\n return pr;\r\n }\r\n\r\n /**\r\n * Compute the final position from a segment made of destination-position\r\n * @param position world position\r\n * @param destination world position\r\n * @param result output the resulting point along the navmesh\r\n */\r\n moveAlongToRef(position: Vector3, destination: Vector3, result: Vector3): void {\r\n this._tempVec1.x = position.x;\r\n this._tempVec1.y = position.y;\r\n this._tempVec1.z = position.z;\r\n this._tempVec2.x = destination.x;\r\n this._tempVec2.y = destination.y;\r\n this._tempVec2.z = destination.z;\r\n const ret = this.navMesh.moveAlong(this._tempVec1, this._tempVec2);\r\n result.set(ret.x, ret.y, ret.z);\r\n }\r\n\r\n private _convertNavPathPoints(navPath: any): Vector3[] {\r\n let pt: number;\r\n const pointCount = navPath.getPointCount();\r\n const positions = [];\r\n for (pt = 0; pt < pointCount; pt++) {\r\n const p = navPath.getPoint(pt);\r\n positions.push(new Vector3(p.x, p.y, p.z));\r\n }\r\n return positions;\r\n }\r\n\r\n /**\r\n * Compute a navigation path from start to end. Returns an empty array if no path can be computed\r\n * Path is straight.\r\n * @param start world position\r\n * @param end world position\r\n * @returns array containing world position composing the path\r\n */\r\n computePath(start: Vector3, end: Vector3): Vector3[] {\r\n this._tempVec1.x = start.x;\r\n this._tempVec1.y = start.y;\r\n this._tempVec1.z = start.z;\r\n this._tempVec2.x = end.x;\r\n this._tempVec2.y = end.y;\r\n this._tempVec2.z = end.z;\r\n const navPath = this.navMesh.computePath(this._tempVec1, this._tempVec2);\r\n return this._convertNavPathPoints(navPath);\r\n }\r\n\r\n /**\r\n * Compute a navigation path from start to end. Returns an empty array if no path can be computed.\r\n * Path follows navigation mesh geometry.\r\n * @param start world position\r\n * @param end world position\r\n * @returns array containing world position composing the path\r\n */\r\n computePathSmooth(start: Vector3, end: Vector3): Vector3[] {\r\n this._tempVec1.x = start.x;\r\n this._tempVec1.y = start.y;\r\n this._tempVec1.z = start.z;\r\n this._tempVec2.x = end.x;\r\n this._tempVec2.y = end.y;\r\n this._tempVec2.z = end.z;\r\n const navPath = this.navMesh.computePathSmooth(this._tempVec1, this._tempVec2);\r\n return this._convertNavPathPoints(navPath);\r\n }\r\n /**\r\n * Create a new Crowd so you can add agents\r\n * @param maxAgents the maximum agent count in the crowd\r\n * @param maxAgentRadius the maximum radius an agent can have\r\n * @param scene to attach the crowd to\r\n * @returns the crowd you can add agents to\r\n */\r\n createCrowd(maxAgents: number, maxAgentRadius: number, scene: Scene): ICrowd {\r\n const crowd = new RecastJSCrowd(this, maxAgents, maxAgentRadius, scene);\r\n return crowd;\r\n }\r\n\r\n /**\r\n * Set the Bounding box extent for doing spatial queries (getClosestPoint, getRandomPointAround, ...)\r\n * The queries will try to find a solution within those bounds\r\n * default is (1,1,1)\r\n * @param extent x,y,z value that define the extent around the queries point of reference\r\n */\r\n setDefaultQueryExtent(extent: Vector3): void {\r\n this._tempVec1.x = extent.x;\r\n this._tempVec1.y = extent.y;\r\n this._tempVec1.z = extent.z;\r\n this.navMesh.setDefaultQueryExtent(this._tempVec1);\r\n }\r\n\r\n /**\r\n * Get the Bounding box extent specified by setDefaultQueryExtent\r\n * @returns the box extent values\r\n */\r\n getDefaultQueryExtent(): Vector3 {\r\n const p = this.navMesh.getDefaultQueryExtent();\r\n return new Vector3(p.x, p.y, p.z);\r\n }\r\n\r\n /**\r\n * build the navmesh from a previously saved state using getNavmeshData\r\n * @param data the Uint8Array returned by getNavmeshData\r\n */\r\n buildFromNavmeshData(data: Uint8Array): void {\r\n const nDataBytes = data.length * data.BYTES_PER_ELEMENT;\r\n const dataPtr = this.bjsRECAST._malloc(nDataBytes);\r\n\r\n const dataHeap = new Uint8Array(this.bjsRECAST.HEAPU8.buffer, dataPtr, nDataBytes);\r\n dataHeap.set(data);\r\n\r\n const buf = new this.bjsRECAST.NavmeshData();\r\n buf.dataPointer = dataHeap.byteOffset;\r\n buf.size = data.length;\r\n this.navMesh = new this.bjsRECAST.NavMesh();\r\n this.navMesh.buildFromNavmeshData(buf);\r\n\r\n // Free memory\r\n this.bjsRECAST._free(dataHeap.byteOffset);\r\n }\r\n\r\n /**\r\n * returns the navmesh data that can be used later. The navmesh must be built before retrieving the data\r\n * @returns data the Uint8Array that can be saved and reused\r\n */\r\n getNavmeshData(): Uint8Array {\r\n const navmeshData = this.navMesh.getNavmeshData();\r\n const arrView = new Uint8Array(this.bjsRECAST.HEAPU8.buffer, navmeshData.dataPointer, navmeshData.size);\r\n const ret = new Uint8Array(navmeshData.size);\r\n ret.set(arrView);\r\n this.navMesh.freeNavmeshData(navmeshData);\r\n return ret;\r\n }\r\n\r\n /**\r\n * Get the Bounding box extent result specified by setDefaultQueryExtent\r\n * @param result output the box extent values\r\n */\r\n getDefaultQueryExtentToRef(result: Vector3): void {\r\n const p = this.navMesh.getDefaultQueryExtent();\r\n result.set(p.x, p.y, p.z);\r\n }\r\n\r\n /**\r\n * Disposes\r\n */\r\n public dispose() {}\r\n\r\n /**\r\n * Creates a cylinder obstacle and add it to the navigation\r\n * @param position world position\r\n * @param radius cylinder radius\r\n * @param height cylinder height\r\n * @returns the obstacle freshly created\r\n */\r\n addCylinderObstacle(position: Vector3, radius: number, height: number): Nullable<IObstacle> {\r\n this._tempVec1.x = position.x;\r\n this._tempVec1.y = position.y;\r\n this._tempVec1.z = position.z;\r\n return this.navMesh.addCylinderObstacle(this._tempVec1, radius, height);\r\n }\r\n\r\n /**\r\n * Creates an oriented box obstacle and add it to the navigation\r\n * @param position world position\r\n * @param extent box size\r\n * @param angle angle in radians of the box orientation on Y axis\r\n * @returns the obstacle freshly created\r\n */\r\n addBoxObstacle(position: Vector3, extent: Vector3, angle: number): Nullable<IObstacle> {\r\n this._tempVec1.x = position.x;\r\n this._tempVec1.y = position.y;\r\n this._tempVec1.z = position.z;\r\n this._tempVec2.x = extent.x;\r\n this._tempVec2.y = extent.y;\r\n this._tempVec2.z = extent.z;\r\n return this.navMesh.addBoxObstacle(this._tempVec1, this._tempVec2, angle);\r\n }\r\n\r\n /**\r\n * Removes an obstacle created by addCylinderObstacle or addBoxObstacle\r\n * @param obstacle obstacle to remove from the navigation\r\n */\r\n removeObstacle(obstacle: IObstacle): void {\r\n this.navMesh.removeObstacle(obstacle);\r\n }\r\n\r\n /**\r\n * If this plugin is supported\r\n * @returns true if plugin is supported\r\n */\r\n public isSupported(): boolean {\r\n return this.bjsRECAST !== undefined;\r\n }\r\n\r\n /**\r\n * Returns the seed used for randomized functions like `getRandomPointAround`\r\n * @returns seed number\r\n */\r\n public getRandomSeed(): number {\r\n return this.bjsRECAST._getRandomSeed();\r\n }\r\n\r\n /**\r\n * Set the seed used for randomized functions like `getRandomPointAround`\r\n * @param seed number used as seed for random functions\r\n */\r\n public setRandomSeed(seed: number): void {\r\n this.bjsRECAST._setRandomSeed(seed);\r\n }\r\n}\r\n\r\n/**\r\n * Recast detour crowd implementation\r\n */\r\nexport class RecastJSCrowd implements ICrowd {\r\n /**\r\n * Recast/detour plugin\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n public bjsRECASTPlugin: RecastJSPlugin;\r\n /**\r\n * Link to the detour crowd\r\n */\r\n public recastCrowd: any = {};\r\n /**\r\n * One transform per agent\r\n */\r\n public transforms: TransformNode[] = new Array<TransformNode>();\r\n /**\r\n * All agents created\r\n */\r\n public agents: number[] = new Array<number>();\r\n /**\r\n * agents reach radius\r\n */\r\n public reachRadii: number[] = new Array<number>();\r\n /**\r\n * true when a destination is active for an agent and notifier hasn't been notified of reach\r\n */\r\n private _agentDestinationArmed: boolean[] = new Array<boolean>();\r\n /**\r\n * agent current target\r\n */\r\n private _agentDestination: Vector3[] = new Array<Vector3>();\r\n /**\r\n * Link to the scene is kept to unregister the crowd from the scene\r\n */\r\n private _scene: Scene;\r\n\r\n /**\r\n * Observer for crowd updates\r\n */\r\n private _onBeforeAnimationsObserver: Nullable<Observer<Scene>> = null;\r\n\r\n /**\r\n * Fires each time an agent is in reach radius of its destination\r\n */\r\n public onReachTargetObservable = new Observable<{ agentIndex: number; destination: Vector3 }>();\r\n\r\n /**\r\n * Constructor\r\n * @param plugin recastJS plugin\r\n * @param maxAgents the maximum agent count in the crowd\r\n * @param maxAgentRadius the maximum radius an agent can have\r\n * @param scene to attach the crowd to\r\n * @returns the crowd you can add agents to\r\n */\r\n public constructor(plugin: RecastJSPlugin, maxAgents: number, maxAgentRadius: number, scene: Scene) {\r\n this.bjsRECASTPlugin = plugin;\r\n this.recastCrowd = new this.bjsRECASTPlugin.bjsRECAST.Crowd(maxAgents, maxAgentRadius, this.bjsRECASTPlugin.navMesh.getNavMesh());\r\n this._scene = scene;\r\n\r\n this._onBeforeAnimationsObserver = scene.onBeforeAnimationsObservable.add(() => {\r\n this.update(scene.getEngine().getDeltaTime() * 0.001 * plugin.timeFactor);\r\n });\r\n }\r\n\r\n /**\r\n * Add a new agent to the crowd with the specified parameter a corresponding transformNode.\r\n * You can attach anything to that node. The node position is updated in the scene update tick.\r\n * @param pos world position that will be constrained by the navigation mesh\r\n * @param parameters agent parameters\r\n * @param transform hooked to the agent that will be update by the scene\r\n * @returns agent index\r\n */\r\n addAgent(pos: Vector3, parameters: IAgentParameters, transform: TransformNode): number {\r\n const agentParams = new this.bjsRECASTPlugin.bjsRECAST.dtCrowdAgentParams();\r\n agentParams.radius = parameters.radius;\r\n agentParams.height = parameters.height;\r\n agentParams.maxAcceleration = parameters.maxAcceleration;\r\n agentParams.maxSpeed = parameters.maxSpeed;\r\n agentParams.collisionQueryRange = parameters.collisionQueryRange;\r\n agentParams.pathOptimizationRange = parameters.pathOptimizationRange;\r\n agentParams.separationWeight = parameters.separationWeight;\r\n agentParams.updateFlags = 7;\r\n agentParams.obstacleAvoidanceType = 0;\r\n agentParams.queryFilterType = 0;\r\n agentParams.userData = 0;\r\n\r\n const agentIndex = this.recastCrowd.addAgent(new this.bjsRECASTPlugin.bjsRECAST.Vec3(pos.x, pos.y, pos.z), agentParams);\r\n this.transforms.push(transform);\r\n this.agents.push(agentIndex);\r\n this.reachRadii.push(parameters.reachRadius ? parameters.reachRadius : parameters.radius);\r\n this._agentDestinationArmed.push(false);\r\n this._agentDestination.push(new Vector3(0, 0, 0));\r\n return agentIndex;\r\n }\r\n\r\n /**\r\n * Returns the agent position in world space\r\n * @param index agent index returned by addAgent\r\n * @returns world space position\r\n */\r\n getAgentPosition(index: number): Vector3 {\r\n const agentPos = this.recastCrowd.getAgentPosition(index);\r\n return new Vector3(agentPos.x, agentPos.y, agentPos.z);\r\n }\r\n\r\n /**\r\n * Returns the agent position result in world space\r\n * @param index agent index returned by addAgent\r\n * @param result output world space position\r\n */\r\n getAgentPositionToRef(index: number, result: Vector3): void {\r\n const agentPos = this.recastCrowd.getAgentPosition(index);\r\n result.set(agentPos.x, agentPos.y, agentPos.z);\r\n }\r\n\r\n /**\r\n * Returns the agent velocity in world space\r\n * @param index agent index returned by addAgent\r\n * @returns world space velocity\r\n */\r\n getAgentVelocity(index: number): Vector3 {\r\n const agentVel = this.recastCrowd.getAgentVelocity(index);\r\n return new Vector3(agentVel.x, agentVel.y, agentVel.z);\r\n }\r\n\r\n /**\r\n * Returns the agent velocity result in world space\r\n * @param index agent index returned by addAgent\r\n * @param result output world space velocity\r\n */\r\n getAgentVelocityToRef(index: number, result: Vector3): void {\r\n const agentVel = this.recastCrowd.getAgentVelocity(index);\r\n result.set(agentVel.x, agentVel.y, agentVel.z);\r\n }\r\n\r\n /**\r\n * Returns the agent next target point on the path\r\n * @param index agent index returned by addAgent\r\n * @returns world space position\r\n */\r\n getAgentNextTargetPath(index: number): Vector3 {\r\n const pathTargetPos = this.recastCrowd.getAgentNextTargetPath(index);\r\n return new Vector3(pathTargetPos.x, pathTargetPos.y, pathTargetPos.z);\r\n }\r\n\r\n /**\r\n * Returns the agent next target point on the path\r\n * @param index agent index returned by addAgent\r\n * @param result output world space position\r\n */\r\n getAgentNextTargetPathToRef(index: number, result: Vector3): void {\r\n const pathTargetPos = this.recastCrowd.getAgentNextTargetPath(index);\r\n result.set(pathTargetPos.x, pathTargetPos.y, pathTargetPos.z);\r\n }\r\n\r\n /**\r\n * Gets the agent state\r\n * @param index agent index returned by addAgent\r\n * @returns agent state\r\n */\r\n getAgentState(index: number): number {\r\n return this.recastCrowd.getAgentState(index);\r\n }\r\n\r\n /**\r\n * returns true if the agent in over an off mesh link connection\r\n * @param index agent index returned by addAgent\r\n * @returns true if over an off mesh link connection\r\n */\r\n overOffmeshConnection(index: number): boolean {\r\n return this.recastCrowd.overOffmeshConnection(index);\r\n }\r\n\r\n /**\r\n * Asks a particular agent to go to a destination. That destination is constrained by the navigation mesh\r\n * @param index agent index returned by addAgent\r\n * @param destination targeted world position\r\n */\r\n agentGoto(index: number, destination: Vector3): void {\r\n this.recastCrowd.agentGoto(index, new this.bjsRECASTPlugin.bjsRECAST.Vec3(destination.x, destination.y, destination.z));\r\n\r\n // arm observer\r\n const item = this.agents.indexOf(index);\r\n if (item > -1) {\r\n this._agentDestinationArmed[item] = true;\r\n this._agentDestination[item].set(destination.x, destination.y, destination.z);\r\n }\r\n }\r\n\r\n /**\r\n * Teleport the agent to a new position\r\n * @param index agent index returned by addAgent\r\n * @param destination targeted world position\r\n */\r\n agentTeleport(index: number, destination: Vector3): void {\r\n this.recastCrowd.agentTeleport(index, new this.bjsRECASTPlugin.bjsRECAST.Vec3(destination.x, destination.y, destination.z));\r\n }\r\n\r\n /**\r\n * Update agent parameters\r\n * @param index agent index returned by addAgent\r\n * @param parameters agent parameters\r\n */\r\n updateAgentParameters(index: number, parameters: IAgentParameters): void {\r\n const agentParams = this.recastCrowd.getAgentParameters(index);\r\n\r\n if (parameters.radius !== undefined) {\r\n agentParams.radius = parameters.radius;\r\n }\r\n if (parameters.height !== undefined) {\r\n agentParams.height = parameters.height;\r\n }\r\n if (parameters.maxAcceleration !== undefined) {\r\n agentParams.maxAcceleration = parameters.maxAcceleration;\r\n }\r\n if (parameters.maxSpeed !== undefined) {\r\n agentParams.maxSpeed = parameters.maxSpeed;\r\n }\r\n if (parameters.collisionQueryRange !== undefined) {\r\n agentParams.collisionQueryRange = parameters.collisionQueryRange;\r\n }\r\n if (parameters.pathOptimizationRange !== undefined) {\r\n agentParams.pathOptimizationRange = parameters.pathOptimizationRange;\r\n }\r\n if (parameters.separationWeight !== undefined) {\r\n agentParams.separationWeight = parameters.separationWeight;\r\n }\r\n\r\n this.recastCrowd.setAgentParameters(index, agentParams);\r\n }\r\n\r\n /**\r\n * remove a particular agent previously created\r\n * @param index agent index returned by addAgent\r\n */\r\n removeAgent(index: number): void {\r\n this.recastCrowd.removeAgent(index);\r\n\r\n const item = this.agents.indexOf(index);\r\n if (item > -1) {\r\n this.agents.splice(item, 1);\r\n this.transforms.splice(item, 1);\r\n this.reachRadii.splice(item, 1);\r\n this._agentDestinationArmed.splice(item, 1);\r\n this._agentDestination.splice(item, 1);\r\n }\r\n }\r\n\r\n /**\r\n * get the list of all agents attached to this crowd\r\n * @returns list of agent indices\r\n */\r\n getAgents(): number[] {\r\n return this.agents;\r\n }\r\n\r\n /**\r\n * Tick update done by the Scene. Agent position/velocity/acceleration is updated by this function\r\n * @param deltaTime in seconds\r\n */\r\n update(deltaTime: number): void {\r\n // update obstacles\r\n this.bjsRECASTPlugin.navMesh.update();\r\n\r\n if (deltaTime <= Epsilon) {\r\n return;\r\n }\r\n // update crowd\r\n const timeStep = this.bjsRECASTPlugin.getTimeStep();\r\n const maxStepCount = this.bjsRECASTPlugin.getMaximumSubStepCount();\r\n if (timeStep <= Epsilon) {\r\n this.recastCrowd.update(deltaTime);\r\n } else {\r\n let iterationCount = Math.floor(deltaTime / timeStep);\r\n if (maxStepCount && iterationCount > maxStepCount) {\r\n iterationCount = maxStepCount;\r\n }\r\n if (iterationCount < 1) {\r\n iterationCount = 1;\r\n }\r\n\r\n const step = deltaTime / iterationCount;\r\n for (let i = 0; i < iterationCount; i++) {\r\n this.recastCrowd.update(step);\r\n }\r\n }\r\n\r\n // update transforms\r\n for (let index = 0; index < this.agents.length; index++) {\r\n // update transform position\r\n const agentIndex = this.agents[index];\r\n const agentPosition = this.getAgentPosition(agentIndex);\r\n this.transforms[index].position = agentPosition;\r\n // check agent reach destination\r\n if (this._agentDestinationArmed[index]) {\r\n const dx = agentPosition.x - this._agentDestination[index].x;\r\n const dz = agentPosition.z - this._agentDestination[index].z;\r\n const radius = this.reachRadii[index];\r\n const groundY = this._agentDestination[index].y - this.reachRadii[index];\r\n const ceilingY = this._agentDestination[index].y + this.reachRadii[index];\r\n const distanceXZSquared = dx * dx + dz * dz;\r\n if (agentPosition.y > groundY && agentPosition.y < ceilingY && distanceXZSquared < radius * radius) {\r\n this._agentDestinationArmed[index] = false;\r\n this.onReachTargetObservable.notifyObservers({ agentIndex: agentIndex, destination: this._agentDestination[index] });\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Set the Bounding box extent for doing spatial queries (getClosestPoint, getRandomPointAround, ...)\r\n * The queries will try to find a solution within those bounds\r\n * default is (1,1,1)\r\n * @param extent x,y,z value that define the extent around the queries point of reference\r\n */\r\n setDefaultQueryExtent(extent: Vector3): void {\r\n const ext = new this.bjsRECASTPlugin.bjsRECAST.Vec3(extent.x, extent.y, extent.z);\r\n this.recastCrowd.setDefaultQueryExtent(ext);\r\n }\r\n\r\n /**\r\n * Get the Bounding box extent specified by setDefaultQueryExtent\r\n * @returns the box extent values\r\n */\r\n getDefaultQueryExtent(): Vector3 {\r\n const p = this.recastCrowd.getDefaultQueryExtent();\r\n return new Vector3(p.x, p.y, p.z);\r\n }\r\n\r\n /**\r\n * Get the Bounding box extent result specified by setDefaultQueryExtent\r\n * @param result output the box extent values\r\n */\r\n getDefaultQueryExtentToRef(result: Vector3): void {\r\n const p = this.recastCrowd.getDefaultQueryExtent();\r\n result.set(p.x, p.y, p.z);\r\n }\r\n\r\n /**\r\n * Get the next corner points composing the path (max 4 points)\r\n * @param index agent index returned by addAgent\r\n * @returns array containing world position composing the path\r\n */\r\n getCorners(index: number): Vector3[] {\r\n let pt: number;\r\n const navPath = this.recastCrowd.getCorners(index);\r\n const pointCount = navPath.getPointCount();\r\n const positions = [];\r\n for (pt = 0; pt < pointCount; pt++) {\r\n const p = navPath.getPoint(pt);\r\n positions.push(new Vector3(p.x, p.y, p.z));\r\n }\r\n return positions;\r\n }\r\n\r\n /**\r\n * Release all resources\r\n */\r\n dispose(): void {\r\n this.recastCrowd.destroy();\r\n this._scene.onBeforeAnimationsObservable.remove(this._onBeforeAnimationsObserver);\r\n this._onBeforeAnimationsObserver = null;\r\n this.onReachTargetObservable.clear();\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"recastJSPlugin.js","sourceRoot":"","sources":["../../../../../dev/core/src/Navigation/Plugins/recastJSPlugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEzC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAG5D,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAKpD;;GAEG;AACH,MAAM,OAAO,cAAc;IA0BvB;;;OAGG;IACH,YAAmB,kBAAuB,MAAM;QA7BhD;;WAEG;QACH,gEAAgE;QACzD,cAAS,GAAQ,EAAE,CAAC;QAE3B;;WAEG;QACI,SAAI,GAAW,gBAAgB,CAAC;QAO/B,yBAAoB,GAAW,EAAE,CAAC;QAClC,cAAS,GAAW,CAAC,GAAG,EAAE,CAAC;QAC3B,gBAAW,GAAW,CAAC,CAAC;QAKxB,YAAO,GAAqB,IAAI,CAAC;QAOrC,IAAI,OAAO,eAAe,KAAK,UAAU,EAAE,CAAC;YACxC,MAAM,CAAC,KAAK,CAAC,qFAAqF,CAAC,CAAC;QACxG,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,SAAS,GAAG,eAAe,CAAC;QACrC,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;YACtB,MAAM,CAAC,KAAK,CAAC,uEAAuE,CAAC,CAAC;YACtF,OAAO;QACX,CAAC;QACD,IAAI,CAAC,WAAW,EAAE,CAAC;QAEnB,IAAI,CAAC,SAAS,GAAG,IAAI,I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AAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;QAC3B,IAAI,CAAC,MAAM,CAAC,4BAA4B,CAAC,MAAM,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;QAClF,IAAI,CAAC,2BAA2B,GAAG,IAAI,CAAC;QACxC,IAAI,CAAC,uBAAuB,CAAC,KAAK,EAAE,CAAC;IACzC,CAAC;CACJ","sourcesContent":["import type { INavigationEnginePlugin, ICrowd, IAgentParameters, INavMeshParameters, IObstacle } from \"../../Navigation/INavigationEngine\";\r\nimport { Logger } from \"../../Misc/logger\";\r\nimport { VertexData } from \"../../Meshes/mesh.vertexData\";\r\nimport { Mesh } from \"../../Meshes/mesh\";\r\nimport type { Scene } from \"../../scene\";\r\nimport { Epsilon, Vector3, Matrix } from \"../../Maths/math\";\r\nimport type { TransformNode } from \"../../Meshes/transformNode\";\r\nimport type { Observer } from \"../../Misc/observable\";\r\nimport { Observable } from \"../../Misc/observable\";\r\nimport type { Nullable } from \"../../types\";\r\nimport { VertexBuffer } from \"../../Buffers/buffer\";\r\n\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\ndeclare let Recast: any;\r\n\r\n/**\r\n * RecastJS navigation plugin\r\n */\r\nexport class RecastJSPlugin implements INavigationEnginePlugin {\r\n /**\r\n * Reference to the Recast library\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n public bjsRECAST: any = {};\r\n\r\n /**\r\n * plugin name\r\n */\r\n public name: string = \"RecastJSPlugin\";\r\n\r\n /**\r\n * the first navmesh created. We might extend this to support multiple navmeshes\r\n */\r\n public navMesh: any;\r\n\r\n private _maximumSubStepCount: number = 10;\r\n private _timeStep: number = 1 / 60;\r\n private _timeFactor: number = 1;\r\n\r\n private _tempVec1: any;\r\n private _tempVec2: any;\r\n\r\n private _worker: Nullable<Worker> = null;\r\n\r\n /**\r\n * Initializes the recastJS plugin\r\n * @param recastInjection can be used to inject your own recast reference\r\n */\r\n public constructor(recastInjection: any = Recast) {\r\n if (typeof recastInjection === \"function\") {\r\n Logger.Error(\"RecastJS is not ready. Please make sure you await Recast() before using the plugin.\");\r\n } else {\r\n this.bjsRECAST = recastInjection;\r\n }\r\n\r\n if (!this.isSupported()) {\r\n Logger.Error(\"RecastJS is not available. Please make sure you included the js file.\");\r\n return;\r\n }\r\n this.setTimeStep();\r\n\r\n this._tempVec1 = new this.bjsRECAST.Vec3();\r\n this._tempVec2 = new this.bjsRECAST.Vec3();\r\n }\r\n\r\n /**\r\n * Set worker URL to be used when generating a new navmesh\r\n * @param workerURL url string\r\n * @returns boolean indicating if worker is created\r\n */\r\n public setWorkerURL(workerURL: string | URL): boolean {\r\n if (window && window.Worker) {\r\n this._worker = new Worker(workerURL);\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n /**\r\n * Set the time step of the navigation tick update.\r\n * Default is 1/60.\r\n * A value of 0 will disable fixed time update\r\n * @param newTimeStep the new timestep to apply to this world.\r\n */\r\n setTimeStep(newTimeStep: number = 1 / 60): void {\r\n this._timeStep = newTimeStep;\r\n }\r\n\r\n /**\r\n * Get the time step of the navigation tick update.\r\n * @returns the current time step\r\n */\r\n getTimeStep(): number {\r\n return this._timeStep;\r\n }\r\n\r\n /**\r\n * If delta time in navigation tick update is greater than the time step\r\n * a number of sub iterations are done. If more iterations are needed to reach deltatime\r\n * they will be discarded.\r\n * A value of 0 will set to no maximum and update will use as many substeps as needed\r\n * @param newStepCount the maximum number of iterations\r\n */\r\n setMaximumSubStepCount(newStepCount: number = 10): void {\r\n this._maximumSubStepCount = newStepCount;\r\n }\r\n\r\n /**\r\n * Get the maximum number of iterations per navigation tick update\r\n * @returns the maximum number of iterations\r\n */\r\n getMaximumSubStepCount(): number {\r\n return this._maximumSubStepCount;\r\n }\r\n\r\n /**\r\n * Time factor applied when updating crowd agents (default 1). A value of 0 will pause crowd updates.\r\n * @param value the time factor applied at update\r\n */\r\n public set timeFactor(value: number) {\r\n this._timeFactor = Math.max(value, 0);\r\n }\r\n\r\n /**\r\n * Get the time factor used for crowd agent update\r\n * @returns the time factor\r\n */\r\n public get timeFactor(): number {\r\n return this._timeFactor;\r\n }\r\n\r\n /**\r\n * Creates a navigation mesh\r\n * @param meshes array of all the geometry used to compute the navigation mesh\r\n * @param parameters bunch of parameters used to filter geometry\r\n * @param completion callback when data is available from the worker. Not used without a worker\r\n */\r\n createNavMesh(meshes: Array<Mesh>, parameters: INavMeshParameters, completion?: (navmeshData: Uint8Array) => void): void {\r\n if (this._worker && !completion) {\r\n Logger.Warn(\"A worker is available but no completion callback. Defaulting to blocking navmesh creation\");\r\n } else if (!this._worker && completion) {\r\n Logger.Warn(\"A completion callback is available but no worker. Defaulting to blocking navmesh creation\");\r\n }\r\n\r\n this.navMesh = new this.bjsRECAST.NavMesh();\r\n\r\n let index: number;\r\n let tri: number;\r\n let pt: number;\r\n\r\n const indices = [];\r\n const positions = [];\r\n let offset = 0;\r\n for (index = 0; index < meshes.length; index++) {\r\n if (meshes[index]) {\r\n const mesh = meshes[index];\r\n\r\n const meshIndices = mesh.getIndices();\r\n if (!meshIndices) {\r\n continue;\r\n }\r\n const meshPositions = mesh.getVerticesData(VertexBuffer.PositionKind, false, false);\r\n if (!meshPositions) {\r\n continue;\r\n }\r\n\r\n const worldMatrices = [];\r\n const worldMatrix = mesh.computeWorldMatrix(true);\r\n\r\n if (mesh.hasThinInstances) {\r\n const thinMatrices = mesh.thinInstanceGetWorldMatrices();\r\n for (let instanceIndex = 0; instanceIndex < thinMatrices.length; instanceIndex++) {\r\n const tmpMatrix = new Matrix();\r\n const thinMatrix = thinMatrices[instanceIndex];\r\n thinMatrix.multiplyToRef(worldMatrix, tmpMatrix);\r\n worldMatrices.push(tmpMatrix);\r\n }\r\n } else {\r\n worldMatrices.push(worldMatrix);\r\n }\r\n\r\n for (let matrixIndex = 0; matrixIndex < worldMatrices.length; matrixIndex++) {\r\n const wm = worldMatrices[matrixIndex];\r\n for (tri = 0; tri < meshIndices.length; tri++) {\r\n indices.push(meshIndices[tri] + offset);\r\n }\r\n\r\n const transformed = Vector3.Zero();\r\n const position = Vector3.Zero();\r\n for (pt = 0; pt < meshPositions.length; pt += 3) {\r\n Vector3.FromArrayToRef(meshPositions, pt, position);\r\n Vector3.TransformCoordinatesToRef(position, wm, transformed);\r\n positions.push(transformed.x, transformed.y, transformed.z);\r\n }\r\n\r\n offset += meshPositions.length / 3;\r\n }\r\n }\r\n }\r\n\r\n if (this._worker && completion) {\r\n // spawn worker and send message\r\n this._worker.postMessage([positions, offset, indices, indices.length, parameters]);\r\n this._worker.onmessage = function (e) {\r\n completion(e.data);\r\n };\r\n } else {\r\n // blocking calls\r\n const rc = new this.bjsRECAST.rcConfig();\r\n rc.cs = parameters.cs;\r\n rc.ch = parameters.ch;\r\n rc.borderSize = parameters.borderSize ? parameters.borderSize : 0;\r\n rc.tileSize = parameters.tileSize ? parameters.tileSize : 0;\r\n rc.walkableSlopeAngle = parameters.walkableSlopeAngle;\r\n rc.walkableHeight = parameters.walkableHeight;\r\n rc.walkableClimb = parameters.walkableClimb;\r\n rc.walkableRadius = parameters.walkableRadius;\r\n rc.maxEdgeLen = parameters.maxEdgeLen;\r\n rc.maxSimplificationError = parameters.maxSimplificationError;\r\n rc.minRegionArea = parameters.minRegionArea;\r\n rc.mergeRegionArea = parameters.mergeRegionArea;\r\n rc.maxVertsPerPoly = parameters.maxVertsPerPoly;\r\n rc.detailSampleDist = parameters.detailSampleDist;\r\n rc.detailSampleMaxError = parameters.detailSampleMaxError;\r\n\r\n this.navMesh.build(positions, offset, indices, indices.length, rc);\r\n }\r\n }\r\n\r\n /**\r\n * Create a navigation mesh debug mesh\r\n * @param scene is where the mesh will be added\r\n * @returns debug display mesh\r\n */\r\n createDebugNavMesh(scene: Scene): Mesh {\r\n let tri: number;\r\n let pt: number;\r\n const debugNavMesh = this.navMesh.getDebugNavMesh();\r\n const triangleCount = debugNavMesh.getTriangleCount();\r\n\r\n const indices = [];\r\n const positions = [];\r\n for (tri = 0; tri < triangleCount * 3; tri++) {\r\n indices.push(tri);\r\n }\r\n for (tri = 0; tri < triangleCount; tri++) {\r\n for (pt = 0; pt < 3; pt++) {\r\n const point = debugNavMesh.getTriangle(tri).getPoint(pt);\r\n positions.push(point.x, point.y, point.z);\r\n }\r\n }\r\n\r\n const mesh = new Mesh(\"NavMeshDebug\", scene);\r\n const vertexData = new VertexData();\r\n\r\n vertexData.indices = indices;\r\n vertexData.positions = positions;\r\n vertexData.applyToMesh(mesh, false);\r\n return mesh;\r\n }\r\n\r\n /**\r\n * Get a navigation mesh constrained position, closest to the parameter position\r\n * @param position world position\r\n * @returns the closest point to position constrained by the navigation mesh\r\n */\r\n getClosestPoint(position: Vector3): Vector3 {\r\n this._tempVec1.x = position.x;\r\n this._tempVec1.y = position.y;\r\n this._tempVec1.z = position.z;\r\n const ret = this.navMesh.getClosestPoint(this._tempVec1);\r\n const pr = new Vector3(ret.x, ret.y, ret.z);\r\n return pr;\r\n }\r\n\r\n /**\r\n * Get a navigation mesh constrained position, closest to the parameter position\r\n * @param position world position\r\n * @param result output the closest point to position constrained by the navigation mesh\r\n */\r\n getClosestPointToRef(position: Vector3, result: Vector3): void {\r\n this._tempVec1.x = position.x;\r\n this._tempVec1.y = position.y;\r\n this._tempVec1.z = position.z;\r\n const ret = this.navMesh.getClosestPoint(this._tempVec1);\r\n result.set(ret.x, ret.y, ret.z);\r\n }\r\n\r\n /**\r\n * Get a navigation mesh constrained position, within a particular radius\r\n * @param position world position\r\n * @param maxRadius the maximum distance to the constrained world position\r\n * @returns the closest point to position constrained by the navigation mesh\r\n */\r\n getRandomPointAround(position: Vector3, maxRadius: number): Vector3 {\r\n this._tempVec1.x = position.x;\r\n this._tempVec1.y = position.y;\r\n this._tempVec1.z = position.z;\r\n const ret = this.navMesh.getRandomPointAround(this._tempVec1, maxRadius);\r\n const pr = new Vector3(ret.x, ret.y, ret.z);\r\n return pr;\r\n }\r\n\r\n /**\r\n * Get a navigation mesh constrained position, within a particular radius\r\n * @param position world position\r\n * @param maxRadius the maximum distance to the constrained world position\r\n * @param result output the closest point to position constrained by the navigation mesh\r\n */\r\n getRandomPointAroundToRef(position: Vector3, maxRadius: number, result: Vector3): void {\r\n this._tempVec1.x = position.x;\r\n this._tempVec1.y = position.y;\r\n this._tempVec1.z = position.z;\r\n const ret = this.navMesh.getRandomPointAround(this._tempVec1, maxRadius);\r\n result.set(ret.x, ret.y, ret.z);\r\n }\r\n\r\n /**\r\n * Compute the final position from a segment made of destination-position\r\n * @param position world position\r\n * @param destination world position\r\n * @returns the resulting point along the navmesh\r\n */\r\n moveAlong(position: Vector3, destination: Vector3): Vector3 {\r\n this._tempVec1.x = position.x;\r\n this._tempVec1.y = position.y;\r\n this._tempVec1.z = position.z;\r\n this._tempVec2.x = destination.x;\r\n this._tempVec2.y = destination.y;\r\n this._tempVec2.z = destination.z;\r\n const ret = this.navMesh.moveAlong(this._tempVec1, this._tempVec2);\r\n const pr = new Vector3(ret.x, ret.y, ret.z);\r\n return pr;\r\n }\r\n\r\n /**\r\n * Compute the final position from a segment made of destination-position\r\n * @param position world position\r\n * @param destination world position\r\n * @param result output the resulting point along the navmesh\r\n */\r\n moveAlongToRef(position: Vector3, destination: Vector3, result: Vector3): void {\r\n this._tempVec1.x = position.x;\r\n this._tempVec1.y = position.y;\r\n this._tempVec1.z = position.z;\r\n this._tempVec2.x = destination.x;\r\n this._tempVec2.y = destination.y;\r\n this._tempVec2.z = destination.z;\r\n const ret = this.navMesh.moveAlong(this._tempVec1, this._tempVec2);\r\n result.set(ret.x, ret.y, ret.z);\r\n }\r\n\r\n private _convertNavPathPoints(navPath: any): Vector3[] {\r\n let pt: number;\r\n const pointCount = navPath.getPointCount();\r\n const positions = [];\r\n for (pt = 0; pt < pointCount; pt++) {\r\n const p = navPath.getPoint(pt);\r\n positions.push(new Vector3(p.x, p.y, p.z));\r\n }\r\n return positions;\r\n }\r\n\r\n /**\r\n * Compute a navigation path from start to end. Returns an empty array if no path can be computed\r\n * Path is straight.\r\n * @param start world position\r\n * @param end world position\r\n * @returns array containing world position composing the path\r\n */\r\n computePath(start: Vector3, end: Vector3): Vector3[] {\r\n this._tempVec1.x = start.x;\r\n this._tempVec1.y = start.y;\r\n this._tempVec1.z = start.z;\r\n this._tempVec2.x = end.x;\r\n this._tempVec2.y = end.y;\r\n this._tempVec2.z = end.z;\r\n const navPath = this.navMesh.computePath(this._tempVec1, this._tempVec2);\r\n return this._convertNavPathPoints(navPath);\r\n }\r\n\r\n /**\r\n * Compute a navigation path from start to end. Returns an empty array if no path can be computed.\r\n * Path follows navigation mesh geometry.\r\n * @param start world position\r\n * @param end world position\r\n * @returns array containing world position composing the path\r\n */\r\n computePathSmooth(start: Vector3, end: Vector3): Vector3[] {\r\n this._tempVec1.x = start.x;\r\n this._tempVec1.y = start.y;\r\n this._tempVec1.z = start.z;\r\n this._tempVec2.x = end.x;\r\n this._tempVec2.y = end.y;\r\n this._tempVec2.z = end.z;\r\n const navPath = this.navMesh.computePathSmooth(this._tempVec1, this._tempVec2);\r\n return this._convertNavPathPoints(navPath);\r\n }\r\n /**\r\n * Create a new Crowd so you can add agents\r\n * @param maxAgents the maximum agent count in the crowd\r\n * @param maxAgentRadius the maximum radius an agent can have\r\n * @param scene to attach the crowd to\r\n * @returns the crowd you can add agents to\r\n */\r\n createCrowd(maxAgents: number, maxAgentRadius: number, scene: Scene): ICrowd {\r\n const crowd = new RecastJSCrowd(this, maxAgents, maxAgentRadius, scene);\r\n return crowd;\r\n }\r\n\r\n /**\r\n * Set the Bounding box extent for doing spatial queries (getClosestPoint, getRandomPointAround, ...)\r\n * The queries will try to find a solution within those bounds\r\n * default is (1,1,1)\r\n * @param extent x,y,z value that define the extent around the queries point of reference\r\n */\r\n setDefaultQueryExtent(extent: Vector3): void {\r\n this._tempVec1.x = extent.x;\r\n this._tempVec1.y = extent.y;\r\n this._tempVec1.z = extent.z;\r\n this.navMesh.setDefaultQueryExtent(this._tempVec1);\r\n }\r\n\r\n /**\r\n * Get the Bounding box extent specified by setDefaultQueryExtent\r\n * @returns the box extent values\r\n */\r\n getDefaultQueryExtent(): Vector3 {\r\n const p = this.navMesh.getDefaultQueryExtent();\r\n return new Vector3(p.x, p.y, p.z);\r\n }\r\n\r\n /**\r\n * build the navmesh from a previously saved state using getNavmeshData\r\n * @param data the Uint8Array returned by getNavmeshData\r\n */\r\n buildFromNavmeshData(data: Uint8Array): void {\r\n const nDataBytes = data.length * data.BYTES_PER_ELEMENT;\r\n const dataPtr = this.bjsRECAST._malloc(nDataBytes);\r\n\r\n const dataHeap = new Uint8Array(this.bjsRECAST.HEAPU8.buffer, dataPtr, nDataBytes);\r\n dataHeap.set(data);\r\n\r\n const buf = new this.bjsRECAST.NavmeshData();\r\n buf.dataPointer = dataHeap.byteOffset;\r\n buf.size = data.length;\r\n this.navMesh = new this.bjsRECAST.NavMesh();\r\n this.navMesh.buildFromNavmeshData(buf);\r\n\r\n // Free memory\r\n this.bjsRECAST._free(dataHeap.byteOffset);\r\n }\r\n\r\n /**\r\n * returns the navmesh data that can be used later. The navmesh must be built before retrieving the data\r\n * @returns data the Uint8Array that can be saved and reused\r\n */\r\n getNavmeshData(): Uint8Array {\r\n const navmeshData = this.navMesh.getNavmeshData();\r\n const arrView = new Uint8Array(this.bjsRECAST.HEAPU8.buffer, navmeshData.dataPointer, navmeshData.size);\r\n const ret = new Uint8Array(navmeshData.size);\r\n ret.set(arrView);\r\n this.navMesh.freeNavmeshData(navmeshData);\r\n return ret;\r\n }\r\n\r\n /**\r\n * Get the Bounding box extent result specified by setDefaultQueryExtent\r\n * @param result output the box extent values\r\n */\r\n getDefaultQueryExtentToRef(result: Vector3): void {\r\n const p = this.navMesh.getDefaultQueryExtent();\r\n result.set(p.x, p.y, p.z);\r\n }\r\n\r\n /**\r\n * Disposes of the plugin resources\r\n */\r\n public dispose() {\r\n if (this._worker) {\r\n // Clear handlers and terminate the worker to avoid leaks\r\n this._worker.onmessage = null;\r\n // Clear other handlers if they were used\r\n (this._worker as any).onerror = null;\r\n this._worker.terminate();\r\n }\r\n this._worker = null;\r\n }\r\n\r\n /**\r\n * Creates a cylinder obstacle and add it to the navigation\r\n * @param position world position\r\n * @param radius cylinder radius\r\n * @param height cylinder height\r\n * @returns the obstacle freshly created\r\n */\r\n addCylinderObstacle(position: Vector3, radius: number, height: number): Nullable<IObstacle> {\r\n this._tempVec1.x = position.x;\r\n this._tempVec1.y = position.y;\r\n this._tempVec1.z = position.z;\r\n return this.navMesh.addCylinderObstacle(this._tempVec1, radius, height);\r\n }\r\n\r\n /**\r\n * Creates an oriented box obstacle and add it to the navigation\r\n * @param position world position\r\n * @param extent box size\r\n * @param angle angle in radians of the box orientation on Y axis\r\n * @returns the obstacle freshly created\r\n */\r\n addBoxObstacle(position: Vector3, extent: Vector3, angle: number): Nullable<IObstacle> {\r\n this._tempVec1.x = position.x;\r\n this._tempVec1.y = position.y;\r\n this._tempVec1.z = position.z;\r\n this._tempVec2.x = extent.x;\r\n this._tempVec2.y = extent.y;\r\n this._tempVec2.z = extent.z;\r\n return this.navMesh.addBoxObstacle(this._tempVec1, this._tempVec2, angle);\r\n }\r\n\r\n /**\r\n * Removes an obstacle created by addCylinderObstacle or addBoxObstacle\r\n * @param obstacle obstacle to remove from the navigation\r\n */\r\n removeObstacle(obstacle: IObstacle): void {\r\n this.navMesh.removeObstacle(obstacle);\r\n }\r\n\r\n /**\r\n * If this plugin is supported\r\n * @returns true if plugin is supported\r\n */\r\n public isSupported(): boolean {\r\n return this.bjsRECAST !== undefined;\r\n }\r\n\r\n /**\r\n * Returns the seed used for randomized functions like `getRandomPointAround`\r\n * @returns seed number\r\n */\r\n public getRandomSeed(): number {\r\n return this.bjsRECAST._getRandomSeed();\r\n }\r\n\r\n /**\r\n * Set the seed used for randomized functions like `getRandomPointAround`\r\n * @param seed number used as seed for random functions\r\n */\r\n public setRandomSeed(seed: number): void {\r\n this.bjsRECAST._setRandomSeed(seed);\r\n }\r\n}\r\n\r\n/**\r\n * Recast detour crowd implementation\r\n */\r\nexport class RecastJSCrowd implements ICrowd {\r\n /**\r\n * Recast/detour plugin\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n public bjsRECASTPlugin: RecastJSPlugin;\r\n /**\r\n * Link to the detour crowd\r\n */\r\n public recastCrowd: any = {};\r\n /**\r\n * One transform per agent\r\n */\r\n public transforms: TransformNode[] = new Array<TransformNode>();\r\n /**\r\n * All agents created\r\n */\r\n public agents: number[] = new Array<number>();\r\n /**\r\n * agents reach radius\r\n */\r\n public reachRadii: number[] = new Array<number>();\r\n /**\r\n * true when a destination is active for an agent and notifier hasn't been notified of reach\r\n */\r\n private _agentDestinationArmed: boolean[] = new Array<boolean>();\r\n /**\r\n * agent current target\r\n */\r\n private _agentDestination: Vector3[] = new Array<Vector3>();\r\n /**\r\n * Link to the scene is kept to unregister the crowd from the scene\r\n */\r\n private _scene: Scene;\r\n\r\n /**\r\n * Observer for crowd updates\r\n */\r\n private _onBeforeAnimationsObserver: Nullable<Observer<Scene>> = null;\r\n\r\n /**\r\n * Fires each time an agent is in reach radius of its destination\r\n */\r\n public onReachTargetObservable = new Observable<{ agentIndex: number; destination: Vector3 }>();\r\n\r\n /**\r\n * Constructor\r\n * @param plugin recastJS plugin\r\n * @param maxAgents the maximum agent count in the crowd\r\n * @param maxAgentRadius the maximum radius an agent can have\r\n * @param scene to attach the crowd to\r\n * @returns the crowd you can add agents to\r\n */\r\n public constructor(plugin: RecastJSPlugin, maxAgents: number, maxAgentRadius: number, scene: Scene) {\r\n this.bjsRECASTPlugin = plugin;\r\n this.recastCrowd = new this.bjsRECASTPlugin.bjsRECAST.Crowd(maxAgents, maxAgentRadius, this.bjsRECASTPlugin.navMesh.getNavMesh());\r\n this._scene = scene;\r\n\r\n this._onBeforeAnimationsObserver = scene.onBeforeAnimationsObservable.add(() => {\r\n this.update(scene.getEngine().getDeltaTime() * 0.001 * plugin.timeFactor);\r\n });\r\n }\r\n\r\n /**\r\n * Add a new agent to the crowd with the specified parameter a corresponding transformNode.\r\n * You can attach anything to that node. The node position is updated in the scene update tick.\r\n * @param pos world position that will be constrained by the navigation mesh\r\n * @param parameters agent parameters\r\n * @param transform hooked to the agent that will be update by the scene\r\n * @returns agent index\r\n */\r\n addAgent(pos: Vector3, parameters: IAgentParameters, transform: TransformNode): number {\r\n const agentParams = new this.bjsRECASTPlugin.bjsRECAST.dtCrowdAgentParams();\r\n agentParams.radius = parameters.radius;\r\n agentParams.height = parameters.height;\r\n agentParams.maxAcceleration = parameters.maxAcceleration;\r\n agentParams.maxSpeed = parameters.maxSpeed;\r\n agentParams.collisionQueryRange = parameters.collisionQueryRange;\r\n agentParams.pathOptimizationRange = parameters.pathOptimizationRange;\r\n agentParams.separationWeight = parameters.separationWeight;\r\n agentParams.updateFlags = 7;\r\n agentParams.obstacleAvoidanceType = 0;\r\n agentParams.queryFilterType = 0;\r\n agentParams.userData = 0;\r\n\r\n const agentIndex = this.recastCrowd.addAgent(new this.bjsRECASTPlugin.bjsRECAST.Vec3(pos.x, pos.y, pos.z), agentParams);\r\n this.transforms.push(transform);\r\n this.agents.push(agentIndex);\r\n this.reachRadii.push(parameters.reachRadius ? parameters.reachRadius : parameters.radius);\r\n this._agentDestinationArmed.push(false);\r\n this._agentDestination.push(new Vector3(0, 0, 0));\r\n return agentIndex;\r\n }\r\n\r\n /**\r\n * Returns the agent position in world space\r\n * @param index agent index returned by addAgent\r\n * @returns world space position\r\n */\r\n getAgentPosition(index: number): Vector3 {\r\n const agentPos = this.recastCrowd.getAgentPosition(index);\r\n return new Vector3(agentPos.x, agentPos.y, agentPos.z);\r\n }\r\n\r\n /**\r\n * Returns the agent position result in world space\r\n * @param index agent index returned by addAgent\r\n * @param result output world space position\r\n */\r\n getAgentPositionToRef(index: number, result: Vector3): void {\r\n const agentPos = this.recastCrowd.getAgentPosition(index);\r\n result.set(agentPos.x, agentPos.y, agentPos.z);\r\n }\r\n\r\n /**\r\n * Returns the agent velocity in world space\r\n * @param index agent index returned by addAgent\r\n * @returns world space velocity\r\n */\r\n getAgentVelocity(index: number): Vector3 {\r\n const agentVel = this.recastCrowd.getAgentVelocity(index);\r\n return new Vector3(agentVel.x, agentVel.y, agentVel.z);\r\n }\r\n\r\n /**\r\n * Returns the agent velocity result in world space\r\n * @param index agent index returned by addAgent\r\n * @param result output world space velocity\r\n */\r\n getAgentVelocityToRef(index: number, result: Vector3): void {\r\n const agentVel = this.recastCrowd.getAgentVelocity(index);\r\n result.set(agentVel.x, agentVel.y, agentVel.z);\r\n }\r\n\r\n /**\r\n * Returns the agent next target point on the path\r\n * @param index agent index returned by addAgent\r\n * @returns world space position\r\n */\r\n getAgentNextTargetPath(index: number): Vector3 {\r\n const pathTargetPos = this.recastCrowd.getAgentNextTargetPath(index);\r\n return new Vector3(pathTargetPos.x, pathTargetPos.y, pathTargetPos.z);\r\n }\r\n\r\n /**\r\n * Returns the agent next target point on the path\r\n * @param index agent index returned by addAgent\r\n * @param result output world space position\r\n */\r\n getAgentNextTargetPathToRef(index: number, result: Vector3): void {\r\n const pathTargetPos = this.recastCrowd.getAgentNextTargetPath(index);\r\n result.set(pathTargetPos.x, pathTargetPos.y, pathTargetPos.z);\r\n }\r\n\r\n /**\r\n * Gets the agent state\r\n * @param index agent index returned by addAgent\r\n * @returns agent state\r\n */\r\n getAgentState(index: number): number {\r\n return this.recastCrowd.getAgentState(index);\r\n }\r\n\r\n /**\r\n * returns true if the agent in over an off mesh link connection\r\n * @param index agent index returned by addAgent\r\n * @returns true if over an off mesh link connection\r\n */\r\n overOffmeshConnection(index: number): boolean {\r\n return this.recastCrowd.overOffmeshConnection(index);\r\n }\r\n\r\n /**\r\n * Asks a particular agent to go to a destination. That destination is constrained by the navigation mesh\r\n * @param index agent index returned by addAgent\r\n * @param destination targeted world position\r\n */\r\n agentGoto(index: number, destination: Vector3): void {\r\n this.recastCrowd.agentGoto(index, new this.bjsRECASTPlugin.bjsRECAST.Vec3(destination.x, destination.y, destination.z));\r\n\r\n // arm observer\r\n const item = this.agents.indexOf(index);\r\n if (item > -1) {\r\n this._agentDestinationArmed[item] = true;\r\n this._agentDestination[item].set(destination.x, destination.y, destination.z);\r\n }\r\n }\r\n\r\n /**\r\n * Teleport the agent to a new position\r\n * @param index agent index returned by addAgent\r\n * @param destination targeted world position\r\n */\r\n agentTeleport(index: number, destination: Vector3): void {\r\n this.recastCrowd.agentTeleport(index, new this.bjsRECASTPlugin.bjsRECAST.Vec3(destination.x, destination.y, destination.z));\r\n }\r\n\r\n /**\r\n * Update agent parameters\r\n * @param index agent index returned by addAgent\r\n * @param parameters agent parameters\r\n */\r\n updateAgentParameters(index: number, parameters: IAgentParameters): void {\r\n const agentParams = this.recastCrowd.getAgentParameters(index);\r\n\r\n if (parameters.radius !== undefined) {\r\n agentParams.radius = parameters.radius;\r\n }\r\n if (parameters.height !== undefined) {\r\n agentParams.height = parameters.height;\r\n }\r\n if (parameters.maxAcceleration !== undefined) {\r\n agentParams.maxAcceleration = parameters.maxAcceleration;\r\n }\r\n if (parameters.maxSpeed !== undefined) {\r\n agentParams.maxSpeed = parameters.maxSpeed;\r\n }\r\n if (parameters.collisionQueryRange !== undefined) {\r\n agentParams.collisionQueryRange = parameters.collisionQueryRange;\r\n }\r\n if (parameters.pathOptimizationRange !== undefined) {\r\n agentParams.pathOptimizationRange = parameters.pathOptimizationRange;\r\n }\r\n if (parameters.separationWeight !== undefined) {\r\n agentParams.separationWeight = parameters.separationWeight;\r\n }\r\n\r\n this.recastCrowd.setAgentParameters(index, agentParams);\r\n }\r\n\r\n /**\r\n * remove a particular agent previously created\r\n * @param index agent index returned by addAgent\r\n */\r\n removeAgent(index: number): void {\r\n this.recastCrowd.removeAgent(index);\r\n\r\n const item = this.agents.indexOf(index);\r\n if (item > -1) {\r\n this.agents.splice(item, 1);\r\n this.transforms.splice(item, 1);\r\n this.reachRadii.splice(item, 1);\r\n this._agentDestinationArmed.splice(item, 1);\r\n this._agentDestination.splice(item, 1);\r\n }\r\n }\r\n\r\n /**\r\n * get the list of all agents attached to this crowd\r\n * @returns list of agent indices\r\n */\r\n getAgents(): number[] {\r\n return this.agents;\r\n }\r\n\r\n /**\r\n * Tick update done by the Scene. Agent position/velocity/acceleration is updated by this function\r\n * @param deltaTime in seconds\r\n */\r\n update(deltaTime: number): void {\r\n // update obstacles\r\n this.bjsRECASTPlugin.navMesh.update();\r\n\r\n if (deltaTime <= Epsilon) {\r\n return;\r\n }\r\n // update crowd\r\n const timeStep = this.bjsRECASTPlugin.getTimeStep();\r\n const maxStepCount = this.bjsRECASTPlugin.getMaximumSubStepCount();\r\n if (timeStep <= Epsilon) {\r\n this.recastCrowd.update(deltaTime);\r\n } else {\r\n let iterationCount = Math.floor(deltaTime / timeStep);\r\n if (maxStepCount && iterationCount > maxStepCount) {\r\n iterationCount = maxStepCount;\r\n }\r\n if (iterationCount < 1) {\r\n iterationCount = 1;\r\n }\r\n\r\n const step = deltaTime / iterationCount;\r\n for (let i = 0; i < iterationCount; i++) {\r\n this.recastCrowd.update(step);\r\n }\r\n }\r\n\r\n // update transforms\r\n for (let index = 0; index < this.agents.length; index++) {\r\n // update transform position\r\n const agentIndex = this.agents[index];\r\n const agentPosition = this.getAgentPosition(agentIndex);\r\n this.transforms[index].position = agentPosition;\r\n // check agent reach destination\r\n if (this._agentDestinationArmed[index]) {\r\n const dx = agentPosition.x - this._agentDestination[index].x;\r\n const dz = agentPosition.z - this._agentDestination[index].z;\r\n const radius = this.reachRadii[index];\r\n const groundY = this._agentDestination[index].y - this.reachRadii[index];\r\n const ceilingY = this._agentDestination[index].y + this.reachRadii[index];\r\n const distanceXZSquared = dx * dx + dz * dz;\r\n if (agentPosition.y > groundY && agentPosition.y < ceilingY && distanceXZSquared < radius * radius) {\r\n this._agentDestinationArmed[index] = false;\r\n this.onReachTargetObservable.notifyObservers({ agentIndex: agentIndex, destination: this._agentDestination[index] });\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Set the Bounding box extent for doing spatial queries (getClosestPoint, getRandomPointAround, ...)\r\n * The queries will try to find a solution within those bounds\r\n * default is (1,1,1)\r\n * @param extent x,y,z value that define the extent around the queries point of reference\r\n */\r\n setDefaultQueryExtent(extent: Vector3): void {\r\n const ext = new this.bjsRECASTPlugin.bjsRECAST.Vec3(extent.x, extent.y, extent.z);\r\n this.recastCrowd.setDefaultQueryExtent(ext);\r\n }\r\n\r\n /**\r\n * Get the Bounding box extent specified by setDefaultQueryExtent\r\n * @returns the box extent values\r\n */\r\n getDefaultQueryExtent(): Vector3 {\r\n const p = this.recastCrowd.getDefaultQueryExtent();\r\n return new Vector3(p.x, p.y, p.z);\r\n }\r\n\r\n /**\r\n * Get the Bounding box extent result specified by setDefaultQueryExtent\r\n * @param result output the box extent values\r\n */\r\n getDefaultQueryExtentToRef(result: Vector3): void {\r\n const p = this.recastCrowd.getDefaultQueryExtent();\r\n result.set(p.x, p.y, p.z);\r\n }\r\n\r\n /**\r\n * Get the next corner points composing the path (max 4 points)\r\n * @param index agent index returned by addAgent\r\n * @returns array containing world position composing the path\r\n */\r\n getCorners(index: number): Vector3[] {\r\n let pt: number;\r\n const navPath = this.recastCrowd.getCorners(index);\r\n const pointCount = navPath.getPointCount();\r\n const positions = [];\r\n for (pt = 0; pt < pointCount; pt++) {\r\n const p = navPath.getPoint(pt);\r\n positions.push(new Vector3(p.x, p.y, p.z));\r\n }\r\n return positions;\r\n }\r\n\r\n /**\r\n * Release all resources\r\n */\r\n dispose(): void {\r\n this.recastCrowd.destroy();\r\n this._scene.onBeforeAnimationsObservable.remove(this._onBeforeAnimationsObserver);\r\n this._onBeforeAnimationsObserver = null;\r\n this.onReachTargetObservable.clear();\r\n }\r\n}\r\n"]}
|
|
@@ -33,6 +33,9 @@ export declare class CastingResult {
|
|
|
33
33
|
* Gets if there was a hit
|
|
34
34
|
*/
|
|
35
35
|
get hasHit(): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* The index of the original triangle which was hit. Will be -1 if contact point is not on a mesh shape
|
|
38
|
+
*/
|
|
36
39
|
get triangleIndex(): number;
|
|
37
40
|
/**
|
|
38
41
|
* Sets the hit data
|
|
@@ -47,7 +50,7 @@ export declare class CastingResult {
|
|
|
47
50
|
reset(): void;
|
|
48
51
|
}
|
|
49
52
|
/**
|
|
50
|
-
* Interface for
|
|
53
|
+
* Interface for 3D coordinates
|
|
51
54
|
*/
|
|
52
55
|
interface IXYZ {
|
|
53
56
|
/**
|
package/Physics/castingResult.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"castingResult.js","sourceRoot":"","sources":["../../../../dev/core/src/Physics/castingResult.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAI/C;;GAEG;AACH,MAAM,OAAO,aAAa;IAA1B;QACY,YAAO,GAAY,KAAK,CAAC;QACvB,eAAU,GAAY,OAAO,CAAC,IAAI,EAAE,CAAC;QACrC,cAAS,GAAY,OAAO,CAAC,IAAI,EAAE,CAAC;QACtC,mBAAc,GAAW,CAAC,CAAC,CAAC;IAsExC,CAAC;IAtDG;;OAEG;IACH,IAAI,QAAQ;QACR,OAAO,IAAI,CAAC,SAAS,CAAC;IAC1B,CAAC;IACD;;OAEG;IACH,IAAI,SAAS;QACT,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;IACD;;OAEG;IACH,IAAI,MAAM;QACN,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED;;OAEG;IACH,IAAI,aAAa;QACb,OAAO,IAAI,CAAC,cAAc,CAAC;IAC/B,CAAC;IAED;;;;;OAKG;IACI,UAAU,CAAC,SAAe,EAAE,QAAc,EAAE,aAAsB;QACrE,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;QAC3D,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;QACvD,IAAI,CAAC,cAAc,GAAG,aAAa,IAAI,CAAC,CAAC,CAAC;IAC9C,CAAC;IAED;;OAEG;IACI,KAAK;QACR,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;QAErB,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QAC1B,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QACzB,IAAI,CAAC,cAAc,GAAG,CAAC,CAAC,CAAC;QAEzB,IAAI,CAAC,IAAI,GAAG,SAAS,CAAC;QACtB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAE3B,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC;IAC3B,CAAC;CACJ","sourcesContent":["import { Vector3 } from \"../Maths/math.vector\";\r\nimport type { PhysicsShape } from \"./v2/physicsShape\";\r\nimport type { PhysicsBody } from \"./v2/physicsBody\";\r\n\r\n/**\r\n * Base class for results of casts.\r\n */\r\nexport class CastingResult {\r\n private _hasHit: boolean = false;\r\n protected _hitNormal: Vector3 = Vector3.Zero();\r\n protected _hitPoint: Vector3 = Vector3.Zero();\r\n private _triangleIndex: number = -1;\r\n\r\n /**\r\n * The Physics body that the query hit.\r\n */\r\n public body?: PhysicsBody;\r\n /**\r\n * The body Index in case the Physics body is using instances\r\n */\r\n public bodyIndex?: number;\r\n\r\n /**\r\n * The shape hit by the query.\r\n */\r\n public shape?: PhysicsShape;\r\n\r\n /**\r\n * Gets the hit point.\r\n */\r\n get hitPoint(): Vector3 {\r\n return this._hitPoint;\r\n }\r\n /**\r\n * Gets the hit normal.\r\n */\r\n get hitNormal(): Vector3 {\r\n return this._hitNormal;\r\n }\r\n /**\r\n * Gets if there was a hit\r\n */\r\n get hasHit(): boolean {\r\n return this._hasHit;\r\n }\r\n\r\n
|
|
1
|
+
{"version":3,"file":"castingResult.js","sourceRoot":"","sources":["../../../../dev/core/src/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AAC,cAAc,GAAG,CAAC,CAAC,CAAC;QAEzB,IAAI,CAAC,IAAI,GAAG,SAAS,CAAC;QACtB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAE3B,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC;IAC3B,CAAC;CACJ","sourcesContent":["import { Vector3 } from \"../Maths/math.vector\";\r\nimport type { PhysicsShape } from \"./v2/physicsShape\";\r\nimport type { PhysicsBody } from \"./v2/physicsBody\";\r\n\r\n/**\r\n * Base class for results of casts.\r\n */\r\nexport class CastingResult {\r\n private _hasHit: boolean = false;\r\n protected _hitNormal: Vector3 = Vector3.Zero();\r\n protected _hitPoint: Vector3 = Vector3.Zero();\r\n private _triangleIndex: number = -1;\r\n\r\n /**\r\n * The Physics body that the query hit.\r\n */\r\n public body?: PhysicsBody;\r\n /**\r\n * The body Index in case the Physics body is using instances\r\n */\r\n public bodyIndex?: number;\r\n\r\n /**\r\n * The shape hit by the query.\r\n */\r\n public shape?: PhysicsShape;\r\n\r\n /**\r\n * Gets the hit point.\r\n */\r\n get hitPoint(): Vector3 {\r\n return this._hitPoint;\r\n }\r\n /**\r\n * Gets the hit normal.\r\n */\r\n get hitNormal(): Vector3 {\r\n return this._hitNormal;\r\n }\r\n /**\r\n * Gets if there was a hit\r\n */\r\n get hasHit(): boolean {\r\n return this._hasHit;\r\n }\r\n\r\n /**\r\n * The index of the original triangle which was hit. Will be -1 if contact point is not on a mesh shape\r\n */\r\n get triangleIndex(): number {\r\n return this._triangleIndex;\r\n }\r\n\r\n /**\r\n * Sets the hit data\r\n * @param hitNormal defines the normal in world space\r\n * @param hitPoint defines the point in world space\r\n * @param triangleIndex defines the index of the triangle in case of mesh shape\r\n */\r\n public setHitData(hitNormal: IXYZ, hitPoint: IXYZ, triangleIndex?: number) {\r\n this._hasHit = true;\r\n this._hitNormal.set(hitNormal.x, hitNormal.y, hitNormal.z);\r\n this._hitPoint.set(hitPoint.x, hitPoint.y, hitPoint.z);\r\n this._triangleIndex = triangleIndex ?? -1;\r\n }\r\n\r\n /**\r\n * Resets all the values to default\r\n */\r\n public reset() {\r\n this._hasHit = false;\r\n\r\n this._hitNormal.setAll(0);\r\n this._hitPoint.setAll(0);\r\n this._triangleIndex = -1;\r\n\r\n this.body = undefined;\r\n this.bodyIndex = undefined;\r\n\r\n this.shape = undefined;\r\n }\r\n}\r\n\r\n/**\r\n * Interface for 3D coordinates\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\ninterface IXYZ {\r\n /**\r\n * X\r\n */\r\n x: number;\r\n\r\n /**\r\n * Y\r\n */\r\n y: number;\r\n\r\n /**\r\n * Z\r\n */\r\n z: number;\r\n}\r\n"]}
|
|
@@ -60,7 +60,7 @@ Scene.prototype.disablePhysicsEngine = function () {
|
|
|
60
60
|
* @returns a boolean indicating if there is an active physics engine
|
|
61
61
|
*/
|
|
62
62
|
Scene.prototype.isPhysicsEnabled = function () {
|
|
63
|
-
return this._physicsEngine
|
|
63
|
+
return !!this._physicsEngine;
|
|
64
64
|
};
|
|
65
65
|
/**
|
|
66
66
|
* Deletes a physics compound impostor
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"joinedPhysicsEngineComponent.js","sourceRoot":"","sources":["../../../../dev/core/src/Physics/joinedPhysicsEngineComponent.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAIhD,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAIjC,OAAO,EAAE,aAAa,IAAI,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,EAAE,aAAa,IAAI,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAqDtE;;;GAGG;AACH,KAAK,CAAC,SAAS,CAAC,gBAAgB,GAAG;IAC/B,OAAO,IAAI,CA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ACrD,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC;YACvC,IAAI,CAAC,wBAAwB,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;QACxD,CAAC;IACL,CAAC;AACL,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,OAAO,2BAA2B;IAWpC;;;OAGG;IACH,YAAY,KAAY;QAdxB;;WAEG;QACa,SAAI,GAAG,uBAAuB,CAAC,kBAAkB,CAAC;QAY9D,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,KAAK,CAAC,yBAAyB,GAAG,IAAI,UAAU,EAAS,CAAC;QAC/D,IAAI,CAAC,KAAK,CAAC,wBAAwB,GAAG,IAAI,UAAU,EAAS,CAAC;QAE9D,gEAAgE;QAChE,IAAI,CAAC,KAAK,CAAC,yBAAyB,GAAG,GAAG,EAAE;YACxC,IAAI,IAAI,CAAC,KAAK,CAAC,cAAc,EAAE,CAAC;gBAC5B,OAAO,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC;YAC1D,CAAC;YAED,OAAO,MAAM,GAAG,IAAI,CAAC;QACzB,CAAC,CAAC;IACN,CAAC;IAED;;OAEG;IACI,QAAQ,KAAU,CAAC;IAE1B;;;OAGG;IACI,OAAO;QACV,mCAAmC;IACvC,CAAC;IAED;;OAEG;IACI,OAAO;QACV,IAAI,CAAC,KAAK,CAAC,yBAAyB,CAAC,KAAK,EAAE,CAAC;QAC7C,IAAI,CAAC,KAAK,CAAC,wBAAwB,CAAC,KAAK,EAAE,CAAC;QAE5C,IAAI,IAAI,CAAC,KAAK,CAAC,cAAc,EAAE,CAAC;YAC5B,IAAI,CAAC,KAAK,CAAC,oBAAoB,EAAE,CAAC;QACtC,CAAC;IACL,CAAC;CACJ","sourcesContent":["import type { Nullable } from \"../types\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport type { Vector3 } from \"../Maths/math.vector\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport type { ISceneComponent } from \"../sceneComponent\";\r\nimport { SceneComponentConstants } from \"../sceneComponent\";\r\nimport { Scene } from \"../scene\";\r\nimport type { IPhysicsEngine } from \"./IPhysicsEngine\";\r\nimport type { IPhysicsEnginePlugin as IPhysicsEnginePluginV1 } from \"./v1/IPhysicsEnginePlugin\";\r\nimport type { IPhysicsEnginePluginV2 } from \"./v2/IPhysicsEnginePlugin\";\r\nimport { PhysicsEngine as PhysicsEngineV1 } from \"./v1/physicsEngine\";\r\nimport { PhysicsEngine as PhysicsEngineV2 } from \"./v2/physicsEngine\";\r\n\r\ndeclare module \"../scene\" {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n export interface Scene {\r\n /** @internal (Backing field) */\r\n _physicsEngine: Nullable<IPhysicsEngine>;\r\n /** @internal */\r\n _physicsTimeAccumulator: number;\r\n\r\n /**\r\n * Gets the current physics engine\r\n * @returns a IPhysicsEngine or null if none attached\r\n */\r\n getPhysicsEngine(): Nullable<IPhysicsEngine>;\r\n\r\n /**\r\n * Enables physics to the current scene\r\n * @param gravity defines the scene's gravity for the physics engine. defaults to real earth gravity : (0, -9.81, 0)\r\n * @param plugin defines the physics engine to be used. defaults to CannonJS.\r\n * @returns a boolean indicating if the physics engine was initialized\r\n */\r\n enablePhysics(gravity?: Nullable<Vector3>, plugin?: IPhysicsEnginePluginV1 | IPhysicsEnginePluginV2): boolean;\r\n\r\n /**\r\n * Disables and disposes the physics engine associated with the scene\r\n */\r\n disablePhysicsEngine(): void;\r\n\r\n /**\r\n * Gets a boolean indicating if there is an active physics engine\r\n * @returns a boolean indicating if there is an active physics engine\r\n */\r\n isPhysicsEnabled(): boolean;\r\n\r\n /**\r\n * Deletes a physics compound impostor\r\n * @param compound defines the compound to delete\r\n */\r\n deleteCompoundImpostor(compound: any): void;\r\n\r\n /**\r\n * An event triggered when physic simulation is about to be run\r\n */\r\n onBeforePhysicsObservable: Observable<Scene>;\r\n\r\n /**\r\n * An event triggered when physic simulation has been done\r\n */\r\n onAfterPhysicsObservable: Observable<Scene>;\r\n }\r\n}\r\n\r\n/**\r\n * Gets the current physics engine\r\n * @returns a IPhysicsEngine or null if none attached\r\n */\r\nScene.prototype.getPhysicsEngine = function (): Nullable<IPhysicsEngine> {\r\n return this._physicsEngine ?? null;\r\n};\r\n\r\n/**\r\n * Enables physics to the current scene\r\n * @param gravity defines the scene's gravity for the physics engine\r\n * @param plugin defines the physics engine to be used. defaults to CannonJS.\r\n * @returns a boolean indicating if the physics engine was initialized\r\n */\r\nScene.prototype.enablePhysics = function (gravity: Nullable<Vector3> = null, plugin?: IPhysicsEnginePluginV1 | IPhysicsEnginePluginV2): boolean {\r\n if (this._physicsEngine) {\r\n return true;\r\n }\r\n\r\n // Register the component to the scene\r\n let component = this._getComponent(SceneComponentConstants.NAME_PHYSICSENGINE) as PhysicsEngineSceneComponent;\r\n if (!component) {\r\n component = new PhysicsEngineSceneComponent(this);\r\n this._addComponent(component);\r\n }\r\n\r\n try {\r\n if (!plugin || plugin?.getPluginVersion() === 1) {\r\n this._physicsEngine = new PhysicsEngineV1(gravity, plugin as IPhysicsEnginePluginV1);\r\n } else if (plugin?.getPluginVersion() === 2) {\r\n this._physicsEngine = new PhysicsEngineV2(gravity, plugin as IPhysicsEnginePluginV2);\r\n } else {\r\n throw new Error(\"Unsupported Physics plugin version.\");\r\n }\r\n this._physicsTimeAccumulator = 0;\r\n return true;\r\n } catch (e) {\r\n Logger.Error(e.message);\r\n return false;\r\n }\r\n};\r\n\r\n/**\r\n * Disables and disposes the physics engine associated with the scene\r\n */\r\nScene.prototype.disablePhysicsEngine = function (): void {\r\n if (!this._physicsEngine) {\r\n return;\r\n }\r\n\r\n this._physicsEngine.dispose();\r\n this._physicsEngine = null;\r\n};\r\n\r\n/**\r\n * Gets a boolean indicating if there is an active physics engine\r\n * @returns a boolean indicating if there is an active physics engine\r\n */\r\nScene.prototype.isPhysicsEnabled = function (): boolean {\r\n return this._physicsEngine !== undefined;\r\n};\r\n\r\n/**\r\n * Deletes a physics compound impostor\r\n * @param compound defines the compound to delete\r\n */\r\nScene.prototype.deleteCompoundImpostor = function (compound: any): void {\r\n const mesh: AbstractMesh = compound.parts[0].mesh;\r\n\r\n if (mesh.physicsImpostor) {\r\n mesh.physicsImpostor.dispose(/*true*/);\r\n mesh.physicsImpostor = null;\r\n }\r\n};\r\n\r\n/**\r\n * @internal\r\n */\r\nScene.prototype._advancePhysicsEngineStep = function (step: number) {\r\n if (this._physicsEngine) {\r\n const subTime = this._physicsEngine.getSubTimeStep();\r\n if (subTime > 0) {\r\n this._physicsTimeAccumulator += step;\r\n while (this._physicsTimeAccumulator > subTime) {\r\n this.onBeforePhysicsObservable.notifyObservers(this);\r\n this._physicsEngine._step(subTime / 1000);\r\n this.onAfterPhysicsObservable.notifyObservers(this);\r\n this._physicsTimeAccumulator -= subTime;\r\n }\r\n } else {\r\n this.onBeforePhysicsObservable.notifyObservers(this);\r\n this._physicsEngine._step(step / 1000);\r\n this.onAfterPhysicsObservable.notifyObservers(this);\r\n }\r\n }\r\n};\r\n\r\n/**\r\n * Defines the physics engine scene component responsible to manage a physics engine\r\n */\r\nexport class PhysicsEngineSceneComponent implements ISceneComponent {\r\n /**\r\n * The component name helpful to identify the component in the list of scene components.\r\n */\r\n public readonly name = SceneComponentConstants.NAME_PHYSICSENGINE;\r\n\r\n /**\r\n * The scene the component belongs to.\r\n */\r\n public scene: Scene;\r\n\r\n /**\r\n * Creates a new instance of the component for the given scene\r\n * @param scene Defines the scene to register the component in\r\n */\r\n constructor(scene: Scene) {\r\n this.scene = scene;\r\n this.scene.onBeforePhysicsObservable = new Observable<Scene>();\r\n this.scene.onAfterPhysicsObservable = new Observable<Scene>();\r\n\r\n // Replace the function used to get the deterministic frame time\r\n this.scene.getDeterministicFrameTime = () => {\r\n if (this.scene._physicsEngine) {\r\n return this.scene._physicsEngine.getTimeStep() * 1000;\r\n }\r\n\r\n return 1000.0 / 60.0;\r\n };\r\n }\r\n\r\n /**\r\n * Registers the component in a given scene\r\n */\r\n public register(): void {}\r\n\r\n /**\r\n * Rebuilds the elements related to this component in case of\r\n * context lost for instance.\r\n */\r\n public rebuild(): void {\r\n // Nothing to do for this component\r\n }\r\n\r\n /**\r\n * Disposes the component and the associated resources\r\n */\r\n public dispose(): void {\r\n this.scene.onBeforePhysicsObservable.clear();\r\n this.scene.onAfterPhysicsObservable.clear();\r\n\r\n if (this.scene._physicsEngine) {\r\n this.scene.disablePhysicsEngine();\r\n }\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"joinedPhysicsEngineComponent.js","sourceRoot":"","sources":["../../../../dev/core/src/Physics/joinedPhysicsEngineComponent.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAIhD,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAIjC,OAAO,EAAE,aAAa,IAAI,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,EAAE,aAAa,IAAI,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAqDtE;;;GAGG;AACH,KAAK,CAAC,SAAS,CAAC,gBAAgB,GAAG;IAC/B,OAAO,IAAI,CAAC,cAAc,IAAI,IAAI,CAAC;AACvC,CAAC,CAAC;AAEF;;;;;GAKG;AACH,KAAK,CAAC,SAAS,CAAC,aAAa,GAAG,UAAU,UAA6B,IAAI,EAAE,MAAwD;IACjI,IAAI,IAAI,CAAC,cAAc,EAAE,CAAC;QACtB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,sCAAsC;IACtC,IAAI,SAAS,GAAG,IAAI,CAAC,aAAa,CAAC,uBAAuB,CAAC,kBAAkB,CAAgC,CAAC;IAC9G,IAAI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AAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,KAAK,CAAC,yBAAyB,GAAG,IAAI,UAAU,EAAS,CAAC;QAC/D,IAAI,CAAC,KAAK,CAAC,wBAAwB,GAAG,IAAI,UAAU,EAAS,CAAC;QAE9D,gEAAgE;QAChE,IAAI,CAAC,KAAK,CAAC,yBAAyB,GAAG,GAAG,EAAE;YACxC,IAAI,IAAI,CAAC,KAAK,CAAC,cAAc,EAAE,CAAC;gBAC5B,OAAO,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC;YAC1D,CAAC;YAED,OAAO,MAAM,GAAG,IAAI,CAAC;QACzB,CAAC,CAAC;IACN,CAAC;IAED;;OAEG;IACI,QAAQ,KAAU,CAAC;IAE1B;;;OAGG;IACI,OAAO;QACV,mCAAmC;IACvC,CAAC;IAED;;OAEG;IACI,OAAO;QACV,IAAI,CAAC,KAAK,CAAC,yBAAyB,CAAC,KAAK,EAAE,CAAC;QAC7C,IAAI,CAAC,KAAK,CAAC,wBAAwB,CAAC,KAAK,EAAE,CAAC;QAE5C,IAAI,IAAI,CAAC,KAAK,CAAC,cAAc,EAAE,CAAC;YAC5B,IAAI,CAAC,KAAK,CAAC,oBAAoB,EAAE,CAAC;QACtC,CAAC;IACL,CAAC;CACJ","sourcesContent":["import type { Nullable } from \"../types\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport { Observable } from \"../Misc/observable\";\r\nimport type { Vector3 } from \"../Maths/math.vector\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport type { ISceneComponent } from \"../sceneComponent\";\r\nimport { SceneComponentConstants } from \"../sceneComponent\";\r\nimport { Scene } from \"../scene\";\r\nimport type { IPhysicsEngine } from \"./IPhysicsEngine\";\r\nimport type { IPhysicsEnginePlugin as IPhysicsEnginePluginV1 } from \"./v1/IPhysicsEnginePlugin\";\r\nimport type { IPhysicsEnginePluginV2 } from \"./v2/IPhysicsEnginePlugin\";\r\nimport { PhysicsEngine as PhysicsEngineV1 } from \"./v1/physicsEngine\";\r\nimport { PhysicsEngine as PhysicsEngineV2 } from \"./v2/physicsEngine\";\r\n\r\ndeclare module \"../scene\" {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n export interface Scene {\r\n /** @internal (Backing field) */\r\n _physicsEngine: Nullable<IPhysicsEngine>;\r\n /** @internal */\r\n _physicsTimeAccumulator: number;\r\n\r\n /**\r\n * Gets the current physics engine\r\n * @returns a IPhysicsEngine or null if none attached\r\n */\r\n getPhysicsEngine(): Nullable<IPhysicsEngine>;\r\n\r\n /**\r\n * Enables physics to the current scene\r\n * @param gravity defines the scene's gravity for the physics engine. defaults to real earth gravity : (0, -9.81, 0)\r\n * @param plugin defines the physics engine to be used. defaults to CannonJS.\r\n * @returns a boolean indicating if the physics engine was initialized\r\n */\r\n enablePhysics(gravity?: Nullable<Vector3>, plugin?: IPhysicsEnginePluginV1 | IPhysicsEnginePluginV2): boolean;\r\n\r\n /**\r\n * Disables and disposes the physics engine associated with the scene\r\n */\r\n disablePhysicsEngine(): void;\r\n\r\n /**\r\n * Gets a boolean indicating if there is an active physics engine\r\n * @returns a boolean indicating if there is an active physics engine\r\n */\r\n isPhysicsEnabled(): boolean;\r\n\r\n /**\r\n * Deletes a physics compound impostor\r\n * @param compound defines the compound to delete\r\n */\r\n deleteCompoundImpostor(compound: any): void;\r\n\r\n /**\r\n * An event triggered when physic simulation is about to be run\r\n */\r\n onBeforePhysicsObservable: Observable<Scene>;\r\n\r\n /**\r\n * An event triggered when physic simulation has been done\r\n */\r\n onAfterPhysicsObservable: Observable<Scene>;\r\n }\r\n}\r\n\r\n/**\r\n * Gets the current physics engine\r\n * @returns a IPhysicsEngine or null if none attached\r\n */\r\nScene.prototype.getPhysicsEngine = function (): Nullable<IPhysicsEngine> {\r\n return this._physicsEngine ?? null;\r\n};\r\n\r\n/**\r\n * Enables physics to the current scene\r\n * @param gravity defines the scene's gravity for the physics engine\r\n * @param plugin defines the physics engine to be used. defaults to CannonJS.\r\n * @returns a boolean indicating if the physics engine was initialized\r\n */\r\nScene.prototype.enablePhysics = function (gravity: Nullable<Vector3> = null, plugin?: IPhysicsEnginePluginV1 | IPhysicsEnginePluginV2): boolean {\r\n if (this._physicsEngine) {\r\n return true;\r\n }\r\n\r\n // Register the component to the scene\r\n let component = this._getComponent(SceneComponentConstants.NAME_PHYSICSENGINE) as PhysicsEngineSceneComponent;\r\n if (!component) {\r\n component = new PhysicsEngineSceneComponent(this);\r\n this._addComponent(component);\r\n }\r\n\r\n try {\r\n if (!plugin || plugin?.getPluginVersion() === 1) {\r\n this._physicsEngine = new PhysicsEngineV1(gravity, plugin as IPhysicsEnginePluginV1);\r\n } else if (plugin?.getPluginVersion() === 2) {\r\n this._physicsEngine = new PhysicsEngineV2(gravity, plugin as IPhysicsEnginePluginV2);\r\n } else {\r\n throw new Error(\"Unsupported Physics plugin version.\");\r\n }\r\n this._physicsTimeAccumulator = 0;\r\n return true;\r\n } catch (e) {\r\n Logger.Error(e.message);\r\n return false;\r\n }\r\n};\r\n\r\n/**\r\n * Disables and disposes the physics engine associated with the scene\r\n */\r\nScene.prototype.disablePhysicsEngine = function (): void {\r\n if (!this._physicsEngine) {\r\n return;\r\n }\r\n\r\n this._physicsEngine.dispose();\r\n this._physicsEngine = null;\r\n};\r\n\r\n/**\r\n * Gets a boolean indicating if there is an active physics engine\r\n * @returns a boolean indicating if there is an active physics engine\r\n */\r\nScene.prototype.isPhysicsEnabled = function (): boolean {\r\n return !!this._physicsEngine;\r\n};\r\n\r\n/**\r\n * Deletes a physics compound impostor\r\n * @param compound defines the compound to delete\r\n */\r\nScene.prototype.deleteCompoundImpostor = function (compound: any): void {\r\n const mesh: AbstractMesh = compound.parts[0].mesh;\r\n\r\n if (mesh.physicsImpostor) {\r\n mesh.physicsImpostor.dispose(/*true*/);\r\n mesh.physicsImpostor = null;\r\n }\r\n};\r\n\r\n/**\r\n * @internal\r\n */\r\nScene.prototype._advancePhysicsEngineStep = function (step: number) {\r\n if (this._physicsEngine) {\r\n const subTime = this._physicsEngine.getSubTimeStep();\r\n if (subTime > 0) {\r\n this._physicsTimeAccumulator += step;\r\n while (this._physicsTimeAccumulator > subTime) {\r\n this.onBeforePhysicsObservable.notifyObservers(this);\r\n this._physicsEngine._step(subTime / 1000);\r\n this.onAfterPhysicsObservable.notifyObservers(this);\r\n this._physicsTimeAccumulator -= subTime;\r\n }\r\n } else {\r\n this.onBeforePhysicsObservable.notifyObservers(this);\r\n this._physicsEngine._step(step / 1000);\r\n this.onAfterPhysicsObservable.notifyObservers(this);\r\n }\r\n }\r\n};\r\n\r\n/**\r\n * Defines the physics engine scene component responsible to manage a physics engine\r\n */\r\nexport class PhysicsEngineSceneComponent implements ISceneComponent {\r\n /**\r\n * The component name helpful to identify the component in the list of scene components.\r\n */\r\n public readonly name = SceneComponentConstants.NAME_PHYSICSENGINE;\r\n\r\n /**\r\n * The scene the component belongs to.\r\n */\r\n public scene: Scene;\r\n\r\n /**\r\n * Creates a new instance of the component for the given scene\r\n * @param scene Defines the scene to register the component in\r\n */\r\n constructor(scene: Scene) {\r\n this.scene = scene;\r\n this.scene.onBeforePhysicsObservable = new Observable<Scene>();\r\n this.scene.onAfterPhysicsObservable = new Observable<Scene>();\r\n\r\n // Replace the function used to get the deterministic frame time\r\n this.scene.getDeterministicFrameTime = () => {\r\n if (this.scene._physicsEngine) {\r\n return this.scene._physicsEngine.getTimeStep() * 1000;\r\n }\r\n\r\n return 1000.0 / 60.0;\r\n };\r\n }\r\n\r\n /**\r\n * Registers the component in a given scene\r\n */\r\n public register(): void {}\r\n\r\n /**\r\n * Rebuilds the elements related to this component in case of\r\n * context lost for instance.\r\n */\r\n public rebuild(): void {\r\n // Nothing to do for this component\r\n }\r\n\r\n /**\r\n * Disposes the component and the associated resources\r\n */\r\n public dispose(): void {\r\n this.scene.onBeforePhysicsObservable.clear();\r\n this.scene.onAfterPhysicsObservable.clear();\r\n\r\n if (this.scene._physicsEngine) {\r\n this.scene.disablePhysicsEngine();\r\n }\r\n }\r\n}\r\n"]}
|