Navigation2D get_simple_path goes the long way around obstruction

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By skippydog

Running Godot 3.0.6 w/ Godotsteam

I’ve been looking at a problem for a little while and I’m a bit stumped. I’ve got these buildings with collision polygons and I subtract them from the Navigation2d nav mesh. Those polygons show as red boxes in the gif. I then just do get_simple_path with the mouse click event position and it all works great. Except for these edge cases where the user clicks the on the other side of a building. It goes the long way around. I’ve got the optimizing enabled, not much else in the way of options.

Going the wrong way around in a nav mesh gif

Code is pretty simple, just takes mouse event as destination.

if event.button_index == BUTTON_LEFT and event.pressed:
	mousepos = get_global_mouse_position() - Vector2(0, spriteheight / 4) + mousecursordif
	update_navigation_path(global_position, mousepos)

func update_navigation_path(startpos, endpos):
	navinst = get_tree().get_nodes_in_group('activenav')[0]
	navpath = navinst.get_simple_path(startpos, endpos, true)

Movement is just linear interp between navpath points. Printing out the navpath shows a series of points going the wrong way around. I figure it’s something silly i’m doing wrong, but I’m having a hard time figuring it out. Anyone seen this before?