首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >SKScene in SceneKit

SKScene in SceneKit
EN

Stack Overflow用户
提问于 2018-02-26 17:43:07
回答 1查看 553关注 0票数 1

我试图在SKScene中添加一个动画SCNScene。在查看WWDC 2017届会609时,这似乎是可能的。在演示中,代码看起来是这样的..。

代码语言:javascript
复制
//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
  • 在关联的sceneDidLoad文件中添加.swift ()中的精灵

我不能做的事:

  • 使用SKScene的.swift文件中的任何传统方法,如didMove(to)或update()。
  • 在sceneDidLoad()中向场景中的节点添加操作

不知道我错过了什么。该季的主持人展示动画和互动SK内容。

EN

回答 1

Stack Overflow用户

发布于 2018-03-03 12:56:36

弄明白了。

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

由于以这种方式添加SKScene时暂停,所以没有调用update。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/48994144

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档