Initializing a SKPhysicsBody using a texture results in a stretched collision boundary.

Originator:jameswpurdy
Number:rdar://22496050 Date Originated:30-Aug-2015 11:24 PM
Status:Duplicate/23329854 Resolved:
Product:iOS Product Version:iOS 9.0 (13A4325c)
Classification: Reproducible:
 
Summary:
In Swift, if a SKPhysicsBody is generated with init(texture texture: SKTexture, size size: CGSize), and the input texture's non transparent sections does not span the width or height of the texture, the resultant collision/physics boundary is stretched.  An example of this might be where if you had a png which had a shape in the middle surrounded by transparency. If you used that png as a texture to initialize a SKPhysicsBody, the boundaries on the resultant physics body would be stretched to span the entire width and height of the original png image.

Steps to Reproduce:
let texture = textureAtlas.textureNamed("sprite_png_image_name")
var character = SKSpriteNode(texture: texture)
let texture = _textureAtlas.textureNamed("collision_png_image_name")
character.physicsBody = SKPhysicsBody(texture: texture, size: character.size)
...

Expected Results:
The collision boundary for the "character" SKSpriteNode should match the silhouette of the non-transparent sections of "texture" and not be stretched.

Actual Results:
The collision boundary for the "character" SKSpriteNode is stretched in the X and Y dimensions by the amount the "texture" png's non-transparent parts of the image do not span the entire width and height of the png's frame.

Version:
iOS 9.0 (13A4325c)

Notes:
Running via Xcode Version 7.0 beta 6 (7A192o). This was not a problem in iOS 8 but is a problem in iOS 9 beta.

Configuration:
iPhone 5

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!