为什么在 SceneKit 中不调用 Contact Delegate? [英] Why Contact Delegate isn't called in SceneKit?

查看:50
本文介绍了为什么在 SceneKit 中不调用 Contact Delegate?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一款游戏,但我在 SceneKit 中遇到了联系人委托的问题.我在 ViewController 中声明了正确的委托并使用它来设置委托:

I'm developing a game and I'm facing an issue with the contact delegate in SceneKit. I declared the right delegate in the ViewController and used this to set the delegate:

    sceneView.scene?.physicsWorld.contactDelegate = self

它应该可以工作,事实上,它可以使用 XCode 6.4 但使用测试版 XCode 7 则不行.相同的代码.我的问题是:这里有人能知道一个临时修复方法吗?

It should work and in fact, it does, with the XCode 6.4 but with the beta XCode 7 it doesn't. The same code. My question is: does anyone here is able to know a temporary fix for it?

推荐答案

从 iOS9 开始,你必须明确配置你的physicsBody 的contactTestBitMask"来获取联系人通知.

starting in iOS9, you have to explicitly configure the "contactTestBitMask" of your physicsBody to get contact notifications.

这篇关于为什么在 SceneKit 中不调用 Contact Delegate?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