-
hmm i guess id rather like a laymans terms explanation of what cosine and sine is exactly, as I have many plans to use it in my games for all types of things... someone told me it is
"a point of a circle with a radius of 1"
and cos(0) = 1 while sine(90) = 1
it causes my brain to break trying to understand this, but it seems really important. and Atan2 is that just finding difference between two points? including the angle of the two locations which comes naturally from X, Y coordinates?
-
I find this picture really helps understanding trigonometric functions:
https://upload.wikimedia.org/wikiped...nctions_en.png
In layman terms:
let's say you have a circle with a radius of 10
say you "angle" this radius by 30 degrees,
and now you want to find it's X-Y components
(i.e. how far it has gone to the left, and how far up)
because you are moving your object on a cartesian plane
to find X components you must just multiply 10 (radius) * Cos(angle)
to find Y components you must just multiply 10 (radius) * Sin(angle)
Think of sin and cos as "ratios",
how much your radius horizontal/vertical components has shrunk when it's been angled
Pay attention to the fact that X-Y coordinates in fusion are integers
while sin and cos will most likely return float values
So you'll better do your calculations using alterable values (can hold float values)
and then position your objects basing on that values.
As for Atan2, this in an inverse function (trigonometric functions give ratios from angles, while inverse functions give angles from ratios)
returns the angle of the line drawn within 2 given points and the horizontal x axis