three-pathfinding
Advanced tools
Comparing version 0.6.0 to 0.6.1
{ | ||
"name": "three-pathfinding", | ||
"version": "0.6.0", | ||
"version": "0.6.1", | ||
"description": "Navigation mesh toolkit for three.js, based on PatrolJS", | ||
@@ -5,0 +5,0 @@ "author": "Don McCurdy <dm@donmccurdy.com>", |
127
README.md
@@ -49,12 +49,17 @@ # three-pathfinding | ||
```js | ||
const Pathfinder = require('three-pathfinding'); | ||
const pathfinder = new Pathfinder(); | ||
// ES6 | ||
import { Pathfinding } from 'three-pathfinding'; | ||
// CommonJS | ||
const Pathfinding = require('three-pathfinding').Pathfinding; | ||
// UMD | ||
const Pathfinding = window.threePathfinding.Pathfinding; | ||
// Create level. | ||
const pathfinding = new Pathfinding(); | ||
const ZONE = 'level1'; | ||
pathfinder.setZoneData(ZONE, Pathfinder.createZone(mesh.geometry)); | ||
pathfinding.setZoneData(ZONE, Pathfinding.createZone(mesh.geometry)); | ||
// Find path from A to B. | ||
const groupID = pathfinder.getGroup(ZONE, a); | ||
const path = pathfinder.findPath(a, b, ZONE, groupID); | ||
const groupID = pathfinding.getGroup(ZONE, a); | ||
const path = pathfinding.findPath(a, b, ZONE, groupID); | ||
``` | ||
@@ -82,15 +87,15 @@ | ||
- [Path](#path) | ||
- [setZoneData](#setzonedata) | ||
- [getGroup](#getgroup) | ||
- [getRandomNode](#getrandomnode) | ||
- [getClosestNode](#getclosestnode) | ||
- [findPath](#findpath) | ||
- [clampStep](#clampstep) | ||
- [createZone](#createzone) | ||
- [Zone](#zone) | ||
- [Group](#group) | ||
- [Node](#node) | ||
- [Pathfinding][1] | ||
- [setZoneData][2] | ||
- [getGroup][3] | ||
- [getRandomNode][4] | ||
- [getClosestNode][5] | ||
- [findPath][6] | ||
- [clampStep][7] | ||
- [createZone][8] | ||
- [Zone][9] | ||
- [Group][10] | ||
- [Node][11] | ||
## Path | ||
## Pathfinding | ||
@@ -105,4 +110,4 @@ Defines an instance of the pathfinding module, with one or more zones. | ||
- `zoneID` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** | ||
- `zone` **[Zone](#zone)** | ||
- `zoneID` **[string][12]** | ||
- `zone` **[Zone][13]** | ||
@@ -115,6 +120,6 @@ ### getGroup | ||
- `zoneID` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** | ||
- `zoneID` **[string][12]** | ||
- `position` **THREE.Vector3** | ||
Returns **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** | ||
Returns **[number][14]** | ||
@@ -127,8 +132,8 @@ ### getRandomNode | ||
- `zoneID` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** | ||
- `groupID` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** | ||
- `zoneID` **[string][12]** | ||
- `groupID` **[number][14]** | ||
- `nearPosition` **THREE.Vector3** | ||
- `nearRange` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** | ||
- `nearRange` **[number][14]** | ||
Returns **[Node](#node)** | ||
Returns **[Node][15]** | ||
@@ -142,7 +147,7 @@ ### getClosestNode | ||
- `position` **THREE.Vector3** | ||
- `zoneID` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** | ||
- `groupID` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** | ||
- `checkPolygon` **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** (optional, default `false`) | ||
- `zoneID` **[string][12]** | ||
- `groupID` **[number][14]** | ||
- `checkPolygon` **[boolean][16]** (optional, default `false`) | ||
Returns **[Node](#node)** | ||
Returns **[Node][15]** | ||
@@ -158,6 +163,6 @@ ### findPath | ||
- `targetPosition` **THREE.Vector3** Destination. | ||
- `zoneID` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** ID of current zone. | ||
- `groupID` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** Current group ID. | ||
- `zoneID` **[string][12]** ID of current zone. | ||
- `groupID` **[number][14]** Current group ID. | ||
Returns **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<THREE.Vector3>** Array of points defining the path. | ||
Returns **[Array][17]<THREE.Vector3>** Array of points defining the path. | ||
@@ -173,8 +178,8 @@ ### clampStep | ||
- `end` **THREE.Vector3** Desired endpoint. | ||
- `node` **[Node](#node)** | ||
- `zoneID` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** | ||
- `groupID` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** | ||
- `node` **[Node][15]** | ||
- `zoneID` **[string][12]** | ||
- `groupID` **[number][14]** | ||
- `endTarget` **THREE.Vector3** Updated endpoint. | ||
Returns **[Node](#node)** Updated node. | ||
Returns **[Node][15]** Updated node. | ||
@@ -189,3 +194,3 @@ ### createZone | ||
Returns **[Zone](#zone)** | ||
Returns **[Zone][13]** | ||
@@ -198,3 +203,3 @@ ## Zone | ||
- `groups` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[Group](#group)>** | ||
- `groups` **[Array][17]<[Group][18]>** | ||
@@ -211,8 +216,44 @@ ## Group | ||
- `id` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** | ||
- `neighbours` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)>** IDs of neighboring nodes. | ||
- `id` **[number][14]** | ||
- `neighbours` **[Array][17]<[number][14]>** IDs of neighboring nodes. | ||
- `centroid` **THREE.Vector3** | ||
- `portals` **[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)>>** Array of portals, each defined by two vertex IDs. | ||
- `closed` **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** | ||
- `cost` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** | ||
- `portals` **[Array][17]<[Array][17]<[number][14]>>** Array of portals, each defined by two vertex IDs. | ||
- `closed` **[boolean][16]** | ||
- `cost` **[number][14]** | ||
[1]: #pathfinding | ||
[2]: #setzonedata | ||
[3]: #getgroup | ||
[4]: #getrandomnode | ||
[5]: #getclosestnode | ||
[6]: #findpath | ||
[7]: #clampstep | ||
[8]: #createzone | ||
[9]: #zone | ||
[10]: #group | ||
[11]: #node | ||
[12]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String | ||
[13]: #zone | ||
[14]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number | ||
[15]: #node | ||
[16]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean | ||
[17]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array | ||
[18]: #group | ||
<!--- API END ---> | ||
@@ -219,0 +260,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
257
468692
25
1912