本文へ移動
cccskills
無料GitHub で公開

godot-navigation-pathfinding

Expert blueprint for AI pathfinding (tower defense, RTS, stealth) using NavigationAgent2D/3D, NavigationServer, avoidance, and dynamic navigation mesh generation. Use when implementing enemy AI, NPC movement, or obstacle avoidance. Keywords NavigationAgent2D, NavigationRegion2D, pathfinding, NavigationServer, avoidance, baking, NavigationObstacle.

インストール方法を見る

含まれるファイル(19)

  • SKILL.md12.6 KB
  • references/agent-movement-patterns.md2.6 KB
  • references/expert-nav-architectures.md545 B
  • references/migration-notes.md3.2 KB
  • scripts/agent_stuck_detection.gd1.6 KB
  • scripts/async_dynamic_baking.gd1.9 KB
  • scripts/crowd_agent_3d.gd1.7 KB
  • scripts/dynamic_nav_manager.gd2.0 KB
  • scripts/group_avoidance_formations.gd1.5 KB
  • scripts/layer_mask_navigation.gd1.5 KB
  • scripts/low_level_avoidance.gd1.9 KB
  • scripts/memory_optimized_queries.gd1.4 KB
  • scripts/moving_obstacle_server.gd1.6 KB
  • scripts/nav_link_traversal.gd1.8 KB
  • scripts/nav_mesh_carver_3d.gd1.3 KB
  • scripts/navmesh_profiler.gd820 B
  • scripts/server_navigation_setup.gd1.8 KB
  • scripts/smart_navigation_agent.gd3.7 KB
  • scripts/terrain_cost_manager.gd1.4 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

NEVER Do in Navigation & Pathfinding

  • NEVER set target_position before awaiting physics frame — NavigationServer not ready in _ready()? Path fails silently. MUST call_deferred() then await get_tree().physics_frame.
  • NEVER use NavigationRegion2D.bake_navigation_polygon() at runtime — Synchronous baking freezes game for 100+ ms. Use NavigationServer.bake_from_source_geometry_data_async() for stutter-free updates.
  • NEVER forget to check is_navigation_finished() — Calling get_next_path_position() after reaching target = stale path, AI walks to old position.
  • NEVER use avoidance_enabled without setting radius — Default radius = 0, agent passes through others. Set nav_agent.radius = collision_shape.radius for proper avoidance.
  • NEVER poll target_position every frame for chase AI — Setting target 60x/sec = path recalculation spam. Use timer (0.2s intervals) or distance threshold for updates.
  • NEVER assume path exists — Target unreachable (blocked by walls)? get_next_path_position() returns invalid. Check is_target_reachable() or validate path length.
  • NEVER use heavy node-based navigation for thousands of simple entities — Use NavigationServer3D/2D RIDs directly to bypass node overhead.
  • NEVER call get_path() every frame — Use query_path() with reused NavigationPathQueryResult objects to prevent massive heap allocation and GC pressure.
  • NEVER leave 'enter_cost' at 0 for high-penalty areas — Use costs to make AI prefer logical paths (roads over water) instead of just shortest geometric distance.
  • NEVER ignore agent_set_avoidance_callback — Always use the callback for safe velocity computation to avoid synchronization issues and "jittery" movement.

Decision Tree → Scripts

MANDATORY for the chosen path. Do NOT Load editor-intro / Official Docs bootstrap recipes from this skill body (use Reference links when you need first-time region setup).

NeedScript
Runtime / procedural bake without hitchMANDATORY async_dynamic_baking.gd
Agent stuck / jitter recoveryMANDATORY agent_stuck_detection.gd
High-count RVO without nodesMANDATORY low_level_avoidance.gd
Moving platforms / dynamic regionsdynamic_nav_manager.gd
RID-only maps/regionsserver_navigation_setup.gd
Reused path query objectsmemory_optimized_queries.gd
Terrain enter/travel coststerrain_cost_manager.gd
Projectiles as RVO obstaclesmoving_obstacle_server.gd
Links (jump/teleport/elevator)nav_link_traversal.gd
Walk / fly / swim layerslayer_mask_navigation.gd
Crowd formation offsetsgroup_avoidance_formations.gd
Server RVO crowd agent (node-less)crowd_agent_3d.gd
Dynamic navmesh carve (impact holes)nav_mesh_carver_3d.gd
Bake-time benchmarknavmesh_profiler.gd
Smart agent wrappersmart_navigation_agent.gd

Chase / Retarget Rule (never contradict NEVER)

