As you know, I have been dipping my feet in Unity3D for sometime now and have been talking to a few people. Unity has been attracting users/developers from a vast range of backgrounds, from artists to Ph.D holders and hard core developers. As with any 3d package, you need to rely quite a bit on Maths to do basic operations.

I, myself coming from traditional CS background and have done some maths during college, but since been doing enterprise software (SharePoint) and also who remembers stuff from college? It took a little time to get the memory refreshed.

So today I will be talking about one word that confused me a lot in the beginning, Vector3 data structure.

So what does the Unity documentation says about Vector3?

It says:

“*Representation of 3D vectors and points*“

“*…to pass 3D positions and directions around.*“

Vector3 represents 2 things in Unity3D:

- A 3D point in space, denoted by (x,y,z) coordinates. A position.
- Magnitude and direction in (x,y,z) coordinates

Both of them can be easily confused with each other as both are denoted by same coordinate system (x,y,z).

**Position**

So what does a position means? Let’s have a look at the image below:

This basically says, there is a point in the space which is at position 1 on x-axis, 1 on y-axis and 0 on z-axis.

It is just a single point.

**Vector**

and then what is a Vector? The image below will give you an idea:

This is a journey from one point to another, for a certain distance in a certain direction.

In the image below, all these Vectors are (1,1,0) as they are representing only direction and distance and NOT the origin or destination.

Vectors have some basic mathematical properties like add, subtract, multiply, divide etc. E.g.

**Vector(1,1,0) x 2 = Vector(2,2,0)**

Here the final vector achieved, will be twice the distance but in same direction.

**Vector(1,1,0) x -1 = Vector(-1,-1,0)**

Here the vector direction has been reversed but the same distance. Think of it as a car, which was moving forward and now in reverse gear.

You will find many people around and Unity3D also, using Vector3 as both point and direction vectors interchangeably.

So do not get confused and keep your head straight andÂ Happy CodingÂ