Search code examples
iosswiftsprite-kitswift2skphysicsbody

Physics Body for SKLabelNode in SpriteKit?


How do I create a Physics Body for a string of characters in SpriteKit? I don't want it to be a rectangle around the font, I want each letter to be its own shape for contact.


Solution

  • There is not a built in way to create an SKPhysicsBody from a SKLabelNode or characters in a string.

    You might want to look into creating a full image set of alphabetic characters, creating an SKImageNode for each letter in a string, and using + bodyWithTexture: size: to assign each a body based on its texture.