1

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.

4

1 回答 1

0

旧版本的 pymunk 可能希望将每个新的 body 或 shape 作为不同的参数添加到space.add().

所以尝试更改space.add(static_lines)space.add(*static_lines).

于 2019-11-29T19:44:59.927 回答