Sign up ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.


I have tried all kinds of variations now. The last one was to adjust the linear velocity in each step: newVel = oldVel * 0.9f - all of this including your proposals kind of work, however in the end if the velocity is little enough, the puck sticks to the wall and slides either vertically or horizontally. I can't get rid of this behavior. I want it to bounce, no matter how slow it is. Retitution is 1 for all objects, Friction is 0 for all. There is no gravity. What am I possibly doing wrong?

In my battle to learn and understand Farseer I'm trying to setup a simple Air Hockey like table with a puck on it. The table's border body is made up from:

    Vertices aBorders = new Vertices( 4 );
    aBorders.Add( new Vector2( -fHalfWidth, fHalfHeight ) );
    aBorders.Add( new Vector2( fHalfWidth, fHalfHeight ) );
    aBorders.Add( new Vector2( fHalfWidth, -fHalfHeight ) );
    aBorders.Add( new Vector2( -fHalfWidth, -fHalfHeight ) );

    FixtureFactory.AttachLoopShape( aBorders, this );
    this.CollisionCategories = Category.All;
this.CollidesWith = Category.All;
this.Position = Vector2.Zero;
this.Restitution = 1f;
this.Friction = 0f;

The puck body is defined with:

FixtureFactory.AttachCircle( DIAMETER_PHYSIC_UNITS / 2f, 0.5f, this );
this.Restitution = 0.1f;
this.Friction = 0.5f;
this.BodyType = FarseerPhysics.Dynamics.BodyType.Dynamic;
this.LinearDamping = 0.5f;
this.Mass = 0.2f;

I'm applying a linear force to the puck:

this.oPuck.ApplyLinearImpulse( new Vector2( 1f, 1f ) );

The problem is that the puck and the walls appear to be sticky. This means that the puck's velocity drops to zero to quickly below a certain velocity. The puck gets reflected by the walls a couple of times and then just sticks to the left wall and continues sliding downwards the left wall. This looks very unrealistic.

What I'm really looking for is that a puck-wall-collision does slow down the puck only a tiny little bit. After tweaking all values left and right I was wondering if I'm doing something wrong. Maybe some expert can comment on the parameters?

share|improve this question
You probably have, but have you tried lowering the friction of the puck? –  brandon Feb 13 '12 at 22:49
I have. It does not affect it at all. Same result. –  Krumelur Feb 13 '12 at 23:04
Try lowering your LinearDamping to a lower value. Probably below 1/10. –  ClassicThunder Feb 13 '12 at 23:26
When you create your World do you set any gravity? –  Benixo Feb 13 '12 at 23:57
I have no gravity and that's why I think setting the friction has no effect at all. –  Krumelur Feb 14 '12 at 8:55

3 Answers 3

up vote 1 down vote accepted

The solution was finally found in the Box2D forum. The negine has a velocity threshold. If velocity drops below that it is set to 0. The default value is 1.0. I changed it to 0.1 and voilà it behaves correct, even when using linear damping.

The constant is defined in FarseerPhysics.Settings.VelocityThreshold

share|improve this answer

You need to raise your restitution value, to stop the puck from sticking. The restitution value determines the "bounciness" of your puck when it hits the wall.

A Restitution value of 1 meaning a perfect elastic collision.

Whereas, a value of 0 would mean a perfect in-elastic collision (Doesn't bounce at all).


share|improve this answer
When 2 items collide Box.2d uses the max restitution of either object so it this case the restitution value used is 1.0f. So this is not the solution. See –  ClassicThunder Feb 14 '12 at 0:03
The wall is 1f the puck is 0.1f. If they collide Box.2d will use the maximum of the two (1f). –  ClassicThunder Feb 14 '12 at 0:07
Damping is friction that occurs only on contact. It prevents objects from wanting to separate his is too high causing the objects to appear to be stick. –  ClassicThunder Feb 14 '12 at 0:08
@ClassicThunder: at least Farseer does not seem to use the max. If I adjust my puck's restitution it has an effect, although the restitutiuon of the border remains 1. –  Krumelur Feb 14 '12 at 9:03

The Farseer Physics Engine is an extension of Box.2D and as such you can use the extensive documentation available for Box.2D most usefull of which is the manual.

Damping is used to reduce the world velocity of bodies. Damping is different than friction because friction only occurs with contact. Damping is not a replacement for friction and the two effects should be used together.

Personally I keep my damping pretty high as I'm simulating characters via hit boxes and I don't want my people to bounce. However, in you case I believe the dampening setting is high enough to cause the issue you describe.

Try setting the damping to something along the suggest lines of around a tenth.

Damping parameters should be between 0 and infinity, with 0 meaning no damping, and infinity meaning full damping. Normally you will use a damping value between 0 and 0.1. I generally do not use linear damping because it makes bodies look floaty.

share|improve this answer

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.