I took Box2d folder from Cocos2d 2.0 and added it to Cocos2d 3.0. Initialization of Box2d worked and got green bounding box also. Game crashed as soon as I create b2body.
Please find my B2Body creation code:
-(void)createBody
{
b2BodyDef bodyDef;
bodyDef.type = b2_dynamicBody;
bodyDef.position.Set((self.position.x)/PTM_RATIO, (self.position.y)/PTM_RATIO);
bodyDef.userData = ((__bridge void*)self);
b2PolygonShape box;
box.SetAsBox( ((sW)/PTM_RATIO), ((sH)/PTM_RATIO));
self.body = self.world->CreateBody(&bodyDef);
}
Here is screenshot when crashed. It always crash..how can I fix ?
« ARC enabled, I set -fno-objc-arc flag for all box2d files...but still crashed.
-(void)createBody
{
b2BodyDef bodyDef;
bodyDef.type = b2_dynamicBody;
bodyDef.position.Set((self.position.x)/PTM_RATIO, (self.position.y)/PTM_RATIO);
bodyDef.userData = ((__bridge void*)self);
b2PolygonShape box;
box.SetAsBox( ((sW)/PTM_RATIO), ((sH)/PTM_RATIO));
self.body = self.world->CreateBody(&bodyDef);
self.body->createFixture(&box, 1);
}