Lots of questions about joints...
Posted: Thu Jan 26, 2012 10:36 pm
I don't want to appear to forthright in my first post here, but I'm having lots of trouble getting some of the joints to work. I tried searching first but couldn't find anything that looked like it was related.
I'm using Python 2.7.2+ on Linux Mint 12 with Pymunk 2.1.0
Mainly I'm having trouble with Springs and Pivot joints. Here's some code I wrote:
The two balls jitter around for a few milliseconds, flip positions, and explode apart. I tried modifying the rest length, stiffness, and damping, but it just made it worse. I can move them around, and the small ball wiggles a little bit but doesn't move closer like it should. When the large ball gets really far away (like +400 or so) it starts shooting into the air and falling back down again repeatedly. If I change the small ball's mass to 20 they don't explode but still don't act like they are attached.
On Pivot joints, it just acts... weird. I switched joint=pymunk.DampedSpring with joint=pymunk.PivotJoint (removing the extraneous numbers, of course), and it basically does the same thing as the Damped Spring. BUT if I specify a pivot point like pymunk.Vec2d(200,200) instead of two anchors, it sort of behaves/
Can someone show me what I'm doing wrong?
-hidas
I'm using Python 2.7.2+ on Linux Mint 12 with Pymunk 2.1.0
Mainly I'm having trouble with Springs and Pivot joints. Here's some code I wrote:
Code: Select all
BALL = createBall(150, 150, mass=30, radius=50)
BALL2 = createBall(250, 250, mass=5, radius=10)
joint = pymunk.DampedSpring(BALL.body, BALL2.body, BALL.body.position, BALL2.body.position, 70, 50, 50)
space.add(joint)
On Pivot joints, it just acts... weird. I switched joint=pymunk.DampedSpring with joint=pymunk.PivotJoint (removing the extraneous numbers, of course), and it basically does the same thing as the Damped Spring. BUT if I specify a pivot point like pymunk.Vec2d(200,200) instead of two anchors, it sort of behaves/
Can someone show me what I'm doing wrong?
-hidas