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

How to call a function with pymunk's collision handler?

I am trying to implement an AI to solve a simple task: move from A to B, while avoiding obstacles. So far I used pymunk and pygame to build the enviroment and this works quite fine. But now I am facing the next step: to get rewards for my…
Voß
  • 103
  • 9
1
vote
1 answer

pymunk - Tripping Segment

I am trying to do the following: Vertical line segment (with mass) moving forward (@ fixed velocity) on the ground (no friction), tripping over a point (rock) on the ground. I am looking for the segment point in contact with the ground to stop…
Bill
  • 11
  • 2
1
vote
1 answer

Units of velocity in Pymunk

I was wondering what the basic units of velocity are in Pymunk. If I put in a velocity of (50,50) does that correspond to 50 pixels/second in each direction? The API says that the units of angular velocity are rad/s but doesn't say anything about…
dottified
  • 45
  • 4
1
vote
1 answer

dynamic body with segment shape do not move with a joint

In pymunk, I set the body mass and the space gravity, it should automatic fall down, but the body with segment shape do not move, here is my code in pyglet import pyglet import pymunk from pymunk.pyglet_util import DrawOptions window =…
xmzhang
  • 79
  • 1
1
vote
2 answers

top down friction in pymunk

Been struggling with this for a couple of days, hard to find code examples on the net. I'm making a topdown game and having trouble getting the player to move on key press. At the moment i'm using add_force or add_impulse to move the player in a…
Joe
  • 11,147
  • 7
  • 49
  • 60
1
vote
1 answer

What's causing these objects to fly to the left with pymunk?

Recently I've been trying to make a simple game with pymunk. My goal (at the moment) is for the boxes to be affected by gravity, and to 'jump' when they have their up() function called. Here is my code. import pygame from pygame.locals import…
Bruno E
  • 156
  • 11
1
vote
1 answer

Rotating group of bodies in pymunk

I want to make a 2D grasping hand in pymunk, which can rotate, move up/down and to the sides and clench or extend its fingers, basically, the hand looks like 'U' letter. I tried to do it by making 3 separate bodies (palm, left finger, right finger)…
1
vote
1 answer

Can I freeze the angle of a shape?

Like Unitys transfrom,If you freeze the rotate,object will never rotate in its x axis. Dose pymunk have this function?
sasalicat
  • 11
  • 1
1
vote
1 answer

Pymunk: prevent dynamic objects to move into static objects

I have a dynamic object to which I set different velocity values. However when this dynamic body hits a static body, it overlaps partly with the static shape until this collision is resolved and it moves back. Is there a way in pymunk to make the…
Nico Autia
  • 129
  • 2
  • 14
1
vote
1 answer

How to implement n-body simulation with pymunk?

I'm new with pymunk and I would like to implement a n-body simulation (in 2D) like this one: https://www.youtube.com/watch?v=otIGNTFJwpU&feature=youtu.be I already know how to create the space, shapes and the rendering with pygame. My question: is…
rronan
  • 93
  • 1
  • 6
1
vote
2 answers

PyMunk does not create window - Python

I am trying to learn PyMunk library and I used the example from their website. Here is a code: import pymunk # Import pymunk.. space = pymunk.Space() # Create a Space which contain the simulation space.gravity = 0,-1000 # Set…
user8467049
1
vote
1 answer

Pymunk drawing utils not working

I am struggling to setup pymunk on my Ubuntu 16.04. I am using virtualenv, I have Python 3.5.2, pymunk 5.3.0 and cffi 1.11.0 installed. I tried a very simple code first; basically, I created an empty Space and called step on it and everything…
1
vote
1 answer

Does Per-Body Damping Compound With Space Damping in Pymunk?

Making some simulations for a project. My question is does the damping value of a body compound with the damping value of the pymunk space (if there is any)? For example, if I have a pymunk space, SPACE, with SPACE.damping = 0.9 and then I have a…
Skittles
  • 45
  • 4
1
vote
1 answer

Possible To Run Pymunk Simulation Without Screen (as in without actually seeing it)?

The question I have is, is it possible to run a Pymunk simulation without having the screen to visualize it pop up? I'm working on a research project that involves Pymunk and Pygame. The goal is to develop an agent that can infer certain properties…
1
vote
1 answer

Pymunk Pygame Object positions does not update

Trying the following code with python 2.7. Basically its a circle that hangs from a bar and an apple that you can hit with an impulse by pressing the spacebar. There is also a square. import time import pygame import pymunk import…
Saptarshi
  • 603
  • 2
  • 7
  • 15