2D Motocross Simulator

Sep 27, 2008 at 12:38 AM
Edited Sep 27, 2008 at 3:53 AM
I am making a 2D motocross simulator and I have run into a problem...I cannot figure out what kind of joint/spring combination to use for the suspension. Right now I am just working on the rear suspension. I used a revolute joint to attach the swingarm to the frame and then put a linear spring connecting from the swingarm to the frame. This seems to work slightly but the problem is that if the spring gets compressed too far it sticks. The other problem is that there is no limit on how far the spring can decompress so the swingarm ends up going around the wrong way. Hopefully this makes sense. Thanks in advance for the help.

This is what it should look like:

This is what it looks like if the spring compresses too far:

and it gets stuck like that until it gets jarred just right to decompress.

I tried to use an AngleLimitJoint along with the RevoluteJoint to try to limit the angle the swingarm could travel but it didn't seem to be working right. Even when I set the min and max angles to 0, the softness to 0, and the slop to 0 it still acted more like a shock than a limit.
Sep 27, 2008 at 7:24 PM
I am writing a tank simulator and I feel your pain. What I did to prevent my road-wheels from flipping up into the tank was to make the spring a lot longer then it needed to be. I found out that a springs ends do not have to be inside the Geom or Body. Try placing your spring at the end of the swing arm and the other end where the seat ends.  Also I think you should try only the AngleLimitJoint for the swing arm.
Oct 1, 2008 at 2:16 PM
Any other ideas? I dont want to use an AngleLimitJoint because i want to be able to adjust the dampening. There has to be a better way to achieve this...or at least there should be.
Oct 1, 2008 at 4:27 PM
Use a LinearSpring just like a regular shock but make it longer. Then scale the RestLength a little bit until you get what your looking for. Only use the AngleLimitJoint if your swingarm is still sticking up. Oh and be sure to disable collision between your frame, swingarm, and wheel. Farseer may not be stiff enough for what your trying to do. You can try increasing the Interations of the PhysicsSimulator or increasing the Bias on different joints until you get the desired effect. Feel free to post your code your send it to me.