Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private Vector3 direction = Vector3.up;
- private float distance;
- float duration;
- private Vector3 _startPos;
- void Start()
- {
- _startPos = transform.position;
- }
- void Update()
- {
- float t = Mathf.PingPong(Time.time / duration, 1f);
- transform.position = _startPos + direction.normalized * distance * t;
- }
Advertisement
Add Comment
Please, Sign In to add comment