Reputation: 111
In my game that uses SpriteKit, I have a line of code used for mapping objects based on the part of the image that is actually an object, instead of all the transparent objects:
bg.physicsBody = [SKPhysicsBody bodyWithTexture:bg.texture size:bg.texture.size];
However, the bodyWithTexture
only works on iOS 8.0. Is there an equivalent to this on 7.1 and below?
Upvotes: 0
Views: 323
Reputation: 3102
bodyWithTexture is only available in iOS 8.0 and later.
Best way to handle this in iOS7.1 is to createCGPath that resembles the outline of your texture and use it to create physics body using bodyWithPolygonFromPath:.
Upvotes: 2