im afraid general physics engine such as bullet, havok and physx can not help you much. they are mostly about COLLISION DETECTION. they are about moving objects at their speed and monitoring if they have collided with something. collision response is still mainly up to you.
it seems to me, what you need is Maxwell equations or similar E/M FIELD equations. in other words, once you implement magneto-electric fields interaction it will automatically handle both "collision and response", its built-in into those equations, so to say.
however,
if you would like to simulate electrons and protons as a collection of charged particles, each with its mass, velocity, charge and magneto-electric dipole field, then you need Lorentz equations and you may contact me here if that is the case, i'll share some source code: sione_vaissel_at_yahoo.ca
my only problem is SPIN... now, instead of starting a new thread let me ask my question here and hopefully it is related to original question, so here it goes...
--- THREE MAGNETS (N-dipole-body problem) ---
imagine 3 bar magnets sitting on a table randomly spaced. they are fixed and can not translate, only rotate around their centers , it is 2D situation. there is no gravity, no friction and only forces are magnetic forces. here is a picture where "x" is the point of rotation and coordinate center of each magnet, we have "top" magnet, "middle" magnet and "bottom", like this:
Code: Select all
[S- x -N] topMag: a=90, x=7, y=25
[N- x -S] midMag: a=270, x=18, y=19
[S- x -N] botMag: a=90, x=12, y=4
- input are 3 initial angles and 3 pairs of (x,y) coordinates
- output are the new angles after system stabilize
1.) is there a "general solution" or it must be integrated step by step?
2.) is there a singe solution? is solution stable, chaotic or oscillating?
basically, how to simulate this simple situation?
unfortunately it does not end there. this is only simplified situation and "real algorithm" is the one that can handle situations in 3D with any number of "free floating" magnetic dipoles. it will need to handle both angular and linear acceleration. however, even if this is possible the ultimate question is still how to compare it with the real-world and make sure there are no bugs. here's simple question from every day life: given the four situations - DO MAGNETS ATTRACT OBJECTS IN A STRAIGHT LINE??
a.) magnet dipole - magnet dipole
b.) magnet dipole - electric charge
c.) magnet dipole - metal molecule
d.) magnet dipole - charged metal molecule