What is dot product and cross product?

Hello. I’m currently found out new functions named dot product and cross product.

I’m not very sure what these functions do as when I try to run it I would not get any sense from it.
If anyone here is more experienced with that please try to help. Any help is apreaciated.

Please look up tutorials like these Cross And Dot Products before posting for information. :slightly_smiling_face: :star_struck:

Dot product: cosine angle between 2 vectors
(it’s that angle, between the end and start of the curved line)

To turn it into radians (yes, radians not degrees), you do math.acos(dotproduct)

Cross product:

  • Get a paper
  • Pick 1 side of the paper as a vector (vectorA), and the side next to it as another vector (vectorB)
  • Get a stick and stab the paper, you get the direction
  • Cut out the paper and stick it on the stick until there’s no paper left.
  • That’s Cross product

(green arrow is supposed to show the actual representation of the vector (length and direction altogether)

You can find more details around this:

The cross product returns a vector that is perpendicular between 2 vectors, for example, here is an image:,

VectorA:Cross(VectorB) returns the vector C/returns a vector that is perpendicular to Vector A and B. You might want to use this function if you want to fire a ray to the right of your Roblox character

The dot product basically returns 3 whole numbers, 1, 0 and -1. It returns 1 if 2 vectors are facing in the same direction. It returns 0 if 2 vectors form a right angle. It returns -1 if 2 vectors are facing the opposite direction. You might want to use this function if you want to let a player fight a monster if its in front of your character or letting a player interact with an NPC if its facing towards it.