Main Menu

2 dimensional gas

Started by ShadowCentaur, July 12, 2008, 05:23:52 PM

Previous topic - Next topic

ShadowCentaur

I'm working on a two dimensional gas simulator (using elastic collisions of circles) and I can't quite get it to work correctly. Things keep sticking or flying off in the wrong direction. Anyone done something similar before and have some tips for implementing physics in two dimensions? I used the process discribed here www.geocities.com/vobarian/2dcollisions/2dcollisions.pdf and my code looks pretty much the same as the source he posts here http://www.geocities.com/vobarian/bouncescope/ . Once I get the collisions and maybe some rotational effects going, I've got an idea for a game that the user can "fling" atoms at one another, they form bonds and you get points for making certain types of molecules and exploding them.
If you ever need me, click your heels three times and press Ctrl + Alt + Del.

ATLUS


ShadowCentaur

I found the bug. It turns out that having 20 lines of code to do the job of 4 lines is asking to get some variables mixed up... They now collide properly, (with fully elastic collisions) and there are a number of linear springs attached to them (bonds) wich are damped slightly. the user can grab atoms with the mouse (press and hold left mouse button) and exert a spring force. i haven't decided how the bonds will be formed at the player's controll, probobly depending on the number of electrons orbiting them (to be added) and impact speed.
If you ever need me, click your heels three times and press Ctrl + Alt + Del.