Bridges Revisited

Official forum for the Chipmunk2D Physics Library.
Post Reply
RitterGT
Posts: 3
Joined: Mon Jul 27, 2009 3:51 pm
Contact:

Bridges Revisited

Post by RitterGT »

Hi everyone. Just started using Chipmunk about a week ago and I'm extremely impressed. Got a situation though that could use a bit of a walkthrough however - been stepping it constantly with the debugger, but I think I need something a bit higher level.

I'm currently playing around with the constraints in order to make a bridge-like environment. To do so I have played with using pin and pivot joints as well as slide joints with a small max length to add some give. I've also used your breakablejoint wrapper for each one so that if I roll a heavy ball across it, the bridge snaps. Things look good, but I get confused when the breakablejoint calls the getImpulse function. In the pivot and pin joint, the number returned (cpvLength(jAcc)) is constantly growing. Basically if I create a joint between two segments which are anchored by static body joints, eventually (I believe the growth of jAcc is linear) the center joint (the one between the segments) will snap no matter how high I put the maxForce.

I understand that the physics aren't necessarily perfect and that rounding errors have to occur - is there a work around to make this more accurate? It appears that increasing the number of steps actually increases the growth rate as well, and I don't see much of a difference when altering the bias_coef of constraints.

EDIT::
Figured I'd add in an image just in case this doesn't quite make sense:
Picture 4.png

In this case, the center joint between the two is a Pivot Joint which is breakable with the max force set to extremely high and the joints on either side are pivot joints that are not breakable. Gravity is (0,-400) and the segment masses are 1.0f


Any advice?

Thanks,
-Ritter

P.S - if anything I said didn't make sense, let me know and I'll try to clarify!
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: Bridges Revisited

Post by slembcke »

It looks like your bridge is basically flat. Think about it in real world terms of stretching a cable between two poles. The tighter you make the cable, the straighter it gets. To make it completely straight would require an infinite amount of force and an unbreakable cable. That's probably what's happening here as well. My best guess is that the bridge is vibrating up and down and the impulses are getting bigger and bigger because it's trying to stop the vibration, but overcompensating instead. Try letting your bridge hang down a bit more.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Post Reply

Who is online

Users browsing this forum: No registered users and 15 guests