How to get pixel color from SKSpriteNode or from SKTexture?

前端 未结 3 1707
南笙
南笙 2020-12-04 00:16

I want to get precise selection of my object on game map. Object is a sprite with which has some transparent pixels around and I want to test touch location for these transp

3条回答
  •  感动是毒
    2020-12-04 01:04

    In Sprite Kit you don't have access to texture data.

    Instead you'd have to create a bit mask from the image, for example by loading the image as UIImage or CGImage and scanning for all non-transparent pixels.

提交回复
热议问题