Is the order of SKNode.nodesAtPoint guaranteed?

旧时模样 提交于 2019-12-24 05:04:30

问题


SKNode has a method nodesAtPoint which returns an array of children nodes that intersect given point. Is the order of the elements in such array deterministic (e.g. by drawing order)?

I could not find an answer in documentation, so probably the answer is "no", but I would like to verify.


回答1:


Nope, Sprite Kit does not take into account z-position when traversing the node-tree (definitely for performance reasons). You can easily see this by adding a few nodes to a scene in-order and then changing the z-positions. The order will always be based on the position of the node within the node-tree, rather than the z-position.



来源:https://stackoverflow.com/questions/31230721/is-the-order-of-sknode-nodesatpoint-guaranteed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!