Vector’s are one of the most used tools in games. At first glance it might seem like there is a lot of magic that goes into them but actually they are very simple structures.
Here is an example of a two dimensional vector:
It only has two pieces of data! 0 is the position on the x-axis, 2 is the position on the y-axis.
If we take another two dimensional vector:
We can have a look at some of the basic operations, add and substract.
A + B
If you read it column by column you can see that it just adds the x of the first vector to the x of the second vector and on the other set of numbers it adds the y’s together.
A – B
This is really how simple vectors are at their heart. In Part 2 we will look at how the length of a vector is calculated and what different types of vectors there are.