Game Development Reference
In-Depth Information
Using vectors
We will be using vector math frequently when designing the AI for our games. Vectors are
used everywhere, from calculating which direction a game agent should shoot its gun in, to
expressing the inputs and outputs of an artificial neural network. You should know them
well.
Let's take a point P as follows:
P = (x, y)
A two-dimensional vector looks almost the same when written, as follows:
V = (x, y)
However, although similar, a vector represents two components: direction and magnitude.
The right-hand side of the following diagram shows the vector (9, 6) situated at the origin:
The bearing of the arrow shows the direction of the vector, and the length of the line repres-
ents the magnitude of the vector. A vector can represent the velocity of a vehicle. The mag-
Search WWH ::




Custom Search