我正在制作一个带有场景套件的游戏,其中一部分掷骰子生成一个数字,我已经在3DS max 2016中制作了骰子。我可以在3DS max上轻松制作动画,但我如何将它加载到我的场景中? 我已经加载了没有动画的骰子,但我不确定如何加载骰子动画以使其滚动。
我打算做的是让xcode生成一个数字,并使用该数字从不同的文件中选择一个文件,例如animation1,animation2。 假设生成的数字是2它将运行animation2。
谢谢
I am making a game with scene kit and part of it rolls some dice to generate a number, i have made the dice in 3DS max 2016. I can make the animations easily on 3DS max, but how would i load it into my scene? I have loaded in a dice with no animations, but I am not sure how I can load the dice animations so that it rolls.
What I intend to do is make xcode generate a number, and with that number is chooses a file out of different files, e.g. animation1, animation2. Say the number generated was 2 it would run animation2.
Thanks
最满意答案
您可以使用OpenCOLLADA插件从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 :)将随机附加到您的节点
You can export animations from 3DS Max with OpenCOLLADA plugin. Then you can get animations with SCNSceneSource, like:
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 CAAnimationExtract animations to array, and attach random one to your node with SCNNode's addAnimation(forKey:)
更多推荐
发布评论