Do not assign target_position every physics frame. Retarget on a timer (~0.2s) or when the chased body moves beyond a distance threshold:

# Threshold retarget — not per-frame path spam
const RETARGET_DIST := 1.5
var _last_target: Vector3

func _physics_process(_delta: float) -> void:
    var desired := prey.global_position
    if desired.distance_to(_last_target) >= RETARGET_DIST:
        nav_agent.target_position = desired
        _last_target = desired
    if nav_agent.is_navigation_finished():
        return
    var next := nav_agent.get_next_path_position()
    velocity = (next - global_position).normalized() * speed
    move_and_slide()

Available Scripts

async_dynamic_baking.gd

bake_from_source_geometry_data_async — parse on main, bake off-thread.

agent_stuck_detection.gd

Distance-over-time stall detection and recovery.

low_level_avoidance.gd

Server-side RVO agents + avoidance callbacks.

dynamic_nav_manager.gd

Runtime navmesh updates for moving platforms.

server_navigation_setup.gd

Node-less maps/regions via NavigationServer RIDs.

memory_optimized_queries.gd

Reuse path query parameter/result objects.

terrain_cost_manager.gd

enter_cost / travel_cost for preferred routes.

moving_obstacle_server.gd

Dynamic RVO obstacles without full rebake.

nav_link_traversal.gd

NavigationLink jump/teleport/elevator handling.

layer_mask_navigation.gd

Multi-domain navigation layers (walk/fly/swim).

group_avoidance_formations.gd

Leader-relative offsets to reduce clumping.

smart_navigation_agent.gd

Production NavigationAgent wrapper patterns.

Expert Pointers

Deep dives (on demand)

Reference

Progressive disclosure: open Official Documentation links only when researching a specific API; load Related Skills when routing work to a peer domain — do not preload the whole lattice.

Official Documentation

Related Skills

Prerequisites

  • godot-characterbody-2d — Path corners become CharacterBody velocity via move_and_slide; agent scripts assume a body parent.
  • godot-2d-physics — Collision layers/shapes still block bodies; navmesh is not a physics substitute for walls and triggers.
  • godot-physics-3d — 3D agents share the same split: NavigationServer paths vs RigidBody/CharacterBody collision and slopes.

Complements

Downstream / consumers

  • godot-genre-rts — Unit move commands and RVO crowds consume NavigationAgent/Server patterns directly.
  • godot-genre-tower-defense — Lane/path enemies and dynamic blockers depend on regions, costs, and obstacle updates.
  • godot-genre-stealth — Guard patrols and investigate points are NavigationAgent routes gated by detection state.
  • godot-combat-system — Engage/kite/flank movement issues new targets and stuck recovery on top of paths.
  • godot-monte-carlo-balancer — Simulate chase reachability, travel-time bands, and crowd pressure when tuning AI difficulty.

Master

  • godot-master — Library router and mirrored module entry for this Domain Skill.

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

Bevy ECS skill for 2D sprite animation. Keywords: Bevy, sprite, animation, AnimationPlayer, AnimationClip, 2D.

日本語の概要は準備中です。原文の説明を表示しています。

thedivergentai/Game-Design-Agentic-Skills8452026年10月13日 更新

Bevy ECS skill for 3D lights. Keywords: Bevy, lighting, directional, point, spot, bevy_light, PBR.

日本語の概要は準備中です。原文の説明を表示しています。

thedivergentai/Game-Design-Agentic-Skills8452026年10月13日 更新

Bevy ECS skill for PBR materials. Keywords: Bevy, StandardMaterial, PBR, material, ExtendedMaterial.

日本語の概要は準備中です。原文の説明を表示しています。

thedivergentai/Game-Design-Agentic-Skills8452026年10月13日 更新

Bevy ECS skill for 3D level assembly. Keywords: Bevy, level, scene, mesh, world, ECS.

日本語の概要は準備中です。原文の説明を表示しています。

thedivergentai/Game-Design-Agentic-Skills8452026年10月13日 更新

Bevy ECS skill for abilities. Keywords: Bevy, ability, cooldown, ECS, gameplay.

日本語の概要は準備中です。原文の説明を表示しています。

thedivergentai/Game-Design-Agentic-Skills8452026年10月13日 更新

Bevy ECS skill for moving a Bevy game from 2D to 3D. Keywords: Bevy, 2D, 3D, adapt, camera, sprite.

日本語の概要は準備中です。原文の説明を表示しています。

thedivergentai/Game-Design-Agentic-Skills8452026年10月13日 更新

thedivergentai のスキルをすべて見る

このスキルの問題を報告する