This project has moved. For the latest updates, please go here.

Farseer for just collision, not physics?

Topics: Project Management Forum
Apr 26, 2009 at 8:02 PM
  I'm new to Farseer, but have heard great things about it. I am starting work on an XBox game (using XNA) and have decided that the game engine will use Farseer to handle the physics. However, is it also efficient to use just for collision detection? I guess this would mean making every object a Farseer object, but would this be a problem if not all objects are related to the physics side of the game? It would save a lot of time if there's no reason it shouldn't be used just for collision.
Apr 26, 2009 at 9:40 PM
You can indeed use Farseer Physics as a collision engine only. It is just not fun to have collision detection without any reaction when two objects collide. :)

To answer your questions: Yes, every object needs to be a Farseer object. The objects that is involved in all the collision detection is the geom (short for geometry). To make 2 geometries collide, you just have to create them and add them to the physics simulator object.
To disable the physics, you can set CollisionResponseEnabled to true on the geom object. This way, the collision response when two geometries collide will be disabled. You can also set the gravity to 0, this will make Farseer stop applying gravity.

There is still stuff like linear and angular drag, but they are only used if you apply force or torque to the geometries. You just position the geometries by using the Position property. It has no side effects doing it this way, if the physics is disabled.
Apr 27, 2009 at 4:21 PM
Thanks for the help genbox. I was thinking that I might as well use Farseer objects as tiles on the map, so that players simply walk on them and physics-affected object hits the same floor but will respond realistically.