Box2d B2DebugDraw updated file for cocos2dx V3

i had been using the b2debugDraw by vinova which can be found at this link Vinova github link ,since the cocos2dx update to V3.x there have been changes to the draw function that needs to be overidden.I see people having problems with it as I did so just thought of sharing it .B2DebugDraw.zip (7.0 KB)

The usage index is unchanged from vinova ,
this->addChild(B2DebugDrawLayer::create(world, PTM_RATIO), 9999);

Hi thanks for sharing this but I tried to make an example without any success. Can you please set me a basic example with a circle or a rectangle.
What modifications I have to do in HelloWorld.cpp ?

HI,
You just follow the steps at the github links ,just replace the two files with the ones here,

Basically inlude these files

“Box2D/Box2D.h”
B2DebugDrawLayer.h"

header files in your Helloworld.h file ,then create a variable for you world ,b2world

b2World* world;

And wherever you initialize your physics it would be something like this,

b2Vec2 gravity;
gravity.Set(0.0f, -10.0f);
world = new b2World(gravity);
world->SetAllowSleeping(true);
world->SetContinuousPhysics(true);
this->addChild(B2DebugDrawLayer::create(world, PTM_RATIO), 9999);

the last line adds the debug draw layer.This works