我最近更新到最新的 Xcode 8 beta 6。我之前是 beta 4(我想)。我试图编译我的代码并得到这个错误:
这是片段:
private func setupPlane() {
// create plane geometry with size and material properties
let myPlane = SCNPlane(width: 10000.0, height: 10000.0)
myPlane.firstMaterial!.diffuse.contents = NSColor.orange.cgColor
myPlane.firstMaterial!.specular.contents = NSColor.white.cgColor
// intialize noe
let planeNode = SCNNode()
// assign plane geometry to the node
planeNode.geometry = myPlane
// rotate -90.0 about the x-axis
let rotMat = SCNMatrix4MakeRotation(-CGFloat(M_PI/3.0), 1.0, 0.0, 0.0)
planeNode.transform = rotMat
planeNode.position = SCNVector3Make(0.0, 0.0, 0.0)
// setup the node's physics body property
planeNode.physicsBody = SCNPhysicsBody(type: .static, shape: SCNPhysicsShape(geometry: myPlane, options: nil))
planeNode.physicsBody!.categoryBitMask = PhysicsMask3DOF.plane.rawValue
// add to scene
sceneView.scene!.rootNode.addChildNode(planeNode)
}
如果我注释掉分配物理体的两行,然后设置其类别,则代码编译时错误为零。我不太清楚错误试图暗示什么。任何建议都非常感谢。