如何在ARKit中获取对象的初始位置

时间:2017-11-02 07:40:39

标签: arkit

为这个简单的问题道歉。我正在查看Apple的增强现实应用程序启动程序代码,并注意到该飞机从位置(0,-0.1,-0.8)开始。我想以编程方式获得(并更改)此职位。我试过了:

override func viewDidAppear(_ animated: Bool) {
    super.viewDidAppear(animated)

    let childNodes = scene.rootNode.childNodes
    let rootNode = scene.rootNode
    let rootNodePresentation = rootNode.presentation
    let ship = childNodes[0]
    let shipPresentation = ship.presentation

    print(rootNode.position) // (0,0,0)
    print(rootNode.worldPosition) // (0,0,0)
    print(rootNode.simdWorldPosition) // (0,0,0)
    print(rootNode.worldTransform) // Identity matrix

    print(rootNodePresentation.position) // (0,0,0)
    print(rootNodePresentation.worldPosition) // (0,0,0)
    print(rootNodePresentation.simdWorldPosition) // (0,0,0)
    print(rootNodePresentation.worldTransform) // Identity matrix

    print(ship.position) // (0,0,0)
    print(ship.worldPosition) // (0,0,0)
    print(ship.simdWorldPosition) // (0,0,0)
    print(ship.worldTransform) // Identity matrix

    print(shipPresentation.position)  // (0,0,0)
    print(shipPresentation.worldPosition) // (0,0,0)
    print(shipPresentation.simdWorldPosition) // (0,0,0)
    print(shipPresentation.worldTransform) // Identity matrix
}

从哪里可以获得船舶节点的值(0,-0.1,-0.8)?

0 个答案:

没有答案