Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 使用sceneKit在三维模型上添加二维对象_Ios_Swift_Scenekit_Sknode_3d Model - Fatal编程技术网

Ios 使用sceneKit在三维模型上添加二维对象

Ios 使用sceneKit在三维模型上添加二维对象,ios,swift,scenekit,sknode,3d-model,Ios,Swift,Scenekit,Sknode,3d Model,我对SceneKit和SceneKit有些不熟悉,我需要在3d模型上添加2d对象 现在,我已经用skNode添加了2d对象,但该对象不会随3d模型移动 就像旋转或缩放3d模型,当我们在地图上添加注释时,2d对象也需要和3d对象一起移动 这里是三维汽车模型链接,带有注释, 我需要实现这种类型的输出 我已经完成了这类代码,但对象没有移动 let rectangle = SKShapeNode(rect: CGRect(x: 0, y: 0, width: 20, height: 20), c

我对SceneKit和SceneKit有些不熟悉,我需要在3d模型上添加2d对象

现在,我已经用skNode添加了2d对象,但该对象不会随3d模型移动

就像旋转或缩放3d模型,当我们在地图上添加注释时,2d对象也需要和3d对象一起移动

这里是三维汽车模型链接,带有注释, 我需要实现这种类型的输出

我已经完成了这类代码,但对象没有移动

   let rectangle = SKShapeNode(rect: CGRect(x: 0, y: 0, width: 20, height: 20), cornerRadius: 10)
    rectangle.position = CGPoint(x: 50, y: 56)
    rectangle.fillColor = #colorLiteral(red: 0.807843148708344, green: 0.0274509806185961, blue: 0.333333343267441, alpha: 1.0)
    rectangle.strokeColor = #colorLiteral(red: 0.439215689897537, green: 0.0117647061124444, blue: 0.192156866192818, alpha: 1.0)
    rectangle.lineWidth = 5
    rectangle.alpha = 0.4
    let labelNode = SKLabelNode(text: "Hello World")
    labelNode.fontSize = 20
    labelNode.fontName = "San Fransisco"
    labelNode.position = CGPoint(x:100,y:100)
    shipHud.addChild(rectangle)
    shipHud.addChild(labelNode)





    sceneView.overlaySKScene = shipHud// = shipHud


    shipHud.shipHudFlashAlert(alert: "Oh My God!")

请提供帮助

我们可以按SCNNode添加节点。它对我有用

let cubeNode = SCNNode(geometry: SCNBox(width: 2, height: 2, length: 0.1, chamferRadius: 10))
cubeNode.position = SCNVector3(10, -2, -0.2) // SceneKit/AR coordinates are in meters
sceneView.scene?.rootNode.addChildNode(cubeNode)

你的链接不起作用,但你应该在问题的“内部”张贴代码和图片。不要使用链接。好的,我正在编辑问题..使用
SCNBillboardConstraint
而不是覆盖创建节点。