فهرست منبع

Merge pull request #9139 from CedricGuillemet/navigationAgentSubStep

Get next path step point for an agent
David Catuhe 4 سال پیش
والد
کامیت
e1274eff7b

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 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