2

This simple pymunk code is giving me problems:

space = pm.Space()
b = pm.Body()
b.position = 400,400
c = pm.Circle(b,10)
space.add(b,c)

The above code creates a dialog like the one below

Error Dialog

Why is this happening, and how do I solve this??

Prof. Falken
  • 24,226
  • 19
  • 100
  • 173
pradyunsg
  • 18,287
  • 11
  • 43
  • 96
  • You are likely encountering a fault in the chipmunk library. A debugger could give you more conclusive evidence. If your chipmunk build preserved its symbols and you can run the program under the debugger, you'll likely have a very clear indication of what point the problem occurred and where next to look for a patch or workaround. – Brian Cain May 01 '13 at 14:18
  • @BrianCain Yes, I have done that, the error pops up after the call to chipmunk, to add a new body. – pradyunsg May 01 '13 at 15:01
  • but with a debugger you should know exactly the stack trace and the specific nature of the fault. For example, was it a bus error or segmentation violation, did it occur on a read or write access, what line of code/instruction was executing at the time. Given that information, you could partition the problem into pymunk vs chipmunk, perhaps with the help of the pymunk dev team. And perhaps they could suggest a workaround or a change to your environment. – Brian Cain May 01 '13 at 16:25
  • @BrianCain Well there are not Python errors raised (Pymunk does not do that, so, it's hard to say what exactly happened), that's why I asked this question.. I have used IDLE's Debugger, so if you were pointing at the chipmunk part of the library, I don't know what to do.. Waiting for viblo's answer.. – pradyunsg May 02 '13 at 10:29

1 Answers1

1

If you check the command line I think you will find that Chipmunk printed out the reason. Almost certainly the problem is that you are trying to add a static body to the space, you cannot do that.

viblo
  • 4,159
  • 4
  • 20
  • 28
  • Then, how do I add a static body?? If it is not possible, how do I implement the joint, is there no need to add the body?? – pradyunsg May 03 '13 at 05:34
  • exactly, you dont need to add both bodies in a joint. The important part is that the joint itself is added. – viblo May 03 '13 at 09:40
  • The joint will do its thing as long as its added to the space. If you need one (or both) of the bodies also simulated (for example affected by gravity), then you should add them as well. – viblo May 05 '13 at 20:17