由同一个父母很容易使用交叉点,如下所示:
if a.frame.intersects(b.frame) {
print ("yes!")
} else {
print ("no!")
}
我的问题是节点有不同的父节点。我怎么能在这里得到相同的结果?有人可以帮忙吗?
您需要将帧从给定的子节点转换为其公共父节点。也许这可以帮助你https://developer.apple.com/documentation/spritekit/sknode/converting_coordinate_spaces。