Vector

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

Vector

In math, a vector is a list of numbers representing a direction and a length (called the vector's magnitude).

In math, vectors can be lists of numbers of any length, though in games, we mostly use vectors to represent 2D and 3D coordinates. So, we mainly use vectors with 2 and 3 numbers.

A 2D vector has two values representing the x and y coordinates, while a 3D vector has three values for the x, y, and z coordinates.

In Godot, vectors are essential for representing positions, velocities, and forces within a game world. We use them in scripts to control characters, detect collisions, and more. Godot provides two primary vector types: Vector2 for 2D, and Vector3 for 3D.

Common vector operations

You can manipulate vectors with various operations, including:

  1. Addition and subtraction: You can use these to move a sprite or a character in the game world.
  2. Multiplication and division: You can scale vectors by multiplying or dividing them by a number.
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!