Advertisement
Guest User

Untitled

a guest
Aug 12th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1.  
  2. constant c_inverse_squares
  3. constant c_springs
  4. constant c_gravity
  5. constant c_dampening
  6.  
  7. foreach (node n1)
  8. foreach (node n2)
  9.  
  10. force = (0, 0)
  11.  
  12. if (n1 != n2)
  13. force += gravity (n1, n2)
  14.  
  15. if (n1 isconnectedto n2)
  16. force += hookelaw (n1, n2)
  17. endif
  18.  
  19. endif
  20.  
  21. end
  22.  
  23. n1.velocity += (force * c_dampening)
  24. n1.position += n1.velocity
  25.  
  26. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement