feat(spatial): 空间查询和索引系统 (#324)

* feat(spatial): 添加空间查询包

- ISpatialQuery: 空间查询接口
  - findInRadius, findInRect, findNearest, findKNearest
  - raycast, raycastFirst
  - IBounds, IRaycastHit, SpatialFilter 类型

- ISpatialIndex: 空间索引接口
  - insert, remove, update, clear, getAll

- GridSpatialIndex: 网格空间索引实现
  - 基于均匀网格的空间划分
  - 支持所有 ISpatialQuery 操作

- 工具函数
  - createBounds, isPointInBounds, boundsIntersect
  - distanceSquared, distance

* feat(spatial): 添加空间查询蓝图节点

- 添加 FindInRadius/FindInRect/FindNearest/FindKNearest 节点
- 添加 Raycast/RaycastFirst 射线检测节点
- 每个节点包含模板和执行器
- 使用 menuPath: ['Spatial', ...] 组织节点菜单
This commit is contained in:
YHH
2025-12-25 12:15:06 +08:00
committed by GitHub
parent 4089051731
commit 068ca4bf69
13 changed files with 1696 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
{
"id": "spatial",
"name": "@esengine/spatial",
"globalKey": "spatial",
"displayName": "Spatial Query",
"description": "空间查询和索引系统 | Spatial query and indexing system",
"version": "1.0.0",
"category": "Core",
"icon": "Grid",
"tags": ["spatial", "query", "quadtree", "grid"],
"isCore": false,
"defaultEnabled": true,
"isEngineModule": true,
"canContainContent": false,
"platforms": ["web", "desktop", "server"],
"dependencies": ["core", "math"],
"exports": {
"components": [],
"systems": ["SpatialIndexSystem"]
},
"outputPath": "dist/index.js",
"pluginExport": "SpatialPlugin"
}