Skip to content Skip to sidebar Skip to footer

Pymunk/chipmunk2d - Dynamic Bodies Colliding With Static Bodies Generating Collsion Impulses

simple question, but couldn't find an answer: Can static bodies apply collision impulses to dynamic bodies? here's a little recording of what my code does As you can see, the two d

Solution 1:

The problem is that the center of gravity of the triangle is in the corner (0,0). Meaning all its mass is in that point which is why it doesnt turn and slide down on the side.

One way to fix it is to adjust so that (0,0) is in the middle of the triangle:

points = (-25, -25), (25, -25), (0, 25)

Another way is to transform the vertices of the triangle when creating the shape, by translating them -25 in each direction:

shape = pymunk.Poly(body, points, pymunk.Transform(tx=-25,ty=-25))

Post a Comment for "Pymunk/chipmunk2d - Dynamic Bodies Colliding With Static Bodies Generating Collsion Impulses"