Devlog 2: Adding Physics
It took me a little, but now I’ve added interaction between the different particles, to reflect their charges, based on Coulomb’s Law:
F = k * q_1 * q_2 / d^2
Where k is the coulomb constant, q the charges of the particles in coulombs (a unit) and d the distance between the particles.
Whether a particle is a proton, neutron or electron, is based on their index in the positions array, modulo 3:
colors[index % 3];
charge[index % 3];
But the reason it took me a bit is, because I tried to change the coulomb constant in a way so that when q is of the unit e (elemental charge) instead of in coulombs and the distance d in fm instead of in m (1fm = 10^-15), it still is correct. But I struggled a bit, until eventually I found the problem, I forgot to account for the fact that d is squared, meaning the 10^15 I was working with, where supposed to be 10^30, so as soon as I fixed that, it finally worked like it should.
Next thing to do, is to imitate the strong force, so the protons can stay together.
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.