# Distance Constraint

This topic is 2571 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi,

I am currently trying to understand the theory behind soft distance constraints as discussed in the 2010 GDC presentation of the Box2D creator (can be found here http://www.box2d.org/) since they seem to be a great way to model rather stiff springs that are always stable. Anyways my main problem is that until now the only types of constraints I used are ordinary springs. How exactly is a distance/rigid constraint expressed in the first place? I am not sure why, but google didn't really help me on that subject, so maybe I am just looking for the wrong terms. Basically how can I connect two points A and B with a distance/rigid constraint ? Any links, short code snippets would be great!

Thanks

##### Share on other sites
I've found Jacobson's article to be a great starting point for setting up simple physics things. The article explains how to get a servicable particle physics system going (which can be used to simulate more than you might think) and it shows how to create so called stick constrains (basically fixed distance constraints) between two points. I'm not sure if it'll work with the Box2D stuff, but it might prove an interesting read. The basic idea is that given enough iterations in which you set points A and B at a fixed distance (this is what Jacobson calls relaxation), the points will end up at acceptable locations.

##### Share on other sites

Hi,

I am currently trying to understand the theory behind soft distance constraints as discussed in the 2010 GDC presentation of the Box2D creator (can be found here http://www.box2d.org/) since they seem to be a great way to model rather stiff springs that are always stable. Anyways my main problem is that until now the only types of constraints I used are ordinary springs. How exactly is a distance/rigid constraint expressed in the first place? I am not sure why, but google didn't really help me on that subject, so maybe I am just looking for the wrong terms. Basically how can I connect two points A and B with a distance/rigid constraint ? Any links, short code snippets would be great!

Thanks

I discuss the implementation of a distance constraint in my blog post:

http://www.wildbunny.co.uk/blog/2011/04/06/physics-engines-for-dummies/

Hope that helps!

Cheers, Paul.

##### Share on other sites
thanks, those seem to be good starting points!

• 11
• 20
• 12
• 10
• 34
• ### Forum Statistics

• Total Topics
631399
• Total Posts
2999854
×