In this lecture, we'll discuss a bit about the mathematical concepts related to working in 2D and 3D space. The first thing that we need to understand is a little bit about coordinate systems. A lot of times when you're working with a bitmap graphics tool such as Photoshop, you might see a coordinate system, like we see here. In this coordinate system, the upper left-hand corner is the 0,0 position. As we move horizontally to the right, we go up in pixels. Horizontal pixel positions 0, 1, 2, 3, and so on, up to something like 1,920 on a 4K display. As we move vertically down, we go from vertical position 0 to 1, 2, 3, and so on, up to something like 1,080 on a 4K display. Each position within the bitmap is typically lit up with a pixel or not. There is no in-between positions, that is, you can't be halfway between 1 and 2, there is just position 1 or 2. Therefore, we say this is a discrete integer based coordinate system. The pixels map very clearly to the display, so we might call this a device specific coordinate system as well. To contrast this, here is a 2D Cartesian coordinate system. This is the type of coordinate system that you might have encountered in a math class like geometry in the past. In this coordinate system, the 0,0 position is in the middle, often referred to as the origin position. As you go up, you go into the positive y direction. As you go to the right, you go into the positive x direction. But we also have negatives, so we can go below the origin, which would be in the negative y direction and you can go to the left, which would be in the negative x direction. This is a real number or floating point based number system. Between 0 and 1, for example, you could have 0.5 or 0.55 or 0.555 and so on. There is actually an infinite number of mathematical points between any two points unlike the 2D Bitmap coordinate system we just spoke about. Rather than talk about pixels from the top left of the screen and the 2D Cartesian system, we talk about distance from the origin. This distance can be a unit of measurement, such as centimeters, meters, inches, or miles. Immunity, the standard unit of measurement is meters, so 0.1, 2 would be one meter over in the x-direction and two meters up in the y direction. In game development, you'd likely will encounter both types of coordinate systems but the 2D Cartesian system is what you will deal with most. Within the 2D Cartesian coordinate system, you can define points or locations using the x and y position. You can also define vectors which are displacements in space. This concept is a bit more complicated, so let's talk a little bit more about it. While a point is defined by an x and y location, a vector is defined by direction and magnitude, but how do we describe this? Well, we could define two points where the arrow goes from 0.1 to 0.2, which would define both the direction or angle and magnitude or length of the arrow. But let's look at these two vectors, one is at the origin and one is away from the origin. Are these vectors the same? Well, it turns out, yes, they are. Both vectors have the same direction or angle and magnitude or length even though visually they look like they're in different places. Therefore, we can define a vector based on the displacement from the origin. That is, we just need the one point because we already know the origin, which is always 0, 0. For example, this vector can be defined as vector 2 x, y. Based on this, the computer can easily calculate the direction or angle and the magnitude or length of the vector. In games, we use vectors all the time to calculate jumping, shooting, walking, falling, and the list goes on and on and on. Fortunately, unlike in math class, the computer does the heavy lifting of the calculations, but we still need to understand the concept of what a vector is. We may not just be working in 2D space, we may be working in 3D space where we add the z-axis. We have up and down, left and right and now in and out. In 3D space, we can define a vector as vector 3 x, y, z. Once again, this specifies the direction and magnitude of the origin. Within unity, the interface color codes the axes. Here's a fun little way to remember what color is what axis, XYZ equals RGB, so X is red, Y is green and Z is blue. In 3D space, how do we define a model's position, rotation, and scale? We do this using multiple vectors, one for position, one for rotation, and one for scale. The position is the displacement from the origin of the world coordinate system. The rotation is the degree rotation around each axis and the scale is the scale factor on each axis, where one would typically mean 100 percent of regular size, so 2 would be 200 percent size and 0.05 would be 50 percent size. A transform is a mathematical concept that packages together position, rotation, and scale. That is, it packages three vectors. We see transforms represented within the Unity editor as the transform component on game objects. If a lot of this talk about coordinate systems, points, vectors, and transforms is confusing or even mind-blowing, don't worry, it should start to make a lot more sense as we continue through this project.