Making Objects Move With Sines & Cosines

Sines & Cosines Can Do Magic

If you haven't realized the capability of sines and cosines in making objects move in game then you are in for a treat.
In order to make the objects move you just have to set the x position & y position respectively.
Here are some of the things we will be making:
sin and cosine stuff in unitysine and cosine example in unity

First we just make the ball travel in a circle.
The 'itrValue' is some value that keep changing every frame like Time.timeSinceLevelLoad  
Position in x-axis : Sin(itrValue) * radius
Position in y-axis : Cos(itrValue) * radius
Now we will make it tilt towards a side:
Position in x-axis : Sin(itrValue) * radius
Position in y-axis : Cos(itrValue + offset) * radius
We will now make it move in a flower petal path:
Position in x-axis : Sin(itrValue) * (radius + Cos(itrValue* frequency)
Position in y-axis : Cos(itrValue) * (radius + Cos(itrValue* frequency)
sine and cosine example in unity

Now a random-esque path, useful when object need to move in a way that looks semi-random like the movement of a swarm of mosquitoes:
Position in x-axis : Sin(itrValue) * (radius + Cos(itrValue + Sin(itrValue * frequency))
Position in y-axis : Cos(itrValue) * (radius + Cos(itrValue+ Cos(itrValue* frequency))
sin and cosine stuff in unity

You can get the Unity package HERE.
If you just want the source code, you can get it HERE.
For more Unity development tutorials go HERE.