Changes in Spring behavior in

Mar 21, 2008 at 4:24 PM

Hi - I just updated my project from Farseer to After doing so, I've noticed two main behavior differences (in my app) :

1. Objects connected by "ropes" (implemented as linear springs with small body masses) are behaving radically different than before.
2. Objects having both a fixed angle spring and fixed angle limit joint are behaving differently... it seems like there is an initial full rotation at start up that I wasn't getting before.

The first issue, I tracked down to the removal of the code dealing with linearDragVelocityThreshhold. The second issue, I'm not sure about yet.

Anyway, I wasn't sure if these behavior differences were expected, but thought I would just point them out in case they were not....

Mar 21, 2008 at 4:37 PM
For 1. is linearDragVelocityThreshold something you need? I think I removed it because I thought it wan't necassary.

For 2. Could it be related to the fix I did for this issue:
Mar 21, 2008 at 4:49 PM
Edited Mar 21, 2008 at 4:54 PM
I don't think I need the linearDragVelocityThreshold. I probably just need to readjust my spring constants, dampening, and mass values to get the behavior I had before.

With regard to 2, the work item sounds related... in the mean time, I was able to fix the issue by reverting back to th Farseer code dealing with Rotation, as in:

        public float Rotation {
            get { return rotation; }
            set {
                rotation = value;                
                if (rotation > Calculator.TwoPi) {
                    rotation = rotation % Calculator.TwoPi;
                    revolutions +=1;
                if (rotation < -Calculator.TwoPi) {
                    rotation = rotation % Calculator.TwoPi;
                    revolutions -= 1;                    
                totalRotation = rotation + revolutions * Calculator.TwoPi;

Thanks for the fast reply
Mar 22, 2008 at 4:32 AM
Edited Mar 22, 2008 at 4:36 AM
So I took a stab at adjusting the spring constants and damping parameters and also the body mass values of the rope... I just could not replicate the behavior at all, so maybe I do need the linearDragVelocityThreshold... (of course, that is the beauty of having source code).

In any case, if you have any ideas - I've posted a test case of a test app running in and (no changes) to illustrate the difference in behavior I'm seeing... and also to illustrate the behavior I'm trying to replicate w/o the linearDragVelocityThreshold:

The behavior in (which I would like to replicate):
(Basically, I have sort of a space-chariot here... I'm controlling the 4 smaller spheres with the two thumbsticks of the 360 controller)

In the, this is the behavior I'm seeing with the same parameters - I haven't had any luck with stability by modifying the stiffness, damping, mass parameters:

If you don't have any ideas, its no problem. And I can work around it. Also, I want to say thanks again for this very cool engine!

Mar 22, 2008 at 5:47 PM
Hi Andy,

I don't think this is an issue with the VelocityThreshold. More likely, it was caused by the changes I made to "ApplyDrag()"

See this post for details of those changes:

For performance concerns I chose not to implement the quadraticDrag as mentioned in the post. Possibly that is causing the issue. Most the code is still in, it's just commented out. Maybe if you get time you could modify the ApplyDrag() method to reflect the code in the post above and see if that fixes things.

I can't really test that here because I don't have scenario where my drag is misbehaving.

Mar 23, 2008 at 1:00 AM
Hey Jeff - you are right. I was able to get the behavior I had before (and even tweak it a little more to my liking) by adjusting the quadraticDragCoefficient. Thanks again for the help.

Mar 24, 2008 at 12:40 AM
Edited Mar 24, 2008 at 12:57 AM
Ok, good. I'll re-enable that for the next release.

I'll make Quadratic drag an option that is turned off by default for performance reasons.