Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public float freq = 5;
- private float unit;
- private float x, y;
- private void Start()
- {
- x = transform.position.x;
- y = transform.position.y;
- }
- void Update()
- {
- x = unit * Mathf.Cos(Time.time * freq);
- y = unit * Mathf.Sin(Time.time * freq);
- transform.position = new Vector3(x, y);
- unit += (freq / 10) * Time.deltaTime;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement