Cocos3d + Box2d – Debug Draw & All you need to know

Forums Programming cocos3d Cocos3d + Box2d – Debug Draw & All you need to know

This topic contains 1 reply, has 1 voice, and was last updated by  FazMan 2 years, 6 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
Author Posts
Author Posts
September 30, 2011 at 7:53 am #235700


I am currently working on a full Cocos3d Box2d Game. I have had a hard time Finding resources on how to integrate them, so here it is. As I figure things out I will post them so all who needs can enjoy. I apologies in advance that my style and skill level is fair from perfect but hopefully this will help the newbie programer like myself :).

Getting Box2d Debug Draw to work on Cocos3d. There is another great sample app in this forum that show how to integrate the two, this will help you see the debug draw.

My Temp Solutions:

Created a b2World in the delegate or in a singleton


@interface AppDelegate : NSObject <UIApplicationDelegate> {
UIWindow* window;
CCNodeController* viewController;
b2World* world;

@property (nonatomic, retain) UIWindow* window;
@property (nonatomic) b2World* world;

@synthesize window, world;

In your CC3Layer add

-(void) draw
[super draw];
AppDelegate* mainDelegate = (AppDelegate *)[[UIApplication sharedApplication]delegate];




and in your add this after you setup your b2world

// Debug Draw functions
m_debugDraw = new GLESDebugDraw( PTM_RATIO);

uint32 flags = 0;
flags += b2DebugDraw::e_shapeBit;
// flags += b2DebugDraw::e_jointBit;
// flags += b2DebugDraw::e_aabbBit;
// flags += b2DebugDraw::e_pairBit;
// flags += b2DebugDraw::e_centerOfMassBit;

AppDelegate* mainDelegate = (AppDelegate *)[[UIApplication sharedApplication]delegate]; = _world;

If someone has a better way I am all ears :)

October 4, 2011 at 5:20 am #349609


Thought? how could i get the debug draw to draw onto CC3Billboard?

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.