lhmd / Path-Finder

Python and AssemblyScript implementations of path finding and collision avoidance algorithms in navigation meshes

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

What is it?

This repository contains Python, WASM AssemblyScript and WASM Rust modules, which implements path finding algorithms in navigation meshes. Modules for Python and AssemblyScript based on Three Pathfinding library for navigation mesh, RVO2 library for agents moving and collision avoiding and Recast Navigation for navigation mesh baking. Module for Rust use navmesh crate for path finding in the navigation mesh. Versions for Python and AssemblyScript are very close to each other. If you would like to understand the algorithm, look to the Python code. It's more structured and contains more comments.

Navigation mesh path finding algorithm on non-Rust versions use three main concepts:

  • structure all polygons navigation mesh to a bvh (bounding volume hierarchy)
  • find closest path between centers of polygons by using A* algorithm in dual graph (vertices of this graph are centers of polygons, and two vertices are incident to one edge, iff corresponding polygons have a common edge)
  • combine two previous concepts to find the path between input points

It's important to understand that the path finding algorithm does not guaranteer the optimality of the generated path. In most cases the path is plausible.

Python and AssemblyScript versions of the module allows to bake navigation mesh from input geometry. The algorithm is in fact a port of one specific method from Recast Navigation. For baking purpose you can also use other solutions:

  • Original Recast Navigation. This is the most famous navigation mesh solution. It allows generate mesh and find path in it
  • PyRecastDetour This is Python bindings for some functions in Recast Navigation. Allows to output generated navigation mesh triangulation and it polygonal description
  • Blender, Unity and so on

More detailed descriptions

For Python version: here.

For AssemblyScript version: here.

For Rust version: here.

About

Python and AssemblyScript implementations of path finding and collision avoidance algorithms in navigation meshes


Languages

Language:TypeScript 58.1%Language:Python 41.5%Language:Rust 0.4%