知道skspritenode已经完全移到另一个skspritenode上了

know that skspritenode has completely moved over another skspritenode

我试图弄清楚一个 SKSpriteNode 是否已经完全迭代另一个 SKSpriteNode这是我到目前为止想出的代码,

if (node.frame.maxY == player.frame.minY) {
    player.physicsBody?.collisionBitMask = collisionTypes.vortex.rawValue
}

我知道这很简单,但我迷路了。

设置两个对象的contactTestBitMask 属性。然后在 didBegin 函数中检测它们何时发生碰撞,然后在 didEnd 函数中检测它们何时停止碰撞

player.physicsBody?.contactTestBitMask = collisionTypes.bullet.rawValue
bullet.physicsBody?.contactTestBitMask = collisionTypes.player.rawValue

func didBegin(_ contact: SKPhysicsContact) {
    //detect your collision and do what you need to do
    //maybe set a bool to true if you have multiple collision types
}

func didEnd(_ contact: SKPhysicsContact) {
    //check that the above collison is the one that ended
    //run appropriate code for end collision
}