Unity3d: Reading animations in FBX __unity

Source: Internet
Author: User

Get the cut animation clip from the model and modify the animated events that are set up:

1. The animation model suffix is. FBX. In Unity3d, you can display animations in FBX. To load the animationclip in the model, just Assetdatabase.loadassetsatpath (fbxpath,typeof (Animationclip)) is OK.

This loads the animation in the FBX.

void Animload (String fbxpath)
{
Animationclip clip = Assetdatabase.loadassetatpath (Fbxpath, typeof (Animationclip)) as Animationclip;
}

2. Want to load FBX multiple animationclip in the cut. Now that we know the types contained in the FBX we can all load, then we all load it up and get the type we want in the traversal:

void Animload (String fbxpath)
{
object[] Objs = Assetdatabase.loadallassetsatpath (Fbxpath);
foreach (Object o in Objs)
{
If (O is Animationclip)
{
Debug.Log (O.name + "is clip");
}
}
}

3. I want to manipulate other information in Animationclip, you can use animationutility

void Animoperation (Animationclip clip)
{
Animationevent[] EVs = animationutility.getanimationevents (clip);
foreach (Animationevent e in EVs)
{
Debug.Log ("Do something");
}
}


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.