k0fe

Mathf.PingPong

Jun 23rd, 2019
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.18 KB | None | 0 0
  1. public float x = 2;
  2. public float y = 1;
  3.    
  4. void FixedUpdate()
  5. {
  6.     transform.position = new Vector3(Mathf.PingPong(Time.time, x) - y, transform.position.y, transform.position.z);
  7. }
Advertisement
Add Comment
Please, Sign In to add comment