Advertisement
Guest User

Untitled

a guest
Nov 17th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. public float freq = 5;
  2.  
  3. private float unit;
  4. private float x, y;
  5.  
  6. private void Start()
  7. {
  8. x = transform.position.x;
  9. y = transform.position.y;
  10. }
  11.  
  12. void Update()
  13. {
  14. x = unit * Mathf.Cos(Time.time * freq);
  15. y = unit * Mathf.Sin(Time.time * freq);
  16.  
  17. transform.position = new Vector3(x, y);
  18.  
  19. unit += (freq / 10) * Time.deltaTime;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement