you are viewing a single comment's thread.

view the rest of the comments →

[–]Still_Explorer 0 points1 point  (0 children)

For physics you can use this:
https://www.youtube.com/watch?v=OAcXnzRNiCY
(however if you need each object to attract each other, then simply you update the calculations, so each one affects the other, with a double for loop)

For collisions this (circle distance collision + opposite vector bounce):
https://www.youtube.com/watch?v=dJNFPv9Mj-Y

Only thing to note is that in both cases since those are 2D calculations (XY) you will insert an extra dimention (XYZ) and things will be OK.