Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I just want to be able to see all my bodies on the screen for debugging purposes and i cant think of an easy way, for example i have make some edge fixtures with curved arcs attached and i just want to see what they look like!

share|improve this question
add comment

2 Answers 2

up vote 3 down vote accepted

Farseer does ship a physics view, and thankfully it requires very little brain power to implement and use.

If you downloaded the "Farseer Physics Engine 3.3.1 Samples XNA" recommended package on their download page, you'd see a lot of examples included.

Navigate to (or click these convenient links to the codeplex page :P) SamplesXNA/SamplesXNA/ScreenSystem/PhysicsGameScreen.cs to see example usage of FarseerPhysics.DebugViews.DebugViewXNA.

It boils down to this:

FarseerPhysics.Dynamic.World myWorld;
// initialize myWorld...
var myDebugView = new FarseerPhysics.DebugViews.DebugViewXNA(myWorld);

And then you can set flags on it to determine what's visible:

myDebugView.RemoveFlags(DebugViewFlags.Shape);
myDebugView.RemoveFlags(DebugViewFlags.Joint);
myDebugView.DefaultShapeColor = Color.White;
myDebugView.SleepingShapeColor = Color.LightGray;
share|improve this answer
add comment

Farseer comes with a debugging environment. There's two ways of doing what you want to do. The first way is reproducing your situation in the test environment they ship. It will show everything of relevance. This is the technique I used for my game.

The other way is to integrate the debugging environment they made into your game, this is slightly more complex, and I haven't tried it yet, but if I understand correctly it should be possible, have a look around in the project and see what you can mix and match :)

Update: If it really is so simple as michael says then you should definitely do that, looks a lot better than what I did.

share|improve this answer
add comment

Your Answer

 
discard

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.