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

Help With Spring Factory Problem

Topics: Developer Forum, User Forum
Jun 28, 2011 at 2:16 AM
Edited Jun 28, 2011 at 5:42 AM

Hello, I am new to Farseer and Box2D. I am currently creating a simple object balancing game to get to know the farseer universe a little better. Most everything is going well, however I have run across one issue.

The manual for version  2.1 mentions a springfactory which sounds exactly like what I need.  However, I can't find any trace of it in the new version. 

How can I make a fixed linear spring using version 3.x?

Any help is greatly appreciated. For those who need more information, I have created a long rectangle body and attached it to a square body with a revolute joint to make a crude seesaw. I am then dropping squares of differing density onto the beam with the goal of making things balance. Of course a revolute joint is way too sensitive for this and balancing is impossible, so I am looking to add springs to give the beam a propensity to return to center more easily. If I am way off base, I am open to ideas on doing that better as well.  :-)


Jun 28, 2011 at 9:03 AM

Yeah, the springs have changed in version 3.x, because it's done differently in Box2D (the underlying engine). For more reliable documentation, see Box2D documentation:

Springs are now in fact joints, DistanceJoints. You can set the frequency (stiffness) and damping on them to get the desired effect.

I'm not quite sure what you're trying to do, but there's also a smoothing mechanic in the RevoluteJoint; use the motor.

Jul 2, 2011 at 3:31 AM
Edited Jul 2, 2011 at 3:37 AM

Thanks for the tip.

I am using the distance joint now.  How do I use a motor on a revolute joint?

Thanks for your help,