Hey guys i have a question here, How do i create a body that will not have physic function until i press it? i have this code in my init
CCSprite *tail = [CCSprite spriteWithFile:@"Ball.jpg"]; [self addChild:tail z:1]; b2BodyDef tailBodyDef; tailBodyDef.type = b2_dynamicBody; tailBodyDef.position.Set(100/PTM_RATIO, 100/PTM_RATIO); tailBodyDef.userData = tail; tailBody = world->CreateBody(&tailBodyDef); b2CircleShape circle; circle.m_radius = 26.0/PTM_RATIO; b2FixtureDef tailShapeDef; tailShapeDef.shape = &circle; tailShapeDef.density = 1.0f; tailShapeDef.friction = 0.2f; tailShapeDef.restitution = 0.8f; tailBody->CreateFixture(&tailShapeDef); [self schedule: @selector(tick:)];
The ball will drop off the the edge of screen at the start of game, but thats not what i want. i want it to stay at the same position until i press it. is there anyway i could hold the object back until i give some input?
Haven't tried it but toggling the setActive property seems perfect.
Check out the 'activation' section here: http://www.box2d.org/manual.html#_Toc258082973