Eonirr

Untitled

Feb 11th, 2026 (edited)
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. IEnumerator MoveOverDistance()
  2. {
  3. direction = (transform.position - startPosition).normalized;
  4.  
  5. float currentDistance = 0f;
  6. float distance = //jusqu'à l'infinie et au delà
  7. while (currentDistance < distance)
  8. {
  9. float step = speed * Time.deltaTime;
  10.  
  11. transform.position += direction * step;
  12.  
  13. currentDistance = Vector3.Distance(startPos, transform.position);
  14.  
  15. yield return null;
  16. }
  17.  
  18. transform.position = startPos + direction * distance;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment