0
votes

I’m trying to animate specific parts of a SCNScene object in SceneKit (in my case I want to animate fingers of a hand). I import the .dae (COLLADA) file easily from Blender with the respective bones to generate articulation on the model.

override func viewDidLoad() {
    super.viewDidLoad()

    var scene = SCNScene(named: "hand.dae")!
    sceneView.scene = scene
    sceneView.allowsCameraControl = true
    sceneView.autoenablesDefaultLighting = true
    sceneView.backgroundColor = UIColor.lightGrayColor()
}

My goal is to animate those bones on iOS with user generated values between 0 and 1. Imagine a UISlider where you scroll back and forth and see the specific finger move depending on the value of the slider.

This is needed animation screenshot

Image with the animation pretended

I’ve tried animate the model by calling an animation file like the Apple’s Fox example:

private var indexFingerAnimation: CAAnimation!
indexFingerAnimation = CAAnimation.animationWithSceneNamed(“move_index_finger.dae”)
indexFingerAnimation = false
indexFingerAnimation = 0.3
indexFingerAnimation = 0.3
indexFingerAnimation = Float.infinity

The problem is that’s a Global animation instead of just the index finger. Besides it’s always a ‘pre-defined’ animation instead of an animation controlled by user input. Ultimately I want to mix animations (e.g. move index finger and thumb at the same time revealing gestures)

Is this possible? I’m struggling because I can’t figure out how to manipulate specific parts of the mesh. I’m starting to study MetalKit but it’s not clear to me that’s the solution.

Any help would be really appreciated.

1
What do you mean by "Global" animation? Do you mean it targets all fingers instead of just one? I'm not familiar with Blender but it should be possible to export an animation that only targets the bones of a given finger. If not you can process your animations (using CA APIs) to filter the ones you want to keep. Then if you want to "seek" in your animations, try setting the speed to 0 and re-add your animations after changing their beginTime.Toyos
Thanks Toyos. "Global" means that I can only animate one "exported animation" at a time. My challenge is to move, at the same time, the index finger and the thumb (or any other finger) and I can't figure out how to do that. Can I animate a Bone individually? How should I do that?Joao

1 Answers

-1
votes

I have never tried two animations at the same time but I can rotate SCNNode in dae file with two or more animate

You must set pivot point and group them together