How donmccurdy/three-pathfinding works
three-pathfinding is a Three.js navigation-mesh runtime: application code supplies BufferGeometry, builds and registers a zone, then queries groups and paths or clamps movement. Zone construction turns mesh triangles into connected polygon groups; A* finds a polygon corridor and the funnel channel converts it to waypoints. A separate helper renders debugging markers. The README also describes drag-and-drop and teleport demos. Demo wiring is not established by the sampled source, so those links to the library are omitted.
Main entry points: Pathfinding.js Pathfinding API · Builder.js Zone builder · Utils.js Geometry utilities · AStar.js A* search
Components 14
Mesh preparation
- Zone builder
src/Builder.js - Geometry utilities
src/Utils.js
Navigation runtime
- Pathfinding API
src/Pathfinding.js - A* search
src/AStar.js - Binary heap
src/BinaryHeap.js - Funnel channel
src/Channel.js - Zone data
Debug visualization
- Debug helper
src/PathfindingHelper.js
Examples
- Drag-and-drop demo
demo/index.html - Teleport demo
demo/teleport.html
Other components
- Application
- Navmesh geometry
- Path or step
- Three.js
Connections 21
- Application → Navmesh geometry: loads
- Application → Pathfinding API: calls
- Pathfinding API → Zone builder: builds zone
- Zone builder → Navmesh geometry: reads
- Zone builder → Geometry utilities: welds vertices
- Zone builder → Zone data: creates
- Application → Pathfinding API: registers zone
- Pathfinding API → Zone data: stores and reads
- Pathfinding API → Geometry utilities: queries geometry
- Pathfinding API → A* search: searches corridor
- A* search → Binary heap: orders nodes
- A* search → Geometry utilities: scores distance
- Pathfinding API → Funnel channel: pulls funnel
- Funnel channel → Geometry utilities: tests geometry
- Pathfinding API → Path or step: returns path or step
- Application → Debug helper: updates markers
- Debug helper → Three.js: creates scene objects
- Zone builder → Three.js: uses vectors
- Pathfinding API → Three.js: uses geometry types
- Application → Drag-and-drop demo: views
- Application → Teleport demo: views