terça-feira, 7 de maio de 2013

Gravity Simulation

God it was a pleasure to code this!
I've always had a knack for physics, and to be able to combine that with physics is just amazing, which just makes it even better.
I have been on this for quite a while now, but the final version of the code (the draft was very messy) was quite quickly put together, since I already knew what to do.
I'll write on this project's details later (since there's a lot behind it), and it still has way too many rough edges, but I just couldn't wait to post it here:

(there's only one particle for now, even though I created a class, and if the distance between the attractor (contollable with the mouse) and the particle is zero, the latter will disappear (divide by 0 and stuff like that). If anything goes wrong, i.e. the particle disappears of goes out of the screen, go here and refresh the page. )




(P.S.: I particularly enjoy trying to make one orbit the other)

Source
Full Screen
Licença Creative Commons
GravitySimulation by MikeMakesGames is licensed under a Creative Commons Atribuição-Partilha nos termos da mesma licença 3.0 Unported License.