Logo von Ai Navigation

Ai Navigation

Community
jame581
ai-navigation

Verwenden Sie diesen Skill, wenn Sie KI-Bewegungen implementieren – mit NavigationAgent2D/3D, Steering-Verhalten, Verhaltensbäumen und Patrouillenmustern.

Add to TypingMind

Übersicht

Herausgeberjame581
RepositoryGodotPrompter
Skill-Nameai-navigation
Sterne
808
Forks
47
Mitgelieferte Dateien
6
LizenzMIT
Links
  • Anweisungen in Markdown

    Eine SKILL.md-Datei, die das Modell bei Bedarf lädt. So werden nur dann Token verbraucht, wenn eine Anfrage tatsächlich dazu passt.

  • Funktioniert mit jedem LLM

    KI-Skills bestehen aus reinem Markdown, nicht aus anbieterspezifischem Code. Daher funktionieren sie mit GPT, Claude, Gemini, Grok oder einem lokalen Modell.

  • Mitgelieferte Dateien: 6

    Skripte, Vorlagen und Referenzmaterial, die das Modell bei der Arbeit lesen kann. Die Dateien sind schreibgeschützt und werden niemals ausgeführt.

  • Open Source

    Von jame581 auf GitHub veröffentlicht. Prüfen Sie vor der Installation die Quelldateien.

Installation

Installieren Sie den KI-Skill Ai Navigation in TypingMind, um ihn mit jedem LLM zu nutzen, oder fügen Sie ihn einem anderen Agenten hinzu, der SKILL.md lesen kann.

1

In TypingMind installieren

TypingMind installiert einen Skill direkt aus seinem GitHub-Ordner. Dabei liest die App SKILL.md, bündelt die Ressourcendateien und speichert das Ergebnis lokal.

  1. Öffnen Sie die App und gehen Sie zu Plugins → Skills.
  2. Wählen Sie „Von GitHub installieren“.
  3. Fügen Sie die unten angegebene URL des Skill-Ordners ein und bestätigen Sie.
    https://github.com/jame581/GodotPrompter/tree/master/skills/ai-navigation
  4. Aktivieren Sie den Skill in jedem Chat, in dem er verfügbar sein soll.
Plugins → Skills → Skill hinzufügen → Über GitHub-URL. Fügen Sie dann die Ordner-URL ein und klicken Sie auf „Weiter“.
2

In einem anderen Agenten installieren

Jeder Agent, der das Agent-Skills-Format unterstützt, kann diesen Skill nutzen. Kopieren Sie den Ordner in das Skill-Verzeichnis des jeweiligen Agenten.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/jame581/GodotPrompter.git /tmp/GodotPrompter
mkdir -p .claude/skills
cp -r /tmp/GodotPrompter/skills/ai-navigation .claude/skills/ai-navigation
Starten Sie Claude Code nach dem Kopieren neu, damit der neue Skill erkannt wird.

In TypingMind verwenden

Aktivieren Sie Ai Navigation in einem beliebigen Chat in TypingMind. Den Rest übernimmt das Modell. Name und Beschreibung des Skills stehen im System-Prompt. Sobald eine Anfrage passt, lädt das Modell selbstständig die vollständigen Anweisungen — Sie müssen den Skill nie manuell aufrufen, und er verbraucht erst Token, wenn er tatsächlich genutzt wird.

Das Modell lädt Ai Navigation automatisch, sobald eine passende Anfrage gestellt wird.

Funktioniert mit jedem KI-Modell

KI-Skills bestehen aus reinen Markdown-Anweisungen statt aus anbieterspezifischem Code. Daher ist Ai Navigation nicht an das Modell gebunden, für das der Skill geschrieben wurde. Installieren Sie ihn einmal in TypingMind und nutzen Sie ihn mit GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder einem selbst betriebenen lokalen Modell — alles mit Ihren eigenen API-Schlüsseln.

  • Wird nur bei Bedarf geladen

    Der System-Prompt enthält nur den Namen und die Beschreibung. Die Anweisungen werden bei der ersten passenden Anfrage geladen. Ein ungenutzter Skill verursacht daher keine Kosten.

  • Modell im laufenden Chat wechseln

    Da der Skill aus Anweisungen statt aus Code besteht, funktioniert er auch nach einem Modellwechsel — das nächste Modell liest dieselbe SKILL.md-Datei.

