

It’s called a cross product because its the product of a cross over. The cross product produces a single vector from two input vectors. If the dot product is negative, then the two vectors point in opposite directions, or above 90 and less than or equal to 180 degrees. Dot product in built functionīroadly speaking, if the dot product of two non-zero vectors is positive, then the two vectors point in the same general direction, meaning less than 90 degrees. at an angle of 90° to each other) Unity also comes with a handy built in function similar to that of the magnitude function. If the Dot Product of two vectors = 0, we know that the two vectors are perpendicular (i.e. (3x * 4x) + (3y * 4y) = the Dot Product of two Vector2’s (1x * 2x) + (1y * 2y) + (1z * 2z) = the Dot Product of two Vector3’s The Dot Product is the combined value of two Vectors of the same type which produce a single value known as a scalar. There are two common operators involving Vectors – dot product and cross product. Instead of doing these calculations in Unity the long way, the engine comes with it’s own pre-canned magnitude function attached to both the Vector2 and Vector3 classes. Therefore in the 2D Vector (I’m all out of 3D paper) The Origin is 0,0,0 and the point? is 6,0,4 in the x y z axis Vector2 v2 = new Vector2((float)6.0f, (float)4.0f) //A 3D Vector v3 being constructed The Origin is 0,0 and the point? is 6,4 in the x y axis And consists of two components – the first being the () or () component and the second being set programmatically () or ().Įxample of a Vector setups: //A 2D Vector v2 being constructed Being as thought Vectors are critical to both 2D and 3D game design (like you need to know this stuff) it looks like I need to understand them, backwards!Ī Vector is a line drawn between two points in 2D or 3D space which also has a length, known as its magnitude.Ī Vector always starts from it’s Origin – its () or () component.
