13.02.2012

Farseer engine “bug”

posted by Karsten

I’m working on a game project for the Microsoft Phone / xbox. I decided to try out the box2d library for this one, and found the Farseer engine, which is a well supported library with many developers using it.

Things have been working well, but over the week-end I ran into a strange behaviour. Shapes (called body(ies) in the box2d world) got stuck to static shapes. So if a ball slowly approach a static wall it would be stuck to the wall, and it wouldn’t get away again (at least not by bouncing other balls into it). The ball would only move along the static wall.

Now this isn’t really expected behaviour in an environment simulating physics in the normal world! I have searched high and low to find a solution to this, and in the end my curious mind got into the Settings class, and I found the VelocityThreshold, which was set to 0.3f. This is indeed the culprit, as it treat any velocity below this threshold as inelastic. When set to 0.0f (zero point zero) the world starts to behave normally. This might be ok in a senario with non-static bodies, but in an world with static walls, not so great…

That was then that Sunday afternoon… ;-)

Share

2 Responses to “Farseer engine “bug””

  1. Euqil says:

    Solving the same problem 2 weeks later than you :) thank you for solution

Place your comment

Please fill your data and comment below.
Name
Email
Website
Your comment