Advertisement
Guest User

Line

a guest
Nov 1st, 2014
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. Vector link = target.toVector().subtract(location.toVector());
  2. float length = (float) link.length();
  3. link.normalize();
  4.  
  5. float ratio = length / particles;
  6. Vector v = link.multiply(ratio);
  7. Location loc = location.clone().subtract(v);
  8. for (int i = 0; i < particles; i++) {
  9. if (isZigZag) {
  10. if (zag)
  11. loc.add(0, .1, 0);
  12. else
  13. loc.subtract(0, .1, 0);
  14. }
  15. if (step >= amount) {
  16. if (zag)
  17. zag = false;
  18. else
  19. zag = true;
  20. step = 0;
  21. }
  22. step++;
  23. loc.add(v);
  24. particle.display(loc, visibleRange);
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement