Path Smoothing
Line of Sight Simplification
Section titled “Line of Sight Simplification”Remove unnecessary intermediate points:
import { createLineOfSightSmoother } from '@esengine/pathfinding';
const smoother = createLineOfSightSmoother();const smoothedPath = smoother.smooth(result.path, grid);
// Original path: [(0,0), (1,1), (2,2), (3,3), (4,4)]// Simplified: [(0,0), (4,4)]Curve Smoothing
Section titled “Curve Smoothing”Using Catmull-Rom splines:
import { createCatmullRomSmoother } from '@esengine/pathfinding';
const smoother = createCatmullRomSmoother( 5, // segments - interpolation points per segment 0.5 // tension - (0-1));
const curvedPath = smoother.smooth(result.path, grid);Combined Smoothing
Section titled “Combined Smoothing”Simplify first, then curve smooth:
import { createCombinedSmoother } from '@esengine/pathfinding';
const smoother = createCombinedSmoother(5, 0.5);const finalPath = smoother.smooth(result.path, grid);Line of Sight Functions
Section titled “Line of Sight Functions”import { bresenhamLineOfSight, raycastLineOfSight } from '@esengine/pathfinding';
// Bresenham algorithm (fast, grid-aligned)const hasLOS = bresenhamLineOfSight(x1, y1, x2, y2, grid);
// Raycast (precise, supports floating point coordinates)const hasLOS = raycastLineOfSight(x1, y1, x2, y2, grid, 0.5);Blueprint Nodes
Section titled “Blueprint Nodes”FindPath- Find pathFindPathSmooth- Find and smooth pathIsWalkable- Check if position is walkableGetPathLength- Get number of path pointsGetPathDistance- Get total path distanceGetPathPoint- Get point at indexMoveAlongPath- Move along pathHasLineOfSight- Check line of sight