Magnetic interaction
- juanpi
- Posts: 24
- Joined: Wed Jan 30, 2008 3:52 pm
- Contact:
Magnetic interaction
Hello people,
I have implemented magnetic forces between two bodies. I use all what I posted before, Long range interaction and Verlet velocity integration.
I will post the equations for force in wikipedia and my blog http://www.lavidasegunjuanpi.blogspot.com in a few days.
Meanwhile enjoy the videos
http://www.youtube.com/watch?v=0K-RD60Rloc
http://www.youtube.com/watch?v=0J4ld6X8I6U
http://www.youtube.com/watch?v=K-2uitdJDNg
Cheers,
I have implemented magnetic forces between two bodies. I use all what I posted before, Long range interaction and Verlet velocity integration.
I will post the equations for force in wikipedia and my blog http://www.lavidasegunjuanpi.blogspot.com in a few days.
Meanwhile enjoy the videos
http://www.youtube.com/watch?v=0K-RD60Rloc
http://www.youtube.com/watch?v=0J4ld6X8I6U
http://www.youtube.com/watch?v=K-2uitdJDNg
Cheers,
- slembcke
- Site Admin
- Posts: 4166
- Joined: Tue Aug 14, 2007 7:13 pm
- Contact:
Re: Magnetic interaction
Nifty.
I was thinking about magnets the other day after watching your video with the electrostatic charges. Definitely makes for some interesting videos.
I was thinking about magnets the other day after watching your video with the electrostatic charges. Definitely makes for some interesting videos.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
- juanpi
- Posts: 24
- Joined: Wed Jan 30, 2008 3:52 pm
- Contact:
Re: Magnetic interaction
hi all,
You can find a formula for the forces here
http://en.wikipedia.org/wiki/Magnetic_moment
I checked it a few times, but if somebody finds a mistake feel free to correct.
I would like to prepare a demo on long range interaction and how to change the integrator without changing Chipmunk source code...Do you find this useful or not? Nonetheless i cannot give a date for the release of such tutorial.
Cheers,
You can find a formula for the forces here
http://en.wikipedia.org/wiki/Magnetic_moment
I checked it a few times, but if somebody finds a mistake feel free to correct.
I would like to prepare a demo on long range interaction and how to change the integrator without changing Chipmunk source code...Do you find this useful or not? Nonetheless i cannot give a date for the release of such tutorial.
Cheers,
- slembcke
- Site Admin
- Posts: 4166
- Joined: Tue Aug 14, 2007 7:13 pm
- Contact:
Re: Magnetic interaction
Yeah, go for it. I'm sure someone would find it useful. I've thought about adding some electrical charge puzzles to one of my upcoming games actually. Could be a nifty idea.
Speaking of which, I really need to get that Chipmunk wiki put up...
Speaking of which, I really need to get that Chipmunk wiki put up...
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
- juanpi
- Posts: 24
- Joined: Wed Jan 30, 2008 3:52 pm
- Contact:
Re: Magnetic interaction
Hey, I am also working in a puzzle game (hinged dissection of polygons or in other words folding puzzles). For the moment without physics...maybe we can share some ideas. PM me if you are interesting in sharing some brainstorming...and a flash sub-demo, jejejslembcke wrote:Yeah, go for it. I'm sure someone would find it useful. I've thought about adding some electrical charge puzzles to one of my upcoming games actually. Could be a nifty idea.
-
- Posts: 45
- Joined: Fri Feb 27, 2009 7:59 am
- Contact:
Re: Magnetic interaction
Hi juanpi,
Can you share some source code?
I would like to see how is done the magnets in Xcode.
Can you share some source code?
I would like to see how is done the magnets in Xcode.
- slembcke
- Site Admin
- Posts: 4166
- Joined: Tue Aug 14, 2007 7:13 pm
- Contact:
Re: Magnetic interaction
I've added his example as a new demo in the trunk version of Chipmunk.
You can see it here: http://code.google.com/p/chipmunk-physi ... Electric.c
You can see it here: http://code.google.com/p/chipmunk-physi ... Electric.c
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
-
- Posts: 45
- Joined: Fri Feb 27, 2009 7:59 am
- Contact:
Re: Magnetic interaction
Great!
Thanks,
Pablo
Thanks,
Pablo
-
- Posts: 6
- Joined: Fri May 29, 2009 3:09 pm
- Contact:
Action-Reaction patch (not ready yet)
I've tried to make use of the action-reaction principle to reduce the computational load. I've uploaded the patch here.
The CPU load is reduced, however, there seems to be a problem, most likely with the torques. I'm not very familiar with the equations or the inner workings of Chipmunk, so probably some assumptions I made are wrong.
One such assumption (which relates to how Chipmunk works), is that the force functions are invoked for each body in order (as found in the cpSpace::bodies)
can someone please check this patch?
EDIT: patch removed. look below
The CPU load is reduced, however, there seems to be a problem, most likely with the torques. I'm not very familiar with the equations or the inner workings of Chipmunk, so probably some assumptions I made are wrong.
One such assumption (which relates to how Chipmunk works), is that the force functions are invoked for each body in order (as found in the cpSpace::bodies)
can someone please check this patch?
EDIT: patch removed. look below
Last edited by ioannis on Wed Nov 18, 2009 11:12 am, edited 1 time in total.
-
- Posts: 6
- Joined: Fri May 29, 2009 3:09 pm
- Contact:
Action-Reaction patch
ok, I think I found the error. The sign of the forces was wrong. I'm including here the revised patch. Please do check it as well, see if it does behave as expected.
Who is online
Users browsing this forum: No registered users and 7 guests