【问题标题】:How to create a User Generated Animation in SceneKit with .dae (COLLADA) file from Blender如何使用来自 Blender 的 .dae (COLLADA) 文件在 SceneKit 中创建用户生成的动画
【发布时间】:2017-01-02 04:57:29
【问题描述】:

我正在尝试为 SceneKit 中的 SCNScene 对象的特定部分设置动画(在我的情况下,我想为手的手指设置动画)。我很容易从 Blender 中导入带有相应骨骼的 .dae (COLLADA) 文件,以在模型上生成关节。

override func viewDidLoad() {
    super.viewDidLoad()

    var scene = SCNScene(named: "hand.dae")!
    sceneView.scene = scene
    sceneView.allowsCameraControl = true
    sceneView.autoenablesDefaultLighting = true
    sceneView.backgroundColor = UIColor.lightGrayColor()
}

我的目标是在 iOS 上使用用户生成的 0 到 1 之间的值对这些骨骼进行动画处理。想象一个 UISlider,您可以在其中来回滚动并看到特定手指根据滑块的值移动。

这是需要的动画截图

Image with the animation pretended

我尝试通过调用像 Apple 的 Fox 示例这样的动画文件来为模型设置动画:

private var indexFingerAnimation: CAAnimation!
indexFingerAnimation = CAAnimation.animationWithSceneNamed(“move_index_finger.dae”)
indexFingerAnimation = false
indexFingerAnimation = 0.3
indexFingerAnimation = 0.3
indexFingerAnimation = Float.infinity

问题是这是一个全局动画,而不仅仅是食指。此外,它始终是“预定义”动画,而不是由用户输入控制的动画。最终我想混合动画(例如同时移动食指和拇指显示手势)

这可能吗?我很挣扎,因为我不知道如何操作网格的特定部分。我开始研究 MetalKit,但我不清楚这就是解决方案。

任何帮助将不胜感激。

【问题讨论】:

  • “全球”动画是什么意思?你的意思是它针对所有手指而不是一个手指?我不熟悉 Blender,但应该可以导出仅针对给定手指骨骼的动画。如果没有,您可以处理您的动画(使用 CA API)来过滤您想要保留的动画。然后,如果您想在动画中“寻找”,请尝试将速度设置为 0,并在更改 beginTime 后重新添加动画。
  • 感谢东洋公司。 “全局”意味着我一次只能为一个“导出的动画”设置动画。我的挑战是同时移动食指和拇指(或任何其他手指),我不知道该怎么做。我可以单独为骨骼设置动画吗?我该怎么做?

标签: ios swift scenekit scnnode scnscene


【解决方案1】:

我从来没有同时尝试过两个动画 但我可以在 dae 文件中旋转 SCNNode 并带有两个或更多动画

您必须设置枢轴点并将它们组合在一起

【讨论】:

    猜你喜欢
    • 2013-08-03
    • 2015-01-18
    • 2018-10-08
    • 2017-01-19
    • 2014-09-21
    • 2015-08-30
    • 2018-12-22
    • 2014-10-12
    • 2015-06-15
    相关资源
    最近更新 更多