跳至正文
OpenAgentSkill
浏览已开放 · 目录记录日期 2026-11-21 · 自动更新和账户服务暂时关闭。
浏览器与自动化

godot-ai-navigation

AI movement decision router for chase, patrol, crowd, and bake choices on top of NavigationAgent/Server. Use when deciding node agent vs RID server, bake vs obstacle, layer masks, or retarget policy — not for engine navmesh recipes. Keywords: AI navigation, chase retarget, patrol, crowd RVO, bake vs obstacle, NavigationAgent decision tree.

thedivergentai · 已有 AI 审核记录

安装与使用

运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。

npx skills add thedivergentai/GD-Agentic-Skills --skill godot-ai-navigation

技能说明


name: godot-ai-navigation description: "AI movement decision router for chase, patrol, crowd, and bake choices on top of NavigationAgent/Server. Use when deciding node agent vs RID server, bake vs obstacle, layer masks, or retarget policy — not for engine navmesh recipes. Keywords: AI navigation, chase retarget, patrol, crowd RVO, bake vs obstacle, NavigationAgent decision tree."

Decision Trees (MANDATORY script triggers)

1. Node agent vs NavigationServer RID

SignalChoicePathfinding script (MANDATORY read)
2D top-down / side-scroller, < ~50 agents, editor-tweakableNavigationAgent2D on CharacterBody2Dsmart_navigation_agent.gd
3D floor/slope nav, < ~50 agents, designer-placed regionsNavigationAgent3D on CharacterBody3DSame script (3D branch); pair with godot-physics-3d for body collision
Hundreds–thousands of simple movers (2D or 3D)RID agents on NavigationServerserver_navigation_setup.gd + low_level_avoidance.gd
Agents stuck / jitteringStuck recovery before retarget spamagent_stuck_detection.gd

2. Bake vs obstacle

SignalChoicePathfinding script (MANDATORY read)
Walkable geometry changed (proc gen, doors)Async parse + bakeasync_dynamic_baking.gd
Moving platform / shifting regionDynamic region managerdynamic_nav_manager.gd
Projectile / rolling hazard pushing agentsRVO obstacle (no full rebake)moving_obstacle_server.gd
Prefer roads over mud/waterRegion enter/travel coststerrain_cost_manager.gd

3. Layers, links, crowds

SignalChoicePathfinding script (MANDATORY read)
Walk / fly / swim (or faction) filtersNavigation layers bitmaskslayer_mask_navigation.gd
Jump / teleport / elevator edgesNavigationLink traversalnav_link_traversal.gd
Formation / anti-clump crowdsLeader-relative offsetsgroup_avoidance_formations.gd
Hot-path query allocsReuse query parameter/result objectsmemory_optimized_queries.gd

Do NOT Load scripts outside the chosen row (e.g. skip RID/server scripts for a single designer-tuned agent; skip async bake when only RVO obstacles move).

4. Chase / patrol retarget policy (AI layer)

  • Chase: Retarget on timer (~0.2s) or distance threshold — never assign target_position every physics frame.
  • Patrol: Advance waypoint only when is_navigation_finished() and is_target_reachable(); on unreachable, pick next or repath.
  • State ownership: Patrol/chase/search transitions belong in godot-state-machine-advanced; this skill only decides how to retarget once a state asks for a destination.

Patrol state handoff (call site): in the patrol state's _physics_process, when the agent finishes a waypoint, call retarget_if_needed(next_waypoint) — do not set target_position directly from the state machine root.

# PatrolState.gd — state machine owns transitions; this skill owns retarget policy
func _physics_process(_delta: float) -> void:
	if nav_agent.is_navigation_finished() and nav_agent.is_target_reachable():
		_ai_nav.retarget_if_needed(_waypoints[_index])
		_index = (_index + 1) % _waypoints.size()
# Threshold retarget — AI policy, not per-frame path spam
const RETARGET_DIST := 1.5
var _last_target: Vector3

func retarget_if_needed(desired: Vector3) -> void:
	if desired.distance_to(_last_target) < RETARGET_DIST:
		return
	nav_agent.target_position = desired
	_last_target = desired

NEVER Do in AI Navigation

  • NEVER set target_position before awaiting physics frame — MUST call_deferred() then await get_tree().physics_frame.
  • NEVER use synchronous runtime bake — Use bake_from_source_geometry_data_async via pathfinding async_dynamic_baking.gd.
  • NEVER poll chase targets every frame — Path recalculation spam.
  • NEVER invent local duplicate nav scripts here — Implement from godot-navigation-pathfinding only.
  • **NEVER ignore `is_target_re
阅读完整来源 ↗