【问题标题】:How to store/retrieve SCNNode position?如何存储/检索 SCNNode 位置?
【发布时间】:2023-03-16 13:42:01
【问题描述】:

如何存储和检索 SceneKit SCNNode 位置?

任何 Objective C 代码示例?

非常感谢。

【问题讨论】:

    标签: position store scenekit


    【解决方案1】:

    SCNNode 位置是一个 SCNVector3

    // Storing the position of myNode node into nodePosition variable
    SCNVector3 nodePosition = myNode.position;
    

    但是,如果有动画或物理模拟正在播放,.position 所涉及的节点的属性不会更新。

    相反,您应该为当前位置阅读.presentationNode 属性:

    // Getting the current position of myNode
    // if an animation or physics simulation is in progress
    SCNVector3 nodePosition = myNode.presentationNode.position;
    

    【讨论】:

      猜你喜欢
      • 2018-07-13
      • 2019-07-15
      • 2017-10-27
      • 2019-05-02
      • 2018-12-29
      • 2017-04-15
      • 2018-09-24
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多