【发布时间】:2021-02-22 20:18:39
【问题描述】:
对于场景中的2个dae对象,如何在不同的条件下为它们中的每一个启动动画?
由于所有对象都是 SCNScene 的一部分,因此我无法根据条件引用单个对象。它们都正确渲染,但它们同时动画。我们可以设置一个条件来使场景中的特定对象一次动画吗?
提前致谢!
让 idleScene = SCNScene(named: "art.scnassets/Avatar_1.dae")!
// This node will be parent of all the animation models
let node = SCNNode()
// Add all the child nodes to the parent node
for child in idleScene.rootNode.childNodes {
node.addChildNode(child)
}
// Set up some properties
node.position = SCNVector3(hitTestResult.worldTransform.columns.3.x+0.5,hitTestResult.worldTransform.columns.3.y, hitTestResult.worldTransform.columns.3.z)
node.scale = SCNVector3(0.2, 0.2, 0.2)
// Add the node to the scene
sceneView.scene.rootNode.addChildNode(node)
对于另一个头像(Avatar_2.dae),我们如何将它添加到场景中但给出另一个参考名称。
另外,我们如何单独播放/暂停每个头像的动画?
这个是场景的,但有个人头像的吗?
sceneView.scene.isPaused = 播放
【问题讨论】: