Reputation: 11
I'm using Pymunk 3.0.0 on a Raspberry Pi running Debian Wheezy 7.0. When I try making a shape using the 'pymunk.Segment' function I end up with only the first line of the polygon. The same happens in both the Flipper and BouncingBalls demos so I'm fairly sure it's not my code.
For instance...
static_body = pymunk.Body()
static_lines = [pymunk.Segment(static_body, (150, 100.0), (50.0, 550.0),3.0)
,pymunk.Segment(static_body, (450.0, 100.0), (550.0, 550.0), 3.0)
,pymunk.Segment(static_body, (50.0, 550.0), (300.0, 600.0), 3.0)
,pymunk.Segment(static_body, (300.0, 600.0), (550.0, 550.0), 3.0)
,pymunk.Segment(static_body, (300.0, 420.0), (400.0, 400.0), 3.0)
]
for line in static_lines:
line.elasticity = 0.7
line.group = 1
space.add(static_lines)
...would only create the line from 150,100 to 50,550 and not the other 4.
And when I try to draw the lines using PyGame then first line is drawn okay but the rest are just a very short, thin line at the body's location.
As this happens in the examples I'm assuming it's a bug with Pymunk/Chipmunk/Linux but can't find anything on Google.
Any help much appreciated (noob btw)
Dave.
Upvotes: 1
Views: 689
Reputation: 833
It is possible that the older versions of pymunk expect each new body or shape to be added as a different argument to space.add()
.
So try changing space.add(static_lines)
to space.add(*static_lines)
.
Upvotes: 1