物体在ARKit中悬停在地面上方

时间:2017-07-21 06:27:46

标签: swift4 arkit

我把一个物体放在一架飞机上,但它显示在大约10-15点。上面说的飞机。 我应该使用什么代码将放在平面上?

这是代码

let scene = SCNScene(named: "art.scnassets/cup.scn")!

// Set the scene to the view
sceneView.scene = scene

这是当前的场景截图 物体不接触飞机 enter image description here

1 个答案:

答案 0 :(得分:0)

您的问题尚不清楚,但请查看此代码,它可能会对您有所帮助

    // helicopter is object of SCNNode
    let dragonScene = SCNScene(named: "media.scnassets/helicopter.dae")!
    for childNode in dragonScene.rootNode.childNodes {
        // Adding all the child nodes
        helicopter.addChildNode(childNode)
    }

    helicopter.scale = SCNVector3(x: 0.002, y: 0.002, z: 0.002)
    helicopter.position = SCNVector3(x:2.0 , y:0.0, z:-1.6)
    sceneView.scene.rootNode.addChildNode(helicopter)