I can't make my character move, too. nav_agent.get_next_path_position()
return my character's position.
I also get false from print_debug(nav_agent.is_target_reachable())
, is there any thing wrong?
What do you mean in
If i use the "direction_to" as seen below, it works fine
position.direction_to(myStaticBody2D.global_position')
Do you mean you manage a way to make nav agent move?
It is my scene and script, same as tutorial: https://docs.godotengine.org/en/latest/tutorials/navigation/navigation_using_navigationagents.html

extends CharacterBody2D
@export var tilemap : TileMap
@export var target : Node2D
@onready var nav_agent : NavigationAgent2D = $NavigationAgent2D
const SPEED = 300.0
func _ready():
nav_agent.avoidance_enabled = true
var desired_distance : float = floor(SPEED / 100)
nav_agent.path_desired_distance = desired_distance
nav_agent.target_desired_distance = desired_distance
nav_agent.connect("velocity_computed", Callable(self, "_on_CharacterNavAgent_velocity_computed"))
nav_agent.set_navigation_map(tilemap.get_navigation_map(0))
nav_agent.set_target_position(target.position)
nav_agent.get_next_path_position()
print_debug(nav_agent.is_target_reachable())
func _physics_process(delta):
if not nav_agent.is_navigation_finished():
var cur_pos = global_position
var tar_pos = nav_agent.get_next_path_position()
var agent_velocity = cur_pos.direction_to(tar_pos).normalized() * SPEED
nav_agent.set_velocity(agent_velocity)
func _on_CharacterNavAgent_velocity_computed(safe_velocity: Vector2) -> void:
velocity = safe_velocity
move_and_slide()
Godot Version: v4.0.rc4.official [e0de3573f]