Nodes with negative scale do no participate correctly in physics scene

Originator:stephen.gazzard
Number:rdar://19795916 Date Originated:11-FEB-2015
Status:Open Resolved:
Product:iOS Product Version:XCode: Version 6.1.1 (6A2008a), iOS: 8.1.3 (12B466)
Classification:Other Bug Reproducible:100%
 
Summary:
When running a physics simulation in SpriteKit, if you have a node with a physics body and a negative scale, the node will behave unpredictably in the sprite kit scene. In the gif provided, the static physics body at the bottom has a scale of {-1, -1}, and you can observe that the other node passes through it as if it weren't even there. If the scale were changed to {1, 1} they would behave correctly.

I have seen other behaviours with nodes in this case, such as all dynamic physics bodies being blown out of the scene when there was a {-1, -1} static physics body present, or a dynamic physics body experiencing a giant impulse and flying off the screen when colliding with another physics body whose scale was {-1, -1}

Steps to Reproduce:
1. Create a new game project selecting SpriteKit as the technology
2. Open GameScene.m 
3. Replace all code in the file with this minimal example:

@implementation GameScene

-(void)didMoveToView:(SKView *)view {
    SKSpriteNode *sprite = [SKSpriteNode spriteNodeWithImageNamed:@"Spaceship"];

    sprite.xScale = -0.5;
    sprite.yScale = -0.5;
    sprite.position = CGPointMake(500, 250);
    [self addChild:sprite];
    sprite.physicsBody = [SKPhysicsBody bodyWithRectangleOfSize:sprite.size];
    sprite.physicsBody.dynamic = NO;

    SKSpriteNode *sprite2 = [SKSpriteNode spriteNodeWithImageNamed:@"Spaceship"];

    sprite2.xScale = 0.5;
    sprite2.yScale = 0.5;
    sprite2.position = CGPointMake(500, 500);
    [self addChild:sprite2];
    sprite2.physicsBody = [SKPhysicsBody bodyWithRectangleOfSize:sprite2.size];
    sprite2.physicsBody.dynamic = YES;
}

@end


Expected Results:
I would expect nodes with a negative scale to behave the same as nodes with positive scale, just to be visually reversed.

Actual Results:
In the gif provided, the static physics body at the bottom has a scale of {-1, -1}, and you can observe that the other node passes through it as if it weren't even there. If the scale were changed to {1, 1} they would behave correctly.

I have seen other behaviours with nodes in this case, such as all dynamic physics bodies being blown out of the scene when there was a {-1, -1} static physics body present, or a dynamic physics body experiencing a giant impulse and flying off the screen when colliding with another physics body whose scale was {-1, -1}

Version:
XCode: Version 6.1.1 (6A2008a), iOS: 8.1.3 (12B466)

Notes:
Although the outcome varies, problems occur 100% of the time if the scale is negative.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!