Questions tagged [pymunk]

Pymunk is a 2D physics library for Python built on top of Chipmunk.

Pymunk is a 2D rigid body physics library for Python based on the MIT licensed Chipmunk Project. It's home page is http://www.pymunk.org/en/latest/.

According to the home page, Pymunk is intended to be easy to use and "pythonic". Pymunk allows you to define and simulate the behaviour of objects with mass, position, velocity and collision properties (i.e. a shape) in a 2D space. It is frequently used for game development. Pymunk provides a large number of examples.

Further Information

176 questions
0
votes
1 answer

Pymunk creating a trail

I want to create a trail of every ball i create, but i cant think of anything that would help me to do it def create_balls(space,x,y): body = pymunk.Body() body.position = (x,y) shape = pymunk.Circle(body, 10) shape.density = 1 …
André GT
  • 7
  • 1
0
votes
1 answer

Pymunk body-specific damping

How to use pymunk.Body.update_velocity(body, gravity, damping, dt) to dampen the mass. I know I can use global damping here but I want to add more masses later on and have custom damping for each one, and so I want to learn how to deploy…
0
votes
1 answer

Combined center of gravity in pymunk

How to find the combined center of gravity of several pymunk bodies. I know how to use the bodies' positions, masses and the relative distances to calculate it manually. Is there a built-in function to achieve the same purpose?
0
votes
1 answer

Creating repulsion between pymunk masses

I am trying to make an animation where two magnets (that are repelling each other) are falling in a rotating tube. I have the falling (gravity) bit and rotation down but I am having trouble with magnetic forces. The equation for the force that I am…
0
votes
0 answers

"testpymunk.py", line 3, in import pymunk # Import pymunk.. ModuleNotFoundError: No module named 'pymunk'

I installed pymunk with the conda install method. It installed and is in the correct directory. From the python terminal it passes the python test program. In either Spyder IDE or Geany IDE when I attempt to run any of the example programs from the…
0
votes
1 answer

change of impulse direction Pymunk (python)

Hi i would like to create a small drone simulator. Two engines on the left and right. I was based on examples from the pymunk library. But I have no idea how to add engine power to make it hit the point, i.e. make the object rotate. This can be done…
Hubert
  • 42
  • 1
  • 5
0
votes
1 answer

How to get camera following a car in pymunk and pyglet

so im trying to make my car to stay in the start of the screen while moving every thing else to the left but im not ver succesfull at that. my car dont need any inputs from a player it always run with the same speed. here is what ive maid so far -…
0
votes
1 answer

Implementing a built in GUI with pymunk and pygame in Python?

I am looking to make a python program in which I can have a sidebar GUI along with an interactive 2d pymunk workspace to the right of it, which is to be docked within the same frame. Does anyone know how I might implement this?
92carmnad
  • 122
  • 7
0
votes
1 answer

Pymunk/Chipmunk2d - dynamic bodies colliding with static bodies generating collsion impulses

Can static bodies apply collision impulses to dynamic bodies? Here's a little recording of what my code does: As you can see, the two dynamic triangles collide with each other and are stopped by the static line. however, the behaviour is not what I…
0
votes
1 answer

How to change constraint size in pymunk?

I found out how to change the colour of constraints: draw_options = pymunk.pygame_util.DrawOptions(screen) draw_options.constraint_color = 200,200,200 But when drawing small objects, the size of the constraint appears to be too large and makes it…
Nav
  • 19,885
  • 27
  • 92
  • 135
0
votes
1 answer

How to rotate pymunk joints at will?

I'm trying to create a walking spider like this: I considered using a SimpleMotor at the pink and red joints and control them using the rate function. But when I tried, I get an error that the function is not callable. …
Nav
  • 19,885
  • 27
  • 92
  • 135
0
votes
1 answer

The right way to create and update objects in a Pymunk camera windowed world?

I asked about how to have a camera window view of a Pymunk+Pygame world and although I received a generously explained answer, I'm not convinced, because the person uses a Pygame Surface to blit. The API says a Surface is meant to represent an image…
Nav
  • 19,885
  • 27
  • 92
  • 135
0
votes
2 answers

Pymunk - setting position at every timepoint and getting no collisions

I am using pymunk to simulate bodies moving. Because I want the bodies to move in a certain way I am setting their positions every time point (I know that this is not recommended for Chipmunk/Pymunk). Doing this gives me good results for individual…
dottified
  • 45
  • 4
0
votes
1 answer

How do I assign values to a variable with a schedule function in pyglet?

With the following code x=1.0 def update(dt): space.step(dt) def xprinter(self, x): print (x) return x+1 if __name__ == "__main__": x=pyglet.clock.schedule(xprinter,x) pyglet.clock.schedule_interval(update, 1.0/60) …
0
votes
0 answers

How do I work equations of motion into pymunk and draw them in pymunk?

Running equations of motion within pymunk is pretty easy, but once I have to draw it in a window I get a little confused. How would you set up a simple equation of motion (force linearly depends on x position, for example) within the @window.event…
1 2 3
11
12