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
7
votes
1 answer

How do I bind a Pyglet sprite with a Pymunk shape so they rotate together?

How do I bind a pyglet sprite to a pymunk body so that if the body is rotating the sprite also rotates?
6
votes
1 answer

How to keep one body on top of another using Pymunk

I've got a circle, with a box on top: The circle is a simple motor. I want the box to stay directly over the circle. I've tried different constraints, but most of my attempts cause the box to flop to the side. My most successful attempt is to set…
Paul Vincent Craven
  • 2,027
  • 3
  • 19
  • 24
5
votes
2 answers

Balance box on wheels with springs (lock rotation relative to box) pymunk

I want to be able to lock the angle of the wheels relative to the car's chassis. In between the wheels, there are springs, that should allow the car to suspend, but right now, the angle is not locked. I am using pymunk's function…
5
votes
1 answer

Side scrolling with Pymunk and Pygame. How to move the camera / viewport to view only part of the world?

From the pymunk examples I've seen that there's a difference between the pymunk coordinates and pygame coordinates. Also, that pymunk is meant just for the 2D physics, while pygame is for rendering objects/sprites on the screen. So when searching…
Nav
  • 19,885
  • 27
  • 92
  • 135
5
votes
1 answer

Chaotic Pendulum Exhibiting Chaotic Behavior with the Same Initial Conditions

My first post on Stack Overflow, so bear with me. I have built a model of a chaotic double pendulum in python using the pymunk physics library, which in turn uses the chipmunk C library. The pendulum, being chaotic, displays extreme sensitivity to…
TheRuler
  • 400
  • 2
  • 8
5
votes
2 answers

Pygame collision code

First of all, I have to say that I'm french (so that you understand why I make all these mistakes lol) I'm working on a physic game with python, pygame and pymunk : A ball (I'll call it X) will have to reach a Y point. It's a platformer 2d game. To…
user3593048
  • 71
  • 1
  • 2
4
votes
1 answer

Avoiding collisions of QGraphicsItem shapes moved by the mouse

An interesting discussion was raised here about preventing collisions of circles, made of QGraphicsEllipseItems, in a QGraphicsScene. The question narrowed the scope to 2 colliding items but the larger goal still remained, what about for any number…
alec
  • 5,799
  • 1
  • 7
  • 20
3
votes
1 answer

Oscillating Spring with Pymunk

I am trying to create a pendulum with oscillating string and mass which is expected to oscillate for a period of time and then stop. From what I wrote, the mass could not stop oscillating. Kindly help me out. import pyglet import pymunk …
TAYO
  • 77
  • 3
3
votes
1 answer

Using Pymunk with matplotlib.animation.FuncAnimation()

i'm tring to modify this tutorial for using matplotlib_util module (FuncAnimation). When i try to run the code below, i get this result. I tried to add "ax.clear()" inside the animate function but then I couldn't see anything. I couldn't find the…
3
votes
1 answer

Trying to add a box with create_box, unknown Value error

I'm trying to add a box to a space, here's what I have: body = pymunk.Body() body.position = 300, 200 box = pymunk.Poly.create_box(body, (100, 300)) space.add(body, box) I get the following error: File…
GTS
  • 71
  • 3
3
votes
1 answer

how to change color of a shape in pymunk?

I am trying to create shapes using pymunk with pyglet. But I am facing a problem that I unable to change the color of a pymunk shape. They don't have any such attribute. I have tried draw_polygon in pymunk.pyglet_utils.DrawOptions but there were no…
Xavier
  • 39
  • 2
3
votes
1 answer

Is there an environment variable to disable PyMunk/Chipmunk from printing `Loading chipmunk for Linux`

I am trying to run a PyMunk simulation in a subprocess and get a floating point return value from a pipe, however every time I run the simulation I also get stuck with a Loading chipmunk for Linux (64bit)…
erik
  • 3,810
  • 6
  • 32
  • 63
3
votes
1 answer

Pymunk hitreg issue

I want to create a pinball game but the ball sometimes doesn't collide with other objects. example: https://youtu.be/HwSXwJ4-d2w Here's the code import pyglet, pymunk from pymunk.pyglet_util import DrawOptions win = pyglet.window.Window(1280, 720,…
3
votes
1 answer

Changing constraint colors in pymunk/pygame

I am working on a project using pymunk and pygame. I am using PivotJoint constraints to attach my bodies together. I would like to make the joints invisible if possible - is there any way to do this? Right now the joints appear purple in pygame and…
dottified
  • 45
  • 4
3
votes
1 answer

Non colliding objects which has Colliding Pairs, Pymunk Pygame

I would like to implement a code which has non colliding pairs with colliding objects. My pairs are 2 balls which are connected to each other. I want those 2 pair ball to collide. However I don't want those 2 balls to collide with other pairs. How…
Meric Ozcan
  • 678
  • 5
  • 25
1
2 3
11 12