SceneKit动画与.dae [英] SceneKit animation with .dae

查看:3392
本文介绍了SceneKit动画与.dae的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想我的动画在SceneKit场景模型:


  1. 创建一个简单的立方体模型,并导出它cube.dae

  2. 创建多维数据集一个简单的骨架,并用骨头做一个简单的旋转动画,并导出它animation.dae

  3. 使用苹果样品福克斯演示(WWDC 2015),我试图把模型场景和它的作品

  4. 动画盒旋转 - 这是工作,但应用动画完成后,立方体改变其位置(0,0,0)

也许有人已经成功地与骨骼动画和SceneKit使用其他3D工具(玛雅,搅拌机,3D Max中)?

转换.dae到.scn我选择.dae文件,然后X code编辑 - >转换为scenekit现场格式为

链路与模型和动画 HTTPS归档://www.dropbox .COM / S / p4kw3874p70v9zs / ModelsAnimations.zip?DL = 0

code:
初始化模型节点

 让characterScene = SCNScene(命名为:game.scnassets / cube.scn)!
        让characterTopLevelNode = characterScene.rootNode.childNodes [0]
        characterNode.addChildNode(characterTopLevelNode)
        让idleAnimation = CAAnimation.animationWithSceneNamed(game.scnassets / cubeWithMeshSkeletonAnimation.scn)!
        idleAnimation.usesSceneTimeBase = FALSE
        idleAnimation.repeatCount = Float.infinity
        characterNode.addAnimation(idleAnimation,forKey:空闲)

在场景中添加模型

 让现场= SCNScene(命名为:game.scnassets / Level1.scn)!
        gameView.scene =现场
        gameView.playing =真
        gameView.loops =真        scene.rootNode.addChildNode(unrealCharacter.characterNode)
        指定startPosition就让= scene.rootNode.childNodeWithName(起点,递归:真的)!
        unrealCharacter.characterNode.transform = startPosition.transform


解决方案

这是我的错,我需要保存钻机初始模型。 previously我只动画保存钻机。现在动画工作正常。

I'm trying to animate my model on a SceneKit scene:

  1. create a simple cube model and export it to cube.dae
  2. create a simple skeleton for cube and make a simple rotation animation using bones and export it to animation.dae
  3. using Apple sample Fox demo (WWDC 2015), I tried to put model on scene and it works
  4. animate box rotation – it is working but after applying animation, the cube changes its position to (0,0,0)

Maybe someone has succeeded with skeletal animation and SceneKit using another 3d tool (Maya, Blender, 3D Max)?

to convert .dae to .scn I select .dae-file and then in Xcode "editor" --> "convert to scenekit scene format"

link to archive with models and animations https://www.dropbox.com/s/p4kw3874p70v9zs/ModelsAnimations.zip?dl=0

code: init model node

let characterScene = SCNScene(named: "game.scnassets/cube.scn")!
        let characterTopLevelNode = characterScene.rootNode.childNodes[0]
        characterNode.addChildNode(characterTopLevelNode)
        let idleAnimation = CAAnimation.animationWithSceneNamed("game.scnassets/cubeWithMeshSkeletonAnimation.scn")!
        idleAnimation.usesSceneTimeBase = false
        idleAnimation.repeatCount = Float.infinity
        characterNode.addAnimation(idleAnimation, forKey: "idle")

add model on scene

let scene = SCNScene(named: "game.scnassets/Level1.scn")!
        gameView.scene = scene
        gameView.playing = true
        gameView.loops = true

        scene.rootNode.addChildNode(unrealCharacter.characterNode)
        let startPosition = scene.rootNode.childNodeWithName("startingPoint", recursively: true)!
        unrealCharacter.characterNode.transform = startPosition.transform

解决方案

It was my mistake, I need to save rig in initial model. Previously I saved rig only for animation. Now animation works fine.

这篇关于SceneKit动画与.dae的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