When I try to use AStar2D with an Isometric TileMap I get a strange behavior from the unit at the corners. What should I do to make it work?

This behavior happens when diagonal movement is at its default value. When I change it to: DIAGONAL_MODE_NEVER It stops completely.

    Abdo_23 i would deleted the path points that are outside the path.. i mean you laid the path yourself right? you you know the path 😃 just use them coords

    Abdo_23 I was going to comment on this, but you wrote the solution yourself:

    Abdo_23 This behavior happens when diagonal movement is at its default value. When I change it to: DIAGONAL_MODE_NEVER It stops completely.

    So what are you asking?

    your tiles are squares placed in a square grid, horizontal movement is between the left and right, diagonal movement looks connected.

    In my case I stopped messing around with AStar2D after realizing it was going to be a lot of work. AStar2D is based on AStar3D, so it's designed for pathfinding between a set of nodes. this is not ideal for an isometric game where you have tiles in a grid.
    So in my case I just wrote a AStar algorithm in gdscript. Here it is:

    extends Node
    
    #THIS USES THE VOXEL_ROAD TO FIND A PATH
    #NO ASTAR REQUIRED
    func find_shortest_path(closest_node : Vector2i, target : Vector2i) -> PackedVector2Array:
    	var map_size_shift : Vector2i = Vector2i(TerrainMap.hmapsiz, TerrainMap.hmapsiz)#terrain.map_size/2)
    	closest_node += map_size_shift
    	target += map_size_shift
    	var node_parents : Dictionary = Dictionary()
    	var follow_path : PackedVector2Array = PackedVector2Array()
    	var goal : Vector2i
    	goal = find_path(closest_node, target, node_parents)
    	
    	if goal == closest_node:
    		follow_path.append(closest_node - map_size_shift)
    		print("failed find path")
    		return follow_path
    	
    	var curr : Vector2i = goal
    	while(curr != closest_node):
    		follow_path.append(curr - map_size_shift)
    		curr = node_parents.get(curr)
    		#print("found path")
    	return follow_path
    
    var directions : Array[Vector2i] = [Vector2i.DOWN, Vector2i.LEFT, Vector2i.UP, Vector2i.RIGHT]
    
    func sort_ascending(a, b) -> bool:
    	if a[0] > b[0]:
    		return true
    	return false
    
    func order_by_size(direc : Array[Vector2i], goal : Vector2i):
    	#astar
    	if direc:
    		var distance : Array = []#Array()# : Array[float, Vector2i]
    		#var positions : Array[Vector2i]
    		for i : Vector2i in direc:
    			distance.append([abs(goal - i).length(), i])
    		distance.sort_custom(sort_ascending)
    		direc.clear()
    		for i in distance:
    			direc.append(i[1])
    
    func check_adjacents(pos : Vector2i) -> Array[Vector2i]:
    	var arr : Array[Vector2i] = []
    	if pos.x > 1 and pos.x < TerrainMap.map_size-1 and pos.y > 1 and pos.y < TerrainMap.map_size-1:
    		for i : Vector2i in directions:
    			var cpos : Vector2i = pos + i
    			var direc : int = TerrainMap.Voxel_road[(cpos.y * TerrainMap.map_size) + cpos.x]
    			if direc == 1:
    				arr.append(cpos)
    	return arr
    
    func find_path(pos : Vector2i, goal : Vector2i, node_parents : Dictionary):
    	var queue : Array[Vector2i] = []
    	var exploredNodes : Dictionary = Dictionary()
    	
    	var curr_node : Vector2i
    	
    	queue.push_front(pos)
    	while(queue.size() != 0):
    		curr_node = queue.pop_front()
    		if curr_node == goal:
    			#reach destination
    			return curr_node
    		#terrain.Voxel_road[(goal.y * terrain.map_size) + goal.x]
    		var neigh : Array[Vector2i] = check_adjacents(curr_node)
    		#order by size
    		order_by_size(neigh, goal)
    		if neigh:
    			for i : Vector2i in neigh:
    				if exploredNodes.get(i, null) == null:
    					exploredNodes[i] = true
    					node_parents[i] = curr_node
    					queue.push_front(i)
    	return pos #no path found

    this is in an autoload in my other, more complex project. Of course it's missing the terrain autoload which contains an array and methods for getting items of the array by Vector2i, I've posted it many times already, just look at my other comments.