I need some figures of the walking human for 3D zoetrope, so I want to export 3D data from animating ThirdPersonCharacter at regular intervals ( You can know what the 3D zoetrope is from this video → Pixar's Zoetrope - YouTube ). Now, I’m using “Ethan” and “HumanoidWalk” motion. How can I do it? thanks.
You can export the current skinned mesh of a skinned mesh renderer using SkinnedMeshRenderer.BakeMesh():
using UnityEngine; using UnityEditor; public class BakeAnimationMeshes : MonoBehaviour { public float interval; public Animator animator; public SkinnedMeshRenderer skinnedMeshRenderer; void Start() { float length = animator.GetCurrentAnimatorClipInfo(0)[0].clip.length; Mesh mesh; for (int i = 0; i < length / interval; i++) { animator.Update(interval); mesh = new Mesh(); skinnedMeshRenderer.BakeMesh(mesh); AssetDatabase.CreateAsset(mesh, "Assets/BakedMesh[" + i + "].asset"); } } }
Be careful, this script will spam your Assets folder with one mesh for each step. Without changes I recommend using it only in an otherwise empty project.