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 "C:\Users\Home\AppData\Roaming\Python\Python36\site-packages\pymunk\pygame_util.py", line 153, in <listcomp>
ps = [to_pygame(v, self.surface) for v in verts]
File "C:\Users\Home\AppData\Roaming\Python\Python36\site-packages\pymunk\pygame_util.py", line 183, in to_pygame
return int(p[0]), surface.get_height()-int(p[1])
ValueError: cannot convert float NaN to integer
If I do not add the body in space.add
, I don't get the error, but then it doesn't behave properly.
It seems p[ ]
is a vertex, but since I'm using create_box
, I'm not specifying any vertices.
I'm very new to pymunk, and mostly new to python, so it's likely something very simple, but I've been at it for several hours and can't crack it.