Pymunk servo joint

前端 未结 1 394
春和景丽
春和景丽 2021-01-21 05:17

How do you implement a \"servo\" joint in Pymunk?

I\'m trying to create a simple model where a box is balanced on a single thin \"leg\" below it. I\'ve been able create

1条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-21 05:58

    A couple of things that can cause problems:

    1. Ignore collisions between the two shapes. Since the motor and pin joint force them together, but collision resolution pushes them apart strange things might happen. You can do this by setting the two shapes to the same group: shape_filter = pymunk.ShapeFilter(group=1) shape1.filter = shape_filter shape2.filter = shape_filter

    2. The center of gravity for the two shapes are at their ends, not in the center. Try to move it to center ([(-50, -1), (50, -1), (50, 1), (-50, 1)]).

    (In this case I think 1 is enough to fix the problem, but I added 2 in case you notice other strange things)

    0 讨论(0)
提交回复
热议问题