This project has moved and is read-only. For the latest updates, please go here.

Controlling Joints

Topics: Developer Forum, User Forum
Dec 16, 2010 at 7:24 PM

I'm attempting to make a snake for my XNA game. The snake consists of a head and a tail made up of many fixtures connected with joints. I've been using distance joints, but I've tried almost all of the different types at this point to get the effect I'm looking for.

The issue I keep running into is that when there is too much force applied to the head, the joints connecting the tail fail and freak out. Is there a simple way to control the strength of the joints? Is there a better type of joint than distance to hold 2 objects firmly together against all forces?

Dec 17, 2010 at 2:43 PM

Have you tried to play with the mass of the bodies? Also how much is "much force applied"? Are your bodies/fixtures scaled to mks units within the range of 1? (see 1.7 Units).

Dec 17, 2010 at 7:05 PM

They are not currently scaled to within a range of 1, in fact, I'm using rather high numbers. I'll try scaling them down, but here is the part that causes issues. The bodies on each end of the tail (the head and the tail end piece) need to be much heavier than the tail itself. What this means is that when the head is moved, it creates a lot of strain on the joints connecting the tail because the head and the end of the tail are so much heavier then the rest of it.

I was wondering if there was a setting of any sort that would make the joints hold the two connecting objects together more firmly. I could just add more joints at each section I need connected, but this approach seems very sloppy and I'd prefer to avoid it.

Dec 17, 2010 at 10:24 PM

There is a rope sample in the testbed which adds a distance joint between the two ends. You should have a look at that and maybe try to add an additional (max)distance joint that connects your head and tail. Attaching heavy objects to a chain of light ones can cause strange behaviour and you can't do too much about that other than somehow limit the stress on the small links with tricks like the one above.