GLTFUtility
GLTFUtility copied to clipboard
Can you provide an example scene using GLTF animation
The Readme shows a nice example of animation in progress and the tool does process animations. However, in the code the Animations are only returned to the importer and don't appear to "go anywhere"
Is there an example project or scene using the importer demonstrating animations?
@SimonDarksideJ Did you find out to work this out?
@Siccity Thanks for this awesome work man! I have been working with GLTF for quiet a while now. But first time with Unity. Was surprised that it is not supported natively. With a little bit of search found your repo.
Worked out the basic model loading at runtime stuff. But stuck with animations. Some example would help a lot.
Never mind! Figured it out with some effort.
Followed this article and it was pretty simple to make it work with legacy Animation
API. Couldn't figure out how to make it work with latest Animator
stuff yet, and what works is good enough for me right now.
Here is how you do it...
// Create new mesh.
AnimationClip[] animClips;
GameObject result = Importer.LoadFromFile(Application.dataPath + "/GLTF/BrainStem.glb", new ImportSettings(), out animClips);
// Setup animation, if there is any.
// Taking only the first clip for now. Should be pretty easy to extend it to generalize
if (animClips.Length > 0)
{
Animation anim = result.AddComponent<Animation>();
animClips[0].legacy = true;
anim.AddClip(animClips[0], animClips[0].name);
anim.Play(animClips[0].name);
}
Thanks @Atekihcan , hadn't gotten back to this as I hadn't heard anything back from @Siccity
Potentially the code I've posted using the Playables API in issue #89 is the way to go. I'm also looking for a way of handling animation.