Created
April 28, 2017 22:28
-
-
Save Introscopia/093aa7ee076ccb99bf72fa60293b9c51 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void gravitate( Particle p ){ | |
PVector grav = new PVector(1,0); | |
grav.setMag( G*(p.area()) / sq( constrain(dist(pos.x, pos.y, p.pos.x, p.pos.y), 1, 100000) ) ); | |
grav.rotate(atan2(p.pos.y - pos.y, p.pos.x - pos.x )); | |
acc.add(grav); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment