I am able to set the alpha mask of my own custom object in the .sks file of the project, but I'm not sure how to do it programmatically.
Asked
Active
Viewed 1,261 times
1 Answers
6
UPDATE: Just figured it out.
let presetTexture = SKTexture(imageNamed: "YOURIMAGE.png")
presetObject = SKSpriteNode(texture: presetTexture)
presetObject.physicsBody = SKPhysicsBody(texture: presetTexture, size: presetTexture.size())

Rishi Pochiraju
- 165
- 10
-
1Just be careful with this, if your texture has a gap, the body will only make the left side of the texture – Knight0fDragon Jun 26 '17 at 13:37
-
@Knight0fDragon is there any way to make it the whole texture and not just the left side? – Rishi Pochiraju Jun 26 '17 at 18:26