CodeX

Everything connected with Tech & Code. Follow to join our 1M+ monthly readers

Follow publication

đźš© Creating a waypoints system in Godot/C#

Let’s setup a basic patrolling logic in Godot!

Mina PĂŞcheux
CodeX
Published in
11 min readNov 23, 2022

--

Photo by David Martin on Unsplash

This tutorial is available in video or text format — see below for the text version :)

Check out the Github repo with all my Godot tutorials! 🚀

When you think about it, there are lots of situations in games where you might want one of your object to move according to a specific pattern — a moving platform, an enemy guard patrolling, RTS troups controlling…

This idea of describing a path with some waypoints and then automating the movement of a character or a doodad on the circuit is quite simple, but also very useful!

And, in Godot, setting up a basic looping path like this is actually really easy — so today we’re going to see how we can setup a patrol routine using Godot and C#, in just a few minutes! We will then improve it slightly to let our avatar mark a little pause when it reaches each waypoint, before continuing on its way.

🔍 An overview of the project

For this project, I have prepared a few assets before hand:

  • To begin with, I made a basic Character scene, with a body and head to indicate its current rotation, and the red material that is applied on both meshes.
  • Then, I created a main scene for this waypoints tutorial with an orthographic camera, a global directional light and a ground plane displaying a simple grid, and I instantiated my Character in here.

--

--

CodeX
CodeX

Published in CodeX

Everything connected with Tech & Code. Follow to join our 1M+ monthly readers

Mina PĂŞcheux
Mina PĂŞcheux

Written by Mina PĂŞcheux

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 :)

No responses yet

Write a response