SceneKit 获取旋转后的节点位置 [英] SceneKit get node position after rotation
问题描述
例如,我有两个 SCNNode
s 和 SCNBox
几何体一个接一个地定位增加 x
位置属性:
SCNBox(width: 0, height: 0, length: 0.02, chamferRadius: 0)
然后我想使用 rotation
属性和 SCNVector4
旋转第一个,但是当旋转发生时,我希望我的第二个节点跟随第一个节点并根据旋转第一个.
我发现
http://appleengine.hatenablog.com/entry/2017/08/17/154852
For example I have two SCNNode
s 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?
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
这篇关于SceneKit 获取旋转后的节点位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!