after I upgraded my project to SpriteBuilder 1.1 and Cocos2d v3.1 the following code stopped working:
-(void) touchBegan:(UITouch *)touch withEvent:(UIEvent *)event {
CGPoint touchLocation = [touch locationInNode:_contentNode];
//Not working
if (CGRectContainsPoint([_arbolNegro boundingBox], touchLocation)) {
_mouseJointNode.position = touchLocation;
_mouseJoint = [CCPhysicsJoint connectedSpringJointWithBodyA:_mouseJointNode.physicsBody bodyB:_arbolNegro.physicsBody anchorA:ccp(0, 0) anchorB:ccp(10, 50) restLength:3.f stiffness:3.f damping:0.f];
}
}
I assume that the problem is whit the CGRectContainsPoint
because when I eliminate the if conditional the joint works, but, obviously, without restriction. Any idea?