Skill-Anweisungen

Dies ist der Inhalt von SKILL.md, den das Modell lädt. Lesen Sie ihn vor der Installation — ein Skill besteht aus Anweisungen, denen Ihr Modell folgt.

AI Navigation in Godot 4.3+

Cover NavigationAgent2D/3D, steering behaviors, behavior trees, and patrol patterns. All examples target Godot 4.3+ with no deprecated APIs.

Related skills: state-machine for AI state management, component-system for modular AI behaviors, player-controller for movement physics patterns, math-essentials for pathfinding vectors and steering math, limboai for BT + HSM with a visual editor, beehave for lightweight GDScript behavior trees. For a structured behavior tree (rather than steering/navigation), see the comparison tables in limboai and beehave.


1. Navigation Setup

Scene Structure

World (Node2D or Node3D)
└── NavigationRegion2D (or NavigationRegion3D)
    ├── TileMapLayer / StaticBody2D (geometry)
    └── Enemy (CharacterBody2D with NavigationAgent2D child)

NavigationRegion2D / NavigationRegion3D

  1. Add a NavigationRegion2D (or NavigationRegion3D) node to your scene.
  2. Assign a NavigationPolygon (2D) or NavigationMesh (3D) resource to it.
  3. Draw the walkable area in the NavigationPolygon editor, or configure the NavigationMesh bounds in 3D.
  4. Bake the mesh at edit time: select the NavigationRegion node → click Bake NavigationPolygon (2D) or Bake NavigationMesh (3D) in the toolbar.
  5. Bake at runtime when the world changes dynamically:
gdscript
# 2D
$NavigationRegion2D.bake_navigation_polygon()

# 3D
$NavigationRegion3D.bake_navigation_mesh()
csharp
// 2D
GetNode<NavigationRegion2D>("NavigationRegion2D").BakeNavigationPolygon();

// 3D
GetNode<NavigationRegion3D>("NavigationRegion3D").BakeNavigationMesh();

Async Navigation Baking (Godot 4.4+)

Navigation baking can cause frame drops on large maps. Godot 4.4 supports baking on a background thread: pass true to bake_navigation_polygon(true) (2D) or bake_navigation_mesh(true) (3D) and connect the region's bake_finished signal (use CONNECT_ONE_SHOT) to know when the mesh is ready.

See references/async-baking.md for the full GDScript and C# background-thread bake examples (2D and 3D).

When to use async baking: Procedurally generated levels, destructible terrain, or any scene where the navigation mesh must be rebuilt at runtime. The game continues running while the mesh bakes.

Navigation Layers

Navigation layers let you separate walkable areas for different agent types (ground troops, flying units, large enemies).

gdscript
# Assign layer bits on the NavigationRegion (Inspector or code)
# Layer 1 = ground, Layer 2 = air, Layer 3 = large

# On the NavigationAgent, set matching layers:
$NavigationAgent2D.navigation_layers = 1   # ground only
$NavigationAgent2D.navigation_layers = 2   # air only
$NavigationAgent2D.navigation_layers = 1 | 2  # both (bitwise OR)
csharp
// Assign layer bits on the NavigationRegion (Inspector or code)
// Layer 1 = ground, Layer 2 = air, Layer 3 = large

var navAgent = GetNode<NavigationAgent2D>("NavigationAgent2D");
navAgent.NavigationLayers = 1;       // ground only
navAgent.NavigationLayers = 2;       // air only
navAgent.NavigationLayers = 1 | 2;   // both (bitwise OR)

Set navigation_layers on both the NavigationRegion and the NavigationAgent so they match. Mismatched layers are one of the most common reasons an agent finds no path.


2. NavigationAgent2D Basic Usage

GDScript

gdscript
extends CharacterBody2D

@export var speed: float = 120.0

@onready var nav_agent: NavigationAgent2D = $NavigationAgent2D


func _ready() -> void:
	# velocity_computed fires when avoidance calculates a safe velocity
	nav_agent.velocity_computed.connect(_on_velocity_computed)


