4
votes

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.

1
It looks complicated. But first think i would try would be trying. (+ bodyWithTexture:size:) (+ bodyWithTexture:alphaThreshold:size:) You can give it a try.Darvydas

1 Answers

2
votes

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.