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

Problem with RevoluteJoints and restitution

Topics: Developer Forum, User Forum
Apr 8, 2008 at 1:13 PM
Hi, Im working on a project using Farseer, but I have two small problems:

Firstly, I'm trying to make up a chain with revolute joints with a weight at the end and attaching it to the player. I modified a Farseer Demo before to try this out and it worked fine. Now that I tried to add it to my game (basically copy/paste) the revolute joints started acting weird. What happens is that the joints become slack and kinda like a spring, except the chains start rotating whenever the joints become drawn out. I have tried to find any kind of difference between the demo code and mine, but cant find any.

PhysicsSimulator initialization:
physicsSimulator = new PhysicsSimulator(new Vector2(0, -1500));
physicsSimulator.MaxContactsToDetect = 2;
physicsSimulator.FrictionType = FrictionType.Minimum;

physicsSimulator.Update(gameTime.ElapsedGameTime.Milliseconds * .001f);

RevoluteJoint creation:
for (int k = 1; k < revoluteJoints.Length - 1; k++)
revoluteJointsk = new RevoluteJoint(chainsk.Body, chainsk - 1.Body,
(chainsk.Body.Position + chainsk - 1.Body.Position) / 2);
revoluteJointsk.Softness = linkSoftness; // 0.0f

The values for the Bodies and Geoms are exactly the same in the modified demo and my game. The player weighs 7, a chain 0.3, the weight at the end weighs 5. Gravity is the same.
Can anyone give some suggestion of what could be different/wrong? I just cant see it, so I'll take any help I can get.

Second problem:
When I have two Geoms with 0.0f restitution colliding, they still bounce off each other from time to time. Any idea why? Can I do anything about it?
Apr 10, 2008 at 7:47 PM
My first problem was due to the update rate of the game and the update rate of the physics simulator was different. I also discovered that 60 fps is not enough to simulate several connected revolute joints.

My second problem with the restitution has not been solved though.
Apr 20, 2008 at 3:48 PM
The problem with the revolute joints can be fixed in a better way than bigger update rate; you can just increase the MomentOfInertia to get rid of the stretching of the joints. Dont understand why though.