问题
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