【问题标题】:SpriteKit bodyWithTexture equivalent in iOS 7.1iOS 7.1 中的 SpriteKit bodyWithTexture 等效项
【发布时间】:2014-12-18 16:54:51
【问题描述】:

在我使用 SpriteKit 的游戏中,我有一行代码用于根据图像中实际上是对象的部分而不是所有透明对象来映射对象:

bg.physicsBody = [SKPhysicsBody bodyWithTexture:bg.texture size:bg.texture.size];

但是,bodyWithTexture 仅适用于 iOS 8.0。在 7.1 及以下版本是否有与此等价的功能?

【问题讨论】:

标签: ios ios7 ios8 sprite-kit skphysicsbody


【解决方案1】:

bodyWithTexture 仅适用于 iOS 8.0 及更高版本。

在 iOS7.1 中处理此问题的最佳方法是创建类似于纹理轮廓的CGPath,并使用bodyWithPolygonFromPath: 使用它来创建物理体。

【讨论】:

    猜你喜欢
    • 2013-12-16
    • 1970-01-01
    • 2012-08-03
    • 2011-10-29
    • 2015-11-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多