瀏覽代碼

doc + lint

Cedric Guillemet 4 年之前
父節點
當前提交
16dd3b9a93
共有 1 個文件被更改,包括 23 次插入3 次删除
  1. 23 3
      src/Navigation/Plugins/recastJSPlugin.ts

+ 23 - 3
src/Navigation/Plugins/recastJSPlugin.ts

@@ -51,18 +51,39 @@ export class RecastJSPlugin implements INavigationEnginePlugin {
         this.setTimeStep();
         this.setTimeStep();
     }
     }
 
 
+    /**
+     * Set the time step of the navigation tick update.
+     * Default is 1/60.
+     * A value of 0 will disable fixed time update
+     * @param newTimeStep the new timestep to apply to this world.
+     */
     setTimeStep(newTimeStep: number = 1./60.): void {
     setTimeStep(newTimeStep: number = 1./60.): void {
         this._timeStep = newTimeStep;
         this._timeStep = newTimeStep;
     }
     }
 
 
+    /**
+     * Get the time step of the navigation tick update.
+     * @returns the current time step
+     */
     getTimeStep(): number {
     getTimeStep(): number {
         return this._timeStep;
         return this._timeStep;
     }
     }
 
 
+    /**
+     * If delta time in navigation tick update is greater than the time step
+     * a number of sub iterations are done. If more iterations are need to reach deltatime
+     * they will be discarded.
+     * A value of 0 will set to no maximum and update will use as many substeps as needed
+     * @param newStepCount the maximum number of iterations
+     */
     setMaximumSubStepCount(newStepCount: number = 10): void {
     setMaximumSubStepCount(newStepCount: number = 10): void {
         this._maximumSubStepCount = newStepCount;
         this._maximumSubStepCount = newStepCount;
     }
     }
 
 
+    /**
+     * Get the maximum number of iterations per navigation tick update
+     * @returns the maximum number of iterations
+     */
     getMaximumSubStepCount(): number
     getMaximumSubStepCount(): number
     {
     {
         return this._maximumSubStepCount;
         return this._maximumSubStepCount;
@@ -605,7 +626,7 @@ export class RecastJSCrowd implements ICrowd {
         } else {
         } else {
             var iterationCount = deltaTime / timeStep;
             var iterationCount = deltaTime / timeStep;
             if (maxStepCount && iterationCount > maxStepCount) {
             if (maxStepCount && iterationCount > maxStepCount) {
-                iterationCount = maxStepCount
+                iterationCount = maxStepCount;
             }
             }
             if (iterationCount < 1) {
             if (iterationCount < 1) {
                 iterationCount = 1;
                 iterationCount = 1;
@@ -616,8 +637,7 @@ export class RecastJSCrowd implements ICrowd {
         }
         }
         
         
         // update transforms
         // update transforms
-        for (let index = 0; index < this.agents.length; index++)
-        {
+        for (let index = 0; index < this.agents.length; index++) {
             this.transforms[index].position = this.getAgentPosition(this.agents[index]);
             this.transforms[index].position = this.getAgentPosition(this.agents[index]);
         }
         }
     }
     }