|
@@ -162,6 +162,17 @@ export class RecastJSPlugin implements INavigationEnginePlugin {
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
|
|
+ * Get a navigation mesh constrained position, closest to the parameter position
|
|
|
|
+ * @param position world position
|
|
|
|
+ * @param result output the closest point to position constrained by the navigation mesh
|
|
|
|
+ */
|
|
|
|
+ getClosestPointToRef(position: Vector3, result: Vector3) : void {
|
|
|
|
+ var p = new this.bjsRECAST.Vec3(position.x, position.y, position.z);
|
|
|
|
+ var ret = this.navMesh.getClosestPoint(p);
|
|
|
|
+ result.set(ret.x, ret.y, ret.z);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
* Get a navigation mesh constrained position, within a particular radius
|
|
* Get a navigation mesh constrained position, within a particular radius
|
|
* @param position world position
|
|
* @param position world position
|
|
* @param maxRadius the maximum distance to the constrained world position
|
|
* @param maxRadius the maximum distance to the constrained world position
|
|
@@ -175,6 +186,18 @@ export class RecastJSPlugin implements INavigationEnginePlugin {
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
|
|
+ * Get a navigation mesh constrained position, within a particular radius
|
|
|
|
+ * @param position world position
|
|
|
|
+ * @param maxRadius the maximum distance to the constrained world position
|
|
|
|
+ * @param result output the closest point to position constrained by the navigation mesh
|
|
|
|
+ */
|
|
|
|
+ getRandomPointAroundToRef(position: Vector3, maxRadius: number, result: Vector3): void {
|
|
|
|
+ var p = new this.bjsRECAST.Vec3(position.x, position.y, position.z);
|
|
|
|
+ var ret = this.navMesh.getRandomPointAround(p, maxRadius);
|
|
|
|
+ result.set(ret.x, ret.y, ret.z);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
* Compute the final position from a segment made of destination-position
|
|
* Compute the final position from a segment made of destination-position
|
|
* @param position world position
|
|
* @param position world position
|
|
* @param destination world position
|
|
* @param destination world position
|
|
@@ -189,6 +212,19 @@ export class RecastJSPlugin implements INavigationEnginePlugin {
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
|
|
+ * Compute the final position from a segment made of destination-position
|
|
|
|
+ * @param position world position
|
|
|
|
+ * @param destination world position
|
|
|
|
+ * @param result output the resulting point along the navmesh
|
|
|
|
+ */
|
|
|
|
+ moveAlongToRef(position: Vector3, destination: Vector3, result: Vector3): void {
|
|
|
|
+ var p = new this.bjsRECAST.Vec3(position.x, position.y, position.z);
|
|
|
|
+ var d = new this.bjsRECAST.Vec3(destination.x, destination.y, destination.z);
|
|
|
|
+ var ret = this.navMesh.moveAlong(p, d);
|
|
|
|
+ result.set(ret.x, ret.y, ret.z);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
* Compute a navigation path from start to end. Returns an empty array if no path can be computed
|
|
* Compute a navigation path from start to end. Returns an empty array if no path can be computed
|
|
* @param start world position
|
|
* @param start world position
|
|
* @param end world position
|
|
* @param end world position
|
|
@@ -246,6 +282,16 @@ export class RecastJSPlugin implements INavigationEnginePlugin {
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
|
|
+ * Get the Bounding box extent result specified by setDefaultQueryExtent
|
|
|
|
+ * @param result output the box extent values
|
|
|
|
+ */
|
|
|
|
+ getDefaultQueryExtentToRef(result: Vector3): void
|
|
|
|
+ {
|
|
|
|
+ let p = this.navMesh.getDefaultQueryExtent();
|
|
|
|
+ result.set(p.x, p.y, p.z);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
* Disposes
|
|
* Disposes
|
|
*/
|
|
*/
|
|
public dispose() {
|
|
public dispose() {
|
|
@@ -349,6 +395,16 @@ export class RecastJSCrowd implements ICrowd {
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
|
|
+ * Returns the agent position result in world space
|
|
|
|
+ * @param index agent index returned by addAgent
|
|
|
|
+ * @param result output world space position
|
|
|
|
+ */
|
|
|
|
+ getAgentPositionToRef(index: number, result: Vector3): void {
|
|
|
|
+ var agentPos = this.recastCrowd.getAgentPosition(index);
|
|
|
|
+ result.set(agentPos.x, agentPos.y, agentPos.z);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
* Returns the agent velocity in world space
|
|
* Returns the agent velocity in world space
|
|
* @param index agent index returned by addAgent
|
|
* @param index agent index returned by addAgent
|
|
* @returns world space velocity
|
|
* @returns world space velocity
|
|
@@ -359,6 +415,16 @@ export class RecastJSCrowd implements ICrowd {
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
|
|
+ * Returns the agent velocity result in world space
|
|
|
|
+ * @param index agent index returned by addAgent
|
|
|
|
+ * @param result output world space velocity
|
|
|
|
+ */
|
|
|
|
+ getAgentVelocityToRef(index: number, result: Vector3): void {
|
|
|
|
+ var agentVel = this.recastCrowd.getAgentVelocity(index);
|
|
|
|
+ result.set(agentVel.x, agentVel.y, agentVel.z);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
* Asks a particular agent to go to a destination. That destination is constrained by the navigation mesh
|
|
* 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 index agent index returned by addAgent
|
|
* @param destination targeted world position
|
|
* @param destination targeted world position
|
|
@@ -469,6 +535,16 @@ export class RecastJSCrowd implements ICrowd {
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
|
|
+ * Get the Bounding box extent result specified by setDefaultQueryExtent
|
|
|
|
+ * @param result output the box extent values
|
|
|
|
+ */
|
|
|
|
+ getDefaultQueryExtentToRef(result: Vector3): void
|
|
|
|
+ {
|
|
|
|
+ let p = this.recastCrowd.getDefaultQueryExtent();
|
|
|
|
+ result.set(p.x, p.y, p.z);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
* Release all resources
|
|
* Release all resources
|
|
*/
|
|
*/
|
|
dispose() : void
|
|
dispose() : void
|