Eonirr

Untitled

Apr 9th, 2025
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. private Vector3 direction = Vector3.up;
  2. private float distance;
  3. float duration;
  4.  
  5. private Vector3 _startPos;
  6.  
  7. void Start()
  8. {
  9. _startPos = transform.position;
  10. }
  11.  
  12. void Update()
  13. {
  14. float t = Mathf.PingPong(Time.time / duration, 1f);
  15. transform.position = _startPos + direction.normalized * distance * t;
  16. }
Advertisement
Add Comment
Please, Sign In to add comment