问题
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 :)
回答1:
Yes this is possible. You can register for callbacks from collisions between objects but not have the collision affect the object itself.
The Ray Wenderlich - Sprite Kit book explains how to do this in the Zombie Conga game tutorial.
Try this one... 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 this is which object collisions you want to receive collision callbacks for.
collisionBitMask this is which object will collide and "bounce" off each other.
来源:https://stackoverflow.com/questions/22019951/ios-sprite-kit-collision-with-movement-through-elements