'SCNAnimationPlayer From An Imported animation does not control animation with speed and stop() etc
The following function loads and start an object animation. The problem is player does not change animation speed or it can not stop it.
dump result is like this;
- "player Optional(<SCNAnimationPlayer(0x280a0b580) animation=<SCNAnimation: 0x282d8e6d0, keyPath=(null) duration=2.500000 repeatCount=inf>>)"
func addManAnimation(){
let manScene = SCNScene(named: "man.scn")!.rootNode.childNode(withName: "Armature",recursively: true)!
nodeMan = SCNNode(geometry:manScene.childNode(withName: "man",
recursively: true)!.geometry)
scene.rootNode.addChildNode(manScene)
let player = SCNScene(named: "man.scn")!.rootNode.childNode(withName: "Bone", recursively: true)!.animationPlayer(forKey: "action_container-Armature")
player?.speed = 10
dump("player \(player)")
}
Solution 1:[1]
Now it is OK, I just changed player definition.
let player = manScene.childNode(withName: "Bone",recursively: true)!.animationPlayer(forKey: "action_container-Armature")
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Hope |
