I'm making a SpriteKit game on an iPhone 5. I'm having a weird bug where the physicsBody that is supposed to represent the edges of the screen seems to be too small, and seems to require a bizarre scaling factor to be right.
Here's what seems to be the right way to set a physicsBody to the screen dimensions:
CGRect screenRect = [[UIScreen mainScreen] bounds];
SKPhysicsBody *sBody = [SKPhysicsBody bodyWithEdgeLoopFromRect: screenRect];
[self setPhysicsBody: sBody];
But for me, this is making my other physics bodies collide with an invisible object in the middle of the screen, and making them go right off the edges of the screen without any interference.
However, this:
CGRect screenRect = [[UIScreen mainScreen] bounds];
CGRect x2Rect = CGRectMake(0, 0, screenRect.size.width * 1.5, screenRect.size.height * 1.5);
SKPhysicsBody *sBody = [SKPhysicsBody bodyWithEdgeLoopFromRect:x2Rect];
[self setPhysicsBody: sBody];
Results in a complete absence of weird objects in the middle of the screen, and in other physics bodies colliding with the sides of the screen as expected.
Huh wha?