简体   繁体   中英

How to rotate/scale/change coordinates of SCNNode programatically in ios

I want to put 3D Spectacles model in human's eye using face/eye detection and it should be movable as face moves like Snapchat does. I have loaded the 3D .obj model in view but I can not able to change the rotation angle, coordinates and zoom value of 3D SCNNode programatically. Can you please let me know how to change all these characteristics of 3D SCNNode.

Thanks in advance.

Should be able to do this programatically. I have used something like this:

        node.scale = SCNVector3Make(scale.x, scale.y, scale.z)
        node.eulerAngles = SCNVector3Make(euler.x, euler.y, euler.z)
        node.position = SCNVector3Make(position.x, position.y, position.z)

        DispatchQueue.main.async {
            SCNTransaction.begin()
            self.scene.rootNode.addChildNode(node)
            SCNTransaction.commit()
        }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM