Jump to content
  • Advertisement
Sign in to follow this  

magnetic force for orbitted movement

This topic is 3498 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a number of particles, moving on an elliptical orbit. What I want to do is this: When I bring a magnet closer to the orbit, the orbit will be morphed, meaning particles will lean towards the magnetic field. When I put away the magnet, they will go back to the original orbit. But I have no idea how to approach this. I prepared the elliptic movement, but how would I integrate the magnet into this? Any ideas?

Share this post

Link to post
Share on other sites
In brief: The movement of your particles is described by a differential equation. Write it down. Then use some numerical integrator (the simplest: explicit Euler) to solve it.

It sounds like this is different from what you are currently doing; it sounds like you currently have functions of time that return the particles' positions. In other words, you've written down the analytical solution to some underlying differential equations. This is very nice when you can do it, but it makes it difficult to add additional forces. Also, it's generally only possible for reasonably simple differential equations.

Now: what is the differential equation? Write down a sum of forces on each particle, and this gives you its acceleration.

Then, you'll want to take this differential equation and put it in "state space form," meaning that you introduce as many variables and equations as you need so that all of your differential equations become first-order. For physical systems, the state is just the position and the velocity (or, equivalently, position and momentum).


Instead of writing

\ddot{x} = f(x)

you'd write,

\left[ \begin{array}{c}\dot{x} \\ \dot{v} \end{array} \right] =\left[ \begin{array}{c}v \\ f(x) \end{array} \right]

This is a first-order differential equation which you can solve using standard numerical methods for the solution of ODEs (ordinary differential equations).

Finally, a warning: I mentioned explicit Euler integration because it's easy to understand and implement. However, it has some problems. The big one is that it tends to increase the energy in your system rather than conserving it. A slight modification gives the semi-implicit (or "symplectic") Euler method which does conserve energy (to first order).

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!