When to use math functions

Hi,
When should i use math.sin, math.cos, math.tan etc. I know Trigometry but idk when to use the math functions

Depends on a lot of use case. sin can be really useful for “bobbing” effects.

You use them for trigonometry. They’re trigonometric functions. Finding the angle between two parts, anything involving a unit circle, most vector operations.

i know what the trig functions do but i cant put it in practice, i know that the sun is useful for “bobbing” effects but i dont have a clue on how to do it

sin(x) oscillates from -1 to 1 over time. You can change the phase, amplitude, and frequency to affect the range, speed, and offset of the wave for a “bobbing” effect.

IIRC, The general formula of a sine wave is:
amplitude * sin((x / frequency) + phase)

Changing the amplitude affects the range, changing the frequency affects the “speed”, and changing the phase affects the “offset” from the original condition.

Here is a Desmos I setup real quickly that you can play with.

a represents amplitude, f represents frequency, p represents phase.

1 Like