相关疑难解决方法(0)

如何正确使用iOS(Swift)SceneKit SCNSceneRenderer unprojectPoint

我正在使用iOS上的SceneKit开发一些代码,在我的代码中我想确定全局z平面上的x和y坐标,其中z是0.0,x和y是通过点击手势确定的.我的设置如下:

    override func viewDidLoad() {
    super.viewDidLoad()

    // create a new scene
    let scene = SCNScene()

    // create and add a camera to the scene
    let cameraNode = SCNNode()
    let camera = SCNCamera()
    cameraNode.camera = camera
    scene.rootNode.addChildNode(cameraNode)
    // place the camera
    cameraNode.position = SCNVector3(x: 0, y: 0, z: 15)

    // create and add an ambient light to the scene
    let ambientLightNode = SCNNode()
    ambientLightNode.light = SCNLight()
    ambientLightNode.light.type = SCNLightTypeAmbient
    ambientLightNode.light.color = UIColor.darkGrayColor()
    scene.rootNode.addChildNode(ambientLightNode)

    let triangleNode = SCNNode()
    triangleNode.geometry = defineTriangle();
    scene.rootNode.addChildNode(triangleNode) …
Run Code Online (Sandbox Code Playgroud)

3d ios scenekit swift

17
推荐指数
1
解决办法
8293
查看次数

标签 统计

3d ×1

ios ×1

scenekit ×1

swift ×1