# Distance Constraint

## Recommended Posts

mokaschitta    124
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
remigius    1172
I've found [url="http://www.gamasutra.com/resource_guide/20030121/jacobson_01.shtml"]Jacobson's article[/url] 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
wildbunny    550
[quote name='mokaschitta' timestamp='1307460563' post='4820548']
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 [url="http://www.box2d.org/"]http://www.box2d.org/[/url]) 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
[/quote]

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

[url="http://www.wildbunny.co.uk/blog/2011/04/06/physics-engines-for-dummies/"]http://www.wildbunny.co.uk/blog/2011/04/06/physics-engines-for-dummies/[/url]

Hope that helps!

Cheers, Paul.

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

## Create an account or sign in to comment

You need to be a member in order to leave a comment

## Create an account

Sign up for a new account in our community. It's easy!

Register a new account