Changes in Spring behavior in 1.0.0.5

Mar 21, 2008 at 4:24 PM

Hi - I just updated my project from Farseer 1.0.0.3 to 1.0.0.5. 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....

Andy.
Coordinator
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: http://www.codeplex.com/FarseerPhysics/WorkItem/View.aspx?WorkItemId=13562
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 1.0.0.3 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 1.0.0.3 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 1.0.0.3 and 1.0.0.5 (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 1.0.0.3 (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)
http://www.youtube.com/watch?v=bEUP_FiO-AU

In the 1.0.0.5, 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:
http://www.youtube.com/watch?v=3BgPyCII9Og

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!

Andy.
Coordinator
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: https://www.codeplex.com/Thread/View.aspx?ProjectName=FarseerPhysics&ThreadId=21087

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 1.0.0.5, it's just commented out. Maybe if you get time you could modify the 1.0.0.5 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.

-Jeff
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.

Andy.
Coordinator
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.