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

Simulation is very slow, adding forces/linear velocity has little impact

Dec 13, 2010 at 9:52 PM
Edited Dec 14, 2010 at 1:34 AM

I've set gravity to be 0, -9.8 and update like this:

world.Step(Math.Min((float)gameTime.ElapsedGameTime.TotalMilliseconds * 0.001f,
                                        (1f / 30f)));

However I'm finding the simulation to be running very, very slowly. I create a box and let it fall and it takes a very long time to do so. The only way I could figure to increase the speed was to increase the step, however that reduced the accuracy of the solver, so instead what I did was loop 5 times on every update and step 1/30 each time, but surely there is a better way and one that makes sense?


My other problem is when I apply forces or set a linear velocity, no matter how great, has very little impact. For example I'm adding a force of 0, 99999999999 on a box with mass 10 and it's barely jumping up a few units... I did notice if I reduce the size of the bodies the forces work more effectively, but is there a simpler solution which does not require me to change the size of everything I create? Right now I create a box that is 100x100, but if I make the box 1x1 it works better with the forces. If it's 100x100 even if I apply a force of 99999999999 it doesn't move much.

Dec 15, 2010 at 6:14 AM

The Box2d that farseer is based off of is optimized for objects from .1 to 10 in size. This is most likely your issue.

Dec 19, 2010 at 9:55 PM

This really needs to be talked about in the manual here:

Dec 19, 2010 at 10:07 PM
Edited Dec 19, 2010 at 10:07 PM

I agree.

Dec 19, 2010 at 11:28 PM

If you give me rights to edit it, I'll go ahead and work on the docs for you.

Dec 20, 2010 at 12:22 AM

The documentation is a little fragile at the moment (there are some weird bugs in that specific part of Codeplex) - however, since they support versioning, I'm not too worried. I will add you as an Editor.