feat(pathfinding): 添加寻路系统模块 (#333)
* feat(pathfinding): 添加寻路系统模块 实现完整的寻路系统,支持 A* 算法、网格地图、导航网格和路径平滑: A* 寻路算法: - 高效的二叉堆优先队列 - 可配置的启发式权重 - 最大搜索节点限制 - 支持对角移动和穿角避免 网格地图 (GridMap): - 基于二维数组的网格地图 - 支持 4 方向和 8 方向移动 - 可变移动代价 - 从数组或字符串加载地图 导航网格 (NavMesh): - 凸多边形导航网格 - 自动检测相邻多边形 - 漏斗算法路径优化 - 适合复杂地形 路径平滑: - Bresenham 视线检测 - 射线投射视线检测 - 视线简化器 (移除不必要的拐点) - Catmull-Rom 曲线平滑 - 组合平滑器 启发式函数: - 曼哈顿距离 (4方向) - 欧几里得距离 (任意方向) - 切比雪夫距离 (8方向) - 八角距离 (8方向,对角线√2) 蓝图节点 (8个): - FindPath: 基础寻路 - FindPathSmooth: 平滑寻路 - IsWalkable: 检查可通行性 - GetPathLength: 获取路径点数 - GetPathDistance: 获取路径距离 - GetPathPoint: 获取路径点 - MoveAlongPath: 沿路径移动 - HasLineOfSight: 视线检测 * chore: update pnpm-lock.yaml for pathfinding package
This commit is contained in:
24
packages/pathfinding/module.json
Normal file
24
packages/pathfinding/module.json
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"id": "pathfinding",
|
||||
"name": "@esengine/pathfinding",
|
||||
"globalKey": "pathfinding",
|
||||
"displayName": "Pathfinding",
|
||||
"description": "寻路系统,提供 A*、网格地图、导航网格和路径平滑 | Pathfinding system with A*, grid map, NavMesh and path smoothing",
|
||||
"version": "1.0.0",
|
||||
"category": "AI",
|
||||
"icon": "Route",
|
||||
"tags": ["pathfinding", "navigation", "astar", "navmesh", "ai"],
|
||||
"isCore": false,
|
||||
"defaultEnabled": true,
|
||||
"isEngineModule": true,
|
||||
"canContainContent": false,
|
||||
"platforms": ["web", "desktop", "mobile"],
|
||||
"dependencies": ["core", "math", "blueprint"],
|
||||
"exports": {
|
||||
"components": ["PathfindingAgentComponent"],
|
||||
"systems": ["PathfindingSystem"]
|
||||
},
|
||||
"requiresWasm": false,
|
||||
"outputPath": "dist/index.js",
|
||||
"pluginExport": "PathfindingPlugin"
|
||||
}
|
||||
Reference in New Issue
Block a user