How to create a 3D stroke animation with Maya and ARKit
Published in
3 min readJul 23, 2018
Shout out to Mark Yagos for the guidance.
Part One: Create the stroke animation in Maya
Please note that this tutorial is only for a two-joint animation.
Step One: Create a straight bezier curve
Step Two: Add a NURBS circle and adjust it to an edge of the curve
Step Three: Extrude the cylinder
Step Four: Add joints to the start and end of the cylinder
Step Five: Bind the joints to the surface extrude by selecting both the joints and extrudeSurface1 and doing the following
Step 6: Implement the Animation by pressing S at the correct keyframes and changing the ScaleX of the Joint1.
Step 7: Export the animation as a Dae
Remember to change the bake animation end to the right keyframe.
Part Two: Implement in XCode
Add your scene to XCode as demonstrated in this tutorial and then use the code below.
Biggest lesson from this adventure was that to use a joint-animation you must add both the geometry and the joints to the scene, in order to be able to run the animation.
let scn:SCNScene? = SCNScene(named: YOUR_SCENE);for child in scn!.rootNode.childNodes {node.addChildNode(child)}
scn?.rootNode.enumerateHierarchy({ (child, _) inprint("Child : ", child);for key in child.animationKeys {print("KEY : ", key);let animation = child.animationPlayer(forKey: key)?.animation;animation?.repeatCount = CGFloat(HUGE);animation?.isRemovedOnCompletion = false;self.sceneView.scene.rootNode.addAnimation(animation!, forKey: key);print(animation!)}})
Oscar