【问题标题】:SKScene in SceneKitSceneKit 中的 SKScene
【发布时间】: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


    【解决方案1】:

    想通了。

    didMove 没有被调用,因为它在添加到diffuse.contents 时不在响应者链中。

    更新未被调用,因为 SKScene 在以这种方式添加时已暂停。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-12-31
      • 1970-01-01
      • 1970-01-01
      • 2014-05-17
      • 1970-01-01
      • 1970-01-01
      • 2014-08-24
      • 1970-01-01
      相关资源
      最近更新 更多