【发布时间】:2019-05-19 16:18:30
【问题描述】:
我是ARKit2 的新手,学习了一些教程和官方文档。
问题
如何将3d 对象添加为SCNNode()?
代码
let artFrame = SCNBox(width: CGFloat(w), height: CGFloat(h), length: 0.002, chamferRadius: 0.02)
artFrame.firstMaterial?.diffuse.contents = imageToDisplay
let artFrameNode = SCNNode(geometry: artFrame)
artFrameNode.physicsBody = SCNPhysicsBody(type: .static, shape: SCNPhysicsShape(geometry: artFrame, options: nil))
artFrameNode.position = SCNVector3Make(Float(x), Float(y), Float(z*3))
sceneView.scene.rootNode.addChildNode(artFrameNode)
根据上面的代码,我在SCNNode 中使用预定义的SCNBox。有什么方法可以使用3d 对象,例如.dae、.obj 而不是SCNBox 并用Image 包装?
我查看了文档,它说您可以将 Mesh objects 添加到 SCNNode :
https://developer.apple.com/documentation/scenekit/scnnode/1419841-init
编辑
每当我添加新的 .dae 并转换为 .scn 时。 Xcode 抛出以下错误:
/Users/paly/Library/Developer/Xcode/DerivedData/sample-bohiilnhthuwfkechtmhscucgccc/Build/Products/Debug-iphoneos/sample.app: resource fork, Finder information, or similar detritus not allowed
Command CodeSign failed with a nonzero exit code
【问题讨论】: