【发布时间】:2018-08-06 05:49:02
【问题描述】:
我正在尝试将动画 SKScene 添加到 ARKit 中的 SCNScene。在查看WWDC 2017 session 609 时,这似乎是可能的。在演示文稿中,代码如下所示...
//Get SpriteKit scene
let spriteKitScene = SKScene(fileNamed: "SpriteKitScene")
//Create plane geometry
let plane = SCNPlane(width: 10.0, height: 10.0)
//Set SpriteKit scene on the plane's material
plane.firstMaterial?.diffuse.contents = spriteKitScene
//If material double-sided, SpriteKit scene will show up on both sides of the plane
plane.firstMaterial?.isDoubleSided = true
//Create a SceneKit node for the plane
let sceneKitNode = SCNNode(geometry: plane)
//Add the Scenekit node to the SceneKit scene
scene.rootNode.addChildNode(sceneKitNode)
我可以做的事情:
- 加载 SKScene
- 在关联的 .swift 文件中的 sceneDidLoad() 中添加精灵
我不能做的事情:
- 使用 SKScene 的 .swift 文件中的任何传统方法,例如 didMove(to) 或 update()。
- 在sceneDidLoad()中为场景中的节点添加动作
不知道我错过了什么。本季主持人展示动画和互动的SK内容。
【问题讨论】:
标签: sprite-kit scenekit arkit