Use cases for trigonometric functions and vector dot and cross

I’ve seen some scripts using trigonometric functions like math.cos (inverse math.acos), and some vector functions like vector dot and vector cross. When I do use these functions?

1 Like

Sin and cosine functions return a Y and X point given an angle on the unit circle. This is actually really useful once you understand it. Since it’s a coordinate on a unit circle, you can multiply it by the radius/length that you want to extend the direction. This is especially useful for 2D games. Reference unit circles, it’ll help this concept make more sense.

As far as dot products go, this is especially useful for comparing two different directions, and to return a differential between the two. A common use case for this would be a line-of-sight system, to see if two directions are similar enough to be considered to be in the bot’s line-of-sight.

acos and other trig functions retrieve the different arc tangents and all that stuff, but I’m not too familiar with them.

1 Like