【问题标题】:How to add custom animations in ios scene kit swift如何在 ios 场景工具包 swift 中添加自定义动画
【发布时间】:2015-10-01 00:31:47
【问题描述】:

我正在使用场景工具包制作游戏,其中一部分掷骰子以生成数字,我在 3DS max 2016 中制作了骰子。我可以在 3DS max 上轻松制作动画,但我将如何将其加载到我的场景?我加载了一个没有动画的骰子,但我不确定如何加载骰子动画以使其滚动。

我打算做的是让 xcode 生成一个数字,并使用该数字从不同的文件中选择一个文件,例如动画1,动画2。假设生成的数字是 2,它将运行动画 2。

谢谢

【问题讨论】:

    标签: ios swift animation xcode6 scenekit


    【解决方案1】:

    您可以使用OpenCOLLADA plugin 从 3DS Max 导出动画。 然后你可以用SCNSceneSource得到动画,比如:

    let src = SCNSceneSource(URL: yourSceneURL, options: nil)
    let node = src.entryWithIdentifier("yourNodeID", withClass: SCNNode.self) as SCNNode
    let animation = node.entryWithIdentifier("yourAnimationID", withClass: CAAnimation.self) as CAAnimation
    

    将动画提取到数组中,并使用 SCNNode 的 addAnimation(forKey:) 将随机一个附加到您的节点

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-01-14
      • 2019-07-06
      • 2017-08-09
      • 2016-10-05
      • 2016-04-30
      • 2015-05-19
      • 1970-01-01
      相关资源
      最近更新 更多