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

Video of some wacky physics problems

Topics: Developer Forum, User Forum
Jul 13, 2010 at 10:09 AM
Edited Jul 13, 2010 at 10:10 AM

Hey guys not been on in a while.  Only just had enough time to carry on developing my game.  I've noticed a few strange things happen but they would be tough to describe so i filmed em for you to look at.  The boxes detonating into loads of pieces is definately a bug in my code, but the engine appears to have a few strange hitches too, mainly....


- Occasionaly you can see the boxes appear as though they are made of rubber, bouncing around way too much.

- The boxes sometimes in a split second fall through the floor then get forced out quickly

- The engine appears to detach itself and no collisions occur for a while, before randomly it starts working normally again.

- Sometimes the boxes wont settle on the floor, they just rotate and bounce around.


Any light you can shed on this would be greatly appreciated.



video is online here

Jul 13, 2010 at 12:15 PM
Edited Jul 13, 2010 at 12:17 PM

Farseer 2.1 or Farseer 3.0?

Are you using a fixed timestep or variable? (I think that a variable timestep could carry problems)

Jul 13, 2010 at 2:14 PM

Its whatever version is @

I believe it's 2.x not 3.


I'm not sure I quite understand what you are asking me there :(  Is that a setting on the PhysicsSimulator?


Jul 13, 2010 at 2:56 PM
Is a setting from your Game class: IsFixedTimeStep = true;
Jul 13, 2010 at 3:19 PM

KK I'll check when I'm back from work. Thx


Jul 13, 2010 at 6:35 PM
Edited Jul 13, 2010 at 6:36 PM
//set framerate to be fix at 100fps IsFixedTimeStep = true; TargetElapsedTime = new TimeSpan(0, 0, 0, 0, 10); //10ms => 100fps Looks like "fixed" is the answer. Any further insight into my problems? Kind rgds
Jul 14, 2010 at 6:19 AM

First off, nice work.  Looks very good.  

Now, regarding your problem: You are obviously using FP2.x from what I can see there in that video.  That is a classic problem that 2.x has with stacking objects (they are constantly colliding, and have a hard time stacking).  FP3 fixes this by implementing resting bodies, which go to sleep after a time (that's a simple way of explaining what it does... there is more to it than that).  You would be much better off moving your code from FP 2.x to 3 for a stacking game.  It will take some work, however, since there are many "breaking changes" with the new way of doing things.  That being said, however, it only took me one or two nights to transition my code to the new, and I am MUCH happier with the way things are reacting.

Let us know if need help in transition the code. 

Jul 14, 2010 at 9:35 AM

Thanks!  Thats only a few sittings worth of work, I'll have something much more substantial soon.  I'll upload more videos as it progresses for sure.

I love how helpful everyone is on this forum, I wish the rest of the internet was like this.


I played around alittle with it lastnight.  I noticed the demo has a stacking option so I had a dig around in that code.  It seems like gravity on that demo is set to a vector of (0,-40) which makes everything act like you are on the surface of the Moon.  When I increase the gravity to something that looks more realistic (0,-300) the boxes have a tendancy to fire off at high speed when they get trapped or glitch or whatever it is they are doing.  I also had a bug in my code meaning that the boxes were able to break into small parts even after they had already done so because they were still attached to the physics simulator.  I fixed that bug and most of my problems have gone away except. . . . performance issues.  But it looks like you have told me what i need to do to get past this.  With farseer 2.x 60 stacked boxes with a good amount of gravity is plenty enough to drop the fps to about 10 :(


Thanks for the advice.  I'll get on it when i get the chance.

Jul 18, 2010 at 3:31 PM
Oh god! I have run into problems already. I started it up in a seperate thread here: Thx