Implementing 2D point-and-click navigation (Godot 4/C#)

Let’s see how to use Godot’s built-in nav utilities to move a unit through a field of asteroids!

Mina Pêcheux
CodeX

--

Moving the player’s avatar or AI units in your game level can sometimes seem difficult, especially when there are a bunch of walls and obstacles everywhere the characters need to avoid.

Luckily, in Godot, navigating in a scene in an intelligent way is really easy — so, today, let’s explore how this works by setting up a simple 2D point-and-click nav system :)

By the end of this video, you’ll know how to get a mouse-clicked position on the screen, and how to have a unit navigate to this spot in a clever way, while avoiding the obstacles on the way:

As usual, since we’ll be coding our logic in C#, make sure that you have a version of Godot with .NET enabled.

Download a version of Godot with .NET support, to be able to program in C#! :)

And of course, don’t forget that you can get the demo scene and all the assets for this example on my

--

--

Mina Pêcheux
CodeX

I’m a freelance full-stack web & game developer. I’m passionate about topics like CGI, music, data science and more! Find me at: https://minapecheux.com :)