SceneKit – DAE文件格式的动画 [英] SceneKit – Animation with DAE file format

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

问题描述

我正在尝试在SceneKit场景上为模型制作动画:

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


  1. 创建一个简单的多维数据集模型并将其导出到 cube.dae

  2. 为立方体创建一个简单的骨架,并使用骨骼制作一个简单的旋转动画并将其导出到animation.dae

  3. 使用Apple样本Fox演示(WWDC 2015),我试图将模型放到场景中,并且可以正常工作

  4. 动画框旋转–可以工作,但是在应用动画后,多维数据集将其位置更改为(0,0,0)

  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)

也许有人使用另一个3d工具成功完成了骨骼动画和SceneKit(Maya ,Blender,3D Max)?

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

将.dae转换为.scn我选择DAE文件,然后在Xcode中编辑->转换为Scenekit场景格式

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

链接

代码:
初始模型节点

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")

在场景上添加模型

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天全站免登陆