2D Navigation Region and Collision Polygons

Godot Version

v4.5.1

Question

My aim is for enemy sprite to travel across the grey path and reach the base sprite wihout moving across green or brown areas of the sprites (Not tile map).

I have added collosion polygons around the green and brown pixels, as well as putting a navigation region across the screen (note: the sprites are children of the Navigation Region, with the exception of the enemy and base).

Issues:

  1. the begining of the enemy sprite’s path is not at its sprite’s location
  2. The path which has been generated moves across the collision polygons.

I am new to Godot and any help would be apreciated.

From what I see it looks like the target position is correct you have a problem with your starting position.

Looking in your _physics_process your dir is set by the local position of the nav_agent. I think getting rid of to_local should help. Also why is it normalized?

Removing to_local causes the sprite to continue beyond the target position. Normalized makes the sprite move slowly to its target position.

how does your nav agent code look?