Skeletal animation with Mixamo in ARCore
Sceneform v 1.7.0 has introduced animation library that makes it possible to run 3D model skeletal animations.
Character animation is difficult and requires a lot of time to develop. Luckily, there is a service called Mixamo that enables you to create, rig and animate 3D characters.
In this article I will show you how to use skeletal animations from Mixamo in your ARCore project.
Working in Mixamo
First, we will need to select a character and skeletal animations for our project. You will need to create an account in Mixamo to be able to download data. Make sure to follow the instructions below:
1. Select a character:
2. Download a selected model using following download settings:
Mixamo character download settings
3. Select and download skeletal animations as separate .FBX files using following settings:
Mixamo animation file settings
Prepare your model
I have tried adding animation files separately when importing sceneform asset to Android Studio project, but the animations would not play. After several attempts, I found this tutorial for Blender and followed the instructions to add all animations in to one .FBX file.
Note: When exporting the final .FBX file from Blender, change “Path Mode“ to copy and toggle “Embedded Textures“ to include model textures.
Blender export settings
Add models to Android Studio project
Put your .FBX file to sampledata folder under app folder and “Import Sceneform Asset” following this instructions.
You will be able to see the list of animations that are available. We will use these names to trigger different animation clips.
List of animations in .sfb file
Add 3D model to the scene
To be able to animate skeletal animation data from the model, we will use SkeletonNode. This node provides mappings between the bones of a skinned Model Renderable and a set of Nodes.
Add TransformableNode as a parent of SkeletonNode to be able to scale and move model in the scene. Check out source code for example.
Play skeletal animation
ModelRenderable object has all animation data for the model. By providing the name of the animation clip, we are able to get AnimationData and play it with help from ModelAnimator object:
animateModel("Character|Kick")