func _physics_process(delta: float) -> void:
	if nav_agent.is_navigation_finished():
		return

	var next_pos: Vector2 = nav_agent.get_next_path_position()
	var direction: Vector2 = (next_pos - global_position).normalized()
	var desired_velocity: Vector2 = direction * speed

	if nav_agent.avoidance_enabled:
		# Hand desired velocity to the avoidance system; wait for the signal
		nav_agent.velocity = desired_velocity
	else:
		velocity = desired_velocity
		move_and_slide()


func _on_velocity_computed(safe_velocity: Vector2) -> void:
	velocity = safe_velocity
	move_and_slide()


func set_target(target_pos: Vector2) -> void:
	nav_agent.target_position = target_pos

Key NavigationAgent2D properties:

PropertyPurpose
target_positionWorld-space destination
path_desired_distanceHow close to each waypoint counts as reached (default 1)
target_desired_distanceHow close to the final target counts as finished (default 10)
avoidance_enabledEnable RVO obstacle avoidance
radiusAgent collision radius for avoidance
time_horizon_agentsSeconds of avoidance look-ahead (tune to reduce jitter)

C#

csharp
using Godot;

public partial class Enemy2D : CharacterBody2D
{
    [Export] public float Speed { get; set; } = 120f;

    private NavigationAgent2D _navAgent;

    public override void _Ready()
    {
        _navAgent = GetNode<NavigationAgent2D>("NavigationAgent2D");
        _navAgent.VelocityComputed += OnVelocityComputed;
    }

    public override void _PhysicsProcess(double delta)
    {
        if (_navAgent.IsNavigationFinished()) return;

        Vector2 nextPos = _navAgent.GetNextPathPosition();
        Vector2 direction = (nextPos - GlobalPosition).Normalized();
        Vector2 desiredVelocity = direction * Speed;

        if (_navAgent.AvoidanceEnabled)
            _navAgent.Velocity = desiredVelocity;
        else
        {
            Velocity = desiredVelocity;
            MoveAndSlide();
        }
    }

    private void OnVelocityComputed(Vector2 safeVelocity)
    {
        Velocity = safeVelocity;
        MoveAndSlide();
    }

    public void SetTarget(Vector2 targetPos) => _navAgent.TargetPosition = targetPos;
}

3. NavigationAgent3D Basic Usage

A CharacterBody3D drives a NavigationAgent3D by calling get_next_path_position() each physics frame, flattening the direction on Y, and keeping gravity separate. With avoidance_enabled the desired velocity goes to nav_agent.velocity and movement happens in the velocity_computed handler; otherwise move_and_slide() is called directly. Targets are set through target_position and completion is checked with is_navigation_finished().

See references/navigation-agent-3d.md for the full GDScript and C# NavigationAgent3D enemy example.


4. Steering Behaviors

Lightweight per-frame calculations (seek, flee, arrive, wander) that produce natural-looking movement without a navigation mesh. Combine them by summing the returned vectors, or pick one and assign it to velocity each _physics_process tick.

See references/steering-behaviors.md for the full GDScript and C# implementations of seek, flee, arrive (with deceleration ramp), and wander (with circle-projection jitter).


5. Patrol Patterns

A NavigationAgent2D plus an array of Marker2D waypoints and a Timer for the pause at each point produces a clean patrol loop. Cycle the index on wait_timer.timeout, set nav_agent.target_position to the next waypoint, and gate movement on is_navigation_finished().

See references/patrol-patterns.md for the full GDScript and C# waypoint-chain patrol with wait-timer pauses.


6. Behavior Tree Concept

A behavior tree (BT) is a tree of nodes evaluated every tick. Three core node types:

TypeSucceeds whenFails when
Sequenceall children succeed (AND)any child fails
Selectorany child succeeds (OR)all children fail
Actionthe leaf action completesthe leaf reports failure

Sequences model "do A then B then C". Selectors model "try A, else try B, else try C".

See references/behavior-trees.md for the full lightweight BT implementation (BTNode base + Sequence / Selector / Action) and a worked enemy that uses "chase OR patrol", in both GDScript and C#.


7. Chase + Attack Pattern

Combines NavigationAgent2D with a state machine. See the state-machine skill for the full FSM infrastructure.

States

