What happens when you multiply two vectors?

Now that I know what happens when you generally multiply it with a number, what happens when you multiply a vector3 with another vector3?

1 Like

You can use Vector3.Scale to multiply two vectors, component by component, e.g.

var v1 : Vector3 = Vector3( 1, 2, 3 );
var v2 : Vector3 = Vector3( 4, 5, 6 );
var vScaled : Vector3 = Vector3.Scale( v1, v2 );  // = ( 4, 10, 18 )

You get an error message.

Further detail since this has come to the top. There are two generally accepted ways to multiply Vector3. As the * would be ambiguous as to which call is being made Unity has implemented neither as default. You can still call static methods on Vector3 to use either.

One is called the dot product. It returns a scalar with a magnitude equivalent to the area of the parallagram between the two vectors. In practical terms the dot product of normalised vectors is equal to the cosine of the angle between them. This can produce really quick angle checks on normalised vectors.

The other is called the cross product. It returns a vector perpendicular to both vectors. Useful for obvious reasons. Particularly when working with planes and surfaces.