pathfinding
Obsidian Engine: Pathfinding Module Efficient A* implementation with Min-Heap and LOS smoothing. Injected by the bundler / init.lua loader; see src/init.lua.
Types
PathfindingModule
The main pathfinding module with the findPath function.
| Field | Type | Description |
|---|---|---|
| MAX_ITERATIONS | number | Maximum A* node expansions before giving up. Raise for bigger maps. |
Methods
Pathfinding.findPath(scene, startPos, endPos, collider, ignoreId, layerMask, smooth, maxIterations)
Find a walkable path from startPos to endPos on scene.
scene (
SceneInstance) Active scenestartPos (
Vec2) World start positionendPos (
Vec2) World goal positioncollider (
table, optional) { w, h } entity size (default {w=1,h=1})ignoreId (
number, optional) Entity ID excluded from collision checkslayerMask (
number, optional) Collision layer bitmasksmooth (
boolean, optional) Apply LOS waypoint reduction (default true)maxIterations (
number, optional) Max A* expansions before giving up (default Pathfinding.MAX_ITERATIONS)returns (
Vec2[]|nil) Ordered waypoints start→goal, or nil if unreachable