feat(homing): bullet_manager 受限角速度转向 + 锁定式目标重选 + bounce 协同; 删除无人消费的位置快照
_apply_homing 在位置积分前把速度矢量朝目标旋转,单帧转角上限 strength*delta, rotated() 保持速率不变;wrapf 取最短转向方向。 目标仅在失效或首帧时经 _find_nearest_unvisited 重选,配 get_active_count()==0 空场守卫,避免 query_circle(r=400) 进入每帧热路径。 bounce 命中重定向时改写 homing_target_id,由 bounce 选目标 homing 追上去。 删除 _enemy_pos_snapshot 及 EnemyManager.fill_pos_snapshot(全项目唯一调用方)。 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -342,13 +342,6 @@ func get_nearest_pos(origin: Vector2, max_dist: float = 9999.0) -> Vector2:
|
||||
best = Vector2(_data[base + 0], _data[base + 1])
|
||||
return best
|
||||
|
||||
## 建立敌人位置快照(BulletManager homing 共用)
|
||||
func fill_pos_snapshot(out_arr: PackedVector2Array) -> void:
|
||||
out_arr.resize(_active_count)
|
||||
for i in _active_count:
|
||||
var base: int = i * ENEMY_STRIDE
|
||||
out_arr[i] = Vector2(_data[base + 0], _data[base + 1])
|
||||
|
||||
## 同步 Node2D 显示位置(屏内 dirty sync)
|
||||
func sync_node_positions(enemy_nodes: Array) -> void:
|
||||
for i in min(_active_count, enemy_nodes.size()):
|
||||
|
||||
Reference in New Issue
Block a user