我正在抛出一个对象(box2d),但是当我尝试进行碰撞检测时,它在该对象的 CGRect 上给了我错误。见下图
这就是我创建对象主体的方式
-(void) createObject
{
freeBodySprite = [CCSprite spriteWithFile:@"object.png"];
//freeBodySprite.position = ccp(100, 300);
[self addChild:freeBodySprite z:2 tag:6];
CGPoint startPos = CGPointMake(150, 320/1.25);
bodyDef.type = b2_staticBody;
bodyDef.position = [self toMeters:startPos];
bodyDef.userData = freeBodySprite;
float radiusInMeters = ((freeBodySprite.contentSize.width * freeBodySprite.scale/PTM_RATIO) * 0.5f);
shape.m_radius = radiusInMeters;
fixtureDef.shape = &shape;
fixtureDef.density = 0.02f;
fixtureDef.friction = 1.0f;
fixtureDef.restitution = 0.0f;
circularObstacleBody = world->CreateBody(&bodyDef);
stoneFixture = circularObstacleBody->CreateFixture(&fixtureDef);
freeBody = circularObstacleBody;
}