浏览代码

Merge pull request #6768 from CedricGuillemet/recastJSUpdateMissingMoveAlong

glue for extent parameters queries
David Catuhe 6 年之前
父节点
当前提交
fc64bbe987
共有 3 个文件被更改,包括 80 次插入8 次删除
  1. 8 8
      dist/preview release/recast.js
  2. 28 0
      src/Navigation/INavigationEngine.ts
  3. 44 0
      src/Navigation/Plugins/recastJSPlugin.ts

文件差异内容过多而无法显示
+ 8 - 8
dist/preview release/recast.js


+ 28 - 0
src/Navigation/INavigationEngine.ts

@@ -73,6 +73,20 @@ export interface INavigationEnginePlugin {
     createCrowd(maxAgents: number, maxAgentRadius: number, scene: Scene): ICrowd;
 
     /**
+     * Set the Bounding box extent for doing spatial queries (getClosestPoint, getRandomPointAround, ...)
+     * The queries will try to find a solution within those bounds
+     * default is (1,1,1)
+     * @param extent x,y,z value that define the extent around the queries point of reference
+     */
+    setDefaultQueryExtent(extent: Vector3): void;
+
+    /**
+     * Get the Bounding box extent specified by setDefaultQueryExtent
+     * @returns the box extent values
+     */
+    getDefaultQueryExtent(): Vector3;
+
+    /**
      * Release all resources
      */
     dispose(): void;
@@ -132,6 +146,20 @@ export interface ICrowd {
     agentGoto(index: number, destination: Vector3): void;
 
     /**
+     * Set the Bounding box extent for doing spatial queries (getClosestPoint, getRandomPointAround, ...)
+     * The queries will try to find a solution within those bounds
+     * default is (1,1,1)
+     * @param extent x,y,z value that define the extent around the queries point of reference
+     */
+    setDefaultQueryExtent(extent: Vector3): void;
+
+    /**
+     * Get the Bounding box extent specified by setDefaultQueryExtent
+     * @returns the box extent values
+     */
+    getDefaultQueryExtent(): Vector3;
+
+    /**
      * Release all resources
      */
     dispose() : void;

+ 44 - 0
src/Navigation/Plugins/recastJSPlugin.ts

@@ -224,6 +224,28 @@ export class RecastJSPlugin implements INavigationEnginePlugin {
     }
 
     /**
+     * Set the Bounding box extent for doing spatial queries (getClosestPoint, getRandomPointAround, ...)
+     * The queries will try to find a solution within those bounds
+     * default is (1,1,1)
+     * @param extent x,y,z value that define the extent around the queries point of reference
+     */
+    setDefaultQueryExtent(extent: Vector3): void
+    {
+        let ext = new this.bjsRECAST.Vec3(extent.x, extent.y, extent.z);
+        this.navMesh.setDefaultQueryExtent(ext);
+    }
+
+    /**
+     * Get the Bounding box extent specified by setDefaultQueryExtent
+     * @returns the box extent values
+     */
+    getDefaultQueryExtent(): Vector3
+    {
+        let p = this.navMesh.getDefaultQueryExtent();
+        return new Vector3(p.x, p.y, p.z);
+    }
+
+    /**
      * Disposes
      */
     public dispose() {
@@ -383,6 +405,28 @@ export class RecastJSCrowd implements ICrowd {
     }
 
     /**
+     * Set the Bounding box extent for doing spatial queries (getClosestPoint, getRandomPointAround, ...)
+     * The queries will try to find a solution within those bounds
+     * default is (1,1,1)
+     * @param extent x,y,z value that define the extent around the queries point of reference
+     */
+    setDefaultQueryExtent(extent: Vector3): void
+    {
+        let ext = new this.bjsRECASTPlugin.bjsRECAST.Vec3(extent.x, extent.y, extent.z);
+        this.recastCrowd.setDefaultQueryExtent(ext);
+    }
+
+    /**
+     * Get the Bounding box extent specified by setDefaultQueryExtent
+     * @returns the box extent values
+     */
+    getDefaultQueryExtent(): Vector3
+    {
+        let p = this.recastCrowd.getDefaultQueryExtent();
+        return new Vector3(p.x, p.y, p.z);
+    }
+
+    /**
      * Release all resources
      */
     dispose() : void