iOS Sprite Kit Collision with movement through elements

前端 未结 1 1916
小鲜肉
小鲜肉 2021-01-21 02:54

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

1条回答
  •  旧时难觅i
    2021-01-21 03:40

    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.

    0 讨论(0)
提交回复
热议问题