Steering behaviors
2025/12/27
- Type
- Learning Resource
- Format
- Glossary Article
- Version
- General
- Subject Tags
- Created
- Updated
- 2026/02/16
- 2025/12/27
Steering behaviors are a suite of algorithms used to make playable characters and AIs move smoothly in various ways: following a target, slowing down when arriving at a location, following a path, following each other in a queue, etc.
The most interesting aspect of these behaviors is that they mostly rely on vector arithmetic. So, they are lightweight and generally require little code complexity. They also work the same or nearly the same in 2D and 3D, making them well worth learning.
The simplest and most basic of those behaviors is the follow steering behavior.
It works like this:
The code looks like this:
var max_speed := 600.0
var steering_factor := 10.0
## Reference to the node to follow.
var target: Node2D = null
func _physics_process(delta: float) -> void:
var direction := Vector2.ZERO
if target != null:
direction = global_position.direction_to(target.global_position)
var desired_velocity := max_speed * direction
var steering_vector := desired_velocity - velocity
velocity += steering_vector * steering_factor * delta
position += velocity * deltaYou can also skip the first step and use this equation to make a playable character accelerate and decelerate smoothly. Here's an example:
var max_speed := 600.0
var steering_factor := 10.0
func _process(delta: float) -> void:
var direction := Input.get_vector("move_left", "move_right", "move_up", "move_down")
var desired_velocity := max_speed * direction
var steering_vector := desired_velocity - velocity
velocity += steering_vector * steering_factor * delta
position += velocity * deltaThis basic steering algorithm is a form of linear interpolation.
You can use steering behaviors in combination with pathfinding to make entities follow a path smoothly and avoid each other while moving along the path. This technique is often used in real-time strategy games (RTS), among other genres.
The most common steering behaviors are:
Don't stop here. Step-by-step tutorials are fun but they only take you so far.
Try one of our proven study programs to become an independent Gamedev truly capable of realizing the games you’ve always wanted to make.
Get help from peers and pros on GDQuest's Discord server!
20,000 membersJoin ServerThere are multiple ways you can join our effort to create free and open source gamedev resources that are accessible to everyone!
Sponsor this library by learning gamedev with us onGDSchool
Learn MoreImprove and build on assets or suggest edits onGithub
Contributeshare this page and talk about GDQUest onRedditYoutubeTwitter…