iOS Sprite Kit 通过元素移动进行碰撞

标签 ios iphone sprite

是否可以使用Sprite套件的physicalBody来进行元素碰撞并仍然允许元素相互穿过?我感兴趣的是仅当两个边界相互碰撞时才调用委托(delegate),然后允许它们相互穿过:)

最佳答案

是的,这是可能的。您可以注册对象之间碰撞的回调,但不会让碰撞影响对象本身。

Ray Wenderlich - Sprite Kit 书籍在 Zombie Conga 游戏教程中解释了如何执行此操作。

试试这个... http://www.raywenderlich.com/42699/spritekit-tutorial-for-beginners

名为“碰撞检测和物理:实现”的部分应该解释您需要什么。

刚刚快速阅读了一下,您想要的两件事是......

contactTestBitMask 这是您想要接收碰撞回调的对象碰撞。 collisionBitMask 这是哪个对象将相互碰撞并“反弹”。

关于iOS Sprite Kit 通过元素移动进行碰撞,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22019951/

相关文章:

ios - swift/IOS : Accessing objects that are stored inside NSSet

ios - iOS7 有类似 UIAccessibilityCustomAction 的东西吗?

iphone - 从应用程序启动 iPhone 设置屏幕?

iphone - 有没有非私有(private) API 替代方案?

iphone - 拦截 Store Kit 警报 View

ios - 仅在 UIAlertView 出现时才单击 "Okay"

java - 将多个 Sprite 作为一个旋转(围绕同一原点)

python - 属性错误: 'Mob' object has no attribute '_Sprite__g'

actionscript-3 - ActionScript 3 中的碰撞检测性能如何?

ios - UITableViewCell 中的第三个标签打乱了文本