StateEntry conditionExit condition
PATROLdefault / player escapedplayer enters detect_range
CHASEplayer in detect_rangeplayer in attack_range OR player escaped
ATTACKplayer in attack_rangeplayer left attack_range

See references/chase-attack.md for the full GDScript and C# implementation (PATROL → CHASE → ATTACK transitions, attack cooldown timer, patrol-waypoint advancement, escape-range hand-off back to patrol).

For larger projects, extract each state into its own node class using the state-machine skill and inject the NavigationAgent2D reference from the parent.


8. Dedicated 2D Navigation Server (Godot 4.5+)

Prior to Godot 4.5, NavigationServer2D was a thin frontend that delegated all work to the 3D navigation server internally. Godot 4.5 splits them into fully independent servers. The change is transparent — no API changes and no code migration is required — but it brings two practical benefits:

  • Performance: 2D pathfinding no longer competes with 3D navigation for server resources. Large 2D scenes with many agents see lower CPU overhead.
  • Smaller exports for 2D-only games: The 3D navigation server can be stripped from 2D-only export templates, reducing binary size.
gdscript
# No code change needed — NavigationServer2D calls work identically.
# The split is internal; you continue using NavigationServer2D as before.

# Example: query a path directly via the server (unchanged API).
func get_path_to(target: Vector2) -> PackedVector2Array:
    var map: RID = get_world_2d().get_navigation_map()
    return NavigationServer2D.map_get_path(
        map,
        global_position,
        target,
        true  # optimize path
    )
csharp
// No code change needed — NavigationServer2D calls work identically.
public PackedVector2Array GetPathTo(Vector2 target)
{
    var map = GetWorld2D().GetNavigationMap();
    return NavigationServer2D.MapGetPath(map, GlobalPosition, target, true);
}

2D-only projects: In Project Settings → Modules, you can disable the NavigationServer3D module to reduce export size. This is only safe if no 3D navigation nodes (NavigationRegion3D, NavigationAgent3D) are used anywhere in the project.


9. Common Pitfalls

PitfallSymptomFix
Navigation mesh not bakedAgent stands still; no path foundBake the NavigationPolygon/NavigationMesh before running, or call bake_navigation_polygon() at runtime after scene loads
agent_radius too largeAgent can't fit through doorways or narrow corridorsLower radius on NavigationAgent to be slightly less than half the passage width
Avoidance jitterAgent stutters or oscillates when near other agentsIncrease time_horizon_agents (try 2–4 s) or slightly lower max_speed on the agent
Path recalculation too frequentCPU spike each frame; agents lagAdd a Timer (0.2–0.5 s) and only set target_position when the timer fires, not every physics frame
Wrong navigation layerAgent ignores some regions or finds no pathConfirm navigation_layers bitmask matches between the NavigationRegion and the NavigationAgent
Target set before NavigationServer is readyPath is empty on the first frameDefer target_position assignment to _ready() or await NavigationServer2D.map_changed
Gravity ignored in 3DAgent floats or sinks into the floorAlways accumulate velocity.y from gravity separately; only zero out X/Z from the nav direction
Baking causes frame dropSynchronous bake on large maps blocks the main threadUse async baking: bake_navigation_mesh(true) (Godot 4.4+); connect bake_finished signal

⚠️ Changed in Godot 4.7: NavigationServer3D.map_get_closest_point_normal(map, to_point) now returns a normalized vector (GH-119022) — previously the returned surface normal could be unnormalized. Code that compensated by calling normalized() on the result keeps working; code that relied on the unnormalized magnitude breaks.


10. Checklist

  • NavigationRegion2D/3D added to the scene with a NavigationPolygon/NavigationMesh resource
  • Navigation mesh baked (edit-time or at runtime before the agent needs a path)
  • navigation_layers bitmask matches between NavigationRegion and NavigationAgent
  • NavigationAgent2D/NavigationAgent3D is a child of the enemy node
  • get_next_path_position() called each physics frame, not get_target_position()
  • velocity_computed signal connected when avoidance_enabled is true
  • is_navigation_finished() checked before moving to avoid jitter at the destination
  • Path target updated via a throttle timer rather than every frame when following a moving player
  • agent_radius small enough to fit through the narrowest passage in the level
  • Gravity applied independently of horizontal nav velocity (3D only)
  • Large or dynamic maps use async baking (bake_navigation_mesh(true)) to avoid frame drops (Godot 4.4+)
  • 2D-only projects on Godot 4.5+ can disable NavigationServer3D in Project Settings to reduce export size

