Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Swift SceneKit:使用骨架动画渲染两个SCNNodes时出错_Swift_Scenekit - Fatal编程技术网

Swift SceneKit:使用骨架动画渲染两个SCNNodes时出错

Swift SceneKit:使用骨架动画渲染两个SCNNodes时出错,swift,scenekit,Swift,Scenekit,我尝试使用以下代码加载骨骼动画: let file = Bundle.main.url(forResource: name, withExtension: "dae") let source = SCNSceneSource(url: file!, options: nil) let node = SCNNode() for n in try! (source?.scene(options: nil).rootNode.childNodes)! as [SCNNode] { node.

我尝试使用以下代码加载骨骼动画:

let file = Bundle.main.url(forResource: name, withExtension: "dae")
let source = SCNSceneSource(url: file!, options: nil)
let  node = SCNNode()
for n in try! (source?.scene(options: nil).rootNode.childNodes)! as [SCNNode] {
    node.addChildNode(n)
}
let animationIDs = source?.identifiersOfEntries(withClass: CAAnimation.self)
var animationArray:[CAAnimation] = []
for id in animationIDs!{
    let animation = source?.entryWithIdentifier(id, withClass: CAAnimation.self)
    animationArray.append(animation!)
}
let animationGroup = CAAnimationGroup()
animationGroup.animations = animationArray
animationGroup.duration = 1000
animationGroup.repeatCount = 1000
animationGroup.beginTime = 0
node.addAnimation(animationGroup, forKey: "Animation")
scene.rootNode.addChildNode(node)
首先,它成功地与主英雄节点一起工作。骨骼动画看起来不错。但是,当我创建敌人节点时,我会在加载游戏场景后收到以下错误:

validateFunctionArguments:2665: failed assertion `(length - offset)(10992) must be >= 12304 at buffer binding at index 1 for scn_node[0].'
那有什么问题吗?似乎我仍然可以加载其他没有骨骼动画的模型,并且这些动画仍然可以完美地运行。但这是否意味着SceneKit只允许我们在一个特定的SCNNode上加载骨骼动画

如果你知道这个错误,请帮我解决。。。 如果您对如何从dae文件加载骨骼动画有更好的解决方案,请共享。。。
非常感谢您……

这可能是SceneKit中的错误,也可能是金属验证层的假阳性

您可以尝试或尝试在Xcode之外打开应用程序,以查看骨骼动画是否正常工作以及错误是否无关