I am new to iOS and scenekit. I have an scn scene which contains a rigged model of a human body (skin and skeleton). And two other collada (.dae) files containing a gun and an animation to move hands. How can I attach the gun to the model's hand so that it will rotate with the model's hand while animating.
I have explored SCNSkinner and SCNIKConstraint but couldn't find a way to do it. Currently the gun object's position is static and doesn't move with the hands.
let model = SCNScene(named: "Model.scnassets/model.scn")
let gun = SCNScene(named: "Model.scnassets/gun.dae")
model?.rootNode?.addChildNode(gun)
//fromFile is a custom extension
let animation = SCNAnimation.fromFile(named: "test_with_gun", inDirectory: "Model.scnassets/Animation")
if let anim = animation {
model.addAnimation(anim, forKey: anim.keyPath)
}