Physics Debug Draw

  ... the Physics Box2D Extension for AndEngine.

Physics Debug Draw

Postby dario22 » Thu Feb 23, 2012 3:05 pm

is any Box2d debug draw available for GLES2?
dario22
 
Posts: 13
Joined: Thu Dec 15, 2011 8:51 am


Re: Physics Debug Draw

Postby dario22 » Fri Feb 24, 2012 10:50 am

its not work with me :(, ok thank you, I'l wait official version
dario22
 
Posts: 13
Joined: Thu Dec 15, 2011 8:51 am

Re: Physics Debug Draw

Postby RealMayo » Fri Feb 24, 2012 5:07 pm

I'll help you get it working. Let me know what problems you are having :)

Don't bother waiting for the official version, Nicolas does not look like he is going to get around to this anytime soon. I exchanged some emails with him over the last few months, so he is aware of it, but he is not doing anything about it.
User avatar
RealMayo
 
Posts: 1682
Joined: Sat Sep 03, 2011 9:25 pm
Location: Chicago, IL

Re: Physics Debug Draw

Postby RealMayo » Sun Aug 05, 2012 9:43 pm

:information: Note: the following will only work if you are using my copies of AndEngine and box2dPhysicsExtension. To get my copies of these, following the instructions here...
http://www.andengine.org/forums/tutorials/getting-started-with-andengine-t4858.html

I have now updated my Sample Project (at the following link) to contain an example of using this box2D Debug Draw for AndEngine GLES2...
https://github.com/RealMayo/AndEngineSampleProject

All you need to do in that project is in the MainActivity.java file, uncomment line 141 to turn Debug Draw on. And to turn it off, just comment that line out.

You will notice that when you have turned Debug Draw on, and you run the app, you will see the outline of a little "shelf" that the objects collide with. That shelf is defined in MainActivity.java on lines 125 and 132. Then if you turn Debug Draw off, and run the app, you no longer see that shelf, but the objects still interact with it.

Also when you have Debug Draw turned on you will notice that everything has a blue outline around it, even the colorful sprites have a little blue line around them (because the sprites happen to be the exact same size as the bodies they are attached to). This is how Debug Draw works, it exposes the shapes of all bodies on your screen.

Note that in a box2d physics world, collision only occurs between bodies (which is what the blue outlines are showing you). Collision does not occur between sprites. So theoretically you can have a large sprite on a tiny body, and collision will still only occur with the tiny body not the large sprite, and Debug Draw will outline that tiny body, it will not outline your sprite in this case.
User avatar
RealMayo
 
Posts: 1682
Joined: Sat Sep 03, 2011 9:25 pm
Location: Chicago, IL

Re: Physics Debug Draw

Postby Mathew » Sat Aug 11, 2012 12:33 pm

I am wondering in latest andengine there are no classes like Ellipse and PolyLine, required for this debuger?

//edit got them (missing classes)
User avatar
Mathew
 
Posts: 1073
Joined: Sun Jul 31, 2011 2:49 pm
Location: Tarnów, Poland

Re: Physics Debug Draw

Postby nazgee » Sun Nov 04, 2012 12:37 pm

I would recomment using this solution, as it does not require using specific AE branch - comes as an extension.
Dirt Rider Mayhem is PUBLISHED now!
Image
User avatar
nazgee
 
Posts: 524
Joined: Fri Oct 21, 2011 10:31 pm
Location: Poland, Wrocław


Return to Physics Box2D

Who is online

Users browsing this forum: Google [Bot] and 10 guests