Forward Direction

2025/12/27

Type
Learning Resource
Format
Glossary Article
Version
General
Subject Tags
Code
Assets
All else
Copyright 2016-2026, GDQuest
Created
2026/02/16
Updated
2025/12/27

Forward Direction

In computer graphics, elements' position, scale, and rotation are defined in a local coordinate system. This is often called a "transform" or "basis" in 3D.

What does a 'local coordinate system' mean?

A local coordinate system is a system that moves with you. For example, your left and right sides are always the same, no matter which direction you're facing. North, south, east, and west are a global coordinate system, while left, right, front, and back are your local coordinate system.

The forward direction is the direction in which an object is facing. This is often used to move an object in the direction it is facing, without having to know its angle.

For example, to move a bullet in the direction it is facing in 2D, you can use the following code:

var speed := 1000.0

func _physics_process(delta: float) -> void:
	position += transform.x * speed * delta

With this, you only need to orient the bullet once, and it will then move in that direction forever. By convention, transform.x is the forward direction in 2D (at least if you draw assets to face right by default).

In 3D, in Godot, the forward direction is the basis.z vector by convention. Here's an example of how to move an object in the direction it is facing in 3D, assuming the 3D model faces forward along the Z axis:

var speed := 10.0

func _physics_process(delta: float) -> void:
	var motion := basis.z * speed * delta
Become an Indie Gamedev with GDQuest!

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.

Nathan

Founder and teacher at GDQuest
  • Starter Kit
  • Learn Gamedev from Zero
Check out GDSchool

You're welcome in our little community

Get help from peers and pros on GDQuest's Discord server!

20,000 membersJoin Server

Contribute to GDQuest's Free Library

There are multiple ways you can join our effort to create free and open source gamedev resources that are accessible to everyone!