Mitgelieferte Dateien

Das Modell liest diese Dateien bei Bedarf, während der Skill geladen ist. Sie werden als lesbare Dateien bereitgestellt und niemals ausgeführt.

Häufig gestellte Fragen

Was macht der KI-Skill Ai Navigation?

Verwenden Sie diesen Skill, wenn Sie KI-Bewegungen implementieren – mit NavigationAgent2D/3D, Steering-Verhalten, Verhaltensbäumen und Patrouillenmustern.

Warum Ai Navigation in TypingMind nutzen?

Weil Sie den Skill einmal installieren und mit jedem Modell verwenden können. Ai Navigation besteht aus reinem Markdown statt aus anbieterspezifischem Code. So funktioniert derselbe Skill mit GPT-5, Claude, Gemini, Grok oder einem lokalen Modell – und Sie können das Modell mitten im Chat wechseln, ohne dass der Skill seine Funktion verliert. TypingMind verwendet Ihre eigenen API-Schlüssel. Sie bezahlen die Anbieter daher direkt statt über ein Abonnement pro Nutzerplatz, und Ihre Skills und Chats bleiben in Ihrem eigenen Speicher.

Wie installiere ich Ai Navigation in TypingMind?

Öffnen Sie in TypingMind Plugins → Skills → Von GitHub installieren und fügen Sie https://github.com/jame581/GodotPrompter/tree/master/skills/ai-navigation ein. TypingMind liest die Datei SKILL.md, bündelt die zugehörigen Dateien und installiert alles als Skill, den Sie für jeden Chat einzeln aktivieren können.

Welche KI-Modelle können Ai Navigation nutzen?

Jedes Modell, das Sie mit TypingMind verbinden. KI-Skills bestehen aus reinen Markdown-Anweisungen statt aus anbieterspezifischem Code. Daher können GPT, Claude, Gemini, Grok und lokale Modelle diesen Skill laden, wenn eine Anfrage dazu passt.

Wie viele KI-Modelle kann ich mit Ai Navigation verwenden?

So viele Sie möchten. In TypingMind können Sie Ai Navigation mit jedem Modell verwenden, das Skills unterstützt, etwa mit GPT, Claude, Gemini, Grok, DeepSeek, Mistral oder Llama. Dabei nutzen Sie Ihre eigenen API-Schlüssel.

Ist der KI-Skill Ai Navigation kostenlos?

Ja. Der Skill wird von jame581 auf GitHub unter der Lizenz MIT veröffentlicht. Sie bezahlen nur Ihren eigenen KI-Anbieter für die verwendeten Token.

Was sind KI-Skills?

Ein KI-Skill ist ein wiederverwendbares Anweisungspaket, das einem KI-Modell vermittelt, wie es eine bestimmte Aufgabe erledigt. Es folgt dem offenen Format Agent Skills: Die Datei SKILL.md enthält den Namen und die Beschreibung des Skills. Hinzu kommen bei Bedarf Skripte, Vorlagen oder Referenzdateien für das Modell. Das Modell liest die Anweisungen nur, wenn Ihre Anfrage zum Skill passt. Ein installierter Skill verursacht daher erst Kosten, wenn er verwendet wird.

Wie unterscheiden sich KI-Skills von Plugins oder MCP-Servern?

Ein Plugin oder MCP-Server stellt einem Modell neue aufrufbare Tools bereit – Code, der auf einem System ausgeführt wird und ein Ergebnis zurückgibt. Ein KI-Skill vermittelt dem Modell stattdessen Wissen und Vorgehensweisen: wie es eine Aufgabe angeht, welche Schritte es befolgt und wie eine gute Ausgabe aussieht. Skills bestehen aus reinem Markdown und kommen daher ohne Server, API-Schlüssel und Laufzeitumgebung aus. Sie funktionieren mit jedem Modell.

Alle anzeigen

Jetzt eigenen KI-Arbeitsbereich einrichten

Abonnieren Sie unseren Newsletter und erfahren Sie mehr über neue Funktionen und kommende Gewinnspiele 👇