SceneKit get node position after rotation

微笑、不失礼 提交于 2019-12-11 18:30:17

问题


For example I have two SCNNodes with SCNBox geometry positioned one after another increasing x position property:

SCNBox(width: 0, height: 0, length: 0.02, chamferRadius: 0)

Then I want to rotate the first one using rotation property with SCNVector4, but when rotation happens I want my second node to follow the first one and change its position according rotation of the first one.

I found this solution on the web and tried to print node's position, worldPosition and presentation.position but they are all the same value.

Can someone help me to find out how can I obtain node's position after rotation?


回答1:


The position of a node does not change when it rotates. Maybe you could look at connecting the nodes with a physics mechanism such as SCNPhysicsHingeJoint? I found this example which could be useful for your scenario:

http://lepetit-prince.net/ios/?p=3540

Another example:

http://appleengine.hatenablog.com/entry/2017/08/17/154852



来源:https://stackoverflow.com/questions/50466931/scenekit-get-node-position-after-rotation

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