通过元素移动的iOS Sprite Kit Collision [英] iOS Sprite Kit Collision with movement through elements

查看:106
本文介绍了通过元素移动的iOS Sprite Kit Collision的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用Sprite套件的physicsBody进行元素碰撞并仍然允许元素相互穿过?我有兴趣让代表仅在两个边界彼此碰触时才被调用,然后让它们彼此通过:)

Is it possible to use Sprite kit's physicsBody to have element collision and still allow elements to go through each other? I'm interested in having the delegate to be called only when two borders hit each other and then allow them to go through each other afterwards :)

推荐答案

是可以的.您可以注册对象之间的冲突引起的回调,但不会使冲突影响对象本身.

Yes this is possible. You can register for callbacks from collisions between objects but not have the collision affect the object itself.

《 Ray Wenderlich-Sprite Kit》一书在Zombie Conga游戏教程中介绍了如何做到这一点.

The Ray Wenderlich - Sprite Kit book explains how to do this in the Zombie Conga game tutorial.

尝试一下... http://www.raywenderlich.com/42699/spritekit-tutorial-for-beginners

碰撞检测和物理:实现"部分应说明您的需求.

The section called "Collision Detection and Physics: Implementation" should explain what you need.

快速阅读一下,您所关注的两件事就是...

Just had a quick read and the two things you're after are...

contactTestBitMask这是您要为其接收碰撞回调的对象碰撞. collisionBitMask这是物体会碰撞并彼此反弹"的地方.

contactTestBitMask this is which object collisions you want to receive collision callbacks for. collisionBitMask this is which object will collide and "bounce" off each other.

这篇关于通过元素移动的iOS Sprite Kit Collision的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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