Box2d Debug Drawing (tested with cocos2d-x 2.0.2 and above)


#1

Hi guys,

I’ve had a hard time making box2d debug drawing work.
To make it easier for other developers, I’ve shared my solution on github:

Hope it helps :slight_smile:


Can someone please tell me How to enable debug draw on the latest cocos2dx v3
#2

hi, can you evaluate on this. i get the draws, but it doesnt draw any updates, i.e. the objects are not moving.


#3

hans hans wrote:

hi, can you evaluate on this. i get the draws, but it doesnt draw any updates, i.e. the objects are not moving.

actually, here is exactly what im doing.

B2DebugDrawLayer *dDraw;
dDraw= B2DebugDrawLayer::create(world, 32.0f);
this~~>addChild;

the objects appear but dont move. adding dDraw~~>draw() in the update loop doesnt add any movement either:S

edit: the objects r definitely moving in the physics engine, i have confirmed.

@Jeff: I am doing this within the Level class. specifically, the first part, i…e AddChild etc. in my createPhysicalWorld function, and the dDraw->draw within the update loop. any help? ^^