android - Get DebugDraw working in JBox2D -


I try to run DebugDraw in a simple Android JBox2D project.

I just expand DebugDraw are this way and put some log output:

  public class extends SimpleDebugView debug Drav {private static final String TAG = "SimpleDebugView "; Public SimpleDebugView () {Super (New OBBViewportTransform ()); } @ Override Public Wide Daipoint (VAC 2 Arjipiint Float Ajiaradiaonskrin, color 3 F Arjerolr) {Logkai (tag, "Draw Point"); } [@Override public void drawSolidPolygon (Vec2] corner, integer vertexCount, Color3f color) {Log.i (TAG, "solid polygon Draw"); } @ Override Public Wide Draw Verbal (VAC2 Center, Float Radius, Color 3F Color) {Log. I (tag, "draw circle"); } @ Override Public Blank Draw Associated Carrel (VAC2 Center, Float Radius, VAC 2 axis, Color 3F Color) {Log. (Tag, "Draw a solid circle"); } @ Override public spaces draw segment (VAC 2 P 1, VAC 2 P 2, Color 3 F color) {Logkai (tag "segment highlighted"); } @ Override Public Wide DrawResform (XF Conversion) {Log. I (tag, "draw transform form"); } @ Override Public Zero Drawing (float x, float y, string s, color 3f color) {Log.i (tag, "string draw"); }}   

I use the new debug class like this:

  [...] mWorld = New World (gravity); MWorld.setAllowSleep (true); SimpleDebugView Simple DebugDown = New LiveDebug View (); Simpledbugdravksetflags (Debgdravki_spbit | DebugDrawki_abbbit | DebugDrawki_parbit | DebugDrawki_senterofmssbit | DebugDrawki_jointbit | DebugDrawki_dinmictribit); MWorld.setDebugDraw (simpleDebugDraw); [...]   

After this I can make body and start physics simulation.

My simulation works, I render my stuff on a canvas based on simulation.

But when I want to use the debug Drav am (because it sometimes makes it easier to debug the modeling of the physical world), do not see the log output, it does not seem to work And even when debugging, breakpoint does not get hit in my SimpleViewviewview. So it seems that the methods are not called at all. Am I using the debug draws wrong?

I got the solution.

I have to tell my physical world that it should attract the debug through:

  mWorld.drawDebugData ();   

Then I step straight (after doing this it is called and my methods are called.

In some way I thought it would be done automatically When I give a DebugDraw, but it was not.

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -