Reputation: 217
I'm using pymunk to apply forces to a circular body at the ends of its diameter. The forces are of different magnitudes, and neither has an x-component (relative to the body, that is, so they are perpendicular to the diameter). I would expect these forces together to rotate the body to some degree, but instead they just add together to create a force vector with no x-component and a y-component (so, again, perpendicular to the diameter) that is just a combination of the magnitudes of both forces.
Is pymunk just unable to calculate the resultant rotation from multiple forces applied at separate points on a body? Since that is the only reason I'm even using a physics engine at all, I would be extremely disappointed if that were the case. I would appreciate any help with this problem. Thank you in advance.
Upvotes: 3
Views: 1754
Reputation: 4603
pymunk should be able to calculate the rotation unless I misunderstand the question. Check this example:
>>> b = Body(1,100)
>>> c = Circle(b,10)
>>> s.add(b,c)
>>> b.apply_impulse((100,0), (0,10))
>>> b.apply_impulse((-50,0), (0,-10))
>>> s.step(.1)
>>> b.angle
-1.5
>>> b.position
Vec2d(5.0, 0.0)
>>> s.step(.1)
>>> b.angle
-3.0
>>> b.position
Vec2d(10.0, 0.0)
Upvotes: 1