Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Electricity and general attractive/repulsive force? #158

Open
aparamon opened this issue Feb 22, 2019 · 2 comments
Open

Electricity and general attractive/repulsive force? #158

aparamon opened this issue Feb 22, 2019 · 2 comments

Comments

@aparamon
Copy link

pymunk.Body seems to only support gravitation, but not other types of mechanical forces, e.g. electricity.
Is it possible to specify body electric charges?

More generally: is it possible to specify polynomial attractive/repulsive force, and specify its per-body "charges"?

@aparamon aparamon changed the title Electric and general attractive/repulsive force? Electricity and general attractive/repulsive force? Feb 22, 2019
@viblo
Copy link
Owner

viblo commented Feb 22, 2019

There is no built in ready to use support for this. You will have to do something yourself.

There are some resources for Chipmunk (The c library pymunk is using) that you might find useful:
https://chipmunk-physics.net/forum/viewtopic.php?f=1&t=1433&p=6906
https://github.com/slembcke/Chipmunk2D/blob/b56ae7591b78acc6bb72401ee999d0e9b5019305/Demo/MagnetsElectric.c
https://github.com/slembcke/Chipmunk2D/blob/master/demo/Planet.c

@viblo
Copy link
Owner

viblo commented Apr 16, 2019

Rereading this issue I see that another thing should be clarified: Pymunk does not calculate any gravity force between two bodies. The only thing it does is calculate how the gravity set on the space should affect each body.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants