NPC ignoring NavigationPolygon

I set a NavigationPolygonIntance to my NPC (soldier), but he’s ignoring it:

Also, this is the soldier’s script:

extends "res://Script/Character/NPCs/PlayerDetection.gd"

# Inheriting the following:
#const SPEED = 50
#const MAX_SPEED = 300
#const FRICTION = 0.25  # the time to get from MAX_SPEED to 0.



onready var navigation = get_tree().get_root().find_node("Navigation2D", true, false)
onready var destinations = navigation.get_node("Destinations")

var motion
var possible_destinations
var path =[]

export var minimum_arrival_distance = 5
export var walk_speed = 0.5


func _ready():
	randomize()
	possible_destinations = destinations.get_children()
	make_path()


func _physics_process(delta):
	navigate()


func make_path():
	var new_destination = possible_destinations[randi() % possible_destinations.size() -1]
	path = navigation.get_simple_path(global_position , new_destination.global_position , false) 
	
	
func navigate():
	var distance_to_destination = global_position.distance_to(path[0]) 
	if distance_to_destination > minimum_arrival_distance:
		move()
	else:
		update_path()	


func move():
	look_at(path[0])
	motion = (path[0] - global_position).normalized() * (MAX_SPEED * walk_speed)
	move_and_slide(motion)
	if is_on_wall():
		rotation_degrees += 90 
		make_path()


func update_path():
	if path.size() == 1 :
		if $Timer.is_stopped():
			$Timer.start()
	else:
		path.remove(0)

func _on_Timer_timeout():
	make_path()

And this is the NavigationPolygonIntance location and area:

please help I’m stuck with this for over a week now :cry:

wheres the destination?
im just getting to the navigation lectures so hopefully ill have a better idea whats going on by tomorrow :wink:

Inkedbandicam 2020-05-12 _LI

The two “+” in the circles are Position2D nodes, that the NPC is programmed to reach.
When it’s trying to reach one of them- it gets stuck on the table.

are you still getting this issue? or did you manage to find a solution.
i seen your other post about guards getting caught in the corners.

Privacy & Terms