【发布时间】:2020-09-17 19:21:31
【问题描述】:
我在 Blender 中制作了一个动画并将其移至 Xcode,它是从 .dae 文件转换而来的 通过 Xcode 到 .scn。
我可以在 Xcode 的场景图中播放动画,因为它是在 Blender 中设计的。
我正在加载几何图形和动画并为动画对象创建节点。
我使用 SCNAnimationPlayer() 加载动画。代码如下。
let scene = SCNScene(named: "scene.scn")!
let geometry = scene.rootNode.childNode(withName: "animatedGeo",
recursively:true).geometry!
let animationNode = SCNNode(geometry: geometry)
let armature = scene.rootNode.childNode(withName: "Armature", recursively: true)!
let animationPlayer = armature.animationPlayer(forKey: "action_container-Armature")!
animationNode.addAnimationPlayer(animationPlayer, forKey: "action_container-Armature")
rootNode.addChildNode(animationNode)
我没有以编程方式为 animationPlayer 设置任何内容,因为所有设置看起来 在 Xcode 的场景图窗口中确定。
但是,当场景加载时,我看到 iPhone 屏幕上的动画对象有一个小动作。 看起来只有第一个(父)骨骼动画部分播放。 我找不到在场景图中播放所有动画的原因。
【问题讨论】:
标签: ios swift animation scenekit