Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've ported my engine to iOS and have been using the C++ version of Box2D. Everything runs fine except on collisions, it seems Box2D and Farseer handle collisions somewhat differently.

Anyone know what these differences are exactly and if I can disable the difference and make them mimic one another?

Initial behaviours tend to be fine, for example falling speeds and the first moment of impact both cases exhibit the exact same behaviour, velocities etc.

Just after the first impact is resolved however the second impact (which occurs as a result of bodies being bumped around) is different. box2d records a higher velocity on a second collision than the first and shows less 'bounce back' from the collision.

Velocity, position iterations are the same, as are the bodies masses, densities etc. Pretty sure everything in Farseer.Settings matches up with Box2Ds settings.

share|improve this question
How big is the difference between the two? Could it be a floating point rounding error? Maybe have a look at floating point determinism... – Felheart Aug 21 '11 at 3:29
My first suspicion was that, but tbh the differences are fairly large to be put down to rounding errors... – zombinee Aug 21 '11 at 7:09
I'd not rule rounding errors out because of that. Even small errors can accumulate to huge values if given enough time / enough calculations. See the butterfly effect. – Felheart Aug 21 '11 at 23:07
There isn't enough time given, the values match up perfectly but after the first contact they end up differing by large values. – zombinee Aug 21 '11 at 23:45
Both librarys are open source. Single step trough both of them. – Felheart Aug 21 '11 at 23:56

You cannot really expect two different physics engines to get binary identical results. They all do their computations differently, and thus they will come up with different results.

share|improve this answer
Farseer is a Box2D port ;) – zombinee Aug 21 '11 at 7:09
@meds: Apparently, Farseer is based on Box2D.XNA, which itself is based on Box2D. So that's two degrees of separation between them. It's not entirely clear whether Box2D.XNA is a rewrite of Box2D in C#, or is simply a CLI interface to the Box2D library. If it's actually a real port, rather than just an interface wrapper, then there is no reason to expect identical behavior. And with physics systems, it doesn't take much difference to cause a visible effect. Even changing the order of operations in the integrator can have real problems. – Nicol Bolas Aug 21 '11 at 7:47
From what I've seen of Farseer it mostly keeps to Box2Ds way of doing things, handling collisions and all that. Really all it does is add some extra functionality to Box2D but doesn't modify Box2Ds behavior as far as i'm aware. – zombinee Aug 21 '11 at 8:01

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.