施加力后如何获取当前SCNnode位置

How to get current SCNnode position after apply force

我在场景中使用以下方法对我的SCNnode施加恒力,

 func applyForceToDrone(powerApply: Double, isHovering: Bool, gravity : SCNVector3) {
   
        let nodo = arrayDrone[0] // load the first drone in the scene
        guard let lhBlade = nodo.childNode(withName: "Rotor_L_2", recursively: true) else {fatalError()}
        guard let rhBlade = nodo.childNode(withName: "Rotor_R_2", recursively: true) else {fatalError()}
        if isHovering == true {
            print("x gravity = \(gravity.x), \(gravity.y) \(gravity.z)")
            let force = SCNVector3(gravity.x, abs(gravity.y), gravity.z)

            nodo.physicsBody?.applyForce(force, asImpulse: false)
        } else {
            print("apply power  \(powerApply)")
            let positionBladeLH = lhBlade.position
            let positionBladeRH = rhBlade.position
            let force = SCNVector3(0, powerApply, 0)
            nodo.physicsBody?.applyForce(force, at: positionBladeLH, asImpulse: false)
            nodo.physicsBody?.applyForce(force, at: positionBladeRH, asImpulse: false)
            
            let alt = nodo.position.y // position is wrong ... is always the starting position
            print(alt)
        }
    }

我在渲染方法中使用了这个函数来驾驶我的无人机。

func renderer(_ renderer: SCNSceneRenderer, updateAtTime time: TimeInterval) {}

我想在每次施加力时读取节点的当前位置。

如何在渲染器施加力时获取更新位置。

我试过:

let alt = nodo.position.y

但它总是给我节点的起始位置,而不是施加力后的位置。

谢谢

像这样使用节点的表示对象:

而不是

nodo.position.y

使用

nodo.presentation.position.y // local space

nodo.presentation.worldPosition.y // world space