Posts

Post not yet marked as solved
1 Replies
544 Views
So this is a weird issue, and I've reproduced it here for your amusement: https://github.com/Lordnibbler/brokenatlas (take a look at GameScene.swift, there are two didMove functions which reproduce the issues) TLDR: I want to use a texture atlas in the Assets.xcassets catalog to load (and eventually animate) an SKSpriteNode for a game. I also want this SKSpriteNode to have an SKPhysicsBody, which should have its shape determined by the SKTexture loaded from the atlas. According to multiple pieces of Apple documentation this is a reasonable use case: https://developer.apple.com/documentation/spritekit/sknode/getting_started_with_physics_bodies https://developer.apple.com/documentation/spritekit/skphysicsbody/shaping_a_physics_body_to_match_a_node_s_graphics All seems well in the simulator, but, when running this code on a real device (both iPad Pro 2018 11" and iPhone 11 Pro), I see a "triangle" shaped physics body. The real kicker is, if I copy the EXACT SAME IMAGE directly into the Assets.xcassets catalog, not in a texture atlas, and load the sprite's texture using an SKTexture directly, the physics body blue outline EXACTLY matches the shape of the sprite image. Why could this be? Xcode 11.5 iOS 13.5
Posted Last updated
.