Steer and Draw Forces in Godot

Опубликовано: 23 Март 2026
на канале: Cashew OldDew
5,348
279

This tutorial aims to replicate steering behavior and visual debugging for forces through draw functions in Godot 4.2+

Steering is one of the simplest natural behaviors that can be implemented in a video game for an autonomous agent. If your game has a car, an animal looking for food or anything that is able to follow a target, then steering can be applied to it. Additionally, when working with physics, there is a chance that not everything will work as planned every time. For such cases, being able to see how the forces behave at runtime is essential for easy debugging. In order to draw these, Godot provides functions to draw lines, circles and many other two dimensional shapes.

While steering is already a very interesting topic, we are just dipping our toes into autonomous agents and natural behaviors. I recommend reading Nature of Code from https://natureofcode.com/

If you want to see some other interesting autonomous agent behaviors implemented in Godot, please let me know in the comments.

Some amazing tutorials on autonomous agents and steering that helped making this video:
   • Intro to Steering Behaviors in Godot part ...   - ‪@Gdquest‬
   • 5.2 Seeking a Target - The Nature of Code   - ‪@TheCodingTrain‬
The wonderful assets I used are from the Kenney Fish Pack: https://kenney.nl/assets/fish-pack
Thanks a lot, ‪@KenneyNL‬ for providing such amazing free assets!

Corrections:
At 25:56 I have drawn a vector from velocity to scaled_desired_velocity. However, if I actually wanted to see the real (shorter, because it was divided by the mass) steering vector, I should've drawn a line from debug["velocity"] to debug["steer"]

--------------------
Github repository for this project.
https://github.com/cashew-olddew/godo...

Support me on Ko-Fi: https://ko-fi.com/cashewolddew
--------------------

Chapters:
0:00 What will you learn?
0:15 How does steering work?
3:37 How to implement steering in Godot?
15:15 Steering implementation result
16:29 How to draw forces in Godot?
26:06 Drawing forces result

#gamedev #godot #tutorial