소스 검색

Merge pull request #9139 from CedricGuillemet/navigationAgentSubStep

Get next path step point for an agent
David Catuhe 4 년 전
부모
커밋
e1274eff7b
4개의 변경된 파일43개의 추가작업 그리고 8개의 파일을 삭제
  1. 8 8
      dist/preview release/recast.js
  2. 1 0
      dist/preview release/what's new.md
  3. 14 0
      src/Navigation/INavigationEngine.ts
  4. 20 0
      src/Navigation/Plugins/recastJSPlugin.ts

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 8 - 8
dist/preview release/recast.js


+ 1 - 0
dist/preview release/what's new.md

@@ -161,6 +161,7 @@
 ### Navigation
 
 - export/load prebuilt binary navigation mesh ([cedricguillemet](https://github.com/cedricguillemet))
+- get next path step point for an agent ([cedricguillemet](https://github.com/cedricguillemet))
 
 ### Materials
 

+ 14 - 0
src/Navigation/INavigationEngine.ts

@@ -176,6 +176,20 @@ export interface ICrowd {
     getAgentVelocityToRef(index: number, result: Vector3): void;
 
     /**
+     * Gets the agent next target point on the path
+     * @param index agent index returned by addAgent
+     * @returns world space position
+     */
+    getAgentNextTargetPath(index: number): Vector3;
+
+    /**
+     * Gets the agent next target point on the path
+     * @param index agent index returned by addAgent
+     * @param result output world space position
+     */
+    getAgentNextTargetPathToRef(index: number, result: Vector3): void;
+
+    /**
      * remove a particular agent previously created
      * @param index agent index returned by addAgent
      */

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

@@ -461,6 +461,26 @@ export class RecastJSCrowd implements ICrowd {
     }
 
     /**
+     * Returns the agent next target point on the path
+     * @param index agent index returned by addAgent
+     * @returns world space position
+     */
+    getAgentNextTargetPath(index: number): Vector3 {
+        var pathTargetPos = this.recastCrowd.getAgentNextTargetPath(index);
+        return new Vector3(pathTargetPos.x, pathTargetPos.y, pathTargetPos.z);
+    }
+
+    /**
+     * Returns the agent next target point on the path
+     * @param index agent index returned by addAgent
+     * @param result output world space position
+     */
+    getAgentNextTargetPathToRef(index: number, result: Vector3): void {
+        var pathTargetPos = this.recastCrowd.getAgentNextTargetPath(index);
+        result.set(pathTargetPos.x, pathTargetPos.y, pathTargetPos.z);
+    }
+
+    /**
      * Asks a particular agent to go to a destination. That destination is constrained by the navigation mesh
      * @param index agent index returned by addAgent
      * @param destination targeted world position