How to get the real position of a sub node in SceneKit after rotation?

放肆的年华 提交于 2019-12-01 16:28:44
mnuages

the position of a node is expressed in its parent coordinate system. Just like for views in UIKIt/AppKit. If you change the frame of a view, the frame of its subviews does not change.

What you want is what we call the world transform of the subnode (i.e. its transform expressed in the coordinate system of the scene's root node).

You can have a look at worldTransform and -convertPosition:toNode:.

The node's position won't change due to physics, that is why you aren't seeing it change. You need to call the node's presentationNode to get the position of the node as it is presented onscreen:

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