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 want to use Box2D.XNA or Farseer for collision detection in my 2D game, but I don't know how to start. I added Box2D.XNA to my solution, but I don't know how to create rectangles, circles or whatever. The same with Farseer, I don't know how to use it because it's so difficult to find a good beginner tutorial. Does somebody know how to make rectangles or circles with one of the two physics engines? I just want to make some collisions between rectangles and circles.

share|improve this question

closed as not a real question by ClassicThunder, Nate, Byte56, Sean Middleditch, Josh Petrie May 8 '13 at 2:59

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

There are tons of online tutorials for both libraries. If you need help getting started Google around for a tutorial. If you need help with a specific problem that is when you should ask here. – ClassicThunder May 7 '13 at 21:20
Usually tutorials are good places to start. If you are having trouble with the tutorials then maybe you should try a different engine, or need some other tutorials before getting into engine usage. – UnderscoreZero May 7 '13 at 21:20
up vote 0 down vote accepted

There are plenty of tutorials for both libraries. For Farseer, I recommend to check out the "Getting started" section of their document, which also links to a Box2D manual for further reading:

You can then take a look at the Farseer Examples and try to understand how they work. The Basic examples are pretty straightforward. If you still have problems trying to figure it out, you might want to follow a tutorial like this.

Probably the most important thing to note is, that you can't create Rectangle of the size 100x100 Pixel in Farseer. Instead, you'd create a Rectangle that is 100x100 meters. This is why you'll find a class like "CoordinateHelper" or "ConvertUnits" in the above tutorials, which you'll use to convert meter to Pixels.

If you notice, that your collisions are really weird (not fitting the real Image), you will have to turn on DebugView, so you can actually see the collison boxes.

share|improve this answer

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