2
\$\begingroup\$

I am using the Farseer Physics engine in my MonoGame project. I have static walls which have "body" friction 0 and "body" restitution 1. I have dynamic objects, which are circles, with "body" friction 0 and "body" restitution 1. There is no gravity.

When I launch a dynamic object at a wall, it does not bounce in the way I would expect for a perfectly elastic, frictionless collision. The angle it bounces at should be the reflection (through the wall's normal vector) of the angle it arrives at.

Instead, the dynamic objects often slide along the wall:

In the diagram, the black line is the wall; the blue line is the desired path of the dynamic object; and the orange line is the current path of the dynamic object.

How can I make my dynamic objects bounce properly?

\$\endgroup\$
1
  • \$\begingroup\$ I haven't used that engine before. But have you tried setting the drag or dampening to 0 on both bodies \$\endgroup\$ – Daniel Holst Jul 6 '15 at 10:15
2
\$\begingroup\$

It turns out that Farseer objects can have multiple restitution and friction settings: one set for the body and one set for each fixture.

I was only setting the body settings; adding settings for the fixtures solved the problem:

fixture.Restitution = 1f;
fixture.Friction = 0f;
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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