I know that this question has been "asked" here but it was not helpful, nor did it cover what I am asking.
That being said, I want to know how to achieve the following:
- I need a
node that has 2 physics bodies: 1) a smaller body (200x200) that represents the node's frame, and 2) a larger body (500x500) that represents an outer perimeter of an area that will act as a "detection" boundary. The outer body will not physically impact colliding objects, it just needs to register that an object has encountered that boundary line. Below is a simple idea of what I am describing:
My initial approach was to use
SKPhysicsBody bodyWithBodies:<NSArray> but that would have just created the overlap body as the smaller rect.
So I figured I would have to create an
SKSpriteNode for the smaller body (the black square), and another
SKSpriteNode for the larger body (the blue square), and add it as a child to the smaller square (or vice versa).
My problem is that I can't seem to get the outer boundary to allow another object to pass through while registering that interaction. The closest I have come is getting a movable node to hit the boundary, then continually get pushed back and forth along the line of the 500x500 boundary as long as I attempt to pass through the boundary. I have been able to make the moving node UNABLE to pass through the 500x500, but this is quite the opposite of what I need.
Here is the code that I am using, perhaps someone can see something I am doing wrong:
// Detection body - 500x500
SKSpriteNode *dbody = [SKSpriteNode spriteNodeWithImageNamed:@"object500"];
dbody.position = CGPointMake(500, 100);